@copilotz/chat-ui 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +456 -327
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +467 -333
- package/dist/index.js.map +1 -1
- package/dist/styles.css +33 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,8 @@ __export(index_exports, {
|
|
|
35
35
|
ChatUserContextProvider: () => ChatUserContextProvider,
|
|
36
36
|
MessageSenderAvatar: () => MessageSenderAvatar,
|
|
37
37
|
defaultChatConfig: () => defaultChatConfig,
|
|
38
|
+
getAttachmentKindFromMimeType: () => getAttachmentKindFromMimeType,
|
|
39
|
+
getMimeTypeFromDataUrl: () => getMimeTypeFromDataUrl,
|
|
38
40
|
mergeConfig: () => mergeConfig,
|
|
39
41
|
resolveMessageSenderDisplay: () => resolveMessageSenderDisplay,
|
|
40
42
|
useChatUserContext: () => useChatUserContext
|
|
@@ -253,6 +255,29 @@ var createObjectUrlFromDataUrl = (dataUrl) => {
|
|
|
253
255
|
return null;
|
|
254
256
|
}
|
|
255
257
|
};
|
|
258
|
+
var getAttachmentKindFromMimeType = (mimeType) => {
|
|
259
|
+
const normalized = (mimeType || "").toLowerCase();
|
|
260
|
+
if (normalized.startsWith("image/")) return "image";
|
|
261
|
+
if (normalized.startsWith("audio/")) return "audio";
|
|
262
|
+
if (normalized.startsWith("video/")) return "video";
|
|
263
|
+
return "file";
|
|
264
|
+
};
|
|
265
|
+
var getMimeTypeFromDataUrl = (dataUrl) => {
|
|
266
|
+
const match = dataUrl.match(/^data:([^;,]+)[;,]/);
|
|
267
|
+
return match?.[1] || null;
|
|
268
|
+
};
|
|
269
|
+
var formatFileSize = (bytes) => {
|
|
270
|
+
if (typeof bytes !== "number" || !Number.isFinite(bytes) || bytes < 0) return "";
|
|
271
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
272
|
+
const units = ["KB", "MB", "GB", "TB"];
|
|
273
|
+
let value = bytes / 1024;
|
|
274
|
+
let unitIndex = 0;
|
|
275
|
+
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
276
|
+
value /= 1024;
|
|
277
|
+
unitIndex += 1;
|
|
278
|
+
}
|
|
279
|
+
return `${value >= 10 ? value.toFixed(0) : value.toFixed(1)} ${units[unitIndex]}`;
|
|
280
|
+
};
|
|
256
281
|
|
|
257
282
|
// src/components/ui/button.tsx
|
|
258
283
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -402,10 +427,155 @@ function TooltipContent({
|
|
|
402
427
|
) });
|
|
403
428
|
}
|
|
404
429
|
|
|
405
|
-
// src/components/
|
|
406
|
-
var
|
|
430
|
+
// src/components/ui/dialog.tsx
|
|
431
|
+
var React = __toESM(require("react"), 1);
|
|
432
|
+
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
407
433
|
var import_lucide_react = require("lucide-react");
|
|
408
434
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
435
|
+
function cleanupBodyStyles() {
|
|
436
|
+
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
437
|
+
document.body.style.pointerEvents = "";
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function Dialog({
|
|
441
|
+
open,
|
|
442
|
+
onOpenChange,
|
|
443
|
+
...props
|
|
444
|
+
}) {
|
|
445
|
+
const prevOpenRef = React.useRef(open);
|
|
446
|
+
React.useEffect(() => {
|
|
447
|
+
if (prevOpenRef.current === true && open === false) {
|
|
448
|
+
const timeout = setTimeout(cleanupBodyStyles, 250);
|
|
449
|
+
return () => clearTimeout(timeout);
|
|
450
|
+
}
|
|
451
|
+
prevOpenRef.current = open;
|
|
452
|
+
}, [open]);
|
|
453
|
+
React.useEffect(() => {
|
|
454
|
+
return () => {
|
|
455
|
+
cleanupBodyStyles();
|
|
456
|
+
};
|
|
457
|
+
}, []);
|
|
458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", open, onOpenChange, ...props });
|
|
459
|
+
}
|
|
460
|
+
function DialogTrigger({
|
|
461
|
+
...props
|
|
462
|
+
}) {
|
|
463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
464
|
+
}
|
|
465
|
+
function DialogPortal({
|
|
466
|
+
...props
|
|
467
|
+
}) {
|
|
468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
469
|
+
}
|
|
470
|
+
function DialogOverlay({
|
|
471
|
+
className,
|
|
472
|
+
...props
|
|
473
|
+
}) {
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
475
|
+
DialogPrimitive.Overlay,
|
|
476
|
+
{
|
|
477
|
+
"data-slot": "dialog-overlay",
|
|
478
|
+
className: cn(
|
|
479
|
+
"fixed inset-0 z-50 bg-black/50",
|
|
480
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
481
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
482
|
+
"data-[state=closed]:pointer-events-none",
|
|
483
|
+
className
|
|
484
|
+
),
|
|
485
|
+
...props
|
|
486
|
+
}
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
function DialogContent({
|
|
490
|
+
className,
|
|
491
|
+
children,
|
|
492
|
+
showCloseButton = true,
|
|
493
|
+
...props
|
|
494
|
+
}) {
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogOverlay, {}),
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
498
|
+
DialogPrimitive.Content,
|
|
499
|
+
{
|
|
500
|
+
"data-slot": "dialog-content",
|
|
501
|
+
"aria-describedby": void 0,
|
|
502
|
+
className: cn(
|
|
503
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
504
|
+
className
|
|
505
|
+
),
|
|
506
|
+
...props,
|
|
507
|
+
children: [
|
|
508
|
+
children,
|
|
509
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
510
|
+
DialogPrimitive.Close,
|
|
511
|
+
{
|
|
512
|
+
"data-slot": "dialog-close",
|
|
513
|
+
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",
|
|
514
|
+
children: [
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.XIcon, {}),
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sr-only", children: "Close" })
|
|
517
|
+
]
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
] });
|
|
524
|
+
}
|
|
525
|
+
function DialogHeader({ className, ...props }) {
|
|
526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
527
|
+
"div",
|
|
528
|
+
{
|
|
529
|
+
"data-slot": "dialog-header",
|
|
530
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
531
|
+
...props
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
function DialogFooter({ className, ...props }) {
|
|
536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
537
|
+
"div",
|
|
538
|
+
{
|
|
539
|
+
"data-slot": "dialog-footer",
|
|
540
|
+
className: cn(
|
|
541
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
542
|
+
className
|
|
543
|
+
),
|
|
544
|
+
...props
|
|
545
|
+
}
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
function DialogTitle({
|
|
549
|
+
className,
|
|
550
|
+
...props
|
|
551
|
+
}) {
|
|
552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
553
|
+
DialogPrimitive.Title,
|
|
554
|
+
{
|
|
555
|
+
"data-slot": "dialog-title",
|
|
556
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
557
|
+
...props
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
function DialogDescription({
|
|
562
|
+
className,
|
|
563
|
+
...props
|
|
564
|
+
}) {
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
566
|
+
DialogPrimitive.Description,
|
|
567
|
+
{
|
|
568
|
+
"data-slot": "dialog-description",
|
|
569
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
570
|
+
...props
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// src/components/chat/AssistantActivity.tsx
|
|
576
|
+
var import_react = require("react");
|
|
577
|
+
var import_lucide_react2 = require("lucide-react");
|
|
578
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
409
579
|
var ROOT_CLASS = "mb-4 w-full max-w-full min-w-0";
|
|
410
580
|
var interpolate = (template, replacements) => Object.entries(replacements).reduce(
|
|
411
581
|
(output, [key, value]) => output.replaceAll(`{{${key}}}`, String(value ?? "")),
|
|
@@ -430,33 +600,33 @@ var resolveActivityLabel = (item, labels) => {
|
|
|
430
600
|
return item.status === "active" ? labels?.activityThinkingActive || "Thinking" : labels?.activityThinkingComplete || "Thought through request";
|
|
431
601
|
};
|
|
432
602
|
var ActivityIcon = ({ item }) => {
|
|
433
|
-
if (item.status === "active") return /* @__PURE__ */ (0,
|
|
434
|
-
if (item.status === "failed") return /* @__PURE__ */ (0,
|
|
435
|
-
if (item.status === "complete") return /* @__PURE__ */ (0,
|
|
436
|
-
if (item.kind === "tool") return /* @__PURE__ */ (0,
|
|
437
|
-
if (item.kind === "answering") return /* @__PURE__ */ (0,
|
|
438
|
-
if (item.kind === "thinking") return /* @__PURE__ */ (0,
|
|
439
|
-
return /* @__PURE__ */ (0,
|
|
603
|
+
if (item.status === "active") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.LoaderCircle, { className: "h-4 w-4 animate-spin text-primary" });
|
|
604
|
+
if (item.status === "failed") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.CircleAlert, { className: "h-4 w-4 text-destructive" });
|
|
605
|
+
if (item.status === "complete") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.CheckCircle2, { className: "h-4 w-4 text-muted-foreground" });
|
|
606
|
+
if (item.kind === "tool") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Wrench, { className: "h-4 w-4 text-muted-foreground" });
|
|
607
|
+
if (item.kind === "answering") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Sparkles, { className: "h-4 w-4 text-muted-foreground" });
|
|
608
|
+
if (item.kind === "thinking") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Brain, { className: "h-4 w-4 text-muted-foreground" });
|
|
609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.CheckCircle2, { className: "h-4 w-4 text-muted-foreground" });
|
|
440
610
|
};
|
|
441
611
|
var ActivityDetails = (0, import_react.memo)(function ActivityDetails2({
|
|
442
612
|
item
|
|
443
613
|
}) {
|
|
444
614
|
const toolCall = item.details?.toolCall;
|
|
445
|
-
return /* @__PURE__ */ (0,
|
|
446
|
-
item.details?.reasoning && /* @__PURE__ */ (0,
|
|
447
|
-
item.details?.error && /* @__PURE__ */ (0,
|
|
448
|
-
toolCall && /* @__PURE__ */ (0,
|
|
449
|
-
item.details?.result !== void 0 && /* @__PURE__ */ (0,
|
|
615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-3 pb-1 pl-7 pt-2 text-sm text-muted-foreground", children: [
|
|
616
|
+
item.details?.reasoning && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "whitespace-pre-wrap break-words leading-6", children: item.details.reasoning }),
|
|
617
|
+
item.details?.error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "text-destructive", children: item.details.error }),
|
|
618
|
+
toolCall && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("pre", { className: "overflow-x-auto rounded-md bg-muted/60 p-2 text-xs", children: JSON.stringify(toolCall.arguments, null, 2) }),
|
|
619
|
+
item.details?.result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("pre", { className: "overflow-x-auto rounded-md bg-muted/60 p-2 text-xs", children: JSON.stringify(item.details.result, null, 2) })
|
|
450
620
|
] });
|
|
451
621
|
});
|
|
452
622
|
var ActivitySkeleton = (0, import_react.memo)(function ActivitySkeleton2() {
|
|
453
|
-
return /* @__PURE__ */ (0,
|
|
454
|
-
/* @__PURE__ */ (0,
|
|
455
|
-
/* @__PURE__ */ (0,
|
|
456
|
-
/* @__PURE__ */ (0,
|
|
457
|
-
/* @__PURE__ */ (0,
|
|
623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: ROOT_CLASS, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full min-w-0 items-center gap-3 rounded-md border border-border/50 bg-muted/20 px-3 py-2", children: [
|
|
624
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
625
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "inline-block h-2 w-2 animate-pulse rounded-full bg-primary/80" }),
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "inline-block h-2 w-2 animate-pulse rounded-full bg-primary/60 [animation-delay:120ms]" }),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "inline-block h-2 w-2 animate-pulse rounded-full bg-primary/40 [animation-delay:240ms]" })
|
|
458
628
|
] }),
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "h-3 w-28 animate-pulse rounded-full bg-muted" })
|
|
460
630
|
] }) });
|
|
461
631
|
});
|
|
462
632
|
var ActivityTimeline = (0, import_react.memo)(function ActivityTimeline2({
|
|
@@ -465,15 +635,15 @@ var ActivityTimeline = (0, import_react.memo)(function ActivityTimeline2({
|
|
|
465
635
|
labels
|
|
466
636
|
}) {
|
|
467
637
|
const [openById, setOpenById] = (0, import_react.useState)({});
|
|
468
|
-
return /* @__PURE__ */ (0,
|
|
638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: ROOT_CLASS, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "space-y-1", children: activity.items.map((item, index) => {
|
|
469
639
|
const detailsAvailable = showActivityDetails && hasDetails(item);
|
|
470
640
|
const open = Boolean(openById[item.id]);
|
|
471
641
|
const isLast = index === activity.items.length - 1;
|
|
472
|
-
return /* @__PURE__ */ (0,
|
|
473
|
-
!isLast && /* @__PURE__ */ (0,
|
|
474
|
-
/* @__PURE__ */ (0,
|
|
475
|
-
/* @__PURE__ */ (0,
|
|
476
|
-
/* @__PURE__ */ (0,
|
|
642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative grid grid-cols-[1rem_minmax(0,1fr)] gap-3", children: [
|
|
643
|
+
!isLast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute left-2 top-5 h-[calc(100%-0.25rem)] w-px bg-border" }),
|
|
644
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "relative z-10 mt-1 flex h-4 w-4 items-center justify-center bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ActivityIcon, { item }) }),
|
|
645
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "min-w-0", children: [
|
|
646
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
477
647
|
Button,
|
|
478
648
|
{
|
|
479
649
|
type: "button",
|
|
@@ -486,12 +656,12 @@ var ActivityTimeline = (0, import_react.memo)(function ActivityTimeline2({
|
|
|
486
656
|
!detailsAvailable && "pointer-events-none opacity-100"
|
|
487
657
|
),
|
|
488
658
|
children: [
|
|
489
|
-
/* @__PURE__ */ (0,
|
|
490
|
-
detailsAvailable && (open ? /* @__PURE__ */ (0,
|
|
659
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "min-w-0 truncate", children: resolveActivityLabel(item, labels) }),
|
|
660
|
+
detailsAvailable && (open ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.ChevronDown, { className: "h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.ChevronRight, { className: "h-3.5 w-3.5 shrink-0" }))
|
|
491
661
|
]
|
|
492
662
|
}
|
|
493
663
|
),
|
|
494
|
-
detailsAvailable && open && /* @__PURE__ */ (0,
|
|
664
|
+
detailsAvailable && open && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ActivityDetails, { item })
|
|
495
665
|
] })
|
|
496
666
|
] }, item.id);
|
|
497
667
|
}) }) });
|
|
@@ -503,8 +673,8 @@ var AssistantActivity = (0, import_react.memo)(function AssistantActivity2({
|
|
|
503
673
|
labels
|
|
504
674
|
}) {
|
|
505
675
|
if (!activity || activity.items.length === 0) return null;
|
|
506
|
-
if (!showActivity) return hasActiveItem(activity) ? /* @__PURE__ */ (0,
|
|
507
|
-
return /* @__PURE__ */ (0,
|
|
676
|
+
if (!showActivity) return hasActiveItem(activity) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ActivitySkeleton, {}) : null;
|
|
677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
508
678
|
ActivityTimeline,
|
|
509
679
|
{
|
|
510
680
|
activity,
|
|
@@ -560,12 +730,12 @@ function assignAgentColors(agents) {
|
|
|
560
730
|
|
|
561
731
|
// src/components/ui/avatar.tsx
|
|
562
732
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"), 1);
|
|
563
|
-
var
|
|
733
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
564
734
|
function Avatar({
|
|
565
735
|
className,
|
|
566
736
|
...props
|
|
567
737
|
}) {
|
|
568
|
-
return /* @__PURE__ */ (0,
|
|
738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
569
739
|
AvatarPrimitive.Root,
|
|
570
740
|
{
|
|
571
741
|
"data-slot": "avatar",
|
|
@@ -581,7 +751,7 @@ function AvatarImage({
|
|
|
581
751
|
className,
|
|
582
752
|
...props
|
|
583
753
|
}) {
|
|
584
|
-
return /* @__PURE__ */ (0,
|
|
754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
585
755
|
AvatarPrimitive.Image,
|
|
586
756
|
{
|
|
587
757
|
"data-slot": "avatar-image",
|
|
@@ -594,7 +764,7 @@ function AvatarFallback({
|
|
|
594
764
|
className,
|
|
595
765
|
...props
|
|
596
766
|
}) {
|
|
597
|
-
return /* @__PURE__ */ (0,
|
|
767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
598
768
|
AvatarPrimitive.Fallback,
|
|
599
769
|
{
|
|
600
770
|
"data-slot": "avatar-fallback",
|
|
@@ -608,7 +778,7 @@ function AvatarFallback({
|
|
|
608
778
|
}
|
|
609
779
|
|
|
610
780
|
// src/components/chat/MessageSender.tsx
|
|
611
|
-
var
|
|
781
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
612
782
|
var resolveMessageSenderDisplay = ({
|
|
613
783
|
sender,
|
|
614
784
|
fallbackName,
|
|
@@ -627,9 +797,9 @@ var resolveMessageSenderDisplay = ({
|
|
|
627
797
|
return {
|
|
628
798
|
name,
|
|
629
799
|
color,
|
|
630
|
-
avatar: /* @__PURE__ */ (0,
|
|
631
|
-
sender?.avatarUrl || fallbackAvatarUrl ? /* @__PURE__ */ (0,
|
|
632
|
-
shouldUseFallbackAvatar ? fallbackAvatar : /* @__PURE__ */ (0,
|
|
800
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
801
|
+
sender?.avatarUrl || fallbackAvatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AvatarImage, { src: sender?.avatarUrl || fallbackAvatarUrl, alt: name }) : null,
|
|
802
|
+
shouldUseFallbackAvatar ? fallbackAvatar : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
633
803
|
AvatarFallback,
|
|
634
804
|
{
|
|
635
805
|
className: fallbackClassName,
|
|
@@ -654,12 +824,12 @@ var MessageSenderAvatar = ({
|
|
|
654
824
|
fallbackAvatarUrl,
|
|
655
825
|
compactMode
|
|
656
826
|
});
|
|
657
|
-
return /* @__PURE__ */ (0,
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: display.avatar });
|
|
658
828
|
};
|
|
659
829
|
|
|
660
830
|
// src/components/chat/Message.tsx
|
|
661
|
-
var
|
|
662
|
-
var
|
|
831
|
+
var import_lucide_react3 = require("lucide-react");
|
|
832
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
663
833
|
var hasRenderableAssistantBody = (message) => {
|
|
664
834
|
if (message.role !== "assistant") return true;
|
|
665
835
|
if (typeof message.content === "string" && message.content.trim().length > 0) return true;
|
|
@@ -670,7 +840,7 @@ var defaultMarkdownComponents = {
|
|
|
670
840
|
code: ({ node, className, children, ...props }) => {
|
|
671
841
|
const inline = props.inline;
|
|
672
842
|
const match = /language-(\w+)/.exec(className || "");
|
|
673
|
-
return !inline && match ? /* @__PURE__ */ (0,
|
|
843
|
+
return !inline && match ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className, ...props, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className: "bg-muted px-1 py-0.5 rounded text-sm", ...props, children });
|
|
674
844
|
}
|
|
675
845
|
};
|
|
676
846
|
var remarkPluginsDefault = [import_remark_gfm.default];
|
|
@@ -707,7 +877,7 @@ var getCollapsedPreview = (content, previewChars, previewOverride) => {
|
|
|
707
877
|
return `${content.slice(0, previewChars).trimEnd()}...`;
|
|
708
878
|
};
|
|
709
879
|
var LongContentShell = (0, import_react2.memo)(function LongContentShell2({ children, className, style }) {
|
|
710
|
-
return /* @__PURE__ */ (0,
|
|
880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className, style, children });
|
|
711
881
|
});
|
|
712
882
|
var PlainTextContent = (0, import_react2.memo)(function PlainTextContent2({
|
|
713
883
|
content,
|
|
@@ -716,12 +886,12 @@ var PlainTextContent = (0, import_react2.memo)(function PlainTextContent2({
|
|
|
716
886
|
style
|
|
717
887
|
}) {
|
|
718
888
|
const chunks = (0, import_react2.useMemo)(() => getPlainTextChunks(content, chunkSize), [content, chunkSize]);
|
|
719
|
-
return /* @__PURE__ */ (0,
|
|
889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
720
890
|
LongContentShell,
|
|
721
891
|
{
|
|
722
892
|
className: `text-sm leading-6 whitespace-pre-wrap break-words ${className}`.trim(),
|
|
723
893
|
style,
|
|
724
|
-
children: chunks.map((chunk, index) => /* @__PURE__ */ (0,
|
|
894
|
+
children: chunks.map((chunk, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react2.default.Fragment, { children: chunk }, index))
|
|
725
895
|
}
|
|
726
896
|
);
|
|
727
897
|
});
|
|
@@ -756,12 +926,12 @@ var StreamingText = (0, import_react2.memo)(function StreamingText2({
|
|
|
756
926
|
],
|
|
757
927
|
[enableSyntaxHighlight, markdown?.rehypePlugins]
|
|
758
928
|
);
|
|
759
|
-
return /* @__PURE__ */ (0,
|
|
760
|
-
hasContent ? renderMarkdown ? /* @__PURE__ */ (0,
|
|
929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
930
|
+
hasContent ? renderMarkdown ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
761
931
|
LongContentShell,
|
|
762
932
|
{
|
|
763
933
|
className: `prose prose-sm max-w-none dark:prose-invert break-words ${className}`.trim(),
|
|
764
|
-
children: /* @__PURE__ */ (0,
|
|
934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
765
935
|
import_react_markdown.default,
|
|
766
936
|
{
|
|
767
937
|
remarkPlugins: mergedRemarkPlugins,
|
|
@@ -771,7 +941,7 @@ var StreamingText = (0, import_react2.memo)(function StreamingText2({
|
|
|
771
941
|
}
|
|
772
942
|
)
|
|
773
943
|
}
|
|
774
|
-
) : /* @__PURE__ */ (0,
|
|
944
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
775
945
|
PlainTextContent,
|
|
776
946
|
{
|
|
777
947
|
content,
|
|
@@ -779,9 +949,86 @@ var StreamingText = (0, import_react2.memo)(function StreamingText2({
|
|
|
779
949
|
chunkSize: plainTextChunkChars
|
|
780
950
|
}
|
|
781
951
|
) : null,
|
|
782
|
-
isStreaming && hasContent && /* @__PURE__ */ (0,
|
|
952
|
+
isStreaming && hasContent && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "inline-block w-2 h-4 bg-primary animate-pulse ml-1" })
|
|
783
953
|
] });
|
|
784
954
|
});
|
|
955
|
+
var getAttachmentLabel = (attachment) => attachment.fileName || attachment.mimeType || "Attachment";
|
|
956
|
+
var getAttachmentIcon = (attachment) => {
|
|
957
|
+
if (attachment.kind === "image") return import_lucide_react3.FileImage;
|
|
958
|
+
if (attachment.kind === "audio") return import_lucide_react3.FileAudio;
|
|
959
|
+
if (attachment.kind === "video") return import_lucide_react3.FileVideo;
|
|
960
|
+
const value = `${attachment.fileName || ""} ${attachment.mimeType || ""}`.toLowerCase();
|
|
961
|
+
if (value.includes("zip") || value.includes("gzip") || value.includes("tar") || value.includes("archive")) {
|
|
962
|
+
return import_lucide_react3.FileArchive;
|
|
963
|
+
}
|
|
964
|
+
if (value.includes("json") || value.includes("text") || value.includes("markdown") || value.includes("csv")) {
|
|
965
|
+
return import_lucide_react3.FileText;
|
|
966
|
+
}
|
|
967
|
+
return import_lucide_react3.File;
|
|
968
|
+
};
|
|
969
|
+
var AttachmentDownloadButton = ({ attachment }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { asChild: true, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("a", { href: attachment.dataUrl, download: attachment.fileName || "attachment", children: [
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Download, { className: "h-4 w-4" }),
|
|
971
|
+
"Download"
|
|
972
|
+
] }) });
|
|
973
|
+
var AttachmentMetadata = ({ attachment }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-sm", children: [
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { className: "text-muted-foreground", children: "Type" }),
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { className: "min-w-0 truncate", children: attachment.mimeType || "application/octet-stream" }),
|
|
976
|
+
attachment.fileName && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { className: "text-muted-foreground", children: "Name" }),
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { className: "min-w-0 truncate", children: attachment.fileName })
|
|
979
|
+
] }),
|
|
980
|
+
typeof attachment.size === "number" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
981
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { className: "text-muted-foreground", children: "Size" }),
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: formatFileSize(attachment.size) })
|
|
983
|
+
] })
|
|
984
|
+
] });
|
|
985
|
+
var FileAttachmentCard = ({ attachment, compact = false }) => {
|
|
986
|
+
const Icon = getAttachmentIcon(attachment);
|
|
987
|
+
const size = formatFileSize(attachment.size);
|
|
988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex items-center gap-3 rounded-lg border bg-muted/20 text-left ${compact ? "p-2" : "p-3"} max-w-md`, children: [
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { className: "h-5 w-5 text-foreground" }) }),
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
991
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "truncate text-sm font-medium", children: getAttachmentLabel(attachment) }),
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: [attachment.mimeType || "File", size].filter(Boolean).join(" \xB7 ") })
|
|
993
|
+
] })
|
|
994
|
+
] });
|
|
995
|
+
};
|
|
996
|
+
var AttachmentDialog = ({ attachment, children }) => {
|
|
997
|
+
const label = getAttachmentLabel(attachment);
|
|
998
|
+
const Icon = getAttachmentIcon(attachment);
|
|
999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Dialog, { children: [
|
|
1000
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogTrigger, { asChild: true, children }),
|
|
1001
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogContent, { className: "max-w-3xl", children: [
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogHeader, { children: [
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogTitle, { className: "truncate", children: label }),
|
|
1004
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogDescription, { children: "Attachment details and download options." })
|
|
1005
|
+
] }),
|
|
1006
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-4", children: [
|
|
1007
|
+
attachment.kind === "image" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "max-h-[65vh] overflow-auto rounded-lg border bg-muted/20", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1008
|
+
"img",
|
|
1009
|
+
{
|
|
1010
|
+
src: attachment.dataUrl,
|
|
1011
|
+
alt: label,
|
|
1012
|
+
className: "mx-auto h-auto max-h-[65vh] w-auto max-w-full object-contain"
|
|
1013
|
+
}
|
|
1014
|
+
) }) : attachment.kind === "video" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "rounded-lg border bg-muted/20", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1015
|
+
"video",
|
|
1016
|
+
{
|
|
1017
|
+
src: attachment.dataUrl,
|
|
1018
|
+
poster: attachment.poster,
|
|
1019
|
+
controls: true,
|
|
1020
|
+
className: "max-h-[65vh] w-full rounded-lg"
|
|
1021
|
+
}
|
|
1022
|
+
) }) : attachment.kind === "audio" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("audio", { className: "w-full", preload: "metadata", controls: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center gap-3 rounded-lg border bg-muted/20 p-8 text-center", children: [
|
|
1023
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-lg bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { className: "h-8 w-8 text-foreground" }) }),
|
|
1024
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "max-w-full truncate text-sm font-medium", children: label })
|
|
1025
|
+
] }),
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AttachmentMetadata, { attachment })
|
|
1027
|
+
] }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AttachmentDownloadButton, { attachment }) })
|
|
1029
|
+
] })
|
|
1030
|
+
] });
|
|
1031
|
+
};
|
|
785
1032
|
var MediaRenderer = (0, import_react2.memo)(function MediaRenderer2({ attachment }) {
|
|
786
1033
|
const [audioPlaybackSrc, setAudioPlaybackSrc] = (0, import_react2.useState)(attachment.dataUrl);
|
|
787
1034
|
(0, import_react2.useEffect)(() => {
|
|
@@ -807,41 +1054,48 @@ var MediaRenderer = (0, import_react2.memo)(function MediaRenderer2({ attachment
|
|
|
807
1054
|
};
|
|
808
1055
|
switch (attachment.kind) {
|
|
809
1056
|
case "image":
|
|
810
|
-
return /* @__PURE__ */ (0,
|
|
811
|
-
/* @__PURE__ */ (0,
|
|
1057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AttachmentDialog, { attachment, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "block max-w-md text-left", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative overflow-hidden rounded-lg border bg-muted/20", children: [
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
812
1059
|
"img",
|
|
813
1060
|
{
|
|
814
1061
|
src: attachment.dataUrl,
|
|
815
1062
|
alt: attachment.fileName || "Attachment",
|
|
816
|
-
className: "w-full
|
|
1063
|
+
className: "h-auto w-full object-cover",
|
|
817
1064
|
loading: "lazy"
|
|
818
1065
|
}
|
|
819
1066
|
),
|
|
820
|
-
attachment.fileName && /* @__PURE__ */ (0,
|
|
821
|
-
] });
|
|
1067
|
+
attachment.fileName && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-black/50 p-2 text-xs text-white", children: attachment.fileName })
|
|
1068
|
+
] }) }) });
|
|
822
1069
|
case "audio":
|
|
823
|
-
return /* @__PURE__ */ (0,
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex w-full max-w-md min-w-64 items-center gap-2 py-0", children: [
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1072
|
+
"audio",
|
|
1073
|
+
{
|
|
1074
|
+
className: "mt-2 w-full",
|
|
1075
|
+
preload: "metadata",
|
|
1076
|
+
controls: true,
|
|
1077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("source", { src: audioPlaybackSrc, type: attachment.mimeType })
|
|
1078
|
+
}
|
|
1079
|
+
),
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AttachmentDialog, { attachment, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { type: "button", variant: "outline", size: "icon", className: "mt-2 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.FileAudio, { className: "h-4 w-4" }) }) })
|
|
1081
|
+
] });
|
|
832
1082
|
case "video":
|
|
833
|
-
return /* @__PURE__ */ (0,
|
|
834
|
-
/* @__PURE__ */ (0,
|
|
1083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AttachmentDialog, { attachment, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "block max-w-lg text-left", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative overflow-hidden rounded-lg border bg-muted/20", children: [
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
835
1085
|
"video",
|
|
836
1086
|
{
|
|
837
1087
|
src: attachment.dataUrl,
|
|
838
1088
|
poster: attachment.poster,
|
|
839
|
-
|
|
840
|
-
|
|
1089
|
+
className: "h-auto w-full",
|
|
1090
|
+
muted: true,
|
|
1091
|
+
preload: "metadata"
|
|
841
1092
|
}
|
|
842
1093
|
),
|
|
843
|
-
|
|
844
|
-
|
|
1094
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-black/10", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.FileVideo, { className: "h-8 w-8 rounded-full bg-black/50 p-1.5 text-white" }) }),
|
|
1095
|
+
attachment.fileName && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-black/50 p-2 text-xs text-white", children: attachment.fileName })
|
|
1096
|
+
] }) }) });
|
|
1097
|
+
case "file":
|
|
1098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AttachmentDialog, { attachment, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "block max-w-md text-left", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FileAttachmentCard, { attachment }) }) });
|
|
845
1099
|
default:
|
|
846
1100
|
return null;
|
|
847
1101
|
}
|
|
@@ -966,15 +1220,15 @@ var Message = (0, import_react2.memo)(({
|
|
|
966
1220
|
minute: "2-digit"
|
|
967
1221
|
});
|
|
968
1222
|
};
|
|
969
|
-
return /* @__PURE__ */ (0,
|
|
1223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
970
1224
|
"div",
|
|
971
1225
|
{
|
|
972
1226
|
className: `flex w-full flex-col ${className} max-w-[800px] mx-auto`,
|
|
973
1227
|
onMouseEnter: () => setShowActions(true),
|
|
974
1228
|
onMouseLeave: () => setShowActions(false),
|
|
975
1229
|
children: [
|
|
976
|
-
/* @__PURE__ */ (0,
|
|
977
|
-
showAvatar && /* @__PURE__ */ (0,
|
|
1230
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
|
|
1231
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
978
1232
|
MessageSenderAvatar,
|
|
979
1233
|
{
|
|
980
1234
|
sender: message.sender,
|
|
@@ -984,8 +1238,8 @@ var Message = (0, import_react2.memo)(({
|
|
|
984
1238
|
compactMode
|
|
985
1239
|
}
|
|
986
1240
|
) }),
|
|
987
|
-
/* @__PURE__ */ (0,
|
|
988
|
-
/* @__PURE__ */ (0,
|
|
1241
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
|
|
1242
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
989
1243
|
"span",
|
|
990
1244
|
{
|
|
991
1245
|
className: `font-medium ${compactMode ? "text-sm" : "text-base"}`,
|
|
@@ -993,13 +1247,13 @@ var Message = (0, import_react2.memo)(({
|
|
|
993
1247
|
children: senderDisplay.name
|
|
994
1248
|
}
|
|
995
1249
|
),
|
|
996
|
-
showTimestamp && /* @__PURE__ */ (0,
|
|
997
|
-
message.isEdited && /* @__PURE__ */ (0,
|
|
1250
|
+
showTimestamp && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(message.timestamp) }),
|
|
1251
|
+
message.isEdited && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Badge, { variant: "outline", className: "text-xs", children: "editado" })
|
|
998
1252
|
] })
|
|
999
1253
|
] }),
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1001
|
-
isEditing ? /* @__PURE__ */ (0,
|
|
1002
|
-
/* @__PURE__ */ (0,
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `relative overflow-hidden text-left ${messageIsUser ? "ml-auto inline-flex max-w-[85%] flex-col rounded-lg bg-primary p-3 text-primary-foreground" : "flex w-full max-w-full flex-col"}`, children: [
|
|
1255
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2", children: [
|
|
1256
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1003
1257
|
Textarea,
|
|
1004
1258
|
{
|
|
1005
1259
|
value: editContent,
|
|
@@ -1008,18 +1262,18 @@ var Message = (0, import_react2.memo)(({
|
|
|
1008
1262
|
autoFocus: true
|
|
1009
1263
|
}
|
|
1010
1264
|
),
|
|
1011
|
-
/* @__PURE__ */ (0,
|
|
1012
|
-
/* @__PURE__ */ (0,
|
|
1013
|
-
/* @__PURE__ */ (0,
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-2 justify-end", children: [
|
|
1266
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Button, { variant: "outline", size: "sm", onClick: handleCancelEdit, children: [
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.X, { className: "h-4 w-4 mr-1" }),
|
|
1014
1268
|
"Cancelar"
|
|
1015
1269
|
] }),
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1017
|
-
/* @__PURE__ */ (0,
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Button, { size: "sm", onClick: handleEdit, children: [
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Check, { className: "h-4 w-4 mr-1" }),
|
|
1018
1272
|
"Salvar"
|
|
1019
1273
|
] })
|
|
1020
1274
|
] })
|
|
1021
|
-
] }) : /* @__PURE__ */ (0,
|
|
1022
|
-
!messageIsUser && /* @__PURE__ */ (0,
|
|
1275
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1276
|
+
!messageIsUser && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1023
1277
|
AssistantActivity,
|
|
1024
1278
|
{
|
|
1025
1279
|
activity: message.activity,
|
|
@@ -1028,7 +1282,7 @@ var Message = (0, import_react2.memo)(({
|
|
|
1028
1282
|
labels
|
|
1029
1283
|
}
|
|
1030
1284
|
),
|
|
1031
|
-
/* @__PURE__ */ (0,
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1032
1286
|
StreamingText,
|
|
1033
1287
|
{
|
|
1034
1288
|
content: contentToRender,
|
|
@@ -1038,7 +1292,7 @@ var Message = (0, import_react2.memo)(({
|
|
|
1038
1292
|
plainTextChunkChars: normalizedChunkChars
|
|
1039
1293
|
}
|
|
1040
1294
|
),
|
|
1041
|
-
canCollapseMessage && /* @__PURE__ */ (0,
|
|
1295
|
+
canCollapseMessage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1042
1296
|
Button,
|
|
1043
1297
|
{
|
|
1044
1298
|
type: "button",
|
|
@@ -1050,47 +1304,47 @@ var Message = (0, import_react2.memo)(({
|
|
|
1050
1304
|
children: isCollapsed ? showMoreLabel : showLessLabel
|
|
1051
1305
|
}
|
|
1052
1306
|
) }),
|
|
1053
|
-
message.attachments && message.attachments.length > 0 && /* @__PURE__ */ (0,
|
|
1307
|
+
message.attachments && message.attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3 space-y-2", children: message.attachments.map((attachment, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MediaRenderer, { attachment }, index)) })
|
|
1054
1308
|
] }),
|
|
1055
|
-
!isEditing && (showActions || copied) && /* @__PURE__ */ (0,
|
|
1056
|
-
enableCopy && /* @__PURE__ */ (0,
|
|
1057
|
-
/* @__PURE__ */ (0,
|
|
1309
|
+
!isEditing && (showActions || copied) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `absolute -top-2 flex gap-1 ${messageIsUser ? "-left-2" : "-right-2"}`, children: [
|
|
1310
|
+
enableCopy && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Tooltip, { children: [
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1058
1312
|
Button,
|
|
1059
1313
|
{
|
|
1060
1314
|
variant: "secondary",
|
|
1061
1315
|
size: "icon",
|
|
1062
1316
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1063
1317
|
onClick: handleCopy,
|
|
1064
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
1318
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Check, { className: "h-3 w-3 text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Copy, { className: "h-3 w-3" })
|
|
1065
1319
|
}
|
|
1066
1320
|
) }),
|
|
1067
|
-
/* @__PURE__ */ (0,
|
|
1321
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipContent, { children: copied ? "Copiado!" : "Copiar" })
|
|
1068
1322
|
] }),
|
|
1069
|
-
canEdit && /* @__PURE__ */ (0,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1323
|
+
canEdit && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Tooltip, { children: [
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1071
1325
|
Button,
|
|
1072
1326
|
{
|
|
1073
1327
|
variant: "secondary",
|
|
1074
1328
|
size: "icon",
|
|
1075
1329
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1076
1330
|
onClick: handleEdit,
|
|
1077
|
-
children: /* @__PURE__ */ (0,
|
|
1331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Edit, { className: "h-3 w-3" })
|
|
1078
1332
|
}
|
|
1079
1333
|
) }),
|
|
1080
|
-
/* @__PURE__ */ (0,
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipContent, { children: "Editar" })
|
|
1081
1335
|
] }),
|
|
1082
|
-
canRegenerate && /* @__PURE__ */ (0,
|
|
1083
|
-
/* @__PURE__ */ (0,
|
|
1336
|
+
canRegenerate && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Tooltip, { children: [
|
|
1337
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1084
1338
|
Button,
|
|
1085
1339
|
{
|
|
1086
1340
|
variant: "secondary",
|
|
1087
1341
|
size: "icon",
|
|
1088
1342
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1089
1343
|
onClick: handleRegenerate,
|
|
1090
|
-
children: /* @__PURE__ */ (0,
|
|
1344
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.RotateCcw, { className: "h-3 w-3" })
|
|
1091
1345
|
}
|
|
1092
1346
|
) }),
|
|
1093
|
-
/* @__PURE__ */ (0,
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipContent, { children: "Regenerar" })
|
|
1094
1348
|
] })
|
|
1095
1349
|
] })
|
|
1096
1350
|
] }) })
|
|
@@ -1103,9 +1357,9 @@ var Message = (0, import_react2.memo)(({
|
|
|
1103
1357
|
var import_react4 = require("react");
|
|
1104
1358
|
|
|
1105
1359
|
// src/components/ui/input.tsx
|
|
1106
|
-
var
|
|
1360
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1107
1361
|
function Input({ className, type, ...props }) {
|
|
1108
|
-
return /* @__PURE__ */ (0,
|
|
1362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1109
1363
|
"input",
|
|
1110
1364
|
{
|
|
1111
1365
|
type,
|
|
@@ -1122,17 +1376,17 @@ function Input({ className, type, ...props }) {
|
|
|
1122
1376
|
}
|
|
1123
1377
|
|
|
1124
1378
|
// src/components/ui/sidebar.tsx
|
|
1125
|
-
var
|
|
1379
|
+
var React6 = __toESM(require("react"), 1);
|
|
1126
1380
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
1127
1381
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
1128
|
-
var
|
|
1382
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1129
1383
|
|
|
1130
1384
|
// src/hooks/use-mobile.ts
|
|
1131
|
-
var
|
|
1385
|
+
var React4 = __toESM(require("react"), 1);
|
|
1132
1386
|
var MOBILE_BREAKPOINT = 768;
|
|
1133
1387
|
function useIsMobile() {
|
|
1134
|
-
const [isMobile, setIsMobile] =
|
|
1135
|
-
|
|
1388
|
+
const [isMobile, setIsMobile] = React4.useState(void 0);
|
|
1389
|
+
React4.useEffect(() => {
|
|
1136
1390
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
1137
1391
|
const onChange = () => {
|
|
1138
1392
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -1146,14 +1400,14 @@ function useIsMobile() {
|
|
|
1146
1400
|
|
|
1147
1401
|
// src/components/ui/separator.tsx
|
|
1148
1402
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
1149
|
-
var
|
|
1403
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1150
1404
|
function Separator({
|
|
1151
1405
|
className,
|
|
1152
1406
|
orientation = "horizontal",
|
|
1153
1407
|
decorative = true,
|
|
1154
1408
|
...props
|
|
1155
1409
|
}) {
|
|
1156
|
-
return /* @__PURE__ */ (0,
|
|
1410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1157
1411
|
SeparatorPrimitive.Root,
|
|
1158
1412
|
{
|
|
1159
1413
|
"data-slot": "separator",
|
|
@@ -1169,41 +1423,41 @@ function Separator({
|
|
|
1169
1423
|
}
|
|
1170
1424
|
|
|
1171
1425
|
// src/components/ui/sheet.tsx
|
|
1172
|
-
var
|
|
1426
|
+
var React5 = __toESM(require("react"), 1);
|
|
1173
1427
|
var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1174
|
-
var
|
|
1175
|
-
var
|
|
1176
|
-
function
|
|
1428
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1429
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1430
|
+
function cleanupBodyStyles2() {
|
|
1177
1431
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1178
1432
|
document.body.style.pointerEvents = "";
|
|
1179
1433
|
}
|
|
1180
1434
|
}
|
|
1181
1435
|
function Sheet({ open, onOpenChange, ...props }) {
|
|
1182
|
-
const prevOpenRef =
|
|
1183
|
-
|
|
1436
|
+
const prevOpenRef = React5.useRef(open);
|
|
1437
|
+
React5.useEffect(() => {
|
|
1184
1438
|
if (prevOpenRef.current === true && open === false) {
|
|
1185
|
-
const timeout = setTimeout(
|
|
1439
|
+
const timeout = setTimeout(cleanupBodyStyles2, 350);
|
|
1186
1440
|
return () => clearTimeout(timeout);
|
|
1187
1441
|
}
|
|
1188
1442
|
prevOpenRef.current = open;
|
|
1189
1443
|
}, [open]);
|
|
1190
|
-
|
|
1444
|
+
React5.useEffect(() => {
|
|
1191
1445
|
return () => {
|
|
1192
|
-
|
|
1446
|
+
cleanupBodyStyles2();
|
|
1193
1447
|
};
|
|
1194
1448
|
}, []);
|
|
1195
|
-
return /* @__PURE__ */ (0,
|
|
1449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
|
|
1196
1450
|
}
|
|
1197
1451
|
function SheetPortal({
|
|
1198
1452
|
...props
|
|
1199
1453
|
}) {
|
|
1200
|
-
return /* @__PURE__ */ (0,
|
|
1454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
1201
1455
|
}
|
|
1202
1456
|
function SheetOverlay({
|
|
1203
1457
|
className,
|
|
1204
1458
|
...props
|
|
1205
1459
|
}) {
|
|
1206
|
-
return /* @__PURE__ */ (0,
|
|
1460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1207
1461
|
SheetPrimitive.Overlay,
|
|
1208
1462
|
{
|
|
1209
1463
|
"data-slot": "sheet-overlay",
|
|
@@ -1224,9 +1478,9 @@ function SheetContent({
|
|
|
1224
1478
|
side = "right",
|
|
1225
1479
|
...props
|
|
1226
1480
|
}) {
|
|
1227
|
-
return /* @__PURE__ */ (0,
|
|
1228
|
-
/* @__PURE__ */ (0,
|
|
1229
|
-
/* @__PURE__ */ (0,
|
|
1481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(SheetPortal, { children: [
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SheetOverlay, {}),
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1230
1484
|
SheetPrimitive.Content,
|
|
1231
1485
|
{
|
|
1232
1486
|
"data-slot": "sheet-content",
|
|
@@ -1242,9 +1496,9 @@ function SheetContent({
|
|
|
1242
1496
|
...props,
|
|
1243
1497
|
children: [
|
|
1244
1498
|
children,
|
|
1245
|
-
/* @__PURE__ */ (0,
|
|
1246
|
-
/* @__PURE__ */ (0,
|
|
1247
|
-
/* @__PURE__ */ (0,
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(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: [
|
|
1500
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.XIcon, { className: "size-4" }),
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1248
1502
|
] })
|
|
1249
1503
|
]
|
|
1250
1504
|
}
|
|
@@ -1252,7 +1506,7 @@ function SheetContent({
|
|
|
1252
1506
|
] });
|
|
1253
1507
|
}
|
|
1254
1508
|
function SheetHeader({ className, ...props }) {
|
|
1255
|
-
return /* @__PURE__ */ (0,
|
|
1509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1256
1510
|
"div",
|
|
1257
1511
|
{
|
|
1258
1512
|
"data-slot": "sheet-header",
|
|
@@ -1265,7 +1519,7 @@ function SheetTitle({
|
|
|
1265
1519
|
className,
|
|
1266
1520
|
...props
|
|
1267
1521
|
}) {
|
|
1268
|
-
return /* @__PURE__ */ (0,
|
|
1522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1269
1523
|
SheetPrimitive.Title,
|
|
1270
1524
|
{
|
|
1271
1525
|
"data-slot": "sheet-title",
|
|
@@ -1278,7 +1532,7 @@ function SheetDescription({
|
|
|
1278
1532
|
className,
|
|
1279
1533
|
...props
|
|
1280
1534
|
}) {
|
|
1281
|
-
return /* @__PURE__ */ (0,
|
|
1535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1282
1536
|
SheetPrimitive.Description,
|
|
1283
1537
|
{
|
|
1284
1538
|
"data-slot": "sheet-description",
|
|
@@ -1289,9 +1543,9 @@ function SheetDescription({
|
|
|
1289
1543
|
}
|
|
1290
1544
|
|
|
1291
1545
|
// src/components/ui/skeleton.tsx
|
|
1292
|
-
var
|
|
1546
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1293
1547
|
function Skeleton({ className, ...props }) {
|
|
1294
|
-
return /* @__PURE__ */ (0,
|
|
1548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1295
1549
|
"div",
|
|
1296
1550
|
{
|
|
1297
1551
|
"data-slot": "skeleton",
|
|
@@ -1302,16 +1556,16 @@ function Skeleton({ className, ...props }) {
|
|
|
1302
1556
|
}
|
|
1303
1557
|
|
|
1304
1558
|
// src/components/ui/sidebar.tsx
|
|
1305
|
-
var
|
|
1559
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1306
1560
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1307
1561
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
1308
1562
|
var SIDEBAR_WIDTH = "16rem";
|
|
1309
1563
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1310
1564
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
1311
1565
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1312
|
-
var SidebarContext =
|
|
1566
|
+
var SidebarContext = React6.createContext(null);
|
|
1313
1567
|
function useSidebar() {
|
|
1314
|
-
const context =
|
|
1568
|
+
const context = React6.useContext(SidebarContext);
|
|
1315
1569
|
if (!context) {
|
|
1316
1570
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1317
1571
|
}
|
|
@@ -1327,10 +1581,10 @@ function SidebarProvider({
|
|
|
1327
1581
|
...props
|
|
1328
1582
|
}) {
|
|
1329
1583
|
const isMobile = useIsMobile();
|
|
1330
|
-
const [openMobile, setOpenMobile] =
|
|
1331
|
-
const [_open, _setOpen] =
|
|
1584
|
+
const [openMobile, setOpenMobile] = React6.useState(false);
|
|
1585
|
+
const [_open, _setOpen] = React6.useState(defaultOpen);
|
|
1332
1586
|
const open = openProp ?? _open;
|
|
1333
|
-
const setOpen =
|
|
1587
|
+
const setOpen = React6.useCallback(
|
|
1334
1588
|
(value) => {
|
|
1335
1589
|
const openState = typeof value === "function" ? value(open) : value;
|
|
1336
1590
|
if (setOpenProp) {
|
|
@@ -1342,10 +1596,10 @@ function SidebarProvider({
|
|
|
1342
1596
|
},
|
|
1343
1597
|
[setOpenProp, open]
|
|
1344
1598
|
);
|
|
1345
|
-
const toggleSidebar =
|
|
1599
|
+
const toggleSidebar = React6.useCallback(() => {
|
|
1346
1600
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
1347
1601
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
1348
|
-
|
|
1602
|
+
React6.useEffect(() => {
|
|
1349
1603
|
const handleKeyDown = (event) => {
|
|
1350
1604
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1351
1605
|
event.preventDefault();
|
|
@@ -1356,7 +1610,7 @@ function SidebarProvider({
|
|
|
1356
1610
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1357
1611
|
}, [toggleSidebar]);
|
|
1358
1612
|
const state = open ? "expanded" : "collapsed";
|
|
1359
|
-
const contextValue =
|
|
1613
|
+
const contextValue = React6.useMemo(
|
|
1360
1614
|
() => ({
|
|
1361
1615
|
state,
|
|
1362
1616
|
open,
|
|
@@ -1368,7 +1622,7 @@ function SidebarProvider({
|
|
|
1368
1622
|
}),
|
|
1369
1623
|
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
1370
1624
|
);
|
|
1371
|
-
return /* @__PURE__ */ (0,
|
|
1625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1372
1626
|
"div",
|
|
1373
1627
|
{
|
|
1374
1628
|
"data-slot": "sidebar-wrapper",
|
|
@@ -1396,7 +1650,7 @@ function Sidebar({
|
|
|
1396
1650
|
}) {
|
|
1397
1651
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1398
1652
|
if (collapsible === "none") {
|
|
1399
|
-
return /* @__PURE__ */ (0,
|
|
1653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1400
1654
|
"div",
|
|
1401
1655
|
{
|
|
1402
1656
|
"data-slot": "sidebar",
|
|
@@ -1410,7 +1664,7 @@ function Sidebar({
|
|
|
1410
1664
|
);
|
|
1411
1665
|
}
|
|
1412
1666
|
if (isMobile) {
|
|
1413
|
-
return /* @__PURE__ */ (0,
|
|
1667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1414
1668
|
SheetContent,
|
|
1415
1669
|
{
|
|
1416
1670
|
"data-sidebar": "sidebar",
|
|
@@ -1422,16 +1676,16 @@ function Sidebar({
|
|
|
1422
1676
|
},
|
|
1423
1677
|
side,
|
|
1424
1678
|
children: [
|
|
1425
|
-
/* @__PURE__ */ (0,
|
|
1426
|
-
/* @__PURE__ */ (0,
|
|
1427
|
-
/* @__PURE__ */ (0,
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(SheetHeader, { className: "sr-only", children: [
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SheetTitle, { children: "Sidebar" }),
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
1428
1682
|
] }),
|
|
1429
|
-
/* @__PURE__ */ (0,
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex h-full w-full flex-col", children })
|
|
1430
1684
|
]
|
|
1431
1685
|
}
|
|
1432
1686
|
) });
|
|
1433
1687
|
}
|
|
1434
|
-
return /* @__PURE__ */ (0,
|
|
1688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1435
1689
|
"div",
|
|
1436
1690
|
{
|
|
1437
1691
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
@@ -1441,7 +1695,7 @@ function Sidebar({
|
|
|
1441
1695
|
"data-side": side,
|
|
1442
1696
|
"data-slot": "sidebar",
|
|
1443
1697
|
children: [
|
|
1444
|
-
/* @__PURE__ */ (0,
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1445
1699
|
"div",
|
|
1446
1700
|
{
|
|
1447
1701
|
"data-slot": "sidebar-gap",
|
|
@@ -1453,7 +1707,7 @@ function Sidebar({
|
|
|
1453
1707
|
)
|
|
1454
1708
|
}
|
|
1455
1709
|
),
|
|
1456
|
-
/* @__PURE__ */ (0,
|
|
1710
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1457
1711
|
"div",
|
|
1458
1712
|
{
|
|
1459
1713
|
"data-slot": "sidebar-container",
|
|
@@ -1465,7 +1719,7 @@ function Sidebar({
|
|
|
1465
1719
|
className
|
|
1466
1720
|
),
|
|
1467
1721
|
...props,
|
|
1468
|
-
children: /* @__PURE__ */ (0,
|
|
1722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1469
1723
|
"div",
|
|
1470
1724
|
{
|
|
1471
1725
|
"data-sidebar": "sidebar",
|
|
@@ -1486,7 +1740,7 @@ function SidebarTrigger({
|
|
|
1486
1740
|
...props
|
|
1487
1741
|
}) {
|
|
1488
1742
|
const { toggleSidebar } = useSidebar();
|
|
1489
|
-
return /* @__PURE__ */ (0,
|
|
1743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1490
1744
|
Button,
|
|
1491
1745
|
{
|
|
1492
1746
|
"data-sidebar": "trigger",
|
|
@@ -1500,15 +1754,15 @@ function SidebarTrigger({
|
|
|
1500
1754
|
},
|
|
1501
1755
|
...props,
|
|
1502
1756
|
children: [
|
|
1503
|
-
/* @__PURE__ */ (0,
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1757
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.PanelLeftIcon, {}),
|
|
1758
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
1505
1759
|
]
|
|
1506
1760
|
}
|
|
1507
1761
|
);
|
|
1508
1762
|
}
|
|
1509
1763
|
function SidebarRail({ className, ...props }) {
|
|
1510
1764
|
const { toggleSidebar } = useSidebar();
|
|
1511
|
-
return /* @__PURE__ */ (0,
|
|
1765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1512
1766
|
"button",
|
|
1513
1767
|
{
|
|
1514
1768
|
"data-sidebar": "rail",
|
|
@@ -1531,7 +1785,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
1531
1785
|
);
|
|
1532
1786
|
}
|
|
1533
1787
|
function SidebarInset({ className, ...props }) {
|
|
1534
|
-
return /* @__PURE__ */ (0,
|
|
1788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1535
1789
|
"main",
|
|
1536
1790
|
{
|
|
1537
1791
|
"data-slot": "sidebar-inset",
|
|
@@ -1545,7 +1799,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
1545
1799
|
);
|
|
1546
1800
|
}
|
|
1547
1801
|
function SidebarHeader({ className, ...props }) {
|
|
1548
|
-
return /* @__PURE__ */ (0,
|
|
1802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1549
1803
|
"div",
|
|
1550
1804
|
{
|
|
1551
1805
|
"data-slot": "sidebar-header",
|
|
@@ -1556,7 +1810,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
1556
1810
|
);
|
|
1557
1811
|
}
|
|
1558
1812
|
function SidebarFooter({ className, ...props }) {
|
|
1559
|
-
return /* @__PURE__ */ (0,
|
|
1813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1560
1814
|
"div",
|
|
1561
1815
|
{
|
|
1562
1816
|
"data-slot": "sidebar-footer",
|
|
@@ -1567,7 +1821,7 @@ function SidebarFooter({ className, ...props }) {
|
|
|
1567
1821
|
);
|
|
1568
1822
|
}
|
|
1569
1823
|
function SidebarContent({ className, ...props }) {
|
|
1570
|
-
return /* @__PURE__ */ (0,
|
|
1824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1571
1825
|
"div",
|
|
1572
1826
|
{
|
|
1573
1827
|
"data-slot": "sidebar-content",
|
|
@@ -1581,7 +1835,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
1581
1835
|
);
|
|
1582
1836
|
}
|
|
1583
1837
|
function SidebarGroup({ className, ...props }) {
|
|
1584
|
-
return /* @__PURE__ */ (0,
|
|
1838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1585
1839
|
"div",
|
|
1586
1840
|
{
|
|
1587
1841
|
"data-slot": "sidebar-group",
|
|
@@ -1597,7 +1851,7 @@ function SidebarGroupLabel({
|
|
|
1597
1851
|
...props
|
|
1598
1852
|
}) {
|
|
1599
1853
|
const Comp = asChild ? import_react_slot3.Slot : "div";
|
|
1600
|
-
return /* @__PURE__ */ (0,
|
|
1854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1601
1855
|
Comp,
|
|
1602
1856
|
{
|
|
1603
1857
|
"data-slot": "sidebar-group-label",
|
|
@@ -1615,7 +1869,7 @@ function SidebarGroupContent({
|
|
|
1615
1869
|
className,
|
|
1616
1870
|
...props
|
|
1617
1871
|
}) {
|
|
1618
|
-
return /* @__PURE__ */ (0,
|
|
1872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1619
1873
|
"div",
|
|
1620
1874
|
{
|
|
1621
1875
|
"data-slot": "sidebar-group-content",
|
|
@@ -1626,7 +1880,7 @@ function SidebarGroupContent({
|
|
|
1626
1880
|
);
|
|
1627
1881
|
}
|
|
1628
1882
|
function SidebarMenu({ className, ...props }) {
|
|
1629
|
-
return /* @__PURE__ */ (0,
|
|
1883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1630
1884
|
"ul",
|
|
1631
1885
|
{
|
|
1632
1886
|
"data-slot": "sidebar-menu",
|
|
@@ -1637,7 +1891,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
1637
1891
|
);
|
|
1638
1892
|
}
|
|
1639
1893
|
function SidebarMenuItem({ className, ...props }) {
|
|
1640
|
-
return /* @__PURE__ */ (0,
|
|
1894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1641
1895
|
"li",
|
|
1642
1896
|
{
|
|
1643
1897
|
"data-slot": "sidebar-menu-item",
|
|
@@ -1678,7 +1932,7 @@ function SidebarMenuButton({
|
|
|
1678
1932
|
}) {
|
|
1679
1933
|
const Comp = asChild ? import_react_slot3.Slot : "button";
|
|
1680
1934
|
const { isMobile, state } = useSidebar();
|
|
1681
|
-
const button = /* @__PURE__ */ (0,
|
|
1935
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1682
1936
|
Comp,
|
|
1683
1937
|
{
|
|
1684
1938
|
"data-slot": "sidebar-menu-button",
|
|
@@ -1697,9 +1951,9 @@ function SidebarMenuButton({
|
|
|
1697
1951
|
children: tooltip
|
|
1698
1952
|
};
|
|
1699
1953
|
}
|
|
1700
|
-
return /* @__PURE__ */ (0,
|
|
1701
|
-
/* @__PURE__ */ (0,
|
|
1702
|
-
/* @__PURE__ */ (0,
|
|
1954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tooltip, { children: [
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipTrigger, { asChild: true, children: button }),
|
|
1956
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1703
1957
|
TooltipContent,
|
|
1704
1958
|
{
|
|
1705
1959
|
side: "right",
|
|
@@ -1717,7 +1971,7 @@ function SidebarMenuAction({
|
|
|
1717
1971
|
...props
|
|
1718
1972
|
}) {
|
|
1719
1973
|
const Comp = asChild ? import_react_slot3.Slot : "button";
|
|
1720
|
-
return /* @__PURE__ */ (0,
|
|
1974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1721
1975
|
Comp,
|
|
1722
1976
|
{
|
|
1723
1977
|
"data-slot": "sidebar-menu-action",
|
|
@@ -1738,151 +1992,6 @@ function SidebarMenuAction({
|
|
|
1738
1992
|
);
|
|
1739
1993
|
}
|
|
1740
1994
|
|
|
1741
|
-
// src/components/ui/dialog.tsx
|
|
1742
|
-
var React6 = __toESM(require("react"), 1);
|
|
1743
|
-
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1744
|
-
var import_lucide_react5 = require("lucide-react");
|
|
1745
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1746
|
-
function cleanupBodyStyles2() {
|
|
1747
|
-
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1748
|
-
document.body.style.pointerEvents = "";
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
function Dialog({
|
|
1752
|
-
open,
|
|
1753
|
-
onOpenChange,
|
|
1754
|
-
...props
|
|
1755
|
-
}) {
|
|
1756
|
-
const prevOpenRef = React6.useRef(open);
|
|
1757
|
-
React6.useEffect(() => {
|
|
1758
|
-
if (prevOpenRef.current === true && open === false) {
|
|
1759
|
-
const timeout = setTimeout(cleanupBodyStyles2, 250);
|
|
1760
|
-
return () => clearTimeout(timeout);
|
|
1761
|
-
}
|
|
1762
|
-
prevOpenRef.current = open;
|
|
1763
|
-
}, [open]);
|
|
1764
|
-
React6.useEffect(() => {
|
|
1765
|
-
return () => {
|
|
1766
|
-
cleanupBodyStyles2();
|
|
1767
|
-
};
|
|
1768
|
-
}, []);
|
|
1769
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", open, onOpenChange, ...props });
|
|
1770
|
-
}
|
|
1771
|
-
function DialogTrigger({
|
|
1772
|
-
...props
|
|
1773
|
-
}) {
|
|
1774
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
1775
|
-
}
|
|
1776
|
-
function DialogPortal({
|
|
1777
|
-
...props
|
|
1778
|
-
}) {
|
|
1779
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
1780
|
-
}
|
|
1781
|
-
function DialogOverlay({
|
|
1782
|
-
className,
|
|
1783
|
-
...props
|
|
1784
|
-
}) {
|
|
1785
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1786
|
-
DialogPrimitive.Overlay,
|
|
1787
|
-
{
|
|
1788
|
-
"data-slot": "dialog-overlay",
|
|
1789
|
-
className: cn(
|
|
1790
|
-
"fixed inset-0 z-50 bg-black/50",
|
|
1791
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1792
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1793
|
-
"data-[state=closed]:pointer-events-none",
|
|
1794
|
-
className
|
|
1795
|
-
),
|
|
1796
|
-
...props
|
|
1797
|
-
}
|
|
1798
|
-
);
|
|
1799
|
-
}
|
|
1800
|
-
function DialogContent({
|
|
1801
|
-
className,
|
|
1802
|
-
children,
|
|
1803
|
-
showCloseButton = true,
|
|
1804
|
-
...props
|
|
1805
|
-
}) {
|
|
1806
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
1807
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogOverlay, {}),
|
|
1808
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1809
|
-
DialogPrimitive.Content,
|
|
1810
|
-
{
|
|
1811
|
-
"data-slot": "dialog-content",
|
|
1812
|
-
"aria-describedby": void 0,
|
|
1813
|
-
className: cn(
|
|
1814
|
-
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
1815
|
-
className
|
|
1816
|
-
),
|
|
1817
|
-
...props,
|
|
1818
|
-
children: [
|
|
1819
|
-
children,
|
|
1820
|
-
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1821
|
-
DialogPrimitive.Close,
|
|
1822
|
-
{
|
|
1823
|
-
"data-slot": "dialog-close",
|
|
1824
|
-
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",
|
|
1825
|
-
children: [
|
|
1826
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.XIcon, {}),
|
|
1827
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1828
|
-
]
|
|
1829
|
-
}
|
|
1830
|
-
)
|
|
1831
|
-
]
|
|
1832
|
-
}
|
|
1833
|
-
)
|
|
1834
|
-
] });
|
|
1835
|
-
}
|
|
1836
|
-
function DialogHeader({ className, ...props }) {
|
|
1837
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1838
|
-
"div",
|
|
1839
|
-
{
|
|
1840
|
-
"data-slot": "dialog-header",
|
|
1841
|
-
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
1842
|
-
...props
|
|
1843
|
-
}
|
|
1844
|
-
);
|
|
1845
|
-
}
|
|
1846
|
-
function DialogFooter({ className, ...props }) {
|
|
1847
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1848
|
-
"div",
|
|
1849
|
-
{
|
|
1850
|
-
"data-slot": "dialog-footer",
|
|
1851
|
-
className: cn(
|
|
1852
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
1853
|
-
className
|
|
1854
|
-
),
|
|
1855
|
-
...props
|
|
1856
|
-
}
|
|
1857
|
-
);
|
|
1858
|
-
}
|
|
1859
|
-
function DialogTitle({
|
|
1860
|
-
className,
|
|
1861
|
-
...props
|
|
1862
|
-
}) {
|
|
1863
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1864
|
-
DialogPrimitive.Title,
|
|
1865
|
-
{
|
|
1866
|
-
"data-slot": "dialog-title",
|
|
1867
|
-
className: cn("text-lg leading-none font-semibold", className),
|
|
1868
|
-
...props
|
|
1869
|
-
}
|
|
1870
|
-
);
|
|
1871
|
-
}
|
|
1872
|
-
function DialogDescription({
|
|
1873
|
-
className,
|
|
1874
|
-
...props
|
|
1875
|
-
}) {
|
|
1876
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1877
|
-
DialogPrimitive.Description,
|
|
1878
|
-
{
|
|
1879
|
-
"data-slot": "dialog-description",
|
|
1880
|
-
className: cn("text-muted-foreground text-sm", className),
|
|
1881
|
-
...props
|
|
1882
|
-
}
|
|
1883
|
-
);
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
1995
|
// src/components/ui/alert-dialog.tsx
|
|
1887
1996
|
var React7 = __toESM(require("react"), 1);
|
|
1888
1997
|
var AlertDialogPrimitive = __toESM(require("@radix-ui/react-alert-dialog"), 1);
|
|
@@ -3735,7 +3844,7 @@ var FileUploadItem = (0, import_react8.memo)(function FileUploadItem2({ file, pr
|
|
|
3735
3844
|
if (t.startsWith("audio/")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Mic, { className: "h-4 w-4" });
|
|
3736
3845
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.FileText, { className: "h-4 w-4" });
|
|
3737
3846
|
};
|
|
3738
|
-
const
|
|
3847
|
+
const formatFileSize2 = (bytes) => {
|
|
3739
3848
|
if (bytes === 0) return "0 Bytes";
|
|
3740
3849
|
const k = 1024;
|
|
3741
3850
|
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
@@ -3746,7 +3855,7 @@ var FileUploadItem = (0, import_react8.memo)(function FileUploadItem2({ file, pr
|
|
|
3746
3855
|
getFileIcon(file.type, file.name),
|
|
3747
3856
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
3748
3857
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
3749
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground", children:
|
|
3858
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground", children: formatFileSize2(file.size ?? 0) }),
|
|
3750
3859
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Progress, { value: progress, className: "h-1 mt-1" })
|
|
3751
3860
|
] }),
|
|
3752
3861
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -3876,7 +3985,24 @@ var AttachmentPreview = (0, import_react8.memo)(function AttachmentPreview2({ at
|
|
|
3876
3985
|
}
|
|
3877
3986
|
)
|
|
3878
3987
|
] }),
|
|
3879
|
-
attachment.
|
|
3988
|
+
attachment.kind === "file" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex min-w-48 items-center gap-2 p-2", children: [
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.FileText, { className: "h-4 w-4" }) }),
|
|
3990
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
3991
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "truncate text-xs font-medium", children: attachment.fileName || "File" }),
|
|
3992
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: [attachment.mimeType || "File", formatFileSize(attachment.size)].filter(Boolean).join(" \xB7 ") })
|
|
3993
|
+
] }),
|
|
3994
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3995
|
+
Button,
|
|
3996
|
+
{
|
|
3997
|
+
variant: "ghost",
|
|
3998
|
+
size: "icon",
|
|
3999
|
+
className: "h-6 w-6 opacity-0 transition-opacity group-hover:opacity-100",
|
|
4000
|
+
onClick: onRemove,
|
|
4001
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.X, { className: "h-3 w-3" })
|
|
4002
|
+
}
|
|
4003
|
+
)
|
|
4004
|
+
] }),
|
|
4005
|
+
attachment.fileName && attachment.kind !== "audio" && attachment.kind !== "file" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "truncate", children: attachment.fileName }) })
|
|
3880
4006
|
] }) });
|
|
3881
4007
|
});
|
|
3882
4008
|
var resolveVoiceErrorMessage = (error, config) => {
|
|
@@ -3905,7 +4031,7 @@ var ChatInput = (0, import_react8.memo)(function ChatInput2({
|
|
|
3905
4031
|
maxAttachments = 4,
|
|
3906
4032
|
maxFileSize = 10 * 1024 * 1024,
|
|
3907
4033
|
// 10MB
|
|
3908
|
-
acceptedFileTypes = [
|
|
4034
|
+
acceptedFileTypes = [],
|
|
3909
4035
|
className = "",
|
|
3910
4036
|
config,
|
|
3911
4037
|
mentionAgents = [],
|
|
@@ -4080,9 +4206,9 @@ var ChatInput = (0, import_react8.memo)(function ChatInput2({
|
|
|
4080
4206
|
return newMap;
|
|
4081
4207
|
});
|
|
4082
4208
|
const attachment = {
|
|
4083
|
-
kind:
|
|
4209
|
+
kind: getAttachmentKindFromMimeType(file.type),
|
|
4084
4210
|
dataUrl,
|
|
4085
|
-
mimeType: file.type,
|
|
4211
|
+
mimeType: file.type || "application/octet-stream",
|
|
4086
4212
|
fileName: file.name,
|
|
4087
4213
|
size: file.size
|
|
4088
4214
|
};
|
|
@@ -4505,7 +4631,7 @@ var ChatInput = (0, import_react8.memo)(function ChatInput2({
|
|
|
4505
4631
|
ref: fileInputRef,
|
|
4506
4632
|
type: "file",
|
|
4507
4633
|
multiple: true,
|
|
4508
|
-
accept: acceptedFileTypes.join(","),
|
|
4634
|
+
accept: acceptedFileTypes.length > 0 ? acceptedFileTypes.join(",") : void 0,
|
|
4509
4635
|
onChange: handleFileSelect,
|
|
4510
4636
|
className: "hidden"
|
|
4511
4637
|
}
|
|
@@ -5545,7 +5671,7 @@ var ChatUI = ({
|
|
|
5545
5671
|
if (groupedMessages.length > 0 || !suggestions.length) return null;
|
|
5546
5672
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
|
|
5547
5673
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-center mb-8", children: [
|
|
5548
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.Sparkles, { className: "w-7 h-7 text-primary" }) }),
|
|
5674
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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: config.branding.avatar ?? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.Sparkles, { className: "w-7 h-7 text-primary" }) }),
|
|
5549
5675
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
|
|
5550
5676
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
|
|
5551
5677
|
] }),
|
|
@@ -5817,6 +5943,7 @@ var ChatUI = ({
|
|
|
5817
5943
|
enableAudioRecording: config.features.enableAudioRecording,
|
|
5818
5944
|
maxAttachments: config.features.maxAttachments,
|
|
5819
5945
|
maxFileSize: config.features.maxFileSize,
|
|
5946
|
+
acceptedFileTypes: config.features.acceptedFileTypes,
|
|
5820
5947
|
config,
|
|
5821
5948
|
mentionAgents: participantIds && participantIds.length > 0 ? agentOptions.filter(
|
|
5822
5949
|
(a) => participantIds.includes(a.id)
|
|
@@ -5895,6 +6022,8 @@ var ChatUI = ({
|
|
|
5895
6022
|
ChatUserContextProvider,
|
|
5896
6023
|
MessageSenderAvatar,
|
|
5897
6024
|
defaultChatConfig,
|
|
6025
|
+
getAttachmentKindFromMimeType,
|
|
6026
|
+
getMimeTypeFromDataUrl,
|
|
5898
6027
|
mergeConfig,
|
|
5899
6028
|
resolveMessageSenderDisplay,
|
|
5900
6029
|
useChatUserContext
|