@copilotz/chat-ui 0.4.0 → 0.5.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 +1000 -1340
- 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 +943 -1285
- 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 +58 -106
- 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;
|
|
@@ -894,7 +849,7 @@ var arePropsEqual = (prevProps, nextProps) => {
|
|
|
894
849
|
if (prevProps.assistantAvatar !== nextProps.assistantAvatar) return false;
|
|
895
850
|
return true;
|
|
896
851
|
};
|
|
897
|
-
var Message =
|
|
852
|
+
var Message = memo2(({
|
|
898
853
|
message,
|
|
899
854
|
isUser,
|
|
900
855
|
userAvatar,
|
|
@@ -906,12 +861,11 @@ var Message = memo(({
|
|
|
906
861
|
enableCopy = true,
|
|
907
862
|
enableEdit = true,
|
|
908
863
|
enableRegenerate = true,
|
|
909
|
-
|
|
864
|
+
activityDisplay = "full",
|
|
910
865
|
compactMode = false,
|
|
911
866
|
onAction,
|
|
912
867
|
className = "",
|
|
913
|
-
|
|
914
|
-
thinkingLabel = "Thinking...",
|
|
868
|
+
labels,
|
|
915
869
|
showMoreLabel = "Show more",
|
|
916
870
|
showLessLabel = "Show less",
|
|
917
871
|
collapseLongMessages = false,
|
|
@@ -925,10 +879,10 @@ var Message = memo(({
|
|
|
925
879
|
isGrouped = false,
|
|
926
880
|
agentOptions = []
|
|
927
881
|
}) => {
|
|
928
|
-
const [isEditing, setIsEditing] =
|
|
929
|
-
const [editContent, setEditContent] =
|
|
930
|
-
const [showActions, setShowActions] =
|
|
931
|
-
const [copied, setCopied] =
|
|
882
|
+
const [isEditing, setIsEditing] = useState2(false);
|
|
883
|
+
const [editContent, setEditContent] = useState2(message.content);
|
|
884
|
+
const [showActions, setShowActions] = useState2(false);
|
|
885
|
+
const [copied, setCopied] = useState2(false);
|
|
932
886
|
const messageIsUser = isUser ?? message.role === "user";
|
|
933
887
|
const agentSender = !messageIsUser && message.senderAgentId ? agentOptions.find(
|
|
934
888
|
(a) => a.id === message.senderAgentId || a.name.toLowerCase() === (message.senderAgentId ?? "").toLowerCase() || a.name.toLowerCase() === (message.senderName ?? "").toLowerCase()
|
|
@@ -988,20 +942,20 @@ var Message = memo(({
|
|
|
988
942
|
minute: "2-digit"
|
|
989
943
|
});
|
|
990
944
|
};
|
|
991
|
-
return /* @__PURE__ */
|
|
945
|
+
return /* @__PURE__ */ jsxs3(
|
|
992
946
|
"div",
|
|
993
947
|
{
|
|
994
948
|
className: `flex w-full flex-col ${className} max-w-[800px] mx-auto`,
|
|
995
949
|
onMouseEnter: () => setShowActions(true),
|
|
996
950
|
onMouseLeave: () => setShowActions(false),
|
|
997
951
|
children: [
|
|
998
|
-
!isGrouped && /* @__PURE__ */
|
|
999
|
-
showAvatar && /* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
] }) : agentSender ? /* @__PURE__ */
|
|
1003
|
-
agentSender.avatarUrl ? /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
952
|
+
!isGrouped && /* @__PURE__ */ jsxs3("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
|
|
953
|
+
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: [
|
|
954
|
+
/* @__PURE__ */ jsx8(AvatarImage, { src: userAvatar, alt: userName }),
|
|
955
|
+
/* @__PURE__ */ jsx8(AvatarFallback, { className: "bg-primary text-primary-foreground", children: userName.charAt(0).toUpperCase() })
|
|
956
|
+
] }) : agentSender ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
957
|
+
agentSender.avatarUrl ? /* @__PURE__ */ jsx8(AvatarImage, { src: agentSender.avatarUrl, alt: agentSender.name }) : null,
|
|
958
|
+
/* @__PURE__ */ jsx8(
|
|
1005
959
|
AvatarFallback,
|
|
1006
960
|
{
|
|
1007
961
|
style: agentColor ? { backgroundColor: agentColor, color: "white" } : void 0,
|
|
@@ -1009,9 +963,9 @@ var Message = memo(({
|
|
|
1009
963
|
children: getAgentInitials(agentSender.name)
|
|
1010
964
|
}
|
|
1011
965
|
)
|
|
1012
|
-
] }) : /* @__PURE__ */
|
|
1013
|
-
/* @__PURE__ */
|
|
1014
|
-
/* @__PURE__ */
|
|
966
|
+
] }) : /* @__PURE__ */ jsx8(Fragment, { children: assistantAvatar || /* @__PURE__ */ jsx8(AvatarFallback, { className: "bg-secondary text-secondary-foreground", children: "AI" }) }) }) }),
|
|
967
|
+
/* @__PURE__ */ jsxs3("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
|
|
968
|
+
/* @__PURE__ */ jsx8(
|
|
1015
969
|
"span",
|
|
1016
970
|
{
|
|
1017
971
|
className: `font-medium ${compactMode ? "text-sm" : "text-base"}`,
|
|
@@ -1019,13 +973,13 @@ var Message = memo(({
|
|
|
1019
973
|
children: messageIsUser ? userName : resolvedAssistantName
|
|
1020
974
|
}
|
|
1021
975
|
),
|
|
1022
|
-
showTimestamp && /* @__PURE__ */
|
|
1023
|
-
message.isEdited && /* @__PURE__ */
|
|
976
|
+
showTimestamp && /* @__PURE__ */ jsx8("span", { className: "text-xs text-muted-foreground", children: formatTime(message.timestamp) }),
|
|
977
|
+
message.isEdited && /* @__PURE__ */ jsx8(Badge, { variant: "outline", className: "text-xs", children: "editado" })
|
|
1024
978
|
] })
|
|
1025
979
|
] }),
|
|
1026
|
-
/* @__PURE__ */
|
|
1027
|
-
isEditing ? /* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__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: [
|
|
981
|
+
isEditing ? /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
|
|
982
|
+
/* @__PURE__ */ jsx8(
|
|
1029
983
|
Textarea,
|
|
1030
984
|
{
|
|
1031
985
|
value: editContent,
|
|
@@ -1034,40 +988,37 @@ var Message = memo(({
|
|
|
1034
988
|
autoFocus: true
|
|
1035
989
|
}
|
|
1036
990
|
),
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
991
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-2 justify-end", children: [
|
|
992
|
+
/* @__PURE__ */ jsxs3(Button, { variant: "outline", size: "sm", onClick: handleCancelEdit, children: [
|
|
993
|
+
/* @__PURE__ */ jsx8(X, { className: "h-4 w-4 mr-1" }),
|
|
1040
994
|
"Cancelar"
|
|
1041
995
|
] }),
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ jsxs3(Button, { size: "sm", onClick: handleEdit, children: [
|
|
997
|
+
/* @__PURE__ */ jsx8(Check, { className: "h-4 w-4 mr-1" }),
|
|
1044
998
|
"Salvar"
|
|
1045
999
|
] })
|
|
1046
1000
|
] })
|
|
1047
|
-
] }) : /* @__PURE__ */
|
|
1048
|
-
!messageIsUser &&
|
|
1049
|
-
|
|
1001
|
+
] }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1002
|
+
!messageIsUser && /* @__PURE__ */ jsx8(
|
|
1003
|
+
AssistantActivity,
|
|
1050
1004
|
{
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1005
|
+
activity: message.activity,
|
|
1006
|
+
displayMode: activityDisplay,
|
|
1007
|
+
labels
|
|
1054
1008
|
}
|
|
1055
1009
|
),
|
|
1056
|
-
|
|
1057
|
-
/* @__PURE__ */ jsx7(
|
|
1010
|
+
/* @__PURE__ */ jsx8(
|
|
1058
1011
|
StreamingText,
|
|
1059
1012
|
{
|
|
1060
1013
|
content: contentToRender,
|
|
1061
1014
|
isStreaming: message.isStreaming,
|
|
1062
|
-
thinkingLabel,
|
|
1063
1015
|
renderMarkdown: shouldRenderMarkdown,
|
|
1064
1016
|
markdown,
|
|
1065
1017
|
plainTextChunkChars: normalizedChunkChars,
|
|
1066
|
-
contentStyle
|
|
1067
|
-
hideThinkingIndicator: !!message.reasoning
|
|
1018
|
+
contentStyle
|
|
1068
1019
|
}
|
|
1069
1020
|
),
|
|
1070
|
-
canCollapseMessage && /* @__PURE__ */
|
|
1021
|
+
canCollapseMessage && /* @__PURE__ */ jsx8("div", { className: "mt-3", children: /* @__PURE__ */ jsx8(
|
|
1071
1022
|
Button,
|
|
1072
1023
|
{
|
|
1073
1024
|
type: "button",
|
|
@@ -1079,47 +1030,47 @@ var Message = memo(({
|
|
|
1079
1030
|
children: isCollapsed ? showMoreLabel : showLessLabel
|
|
1080
1031
|
}
|
|
1081
1032
|
) }),
|
|
1082
|
-
message.attachments && message.attachments.length > 0 && /* @__PURE__ */
|
|
1033
|
+
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
1034
|
] }),
|
|
1084
|
-
!isEditing && (showActions || copied) && /* @__PURE__ */
|
|
1085
|
-
enableCopy && /* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1035
|
+
!isEditing && (showActions || copied) && /* @__PURE__ */ jsxs3("div", { className: `absolute -top-2 flex gap-1 ${messageIsUser ? "-left-2" : "-right-2"}`, children: [
|
|
1036
|
+
enableCopy && /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1037
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1087
1038
|
Button,
|
|
1088
1039
|
{
|
|
1089
1040
|
variant: "secondary",
|
|
1090
1041
|
size: "icon",
|
|
1091
1042
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1092
1043
|
onClick: handleCopy,
|
|
1093
|
-
children: copied ? /* @__PURE__ */
|
|
1044
|
+
children: copied ? /* @__PURE__ */ jsx8(Check, { className: "h-3 w-3 text-green-500" }) : /* @__PURE__ */ jsx8(Copy, { className: "h-3 w-3" })
|
|
1094
1045
|
}
|
|
1095
1046
|
) }),
|
|
1096
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ jsx8(TooltipContent, { children: copied ? "Copiado!" : "Copiar" })
|
|
1097
1048
|
] }),
|
|
1098
|
-
canEdit && /* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1049
|
+
canEdit && /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1050
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1100
1051
|
Button,
|
|
1101
1052
|
{
|
|
1102
1053
|
variant: "secondary",
|
|
1103
1054
|
size: "icon",
|
|
1104
1055
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1105
1056
|
onClick: handleEdit,
|
|
1106
|
-
children: /* @__PURE__ */
|
|
1057
|
+
children: /* @__PURE__ */ jsx8(Edit, { className: "h-3 w-3" })
|
|
1107
1058
|
}
|
|
1108
1059
|
) }),
|
|
1109
|
-
/* @__PURE__ */
|
|
1060
|
+
/* @__PURE__ */ jsx8(TooltipContent, { children: "Editar" })
|
|
1110
1061
|
] }),
|
|
1111
|
-
canRegenerate && /* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1062
|
+
canRegenerate && /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1063
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1113
1064
|
Button,
|
|
1114
1065
|
{
|
|
1115
1066
|
variant: "secondary",
|
|
1116
1067
|
size: "icon",
|
|
1117
1068
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1118
1069
|
onClick: handleRegenerate,
|
|
1119
|
-
children: /* @__PURE__ */
|
|
1070
|
+
children: /* @__PURE__ */ jsx8(RotateCcw, { className: "h-3 w-3" })
|
|
1120
1071
|
}
|
|
1121
1072
|
) }),
|
|
1122
|
-
/* @__PURE__ */
|
|
1073
|
+
/* @__PURE__ */ jsx8(TooltipContent, { children: "Regenerar" })
|
|
1123
1074
|
] })
|
|
1124
1075
|
] })
|
|
1125
1076
|
] }) })
|
|
@@ -1129,12 +1080,12 @@ var Message = memo(({
|
|
|
1129
1080
|
}, arePropsEqual);
|
|
1130
1081
|
|
|
1131
1082
|
// src/components/chat/Sidebar.tsx
|
|
1132
|
-
import { useState as
|
|
1083
|
+
import { useState as useState5, useRef as useRef4, useEffect as useEffect8 } from "react";
|
|
1133
1084
|
|
|
1134
1085
|
// src/components/ui/input.tsx
|
|
1135
|
-
import { jsx as
|
|
1086
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1136
1087
|
function Input({ className, type, ...props }) {
|
|
1137
|
-
return /* @__PURE__ */
|
|
1088
|
+
return /* @__PURE__ */ jsx9(
|
|
1138
1089
|
"input",
|
|
1139
1090
|
{
|
|
1140
1091
|
type,
|
|
@@ -1151,17 +1102,17 @@ function Input({ className, type, ...props }) {
|
|
|
1151
1102
|
}
|
|
1152
1103
|
|
|
1153
1104
|
// src/components/ui/sidebar.tsx
|
|
1154
|
-
import * as
|
|
1105
|
+
import * as React5 from "react";
|
|
1155
1106
|
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
1156
1107
|
import { cva as cva3 } from "class-variance-authority";
|
|
1157
1108
|
import { PanelLeftIcon } from "lucide-react";
|
|
1158
1109
|
|
|
1159
1110
|
// src/hooks/use-mobile.ts
|
|
1160
|
-
import * as
|
|
1111
|
+
import * as React3 from "react";
|
|
1161
1112
|
var MOBILE_BREAKPOINT = 768;
|
|
1162
1113
|
function useIsMobile() {
|
|
1163
|
-
const [isMobile, setIsMobile] =
|
|
1164
|
-
|
|
1114
|
+
const [isMobile, setIsMobile] = React3.useState(void 0);
|
|
1115
|
+
React3.useEffect(() => {
|
|
1165
1116
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
1166
1117
|
const onChange = () => {
|
|
1167
1118
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -1175,14 +1126,14 @@ function useIsMobile() {
|
|
|
1175
1126
|
|
|
1176
1127
|
// src/components/ui/separator.tsx
|
|
1177
1128
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
1178
|
-
import { jsx as
|
|
1129
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1179
1130
|
function Separator({
|
|
1180
1131
|
className,
|
|
1181
1132
|
orientation = "horizontal",
|
|
1182
1133
|
decorative = true,
|
|
1183
1134
|
...props
|
|
1184
1135
|
}) {
|
|
1185
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ jsx10(
|
|
1186
1137
|
SeparatorPrimitive.Root,
|
|
1187
1138
|
{
|
|
1188
1139
|
"data-slot": "separator",
|
|
@@ -1198,41 +1149,41 @@ function Separator({
|
|
|
1198
1149
|
}
|
|
1199
1150
|
|
|
1200
1151
|
// src/components/ui/sheet.tsx
|
|
1201
|
-
import * as
|
|
1152
|
+
import * as React4 from "react";
|
|
1202
1153
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
1203
1154
|
import { XIcon } from "lucide-react";
|
|
1204
|
-
import { jsx as
|
|
1155
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1205
1156
|
function cleanupBodyStyles() {
|
|
1206
1157
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1207
1158
|
document.body.style.pointerEvents = "";
|
|
1208
1159
|
}
|
|
1209
1160
|
}
|
|
1210
1161
|
function Sheet({ open, onOpenChange, ...props }) {
|
|
1211
|
-
const prevOpenRef =
|
|
1212
|
-
|
|
1162
|
+
const prevOpenRef = React4.useRef(open);
|
|
1163
|
+
React4.useEffect(() => {
|
|
1213
1164
|
if (prevOpenRef.current === true && open === false) {
|
|
1214
1165
|
const timeout = setTimeout(cleanupBodyStyles, 350);
|
|
1215
1166
|
return () => clearTimeout(timeout);
|
|
1216
1167
|
}
|
|
1217
1168
|
prevOpenRef.current = open;
|
|
1218
1169
|
}, [open]);
|
|
1219
|
-
|
|
1170
|
+
React4.useEffect(() => {
|
|
1220
1171
|
return () => {
|
|
1221
1172
|
cleanupBodyStyles();
|
|
1222
1173
|
};
|
|
1223
1174
|
}, []);
|
|
1224
|
-
return /* @__PURE__ */
|
|
1175
|
+
return /* @__PURE__ */ jsx11(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
|
|
1225
1176
|
}
|
|
1226
1177
|
function SheetPortal({
|
|
1227
1178
|
...props
|
|
1228
1179
|
}) {
|
|
1229
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ jsx11(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
1230
1181
|
}
|
|
1231
1182
|
function SheetOverlay({
|
|
1232
1183
|
className,
|
|
1233
1184
|
...props
|
|
1234
1185
|
}) {
|
|
1235
|
-
return /* @__PURE__ */
|
|
1186
|
+
return /* @__PURE__ */ jsx11(
|
|
1236
1187
|
SheetPrimitive.Overlay,
|
|
1237
1188
|
{
|
|
1238
1189
|
"data-slot": "sheet-overlay",
|
|
@@ -1253,9 +1204,9 @@ function SheetContent({
|
|
|
1253
1204
|
side = "right",
|
|
1254
1205
|
...props
|
|
1255
1206
|
}) {
|
|
1256
|
-
return /* @__PURE__ */
|
|
1257
|
-
/* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
1207
|
+
return /* @__PURE__ */ jsxs4(SheetPortal, { children: [
|
|
1208
|
+
/* @__PURE__ */ jsx11(SheetOverlay, {}),
|
|
1209
|
+
/* @__PURE__ */ jsxs4(
|
|
1259
1210
|
SheetPrimitive.Content,
|
|
1260
1211
|
{
|
|
1261
1212
|
"data-slot": "sheet-content",
|
|
@@ -1271,9 +1222,9 @@ function SheetContent({
|
|
|
1271
1222
|
...props,
|
|
1272
1223
|
children: [
|
|
1273
1224
|
children,
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
1276
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__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: [
|
|
1226
|
+
/* @__PURE__ */ jsx11(XIcon, { className: "size-4" }),
|
|
1227
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Close" })
|
|
1277
1228
|
] })
|
|
1278
1229
|
]
|
|
1279
1230
|
}
|
|
@@ -1281,7 +1232,7 @@ function SheetContent({
|
|
|
1281
1232
|
] });
|
|
1282
1233
|
}
|
|
1283
1234
|
function SheetHeader({ className, ...props }) {
|
|
1284
|
-
return /* @__PURE__ */
|
|
1235
|
+
return /* @__PURE__ */ jsx11(
|
|
1285
1236
|
"div",
|
|
1286
1237
|
{
|
|
1287
1238
|
"data-slot": "sheet-header",
|
|
@@ -1294,7 +1245,7 @@ function SheetTitle({
|
|
|
1294
1245
|
className,
|
|
1295
1246
|
...props
|
|
1296
1247
|
}) {
|
|
1297
|
-
return /* @__PURE__ */
|
|
1248
|
+
return /* @__PURE__ */ jsx11(
|
|
1298
1249
|
SheetPrimitive.Title,
|
|
1299
1250
|
{
|
|
1300
1251
|
"data-slot": "sheet-title",
|
|
@@ -1307,7 +1258,7 @@ function SheetDescription({
|
|
|
1307
1258
|
className,
|
|
1308
1259
|
...props
|
|
1309
1260
|
}) {
|
|
1310
|
-
return /* @__PURE__ */
|
|
1261
|
+
return /* @__PURE__ */ jsx11(
|
|
1311
1262
|
SheetPrimitive.Description,
|
|
1312
1263
|
{
|
|
1313
1264
|
"data-slot": "sheet-description",
|
|
@@ -1318,9 +1269,9 @@ function SheetDescription({
|
|
|
1318
1269
|
}
|
|
1319
1270
|
|
|
1320
1271
|
// src/components/ui/skeleton.tsx
|
|
1321
|
-
import { jsx as
|
|
1272
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1322
1273
|
function Skeleton({ className, ...props }) {
|
|
1323
|
-
return /* @__PURE__ */
|
|
1274
|
+
return /* @__PURE__ */ jsx12(
|
|
1324
1275
|
"div",
|
|
1325
1276
|
{
|
|
1326
1277
|
"data-slot": "skeleton",
|
|
@@ -1331,16 +1282,16 @@ function Skeleton({ className, ...props }) {
|
|
|
1331
1282
|
}
|
|
1332
1283
|
|
|
1333
1284
|
// src/components/ui/sidebar.tsx
|
|
1334
|
-
import { jsx as
|
|
1285
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1335
1286
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1336
1287
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
1337
1288
|
var SIDEBAR_WIDTH = "16rem";
|
|
1338
1289
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1339
1290
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
1340
1291
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1341
|
-
var SidebarContext =
|
|
1292
|
+
var SidebarContext = React5.createContext(null);
|
|
1342
1293
|
function useSidebar() {
|
|
1343
|
-
const context =
|
|
1294
|
+
const context = React5.useContext(SidebarContext);
|
|
1344
1295
|
if (!context) {
|
|
1345
1296
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1346
1297
|
}
|
|
@@ -1356,10 +1307,10 @@ function SidebarProvider({
|
|
|
1356
1307
|
...props
|
|
1357
1308
|
}) {
|
|
1358
1309
|
const isMobile = useIsMobile();
|
|
1359
|
-
const [openMobile, setOpenMobile] =
|
|
1360
|
-
const [_open, _setOpen] =
|
|
1310
|
+
const [openMobile, setOpenMobile] = React5.useState(false);
|
|
1311
|
+
const [_open, _setOpen] = React5.useState(defaultOpen);
|
|
1361
1312
|
const open = openProp ?? _open;
|
|
1362
|
-
const setOpen =
|
|
1313
|
+
const setOpen = React5.useCallback(
|
|
1363
1314
|
(value) => {
|
|
1364
1315
|
const openState = typeof value === "function" ? value(open) : value;
|
|
1365
1316
|
if (setOpenProp) {
|
|
@@ -1371,10 +1322,10 @@ function SidebarProvider({
|
|
|
1371
1322
|
},
|
|
1372
1323
|
[setOpenProp, open]
|
|
1373
1324
|
);
|
|
1374
|
-
const toggleSidebar =
|
|
1325
|
+
const toggleSidebar = React5.useCallback(() => {
|
|
1375
1326
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
1376
1327
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
1377
|
-
|
|
1328
|
+
React5.useEffect(() => {
|
|
1378
1329
|
const handleKeyDown = (event) => {
|
|
1379
1330
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1380
1331
|
event.preventDefault();
|
|
@@ -1385,7 +1336,7 @@ function SidebarProvider({
|
|
|
1385
1336
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1386
1337
|
}, [toggleSidebar]);
|
|
1387
1338
|
const state = open ? "expanded" : "collapsed";
|
|
1388
|
-
const contextValue =
|
|
1339
|
+
const contextValue = React5.useMemo(
|
|
1389
1340
|
() => ({
|
|
1390
1341
|
state,
|
|
1391
1342
|
open,
|
|
@@ -1397,7 +1348,7 @@ function SidebarProvider({
|
|
|
1397
1348
|
}),
|
|
1398
1349
|
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
1399
1350
|
);
|
|
1400
|
-
return /* @__PURE__ */
|
|
1351
|
+
return /* @__PURE__ */ jsx13(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx13(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx13(
|
|
1401
1352
|
"div",
|
|
1402
1353
|
{
|
|
1403
1354
|
"data-slot": "sidebar-wrapper",
|
|
@@ -1425,7 +1376,7 @@ function Sidebar({
|
|
|
1425
1376
|
}) {
|
|
1426
1377
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1427
1378
|
if (collapsible === "none") {
|
|
1428
|
-
return /* @__PURE__ */
|
|
1379
|
+
return /* @__PURE__ */ jsx13(
|
|
1429
1380
|
"div",
|
|
1430
1381
|
{
|
|
1431
1382
|
"data-slot": "sidebar",
|
|
@@ -1439,7 +1390,7 @@ function Sidebar({
|
|
|
1439
1390
|
);
|
|
1440
1391
|
}
|
|
1441
1392
|
if (isMobile) {
|
|
1442
|
-
return /* @__PURE__ */
|
|
1393
|
+
return /* @__PURE__ */ jsx13(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs5(
|
|
1443
1394
|
SheetContent,
|
|
1444
1395
|
{
|
|
1445
1396
|
"data-sidebar": "sidebar",
|
|
@@ -1451,16 +1402,16 @@ function Sidebar({
|
|
|
1451
1402
|
},
|
|
1452
1403
|
side,
|
|
1453
1404
|
children: [
|
|
1454
|
-
/* @__PURE__ */
|
|
1455
|
-
/* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */
|
|
1405
|
+
/* @__PURE__ */ jsxs5(SheetHeader, { className: "sr-only", children: [
|
|
1406
|
+
/* @__PURE__ */ jsx13(SheetTitle, { children: "Sidebar" }),
|
|
1407
|
+
/* @__PURE__ */ jsx13(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
1457
1408
|
] }),
|
|
1458
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx13("div", { className: "flex h-full w-full flex-col", children })
|
|
1459
1410
|
]
|
|
1460
1411
|
}
|
|
1461
1412
|
) });
|
|
1462
1413
|
}
|
|
1463
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ jsxs5(
|
|
1464
1415
|
"div",
|
|
1465
1416
|
{
|
|
1466
1417
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
@@ -1470,7 +1421,7 @@ function Sidebar({
|
|
|
1470
1421
|
"data-side": side,
|
|
1471
1422
|
"data-slot": "sidebar",
|
|
1472
1423
|
children: [
|
|
1473
|
-
/* @__PURE__ */
|
|
1424
|
+
/* @__PURE__ */ jsx13(
|
|
1474
1425
|
"div",
|
|
1475
1426
|
{
|
|
1476
1427
|
"data-slot": "sidebar-gap",
|
|
@@ -1482,7 +1433,7 @@ function Sidebar({
|
|
|
1482
1433
|
)
|
|
1483
1434
|
}
|
|
1484
1435
|
),
|
|
1485
|
-
/* @__PURE__ */
|
|
1436
|
+
/* @__PURE__ */ jsx13(
|
|
1486
1437
|
"div",
|
|
1487
1438
|
{
|
|
1488
1439
|
"data-slot": "sidebar-container",
|
|
@@ -1494,7 +1445,7 @@ function Sidebar({
|
|
|
1494
1445
|
className
|
|
1495
1446
|
),
|
|
1496
1447
|
...props,
|
|
1497
|
-
children: /* @__PURE__ */
|
|
1448
|
+
children: /* @__PURE__ */ jsx13(
|
|
1498
1449
|
"div",
|
|
1499
1450
|
{
|
|
1500
1451
|
"data-sidebar": "sidebar",
|
|
@@ -1515,7 +1466,7 @@ function SidebarTrigger({
|
|
|
1515
1466
|
...props
|
|
1516
1467
|
}) {
|
|
1517
1468
|
const { toggleSidebar } = useSidebar();
|
|
1518
|
-
return /* @__PURE__ */
|
|
1469
|
+
return /* @__PURE__ */ jsxs5(
|
|
1519
1470
|
Button,
|
|
1520
1471
|
{
|
|
1521
1472
|
"data-sidebar": "trigger",
|
|
@@ -1529,15 +1480,15 @@ function SidebarTrigger({
|
|
|
1529
1480
|
},
|
|
1530
1481
|
...props,
|
|
1531
1482
|
children: [
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1483
|
+
/* @__PURE__ */ jsx13(PanelLeftIcon, {}),
|
|
1484
|
+
/* @__PURE__ */ jsx13("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
1534
1485
|
]
|
|
1535
1486
|
}
|
|
1536
1487
|
);
|
|
1537
1488
|
}
|
|
1538
1489
|
function SidebarRail({ className, ...props }) {
|
|
1539
1490
|
const { toggleSidebar } = useSidebar();
|
|
1540
|
-
return /* @__PURE__ */
|
|
1491
|
+
return /* @__PURE__ */ jsx13(
|
|
1541
1492
|
"button",
|
|
1542
1493
|
{
|
|
1543
1494
|
"data-sidebar": "rail",
|
|
@@ -1560,7 +1511,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
1560
1511
|
);
|
|
1561
1512
|
}
|
|
1562
1513
|
function SidebarInset({ className, ...props }) {
|
|
1563
|
-
return /* @__PURE__ */
|
|
1514
|
+
return /* @__PURE__ */ jsx13(
|
|
1564
1515
|
"main",
|
|
1565
1516
|
{
|
|
1566
1517
|
"data-slot": "sidebar-inset",
|
|
@@ -1574,7 +1525,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
1574
1525
|
);
|
|
1575
1526
|
}
|
|
1576
1527
|
function SidebarHeader({ className, ...props }) {
|
|
1577
|
-
return /* @__PURE__ */
|
|
1528
|
+
return /* @__PURE__ */ jsx13(
|
|
1578
1529
|
"div",
|
|
1579
1530
|
{
|
|
1580
1531
|
"data-slot": "sidebar-header",
|
|
@@ -1585,7 +1536,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
1585
1536
|
);
|
|
1586
1537
|
}
|
|
1587
1538
|
function SidebarFooter({ className, ...props }) {
|
|
1588
|
-
return /* @__PURE__ */
|
|
1539
|
+
return /* @__PURE__ */ jsx13(
|
|
1589
1540
|
"div",
|
|
1590
1541
|
{
|
|
1591
1542
|
"data-slot": "sidebar-footer",
|
|
@@ -1596,7 +1547,7 @@ function SidebarFooter({ className, ...props }) {
|
|
|
1596
1547
|
);
|
|
1597
1548
|
}
|
|
1598
1549
|
function SidebarContent({ className, ...props }) {
|
|
1599
|
-
return /* @__PURE__ */
|
|
1550
|
+
return /* @__PURE__ */ jsx13(
|
|
1600
1551
|
"div",
|
|
1601
1552
|
{
|
|
1602
1553
|
"data-slot": "sidebar-content",
|
|
@@ -1610,7 +1561,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
1610
1561
|
);
|
|
1611
1562
|
}
|
|
1612
1563
|
function SidebarGroup({ className, ...props }) {
|
|
1613
|
-
return /* @__PURE__ */
|
|
1564
|
+
return /* @__PURE__ */ jsx13(
|
|
1614
1565
|
"div",
|
|
1615
1566
|
{
|
|
1616
1567
|
"data-slot": "sidebar-group",
|
|
@@ -1626,7 +1577,7 @@ function SidebarGroupLabel({
|
|
|
1626
1577
|
...props
|
|
1627
1578
|
}) {
|
|
1628
1579
|
const Comp = asChild ? Slot3 : "div";
|
|
1629
|
-
return /* @__PURE__ */
|
|
1580
|
+
return /* @__PURE__ */ jsx13(
|
|
1630
1581
|
Comp,
|
|
1631
1582
|
{
|
|
1632
1583
|
"data-slot": "sidebar-group-label",
|
|
@@ -1644,7 +1595,7 @@ function SidebarGroupContent({
|
|
|
1644
1595
|
className,
|
|
1645
1596
|
...props
|
|
1646
1597
|
}) {
|
|
1647
|
-
return /* @__PURE__ */
|
|
1598
|
+
return /* @__PURE__ */ jsx13(
|
|
1648
1599
|
"div",
|
|
1649
1600
|
{
|
|
1650
1601
|
"data-slot": "sidebar-group-content",
|
|
@@ -1655,7 +1606,7 @@ function SidebarGroupContent({
|
|
|
1655
1606
|
);
|
|
1656
1607
|
}
|
|
1657
1608
|
function SidebarMenu({ className, ...props }) {
|
|
1658
|
-
return /* @__PURE__ */
|
|
1609
|
+
return /* @__PURE__ */ jsx13(
|
|
1659
1610
|
"ul",
|
|
1660
1611
|
{
|
|
1661
1612
|
"data-slot": "sidebar-menu",
|
|
@@ -1666,7 +1617,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
1666
1617
|
);
|
|
1667
1618
|
}
|
|
1668
1619
|
function SidebarMenuItem({ className, ...props }) {
|
|
1669
|
-
return /* @__PURE__ */
|
|
1620
|
+
return /* @__PURE__ */ jsx13(
|
|
1670
1621
|
"li",
|
|
1671
1622
|
{
|
|
1672
1623
|
"data-slot": "sidebar-menu-item",
|
|
@@ -1707,7 +1658,7 @@ function SidebarMenuButton({
|
|
|
1707
1658
|
}) {
|
|
1708
1659
|
const Comp = asChild ? Slot3 : "button";
|
|
1709
1660
|
const { isMobile, state } = useSidebar();
|
|
1710
|
-
const button = /* @__PURE__ */
|
|
1661
|
+
const button = /* @__PURE__ */ jsx13(
|
|
1711
1662
|
Comp,
|
|
1712
1663
|
{
|
|
1713
1664
|
"data-slot": "sidebar-menu-button",
|
|
@@ -1726,9 +1677,9 @@ function SidebarMenuButton({
|
|
|
1726
1677
|
children: tooltip
|
|
1727
1678
|
};
|
|
1728
1679
|
}
|
|
1729
|
-
return /* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
1680
|
+
return /* @__PURE__ */ jsxs5(Tooltip, { children: [
|
|
1681
|
+
/* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: button }),
|
|
1682
|
+
/* @__PURE__ */ jsx13(
|
|
1732
1683
|
TooltipContent,
|
|
1733
1684
|
{
|
|
1734
1685
|
side: "right",
|
|
@@ -1746,7 +1697,7 @@ function SidebarMenuAction({
|
|
|
1746
1697
|
...props
|
|
1747
1698
|
}) {
|
|
1748
1699
|
const Comp = asChild ? Slot3 : "button";
|
|
1749
|
-
return /* @__PURE__ */
|
|
1700
|
+
return /* @__PURE__ */ jsx13(
|
|
1750
1701
|
Comp,
|
|
1751
1702
|
{
|
|
1752
1703
|
"data-slot": "sidebar-menu-action",
|
|
@@ -1768,10 +1719,10 @@ function SidebarMenuAction({
|
|
|
1768
1719
|
}
|
|
1769
1720
|
|
|
1770
1721
|
// src/components/ui/dialog.tsx
|
|
1771
|
-
import * as
|
|
1722
|
+
import * as React6 from "react";
|
|
1772
1723
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
1773
1724
|
import { XIcon as XIcon2 } from "lucide-react";
|
|
1774
|
-
import { jsx as
|
|
1725
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1775
1726
|
function cleanupBodyStyles2() {
|
|
1776
1727
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1777
1728
|
document.body.style.pointerEvents = "";
|
|
@@ -1782,36 +1733,36 @@ function Dialog({
|
|
|
1782
1733
|
onOpenChange,
|
|
1783
1734
|
...props
|
|
1784
1735
|
}) {
|
|
1785
|
-
const prevOpenRef =
|
|
1786
|
-
|
|
1736
|
+
const prevOpenRef = React6.useRef(open);
|
|
1737
|
+
React6.useEffect(() => {
|
|
1787
1738
|
if (prevOpenRef.current === true && open === false) {
|
|
1788
1739
|
const timeout = setTimeout(cleanupBodyStyles2, 250);
|
|
1789
1740
|
return () => clearTimeout(timeout);
|
|
1790
1741
|
}
|
|
1791
1742
|
prevOpenRef.current = open;
|
|
1792
1743
|
}, [open]);
|
|
1793
|
-
|
|
1744
|
+
React6.useEffect(() => {
|
|
1794
1745
|
return () => {
|
|
1795
1746
|
cleanupBodyStyles2();
|
|
1796
1747
|
};
|
|
1797
1748
|
}, []);
|
|
1798
|
-
return /* @__PURE__ */
|
|
1749
|
+
return /* @__PURE__ */ jsx14(DialogPrimitive.Root, { "data-slot": "dialog", open, onOpenChange, ...props });
|
|
1799
1750
|
}
|
|
1800
1751
|
function DialogTrigger({
|
|
1801
1752
|
...props
|
|
1802
1753
|
}) {
|
|
1803
|
-
return /* @__PURE__ */
|
|
1754
|
+
return /* @__PURE__ */ jsx14(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
1804
1755
|
}
|
|
1805
1756
|
function DialogPortal({
|
|
1806
1757
|
...props
|
|
1807
1758
|
}) {
|
|
1808
|
-
return /* @__PURE__ */
|
|
1759
|
+
return /* @__PURE__ */ jsx14(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
1809
1760
|
}
|
|
1810
1761
|
function DialogOverlay({
|
|
1811
1762
|
className,
|
|
1812
1763
|
...props
|
|
1813
1764
|
}) {
|
|
1814
|
-
return /* @__PURE__ */
|
|
1765
|
+
return /* @__PURE__ */ jsx14(
|
|
1815
1766
|
DialogPrimitive.Overlay,
|
|
1816
1767
|
{
|
|
1817
1768
|
"data-slot": "dialog-overlay",
|
|
@@ -1832,9 +1783,9 @@ function DialogContent({
|
|
|
1832
1783
|
showCloseButton = true,
|
|
1833
1784
|
...props
|
|
1834
1785
|
}) {
|
|
1835
|
-
return /* @__PURE__ */
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1786
|
+
return /* @__PURE__ */ jsxs6(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
1787
|
+
/* @__PURE__ */ jsx14(DialogOverlay, {}),
|
|
1788
|
+
/* @__PURE__ */ jsxs6(
|
|
1838
1789
|
DialogPrimitive.Content,
|
|
1839
1790
|
{
|
|
1840
1791
|
"data-slot": "dialog-content",
|
|
@@ -1846,14 +1797,14 @@ function DialogContent({
|
|
|
1846
1797
|
...props,
|
|
1847
1798
|
children: [
|
|
1848
1799
|
children,
|
|
1849
|
-
showCloseButton && /* @__PURE__ */
|
|
1800
|
+
showCloseButton && /* @__PURE__ */ jsxs6(
|
|
1850
1801
|
DialogPrimitive.Close,
|
|
1851
1802
|
{
|
|
1852
1803
|
"data-slot": "dialog-close",
|
|
1853
1804
|
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
1805
|
children: [
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
1806
|
+
/* @__PURE__ */ jsx14(XIcon2, {}),
|
|
1807
|
+
/* @__PURE__ */ jsx14("span", { className: "sr-only", children: "Close" })
|
|
1857
1808
|
]
|
|
1858
1809
|
}
|
|
1859
1810
|
)
|
|
@@ -1863,7 +1814,7 @@ function DialogContent({
|
|
|
1863
1814
|
] });
|
|
1864
1815
|
}
|
|
1865
1816
|
function DialogHeader({ className, ...props }) {
|
|
1866
|
-
return /* @__PURE__ */
|
|
1817
|
+
return /* @__PURE__ */ jsx14(
|
|
1867
1818
|
"div",
|
|
1868
1819
|
{
|
|
1869
1820
|
"data-slot": "dialog-header",
|
|
@@ -1873,7 +1824,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
1873
1824
|
);
|
|
1874
1825
|
}
|
|
1875
1826
|
function DialogFooter({ className, ...props }) {
|
|
1876
|
-
return /* @__PURE__ */
|
|
1827
|
+
return /* @__PURE__ */ jsx14(
|
|
1877
1828
|
"div",
|
|
1878
1829
|
{
|
|
1879
1830
|
"data-slot": "dialog-footer",
|
|
@@ -1889,7 +1840,7 @@ function DialogTitle({
|
|
|
1889
1840
|
className,
|
|
1890
1841
|
...props
|
|
1891
1842
|
}) {
|
|
1892
|
-
return /* @__PURE__ */
|
|
1843
|
+
return /* @__PURE__ */ jsx14(
|
|
1893
1844
|
DialogPrimitive.Title,
|
|
1894
1845
|
{
|
|
1895
1846
|
"data-slot": "dialog-title",
|
|
@@ -1902,7 +1853,7 @@ function DialogDescription({
|
|
|
1902
1853
|
className,
|
|
1903
1854
|
...props
|
|
1904
1855
|
}) {
|
|
1905
|
-
return /* @__PURE__ */
|
|
1856
|
+
return /* @__PURE__ */ jsx14(
|
|
1906
1857
|
DialogPrimitive.Description,
|
|
1907
1858
|
{
|
|
1908
1859
|
"data-slot": "dialog-description",
|
|
@@ -1913,9 +1864,9 @@ function DialogDescription({
|
|
|
1913
1864
|
}
|
|
1914
1865
|
|
|
1915
1866
|
// src/components/ui/alert-dialog.tsx
|
|
1916
|
-
import * as
|
|
1867
|
+
import * as React7 from "react";
|
|
1917
1868
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
1918
|
-
import { jsx as
|
|
1869
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1919
1870
|
function cleanupBodyStyles3() {
|
|
1920
1871
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1921
1872
|
document.body.style.pointerEvents = "";
|
|
@@ -1926,31 +1877,31 @@ function AlertDialog({
|
|
|
1926
1877
|
onOpenChange,
|
|
1927
1878
|
...props
|
|
1928
1879
|
}) {
|
|
1929
|
-
const prevOpenRef =
|
|
1930
|
-
|
|
1880
|
+
const prevOpenRef = React7.useRef(open);
|
|
1881
|
+
React7.useEffect(() => {
|
|
1931
1882
|
if (prevOpenRef.current === true && open === false) {
|
|
1932
1883
|
const timeout = setTimeout(cleanupBodyStyles3, 250);
|
|
1933
1884
|
return () => clearTimeout(timeout);
|
|
1934
1885
|
}
|
|
1935
1886
|
prevOpenRef.current = open;
|
|
1936
1887
|
}, [open]);
|
|
1937
|
-
|
|
1888
|
+
React7.useEffect(() => {
|
|
1938
1889
|
return () => {
|
|
1939
1890
|
cleanupBodyStyles3();
|
|
1940
1891
|
};
|
|
1941
1892
|
}, []);
|
|
1942
|
-
return /* @__PURE__ */
|
|
1893
|
+
return /* @__PURE__ */ jsx15(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", open, onOpenChange, ...props });
|
|
1943
1894
|
}
|
|
1944
1895
|
function AlertDialogPortal({
|
|
1945
1896
|
...props
|
|
1946
1897
|
}) {
|
|
1947
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ jsx15(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
1948
1899
|
}
|
|
1949
1900
|
function AlertDialogOverlay({
|
|
1950
1901
|
className,
|
|
1951
1902
|
...props
|
|
1952
1903
|
}) {
|
|
1953
|
-
return /* @__PURE__ */
|
|
1904
|
+
return /* @__PURE__ */ jsx15(
|
|
1954
1905
|
AlertDialogPrimitive.Overlay,
|
|
1955
1906
|
{
|
|
1956
1907
|
"data-slot": "alert-dialog-overlay",
|
|
@@ -1969,9 +1920,9 @@ function AlertDialogContent({
|
|
|
1969
1920
|
className,
|
|
1970
1921
|
...props
|
|
1971
1922
|
}) {
|
|
1972
|
-
return /* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
1923
|
+
return /* @__PURE__ */ jsxs7(AlertDialogPortal, { children: [
|
|
1924
|
+
/* @__PURE__ */ jsx15(AlertDialogOverlay, {}),
|
|
1925
|
+
/* @__PURE__ */ jsx15(
|
|
1975
1926
|
AlertDialogPrimitive.Content,
|
|
1976
1927
|
{
|
|
1977
1928
|
"data-slot": "alert-dialog-content",
|
|
@@ -1988,7 +1939,7 @@ function AlertDialogHeader({
|
|
|
1988
1939
|
className,
|
|
1989
1940
|
...props
|
|
1990
1941
|
}) {
|
|
1991
|
-
return /* @__PURE__ */
|
|
1942
|
+
return /* @__PURE__ */ jsx15(
|
|
1992
1943
|
"div",
|
|
1993
1944
|
{
|
|
1994
1945
|
"data-slot": "alert-dialog-header",
|
|
@@ -2001,7 +1952,7 @@ function AlertDialogFooter({
|
|
|
2001
1952
|
className,
|
|
2002
1953
|
...props
|
|
2003
1954
|
}) {
|
|
2004
|
-
return /* @__PURE__ */
|
|
1955
|
+
return /* @__PURE__ */ jsx15(
|
|
2005
1956
|
"div",
|
|
2006
1957
|
{
|
|
2007
1958
|
"data-slot": "alert-dialog-footer",
|
|
@@ -2017,7 +1968,7 @@ function AlertDialogTitle({
|
|
|
2017
1968
|
className,
|
|
2018
1969
|
...props
|
|
2019
1970
|
}) {
|
|
2020
|
-
return /* @__PURE__ */
|
|
1971
|
+
return /* @__PURE__ */ jsx15(
|
|
2021
1972
|
AlertDialogPrimitive.Title,
|
|
2022
1973
|
{
|
|
2023
1974
|
"data-slot": "alert-dialog-title",
|
|
@@ -2030,7 +1981,7 @@ function AlertDialogDescription({
|
|
|
2030
1981
|
className,
|
|
2031
1982
|
...props
|
|
2032
1983
|
}) {
|
|
2033
|
-
return /* @__PURE__ */
|
|
1984
|
+
return /* @__PURE__ */ jsx15(
|
|
2034
1985
|
AlertDialogPrimitive.Description,
|
|
2035
1986
|
{
|
|
2036
1987
|
"data-slot": "alert-dialog-description",
|
|
@@ -2043,7 +1994,7 @@ function AlertDialogAction({
|
|
|
2043
1994
|
className,
|
|
2044
1995
|
...props
|
|
2045
1996
|
}) {
|
|
2046
|
-
return /* @__PURE__ */
|
|
1997
|
+
return /* @__PURE__ */ jsx15(
|
|
2047
1998
|
AlertDialogPrimitive.Action,
|
|
2048
1999
|
{
|
|
2049
2000
|
className: cn(buttonVariants(), className),
|
|
@@ -2055,7 +2006,7 @@ function AlertDialogCancel({
|
|
|
2055
2006
|
className,
|
|
2056
2007
|
...props
|
|
2057
2008
|
}) {
|
|
2058
|
-
return /* @__PURE__ */
|
|
2009
|
+
return /* @__PURE__ */ jsx15(
|
|
2059
2010
|
AlertDialogPrimitive.Cancel,
|
|
2060
2011
|
{
|
|
2061
2012
|
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
@@ -2067,16 +2018,16 @@ function AlertDialogCancel({
|
|
|
2067
2018
|
// src/components/ui/dropdown-menu.tsx
|
|
2068
2019
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2069
2020
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
2070
|
-
import { jsx as
|
|
2021
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2071
2022
|
function DropdownMenu({
|
|
2072
2023
|
...props
|
|
2073
2024
|
}) {
|
|
2074
|
-
return /* @__PURE__ */
|
|
2025
|
+
return /* @__PURE__ */ jsx16(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2075
2026
|
}
|
|
2076
2027
|
function DropdownMenuTrigger({
|
|
2077
2028
|
...props
|
|
2078
2029
|
}) {
|
|
2079
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsx16(
|
|
2080
2031
|
DropdownMenuPrimitive.Trigger,
|
|
2081
2032
|
{
|
|
2082
2033
|
"data-slot": "dropdown-menu-trigger",
|
|
@@ -2089,7 +2040,7 @@ function DropdownMenuContent({
|
|
|
2089
2040
|
sideOffset = 4,
|
|
2090
2041
|
...props
|
|
2091
2042
|
}) {
|
|
2092
|
-
return /* @__PURE__ */
|
|
2043
|
+
return /* @__PURE__ */ jsx16(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx16(
|
|
2093
2044
|
DropdownMenuPrimitive.Content,
|
|
2094
2045
|
{
|
|
2095
2046
|
"data-slot": "dropdown-menu-content",
|
|
@@ -2108,7 +2059,7 @@ function DropdownMenuItem({
|
|
|
2108
2059
|
variant = "default",
|
|
2109
2060
|
...props
|
|
2110
2061
|
}) {
|
|
2111
|
-
return /* @__PURE__ */
|
|
2062
|
+
return /* @__PURE__ */ jsx16(
|
|
2112
2063
|
DropdownMenuPrimitive.Item,
|
|
2113
2064
|
{
|
|
2114
2065
|
"data-slot": "dropdown-menu-item",
|
|
@@ -2127,7 +2078,7 @@ function DropdownMenuLabel({
|
|
|
2127
2078
|
inset,
|
|
2128
2079
|
...props
|
|
2129
2080
|
}) {
|
|
2130
|
-
return /* @__PURE__ */
|
|
2081
|
+
return /* @__PURE__ */ jsx16(
|
|
2131
2082
|
DropdownMenuPrimitive.Label,
|
|
2132
2083
|
{
|
|
2133
2084
|
"data-slot": "dropdown-menu-label",
|
|
@@ -2144,7 +2095,7 @@ function DropdownMenuSeparator({
|
|
|
2144
2095
|
className,
|
|
2145
2096
|
...props
|
|
2146
2097
|
}) {
|
|
2147
|
-
return /* @__PURE__ */
|
|
2098
|
+
return /* @__PURE__ */ jsx16(
|
|
2148
2099
|
DropdownMenuPrimitive.Separator,
|
|
2149
2100
|
{
|
|
2150
2101
|
"data-slot": "dropdown-menu-separator",
|
|
@@ -2176,7 +2127,7 @@ import {
|
|
|
2176
2127
|
Sun,
|
|
2177
2128
|
Palette
|
|
2178
2129
|
} from "lucide-react";
|
|
2179
|
-
import { Fragment as Fragment2, jsx as
|
|
2130
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2180
2131
|
var getInitials = (name, email) => {
|
|
2181
2132
|
if (name) {
|
|
2182
2133
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -2211,27 +2162,27 @@ var UserMenu = ({
|
|
|
2211
2162
|
};
|
|
2212
2163
|
const displayName = getDisplayName(user, labels.guest);
|
|
2213
2164
|
const initials = getInitials(user?.name, user?.email);
|
|
2214
|
-
return /* @__PURE__ */
|
|
2215
|
-
/* @__PURE__ */
|
|
2165
|
+
return /* @__PURE__ */ jsx17(SidebarMenu, { children: /* @__PURE__ */ jsx17(SidebarMenuItem, { children: /* @__PURE__ */ jsxs9(DropdownMenu, { children: [
|
|
2166
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
2216
2167
|
SidebarMenuButton,
|
|
2217
2168
|
{
|
|
2218
2169
|
size: "lg",
|
|
2219
2170
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
2220
2171
|
tooltip: displayName,
|
|
2221
2172
|
children: [
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
user?.avatar && /* @__PURE__ */
|
|
2224
|
-
/* @__PURE__ */
|
|
2173
|
+
/* @__PURE__ */ jsxs9(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2174
|
+
user?.avatar && /* @__PURE__ */ jsx17(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2175
|
+
/* @__PURE__ */ jsx17(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2225
2176
|
] }),
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
2228
|
-
user?.email && /* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
|
|
2178
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate font-medium", children: displayName }),
|
|
2179
|
+
user?.email && /* @__PURE__ */ jsx17("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2229
2180
|
] }),
|
|
2230
|
-
/* @__PURE__ */
|
|
2181
|
+
/* @__PURE__ */ jsx17(ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
|
|
2231
2182
|
]
|
|
2232
2183
|
}
|
|
2233
2184
|
) }),
|
|
2234
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ jsxs9(
|
|
2235
2186
|
DropdownMenuContent,
|
|
2236
2187
|
{
|
|
2237
2188
|
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg",
|
|
@@ -2239,72 +2190,72 @@ var UserMenu = ({
|
|
|
2239
2190
|
align: "end",
|
|
2240
2191
|
sideOffset: 4,
|
|
2241
2192
|
children: [
|
|
2242
|
-
/* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
user?.avatar && /* @__PURE__ */
|
|
2245
|
-
/* @__PURE__ */
|
|
2193
|
+
/* @__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: [
|
|
2194
|
+
/* @__PURE__ */ jsxs9(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2195
|
+
user?.avatar && /* @__PURE__ */ jsx17(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2196
|
+
/* @__PURE__ */ jsx17(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2246
2197
|
] }),
|
|
2247
|
-
/* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
user?.email && /* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
2199
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate font-medium", children: displayName }),
|
|
2200
|
+
user?.email && /* @__PURE__ */ jsx17("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2250
2201
|
] })
|
|
2251
2202
|
] }) }),
|
|
2252
|
-
/* @__PURE__ */
|
|
2253
|
-
callbacks?.onViewProfile && /* @__PURE__ */
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
2203
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2204
|
+
callbacks?.onViewProfile && /* @__PURE__ */ jsxs9(DropdownMenuItem, { onClick: callbacks.onViewProfile, children: [
|
|
2205
|
+
/* @__PURE__ */ jsx17(User, { className: "mr-2 h-4 w-4" }),
|
|
2206
|
+
/* @__PURE__ */ jsx17("span", { children: labels.profile })
|
|
2256
2207
|
] }),
|
|
2257
|
-
callbacks?.onOpenSettings && /* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2259
|
-
/* @__PURE__ */
|
|
2208
|
+
callbacks?.onOpenSettings && /* @__PURE__ */ jsxs9(DropdownMenuItem, { onClick: callbacks.onOpenSettings, children: [
|
|
2209
|
+
/* @__PURE__ */ jsx17(Settings, { className: "mr-2 h-4 w-4" }),
|
|
2210
|
+
/* @__PURE__ */ jsx17("span", { children: labels.settings })
|
|
2260
2211
|
] }),
|
|
2261
2212
|
additionalItems,
|
|
2262
|
-
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */
|
|
2263
|
-
/* @__PURE__ */
|
|
2264
|
-
/* @__PURE__ */
|
|
2213
|
+
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2214
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2215
|
+
/* @__PURE__ */ jsxs9(
|
|
2265
2216
|
DropdownMenuItem,
|
|
2266
2217
|
{
|
|
2267
2218
|
onClick: () => callbacks.onThemeChange?.("light"),
|
|
2268
2219
|
className: currentTheme === "light" ? "bg-accent" : "",
|
|
2269
2220
|
children: [
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
/* @__PURE__ */
|
|
2221
|
+
/* @__PURE__ */ jsx17(Sun, { className: "mr-2 h-4 w-4" }),
|
|
2222
|
+
/* @__PURE__ */ jsx17("span", { children: labels.lightMode })
|
|
2272
2223
|
]
|
|
2273
2224
|
}
|
|
2274
2225
|
),
|
|
2275
|
-
/* @__PURE__ */
|
|
2226
|
+
/* @__PURE__ */ jsxs9(
|
|
2276
2227
|
DropdownMenuItem,
|
|
2277
2228
|
{
|
|
2278
2229
|
onClick: () => callbacks.onThemeChange?.("dark"),
|
|
2279
2230
|
className: currentTheme === "dark" ? "bg-accent" : "",
|
|
2280
2231
|
children: [
|
|
2281
|
-
/* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsx17(Moon, { className: "mr-2 h-4 w-4" }),
|
|
2233
|
+
/* @__PURE__ */ jsx17("span", { children: labels.darkMode })
|
|
2283
2234
|
]
|
|
2284
2235
|
}
|
|
2285
2236
|
),
|
|
2286
|
-
/* @__PURE__ */
|
|
2237
|
+
/* @__PURE__ */ jsxs9(
|
|
2287
2238
|
DropdownMenuItem,
|
|
2288
2239
|
{
|
|
2289
2240
|
onClick: () => callbacks.onThemeChange?.("system"),
|
|
2290
2241
|
className: currentTheme === "system" ? "bg-accent" : "",
|
|
2291
2242
|
children: [
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ jsx17(Palette, { className: "mr-2 h-4 w-4" }),
|
|
2244
|
+
/* @__PURE__ */ jsx17("span", { children: labels.systemTheme })
|
|
2294
2245
|
]
|
|
2295
2246
|
}
|
|
2296
2247
|
)
|
|
2297
2248
|
] }),
|
|
2298
|
-
callbacks?.onLogout && /* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2249
|
+
callbacks?.onLogout && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2250
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2251
|
+
/* @__PURE__ */ jsxs9(
|
|
2301
2252
|
DropdownMenuItem,
|
|
2302
2253
|
{
|
|
2303
2254
|
onClick: callbacks.onLogout,
|
|
2304
2255
|
className: "text-destructive focus:text-destructive focus:bg-destructive/10",
|
|
2305
2256
|
children: [
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2257
|
+
/* @__PURE__ */ jsx17(LogOut, { className: "mr-2 h-4 w-4" }),
|
|
2258
|
+
/* @__PURE__ */ jsx17("span", { children: labels.logout })
|
|
2308
2259
|
]
|
|
2309
2260
|
}
|
|
2310
2261
|
)
|
|
@@ -2316,26 +2267,26 @@ var UserMenu = ({
|
|
|
2316
2267
|
};
|
|
2317
2268
|
|
|
2318
2269
|
// src/components/chat/Sidebar.tsx
|
|
2319
|
-
import { jsx as
|
|
2270
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2320
2271
|
var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
2321
|
-
const [title, setTitle] =
|
|
2322
|
-
const [isOpen, setIsOpen] =
|
|
2272
|
+
const [title, setTitle] = useState5("");
|
|
2273
|
+
const [isOpen, setIsOpen] = useState5(false);
|
|
2323
2274
|
const handleCreate = () => {
|
|
2324
2275
|
onCreateThread(title.trim() || void 0);
|
|
2325
2276
|
setTitle("");
|
|
2326
2277
|
setIsOpen(false);
|
|
2327
2278
|
};
|
|
2328
|
-
return /* @__PURE__ */
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
/* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ jsxs10(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2280
|
+
/* @__PURE__ */ jsx18(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ jsxs10(Button, { className: "w-full justify-start", variant: "outline", children: [
|
|
2281
|
+
/* @__PURE__ */ jsx18(Plus, { className: "mr-2 h-4 w-4" }),
|
|
2331
2282
|
config.labels?.newChat || "New Chat"
|
|
2332
2283
|
] }) }),
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */
|
|
2284
|
+
/* @__PURE__ */ jsxs10(DialogContent, { children: [
|
|
2285
|
+
/* @__PURE__ */ jsxs10(DialogHeader, { children: [
|
|
2286
|
+
/* @__PURE__ */ jsx18(DialogTitle, { children: config.labels?.createNewThread || "New Conversation" }),
|
|
2287
|
+
/* @__PURE__ */ jsx18(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
2337
2288
|
] }),
|
|
2338
|
-
/* @__PURE__ */
|
|
2289
|
+
/* @__PURE__ */ jsx18(
|
|
2339
2290
|
Input,
|
|
2340
2291
|
{
|
|
2341
2292
|
value: title,
|
|
@@ -2345,16 +2296,16 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2345
2296
|
autoFocus: true
|
|
2346
2297
|
}
|
|
2347
2298
|
),
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ jsxs10(DialogFooter, { children: [
|
|
2300
|
+
/* @__PURE__ */ jsx18(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config.labels?.cancel || "Cancel" }),
|
|
2301
|
+
/* @__PURE__ */ jsx18(Button, { onClick: handleCreate, children: config.labels?.create || "Create" })
|
|
2351
2302
|
] })
|
|
2352
2303
|
] })
|
|
2353
2304
|
] });
|
|
2354
2305
|
};
|
|
2355
2306
|
var ThreadInitialsIcon = ({ title }) => {
|
|
2356
2307
|
const initials = title?.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase() || "?";
|
|
2357
|
-
return /* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ jsx18("div", { className: "flex shrink-0 items-center justify-center rounded bg-muted text-[10px] font-medium", children: initials });
|
|
2358
2309
|
};
|
|
2359
2310
|
var Sidebar2 = ({
|
|
2360
2311
|
threads,
|
|
@@ -2373,14 +2324,14 @@ var Sidebar2 = ({
|
|
|
2373
2324
|
userMenuAdditionalItems,
|
|
2374
2325
|
...props
|
|
2375
2326
|
}) => {
|
|
2376
|
-
const [searchQuery, setSearchQuery] =
|
|
2377
|
-
const [showArchived, setShowArchived] =
|
|
2378
|
-
const [deleteThreadId, setDeleteThreadId] =
|
|
2379
|
-
const [editingThreadId, setEditingThreadId] =
|
|
2380
|
-
const [editTitle, setEditTitle] =
|
|
2327
|
+
const [searchQuery, setSearchQuery] = useState5("");
|
|
2328
|
+
const [showArchived, setShowArchived] = useState5(false);
|
|
2329
|
+
const [deleteThreadId, setDeleteThreadId] = useState5(null);
|
|
2330
|
+
const [editingThreadId, setEditingThreadId] = useState5(null);
|
|
2331
|
+
const [editTitle, setEditTitle] = useState5("");
|
|
2381
2332
|
const inputRef = useRef4(null);
|
|
2382
2333
|
const { setOpen } = useSidebar();
|
|
2383
|
-
|
|
2334
|
+
useEffect8(() => {
|
|
2384
2335
|
if (editingThreadId && inputRef.current) {
|
|
2385
2336
|
inputRef.current.focus();
|
|
2386
2337
|
inputRef.current.select();
|
|
@@ -2431,38 +2382,38 @@ var Sidebar2 = ({
|
|
|
2431
2382
|
const cancelEdit = () => {
|
|
2432
2383
|
setEditingThreadId(null);
|
|
2433
2384
|
};
|
|
2434
|
-
return /* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
config.branding?.subtitle && /* @__PURE__ */
|
|
2385
|
+
return /* @__PURE__ */ jsxs10(Sidebar, { collapsible: "icon", ...props, children: [
|
|
2386
|
+
/* @__PURE__ */ jsxs10(SidebarHeader, { children: [
|
|
2387
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
2388
|
+
/* @__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" }) }) }) }),
|
|
2389
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
2390
|
+
/* @__PURE__ */ jsx18("span", { className: "text-sm font-semibold truncate", children: config.branding?.title || "Chat" }),
|
|
2391
|
+
config.branding?.subtitle && /* @__PURE__ */ jsx18("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
2441
2392
|
] })
|
|
2442
2393
|
] }),
|
|
2443
|
-
onCreateThread && /* @__PURE__ */
|
|
2394
|
+
onCreateThread && /* @__PURE__ */ jsx18(
|
|
2444
2395
|
CreateThreadDialog,
|
|
2445
2396
|
{
|
|
2446
2397
|
config,
|
|
2447
2398
|
onCreateThread,
|
|
2448
|
-
trigger: /* @__PURE__ */
|
|
2399
|
+
trigger: /* @__PURE__ */ jsx18(SidebarMenu, { children: /* @__PURE__ */ jsx18(SidebarMenuItem, { children: /* @__PURE__ */ jsxs10(
|
|
2449
2400
|
SidebarMenuButton,
|
|
2450
2401
|
{
|
|
2451
2402
|
size: "lg",
|
|
2452
2403
|
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
2404
|
tooltip: config.labels?.newChat || "New Chat",
|
|
2454
2405
|
children: [
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2406
|
+
/* @__PURE__ */ jsx18(Plus, { className: "size-4" }),
|
|
2407
|
+
/* @__PURE__ */ jsx18("span", { className: "group-data-[collapsible=icon]:hidden", children: config.labels?.newChat || "New Chat" })
|
|
2457
2408
|
]
|
|
2458
2409
|
}
|
|
2459
2410
|
) }) })
|
|
2460
2411
|
}
|
|
2461
2412
|
),
|
|
2462
|
-
/* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2464
|
-
/* @__PURE__ */
|
|
2465
|
-
/* @__PURE__ */
|
|
2413
|
+
/* @__PURE__ */ jsxs10("div", { className: "px-2 py-1 mt-4", children: [
|
|
2414
|
+
/* @__PURE__ */ jsxs10("div", { className: "relative group-data-[collapsible=icon]:hidden", children: [
|
|
2415
|
+
/* @__PURE__ */ jsx18(Search, { className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 select-none opacity-50" }),
|
|
2416
|
+
/* @__PURE__ */ jsx18(
|
|
2466
2417
|
Input,
|
|
2467
2418
|
{
|
|
2468
2419
|
className: "pl-8 h-8 bg-sidebar-accent/50 border-sidebar-border focus-visible:ring-1 focus-visible:ring-sidebar-ring",
|
|
@@ -2472,7 +2423,7 @@ var Sidebar2 = ({
|
|
|
2472
2423
|
}
|
|
2473
2424
|
)
|
|
2474
2425
|
] }),
|
|
2475
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ jsx18("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ jsx18(
|
|
2476
2427
|
Button,
|
|
2477
2428
|
{
|
|
2478
2429
|
variant: "ghost",
|
|
@@ -2480,13 +2431,13 @@ var Sidebar2 = ({
|
|
|
2480
2431
|
className: "h-7 w-7",
|
|
2481
2432
|
onClick: () => setOpen(true),
|
|
2482
2433
|
title: config.labels?.search || "Search",
|
|
2483
|
-
children: /* @__PURE__ */
|
|
2434
|
+
children: /* @__PURE__ */ jsx18(Search, { className: "h-4 w-4" })
|
|
2484
2435
|
}
|
|
2485
2436
|
) })
|
|
2486
2437
|
] })
|
|
2487
2438
|
] }),
|
|
2488
|
-
/* @__PURE__ */
|
|
2489
|
-
threads.some((t) => t.isArchived) && /* @__PURE__ */
|
|
2439
|
+
/* @__PURE__ */ jsxs10(SidebarContent, { children: [
|
|
2440
|
+
threads.some((t) => t.isArchived) && /* @__PURE__ */ jsx18("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsxs10(
|
|
2490
2441
|
Button,
|
|
2491
2442
|
{
|
|
2492
2443
|
variant: "ghost",
|
|
@@ -2494,18 +2445,18 @@ var Sidebar2 = ({
|
|
|
2494
2445
|
onClick: () => setShowArchived(!showArchived),
|
|
2495
2446
|
className: "h-6 text-xs w-full justify-start text-muted-foreground",
|
|
2496
2447
|
children: [
|
|
2497
|
-
/* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ jsx18(Filter, { className: "mr-2 h-3 w-3" }),
|
|
2498
2449
|
showArchived ? config.labels?.hideArchived || "Hide Archived" : config.labels?.showArchived || "Show Archived"
|
|
2499
2450
|
]
|
|
2500
2451
|
}
|
|
2501
2452
|
) }),
|
|
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__ */
|
|
2453
|
+
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs10("div", { className: "px-4 py-8 text-center text-muted-foreground group-data-[collapsible=icon]:hidden", children: [
|
|
2454
|
+
/* @__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" }) }),
|
|
2455
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
|
|
2456
|
+
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs10(SidebarGroup, { className: "mt-2", children: [
|
|
2457
|
+
/* @__PURE__ */ jsx18(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: group }),
|
|
2458
|
+
/* @__PURE__ */ jsx18(SidebarGroupContent, { children: /* @__PURE__ */ jsx18(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */ jsxs10(SidebarMenuItem, { children: [
|
|
2459
|
+
editingThreadId === thread.id ? /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1 px-2 py-1", children: /* @__PURE__ */ jsx18(
|
|
2509
2460
|
Input,
|
|
2510
2461
|
{
|
|
2511
2462
|
ref: inputRef,
|
|
@@ -2518,42 +2469,42 @@ var Sidebar2 = ({
|
|
|
2518
2469
|
onBlur: saveEdit,
|
|
2519
2470
|
className: "h-7 text-sm"
|
|
2520
2471
|
}
|
|
2521
|
-
) }) : /* @__PURE__ */
|
|
2472
|
+
) }) : /* @__PURE__ */ jsxs10(
|
|
2522
2473
|
SidebarMenuButton,
|
|
2523
2474
|
{
|
|
2524
2475
|
isActive: currentThreadId === thread.id,
|
|
2525
2476
|
onClick: () => onSelectThread?.(thread.id),
|
|
2526
2477
|
tooltip: thread.title,
|
|
2527
2478
|
children: [
|
|
2528
|
-
/* @__PURE__ */
|
|
2529
|
-
/* @__PURE__ */
|
|
2530
|
-
thread.isArchived && /* @__PURE__ */
|
|
2479
|
+
/* @__PURE__ */ jsx18(ThreadInitialsIcon, { title: thread.title || "?" }),
|
|
2480
|
+
/* @__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" }) }),
|
|
2481
|
+
thread.isArchived && /* @__PURE__ */ jsx18(Archive, { className: "ml-auto h-3 w-3 opacity-50 group-data-[collapsible=icon]:hidden" })
|
|
2531
2482
|
]
|
|
2532
2483
|
}
|
|
2533
2484
|
),
|
|
2534
|
-
!editingThreadId && /* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
2536
|
-
/* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */
|
|
2485
|
+
!editingThreadId && /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2486
|
+
/* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(SidebarMenuAction, { showOnHover: true, children: [
|
|
2487
|
+
/* @__PURE__ */ jsx18(MoreHorizontal, {}),
|
|
2488
|
+
/* @__PURE__ */ jsx18("span", { className: "sr-only", children: "More" })
|
|
2538
2489
|
] }) }),
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2490
|
+
/* @__PURE__ */ jsxs10(DropdownMenuContent, { className: "w-48", side: "right", align: "start", children: [
|
|
2491
|
+
/* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: () => startEditing(thread), children: [
|
|
2492
|
+
/* @__PURE__ */ jsx18(Edit2, { className: "mr-2 h-4 w-4" }),
|
|
2493
|
+
/* @__PURE__ */ jsx18("span", { children: config.labels?.renameThread || "Rename" })
|
|
2543
2494
|
] }),
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2495
|
+
/* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: () => onArchiveThread?.(thread.id), children: [
|
|
2496
|
+
/* @__PURE__ */ jsx18(Archive, { className: "mr-2 h-4 w-4" }),
|
|
2497
|
+
/* @__PURE__ */ jsx18("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
|
|
2547
2498
|
] }),
|
|
2548
|
-
/* @__PURE__ */
|
|
2549
|
-
/* @__PURE__ */
|
|
2499
|
+
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2500
|
+
/* @__PURE__ */ jsxs10(
|
|
2550
2501
|
DropdownMenuItem,
|
|
2551
2502
|
{
|
|
2552
2503
|
onClick: () => setDeleteThreadId(thread.id),
|
|
2553
2504
|
className: "text-destructive focus:text-destructive",
|
|
2554
2505
|
children: [
|
|
2555
|
-
/* @__PURE__ */
|
|
2556
|
-
/* @__PURE__ */
|
|
2506
|
+
/* @__PURE__ */ jsx18(Trash2, { className: "mr-2 h-4 w-4" }),
|
|
2507
|
+
/* @__PURE__ */ jsx18("span", { children: config.labels?.deleteThread || "Delete" })
|
|
2557
2508
|
]
|
|
2558
2509
|
}
|
|
2559
2510
|
)
|
|
@@ -2562,7 +2513,7 @@ var Sidebar2 = ({
|
|
|
2562
2513
|
] }, thread.id)) }) })
|
|
2563
2514
|
] }, group))
|
|
2564
2515
|
] }),
|
|
2565
|
-
/* @__PURE__ */
|
|
2516
|
+
/* @__PURE__ */ jsx18(SidebarFooter, { children: /* @__PURE__ */ jsx18(
|
|
2566
2517
|
UserMenu,
|
|
2567
2518
|
{
|
|
2568
2519
|
user,
|
|
@@ -2573,15 +2524,15 @@ var Sidebar2 = ({
|
|
|
2573
2524
|
additionalItems: userMenuAdditionalItems
|
|
2574
2525
|
}
|
|
2575
2526
|
) }),
|
|
2576
|
-
/* @__PURE__ */
|
|
2577
|
-
deleteThreadId && /* @__PURE__ */
|
|
2578
|
-
/* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */
|
|
2527
|
+
/* @__PURE__ */ jsx18(SidebarRail, {}),
|
|
2528
|
+
deleteThreadId && /* @__PURE__ */ jsx18(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
2529
|
+
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
2530
|
+
/* @__PURE__ */ jsx18(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
2531
|
+
/* @__PURE__ */ jsx18(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
2581
2532
|
] }),
|
|
2582
|
-
/* @__PURE__ */
|
|
2583
|
-
/* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2533
|
+
/* @__PURE__ */ jsxs10(AlertDialogFooter, { children: [
|
|
2534
|
+
/* @__PURE__ */ jsx18(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
|
|
2535
|
+
/* @__PURE__ */ jsx18(
|
|
2585
2536
|
AlertDialogAction,
|
|
2586
2537
|
{
|
|
2587
2538
|
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
@@ -2595,7 +2546,7 @@ var Sidebar2 = ({
|
|
|
2595
2546
|
};
|
|
2596
2547
|
|
|
2597
2548
|
// src/components/chat/ChatHeader.tsx
|
|
2598
|
-
import
|
|
2549
|
+
import React10 from "react";
|
|
2599
2550
|
import {
|
|
2600
2551
|
Bot as Bot2,
|
|
2601
2552
|
MoreVertical,
|
|
@@ -2611,10 +2562,10 @@ import {
|
|
|
2611
2562
|
} from "lucide-react";
|
|
2612
2563
|
|
|
2613
2564
|
// src/components/chat/AgentSelectors.tsx
|
|
2614
|
-
import { memo as
|
|
2565
|
+
import { memo as memo3, useMemo as useMemo4 } from "react";
|
|
2615
2566
|
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 =
|
|
2567
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2568
|
+
var ParticipantsSelector = memo3(({
|
|
2618
2569
|
agents,
|
|
2619
2570
|
participantIds,
|
|
2620
2571
|
onParticipantsChange,
|
|
@@ -2622,8 +2573,8 @@ var ParticipantsSelector = memo2(({
|
|
|
2622
2573
|
maxVisible = 3,
|
|
2623
2574
|
disabled = false
|
|
2624
2575
|
}) => {
|
|
2625
|
-
const agentsWithColors =
|
|
2626
|
-
const selectedAgents =
|
|
2576
|
+
const agentsWithColors = useMemo4(() => assignAgentColors(agents), [agents]);
|
|
2577
|
+
const selectedAgents = useMemo4(
|
|
2627
2578
|
() => agentsWithColors.filter((a) => participantIds.includes(a.id)),
|
|
2628
2579
|
[agentsWithColors, participantIds]
|
|
2629
2580
|
);
|
|
@@ -2641,19 +2592,19 @@ var ParticipantsSelector = memo2(({
|
|
|
2641
2592
|
};
|
|
2642
2593
|
const visibleAgents = selectedAgents.slice(0, maxVisible);
|
|
2643
2594
|
const hiddenCount = selectedAgents.length - maxVisible;
|
|
2644
|
-
return /* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2595
|
+
return /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
|
|
2596
|
+
/* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
2646
2597
|
Button,
|
|
2647
2598
|
{
|
|
2648
2599
|
variant: "ghost",
|
|
2649
2600
|
className: "h-9 px-2 gap-1.5 text-sm hover:bg-accent/50",
|
|
2650
2601
|
disabled,
|
|
2651
2602
|
children: [
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
/* @__PURE__ */
|
|
2603
|
+
/* @__PURE__ */ jsx19(Users, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2604
|
+
/* @__PURE__ */ jsx19("div", { className: "flex items-center gap-1", children: visibleAgents.length > 0 ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
2605
|
+
/* @__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: [
|
|
2606
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2607
|
+
/* @__PURE__ */ jsx19(
|
|
2657
2608
|
AvatarFallback,
|
|
2658
2609
|
{
|
|
2659
2610
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2662,34 +2613,34 @@ var ParticipantsSelector = memo2(({
|
|
|
2662
2613
|
}
|
|
2663
2614
|
)
|
|
2664
2615
|
] }, agent.id)) }),
|
|
2665
|
-
hiddenCount > 0 && /* @__PURE__ */
|
|
2616
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxs11("span", { className: "text-xs text-muted-foreground", children: [
|
|
2666
2617
|
"+",
|
|
2667
2618
|
hiddenCount
|
|
2668
2619
|
] })
|
|
2669
|
-
] }) : /* @__PURE__ */
|
|
2670
|
-
/* @__PURE__ */
|
|
2620
|
+
] }) : /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: label }) }),
|
|
2621
|
+
/* @__PURE__ */ jsx19(ChevronDown2, { className: "h-3 w-3 opacity-50" })
|
|
2671
2622
|
]
|
|
2672
2623
|
}
|
|
2673
2624
|
) }),
|
|
2674
|
-
/* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */
|
|
2625
|
+
/* @__PURE__ */ jsxs11(DropdownMenuContent, { align: "start", className: "w-[260px]", children: [
|
|
2626
|
+
/* @__PURE__ */ jsxs11(DropdownMenuLabel, { className: "flex items-center justify-between", children: [
|
|
2627
|
+
/* @__PURE__ */ jsx19("span", { children: "Participants" }),
|
|
2628
|
+
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */ jsx19(Button, { variant: "ghost", size: "sm", className: "h-6 text-xs", onClick: selectAll, children: "Select All" })
|
|
2678
2629
|
] }),
|
|
2679
|
-
/* @__PURE__ */
|
|
2630
|
+
/* @__PURE__ */ jsx19(DropdownMenuSeparator, {}),
|
|
2680
2631
|
agentsWithColors.map((agent) => {
|
|
2681
2632
|
const isSelected = participantIds.includes(agent.id);
|
|
2682
2633
|
const isLastSelected = isSelected && participantIds.length === 1;
|
|
2683
|
-
return /* @__PURE__ */
|
|
2634
|
+
return /* @__PURE__ */ jsxs11(
|
|
2684
2635
|
DropdownMenuItem,
|
|
2685
2636
|
{
|
|
2686
2637
|
onClick: () => toggleParticipant(agent.id),
|
|
2687
2638
|
className: "flex items-center gap-3 p-2 cursor-pointer",
|
|
2688
2639
|
disabled: isLastSelected,
|
|
2689
2640
|
children: [
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
2641
|
+
/* @__PURE__ */ jsxs11(Avatar, { className: "h-6 w-6", children: [
|
|
2642
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2643
|
+
/* @__PURE__ */ jsx19(
|
|
2693
2644
|
AvatarFallback,
|
|
2694
2645
|
{
|
|
2695
2646
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2698,11 +2649,11 @@ var ParticipantsSelector = memo2(({
|
|
|
2698
2649
|
}
|
|
2699
2650
|
)
|
|
2700
2651
|
] }),
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
agent.description && /* @__PURE__ */
|
|
2652
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
|
|
2653
|
+
/* @__PURE__ */ jsx19("div", { className: "font-medium text-sm truncate", children: agent.name }),
|
|
2654
|
+
agent.description && /* @__PURE__ */ jsx19("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
|
|
2704
2655
|
] }),
|
|
2705
|
-
isSelected && /* @__PURE__ */
|
|
2656
|
+
isSelected && /* @__PURE__ */ jsx19(Check2, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2706
2657
|
]
|
|
2707
2658
|
},
|
|
2708
2659
|
agent.id
|
|
@@ -2712,7 +2663,7 @@ var ParticipantsSelector = memo2(({
|
|
|
2712
2663
|
] });
|
|
2713
2664
|
});
|
|
2714
2665
|
ParticipantsSelector.displayName = "ParticipantsSelector";
|
|
2715
|
-
var TargetAgentSelector =
|
|
2666
|
+
var TargetAgentSelector = memo3(({
|
|
2716
2667
|
agents,
|
|
2717
2668
|
targetAgentId,
|
|
2718
2669
|
onTargetChange,
|
|
@@ -2720,24 +2671,24 @@ var TargetAgentSelector = memo2(({
|
|
|
2720
2671
|
placeholder = "Select agent",
|
|
2721
2672
|
disabled = false
|
|
2722
2673
|
}) => {
|
|
2723
|
-
const agentsWithColors =
|
|
2724
|
-
const selectedAgent =
|
|
2674
|
+
const agentsWithColors = useMemo4(() => assignAgentColors(agents), [agents]);
|
|
2675
|
+
const selectedAgent = useMemo4(
|
|
2725
2676
|
() => agentsWithColors.find((a) => a.id === targetAgentId),
|
|
2726
2677
|
[agentsWithColors, targetAgentId]
|
|
2727
2678
|
);
|
|
2728
|
-
return /* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2679
|
+
return /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
|
|
2680
|
+
/* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
2730
2681
|
Button,
|
|
2731
2682
|
{
|
|
2732
2683
|
variant: "ghost",
|
|
2733
2684
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2734
2685
|
disabled,
|
|
2735
2686
|
children: [
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
selectedAgent ? /* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
2739
|
-
/* @__PURE__ */
|
|
2740
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ jsx19(AtSign, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2688
|
+
selectedAgent ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2689
|
+
/* @__PURE__ */ jsxs11(Avatar, { className: "h-5 w-5", children: [
|
|
2690
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2691
|
+
/* @__PURE__ */ jsx19(
|
|
2741
2692
|
AvatarFallback,
|
|
2742
2693
|
{
|
|
2743
2694
|
style: { backgroundColor: selectedAgent.color || getAgentColor(selectedAgent.id), color: "white" },
|
|
@@ -2746,26 +2697,26 @@ var TargetAgentSelector = memo2(({
|
|
|
2746
2697
|
}
|
|
2747
2698
|
)
|
|
2748
2699
|
] }),
|
|
2749
|
-
/* @__PURE__ */
|
|
2750
|
-
] }) : /* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
2700
|
+
/* @__PURE__ */ jsx19("span", { className: "max-w-[150px] truncate", children: selectedAgent.name })
|
|
2701
|
+
] }) : /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: placeholder }),
|
|
2702
|
+
/* @__PURE__ */ jsx19(ChevronDown2, { className: "h-4 w-4 opacity-50" })
|
|
2752
2703
|
]
|
|
2753
2704
|
}
|
|
2754
2705
|
) }),
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ jsxs11(DropdownMenuContent, { align: "start", className: "w-[280px]", children: [
|
|
2707
|
+
/* @__PURE__ */ jsx19(DropdownMenuLabel, { children: label }),
|
|
2708
|
+
/* @__PURE__ */ jsx19(DropdownMenuSeparator, {}),
|
|
2758
2709
|
agentsWithColors.map((agent) => {
|
|
2759
2710
|
const isSelected = agent.id === targetAgentId;
|
|
2760
|
-
return /* @__PURE__ */
|
|
2711
|
+
return /* @__PURE__ */ jsxs11(
|
|
2761
2712
|
DropdownMenuItem,
|
|
2762
2713
|
{
|
|
2763
2714
|
onClick: () => onTargetChange(agent.id),
|
|
2764
2715
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2765
2716
|
children: [
|
|
2766
|
-
/* @__PURE__ */
|
|
2767
|
-
/* @__PURE__ */
|
|
2768
|
-
/* @__PURE__ */
|
|
2717
|
+
/* @__PURE__ */ jsxs11(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2718
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2719
|
+
/* @__PURE__ */ jsx19(
|
|
2769
2720
|
AvatarFallback,
|
|
2770
2721
|
{
|
|
2771
2722
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2774,12 +2725,12 @@ var TargetAgentSelector = memo2(({
|
|
|
2774
2725
|
}
|
|
2775
2726
|
)
|
|
2776
2727
|
] }),
|
|
2777
|
-
/* @__PURE__ */
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
isSelected && /* @__PURE__ */
|
|
2728
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
|
|
2729
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2730
|
+
/* @__PURE__ */ jsx19("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2731
|
+
isSelected && /* @__PURE__ */ jsx19(Check2, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2781
2732
|
] }),
|
|
2782
|
-
agent.description && /* @__PURE__ */
|
|
2733
|
+
agent.description && /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2783
2734
|
] })
|
|
2784
2735
|
]
|
|
2785
2736
|
},
|
|
@@ -2790,7 +2741,7 @@ var TargetAgentSelector = memo2(({
|
|
|
2790
2741
|
] });
|
|
2791
2742
|
});
|
|
2792
2743
|
TargetAgentSelector.displayName = "TargetAgentSelector";
|
|
2793
|
-
var AgentBadge =
|
|
2744
|
+
var AgentBadge = memo3(({
|
|
2794
2745
|
agent,
|
|
2795
2746
|
onRemove,
|
|
2796
2747
|
showRemove = false,
|
|
@@ -2799,16 +2750,16 @@ var AgentBadge = memo2(({
|
|
|
2799
2750
|
const color = agent.color || getAgentColor(agent.id);
|
|
2800
2751
|
const avatarSize = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
2801
2752
|
const textSize = size === "sm" ? "text-xs" : "text-sm";
|
|
2802
|
-
return /* @__PURE__ */
|
|
2753
|
+
return /* @__PURE__ */ jsxs11(
|
|
2803
2754
|
Badge,
|
|
2804
2755
|
{
|
|
2805
2756
|
variant: "secondary",
|
|
2806
2757
|
className: "flex items-center gap-1.5 pr-1",
|
|
2807
2758
|
style: { borderColor: color, borderWidth: 1 },
|
|
2808
2759
|
children: [
|
|
2809
|
-
/* @__PURE__ */
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2760
|
+
/* @__PURE__ */ jsxs11(Avatar, { className: avatarSize, children: [
|
|
2761
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2762
|
+
/* @__PURE__ */ jsx19(
|
|
2812
2763
|
AvatarFallback,
|
|
2813
2764
|
{
|
|
2814
2765
|
style: { backgroundColor: color, color: "white" },
|
|
@@ -2817,8 +2768,8 @@ var AgentBadge = memo2(({
|
|
|
2817
2768
|
}
|
|
2818
2769
|
)
|
|
2819
2770
|
] }),
|
|
2820
|
-
/* @__PURE__ */
|
|
2821
|
-
showRemove && onRemove && /* @__PURE__ */
|
|
2771
|
+
/* @__PURE__ */ jsx19("span", { className: textSize, children: agent.name }),
|
|
2772
|
+
showRemove && onRemove && /* @__PURE__ */ jsx19(
|
|
2822
2773
|
Button,
|
|
2823
2774
|
{
|
|
2824
2775
|
variant: "ghost",
|
|
@@ -2828,7 +2779,7 @@ var AgentBadge = memo2(({
|
|
|
2828
2779
|
e.stopPropagation();
|
|
2829
2780
|
onRemove();
|
|
2830
2781
|
},
|
|
2831
|
-
children: /* @__PURE__ */
|
|
2782
|
+
children: /* @__PURE__ */ jsx19(X2, { className: "h-3 w-3" })
|
|
2832
2783
|
}
|
|
2833
2784
|
)
|
|
2834
2785
|
]
|
|
@@ -2838,7 +2789,7 @@ var AgentBadge = memo2(({
|
|
|
2838
2789
|
AgentBadge.displayName = "AgentBadge";
|
|
2839
2790
|
|
|
2840
2791
|
// src/components/chat/ChatHeader.tsx
|
|
2841
|
-
import { Fragment as Fragment4, jsx as
|
|
2792
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2842
2793
|
var ChatHeader = ({
|
|
2843
2794
|
config,
|
|
2844
2795
|
currentThreadTitle,
|
|
@@ -2859,11 +2810,11 @@ var ChatHeader = ({
|
|
|
2859
2810
|
onParticipantsChange,
|
|
2860
2811
|
className = ""
|
|
2861
2812
|
}) => {
|
|
2862
|
-
const [isDarkMode, setIsDarkMode] =
|
|
2813
|
+
const [isDarkMode, setIsDarkMode] = React10.useState(() => {
|
|
2863
2814
|
if (typeof window === "undefined") return false;
|
|
2864
2815
|
return document.documentElement.classList.contains("dark");
|
|
2865
2816
|
});
|
|
2866
|
-
|
|
2817
|
+
React10.useEffect(() => {
|
|
2867
2818
|
const observer = new MutationObserver(() => {
|
|
2868
2819
|
setIsDarkMode(document.documentElement.classList.contains("dark"));
|
|
2869
2820
|
});
|
|
@@ -2909,19 +2860,19 @@ var ChatHeader = ({
|
|
|
2909
2860
|
};
|
|
2910
2861
|
const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
|
|
2911
2862
|
const agentPlaceholder = config.agentSelector?.label || "Select agent";
|
|
2912
|
-
return /* @__PURE__ */
|
|
2863
|
+
return /* @__PURE__ */ jsx20(
|
|
2913
2864
|
Card,
|
|
2914
2865
|
{
|
|
2915
2866
|
"data-chat-header": true,
|
|
2916
2867
|
className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
|
|
2917
2868
|
style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
|
|
2918
|
-
children: /* @__PURE__ */
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
/* @__PURE__ */
|
|
2869
|
+
children: /* @__PURE__ */ jsx20(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2870
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
2871
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
2872
|
+
/* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(SidebarTrigger, { className: "-ml-1" }) }),
|
|
2873
|
+
/* @__PURE__ */ jsx20(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
|
|
2923
2874
|
] }),
|
|
2924
|
-
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */
|
|
2875
|
+
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */ jsx20(
|
|
2925
2876
|
ParticipantsSelector,
|
|
2926
2877
|
{
|
|
2927
2878
|
agents: agentOptions,
|
|
@@ -2929,40 +2880,40 @@ var ChatHeader = ({
|
|
|
2929
2880
|
onParticipantsChange
|
|
2930
2881
|
}
|
|
2931
2882
|
),
|
|
2932
|
-
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2883
|
+
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2884
|
+
/* @__PURE__ */ jsx20(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
2934
2885
|
Button,
|
|
2935
2886
|
{
|
|
2936
2887
|
variant: "ghost",
|
|
2937
2888
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2938
2889
|
children: [
|
|
2939
|
-
selectedAgent?.avatarUrl ? /* @__PURE__ */
|
|
2940
|
-
/* @__PURE__ */
|
|
2941
|
-
/* @__PURE__ */
|
|
2890
|
+
selectedAgent?.avatarUrl ? /* @__PURE__ */ jsxs12(Avatar, { className: "h-5 w-5", children: [
|
|
2891
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2892
|
+
/* @__PURE__ */ jsx20(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
|
|
2942
2893
|
] }) : null,
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
/* @__PURE__ */
|
|
2894
|
+
/* @__PURE__ */ jsx20("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
|
|
2895
|
+
/* @__PURE__ */ jsx20(ChevronDown3, { className: "h-4 w-4 opacity-50" })
|
|
2945
2896
|
]
|
|
2946
2897
|
}
|
|
2947
2898
|
) }),
|
|
2948
|
-
/* @__PURE__ */
|
|
2899
|
+
/* @__PURE__ */ jsx20(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
|
|
2949
2900
|
const isSelected = agent.id === selectedAgentId;
|
|
2950
|
-
return /* @__PURE__ */
|
|
2901
|
+
return /* @__PURE__ */ jsxs12(
|
|
2951
2902
|
DropdownMenuItem,
|
|
2952
2903
|
{
|
|
2953
2904
|
onClick: () => onSelectAgent?.(agent.id),
|
|
2954
2905
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2955
2906
|
children: [
|
|
2956
|
-
agent.avatarUrl ? /* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
] }) : /* @__PURE__ */
|
|
2960
|
-
/* @__PURE__ */
|
|
2961
|
-
/* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
isSelected && /* @__PURE__ */
|
|
2907
|
+
agent.avatarUrl ? /* @__PURE__ */ jsxs12(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2908
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2909
|
+
/* @__PURE__ */ jsx20(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
|
|
2910
|
+
] }) : /* @__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" }) }),
|
|
2911
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2912
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2913
|
+
/* @__PURE__ */ jsx20("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2914
|
+
isSelected && /* @__PURE__ */ jsx20(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2964
2915
|
] }),
|
|
2965
|
-
agent.description && /* @__PURE__ */
|
|
2916
|
+
agent.description && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2966
2917
|
] })
|
|
2967
2918
|
]
|
|
2968
2919
|
},
|
|
@@ -2970,59 +2921,59 @@ var ChatHeader = ({
|
|
|
2970
2921
|
);
|
|
2971
2922
|
}) })
|
|
2972
2923
|
] }),
|
|
2973
|
-
!showAgentSelector && isMobile && /* @__PURE__ */
|
|
2924
|
+
!showAgentSelector && isMobile && /* @__PURE__ */ jsx20("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
|
|
2974
2925
|
] }),
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
showCustomComponentButton && config.customComponent && /* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
2926
|
+
/* @__PURE__ */ jsx20("div", { className: "flex-1" }),
|
|
2927
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
2928
|
+
showCustomComponentButton && config.customComponent && /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
2929
|
+
/* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(
|
|
2979
2930
|
Button,
|
|
2980
2931
|
{
|
|
2981
2932
|
variant: "ghost",
|
|
2982
2933
|
size: "icon",
|
|
2983
2934
|
className: "h-8 w-8",
|
|
2984
2935
|
onClick: onCustomComponentToggle,
|
|
2985
|
-
children: config.customComponent.icon || /* @__PURE__ */
|
|
2936
|
+
children: config.customComponent.icon || /* @__PURE__ */ jsx20(Menu, { className: "h-4 w-4" })
|
|
2986
2937
|
}
|
|
2987
2938
|
) }),
|
|
2988
|
-
/* @__PURE__ */
|
|
2939
|
+
/* @__PURE__ */ jsx20(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
|
|
2989
2940
|
] }),
|
|
2990
2941
|
config.headerActions,
|
|
2991
|
-
/* @__PURE__ */
|
|
2992
|
-
/* @__PURE__ */
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
onNewThread && /* @__PURE__ */
|
|
2995
|
-
/* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
2942
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2943
|
+
/* @__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" }) }) }),
|
|
2944
|
+
/* @__PURE__ */ jsxs12(DropdownMenuContent, { align: "end", children: [
|
|
2945
|
+
onNewThread && /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2946
|
+
/* @__PURE__ */ jsxs12(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
|
|
2947
|
+
/* @__PURE__ */ jsx20(Plus2, { className: "h-4 w-4 mr-2" }),
|
|
2997
2948
|
config.labels?.newThread || "New Thread"
|
|
2998
2949
|
] }),
|
|
2999
|
-
/* @__PURE__ */
|
|
2950
|
+
/* @__PURE__ */ jsx20(DropdownMenuSeparator, {})
|
|
3000
2951
|
] }),
|
|
3001
|
-
onExportData && /* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
2952
|
+
onExportData && /* @__PURE__ */ jsxs12(DropdownMenuItem, { onClick: onExportData, children: [
|
|
2953
|
+
/* @__PURE__ */ jsx20(Download, { className: "h-4 w-4 mr-2" }),
|
|
3003
2954
|
config.labels?.exportData || "Export Data"
|
|
3004
2955
|
] }),
|
|
3005
|
-
onImportData && /* @__PURE__ */
|
|
3006
|
-
/* @__PURE__ */
|
|
2956
|
+
onImportData && /* @__PURE__ */ jsxs12(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
2957
|
+
/* @__PURE__ */ jsx20(Upload, { className: "h-4 w-4 mr-2" }),
|
|
3007
2958
|
config.labels?.importData || "Import Data"
|
|
3008
2959
|
] }),
|
|
3009
|
-
(onExportData || onImportData) && /* @__PURE__ */
|
|
3010
|
-
/* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
2960
|
+
(onExportData || onImportData) && /* @__PURE__ */ jsx20(DropdownMenuSeparator, {}),
|
|
2961
|
+
/* @__PURE__ */ jsx20(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2962
|
+
/* @__PURE__ */ jsx20(Sun2, { className: "h-4 w-4 mr-2" }),
|
|
3012
2963
|
config.labels?.lightMode || "Light Mode"
|
|
3013
|
-
] }) : /* @__PURE__ */
|
|
3014
|
-
/* @__PURE__ */
|
|
2964
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2965
|
+
/* @__PURE__ */ jsx20(Moon2, { className: "h-4 w-4 mr-2" }),
|
|
3015
2966
|
config.labels?.darkMode || "Dark Mode"
|
|
3016
2967
|
] }) }),
|
|
3017
|
-
onClearAll && /* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3019
|
-
/* @__PURE__ */
|
|
2968
|
+
onClearAll && /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2969
|
+
/* @__PURE__ */ jsx20(DropdownMenuSeparator, {}),
|
|
2970
|
+
/* @__PURE__ */ jsxs12(
|
|
3020
2971
|
DropdownMenuItem,
|
|
3021
2972
|
{
|
|
3022
2973
|
onClick: onClearAll,
|
|
3023
2974
|
className: "text-destructive",
|
|
3024
2975
|
children: [
|
|
3025
|
-
/* @__PURE__ */
|
|
2976
|
+
/* @__PURE__ */ jsx20(Trash22, { className: "h-4 w-4 mr-2" }),
|
|
3026
2977
|
config.labels?.clearAll || "Clear All"
|
|
3027
2978
|
]
|
|
3028
2979
|
}
|
|
@@ -3037,18 +2988,18 @@ var ChatHeader = ({
|
|
|
3037
2988
|
};
|
|
3038
2989
|
|
|
3039
2990
|
// src/components/chat/ChatInput.tsx
|
|
3040
|
-
import
|
|
2991
|
+
import React12, { useState as useState7, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect10, memo as memo4 } from "react";
|
|
3041
2992
|
|
|
3042
2993
|
// src/components/chat/UserContext.tsx
|
|
3043
|
-
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as
|
|
3044
|
-
import { jsx as
|
|
2994
|
+
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect9, useMemo as useMemo5, useState as useState6 } from "react";
|
|
2995
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3045
2996
|
var Ctx = createContext2(void 0);
|
|
3046
2997
|
var ChatUserContextProvider = ({ children, initial }) => {
|
|
3047
|
-
const [ctx, setCtx] =
|
|
2998
|
+
const [ctx, setCtx] = useState6(() => ({
|
|
3048
2999
|
updatedAt: Date.now(),
|
|
3049
3000
|
...initial ?? {}
|
|
3050
3001
|
}));
|
|
3051
|
-
|
|
3002
|
+
useEffect9(() => {
|
|
3052
3003
|
if (!initial) return;
|
|
3053
3004
|
setCtx((prev) => {
|
|
3054
3005
|
const keys = Object.keys(initial);
|
|
@@ -3063,12 +3014,12 @@ var ChatUserContextProvider = ({ children, initial }) => {
|
|
|
3063
3014
|
return { ...prev, ...partial, updatedAt: Date.now() };
|
|
3064
3015
|
});
|
|
3065
3016
|
}, []);
|
|
3066
|
-
const value =
|
|
3017
|
+
const value = useMemo5(() => ({
|
|
3067
3018
|
context: ctx,
|
|
3068
3019
|
setContext: setPartial,
|
|
3069
3020
|
resetContext: () => setCtx({ updatedAt: Date.now() })
|
|
3070
3021
|
}), [ctx, setPartial]);
|
|
3071
|
-
return /* @__PURE__ */
|
|
3022
|
+
return /* @__PURE__ */ jsx21(Ctx.Provider, { value, children });
|
|
3072
3023
|
};
|
|
3073
3024
|
function useChatUserContext() {
|
|
3074
3025
|
const v = useContext2(Ctx);
|
|
@@ -3402,13 +3353,13 @@ var resolveVoiceProviderFactory = (createProvider) => createProvider ?? createMa
|
|
|
3402
3353
|
|
|
3403
3354
|
// src/components/ui/progress.tsx
|
|
3404
3355
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3405
|
-
import { jsx as
|
|
3356
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3406
3357
|
function Progress({
|
|
3407
3358
|
className,
|
|
3408
3359
|
value,
|
|
3409
3360
|
...props
|
|
3410
3361
|
}) {
|
|
3411
|
-
return /* @__PURE__ */
|
|
3362
|
+
return /* @__PURE__ */ jsx22(
|
|
3412
3363
|
ProgressPrimitive.Root,
|
|
3413
3364
|
{
|
|
3414
3365
|
"data-slot": "progress",
|
|
@@ -3417,7 +3368,7 @@ function Progress({
|
|
|
3417
3368
|
className
|
|
3418
3369
|
),
|
|
3419
3370
|
...props,
|
|
3420
|
-
children: /* @__PURE__ */
|
|
3371
|
+
children: /* @__PURE__ */ jsx22(
|
|
3421
3372
|
ProgressPrimitive.Indicator,
|
|
3422
3373
|
{
|
|
3423
3374
|
"data-slot": "progress-indicator",
|
|
@@ -3431,7 +3382,7 @@ function Progress({
|
|
|
3431
3382
|
|
|
3432
3383
|
// src/components/chat/VoiceComposer.tsx
|
|
3433
3384
|
import { Keyboard, Loader2, Mic, Send, Square, Trash2 as Trash23, X as X3 } from "lucide-react";
|
|
3434
|
-
import { jsx as
|
|
3385
|
+
import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3435
3386
|
var formatDuration = (durationMs) => {
|
|
3436
3387
|
const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
|
|
3437
3388
|
const minutes = Math.floor(totalSeconds / 60);
|
|
@@ -3526,13 +3477,13 @@ var VoiceComposer = ({
|
|
|
3526
3477
|
}
|
|
3527
3478
|
onRecordAgain();
|
|
3528
3479
|
};
|
|
3529
|
-
return /* @__PURE__ */
|
|
3530
|
-
/* @__PURE__ */
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3480
|
+
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: [
|
|
3481
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
|
|
3482
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3483
|
+
/* @__PURE__ */ jsx23(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
|
|
3484
|
+
/* @__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
3485
|
] }),
|
|
3535
|
-
/* @__PURE__ */
|
|
3486
|
+
/* @__PURE__ */ jsxs13(
|
|
3536
3487
|
Button,
|
|
3537
3488
|
{
|
|
3538
3489
|
type: "button",
|
|
@@ -3542,14 +3493,14 @@ var VoiceComposer = ({
|
|
|
3542
3493
|
onClick: onExit,
|
|
3543
3494
|
disabled: disabled || isBusy,
|
|
3544
3495
|
children: [
|
|
3545
|
-
/* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3496
|
+
/* @__PURE__ */ jsx23(Keyboard, { className: "h-4 w-4" }),
|
|
3497
|
+
/* @__PURE__ */ jsx23("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
|
|
3547
3498
|
]
|
|
3548
3499
|
}
|
|
3549
3500
|
)
|
|
3550
3501
|
] }),
|
|
3551
|
-
!isDraftLayout ? /* @__PURE__ */
|
|
3552
|
-
/* @__PURE__ */
|
|
3502
|
+
!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: [
|
|
3503
|
+
/* @__PURE__ */ jsx23(
|
|
3553
3504
|
Button,
|
|
3554
3505
|
{
|
|
3555
3506
|
type: "button",
|
|
@@ -3558,21 +3509,21 @@ var VoiceComposer = ({
|
|
|
3558
3509
|
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
3510
|
onClick: isCapturing ? onStop : onStart,
|
|
3560
3511
|
disabled: disabled || isBusy,
|
|
3561
|
-
children: isBusy ? /* @__PURE__ */
|
|
3512
|
+
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
3513
|
}
|
|
3563
3514
|
),
|
|
3564
|
-
/* @__PURE__ */
|
|
3565
|
-
/* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */
|
|
3567
|
-
/* @__PURE__ */
|
|
3568
|
-
/* @__PURE__ */
|
|
3515
|
+
/* @__PURE__ */ jsxs13("div", { className: "w-full space-y-2", children: [
|
|
3516
|
+
/* @__PURE__ */ jsx23(Progress, { value: levelValue, className: "h-2" }),
|
|
3517
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
3518
|
+
/* @__PURE__ */ jsx23("span", { children: formatDuration(durationMs) }),
|
|
3519
|
+
/* @__PURE__ */ jsx23("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
|
|
3569
3520
|
] })
|
|
3570
3521
|
] }),
|
|
3571
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */
|
|
3572
|
-
] }) }) : /* @__PURE__ */
|
|
3573
|
-
/* @__PURE__ */
|
|
3574
|
-
/* @__PURE__ */
|
|
3575
|
-
/* @__PURE__ */
|
|
3522
|
+
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 })
|
|
3523
|
+
] }) }) : /* @__PURE__ */ jsxs13("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
|
|
3524
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
|
|
3525
|
+
/* @__PURE__ */ jsx23("span", { children: formatDuration(durationMs) }),
|
|
3526
|
+
/* @__PURE__ */ jsx23(
|
|
3576
3527
|
Button,
|
|
3577
3528
|
{
|
|
3578
3529
|
type: "button",
|
|
@@ -3583,12 +3534,12 @@ var VoiceComposer = ({
|
|
|
3583
3534
|
disabled,
|
|
3584
3535
|
"aria-label": labels?.voiceDiscard || "Delete recording",
|
|
3585
3536
|
title: labels?.voiceDiscard || "Delete recording",
|
|
3586
|
-
children: /* @__PURE__ */
|
|
3537
|
+
children: /* @__PURE__ */ jsx23(Trash23, { className: "h-4 w-4" })
|
|
3587
3538
|
}
|
|
3588
3539
|
)
|
|
3589
3540
|
] }),
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3541
|
+
/* @__PURE__ */ jsxs13("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
|
|
3542
|
+
/* @__PURE__ */ jsx23(
|
|
3592
3543
|
Button,
|
|
3593
3544
|
{
|
|
3594
3545
|
type: "button",
|
|
@@ -3597,12 +3548,12 @@ var VoiceComposer = ({
|
|
|
3597
3548
|
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
3549
|
onClick: handleReviewOrbClick,
|
|
3599
3550
|
disabled: disabled || orbIsReviewBusy,
|
|
3600
|
-
children: orbIsReviewBusy ? /* @__PURE__ */
|
|
3551
|
+
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
3552
|
}
|
|
3602
3553
|
),
|
|
3603
|
-
/* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
3605
|
-
isCapturing && /* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ jsxs13("div", { className: "max-w-sm space-y-1 px-2", children: [
|
|
3555
|
+
/* @__PURE__ */ jsx23("p", { className: "text-sm text-foreground", children: reviewHelperText }),
|
|
3556
|
+
isCapturing && /* @__PURE__ */ jsx23("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ jsx23(
|
|
3606
3557
|
"div",
|
|
3607
3558
|
{
|
|
3608
3559
|
className: "h-full rounded-full bg-red-500 transition-[width] duration-150",
|
|
@@ -3611,21 +3562,21 @@ var VoiceComposer = ({
|
|
|
3611
3562
|
) })
|
|
3612
3563
|
] })
|
|
3613
3564
|
] }),
|
|
3614
|
-
attachment && /* @__PURE__ */
|
|
3615
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */
|
|
3616
|
-
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */
|
|
3617
|
-
/* @__PURE__ */
|
|
3618
|
-
isAutoSendActive && /* @__PURE__ */
|
|
3619
|
-
/* @__PURE__ */
|
|
3565
|
+
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 }) }) }),
|
|
3566
|
+
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 }),
|
|
3567
|
+
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) }) }),
|
|
3568
|
+
/* @__PURE__ */ jsxs13("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
|
|
3569
|
+
isAutoSendActive && /* @__PURE__ */ jsxs13(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
|
|
3570
|
+
/* @__PURE__ */ jsx23(X3, { className: "h-4 w-4" }),
|
|
3620
3571
|
labels?.voiceCancel || "Cancel"
|
|
3621
3572
|
] }),
|
|
3622
|
-
/* @__PURE__ */
|
|
3623
|
-
/* @__PURE__ */
|
|
3573
|
+
/* @__PURE__ */ jsxs13(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
|
|
3574
|
+
/* @__PURE__ */ jsx23(Send, { className: "h-4 w-4" }),
|
|
3624
3575
|
labels?.voiceSendNow || "Send now"
|
|
3625
3576
|
] })
|
|
3626
3577
|
] })
|
|
3627
3578
|
] }),
|
|
3628
|
-
errorMessage && /* @__PURE__ */
|
|
3579
|
+
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
3580
|
] });
|
|
3630
3581
|
};
|
|
3631
3582
|
|
|
@@ -3643,7 +3594,7 @@ import {
|
|
|
3643
3594
|
Pause,
|
|
3644
3595
|
Loader2 as Loader22
|
|
3645
3596
|
} from "lucide-react";
|
|
3646
|
-
import { Fragment as Fragment5, jsx as
|
|
3597
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3647
3598
|
function getActiveMentionMatch(value, caret) {
|
|
3648
3599
|
const prefix = value.slice(0, caret);
|
|
3649
3600
|
const match = /(^|\s)@([\w.-]*)$/.exec(prefix);
|
|
@@ -3667,7 +3618,7 @@ function resolveTargetFromMentions(value, agents) {
|
|
|
3667
3618
|
}
|
|
3668
3619
|
return null;
|
|
3669
3620
|
}
|
|
3670
|
-
var FileUploadItem =
|
|
3621
|
+
var FileUploadItem = memo4(function FileUploadItem2({ file, progress, onCancel }) {
|
|
3671
3622
|
const guessTypeFromName = (name) => {
|
|
3672
3623
|
const ext = (name || "").split(".").pop()?.toLowerCase();
|
|
3673
3624
|
switch (ext) {
|
|
@@ -3695,10 +3646,10 @@ var FileUploadItem = memo3(function FileUploadItem2({ file, progress, onCancel }
|
|
|
3695
3646
|
};
|
|
3696
3647
|
const getFileIcon = (type, name) => {
|
|
3697
3648
|
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__ */
|
|
3649
|
+
if (t.startsWith("image/")) return /* @__PURE__ */ jsx24(Image2, { className: "h-4 w-4" });
|
|
3650
|
+
if (t.startsWith("video/")) return /* @__PURE__ */ jsx24(Video, { className: "h-4 w-4" });
|
|
3651
|
+
if (t.startsWith("audio/")) return /* @__PURE__ */ jsx24(Mic2, { className: "h-4 w-4" });
|
|
3652
|
+
return /* @__PURE__ */ jsx24(FileText, { className: "h-4 w-4" });
|
|
3702
3653
|
};
|
|
3703
3654
|
const formatFileSize = (bytes) => {
|
|
3704
3655
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -3707,30 +3658,30 @@ var FileUploadItem = memo3(function FileUploadItem2({ file, progress, onCancel }
|
|
|
3707
3658
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
3708
3659
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
3709
3660
|
};
|
|
3710
|
-
return /* @__PURE__ */
|
|
3661
|
+
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
3662
|
getFileIcon(file.type, file.name),
|
|
3712
|
-
/* @__PURE__ */
|
|
3713
|
-
/* @__PURE__ */
|
|
3714
|
-
/* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */
|
|
3663
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 min-w-0", children: [
|
|
3664
|
+
/* @__PURE__ */ jsx24("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
3665
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
|
|
3666
|
+
/* @__PURE__ */ jsx24(Progress, { value: progress, className: "h-1 mt-1" })
|
|
3716
3667
|
] }),
|
|
3717
|
-
/* @__PURE__ */
|
|
3668
|
+
/* @__PURE__ */ jsx24(
|
|
3718
3669
|
Button,
|
|
3719
3670
|
{
|
|
3720
3671
|
variant: "ghost",
|
|
3721
3672
|
size: "icon",
|
|
3722
3673
|
className: "h-6 w-6",
|
|
3723
3674
|
onClick: onCancel,
|
|
3724
|
-
children: /* @__PURE__ */
|
|
3675
|
+
children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" })
|
|
3725
3676
|
}
|
|
3726
3677
|
)
|
|
3727
3678
|
] }) }) });
|
|
3728
3679
|
});
|
|
3729
|
-
var AttachmentPreview =
|
|
3730
|
-
const [isPlaying, setIsPlaying] =
|
|
3731
|
-
const [audioPlaybackSrc, setAudioPlaybackSrc] =
|
|
3680
|
+
var AttachmentPreview = memo4(function AttachmentPreview2({ attachment, onRemove }) {
|
|
3681
|
+
const [isPlaying, setIsPlaying] = useState7(false);
|
|
3682
|
+
const [audioPlaybackSrc, setAudioPlaybackSrc] = useState7(attachment.dataUrl);
|
|
3732
3683
|
const audioRef = useRef5(null);
|
|
3733
|
-
|
|
3684
|
+
useEffect10(() => {
|
|
3734
3685
|
if (attachment.kind !== "audio" || !attachment.dataUrl.startsWith("data:")) {
|
|
3735
3686
|
setAudioPlaybackSrc(attachment.dataUrl);
|
|
3736
3687
|
return;
|
|
@@ -3761,9 +3712,9 @@ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove
|
|
|
3761
3712
|
const minutes = Math.floor(seconds / 60);
|
|
3762
3713
|
return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
|
|
3763
3714
|
};
|
|
3764
|
-
return /* @__PURE__ */
|
|
3765
|
-
attachment.kind === "image" && /* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
3715
|
+
return /* @__PURE__ */ jsx24(Card, { className: "relative group", children: /* @__PURE__ */ jsxs14(CardContent, { className: "p-2", children: [
|
|
3716
|
+
attachment.kind === "image" && /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
|
|
3717
|
+
/* @__PURE__ */ jsx24(
|
|
3767
3718
|
"img",
|
|
3768
3719
|
{
|
|
3769
3720
|
src: attachment.dataUrl,
|
|
@@ -3771,19 +3722,19 @@ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove
|
|
|
3771
3722
|
className: "w-full h-20 object-cover rounded"
|
|
3772
3723
|
}
|
|
3773
3724
|
),
|
|
3774
|
-
/* @__PURE__ */
|
|
3725
|
+
/* @__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
3726
|
Button,
|
|
3776
3727
|
{
|
|
3777
3728
|
variant: "destructive",
|
|
3778
3729
|
size: "icon",
|
|
3779
3730
|
className: "h-6 w-6",
|
|
3780
3731
|
onClick: onRemove,
|
|
3781
|
-
children: /* @__PURE__ */
|
|
3732
|
+
children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" })
|
|
3782
3733
|
}
|
|
3783
3734
|
) })
|
|
3784
3735
|
] }),
|
|
3785
|
-
attachment.kind === "video" && /* @__PURE__ */
|
|
3786
|
-
/* @__PURE__ */
|
|
3736
|
+
attachment.kind === "video" && /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
|
|
3737
|
+
/* @__PURE__ */ jsx24(
|
|
3787
3738
|
"video",
|
|
3788
3739
|
{
|
|
3789
3740
|
src: attachment.dataUrl,
|
|
@@ -3792,34 +3743,34 @@ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove
|
|
|
3792
3743
|
muted: true
|
|
3793
3744
|
}
|
|
3794
3745
|
),
|
|
3795
|
-
/* @__PURE__ */
|
|
3746
|
+
/* @__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
3747
|
Button,
|
|
3797
3748
|
{
|
|
3798
3749
|
variant: "destructive",
|
|
3799
3750
|
size: "icon",
|
|
3800
3751
|
className: "h-6 w-6",
|
|
3801
3752
|
onClick: onRemove,
|
|
3802
|
-
children: /* @__PURE__ */
|
|
3753
|
+
children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" })
|
|
3803
3754
|
}
|
|
3804
3755
|
) }),
|
|
3805
|
-
/* @__PURE__ */
|
|
3756
|
+
/* @__PURE__ */ jsx24(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
|
|
3806
3757
|
] }),
|
|
3807
|
-
attachment.kind === "audio" && /* @__PURE__ */
|
|
3808
|
-
/* @__PURE__ */
|
|
3758
|
+
attachment.kind === "audio" && /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 p-2", children: [
|
|
3759
|
+
/* @__PURE__ */ jsx24(
|
|
3809
3760
|
Button,
|
|
3810
3761
|
{
|
|
3811
3762
|
variant: "outline",
|
|
3812
3763
|
size: "icon",
|
|
3813
3764
|
className: "h-8 w-8",
|
|
3814
3765
|
onClick: handlePlayPause,
|
|
3815
|
-
children: isPlaying ? /* @__PURE__ */
|
|
3766
|
+
children: isPlaying ? /* @__PURE__ */ jsx24(Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx24(Play, { className: "h-3 w-3" })
|
|
3816
3767
|
}
|
|
3817
3768
|
),
|
|
3818
|
-
/* @__PURE__ */
|
|
3819
|
-
/* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
3769
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1", children: [
|
|
3770
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
|
|
3771
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
|
|
3821
3772
|
] }),
|
|
3822
|
-
/* @__PURE__ */
|
|
3773
|
+
/* @__PURE__ */ jsx24(
|
|
3823
3774
|
"audio",
|
|
3824
3775
|
{
|
|
3825
3776
|
ref: audioRef,
|
|
@@ -3827,21 +3778,21 @@ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove
|
|
|
3827
3778
|
onPause: () => setIsPlaying(false),
|
|
3828
3779
|
onEnded: () => setIsPlaying(false),
|
|
3829
3780
|
preload: "metadata",
|
|
3830
|
-
children: /* @__PURE__ */
|
|
3781
|
+
children: /* @__PURE__ */ jsx24("source", { src: audioPlaybackSrc, type: attachment.mimeType })
|
|
3831
3782
|
}
|
|
3832
3783
|
),
|
|
3833
|
-
/* @__PURE__ */
|
|
3784
|
+
/* @__PURE__ */ jsx24(
|
|
3834
3785
|
Button,
|
|
3835
3786
|
{
|
|
3836
3787
|
variant: "ghost",
|
|
3837
3788
|
size: "icon",
|
|
3838
3789
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
3839
3790
|
onClick: onRemove,
|
|
3840
|
-
children: /* @__PURE__ */
|
|
3791
|
+
children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" })
|
|
3841
3792
|
}
|
|
3842
3793
|
)
|
|
3843
3794
|
] }),
|
|
3844
|
-
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */
|
|
3795
|
+
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
3796
|
] }) });
|
|
3846
3797
|
});
|
|
3847
3798
|
var resolveVoiceErrorMessage = (error, config) => {
|
|
@@ -3855,7 +3806,7 @@ var resolveVoiceErrorMessage = (error, config) => {
|
|
|
3855
3806
|
};
|
|
3856
3807
|
var clearVoiceTranscript = () => ({});
|
|
3857
3808
|
var resolveVoiceSegmentDuration = (segment) => segment.attachment.durationMs ?? 0;
|
|
3858
|
-
var ChatInput =
|
|
3809
|
+
var ChatInput = memo4(function ChatInput2({
|
|
3859
3810
|
value,
|
|
3860
3811
|
onChange,
|
|
3861
3812
|
onSubmit,
|
|
@@ -3884,27 +3835,27 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
3884
3835
|
const voiceTranscriptMode = config?.voiceCompose?.transcriptMode ?? "final-only";
|
|
3885
3836
|
const voiceMaxRecordingMs = config?.voiceCompose?.maxRecordingMs;
|
|
3886
3837
|
const { setContext } = useChatUserContext();
|
|
3887
|
-
const [uploadProgress, setUploadProgress] =
|
|
3888
|
-
const [isVoiceComposerOpen, setIsVoiceComposerOpen] =
|
|
3838
|
+
const [uploadProgress, setUploadProgress] = useState7(/* @__PURE__ */ new Map());
|
|
3839
|
+
const [isVoiceComposerOpen, setIsVoiceComposerOpen] = useState7(
|
|
3889
3840
|
() => enableAudioRecording && voiceDefaultMode === "voice"
|
|
3890
3841
|
);
|
|
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] =
|
|
3842
|
+
const [voiceState, setVoiceState] = useState7("idle");
|
|
3843
|
+
const [voiceDraft, setVoiceDraft] = useState7(null);
|
|
3844
|
+
const [voiceTranscript, setVoiceTranscript] = useState7(clearVoiceTranscript);
|
|
3845
|
+
const [voiceDurationMs, setVoiceDurationMs] = useState7(0);
|
|
3846
|
+
const [voiceAudioLevel, setVoiceAudioLevel] = useState7(0);
|
|
3847
|
+
const [voiceCountdownMs, setVoiceCountdownMs] = useState7(0);
|
|
3848
|
+
const [isVoiceAutoSendActive, setIsVoiceAutoSendActive] = useState7(false);
|
|
3849
|
+
const [voiceError, setVoiceError] = useState7(null);
|
|
3850
|
+
const [activeMention, setActiveMention] = useState7(null);
|
|
3851
|
+
const [activeMentionIndex, setActiveMentionIndex] = useState7(0);
|
|
3901
3852
|
const textareaRef = useRef5(null);
|
|
3902
3853
|
const fileInputRef = useRef5(null);
|
|
3903
3854
|
const voiceProviderRef = useRef5(null);
|
|
3904
3855
|
const voiceDraftRef = useRef5(null);
|
|
3905
3856
|
const voiceAppendBaseRef = useRef5(null);
|
|
3906
3857
|
const voiceAppendBaseDurationRef = useRef5(0);
|
|
3907
|
-
const filteredMentionAgents =
|
|
3858
|
+
const filteredMentionAgents = React12.useMemo(() => {
|
|
3908
3859
|
if (!activeMention || mentionAgents.length === 0) return [];
|
|
3909
3860
|
const query = activeMention.query.trim().toLowerCase();
|
|
3910
3861
|
const rank = (agent) => {
|
|
@@ -3933,7 +3884,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
3933
3884
|
});
|
|
3934
3885
|
setActiveMentionIndex(0);
|
|
3935
3886
|
}, []);
|
|
3936
|
-
|
|
3887
|
+
useEffect10(() => {
|
|
3937
3888
|
return () => {
|
|
3938
3889
|
if (voiceProviderRef.current) {
|
|
3939
3890
|
void voiceProviderRef.current.destroy();
|
|
@@ -3941,10 +3892,10 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
3941
3892
|
}
|
|
3942
3893
|
};
|
|
3943
3894
|
}, []);
|
|
3944
|
-
|
|
3895
|
+
useEffect10(() => {
|
|
3945
3896
|
voiceDraftRef.current = voiceDraft;
|
|
3946
3897
|
}, [voiceDraft]);
|
|
3947
|
-
|
|
3898
|
+
useEffect10(() => {
|
|
3948
3899
|
if (!isMentionMenuOpen) {
|
|
3949
3900
|
setActiveMentionIndex(0);
|
|
3950
3901
|
return;
|
|
@@ -4364,7 +4315,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4364
4315
|
setVoiceAudioLevel(0);
|
|
4365
4316
|
setVoiceState("review");
|
|
4366
4317
|
}, [armVoiceDraftForAppend, stopVoiceCapture, voiceReviewMode, voiceState]);
|
|
4367
|
-
|
|
4318
|
+
useEffect10(() => {
|
|
4368
4319
|
if (!voiceDraft || voiceAutoSendDelayMs <= 0 || !isVoiceAutoSendActive) {
|
|
4369
4320
|
return;
|
|
4370
4321
|
}
|
|
@@ -4392,8 +4343,8 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4392
4343
|
};
|
|
4393
4344
|
const canAddMoreAttachments = attachments.length < maxAttachments;
|
|
4394
4345
|
const showVoiceComposer = enableAudioRecording && isVoiceComposerOpen;
|
|
4395
|
-
return /* @__PURE__ */
|
|
4396
|
-
uploadProgress.size > 0 && /* @__PURE__ */
|
|
4346
|
+
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: [
|
|
4347
|
+
uploadProgress.size > 0 && /* @__PURE__ */ jsx24("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx24(
|
|
4397
4348
|
FileUploadItem,
|
|
4398
4349
|
{
|
|
4399
4350
|
file: { name: progress.fileName },
|
|
@@ -4408,7 +4359,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4408
4359
|
},
|
|
4409
4360
|
id
|
|
4410
4361
|
)) }),
|
|
4411
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
4362
|
+
attachments.length > 0 && /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx24(
|
|
4412
4363
|
AttachmentPreview,
|
|
4413
4364
|
{
|
|
4414
4365
|
attachment,
|
|
@@ -4416,7 +4367,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4416
4367
|
},
|
|
4417
4368
|
index
|
|
4418
4369
|
)) }),
|
|
4419
|
-
showVoiceComposer ? /* @__PURE__ */
|
|
4370
|
+
showVoiceComposer ? /* @__PURE__ */ jsx24("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsx24(
|
|
4420
4371
|
VoiceComposer,
|
|
4421
4372
|
{
|
|
4422
4373
|
state: voiceState,
|
|
@@ -4456,15 +4407,15 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4456
4407
|
void closeVoiceComposer();
|
|
4457
4408
|
}
|
|
4458
4409
|
}
|
|
4459
|
-
) }) : /* @__PURE__ */
|
|
4410
|
+
) }) : /* @__PURE__ */ jsx24("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs14(
|
|
4460
4411
|
"div",
|
|
4461
4412
|
{
|
|
4462
4413
|
className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
|
|
4463
4414
|
onDrop: handleDrop,
|
|
4464
4415
|
onDragOver: handleDragOver,
|
|
4465
4416
|
children: [
|
|
4466
|
-
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */
|
|
4467
|
-
/* @__PURE__ */
|
|
4417
|
+
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4418
|
+
/* @__PURE__ */ jsx24(
|
|
4468
4419
|
"input",
|
|
4469
4420
|
{
|
|
4470
4421
|
ref: fileInputRef,
|
|
@@ -4475,8 +4426,8 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4475
4426
|
className: "hidden"
|
|
4476
4427
|
}
|
|
4477
4428
|
),
|
|
4478
|
-
/* @__PURE__ */
|
|
4479
|
-
/* @__PURE__ */
|
|
4429
|
+
/* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
4430
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
4480
4431
|
Button,
|
|
4481
4432
|
{
|
|
4482
4433
|
type: "button",
|
|
@@ -4489,14 +4440,14 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4489
4440
|
fileInputRef.current?.click();
|
|
4490
4441
|
},
|
|
4491
4442
|
disabled,
|
|
4492
|
-
children: /* @__PURE__ */
|
|
4443
|
+
children: /* @__PURE__ */ jsx24(Paperclip, { className: "h-4 w-4" })
|
|
4493
4444
|
}
|
|
4494
4445
|
) }),
|
|
4495
|
-
/* @__PURE__ */
|
|
4446
|
+
/* @__PURE__ */ jsx24(TooltipContent, { children: config?.labels?.attachFileTooltip })
|
|
4496
4447
|
] })
|
|
4497
4448
|
] }),
|
|
4498
|
-
/* @__PURE__ */
|
|
4499
|
-
/* @__PURE__ */
|
|
4449
|
+
/* @__PURE__ */ jsxs14("div", { className: "relative flex-1", children: [
|
|
4450
|
+
/* @__PURE__ */ jsx24(
|
|
4500
4451
|
Textarea,
|
|
4501
4452
|
{
|
|
4502
4453
|
ref: textareaRef,
|
|
@@ -4520,7 +4471,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4520
4471
|
rows: 1
|
|
4521
4472
|
}
|
|
4522
4473
|
),
|
|
4523
|
-
isMentionMenuOpen && /* @__PURE__ */
|
|
4474
|
+
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
4475
|
"button",
|
|
4525
4476
|
{
|
|
4526
4477
|
type: "button",
|
|
@@ -4530,15 +4481,15 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4530
4481
|
selectMentionAgent(agent);
|
|
4531
4482
|
},
|
|
4532
4483
|
children: [
|
|
4533
|
-
/* @__PURE__ */
|
|
4534
|
-
agent.description && /* @__PURE__ */
|
|
4484
|
+
/* @__PURE__ */ jsx24("span", { className: "font-medium", children: agent.name }),
|
|
4485
|
+
agent.description && /* @__PURE__ */ jsx24("span", { className: "truncate text-xs text-muted-foreground", children: agent.description })
|
|
4535
4486
|
]
|
|
4536
4487
|
},
|
|
4537
4488
|
agent.id
|
|
4538
4489
|
)) }) })
|
|
4539
4490
|
] }),
|
|
4540
|
-
enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */
|
|
4541
|
-
/* @__PURE__ */
|
|
4491
|
+
enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
4492
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
4542
4493
|
Button,
|
|
4543
4494
|
{
|
|
4544
4495
|
type: "button",
|
|
@@ -4549,13 +4500,13 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4549
4500
|
void startVoiceCapture();
|
|
4550
4501
|
},
|
|
4551
4502
|
disabled: disabled || isGenerating,
|
|
4552
|
-
children: /* @__PURE__ */
|
|
4503
|
+
children: /* @__PURE__ */ jsx24(Mic2, { className: "h-4 w-4" })
|
|
4553
4504
|
}
|
|
4554
4505
|
) }),
|
|
4555
|
-
/* @__PURE__ */
|
|
4506
|
+
/* @__PURE__ */ jsx24(TooltipContent, { children: config?.labels?.voiceEnter })
|
|
4556
4507
|
] }),
|
|
4557
|
-
isGenerating ? /* @__PURE__ */
|
|
4558
|
-
/* @__PURE__ */
|
|
4508
|
+
isGenerating ? /* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
4509
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
4559
4510
|
Button,
|
|
4560
4511
|
{
|
|
4561
4512
|
type: "button",
|
|
@@ -4563,36 +4514,36 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4563
4514
|
size: "icon",
|
|
4564
4515
|
className: "h-10 w-10",
|
|
4565
4516
|
onClick: onStopGeneration,
|
|
4566
|
-
children: /* @__PURE__ */
|
|
4517
|
+
children: /* @__PURE__ */ jsx24(Square2, { className: "h-4 w-4" })
|
|
4567
4518
|
}
|
|
4568
4519
|
) }),
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
] }) : /* @__PURE__ */
|
|
4571
|
-
/* @__PURE__ */
|
|
4520
|
+
/* @__PURE__ */ jsx24(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
|
|
4521
|
+
] }) : /* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
4522
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
4572
4523
|
Button,
|
|
4573
4524
|
{
|
|
4574
4525
|
type: "submit",
|
|
4575
4526
|
size: "icon",
|
|
4576
4527
|
className: "h-10 w-10",
|
|
4577
4528
|
disabled: disabled || !value.trim() && attachments.length === 0,
|
|
4578
|
-
children: disabled ? /* @__PURE__ */
|
|
4529
|
+
children: disabled ? /* @__PURE__ */ jsx24(Loader22, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx24(Send2, { className: "h-4 w-4" })
|
|
4579
4530
|
}
|
|
4580
4531
|
) }),
|
|
4581
|
-
/* @__PURE__ */
|
|
4532
|
+
/* @__PURE__ */ jsx24(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
4582
4533
|
] })
|
|
4583
4534
|
]
|
|
4584
4535
|
}
|
|
4585
4536
|
) }),
|
|
4586
|
-
/* @__PURE__ */
|
|
4537
|
+
/* @__PURE__ */ jsxs14("div", { className: "text-[10px] text-muted-foreground text-center", children: [
|
|
4587
4538
|
window.innerWidth > 768 ? config?.labels?.inputHelpText : "",
|
|
4588
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
4539
|
+
attachments.length > 0 && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4589
4540
|
" \u2022 ",
|
|
4590
4541
|
attachments.length,
|
|
4591
4542
|
"/",
|
|
4592
4543
|
maxAttachments,
|
|
4593
4544
|
" anexos"
|
|
4594
4545
|
] }),
|
|
4595
|
-
config?.labels?.footerLabel && /* @__PURE__ */
|
|
4546
|
+
config?.labels?.footerLabel && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4596
4547
|
" \u2022 ",
|
|
4597
4548
|
config.labels.footerLabel
|
|
4598
4549
|
] })
|
|
@@ -4601,21 +4552,21 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4601
4552
|
});
|
|
4602
4553
|
|
|
4603
4554
|
// src/components/chat/UserProfile.tsx
|
|
4604
|
-
import { useState as
|
|
4555
|
+
import { useState as useState8 } from "react";
|
|
4605
4556
|
|
|
4606
4557
|
// src/components/ui/scroll-area.tsx
|
|
4607
|
-
import * as
|
|
4558
|
+
import * as React13 from "react";
|
|
4608
4559
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4609
|
-
import { jsx as
|
|
4610
|
-
var ScrollArea =
|
|
4611
|
-
return /* @__PURE__ */
|
|
4560
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4561
|
+
var ScrollArea = React13.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
4562
|
+
return /* @__PURE__ */ jsxs15(
|
|
4612
4563
|
ScrollAreaPrimitive.Root,
|
|
4613
4564
|
{
|
|
4614
4565
|
"data-slot": "scroll-area",
|
|
4615
4566
|
className: cn("relative", className),
|
|
4616
4567
|
...props,
|
|
4617
4568
|
children: [
|
|
4618
|
-
/* @__PURE__ */
|
|
4569
|
+
/* @__PURE__ */ jsx25(
|
|
4619
4570
|
ScrollAreaPrimitive.Viewport,
|
|
4620
4571
|
{
|
|
4621
4572
|
ref,
|
|
@@ -4629,8 +4580,8 @@ var ScrollArea = React12.forwardRef(({ className, children, viewportClassName, o
|
|
|
4629
4580
|
children
|
|
4630
4581
|
}
|
|
4631
4582
|
),
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
/* @__PURE__ */
|
|
4583
|
+
/* @__PURE__ */ jsx25(ScrollBar, {}),
|
|
4584
|
+
/* @__PURE__ */ jsx25(ScrollAreaPrimitive.Corner, {})
|
|
4634
4585
|
]
|
|
4635
4586
|
}
|
|
4636
4587
|
);
|
|
@@ -4641,7 +4592,7 @@ function ScrollBar({
|
|
|
4641
4592
|
orientation = "vertical",
|
|
4642
4593
|
...props
|
|
4643
4594
|
}) {
|
|
4644
|
-
return /* @__PURE__ */
|
|
4595
|
+
return /* @__PURE__ */ jsx25(
|
|
4645
4596
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4646
4597
|
{
|
|
4647
4598
|
"data-slot": "scroll-area-scrollbar",
|
|
@@ -4653,7 +4604,7 @@ function ScrollBar({
|
|
|
4653
4604
|
className
|
|
4654
4605
|
),
|
|
4655
4606
|
...props,
|
|
4656
|
-
children: /* @__PURE__ */
|
|
4607
|
+
children: /* @__PURE__ */ jsx25(
|
|
4657
4608
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4658
4609
|
{
|
|
4659
4610
|
"data-slot": "scroll-area-thumb",
|
|
@@ -4692,7 +4643,7 @@ import {
|
|
|
4692
4643
|
Check as Check4,
|
|
4693
4644
|
X as X5
|
|
4694
4645
|
} from "lucide-react";
|
|
4695
|
-
import { Fragment as Fragment6, jsx as
|
|
4646
|
+
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4696
4647
|
var getInitials2 = (name, email) => {
|
|
4697
4648
|
if (name) {
|
|
4698
4649
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -4706,29 +4657,29 @@ var getFieldIcon = (type, key) => {
|
|
|
4706
4657
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4707
4658
|
switch (type) {
|
|
4708
4659
|
case "email":
|
|
4709
|
-
return /* @__PURE__ */
|
|
4660
|
+
return /* @__PURE__ */ jsx26(Mail, { className: iconClass });
|
|
4710
4661
|
case "phone":
|
|
4711
|
-
return /* @__PURE__ */
|
|
4662
|
+
return /* @__PURE__ */ jsx26(Phone, { className: iconClass });
|
|
4712
4663
|
case "url":
|
|
4713
|
-
return /* @__PURE__ */
|
|
4664
|
+
return /* @__PURE__ */ jsx26(Globe, { className: iconClass });
|
|
4714
4665
|
case "date":
|
|
4715
|
-
return /* @__PURE__ */
|
|
4666
|
+
return /* @__PURE__ */ jsx26(Calendar, { className: iconClass });
|
|
4716
4667
|
}
|
|
4717
4668
|
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__ */
|
|
4669
|
+
if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx26(Users2, { className: iconClass });
|
|
4670
|
+
if (lowerKey.includes("following")) return /* @__PURE__ */ jsx26(UserPlus, { className: iconClass });
|
|
4671
|
+
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx26(Image3, { className: iconClass });
|
|
4672
|
+
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx26(BadgeCheck, { className: iconClass });
|
|
4673
|
+
if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx26(FileText2, { className: iconClass });
|
|
4674
|
+
if (lowerKey.includes("email")) return /* @__PURE__ */ jsx26(Mail, { className: iconClass });
|
|
4675
|
+
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx26(Phone, { className: iconClass });
|
|
4676
|
+
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx26(MapPin, { className: iconClass });
|
|
4677
|
+
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx26(Building, { className: iconClass });
|
|
4678
|
+
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx26(Briefcase, { className: iconClass });
|
|
4679
|
+
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx26(Globe, { className: iconClass });
|
|
4680
|
+
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx26(AtSign2, { className: iconClass });
|
|
4681
|
+
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx26(Calendar, { className: iconClass });
|
|
4682
|
+
return /* @__PURE__ */ jsx26(User2, { className: iconClass });
|
|
4732
4683
|
};
|
|
4733
4684
|
var formatValue = (value, type, key) => {
|
|
4734
4685
|
if (value === null || value === void 0) return "-";
|
|
@@ -4762,15 +4713,15 @@ var getMemoryCategoryIcon = (category) => {
|
|
|
4762
4713
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4763
4714
|
switch (category) {
|
|
4764
4715
|
case "preference":
|
|
4765
|
-
return /* @__PURE__ */
|
|
4716
|
+
return /* @__PURE__ */ jsx26(Heart, { className: iconClass });
|
|
4766
4717
|
case "fact":
|
|
4767
|
-
return /* @__PURE__ */
|
|
4718
|
+
return /* @__PURE__ */ jsx26(Info, { className: iconClass });
|
|
4768
4719
|
case "goal":
|
|
4769
|
-
return /* @__PURE__ */
|
|
4720
|
+
return /* @__PURE__ */ jsx26(Target, { className: iconClass });
|
|
4770
4721
|
case "context":
|
|
4771
|
-
return /* @__PURE__ */
|
|
4722
|
+
return /* @__PURE__ */ jsx26(Lightbulb, { className: iconClass });
|
|
4772
4723
|
default:
|
|
4773
|
-
return /* @__PURE__ */
|
|
4724
|
+
return /* @__PURE__ */ jsx26(Brain2, { className: iconClass });
|
|
4774
4725
|
}
|
|
4775
4726
|
};
|
|
4776
4727
|
var getMemoryCategoryLabel = (category) => {
|
|
@@ -4801,10 +4752,10 @@ var UserProfile = ({
|
|
|
4801
4752
|
onDeleteMemory,
|
|
4802
4753
|
className
|
|
4803
4754
|
}) => {
|
|
4804
|
-
const [newMemoryContent, setNewMemoryContent] =
|
|
4805
|
-
const [isAddingMemory, setIsAddingMemory] =
|
|
4806
|
-
const [editingMemoryId, setEditingMemoryId] =
|
|
4807
|
-
const [editingMemoryContent, setEditingMemoryContent] =
|
|
4755
|
+
const [newMemoryContent, setNewMemoryContent] = useState8("");
|
|
4756
|
+
const [isAddingMemory, setIsAddingMemory] = useState8(false);
|
|
4757
|
+
const [editingMemoryId, setEditingMemoryId] = useState8(null);
|
|
4758
|
+
const [editingMemoryContent, setEditingMemoryContent] = useState8("");
|
|
4808
4759
|
const handleAddMemory = () => {
|
|
4809
4760
|
if (newMemoryContent.trim() && onAddMemory) {
|
|
4810
4761
|
onAddMemory(newMemoryContent.trim(), "other");
|
|
@@ -4840,66 +4791,66 @@ var UserProfile = ({
|
|
|
4840
4791
|
const displayName = user?.name || user?.email?.split("@")[0] || "User";
|
|
4841
4792
|
const initials = getInitials2(user?.name, user?.email);
|
|
4842
4793
|
const normalizedFields = normalizeCustomFields(customFields);
|
|
4843
|
-
return /* @__PURE__ */
|
|
4794
|
+
return /* @__PURE__ */ jsx26(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs16(
|
|
4844
4795
|
SheetContent,
|
|
4845
4796
|
{
|
|
4846
4797
|
side: "right",
|
|
4847
4798
|
className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
|
|
4848
4799
|
children: [
|
|
4849
|
-
/* @__PURE__ */
|
|
4850
|
-
/* @__PURE__ */
|
|
4851
|
-
/* @__PURE__ */
|
|
4852
|
-
/* @__PURE__ */
|
|
4853
|
-
user?.avatar && /* @__PURE__ */
|
|
4854
|
-
/* @__PURE__ */
|
|
4800
|
+
/* @__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 }) }) }),
|
|
4801
|
+
/* @__PURE__ */ jsx26(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs16("div", { className: "p-6 space-y-6", children: [
|
|
4802
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center text-center space-y-4", children: [
|
|
4803
|
+
/* @__PURE__ */ jsxs16(Avatar, { className: "h-24 w-24 shrink-0", children: [
|
|
4804
|
+
user?.avatar && /* @__PURE__ */ jsx26(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
4805
|
+
/* @__PURE__ */ jsx26(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
|
|
4855
4806
|
] }),
|
|
4856
|
-
/* @__PURE__ */
|
|
4857
|
-
/* @__PURE__ */
|
|
4858
|
-
user?.email && /* @__PURE__ */
|
|
4807
|
+
/* @__PURE__ */ jsxs16("div", { className: "w-full px-2", children: [
|
|
4808
|
+
/* @__PURE__ */ jsx26("h2", { className: "text-xl font-semibold break-words", children: displayName }),
|
|
4809
|
+
user?.email && /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
|
|
4859
4810
|
] })
|
|
4860
4811
|
] }),
|
|
4861
|
-
/* @__PURE__ */
|
|
4862
|
-
/* @__PURE__ */
|
|
4863
|
-
/* @__PURE__ */
|
|
4864
|
-
/* @__PURE__ */
|
|
4865
|
-
/* @__PURE__ */
|
|
4866
|
-
/* @__PURE__ */
|
|
4867
|
-
/* @__PURE__ */
|
|
4868
|
-
/* @__PURE__ */
|
|
4869
|
-
/* @__PURE__ */
|
|
4812
|
+
/* @__PURE__ */ jsx26(Separator, {}),
|
|
4813
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
4814
|
+
/* @__PURE__ */ jsx26("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
|
|
4815
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
4816
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4817
|
+
/* @__PURE__ */ jsx26(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4818
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4819
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: "Name" }),
|
|
4820
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm font-medium break-words", children: displayName })
|
|
4870
4821
|
] })
|
|
4871
4822
|
] }),
|
|
4872
|
-
user?.email && /* @__PURE__ */
|
|
4873
|
-
/* @__PURE__ */
|
|
4874
|
-
/* @__PURE__ */
|
|
4875
|
-
/* @__PURE__ */
|
|
4876
|
-
/* @__PURE__ */
|
|
4823
|
+
user?.email && /* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4824
|
+
/* @__PURE__ */ jsx26(AtSign2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4825
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4826
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
|
|
4827
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm font-medium break-words", children: user.email })
|
|
4877
4828
|
] })
|
|
4878
4829
|
] }),
|
|
4879
|
-
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */
|
|
4880
|
-
/* @__PURE__ */
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4830
|
+
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: [
|
|
4831
|
+
/* @__PURE__ */ jsx26(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4832
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4833
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: "ID" }),
|
|
4834
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm font-medium break-words", children: user.id })
|
|
4884
4835
|
] })
|
|
4885
4836
|
] })
|
|
4886
4837
|
] })
|
|
4887
4838
|
] }),
|
|
4888
|
-
normalizedFields.length > 0 && /* @__PURE__ */
|
|
4889
|
-
/* @__PURE__ */
|
|
4890
|
-
/* @__PURE__ */
|
|
4891
|
-
/* @__PURE__ */
|
|
4892
|
-
/* @__PURE__ */
|
|
4839
|
+
normalizedFields.length > 0 && /* @__PURE__ */ jsxs16(Fragment6, { children: [
|
|
4840
|
+
/* @__PURE__ */ jsx26(Separator, {}),
|
|
4841
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
4842
|
+
/* @__PURE__ */ jsx26("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
|
|
4843
|
+
/* @__PURE__ */ jsx26("div", { className: "space-y-2", children: normalizedFields.map((field) => {
|
|
4893
4844
|
const isBioField = field.key.toLowerCase().includes("bio");
|
|
4894
|
-
return /* @__PURE__ */
|
|
4845
|
+
return /* @__PURE__ */ jsxs16(
|
|
4895
4846
|
"div",
|
|
4896
4847
|
{
|
|
4897
4848
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
|
|
4898
4849
|
children: [
|
|
4899
|
-
/* @__PURE__ */
|
|
4900
|
-
/* @__PURE__ */
|
|
4901
|
-
/* @__PURE__ */
|
|
4902
|
-
/* @__PURE__ */
|
|
4850
|
+
/* @__PURE__ */ jsx26("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
|
|
4851
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4852
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: field.label }),
|
|
4853
|
+
/* @__PURE__ */ jsx26("p", { className: cn(
|
|
4903
4854
|
"text-sm font-medium",
|
|
4904
4855
|
isBioField ? "whitespace-pre-wrap break-words" : "break-words"
|
|
4905
4856
|
), children: formatValue(field.value, field.type, field.key) })
|
|
@@ -4911,26 +4862,26 @@ var UserProfile = ({
|
|
|
4911
4862
|
}) })
|
|
4912
4863
|
] })
|
|
4913
4864
|
] }),
|
|
4914
|
-
/* @__PURE__ */
|
|
4915
|
-
/* @__PURE__ */
|
|
4916
|
-
/* @__PURE__ */
|
|
4917
|
-
/* @__PURE__ */
|
|
4918
|
-
/* @__PURE__ */
|
|
4865
|
+
/* @__PURE__ */ jsx26(Separator, {}),
|
|
4866
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
4867
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between", children: [
|
|
4868
|
+
/* @__PURE__ */ jsxs16("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
|
|
4869
|
+
/* @__PURE__ */ jsx26(Brain2, { className: "h-4 w-4" }),
|
|
4919
4870
|
labels.memories
|
|
4920
4871
|
] }),
|
|
4921
|
-
onAddMemory && /* @__PURE__ */
|
|
4872
|
+
onAddMemory && /* @__PURE__ */ jsx26(
|
|
4922
4873
|
Button,
|
|
4923
4874
|
{
|
|
4924
4875
|
variant: "ghost",
|
|
4925
4876
|
size: "sm",
|
|
4926
4877
|
className: "h-7 px-2",
|
|
4927
4878
|
onClick: () => setIsAddingMemory(true),
|
|
4928
|
-
children: /* @__PURE__ */
|
|
4879
|
+
children: /* @__PURE__ */ jsx26(Plus3, { className: "h-4 w-4" })
|
|
4929
4880
|
}
|
|
4930
4881
|
)
|
|
4931
4882
|
] }),
|
|
4932
|
-
isAddingMemory && onAddMemory && /* @__PURE__ */
|
|
4933
|
-
/* @__PURE__ */
|
|
4883
|
+
isAddingMemory && onAddMemory && /* @__PURE__ */ jsxs16("div", { className: "flex gap-2", children: [
|
|
4884
|
+
/* @__PURE__ */ jsx26(
|
|
4934
4885
|
Input,
|
|
4935
4886
|
{
|
|
4936
4887
|
value: newMemoryContent,
|
|
@@ -4947,24 +4898,24 @@ var UserProfile = ({
|
|
|
4947
4898
|
autoFocus: true
|
|
4948
4899
|
}
|
|
4949
4900
|
),
|
|
4950
|
-
/* @__PURE__ */
|
|
4901
|
+
/* @__PURE__ */ jsx26(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
|
|
4951
4902
|
] }),
|
|
4952
|
-
/* @__PURE__ */
|
|
4903
|
+
/* @__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
4904
|
const isEditing = editingMemoryId === memory.id;
|
|
4954
|
-
return /* @__PURE__ */
|
|
4905
|
+
return /* @__PURE__ */ jsxs16(
|
|
4955
4906
|
"div",
|
|
4956
4907
|
{
|
|
4957
4908
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
|
|
4958
4909
|
children: [
|
|
4959
|
-
/* @__PURE__ */
|
|
4960
|
-
/* @__PURE__ */
|
|
4961
|
-
/* @__PURE__ */
|
|
4962
|
-
/* @__PURE__ */
|
|
4963
|
-
/* @__PURE__ */
|
|
4964
|
-
/* @__PURE__ */
|
|
4910
|
+
/* @__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) }),
|
|
4911
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4912
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 mb-0.5", children: [
|
|
4913
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
|
|
4914
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
|
|
4915
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
|
|
4965
4916
|
] }),
|
|
4966
|
-
isEditing ? /* @__PURE__ */
|
|
4967
|
-
/* @__PURE__ */
|
|
4917
|
+
isEditing ? /* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
4918
|
+
/* @__PURE__ */ jsx26(
|
|
4968
4919
|
Textarea,
|
|
4969
4920
|
{
|
|
4970
4921
|
value: editingMemoryContent,
|
|
@@ -4981,8 +4932,8 @@ var UserProfile = ({
|
|
|
4981
4932
|
}
|
|
4982
4933
|
}
|
|
4983
4934
|
),
|
|
4984
|
-
/* @__PURE__ */
|
|
4985
|
-
/* @__PURE__ */
|
|
4935
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-1 justify-end", children: [
|
|
4936
|
+
/* @__PURE__ */ jsxs16(
|
|
4986
4937
|
Button,
|
|
4987
4938
|
{
|
|
4988
4939
|
variant: "ghost",
|
|
@@ -4990,12 +4941,12 @@ var UserProfile = ({
|
|
|
4990
4941
|
className: "h-7 px-2",
|
|
4991
4942
|
onClick: handleCancelEdit,
|
|
4992
4943
|
children: [
|
|
4993
|
-
/* @__PURE__ */
|
|
4944
|
+
/* @__PURE__ */ jsx26(X5, { className: "h-3.5 w-3.5 mr-1" }),
|
|
4994
4945
|
"Cancelar"
|
|
4995
4946
|
]
|
|
4996
4947
|
}
|
|
4997
4948
|
),
|
|
4998
|
-
/* @__PURE__ */
|
|
4949
|
+
/* @__PURE__ */ jsxs16(
|
|
4999
4950
|
Button,
|
|
5000
4951
|
{
|
|
5001
4952
|
size: "sm",
|
|
@@ -5003,33 +4954,33 @@ var UserProfile = ({
|
|
|
5003
4954
|
onClick: handleSaveEdit,
|
|
5004
4955
|
disabled: !editingMemoryContent.trim(),
|
|
5005
4956
|
children: [
|
|
5006
|
-
/* @__PURE__ */
|
|
4957
|
+
/* @__PURE__ */ jsx26(Check4, { className: "h-3.5 w-3.5 mr-1" }),
|
|
5007
4958
|
"Salvar"
|
|
5008
4959
|
]
|
|
5009
4960
|
}
|
|
5010
4961
|
)
|
|
5011
4962
|
] })
|
|
5012
|
-
] }) : /* @__PURE__ */
|
|
4963
|
+
] }) : /* @__PURE__ */ jsx26("p", { className: "text-sm break-words", children: memory.content })
|
|
5013
4964
|
] }),
|
|
5014
|
-
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */
|
|
5015
|
-
onUpdateMemory && /* @__PURE__ */
|
|
4965
|
+
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ jsxs16("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
|
|
4966
|
+
onUpdateMemory && /* @__PURE__ */ jsx26(
|
|
5016
4967
|
Button,
|
|
5017
4968
|
{
|
|
5018
4969
|
variant: "ghost",
|
|
5019
4970
|
size: "icon",
|
|
5020
4971
|
className: "h-7 w-7",
|
|
5021
4972
|
onClick: () => handleStartEdit(memory),
|
|
5022
|
-
children: /* @__PURE__ */
|
|
4973
|
+
children: /* @__PURE__ */ jsx26(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5023
4974
|
}
|
|
5024
4975
|
),
|
|
5025
|
-
onDeleteMemory && /* @__PURE__ */
|
|
4976
|
+
onDeleteMemory && /* @__PURE__ */ jsx26(
|
|
5026
4977
|
Button,
|
|
5027
4978
|
{
|
|
5028
4979
|
variant: "ghost",
|
|
5029
4980
|
size: "icon",
|
|
5030
4981
|
className: "h-7 w-7",
|
|
5031
4982
|
onClick: () => onDeleteMemory(memory.id),
|
|
5032
|
-
children: /* @__PURE__ */
|
|
4983
|
+
children: /* @__PURE__ */ jsx26(Trash24, { className: "h-3.5 w-3.5 text-destructive" })
|
|
5033
4984
|
}
|
|
5034
4985
|
)
|
|
5035
4986
|
] })
|
|
@@ -5040,8 +4991,8 @@ var UserProfile = ({
|
|
|
5040
4991
|
}) })
|
|
5041
4992
|
] })
|
|
5042
4993
|
] }) }),
|
|
5043
|
-
/* @__PURE__ */
|
|
5044
|
-
onEditProfile && /* @__PURE__ */
|
|
4994
|
+
/* @__PURE__ */ jsxs16("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
|
|
4995
|
+
onEditProfile && /* @__PURE__ */ jsx26(
|
|
5045
4996
|
Button,
|
|
5046
4997
|
{
|
|
5047
4998
|
variant: "outline",
|
|
@@ -5050,7 +5001,7 @@ var UserProfile = ({
|
|
|
5050
5001
|
children: "Edit Profile"
|
|
5051
5002
|
}
|
|
5052
5003
|
),
|
|
5053
|
-
onLogout && /* @__PURE__ */
|
|
5004
|
+
onLogout && /* @__PURE__ */ jsx26(
|
|
5054
5005
|
Button,
|
|
5055
5006
|
{
|
|
5056
5007
|
variant: "destructive",
|
|
@@ -5066,8 +5017,8 @@ var UserProfile = ({
|
|
|
5066
5017
|
};
|
|
5067
5018
|
|
|
5068
5019
|
// src/components/chat/ChatUI.tsx
|
|
5069
|
-
import { Sparkles, ArrowRight, MessageSquare, Lightbulb as Lightbulb2, Zap, HelpCircle } from "lucide-react";
|
|
5070
|
-
import { jsx as
|
|
5020
|
+
import { Sparkles as Sparkles2, ArrowRight, MessageSquare, Lightbulb as Lightbulb2, Zap, HelpCircle } from "lucide-react";
|
|
5021
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5071
5022
|
function getMessageSpeakerKey(message) {
|
|
5072
5023
|
if (!message) return null;
|
|
5073
5024
|
if (message.role === "assistant") {
|
|
@@ -5108,12 +5059,12 @@ var ChatUI = ({
|
|
|
5108
5059
|
initialInput,
|
|
5109
5060
|
onInitialInputConsumed
|
|
5110
5061
|
}) => {
|
|
5111
|
-
const config =
|
|
5062
|
+
const config = useMemo6(
|
|
5112
5063
|
() => mergeConfig(defaultChatConfig, userConfig),
|
|
5113
5064
|
[userConfig]
|
|
5114
5065
|
);
|
|
5115
|
-
const [isMobile, setIsMobile] =
|
|
5116
|
-
const [isUserProfileOpen, setIsUserProfileOpen] =
|
|
5066
|
+
const [isMobile, setIsMobile] = useState9(false);
|
|
5067
|
+
const [isUserProfileOpen, setIsUserProfileOpen] = useState9(false);
|
|
5117
5068
|
let userContext;
|
|
5118
5069
|
try {
|
|
5119
5070
|
const contextValue = useChatUserContext();
|
|
@@ -5127,10 +5078,10 @@ var ChatUI = ({
|
|
|
5127
5078
|
}
|
|
5128
5079
|
return false;
|
|
5129
5080
|
};
|
|
5130
|
-
const [inputValue, setInputValue] =
|
|
5131
|
-
const [attachments, setAttachments] =
|
|
5132
|
-
const [expandedMessageIds, setExpandedMessageIds] =
|
|
5133
|
-
const [state, setState] =
|
|
5081
|
+
const [inputValue, setInputValue] = useState9("");
|
|
5082
|
+
const [attachments, setAttachments] = useState9([]);
|
|
5083
|
+
const [expandedMessageIds, setExpandedMessageIds] = useState9({});
|
|
5084
|
+
const [state, setState] = useState9({
|
|
5134
5085
|
isRecording: false,
|
|
5135
5086
|
selectedThreadId: currentThreadId,
|
|
5136
5087
|
isAtBottom: true,
|
|
@@ -5142,14 +5093,14 @@ var ChatUI = ({
|
|
|
5142
5093
|
isSidebarCollapsed: false
|
|
5143
5094
|
// No longer used for main sidebar
|
|
5144
5095
|
});
|
|
5145
|
-
|
|
5096
|
+
useEffect11(() => {
|
|
5146
5097
|
if (currentThreadId !== state.selectedThreadId) {
|
|
5147
5098
|
setState((prev) => ({ ...prev, selectedThreadId: currentThreadId }));
|
|
5148
5099
|
}
|
|
5149
5100
|
}, [currentThreadId]);
|
|
5150
5101
|
const initialInputApplied = useRef6(false);
|
|
5151
5102
|
const initialInputConsumedRef = useRef6(false);
|
|
5152
|
-
|
|
5103
|
+
useEffect11(() => {
|
|
5153
5104
|
if (initialInput && !initialInputApplied.current) {
|
|
5154
5105
|
setInputValue(initialInput);
|
|
5155
5106
|
initialInputApplied.current = true;
|
|
@@ -5160,17 +5111,17 @@ var ChatUI = ({
|
|
|
5160
5111
|
const stateRef = useRef6(state);
|
|
5161
5112
|
const inputValueRef = useRef6(inputValue);
|
|
5162
5113
|
const attachmentsRef = useRef6(attachments);
|
|
5163
|
-
|
|
5114
|
+
useEffect11(() => {
|
|
5164
5115
|
stateRef.current = state;
|
|
5165
5116
|
}, [state]);
|
|
5166
|
-
|
|
5117
|
+
useEffect11(() => {
|
|
5167
5118
|
inputValueRef.current = inputValue;
|
|
5168
5119
|
}, [inputValue]);
|
|
5169
|
-
|
|
5120
|
+
useEffect11(() => {
|
|
5170
5121
|
attachmentsRef.current = attachments;
|
|
5171
5122
|
}, [attachments]);
|
|
5172
|
-
const [isCustomMounted, setIsCustomMounted] =
|
|
5173
|
-
const [isCustomVisible, setIsCustomVisible] =
|
|
5123
|
+
const [isCustomMounted, setIsCustomMounted] = useState9(false);
|
|
5124
|
+
const [isCustomVisible, setIsCustomVisible] = useState9(false);
|
|
5174
5125
|
const virtualizer = useVirtualizer({
|
|
5175
5126
|
count: messages.length,
|
|
5176
5127
|
getScrollElement: () => scrollAreaRef.current,
|
|
@@ -5189,7 +5140,7 @@ var ChatUI = ({
|
|
|
5189
5140
|
[]
|
|
5190
5141
|
// No dependencies - uses refs for latest state
|
|
5191
5142
|
);
|
|
5192
|
-
|
|
5143
|
+
useEffect11(() => {
|
|
5193
5144
|
const checkMobile = () => {
|
|
5194
5145
|
setIsMobile(globalThis.innerWidth < 1024);
|
|
5195
5146
|
};
|
|
@@ -5197,7 +5148,7 @@ var ChatUI = ({
|
|
|
5197
5148
|
globalThis.addEventListener("resize", checkMobile);
|
|
5198
5149
|
return () => globalThis.removeEventListener("resize", checkMobile);
|
|
5199
5150
|
}, []);
|
|
5200
|
-
|
|
5151
|
+
useEffect11(() => {
|
|
5201
5152
|
if (!isMobile || !config.customComponent?.component) return;
|
|
5202
5153
|
if (state.showSidebar) {
|
|
5203
5154
|
setIsCustomMounted(true);
|
|
@@ -5209,7 +5160,7 @@ var ChatUI = ({
|
|
|
5209
5160
|
}
|
|
5210
5161
|
}, [state.showSidebar, isMobile, config.customComponent]);
|
|
5211
5162
|
const prevMessageCountRef = useRef6(0);
|
|
5212
|
-
|
|
5163
|
+
useEffect11(() => {
|
|
5213
5164
|
if (messages.length === 0) {
|
|
5214
5165
|
prevMessageCountRef.current = 0;
|
|
5215
5166
|
return;
|
|
@@ -5239,13 +5190,13 @@ var ChatUI = ({
|
|
|
5239
5190
|
}
|
|
5240
5191
|
});
|
|
5241
5192
|
}, [messages, state.isAtBottom, virtualizer]);
|
|
5242
|
-
|
|
5193
|
+
useEffect11(() => {
|
|
5243
5194
|
virtualizer.measure();
|
|
5244
5195
|
}, [expandedMessageIds, virtualizer]);
|
|
5245
|
-
|
|
5196
|
+
useEffect11(() => {
|
|
5246
5197
|
prependSnapshotRef.current = null;
|
|
5247
5198
|
}, [currentThreadId]);
|
|
5248
|
-
|
|
5199
|
+
useEffect11(() => {
|
|
5249
5200
|
const snapshot = prependSnapshotRef.current;
|
|
5250
5201
|
if (!snapshot) return;
|
|
5251
5202
|
if (messages.length <= snapshot.messageCount) {
|
|
@@ -5282,7 +5233,7 @@ var ChatUI = ({
|
|
|
5282
5233
|
} : null;
|
|
5283
5234
|
onLoadOlderMessages();
|
|
5284
5235
|
}, [hasMoreMessagesBefore, isLoadingOlderMessages, messages, onLoadOlderMessages]);
|
|
5285
|
-
|
|
5236
|
+
useEffect11(() => {
|
|
5286
5237
|
const validMessageIds = new Set(messages.map((message) => message.id));
|
|
5287
5238
|
setExpandedMessageIds((prev) => {
|
|
5288
5239
|
const activeIds = Object.keys(prev);
|
|
@@ -5372,7 +5323,7 @@ var ChatUI = ({
|
|
|
5372
5323
|
const handleCustomComponentToggle = useCallback4(() => {
|
|
5373
5324
|
setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar }));
|
|
5374
5325
|
}, []);
|
|
5375
|
-
const sidebarUser =
|
|
5326
|
+
const sidebarUser = useMemo6(() => user ? {
|
|
5376
5327
|
id: user.id,
|
|
5377
5328
|
name: user.name,
|
|
5378
5329
|
email: user.email,
|
|
@@ -5382,7 +5333,7 @@ var ChatUI = ({
|
|
|
5382
5333
|
setIsUserProfileOpen(true);
|
|
5383
5334
|
callbacks.onViewProfile?.();
|
|
5384
5335
|
}, [callbacks.onViewProfile]);
|
|
5385
|
-
const sidebarUserMenuCallbacks =
|
|
5336
|
+
const sidebarUserMenuCallbacks = useMemo6(() => ({
|
|
5386
5337
|
onViewProfile: handleViewProfile,
|
|
5387
5338
|
onOpenSettings: callbacks.onOpenSettings,
|
|
5388
5339
|
onThemeChange: callbacks.onThemeChange,
|
|
@@ -5399,13 +5350,13 @@ var ChatUI = ({
|
|
|
5399
5350
|
const SuggestionIconComponents = [MessageSquare, Lightbulb2, Zap, HelpCircle];
|
|
5400
5351
|
const renderSuggestions = () => {
|
|
5401
5352
|
if (messages.length > 0 || !suggestions.length) return null;
|
|
5402
|
-
return /* @__PURE__ */
|
|
5403
|
-
/* @__PURE__ */
|
|
5404
|
-
/* @__PURE__ */
|
|
5405
|
-
/* @__PURE__ */
|
|
5406
|
-
/* @__PURE__ */
|
|
5353
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
|
|
5354
|
+
/* @__PURE__ */ jsxs17("div", { className: "text-center mb-8", children: [
|
|
5355
|
+
/* @__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" }) }),
|
|
5356
|
+
/* @__PURE__ */ jsx27("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
|
|
5357
|
+
/* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
|
|
5407
5358
|
] }),
|
|
5408
|
-
/* @__PURE__ */
|
|
5359
|
+
/* @__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
5360
|
"button",
|
|
5410
5361
|
{
|
|
5411
5362
|
type: "button",
|
|
@@ -5414,10 +5365,10 @@ var ChatUI = ({
|
|
|
5414
5365
|
children: [
|
|
5415
5366
|
(() => {
|
|
5416
5367
|
const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
|
|
5417
|
-
return /* @__PURE__ */
|
|
5368
|
+
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
5369
|
})(),
|
|
5419
|
-
/* @__PURE__ */
|
|
5420
|
-
/* @__PURE__ */
|
|
5370
|
+
/* @__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 }) }),
|
|
5371
|
+
/* @__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
5372
|
]
|
|
5422
5373
|
},
|
|
5423
5374
|
index
|
|
@@ -5428,41 +5379,41 @@ var ChatUI = ({
|
|
|
5428
5379
|
const items = messageSuggestions?.[messageId];
|
|
5429
5380
|
if (!items || items.length === 0) return null;
|
|
5430
5381
|
const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
|
|
5431
|
-
return /* @__PURE__ */
|
|
5382
|
+
return /* @__PURE__ */ jsx27("div", { className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`, children: items.map((suggestion, index) => /* @__PURE__ */ jsxs17(
|
|
5432
5383
|
"button",
|
|
5433
5384
|
{
|
|
5434
5385
|
type: "button",
|
|
5435
5386
|
onClick: () => handleSendMessage(suggestion),
|
|
5436
5387
|
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
5388
|
children: [
|
|
5438
|
-
/* @__PURE__ */
|
|
5439
|
-
/* @__PURE__ */
|
|
5389
|
+
/* @__PURE__ */ jsx27(Sparkles2, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
5390
|
+
/* @__PURE__ */ jsx27("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
5440
5391
|
]
|
|
5441
5392
|
},
|
|
5442
5393
|
`${messageId}-suggestion-${index}`
|
|
5443
5394
|
)) });
|
|
5444
5395
|
};
|
|
5445
|
-
const renderMessageLoadingSkeleton = () => /* @__PURE__ */
|
|
5396
|
+
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx27("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
5446
5397
|
const isUserRow = index % 2 === 1;
|
|
5447
|
-
return /* @__PURE__ */
|
|
5398
|
+
return /* @__PURE__ */ jsxs17(
|
|
5448
5399
|
"div",
|
|
5449
5400
|
{
|
|
5450
5401
|
className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
|
|
5451
5402
|
children: [
|
|
5452
|
-
!isUserRow && /* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
/* @__PURE__ */
|
|
5455
|
-
/* @__PURE__ */
|
|
5456
|
-
/* @__PURE__ */
|
|
5403
|
+
!isUserRow && /* @__PURE__ */ jsx27(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
|
|
5404
|
+
/* @__PURE__ */ jsxs17("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
|
|
5405
|
+
/* @__PURE__ */ jsx27(Skeleton, { className: "h-4 w-24" }),
|
|
5406
|
+
/* @__PURE__ */ jsx27(Skeleton, { className: "h-4 w-full" }),
|
|
5407
|
+
/* @__PURE__ */ jsx27(Skeleton, { className: "h-4 w-[85%]" })
|
|
5457
5408
|
] }),
|
|
5458
|
-
isUserRow && /* @__PURE__ */
|
|
5409
|
+
isUserRow && /* @__PURE__ */ jsx27(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
|
|
5459
5410
|
]
|
|
5460
5411
|
},
|
|
5461
5412
|
`message-skeleton-${index}`
|
|
5462
5413
|
);
|
|
5463
5414
|
}) });
|
|
5464
5415
|
const isMultiAgentMode = config.agentSelector?.mode === "multi";
|
|
5465
|
-
const messageProps =
|
|
5416
|
+
const messageProps = useMemo6(() => ({
|
|
5466
5417
|
userAvatar: user?.avatar,
|
|
5467
5418
|
userName: user?.name,
|
|
5468
5419
|
assistantAvatar: assistant?.avatar,
|
|
@@ -5472,11 +5423,10 @@ var ChatUI = ({
|
|
|
5472
5423
|
enableCopy: config.features.enableMessageCopy,
|
|
5473
5424
|
enableEdit: config.features.enableMessageEditing,
|
|
5474
5425
|
enableRegenerate: config.features.enableRegeneration,
|
|
5475
|
-
|
|
5426
|
+
activityDisplay: config.features.activityDisplay,
|
|
5476
5427
|
compactMode: config.ui.compactMode,
|
|
5477
5428
|
onAction: handleMessageAction,
|
|
5478
|
-
|
|
5479
|
-
thinkingLabel: config.labels.thinking,
|
|
5429
|
+
labels: config.labels,
|
|
5480
5430
|
showMoreLabel: config.labels.showMoreMessage,
|
|
5481
5431
|
showLessLabel: config.labels.showLessMessage,
|
|
5482
5432
|
collapseLongMessages: config.ui.collapseLongMessages,
|
|
@@ -5500,9 +5450,8 @@ var ChatUI = ({
|
|
|
5500
5450
|
config.features.enableMessageCopy,
|
|
5501
5451
|
config.features.enableMessageEditing,
|
|
5502
5452
|
config.features.enableRegeneration,
|
|
5503
|
-
config.features.
|
|
5504
|
-
config.labels
|
|
5505
|
-
config.labels.thinking,
|
|
5453
|
+
config.features.activityDisplay,
|
|
5454
|
+
config.labels,
|
|
5506
5455
|
config.labels.showMoreMessage,
|
|
5507
5456
|
config.labels.showLessMessage,
|
|
5508
5457
|
config.ui.collapseLongMessages,
|
|
@@ -5517,8 +5466,8 @@ var ChatUI = ({
|
|
|
5517
5466
|
const shouldShowAgentSelector = Boolean(
|
|
5518
5467
|
config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
|
|
5519
5468
|
);
|
|
5520
|
-
return /* @__PURE__ */
|
|
5521
|
-
/* @__PURE__ */
|
|
5469
|
+
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: [
|
|
5470
|
+
/* @__PURE__ */ jsx27(
|
|
5522
5471
|
Sidebar2,
|
|
5523
5472
|
{
|
|
5524
5473
|
threads,
|
|
@@ -5535,8 +5484,8 @@ var ChatUI = ({
|
|
|
5535
5484
|
showThemeOptions: !!callbacks.onThemeChange
|
|
5536
5485
|
}
|
|
5537
5486
|
),
|
|
5538
|
-
/* @__PURE__ */
|
|
5539
|
-
/* @__PURE__ */
|
|
5487
|
+
/* @__PURE__ */ jsx27(SidebarInset, { children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
5488
|
+
/* @__PURE__ */ jsx27(
|
|
5540
5489
|
ChatHeader,
|
|
5541
5490
|
{
|
|
5542
5491
|
config,
|
|
@@ -5554,9 +5503,9 @@ var ChatUI = ({
|
|
|
5554
5503
|
onParticipantsChange
|
|
5555
5504
|
}
|
|
5556
5505
|
),
|
|
5557
|
-
/* @__PURE__ */
|
|
5558
|
-
/* @__PURE__ */
|
|
5559
|
-
/* @__PURE__ */
|
|
5506
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
5507
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
5508
|
+
/* @__PURE__ */ jsx27(
|
|
5560
5509
|
ScrollArea,
|
|
5561
5510
|
{
|
|
5562
5511
|
ref: scrollAreaRef,
|
|
@@ -5564,8 +5513,8 @@ var ChatUI = ({
|
|
|
5564
5513
|
viewportClassName: "p-4 overscroll-contain",
|
|
5565
5514
|
onScrollCapture: handleScroll,
|
|
5566
5515
|
style: { contain: "strict" },
|
|
5567
|
-
children: /* @__PURE__ */
|
|
5568
|
-
messages.length > 0 && /* @__PURE__ */
|
|
5516
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "max-w-4xl mx-auto pb-4", children: [
|
|
5517
|
+
messages.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
5518
|
"button",
|
|
5570
5519
|
{
|
|
5571
5520
|
type: "button",
|
|
@@ -5574,7 +5523,7 @@ var ChatUI = ({
|
|
|
5574
5523
|
children: config.labels.loadOlderMessages
|
|
5575
5524
|
}
|
|
5576
5525
|
) : null }),
|
|
5577
|
-
isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */
|
|
5526
|
+
isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */ jsx27(
|
|
5578
5527
|
"div",
|
|
5579
5528
|
{
|
|
5580
5529
|
style: {
|
|
@@ -5586,7 +5535,7 @@ var ChatUI = ({
|
|
|
5586
5535
|
const message = messages[virtualRow.index];
|
|
5587
5536
|
const prevMessage = virtualRow.index > 0 ? messages[virtualRow.index - 1] : null;
|
|
5588
5537
|
const isGrouped = prevMessage !== null && prevMessage.role === message.role && getMessageSpeakerKey(prevMessage) === getMessageSpeakerKey(message);
|
|
5589
|
-
return /* @__PURE__ */
|
|
5538
|
+
return /* @__PURE__ */ jsx27(
|
|
5590
5539
|
"div",
|
|
5591
5540
|
{
|
|
5592
5541
|
"data-index": virtualRow.index,
|
|
@@ -5598,8 +5547,8 @@ var ChatUI = ({
|
|
|
5598
5547
|
width: "100%",
|
|
5599
5548
|
transform: `translateY(${virtualRow.start}px)`
|
|
5600
5549
|
},
|
|
5601
|
-
children: /* @__PURE__ */
|
|
5602
|
-
/* @__PURE__ */
|
|
5550
|
+
children: /* @__PURE__ */ jsxs17("div", { className: virtualRow.index === 0 ? "" : isGrouped ? "pt-2" : "pt-4", children: [
|
|
5551
|
+
/* @__PURE__ */ jsx27(
|
|
5603
5552
|
Message,
|
|
5604
5553
|
{
|
|
5605
5554
|
message,
|
|
@@ -5619,8 +5568,8 @@ var ChatUI = ({
|
|
|
5619
5568
|
] })
|
|
5620
5569
|
}
|
|
5621
5570
|
),
|
|
5622
|
-
/* @__PURE__ */
|
|
5623
|
-
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */
|
|
5571
|
+
/* @__PURE__ */ jsxs17("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
|
|
5572
|
+
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ jsx27("div", { className: "px-4 pt-1", children: /* @__PURE__ */ jsx27(
|
|
5624
5573
|
TargetAgentSelector,
|
|
5625
5574
|
{
|
|
5626
5575
|
agents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
|
|
@@ -5630,7 +5579,7 @@ var ChatUI = ({
|
|
|
5630
5579
|
disabled: isGenerating
|
|
5631
5580
|
}
|
|
5632
5581
|
) }),
|
|
5633
|
-
/* @__PURE__ */
|
|
5582
|
+
/* @__PURE__ */ jsx27(
|
|
5634
5583
|
ChatInput,
|
|
5635
5584
|
{
|
|
5636
5585
|
value: inputValue,
|
|
@@ -5659,12 +5608,12 @@ var ChatUI = ({
|
|
|
5659
5608
|
)
|
|
5660
5609
|
] })
|
|
5661
5610
|
] }),
|
|
5662
|
-
config?.customComponent?.component && !isMobile && /* @__PURE__ */
|
|
5611
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx27(
|
|
5663
5612
|
"div",
|
|
5664
5613
|
{
|
|
5665
5614
|
className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
|
|
5666
5615
|
style: { width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0 },
|
|
5667
|
-
children: state.showSidebar && /* @__PURE__ */
|
|
5616
|
+
children: state.showSidebar && /* @__PURE__ */ jsx27(
|
|
5668
5617
|
"div",
|
|
5669
5618
|
{
|
|
5670
5619
|
className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
|
|
@@ -5676,8 +5625,8 @@ var ChatUI = ({
|
|
|
5676
5625
|
)
|
|
5677
5626
|
] })
|
|
5678
5627
|
] }) }),
|
|
5679
|
-
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */
|
|
5680
|
-
/* @__PURE__ */
|
|
5628
|
+
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs17("div", { className: "fixed inset-0 z-50", children: [
|
|
5629
|
+
/* @__PURE__ */ jsx27(
|
|
5681
5630
|
"div",
|
|
5682
5631
|
{
|
|
5683
5632
|
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
@@ -5685,16 +5634,16 @@ var ChatUI = ({
|
|
|
5685
5634
|
onClick: closeSidebar
|
|
5686
5635
|
}
|
|
5687
5636
|
),
|
|
5688
|
-
/* @__PURE__ */
|
|
5637
|
+
/* @__PURE__ */ jsx27(
|
|
5689
5638
|
"div",
|
|
5690
5639
|
{
|
|
5691
5640
|
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
5641
|
style: { willChange: "transform" },
|
|
5693
|
-
children: /* @__PURE__ */
|
|
5642
|
+
children: /* @__PURE__ */ jsx27("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
|
|
5694
5643
|
}
|
|
5695
5644
|
)
|
|
5696
5645
|
] }),
|
|
5697
|
-
isUserProfileOpen && /* @__PURE__ */
|
|
5646
|
+
isUserProfileOpen && /* @__PURE__ */ jsx27(
|
|
5698
5647
|
UserProfile,
|
|
5699
5648
|
{
|
|
5700
5649
|
isOpen: isUserProfileOpen,
|
|
@@ -5715,302 +5664,11 @@ var ChatUI = ({
|
|
|
5715
5664
|
)
|
|
5716
5665
|
] }) }) });
|
|
5717
5666
|
};
|
|
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
5667
|
export {
|
|
5994
|
-
|
|
5995
|
-
ChatHeader,
|
|
5996
|
-
ChatInput,
|
|
5668
|
+
AssistantActivity,
|
|
5997
5669
|
ChatUI,
|
|
5998
5670
|
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
5671
|
defaultChatConfig,
|
|
6011
|
-
formatDate,
|
|
6012
|
-
getAgentColor,
|
|
6013
|
-
getAgentInitials,
|
|
6014
5672
|
mergeConfig,
|
|
6015
5673
|
useChatUserContext
|
|
6016
5674
|
};
|