@copilotz/chat-ui 0.1.0 → 0.1.2
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 +405 -13
- package/dist/index.cjs +861 -567
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +775 -478
- package/dist/index.js.map +1 -1
- package/dist/styles.css +246 -18
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,11 @@ var defaultChatConfig = {
|
|
|
64
64
|
title: "Chat Assistant",
|
|
65
65
|
subtitle: "How can I help you today?"
|
|
66
66
|
},
|
|
67
|
+
agentSelector: {
|
|
68
|
+
enabled: false,
|
|
69
|
+
label: "Select agent",
|
|
70
|
+
hideIfSingle: true
|
|
71
|
+
},
|
|
67
72
|
labels: {
|
|
68
73
|
inputPlaceholder: "Type your message...",
|
|
69
74
|
sendButton: "Send",
|
|
@@ -156,6 +161,10 @@ function mergeConfig(_baseConfig, userConfig) {
|
|
|
156
161
|
...defaultChatConfig.ui,
|
|
157
162
|
...userConfig.ui
|
|
158
163
|
},
|
|
164
|
+
agentSelector: {
|
|
165
|
+
...defaultChatConfig.agentSelector,
|
|
166
|
+
...userConfig.agentSelector
|
|
167
|
+
},
|
|
159
168
|
customComponent: userConfig.customComponent || defaultChatConfig.customComponent,
|
|
160
169
|
headerActions: userConfig.headerActions || defaultChatConfig.headerActions
|
|
161
170
|
};
|
|
@@ -566,7 +575,7 @@ function TooltipContent({
|
|
|
566
575
|
// src/components/chat/Message.tsx
|
|
567
576
|
var import_lucide_react = require("lucide-react");
|
|
568
577
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
569
|
-
var ThinkingIndicator = ({ label = "Thinking..." })
|
|
578
|
+
var ThinkingIndicator = (0, import_react.memo)(function ThinkingIndicator2({ label = "Thinking..." }) {
|
|
570
579
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 py-2", children: [
|
|
571
580
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-1", children: [
|
|
572
581
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -593,26 +602,30 @@ var ThinkingIndicator = ({ label = "Thinking..." }) => {
|
|
|
593
602
|
] }),
|
|
594
603
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-sm text-muted-foreground animate-pulse", children: label })
|
|
595
604
|
] });
|
|
605
|
+
});
|
|
606
|
+
var markdownComponents = {
|
|
607
|
+
code: ({ node, className, children, ...props }) => {
|
|
608
|
+
const inline = props.inline;
|
|
609
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
610
|
+
return !inline && match ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { className, ...props, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { className: "bg-muted px-1 py-0.5 rounded text-sm", ...props, children });
|
|
611
|
+
}
|
|
596
612
|
};
|
|
597
|
-
var
|
|
613
|
+
var remarkPluginsDefault = [import_remark_gfm.default];
|
|
614
|
+
var rehypePluginsDefault = [import_rehype_highlight.default];
|
|
615
|
+
var rehypePluginsEmpty = [];
|
|
616
|
+
var StreamingText = (0, import_react.memo)(function StreamingText2({
|
|
598
617
|
content,
|
|
599
618
|
isStreaming = false,
|
|
600
619
|
thinkingLabel = "Thinking..."
|
|
601
|
-
})
|
|
620
|
+
}) {
|
|
602
621
|
const hasContent = content.trim().length > 0;
|
|
603
622
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "prose prose-sm max-w-none dark:prose-invert", children: [
|
|
604
623
|
hasContent ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
605
624
|
import_react_markdown.default,
|
|
606
625
|
{
|
|
607
|
-
remarkPlugins:
|
|
608
|
-
rehypePlugins: isStreaming ?
|
|
609
|
-
components:
|
|
610
|
-
code: ({ node, className, children, ...props }) => {
|
|
611
|
-
const inline = props.inline;
|
|
612
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
613
|
-
return !inline && match ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { className, ...props, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { className: "bg-muted px-1 py-0.5 rounded text-sm", ...props, children });
|
|
614
|
-
}
|
|
615
|
-
},
|
|
626
|
+
remarkPlugins: remarkPluginsDefault,
|
|
627
|
+
rehypePlugins: isStreaming ? rehypePluginsEmpty : rehypePluginsDefault,
|
|
628
|
+
components: markdownComponents,
|
|
616
629
|
children: content
|
|
617
630
|
}
|
|
618
631
|
) : isStreaming ? (
|
|
@@ -621,8 +634,8 @@ var StreamingText = ({
|
|
|
621
634
|
) : null,
|
|
622
635
|
isStreaming && hasContent && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "inline-block w-2 h-4 bg-primary animate-pulse ml-1" })
|
|
623
636
|
] });
|
|
624
|
-
};
|
|
625
|
-
var MediaRenderer = ({ attachment })
|
|
637
|
+
});
|
|
638
|
+
var MediaRenderer = (0, import_react.memo)(function MediaRenderer2({ attachment }) {
|
|
626
639
|
const [isPlaying, setIsPlaying] = (0, import_react.useState)(false);
|
|
627
640
|
const audioRef = (0, import_react.useRef)(null);
|
|
628
641
|
const videoRef = (0, import_react.useRef)(null);
|
|
@@ -696,8 +709,8 @@ var MediaRenderer = ({ attachment }) => {
|
|
|
696
709
|
default:
|
|
697
710
|
return null;
|
|
698
711
|
}
|
|
699
|
-
};
|
|
700
|
-
var ToolCallsDisplay = ({ toolCalls, label })
|
|
712
|
+
});
|
|
713
|
+
var ToolCallsDisplay = (0, import_react.memo)(function ToolCallsDisplay2({ toolCalls, label }) {
|
|
701
714
|
const [expandedCall, setExpandedCall] = (0, import_react.useState)(null);
|
|
702
715
|
const getStatusIcon = (status) => {
|
|
703
716
|
switch (status) {
|
|
@@ -766,8 +779,48 @@ var ToolCallsDisplay = ({ toolCalls, label }) => {
|
|
|
766
779
|
] }, call.id);
|
|
767
780
|
})
|
|
768
781
|
] });
|
|
782
|
+
});
|
|
783
|
+
var arePropsEqual = (prevProps, nextProps) => {
|
|
784
|
+
if (prevProps.message.id !== nextProps.message.id) return false;
|
|
785
|
+
if (prevProps.message.content !== nextProps.message.content) return false;
|
|
786
|
+
if (prevProps.message.isStreaming !== nextProps.message.isStreaming) return false;
|
|
787
|
+
if (prevProps.message.isComplete !== nextProps.message.isComplete) return false;
|
|
788
|
+
if (prevProps.message.isEdited !== nextProps.message.isEdited) return false;
|
|
789
|
+
if (prevProps.message.timestamp !== nextProps.message.timestamp) return false;
|
|
790
|
+
if (prevProps.message.toolCalls !== nextProps.message.toolCalls) {
|
|
791
|
+
const prevCalls = prevProps.message.toolCalls;
|
|
792
|
+
const nextCalls = nextProps.message.toolCalls;
|
|
793
|
+
if (!prevCalls || !nextCalls || prevCalls.length !== nextCalls.length) return false;
|
|
794
|
+
for (let i = 0; i < prevCalls.length; i++) {
|
|
795
|
+
if (prevCalls[i].id !== nextCalls[i].id || prevCalls[i].status !== nextCalls[i].status || prevCalls[i].result !== nextCalls[i].result) {
|
|
796
|
+
return false;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
if (prevProps.message.attachments !== nextProps.message.attachments) {
|
|
801
|
+
const prevAtt = prevProps.message.attachments;
|
|
802
|
+
const nextAtt = nextProps.message.attachments;
|
|
803
|
+
if (!prevAtt || !nextAtt || prevAtt.length !== nextAtt.length) return false;
|
|
804
|
+
}
|
|
805
|
+
if (prevProps.isUser !== nextProps.isUser) return false;
|
|
806
|
+
if (prevProps.userAvatar !== nextProps.userAvatar) return false;
|
|
807
|
+
if (prevProps.userName !== nextProps.userName) return false;
|
|
808
|
+
if (prevProps.assistantName !== nextProps.assistantName) return false;
|
|
809
|
+
if (prevProps.showTimestamp !== nextProps.showTimestamp) return false;
|
|
810
|
+
if (prevProps.showAvatar !== nextProps.showAvatar) return false;
|
|
811
|
+
if (prevProps.enableCopy !== nextProps.enableCopy) return false;
|
|
812
|
+
if (prevProps.enableEdit !== nextProps.enableEdit) return false;
|
|
813
|
+
if (prevProps.enableRegenerate !== nextProps.enableRegenerate) return false;
|
|
814
|
+
if (prevProps.enableToolCallsDisplay !== nextProps.enableToolCallsDisplay) return false;
|
|
815
|
+
if (prevProps.compactMode !== nextProps.compactMode) return false;
|
|
816
|
+
if (prevProps.className !== nextProps.className) return false;
|
|
817
|
+
if (prevProps.toolUsedLabel !== nextProps.toolUsedLabel) return false;
|
|
818
|
+
if (prevProps.thinkingLabel !== nextProps.thinkingLabel) return false;
|
|
819
|
+
if (prevProps.isGrouped !== nextProps.isGrouped) return false;
|
|
820
|
+
if (prevProps.assistantAvatar !== nextProps.assistantAvatar) return false;
|
|
821
|
+
return true;
|
|
769
822
|
};
|
|
770
|
-
var Message = ({
|
|
823
|
+
var Message = (0, import_react.memo)(({
|
|
771
824
|
message,
|
|
772
825
|
isUser,
|
|
773
826
|
userAvatar,
|
|
@@ -784,7 +837,8 @@ var Message = ({
|
|
|
784
837
|
onAction,
|
|
785
838
|
className = "",
|
|
786
839
|
toolUsedLabel,
|
|
787
|
-
thinkingLabel = "Thinking..."
|
|
840
|
+
thinkingLabel = "Thinking...",
|
|
841
|
+
isGrouped = false
|
|
788
842
|
}) => {
|
|
789
843
|
const [isEditing, setIsEditing] = (0, import_react.useState)(false);
|
|
790
844
|
const [editContent, setEditContent] = (0, import_react.useState)(message.content);
|
|
@@ -834,7 +888,7 @@ var Message = ({
|
|
|
834
888
|
onMouseEnter: () => setShowActions(true),
|
|
835
889
|
onMouseLeave: () => setShowActions(false),
|
|
836
890
|
children: [
|
|
837
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
|
|
891
|
+
!isGrouped && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
|
|
838
892
|
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: messageIsUser ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
839
893
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvatarImage, { src: userAvatar, alt: userName }),
|
|
840
894
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvatarFallback, { className: "bg-primary text-primary-foreground", children: userName.charAt(0).toUpperCase() })
|
|
@@ -845,7 +899,7 @@ var Message = ({
|
|
|
845
899
|
message.isEdited && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { variant: "outline", className: "text-xs", children: "editado" })
|
|
846
900
|
] })
|
|
847
901
|
] }),
|
|
848
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"}`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `relative inline-flex flex-col ${messageIsUser ? "rounded-lg p-3 bg-primary text-primary-foreground ml-auto max-w-[85%]" : "max-w-[85%]"}`, children: [
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${isGrouped && showAvatar && !messageIsUser ? compactMode ? "ml-9" : "ml-11" : ""} ${isGrouped && showAvatar && messageIsUser ? compactMode ? "mr-9" : "mr-11" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `relative inline-flex flex-col ${messageIsUser ? "rounded-lg p-3 bg-primary text-primary-foreground ml-auto max-w-[85%]" : "max-w-[85%]"}`, children: [
|
|
849
903
|
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
850
904
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
851
905
|
Textarea,
|
|
@@ -923,7 +977,7 @@ var Message = ({
|
|
|
923
977
|
]
|
|
924
978
|
}
|
|
925
979
|
) });
|
|
926
|
-
};
|
|
980
|
+
}, arePropsEqual);
|
|
927
981
|
|
|
928
982
|
// src/components/chat/Sidebar.tsx
|
|
929
983
|
var import_react2 = require("react");
|
|
@@ -948,7 +1002,7 @@ function Input({ className, type, ...props }) {
|
|
|
948
1002
|
}
|
|
949
1003
|
|
|
950
1004
|
// src/components/ui/sidebar.tsx
|
|
951
|
-
var
|
|
1005
|
+
var React4 = __toESM(require("react"), 1);
|
|
952
1006
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
953
1007
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
954
1008
|
var import_lucide_react3 = require("lucide-react");
|
|
@@ -995,11 +1049,30 @@ function Separator({
|
|
|
995
1049
|
}
|
|
996
1050
|
|
|
997
1051
|
// src/components/ui/sheet.tsx
|
|
1052
|
+
var React3 = __toESM(require("react"), 1);
|
|
998
1053
|
var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
999
1054
|
var import_lucide_react2 = require("lucide-react");
|
|
1000
1055
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1001
|
-
function
|
|
1002
|
-
|
|
1056
|
+
function cleanupBodyStyles() {
|
|
1057
|
+
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1058
|
+
document.body.style.pointerEvents = "";
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
function Sheet({ open, onOpenChange, ...props }) {
|
|
1062
|
+
const prevOpenRef = React3.useRef(open);
|
|
1063
|
+
React3.useEffect(() => {
|
|
1064
|
+
if (prevOpenRef.current === true && open === false) {
|
|
1065
|
+
const timeout = setTimeout(cleanupBodyStyles, 350);
|
|
1066
|
+
return () => clearTimeout(timeout);
|
|
1067
|
+
}
|
|
1068
|
+
prevOpenRef.current = open;
|
|
1069
|
+
}, [open]);
|
|
1070
|
+
React3.useEffect(() => {
|
|
1071
|
+
return () => {
|
|
1072
|
+
cleanupBodyStyles();
|
|
1073
|
+
};
|
|
1074
|
+
}, []);
|
|
1075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
|
|
1003
1076
|
}
|
|
1004
1077
|
function SheetPortal({
|
|
1005
1078
|
...props
|
|
@@ -1015,7 +1088,10 @@ function SheetOverlay({
|
|
|
1015
1088
|
{
|
|
1016
1089
|
"data-slot": "sheet-overlay",
|
|
1017
1090
|
className: cn(
|
|
1018
|
-
"
|
|
1091
|
+
"fixed inset-0 z-50 bg-black/50",
|
|
1092
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1093
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1094
|
+
"data-[state=closed]:pointer-events-none",
|
|
1019
1095
|
className
|
|
1020
1096
|
),
|
|
1021
1097
|
...props
|
|
@@ -1034,6 +1110,7 @@ function SheetContent({
|
|
|
1034
1110
|
SheetPrimitive.Content,
|
|
1035
1111
|
{
|
|
1036
1112
|
"data-slot": "sheet-content",
|
|
1113
|
+
"aria-describedby": void 0,
|
|
1037
1114
|
className: cn(
|
|
1038
1115
|
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
1039
1116
|
side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
@@ -1091,17 +1168,30 @@ function SheetDescription({
|
|
|
1091
1168
|
);
|
|
1092
1169
|
}
|
|
1093
1170
|
|
|
1094
|
-
// src/components/ui/
|
|
1171
|
+
// src/components/ui/skeleton.tsx
|
|
1095
1172
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1173
|
+
function Skeleton({ className, ...props }) {
|
|
1174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1175
|
+
"div",
|
|
1176
|
+
{
|
|
1177
|
+
"data-slot": "skeleton",
|
|
1178
|
+
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
1179
|
+
...props
|
|
1180
|
+
}
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// src/components/ui/sidebar.tsx
|
|
1185
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1096
1186
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1097
1187
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
1098
1188
|
var SIDEBAR_WIDTH = "16rem";
|
|
1099
1189
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1100
1190
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
1101
1191
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1102
|
-
var SidebarContext =
|
|
1192
|
+
var SidebarContext = React4.createContext(null);
|
|
1103
1193
|
function useSidebar() {
|
|
1104
|
-
const context =
|
|
1194
|
+
const context = React4.useContext(SidebarContext);
|
|
1105
1195
|
if (!context) {
|
|
1106
1196
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1107
1197
|
}
|
|
@@ -1117,10 +1207,10 @@ function SidebarProvider({
|
|
|
1117
1207
|
...props
|
|
1118
1208
|
}) {
|
|
1119
1209
|
const isMobile = useIsMobile();
|
|
1120
|
-
const [openMobile, setOpenMobile] =
|
|
1121
|
-
const [_open, _setOpen] =
|
|
1210
|
+
const [openMobile, setOpenMobile] = React4.useState(false);
|
|
1211
|
+
const [_open, _setOpen] = React4.useState(defaultOpen);
|
|
1122
1212
|
const open = openProp ?? _open;
|
|
1123
|
-
const setOpen =
|
|
1213
|
+
const setOpen = React4.useCallback(
|
|
1124
1214
|
(value) => {
|
|
1125
1215
|
const openState = typeof value === "function" ? value(open) : value;
|
|
1126
1216
|
if (setOpenProp) {
|
|
@@ -1132,10 +1222,10 @@ function SidebarProvider({
|
|
|
1132
1222
|
},
|
|
1133
1223
|
[setOpenProp, open]
|
|
1134
1224
|
);
|
|
1135
|
-
const toggleSidebar =
|
|
1225
|
+
const toggleSidebar = React4.useCallback(() => {
|
|
1136
1226
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
1137
1227
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
1138
|
-
|
|
1228
|
+
React4.useEffect(() => {
|
|
1139
1229
|
const handleKeyDown = (event) => {
|
|
1140
1230
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1141
1231
|
event.preventDefault();
|
|
@@ -1146,7 +1236,7 @@ function SidebarProvider({
|
|
|
1146
1236
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1147
1237
|
}, [toggleSidebar]);
|
|
1148
1238
|
const state = open ? "expanded" : "collapsed";
|
|
1149
|
-
const contextValue =
|
|
1239
|
+
const contextValue = React4.useMemo(
|
|
1150
1240
|
() => ({
|
|
1151
1241
|
state,
|
|
1152
1242
|
open,
|
|
@@ -1158,7 +1248,7 @@ function SidebarProvider({
|
|
|
1158
1248
|
}),
|
|
1159
1249
|
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
1160
1250
|
);
|
|
1161
|
-
return /* @__PURE__ */ (0,
|
|
1251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1162
1252
|
"div",
|
|
1163
1253
|
{
|
|
1164
1254
|
"data-slot": "sidebar-wrapper",
|
|
@@ -1186,7 +1276,7 @@ function Sidebar({
|
|
|
1186
1276
|
}) {
|
|
1187
1277
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1188
1278
|
if (collapsible === "none") {
|
|
1189
|
-
return /* @__PURE__ */ (0,
|
|
1279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1190
1280
|
"div",
|
|
1191
1281
|
{
|
|
1192
1282
|
"data-slot": "sidebar",
|
|
@@ -1200,7 +1290,7 @@ function Sidebar({
|
|
|
1200
1290
|
);
|
|
1201
1291
|
}
|
|
1202
1292
|
if (isMobile) {
|
|
1203
|
-
return /* @__PURE__ */ (0,
|
|
1293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1204
1294
|
SheetContent,
|
|
1205
1295
|
{
|
|
1206
1296
|
"data-sidebar": "sidebar",
|
|
@@ -1212,16 +1302,16 @@ function Sidebar({
|
|
|
1212
1302
|
},
|
|
1213
1303
|
side,
|
|
1214
1304
|
children: [
|
|
1215
|
-
/* @__PURE__ */ (0,
|
|
1216
|
-
/* @__PURE__ */ (0,
|
|
1217
|
-
/* @__PURE__ */ (0,
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(SheetHeader, { className: "sr-only", children: [
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SheetTitle, { children: "Sidebar" }),
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
1218
1308
|
] }),
|
|
1219
|
-
/* @__PURE__ */ (0,
|
|
1309
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-full w-full flex-col", children })
|
|
1220
1310
|
]
|
|
1221
1311
|
}
|
|
1222
1312
|
) });
|
|
1223
1313
|
}
|
|
1224
|
-
return /* @__PURE__ */ (0,
|
|
1314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1225
1315
|
"div",
|
|
1226
1316
|
{
|
|
1227
1317
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
@@ -1231,7 +1321,7 @@ function Sidebar({
|
|
|
1231
1321
|
"data-side": side,
|
|
1232
1322
|
"data-slot": "sidebar",
|
|
1233
1323
|
children: [
|
|
1234
|
-
/* @__PURE__ */ (0,
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1235
1325
|
"div",
|
|
1236
1326
|
{
|
|
1237
1327
|
"data-slot": "sidebar-gap",
|
|
@@ -1243,7 +1333,7 @@ function Sidebar({
|
|
|
1243
1333
|
)
|
|
1244
1334
|
}
|
|
1245
1335
|
),
|
|
1246
|
-
/* @__PURE__ */ (0,
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1247
1337
|
"div",
|
|
1248
1338
|
{
|
|
1249
1339
|
"data-slot": "sidebar-container",
|
|
@@ -1255,7 +1345,7 @@ function Sidebar({
|
|
|
1255
1345
|
className
|
|
1256
1346
|
),
|
|
1257
1347
|
...props,
|
|
1258
|
-
children: /* @__PURE__ */ (0,
|
|
1348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1259
1349
|
"div",
|
|
1260
1350
|
{
|
|
1261
1351
|
"data-sidebar": "sidebar",
|
|
@@ -1276,7 +1366,7 @@ function SidebarTrigger({
|
|
|
1276
1366
|
...props
|
|
1277
1367
|
}) {
|
|
1278
1368
|
const { toggleSidebar } = useSidebar();
|
|
1279
|
-
return /* @__PURE__ */ (0,
|
|
1369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1280
1370
|
Button,
|
|
1281
1371
|
{
|
|
1282
1372
|
"data-sidebar": "trigger",
|
|
@@ -1290,15 +1380,15 @@ function SidebarTrigger({
|
|
|
1290
1380
|
},
|
|
1291
1381
|
...props,
|
|
1292
1382
|
children: [
|
|
1293
|
-
/* @__PURE__ */ (0,
|
|
1294
|
-
/* @__PURE__ */ (0,
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.PanelLeftIcon, {}),
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
1295
1385
|
]
|
|
1296
1386
|
}
|
|
1297
1387
|
);
|
|
1298
1388
|
}
|
|
1299
1389
|
function SidebarRail({ className, ...props }) {
|
|
1300
1390
|
const { toggleSidebar } = useSidebar();
|
|
1301
|
-
return /* @__PURE__ */ (0,
|
|
1391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1302
1392
|
"button",
|
|
1303
1393
|
{
|
|
1304
1394
|
"data-sidebar": "rail",
|
|
@@ -1321,7 +1411,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
1321
1411
|
);
|
|
1322
1412
|
}
|
|
1323
1413
|
function SidebarInset({ className, ...props }) {
|
|
1324
|
-
return /* @__PURE__ */ (0,
|
|
1414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1325
1415
|
"main",
|
|
1326
1416
|
{
|
|
1327
1417
|
"data-slot": "sidebar-inset",
|
|
@@ -1335,7 +1425,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
1335
1425
|
);
|
|
1336
1426
|
}
|
|
1337
1427
|
function SidebarHeader({ className, ...props }) {
|
|
1338
|
-
return /* @__PURE__ */ (0,
|
|
1428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1339
1429
|
"div",
|
|
1340
1430
|
{
|
|
1341
1431
|
"data-slot": "sidebar-header",
|
|
@@ -1346,7 +1436,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
1346
1436
|
);
|
|
1347
1437
|
}
|
|
1348
1438
|
function SidebarFooter({ className, ...props }) {
|
|
1349
|
-
return /* @__PURE__ */ (0,
|
|
1439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1350
1440
|
"div",
|
|
1351
1441
|
{
|
|
1352
1442
|
"data-slot": "sidebar-footer",
|
|
@@ -1357,7 +1447,7 @@ function SidebarFooter({ className, ...props }) {
|
|
|
1357
1447
|
);
|
|
1358
1448
|
}
|
|
1359
1449
|
function SidebarContent({ className, ...props }) {
|
|
1360
|
-
return /* @__PURE__ */ (0,
|
|
1450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1361
1451
|
"div",
|
|
1362
1452
|
{
|
|
1363
1453
|
"data-slot": "sidebar-content",
|
|
@@ -1371,7 +1461,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
1371
1461
|
);
|
|
1372
1462
|
}
|
|
1373
1463
|
function SidebarGroup({ className, ...props }) {
|
|
1374
|
-
return /* @__PURE__ */ (0,
|
|
1464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1375
1465
|
"div",
|
|
1376
1466
|
{
|
|
1377
1467
|
"data-slot": "sidebar-group",
|
|
@@ -1387,7 +1477,7 @@ function SidebarGroupLabel({
|
|
|
1387
1477
|
...props
|
|
1388
1478
|
}) {
|
|
1389
1479
|
const Comp = asChild ? import_react_slot3.Slot : "div";
|
|
1390
|
-
return /* @__PURE__ */ (0,
|
|
1480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1391
1481
|
Comp,
|
|
1392
1482
|
{
|
|
1393
1483
|
"data-slot": "sidebar-group-label",
|
|
@@ -1405,7 +1495,7 @@ function SidebarGroupContent({
|
|
|
1405
1495
|
className,
|
|
1406
1496
|
...props
|
|
1407
1497
|
}) {
|
|
1408
|
-
return /* @__PURE__ */ (0,
|
|
1498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1409
1499
|
"div",
|
|
1410
1500
|
{
|
|
1411
1501
|
"data-slot": "sidebar-group-content",
|
|
@@ -1416,7 +1506,7 @@ function SidebarGroupContent({
|
|
|
1416
1506
|
);
|
|
1417
1507
|
}
|
|
1418
1508
|
function SidebarMenu({ className, ...props }) {
|
|
1419
|
-
return /* @__PURE__ */ (0,
|
|
1509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1420
1510
|
"ul",
|
|
1421
1511
|
{
|
|
1422
1512
|
"data-slot": "sidebar-menu",
|
|
@@ -1427,7 +1517,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
1427
1517
|
);
|
|
1428
1518
|
}
|
|
1429
1519
|
function SidebarMenuItem({ className, ...props }) {
|
|
1430
|
-
return /* @__PURE__ */ (0,
|
|
1520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1431
1521
|
"li",
|
|
1432
1522
|
{
|
|
1433
1523
|
"data-slot": "sidebar-menu-item",
|
|
@@ -1468,7 +1558,7 @@ function SidebarMenuButton({
|
|
|
1468
1558
|
}) {
|
|
1469
1559
|
const Comp = asChild ? import_react_slot3.Slot : "button";
|
|
1470
1560
|
const { isMobile, state } = useSidebar();
|
|
1471
|
-
const button = /* @__PURE__ */ (0,
|
|
1561
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1472
1562
|
Comp,
|
|
1473
1563
|
{
|
|
1474
1564
|
"data-slot": "sidebar-menu-button",
|
|
@@ -1487,9 +1577,9 @@ function SidebarMenuButton({
|
|
|
1487
1577
|
children: tooltip
|
|
1488
1578
|
};
|
|
1489
1579
|
}
|
|
1490
|
-
return /* @__PURE__ */ (0,
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1492
|
-
/* @__PURE__ */ (0,
|
|
1580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Tooltip, { children: [
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipTrigger, { asChild: true, children: button }),
|
|
1582
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1493
1583
|
TooltipContent,
|
|
1494
1584
|
{
|
|
1495
1585
|
side: "right",
|
|
@@ -1507,7 +1597,7 @@ function SidebarMenuAction({
|
|
|
1507
1597
|
...props
|
|
1508
1598
|
}) {
|
|
1509
1599
|
const Comp = asChild ? import_react_slot3.Slot : "button";
|
|
1510
|
-
return /* @__PURE__ */ (0,
|
|
1600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1511
1601
|
Comp,
|
|
1512
1602
|
{
|
|
1513
1603
|
"data-slot": "sidebar-menu-action",
|
|
@@ -1529,34 +1619,58 @@ function SidebarMenuAction({
|
|
|
1529
1619
|
}
|
|
1530
1620
|
|
|
1531
1621
|
// src/components/ui/dialog.tsx
|
|
1622
|
+
var React5 = __toESM(require("react"), 1);
|
|
1532
1623
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1533
1624
|
var import_lucide_react4 = require("lucide-react");
|
|
1534
|
-
var
|
|
1625
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1626
|
+
function cleanupBodyStyles2() {
|
|
1627
|
+
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1628
|
+
document.body.style.pointerEvents = "";
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1535
1631
|
function Dialog({
|
|
1632
|
+
open,
|
|
1633
|
+
onOpenChange,
|
|
1536
1634
|
...props
|
|
1537
1635
|
}) {
|
|
1538
|
-
|
|
1636
|
+
const prevOpenRef = React5.useRef(open);
|
|
1637
|
+
React5.useEffect(() => {
|
|
1638
|
+
if (prevOpenRef.current === true && open === false) {
|
|
1639
|
+
const timeout = setTimeout(cleanupBodyStyles2, 250);
|
|
1640
|
+
return () => clearTimeout(timeout);
|
|
1641
|
+
}
|
|
1642
|
+
prevOpenRef.current = open;
|
|
1643
|
+
}, [open]);
|
|
1644
|
+
React5.useEffect(() => {
|
|
1645
|
+
return () => {
|
|
1646
|
+
cleanupBodyStyles2();
|
|
1647
|
+
};
|
|
1648
|
+
}, []);
|
|
1649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", open, onOpenChange, ...props });
|
|
1539
1650
|
}
|
|
1540
1651
|
function DialogTrigger({
|
|
1541
1652
|
...props
|
|
1542
1653
|
}) {
|
|
1543
|
-
return /* @__PURE__ */ (0,
|
|
1654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
1544
1655
|
}
|
|
1545
1656
|
function DialogPortal({
|
|
1546
1657
|
...props
|
|
1547
1658
|
}) {
|
|
1548
|
-
return /* @__PURE__ */ (0,
|
|
1659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
1549
1660
|
}
|
|
1550
1661
|
function DialogOverlay({
|
|
1551
1662
|
className,
|
|
1552
1663
|
...props
|
|
1553
1664
|
}) {
|
|
1554
|
-
return /* @__PURE__ */ (0,
|
|
1665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1555
1666
|
DialogPrimitive.Overlay,
|
|
1556
1667
|
{
|
|
1557
1668
|
"data-slot": "dialog-overlay",
|
|
1558
1669
|
className: cn(
|
|
1559
|
-
"
|
|
1670
|
+
"fixed inset-0 z-50 bg-black/50",
|
|
1671
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1672
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1673
|
+
"data-[state=closed]:pointer-events-none",
|
|
1560
1674
|
className
|
|
1561
1675
|
),
|
|
1562
1676
|
...props
|
|
@@ -1569,12 +1683,13 @@ function DialogContent({
|
|
|
1569
1683
|
showCloseButton = true,
|
|
1570
1684
|
...props
|
|
1571
1685
|
}) {
|
|
1572
|
-
return /* @__PURE__ */ (0,
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogOverlay, {}),
|
|
1688
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1575
1689
|
DialogPrimitive.Content,
|
|
1576
1690
|
{
|
|
1577
1691
|
"data-slot": "dialog-content",
|
|
1692
|
+
"aria-describedby": void 0,
|
|
1578
1693
|
className: cn(
|
|
1579
1694
|
"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",
|
|
1580
1695
|
className
|
|
@@ -1582,14 +1697,14 @@ function DialogContent({
|
|
|
1582
1697
|
...props,
|
|
1583
1698
|
children: [
|
|
1584
1699
|
children,
|
|
1585
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
1700
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1586
1701
|
DialogPrimitive.Close,
|
|
1587
1702
|
{
|
|
1588
1703
|
"data-slot": "dialog-close",
|
|
1589
1704
|
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",
|
|
1590
1705
|
children: [
|
|
1591
|
-
/* @__PURE__ */ (0,
|
|
1592
|
-
/* @__PURE__ */ (0,
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.XIcon, {}),
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1593
1708
|
]
|
|
1594
1709
|
}
|
|
1595
1710
|
)
|
|
@@ -1599,7 +1714,7 @@ function DialogContent({
|
|
|
1599
1714
|
] });
|
|
1600
1715
|
}
|
|
1601
1716
|
function DialogHeader({ className, ...props }) {
|
|
1602
|
-
return /* @__PURE__ */ (0,
|
|
1717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1603
1718
|
"div",
|
|
1604
1719
|
{
|
|
1605
1720
|
"data-slot": "dialog-header",
|
|
@@ -1609,7 +1724,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
1609
1724
|
);
|
|
1610
1725
|
}
|
|
1611
1726
|
function DialogFooter({ className, ...props }) {
|
|
1612
|
-
return /* @__PURE__ */ (0,
|
|
1727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1613
1728
|
"div",
|
|
1614
1729
|
{
|
|
1615
1730
|
"data-slot": "dialog-footer",
|
|
@@ -1625,7 +1740,7 @@ function DialogTitle({
|
|
|
1625
1740
|
className,
|
|
1626
1741
|
...props
|
|
1627
1742
|
}) {
|
|
1628
|
-
return /* @__PURE__ */ (0,
|
|
1743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1629
1744
|
DialogPrimitive.Title,
|
|
1630
1745
|
{
|
|
1631
1746
|
"data-slot": "dialog-title",
|
|
@@ -1638,7 +1753,7 @@ function DialogDescription({
|
|
|
1638
1753
|
className,
|
|
1639
1754
|
...props
|
|
1640
1755
|
}) {
|
|
1641
|
-
return /* @__PURE__ */ (0,
|
|
1756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1642
1757
|
DialogPrimitive.Description,
|
|
1643
1758
|
{
|
|
1644
1759
|
"data-slot": "dialog-description",
|
|
@@ -1649,28 +1764,52 @@ function DialogDescription({
|
|
|
1649
1764
|
}
|
|
1650
1765
|
|
|
1651
1766
|
// src/components/ui/alert-dialog.tsx
|
|
1767
|
+
var React6 = __toESM(require("react"), 1);
|
|
1652
1768
|
var AlertDialogPrimitive = __toESM(require("@radix-ui/react-alert-dialog"), 1);
|
|
1653
|
-
var
|
|
1769
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1770
|
+
function cleanupBodyStyles3() {
|
|
1771
|
+
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1772
|
+
document.body.style.pointerEvents = "";
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1654
1775
|
function AlertDialog({
|
|
1776
|
+
open,
|
|
1777
|
+
onOpenChange,
|
|
1655
1778
|
...props
|
|
1656
1779
|
}) {
|
|
1657
|
-
|
|
1780
|
+
const prevOpenRef = React6.useRef(open);
|
|
1781
|
+
React6.useEffect(() => {
|
|
1782
|
+
if (prevOpenRef.current === true && open === false) {
|
|
1783
|
+
const timeout = setTimeout(cleanupBodyStyles3, 250);
|
|
1784
|
+
return () => clearTimeout(timeout);
|
|
1785
|
+
}
|
|
1786
|
+
prevOpenRef.current = open;
|
|
1787
|
+
}, [open]);
|
|
1788
|
+
React6.useEffect(() => {
|
|
1789
|
+
return () => {
|
|
1790
|
+
cleanupBodyStyles3();
|
|
1791
|
+
};
|
|
1792
|
+
}, []);
|
|
1793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", open, onOpenChange, ...props });
|
|
1658
1794
|
}
|
|
1659
1795
|
function AlertDialogPortal({
|
|
1660
1796
|
...props
|
|
1661
1797
|
}) {
|
|
1662
|
-
return /* @__PURE__ */ (0,
|
|
1798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
1663
1799
|
}
|
|
1664
1800
|
function AlertDialogOverlay({
|
|
1665
1801
|
className,
|
|
1666
1802
|
...props
|
|
1667
1803
|
}) {
|
|
1668
|
-
return /* @__PURE__ */ (0,
|
|
1804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1669
1805
|
AlertDialogPrimitive.Overlay,
|
|
1670
1806
|
{
|
|
1671
1807
|
"data-slot": "alert-dialog-overlay",
|
|
1672
1808
|
className: cn(
|
|
1673
|
-
"
|
|
1809
|
+
"fixed inset-0 z-50 bg-black/50",
|
|
1810
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1811
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1812
|
+
"data-[state=closed]:pointer-events-none",
|
|
1674
1813
|
className
|
|
1675
1814
|
),
|
|
1676
1815
|
...props
|
|
@@ -1681,9 +1820,9 @@ function AlertDialogContent({
|
|
|
1681
1820
|
className,
|
|
1682
1821
|
...props
|
|
1683
1822
|
}) {
|
|
1684
|
-
return /* @__PURE__ */ (0,
|
|
1685
|
-
/* @__PURE__ */ (0,
|
|
1686
|
-
/* @__PURE__ */ (0,
|
|
1823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(AlertDialogPortal, { children: [
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AlertDialogOverlay, {}),
|
|
1825
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1687
1826
|
AlertDialogPrimitive.Content,
|
|
1688
1827
|
{
|
|
1689
1828
|
"data-slot": "alert-dialog-content",
|
|
@@ -1700,7 +1839,7 @@ function AlertDialogHeader({
|
|
|
1700
1839
|
className,
|
|
1701
1840
|
...props
|
|
1702
1841
|
}) {
|
|
1703
|
-
return /* @__PURE__ */ (0,
|
|
1842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1704
1843
|
"div",
|
|
1705
1844
|
{
|
|
1706
1845
|
"data-slot": "alert-dialog-header",
|
|
@@ -1713,7 +1852,7 @@ function AlertDialogFooter({
|
|
|
1713
1852
|
className,
|
|
1714
1853
|
...props
|
|
1715
1854
|
}) {
|
|
1716
|
-
return /* @__PURE__ */ (0,
|
|
1855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1717
1856
|
"div",
|
|
1718
1857
|
{
|
|
1719
1858
|
"data-slot": "alert-dialog-footer",
|
|
@@ -1729,7 +1868,7 @@ function AlertDialogTitle({
|
|
|
1729
1868
|
className,
|
|
1730
1869
|
...props
|
|
1731
1870
|
}) {
|
|
1732
|
-
return /* @__PURE__ */ (0,
|
|
1871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1733
1872
|
AlertDialogPrimitive.Title,
|
|
1734
1873
|
{
|
|
1735
1874
|
"data-slot": "alert-dialog-title",
|
|
@@ -1742,7 +1881,7 @@ function AlertDialogDescription({
|
|
|
1742
1881
|
className,
|
|
1743
1882
|
...props
|
|
1744
1883
|
}) {
|
|
1745
|
-
return /* @__PURE__ */ (0,
|
|
1884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1746
1885
|
AlertDialogPrimitive.Description,
|
|
1747
1886
|
{
|
|
1748
1887
|
"data-slot": "alert-dialog-description",
|
|
@@ -1755,7 +1894,7 @@ function AlertDialogAction({
|
|
|
1755
1894
|
className,
|
|
1756
1895
|
...props
|
|
1757
1896
|
}) {
|
|
1758
|
-
return /* @__PURE__ */ (0,
|
|
1897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1759
1898
|
AlertDialogPrimitive.Action,
|
|
1760
1899
|
{
|
|
1761
1900
|
className: cn(buttonVariants(), className),
|
|
@@ -1767,7 +1906,7 @@ function AlertDialogCancel({
|
|
|
1767
1906
|
className,
|
|
1768
1907
|
...props
|
|
1769
1908
|
}) {
|
|
1770
|
-
return /* @__PURE__ */ (0,
|
|
1909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1771
1910
|
AlertDialogPrimitive.Cancel,
|
|
1772
1911
|
{
|
|
1773
1912
|
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
@@ -1779,16 +1918,16 @@ function AlertDialogCancel({
|
|
|
1779
1918
|
// src/components/ui/dropdown-menu.tsx
|
|
1780
1919
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
1781
1920
|
var import_lucide_react5 = require("lucide-react");
|
|
1782
|
-
var
|
|
1921
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1783
1922
|
function DropdownMenu({
|
|
1784
1923
|
...props
|
|
1785
1924
|
}) {
|
|
1786
|
-
return /* @__PURE__ */ (0,
|
|
1925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
1787
1926
|
}
|
|
1788
1927
|
function DropdownMenuTrigger({
|
|
1789
1928
|
...props
|
|
1790
1929
|
}) {
|
|
1791
|
-
return /* @__PURE__ */ (0,
|
|
1930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1792
1931
|
DropdownMenuPrimitive.Trigger,
|
|
1793
1932
|
{
|
|
1794
1933
|
"data-slot": "dropdown-menu-trigger",
|
|
@@ -1801,7 +1940,7 @@ function DropdownMenuContent({
|
|
|
1801
1940
|
sideOffset = 4,
|
|
1802
1941
|
...props
|
|
1803
1942
|
}) {
|
|
1804
|
-
return /* @__PURE__ */ (0,
|
|
1943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1805
1944
|
DropdownMenuPrimitive.Content,
|
|
1806
1945
|
{
|
|
1807
1946
|
"data-slot": "dropdown-menu-content",
|
|
@@ -1820,7 +1959,7 @@ function DropdownMenuItem({
|
|
|
1820
1959
|
variant = "default",
|
|
1821
1960
|
...props
|
|
1822
1961
|
}) {
|
|
1823
|
-
return /* @__PURE__ */ (0,
|
|
1962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1824
1963
|
DropdownMenuPrimitive.Item,
|
|
1825
1964
|
{
|
|
1826
1965
|
"data-slot": "dropdown-menu-item",
|
|
@@ -1839,7 +1978,7 @@ function DropdownMenuLabel({
|
|
|
1839
1978
|
inset,
|
|
1840
1979
|
...props
|
|
1841
1980
|
}) {
|
|
1842
|
-
return /* @__PURE__ */ (0,
|
|
1981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1843
1982
|
DropdownMenuPrimitive.Label,
|
|
1844
1983
|
{
|
|
1845
1984
|
"data-slot": "dropdown-menu-label",
|
|
@@ -1856,7 +1995,7 @@ function DropdownMenuSeparator({
|
|
|
1856
1995
|
className,
|
|
1857
1996
|
...props
|
|
1858
1997
|
}) {
|
|
1859
|
-
return /* @__PURE__ */ (0,
|
|
1998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1860
1999
|
DropdownMenuPrimitive.Separator,
|
|
1861
2000
|
{
|
|
1862
2001
|
"data-slot": "dropdown-menu-separator",
|
|
@@ -1871,7 +2010,7 @@ var import_lucide_react7 = require("lucide-react");
|
|
|
1871
2010
|
|
|
1872
2011
|
// src/components/chat/UserMenu.tsx
|
|
1873
2012
|
var import_lucide_react6 = require("lucide-react");
|
|
1874
|
-
var
|
|
2013
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1875
2014
|
var getInitials = (name, email) => {
|
|
1876
2015
|
if (name) {
|
|
1877
2016
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -1906,27 +2045,27 @@ var UserMenu = ({
|
|
|
1906
2045
|
};
|
|
1907
2046
|
const displayName = getDisplayName(user, labels.guest);
|
|
1908
2047
|
const initials = getInitials(user?.name, user?.email);
|
|
1909
|
-
return /* @__PURE__ */ (0,
|
|
1910
|
-
/* @__PURE__ */ (0,
|
|
2048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SidebarMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenu, { children: [
|
|
2049
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1911
2050
|
SidebarMenuButton,
|
|
1912
2051
|
{
|
|
1913
2052
|
size: "lg",
|
|
1914
2053
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
1915
2054
|
tooltip: displayName,
|
|
1916
2055
|
children: [
|
|
1917
|
-
/* @__PURE__ */ (0,
|
|
1918
|
-
user?.avatar && /* @__PURE__ */ (0,
|
|
1919
|
-
/* @__PURE__ */ (0,
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2057
|
+
user?.avatar && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2058
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
1920
2059
|
] }),
|
|
1921
|
-
/* @__PURE__ */ (0,
|
|
1922
|
-
/* @__PURE__ */ (0,
|
|
1923
|
-
user?.email && /* @__PURE__ */ (0,
|
|
2060
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate font-medium", children: displayName }),
|
|
2062
|
+
user?.email && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
1924
2063
|
] }),
|
|
1925
|
-
/* @__PURE__ */ (0,
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
|
|
1926
2065
|
]
|
|
1927
2066
|
}
|
|
1928
2067
|
) }),
|
|
1929
|
-
/* @__PURE__ */ (0,
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1930
2069
|
DropdownMenuContent,
|
|
1931
2070
|
{
|
|
1932
2071
|
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg",
|
|
@@ -1934,72 +2073,72 @@ var UserMenu = ({
|
|
|
1934
2073
|
align: "end",
|
|
1935
2074
|
sideOffset: 4,
|
|
1936
2075
|
children: [
|
|
1937
|
-
/* @__PURE__ */ (0,
|
|
1938
|
-
/* @__PURE__ */ (0,
|
|
1939
|
-
user?.avatar && /* @__PURE__ */ (0,
|
|
1940
|
-
/* @__PURE__ */ (0,
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2078
|
+
user?.avatar && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
1941
2080
|
] }),
|
|
1942
|
-
/* @__PURE__ */ (0,
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
1944
|
-
user?.email && /* @__PURE__ */ (0,
|
|
2081
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
2082
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate font-medium", children: displayName }),
|
|
2083
|
+
user?.email && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
1945
2084
|
] })
|
|
1946
2085
|
] }) }),
|
|
1947
|
-
/* @__PURE__ */ (0,
|
|
1948
|
-
callbacks?.onViewProfile && /* @__PURE__ */ (0,
|
|
1949
|
-
/* @__PURE__ */ (0,
|
|
1950
|
-
/* @__PURE__ */ (0,
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuSeparator, {}),
|
|
2087
|
+
callbacks?.onViewProfile && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenuItem, { onClick: callbacks.onViewProfile, children: [
|
|
2088
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.User, { className: "mr-2 h-4 w-4" }),
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: labels.profile })
|
|
1951
2090
|
] }),
|
|
1952
|
-
callbacks?.onOpenSettings && /* @__PURE__ */ (0,
|
|
1953
|
-
/* @__PURE__ */ (0,
|
|
1954
|
-
/* @__PURE__ */ (0,
|
|
2091
|
+
callbacks?.onOpenSettings && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenuItem, { onClick: callbacks.onOpenSettings, children: [
|
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.Settings, { className: "mr-2 h-4 w-4" }),
|
|
2093
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: labels.settings })
|
|
1955
2094
|
] }),
|
|
1956
2095
|
additionalItems,
|
|
1957
|
-
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ (0,
|
|
1958
|
-
/* @__PURE__ */ (0,
|
|
1959
|
-
/* @__PURE__ */ (0,
|
|
2096
|
+
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2097
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuSeparator, {}),
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1960
2099
|
DropdownMenuItem,
|
|
1961
2100
|
{
|
|
1962
2101
|
onClick: () => callbacks.onThemeChange?.("light"),
|
|
1963
2102
|
className: currentTheme === "light" ? "bg-accent" : "",
|
|
1964
2103
|
children: [
|
|
1965
|
-
/* @__PURE__ */ (0,
|
|
1966
|
-
/* @__PURE__ */ (0,
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.Sun, { className: "mr-2 h-4 w-4" }),
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: labels.lightMode })
|
|
1967
2106
|
]
|
|
1968
2107
|
}
|
|
1969
2108
|
),
|
|
1970
|
-
/* @__PURE__ */ (0,
|
|
2109
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1971
2110
|
DropdownMenuItem,
|
|
1972
2111
|
{
|
|
1973
2112
|
onClick: () => callbacks.onThemeChange?.("dark"),
|
|
1974
2113
|
className: currentTheme === "dark" ? "bg-accent" : "",
|
|
1975
2114
|
children: [
|
|
1976
|
-
/* @__PURE__ */ (0,
|
|
1977
|
-
/* @__PURE__ */ (0,
|
|
2115
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.Moon, { className: "mr-2 h-4 w-4" }),
|
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: labels.darkMode })
|
|
1978
2117
|
]
|
|
1979
2118
|
}
|
|
1980
2119
|
),
|
|
1981
|
-
/* @__PURE__ */ (0,
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1982
2121
|
DropdownMenuItem,
|
|
1983
2122
|
{
|
|
1984
2123
|
onClick: () => callbacks.onThemeChange?.("system"),
|
|
1985
2124
|
className: currentTheme === "system" ? "bg-accent" : "",
|
|
1986
2125
|
children: [
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
1988
|
-
/* @__PURE__ */ (0,
|
|
2126
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.Palette, { className: "mr-2 h-4 w-4" }),
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: labels.systemTheme })
|
|
1989
2128
|
]
|
|
1990
2129
|
}
|
|
1991
2130
|
)
|
|
1992
2131
|
] }),
|
|
1993
|
-
callbacks?.onLogout && /* @__PURE__ */ (0,
|
|
1994
|
-
/* @__PURE__ */ (0,
|
|
1995
|
-
/* @__PURE__ */ (0,
|
|
2132
|
+
callbacks?.onLogout && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuSeparator, {}),
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1996
2135
|
DropdownMenuItem,
|
|
1997
2136
|
{
|
|
1998
2137
|
onClick: callbacks.onLogout,
|
|
1999
2138
|
className: "text-destructive focus:text-destructive focus:bg-destructive/10",
|
|
2000
2139
|
children: [
|
|
2001
|
-
/* @__PURE__ */ (0,
|
|
2002
|
-
/* @__PURE__ */ (0,
|
|
2140
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.LogOut, { className: "mr-2 h-4 w-4" }),
|
|
2141
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: labels.logout })
|
|
2003
2142
|
]
|
|
2004
2143
|
}
|
|
2005
2144
|
)
|
|
@@ -2011,7 +2150,7 @@ var UserMenu = ({
|
|
|
2011
2150
|
};
|
|
2012
2151
|
|
|
2013
2152
|
// src/components/chat/Sidebar.tsx
|
|
2014
|
-
var
|
|
2153
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2015
2154
|
var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
2016
2155
|
const [title, setTitle] = (0, import_react2.useState)("");
|
|
2017
2156
|
const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
|
|
@@ -2020,17 +2159,17 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2020
2159
|
setTitle("");
|
|
2021
2160
|
setIsOpen(false);
|
|
2022
2161
|
};
|
|
2023
|
-
return /* @__PURE__ */ (0,
|
|
2024
|
-
/* @__PURE__ */ (0,
|
|
2025
|
-
/* @__PURE__ */ (0,
|
|
2162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2163
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Button, { className: "w-full justify-start", variant: "outline", children: [
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Plus, { className: "mr-2 h-4 w-4" }),
|
|
2026
2165
|
config.labels?.newChat || "New Chat"
|
|
2027
2166
|
] }) }),
|
|
2028
|
-
/* @__PURE__ */ (0,
|
|
2029
|
-
/* @__PURE__ */ (0,
|
|
2030
|
-
/* @__PURE__ */ (0,
|
|
2031
|
-
/* @__PURE__ */ (0,
|
|
2167
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DialogContent, { children: [
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DialogHeader, { children: [
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogTitle, { children: config.labels?.createNewThread || "New Conversation" }),
|
|
2170
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
2032
2171
|
] }),
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2034
2173
|
Input,
|
|
2035
2174
|
{
|
|
2036
2175
|
value: title,
|
|
@@ -2040,16 +2179,16 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2040
2179
|
autoFocus: true
|
|
2041
2180
|
}
|
|
2042
2181
|
),
|
|
2043
|
-
/* @__PURE__ */ (0,
|
|
2044
|
-
/* @__PURE__ */ (0,
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DialogFooter, { children: [
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config.labels?.cancel || "Cancel" }),
|
|
2184
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button, { onClick: handleCreate, children: config.labels?.create || "Create" })
|
|
2046
2185
|
] })
|
|
2047
2186
|
] })
|
|
2048
2187
|
] });
|
|
2049
2188
|
};
|
|
2050
2189
|
var ThreadInitialsIcon = ({ title }) => {
|
|
2051
2190
|
const initials = title?.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase() || "?";
|
|
2052
|
-
return /* @__PURE__ */ (0,
|
|
2191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex shrink-0 items-center justify-center rounded bg-muted text-[10px] font-medium", children: initials });
|
|
2053
2192
|
};
|
|
2054
2193
|
var Sidebar2 = ({
|
|
2055
2194
|
threads,
|
|
@@ -2126,31 +2265,38 @@ var Sidebar2 = ({
|
|
|
2126
2265
|
const cancelEdit = () => {
|
|
2127
2266
|
setEditingThreadId(null);
|
|
2128
2267
|
};
|
|
2129
|
-
return /* @__PURE__ */ (0,
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
2131
|
-
|
|
2268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Sidebar, { collapsible: "icon", ...props, children: [
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SidebarHeader, { children: [
|
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex items-center justify-center shrink-0", children: config.branding?.logo || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AvatarFallback, { className: "bg-primary text-primary-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Bot, { className: "h-4 w-4" }) }) }) }),
|
|
2272
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
2273
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-sm font-semibold truncate", children: config.branding?.title || "Chat" }),
|
|
2274
|
+
config.branding?.subtitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
2275
|
+
] })
|
|
2276
|
+
] }),
|
|
2277
|
+
onCreateThread && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2132
2278
|
CreateThreadDialog,
|
|
2133
2279
|
{
|
|
2134
2280
|
config,
|
|
2135
2281
|
onCreateThread,
|
|
2136
|
-
trigger: /* @__PURE__ */ (0,
|
|
2282
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2137
2283
|
SidebarMenuButton,
|
|
2138
2284
|
{
|
|
2139
2285
|
size: "lg",
|
|
2140
2286
|
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",
|
|
2141
2287
|
tooltip: config.labels?.newChat || "New Chat",
|
|
2142
2288
|
children: [
|
|
2143
|
-
/* @__PURE__ */ (0,
|
|
2144
|
-
/* @__PURE__ */ (0,
|
|
2289
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Plus, { className: "size-4" }),
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "group-data-[collapsible=icon]:hidden", children: config.labels?.newChat || "New Chat" })
|
|
2145
2291
|
]
|
|
2146
2292
|
}
|
|
2147
2293
|
) }) })
|
|
2148
2294
|
}
|
|
2149
2295
|
),
|
|
2150
|
-
/* @__PURE__ */ (0,
|
|
2151
|
-
/* @__PURE__ */ (0,
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2153
|
-
/* @__PURE__ */ (0,
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "px-2 py-1 mt-4", children: [
|
|
2297
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "relative group-data-[collapsible=icon]:hidden", children: [
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Search, { className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 select-none opacity-50" }),
|
|
2299
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2154
2300
|
Input,
|
|
2155
2301
|
{
|
|
2156
2302
|
className: "pl-8 h-8 bg-sidebar-accent/50 border-sidebar-border focus-visible:ring-1 focus-visible:ring-sidebar-ring",
|
|
@@ -2160,7 +2306,7 @@ var Sidebar2 = ({
|
|
|
2160
2306
|
}
|
|
2161
2307
|
)
|
|
2162
2308
|
] }),
|
|
2163
|
-
/* @__PURE__ */ (0,
|
|
2309
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2164
2310
|
Button,
|
|
2165
2311
|
{
|
|
2166
2312
|
variant: "ghost",
|
|
@@ -2168,13 +2314,13 @@ var Sidebar2 = ({
|
|
|
2168
2314
|
className: "h-7 w-7",
|
|
2169
2315
|
onClick: () => setOpen(true),
|
|
2170
2316
|
title: config.labels?.search || "Search",
|
|
2171
|
-
children: /* @__PURE__ */ (0,
|
|
2317
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Search, { className: "h-4 w-4" })
|
|
2172
2318
|
}
|
|
2173
2319
|
) })
|
|
2174
2320
|
] })
|
|
2175
2321
|
] }),
|
|
2176
|
-
/* @__PURE__ */ (0,
|
|
2177
|
-
threads.some((t) => t.isArchived) && /* @__PURE__ */ (0,
|
|
2322
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SidebarContent, { children: [
|
|
2323
|
+
threads.some((t) => t.isArchived) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2178
2324
|
Button,
|
|
2179
2325
|
{
|
|
2180
2326
|
variant: "ghost",
|
|
@@ -2182,18 +2328,18 @@ var Sidebar2 = ({
|
|
|
2182
2328
|
onClick: () => setShowArchived(!showArchived),
|
|
2183
2329
|
className: "h-6 text-xs w-full justify-start text-muted-foreground",
|
|
2184
2330
|
children: [
|
|
2185
|
-
/* @__PURE__ */ (0,
|
|
2331
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Filter, { className: "mr-2 h-3 w-3" }),
|
|
2186
2332
|
showArchived ? config.labels?.hideArchived || "Hide Archived" : config.labels?.showArchived || "Show Archived"
|
|
2187
2333
|
]
|
|
2188
2334
|
}
|
|
2189
2335
|
) }),
|
|
2190
|
-
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ (0,
|
|
2191
|
-
/* @__PURE__ */ (0,
|
|
2192
|
-
/* @__PURE__ */ (0,
|
|
2193
|
-
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0,
|
|
2194
|
-
/* @__PURE__ */ (0,
|
|
2195
|
-
/* @__PURE__ */ (0,
|
|
2196
|
-
editingThreadId === thread.id ? /* @__PURE__ */ (0,
|
|
2336
|
+
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "px-4 py-8 text-center text-muted-foreground group-data-[collapsible=icon]:hidden", children: [
|
|
2337
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mx-auto h-8 w-8 mb-2 flex items-center justify-center rounded-full bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Plus, { className: "h-4 w-4 opacity-50" }) }),
|
|
2338
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
|
|
2339
|
+
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SidebarGroup, { className: "mt-2", children: [
|
|
2340
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: group }),
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarGroupContent, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SidebarMenuItem, { children: [
|
|
2342
|
+
editingThreadId === thread.id ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex items-center gap-1 px-2 py-1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2197
2343
|
Input,
|
|
2198
2344
|
{
|
|
2199
2345
|
ref: inputRef,
|
|
@@ -2206,42 +2352,42 @@ var Sidebar2 = ({
|
|
|
2206
2352
|
onBlur: saveEdit,
|
|
2207
2353
|
className: "h-7 text-sm"
|
|
2208
2354
|
}
|
|
2209
|
-
) }) : /* @__PURE__ */ (0,
|
|
2355
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2210
2356
|
SidebarMenuButton,
|
|
2211
2357
|
{
|
|
2212
2358
|
isActive: currentThreadId === thread.id,
|
|
2213
2359
|
onClick: () => onSelectThread?.(thread.id),
|
|
2214
2360
|
tooltip: thread.title,
|
|
2215
2361
|
children: [
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2217
|
-
/* @__PURE__ */ (0,
|
|
2218
|
-
thread.isArchived && /* @__PURE__ */ (0,
|
|
2362
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ThreadInitialsIcon, { title: thread.title || "?" }),
|
|
2363
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-col items-start gap-0.5 flex-1 min-w-0 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "truncate w-full", children: thread.title || "New Chat" }) }),
|
|
2364
|
+
thread.isArchived && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Archive, { className: "ml-auto h-3 w-3 opacity-50 group-data-[collapsible=icon]:hidden" })
|
|
2219
2365
|
]
|
|
2220
2366
|
}
|
|
2221
2367
|
),
|
|
2222
|
-
!editingThreadId && /* @__PURE__ */ (0,
|
|
2223
|
-
/* @__PURE__ */ (0,
|
|
2224
|
-
/* @__PURE__ */ (0,
|
|
2225
|
-
/* @__PURE__ */ (0,
|
|
2368
|
+
!editingThreadId && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenu, { children: [
|
|
2369
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SidebarMenuAction, { showOnHover: true, children: [
|
|
2370
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.MoreHorizontal, {}),
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sr-only", children: "More" })
|
|
2226
2372
|
] }) }),
|
|
2227
|
-
/* @__PURE__ */ (0,
|
|
2228
|
-
/* @__PURE__ */ (0,
|
|
2229
|
-
/* @__PURE__ */ (0,
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2373
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenuContent, { className: "w-48", side: "right", align: "start", children: [
|
|
2374
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenuItem, { onClick: () => startEditing(thread), children: [
|
|
2375
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Edit2, { className: "mr-2 h-4 w-4" }),
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: config.labels?.renameThread || "Rename" })
|
|
2231
2377
|
] }),
|
|
2232
|
-
/* @__PURE__ */ (0,
|
|
2233
|
-
/* @__PURE__ */ (0,
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2378
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenuItem, { onClick: () => onArchiveThread?.(thread.id), children: [
|
|
2379
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Archive, { className: "mr-2 h-4 w-4" }),
|
|
2380
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
|
|
2235
2381
|
] }),
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2237
|
-
/* @__PURE__ */ (0,
|
|
2382
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuSeparator, {}),
|
|
2383
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2238
2384
|
DropdownMenuItem,
|
|
2239
2385
|
{
|
|
2240
2386
|
onClick: () => setDeleteThreadId(thread.id),
|
|
2241
2387
|
className: "text-destructive focus:text-destructive",
|
|
2242
2388
|
children: [
|
|
2243
|
-
/* @__PURE__ */ (0,
|
|
2244
|
-
/* @__PURE__ */ (0,
|
|
2389
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Trash2, { className: "mr-2 h-4 w-4" }),
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: config.labels?.deleteThread || "Delete" })
|
|
2245
2391
|
]
|
|
2246
2392
|
}
|
|
2247
2393
|
)
|
|
@@ -2250,7 +2396,7 @@ var Sidebar2 = ({
|
|
|
2250
2396
|
] }, thread.id)) }) })
|
|
2251
2397
|
] }, group))
|
|
2252
2398
|
] }),
|
|
2253
|
-
/* @__PURE__ */ (0,
|
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2254
2400
|
UserMenu,
|
|
2255
2401
|
{
|
|
2256
2402
|
user,
|
|
@@ -2261,15 +2407,15 @@ var Sidebar2 = ({
|
|
|
2261
2407
|
additionalItems: userMenuAdditionalItems
|
|
2262
2408
|
}
|
|
2263
2409
|
) }),
|
|
2264
|
-
/* @__PURE__ */ (0,
|
|
2265
|
-
/* @__PURE__ */ (0,
|
|
2266
|
-
/* @__PURE__ */ (0,
|
|
2267
|
-
/* @__PURE__ */ (0,
|
|
2268
|
-
/* @__PURE__ */ (0,
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarRail, {}),
|
|
2411
|
+
deleteThreadId && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(AlertDialogContent, { children: [
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(AlertDialogHeader, { children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
2269
2415
|
] }),
|
|
2270
|
-
/* @__PURE__ */ (0,
|
|
2271
|
-
/* @__PURE__ */ (0,
|
|
2272
|
-
/* @__PURE__ */ (0,
|
|
2416
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(AlertDialogFooter, { children: [
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2273
2419
|
AlertDialogAction,
|
|
2274
2420
|
{
|
|
2275
2421
|
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
@@ -2285,7 +2431,7 @@ var Sidebar2 = ({
|
|
|
2285
2431
|
// src/components/chat/ChatHeader.tsx
|
|
2286
2432
|
var import_react3 = __toESM(require("react"), 1);
|
|
2287
2433
|
var import_lucide_react8 = require("lucide-react");
|
|
2288
|
-
var
|
|
2434
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2289
2435
|
var ChatHeader = ({
|
|
2290
2436
|
config,
|
|
2291
2437
|
currentThreadTitle,
|
|
@@ -2297,6 +2443,10 @@ var ChatHeader = ({
|
|
|
2297
2443
|
onClearAll,
|
|
2298
2444
|
showCustomComponentButton,
|
|
2299
2445
|
isMobile,
|
|
2446
|
+
showAgentSelector = false,
|
|
2447
|
+
agentOptions = [],
|
|
2448
|
+
selectedAgentId = null,
|
|
2449
|
+
onSelectAgent,
|
|
2300
2450
|
className = ""
|
|
2301
2451
|
}) => {
|
|
2302
2452
|
const [isDarkMode, setIsDarkMode] = import_react3.default.useState(() => {
|
|
@@ -2347,72 +2497,114 @@ var ChatHeader = ({
|
|
|
2347
2497
|
};
|
|
2348
2498
|
input.click();
|
|
2349
2499
|
};
|
|
2350
|
-
|
|
2500
|
+
const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
|
|
2501
|
+
const agentPlaceholder = config.agentSelector?.label || "Select agent";
|
|
2502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2351
2503
|
Card,
|
|
2352
2504
|
{
|
|
2353
2505
|
"data-chat-header": true,
|
|
2354
2506
|
className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
|
|
2355
2507
|
style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
|
|
2356
|
-
children: /* @__PURE__ */ (0,
|
|
2357
|
-
/* @__PURE__ */ (0,
|
|
2358
|
-
/* @__PURE__ */ (0,
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CardHeader, { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2509
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2510
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Tooltip, { children: [
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarTrigger, { className: "-ml-1" }) }),
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
|
|
2513
|
+
] }),
|
|
2514
|
+
showAgentSelector && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenu, { children: [
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2516
|
+
Button,
|
|
2517
|
+
{
|
|
2518
|
+
variant: "ghost",
|
|
2519
|
+
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2520
|
+
children: [
|
|
2521
|
+
selectedAgent?.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: "h-5 w-5", children: [
|
|
2522
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2523
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
|
|
2524
|
+
] }) : null,
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.ChevronDown, { className: "h-4 w-4 opacity-50" })
|
|
2527
|
+
]
|
|
2528
|
+
}
|
|
2529
|
+
) }),
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
|
|
2531
|
+
const isSelected = agent.id === selectedAgentId;
|
|
2532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2533
|
+
DropdownMenuItem,
|
|
2534
|
+
{
|
|
2535
|
+
onClick: () => onSelectAgent?.(agent.id),
|
|
2536
|
+
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2537
|
+
children: [
|
|
2538
|
+
agent.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
|
|
2541
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Bot, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2543
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2545
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Check, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2546
|
+
] }),
|
|
2547
|
+
agent.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2548
|
+
] })
|
|
2549
|
+
]
|
|
2550
|
+
},
|
|
2551
|
+
agent.id
|
|
2552
|
+
);
|
|
2553
|
+
}) })
|
|
2554
|
+
] }),
|
|
2555
|
+
!showAgentSelector && isMobile && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
|
|
2365
2556
|
] }),
|
|
2366
|
-
/* @__PURE__ */ (0,
|
|
2367
|
-
|
|
2368
|
-
|
|
2557
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1" }),
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2559
|
+
showCustomComponentButton && config.customComponent && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Tooltip, { children: [
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2369
2561
|
Button,
|
|
2370
2562
|
{
|
|
2371
2563
|
variant: "ghost",
|
|
2372
2564
|
size: "icon",
|
|
2373
2565
|
className: "h-8 w-8",
|
|
2374
2566
|
onClick: onCustomComponentToggle,
|
|
2375
|
-
children: config.customComponent.icon || /* @__PURE__ */ (0,
|
|
2567
|
+
children: config.customComponent.icon || /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Menu, { className: "h-4 w-4" })
|
|
2376
2568
|
}
|
|
2377
2569
|
) }),
|
|
2378
|
-
/* @__PURE__ */ (0,
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
|
|
2379
2571
|
] }),
|
|
2380
2572
|
config.headerActions,
|
|
2381
|
-
/* @__PURE__ */ (0,
|
|
2382
|
-
/* @__PURE__ */ (0,
|
|
2383
|
-
/* @__PURE__ */ (0,
|
|
2384
|
-
onNewThread && /* @__PURE__ */ (0,
|
|
2385
|
-
/* @__PURE__ */ (0,
|
|
2386
|
-
/* @__PURE__ */ (0,
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenu, { children: [
|
|
2574
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
2575
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
2576
|
+
onNewThread && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Plus, { className: "h-4 w-4 mr-2" }),
|
|
2387
2579
|
config.labels?.newThread || "New Thread"
|
|
2388
2580
|
] }),
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2581
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {})
|
|
2390
2582
|
] }),
|
|
2391
|
-
onExportData && /* @__PURE__ */ (0,
|
|
2392
|
-
/* @__PURE__ */ (0,
|
|
2583
|
+
onExportData && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuItem, { onClick: onExportData, children: [
|
|
2584
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Download, { className: "h-4 w-4 mr-2" }),
|
|
2393
2585
|
config.labels?.exportData || "Export Data"
|
|
2394
2586
|
] }),
|
|
2395
|
-
onImportData && /* @__PURE__ */ (0,
|
|
2396
|
-
/* @__PURE__ */ (0,
|
|
2587
|
+
onImportData && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Upload, { className: "h-4 w-4 mr-2" }),
|
|
2397
2589
|
config.labels?.importData || "Import Data"
|
|
2398
2590
|
] }),
|
|
2399
|
-
(onExportData || onImportData) && /* @__PURE__ */ (0,
|
|
2400
|
-
/* @__PURE__ */ (0,
|
|
2401
|
-
/* @__PURE__ */ (0,
|
|
2591
|
+
(onExportData || onImportData) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {}),
|
|
2592
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2593
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Sun, { className: "h-4 w-4 mr-2" }),
|
|
2402
2594
|
config.labels?.lightMode || "Light Mode"
|
|
2403
|
-
] }) : /* @__PURE__ */ (0,
|
|
2404
|
-
/* @__PURE__ */ (0,
|
|
2595
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Moon, { className: "h-4 w-4 mr-2" }),
|
|
2405
2597
|
config.labels?.darkMode || "Dark Mode"
|
|
2406
2598
|
] }) }),
|
|
2407
|
-
onClearAll && /* @__PURE__ */ (0,
|
|
2408
|
-
/* @__PURE__ */ (0,
|
|
2409
|
-
/* @__PURE__ */ (0,
|
|
2599
|
+
onClearAll && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2600
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {}),
|
|
2601
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2410
2602
|
DropdownMenuItem,
|
|
2411
2603
|
{
|
|
2412
2604
|
onClick: onClearAll,
|
|
2413
2605
|
className: "text-destructive",
|
|
2414
2606
|
children: [
|
|
2415
|
-
/* @__PURE__ */ (0,
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Trash2, { className: "h-4 w-4 mr-2" }),
|
|
2416
2608
|
config.labels?.clearAll || "Clear All"
|
|
2417
2609
|
]
|
|
2418
2610
|
}
|
|
@@ -2431,7 +2623,7 @@ var import_react5 = require("react");
|
|
|
2431
2623
|
|
|
2432
2624
|
// src/components/chat/UserContext.tsx
|
|
2433
2625
|
var import_react4 = require("react");
|
|
2434
|
-
var
|
|
2626
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2435
2627
|
var Ctx = (0, import_react4.createContext)(void 0);
|
|
2436
2628
|
var ChatUserContextProvider = ({ children, initial }) => {
|
|
2437
2629
|
const [ctx, setCtx] = (0, import_react4.useState)(() => ({
|
|
@@ -2457,7 +2649,7 @@ var ChatUserContextProvider = ({ children, initial }) => {
|
|
|
2457
2649
|
setContext: setPartial,
|
|
2458
2650
|
resetContext: () => setCtx({ updatedAt: Date.now() })
|
|
2459
2651
|
}), [ctx, setPartial]);
|
|
2460
|
-
return /* @__PURE__ */ (0,
|
|
2652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Ctx.Provider, { value, children });
|
|
2461
2653
|
};
|
|
2462
2654
|
function useChatUserContext() {
|
|
2463
2655
|
const v = (0, import_react4.useContext)(Ctx);
|
|
@@ -2467,13 +2659,13 @@ function useChatUserContext() {
|
|
|
2467
2659
|
|
|
2468
2660
|
// src/components/ui/progress.tsx
|
|
2469
2661
|
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"), 1);
|
|
2470
|
-
var
|
|
2662
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2471
2663
|
function Progress({
|
|
2472
2664
|
className,
|
|
2473
2665
|
value,
|
|
2474
2666
|
...props
|
|
2475
2667
|
}) {
|
|
2476
|
-
return /* @__PURE__ */ (0,
|
|
2668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2477
2669
|
ProgressPrimitive.Root,
|
|
2478
2670
|
{
|
|
2479
2671
|
"data-slot": "progress",
|
|
@@ -2482,7 +2674,7 @@ function Progress({
|
|
|
2482
2674
|
className
|
|
2483
2675
|
),
|
|
2484
2676
|
...props,
|
|
2485
|
-
children: /* @__PURE__ */ (0,
|
|
2677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2486
2678
|
ProgressPrimitive.Indicator,
|
|
2487
2679
|
{
|
|
2488
2680
|
"data-slot": "progress-indicator",
|
|
@@ -2496,8 +2688,8 @@ function Progress({
|
|
|
2496
2688
|
|
|
2497
2689
|
// src/components/chat/ChatInput.tsx
|
|
2498
2690
|
var import_lucide_react9 = require("lucide-react");
|
|
2499
|
-
var
|
|
2500
|
-
var FileUploadItem = ({ file, progress, onCancel })
|
|
2691
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2692
|
+
var FileUploadItem = (0, import_react5.memo)(function FileUploadItem2({ file, progress, onCancel }) {
|
|
2501
2693
|
const guessTypeFromName = (name) => {
|
|
2502
2694
|
const ext = (name || "").split(".").pop()?.toLowerCase();
|
|
2503
2695
|
switch (ext) {
|
|
@@ -2525,10 +2717,10 @@ var FileUploadItem = ({ file, progress, onCancel }) => {
|
|
|
2525
2717
|
};
|
|
2526
2718
|
const getFileIcon = (type, name) => {
|
|
2527
2719
|
const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
|
|
2528
|
-
if (t.startsWith("image/")) return /* @__PURE__ */ (0,
|
|
2529
|
-
if (t.startsWith("video/")) return /* @__PURE__ */ (0,
|
|
2530
|
-
if (t.startsWith("audio/")) return /* @__PURE__ */ (0,
|
|
2531
|
-
return /* @__PURE__ */ (0,
|
|
2720
|
+
if (t.startsWith("image/")) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { className: "h-4 w-4" });
|
|
2721
|
+
if (t.startsWith("video/")) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Video, { className: "h-4 w-4" });
|
|
2722
|
+
if (t.startsWith("audio/")) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Mic, { className: "h-4 w-4" });
|
|
2723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.FileText, { className: "h-4 w-4" });
|
|
2532
2724
|
};
|
|
2533
2725
|
const formatFileSize = (bytes) => {
|
|
2534
2726
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -2537,26 +2729,26 @@ var FileUploadItem = ({ file, progress, onCancel }) => {
|
|
|
2537
2729
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
2538
2730
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
2539
2731
|
};
|
|
2540
|
-
return /* @__PURE__ */ (0,
|
|
2732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Card, { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardContent, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2541
2733
|
getFileIcon(file.type, file.name),
|
|
2542
|
-
/* @__PURE__ */ (0,
|
|
2543
|
-
/* @__PURE__ */ (0,
|
|
2544
|
-
/* @__PURE__ */ (0,
|
|
2545
|
-
/* @__PURE__ */ (0,
|
|
2734
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
2736
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Progress, { value: progress, className: "h-1 mt-1" })
|
|
2546
2738
|
] }),
|
|
2547
|
-
/* @__PURE__ */ (0,
|
|
2739
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2548
2740
|
Button,
|
|
2549
2741
|
{
|
|
2550
2742
|
variant: "ghost",
|
|
2551
2743
|
size: "icon",
|
|
2552
2744
|
className: "h-6 w-6",
|
|
2553
2745
|
onClick: onCancel,
|
|
2554
|
-
children: /* @__PURE__ */ (0,
|
|
2746
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.X, { className: "h-3 w-3" })
|
|
2555
2747
|
}
|
|
2556
2748
|
)
|
|
2557
2749
|
] }) }) });
|
|
2558
|
-
};
|
|
2559
|
-
var AttachmentPreview = ({ attachment, onRemove })
|
|
2750
|
+
});
|
|
2751
|
+
var AttachmentPreview = (0, import_react5.memo)(function AttachmentPreview2({ attachment, onRemove }) {
|
|
2560
2752
|
const [isPlaying, setIsPlaying] = (0, import_react5.useState)(false);
|
|
2561
2753
|
const audioRef = (0, import_react5.useRef)(null);
|
|
2562
2754
|
const handlePlayPause = () => {
|
|
@@ -2575,9 +2767,9 @@ var AttachmentPreview = ({ attachment, onRemove }) => {
|
|
|
2575
2767
|
const minutes = Math.floor(seconds / 60);
|
|
2576
2768
|
return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
|
|
2577
2769
|
};
|
|
2578
|
-
return /* @__PURE__ */ (0,
|
|
2579
|
-
attachment.kind === "image" && /* @__PURE__ */ (0,
|
|
2580
|
-
/* @__PURE__ */ (0,
|
|
2770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Card, { className: "relative group", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(CardContent, { className: "p-2", children: [
|
|
2771
|
+
attachment.kind === "image" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2581
2773
|
"img",
|
|
2582
2774
|
{
|
|
2583
2775
|
src: attachment.dataUrl,
|
|
@@ -2585,19 +2777,19 @@ var AttachmentPreview = ({ attachment, onRemove }) => {
|
|
|
2585
2777
|
className: "w-full h-20 object-cover rounded"
|
|
2586
2778
|
}
|
|
2587
2779
|
),
|
|
2588
|
-
/* @__PURE__ */ (0,
|
|
2780
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2589
2781
|
Button,
|
|
2590
2782
|
{
|
|
2591
2783
|
variant: "destructive",
|
|
2592
2784
|
size: "icon",
|
|
2593
2785
|
className: "h-6 w-6",
|
|
2594
2786
|
onClick: onRemove,
|
|
2595
|
-
children: /* @__PURE__ */ (0,
|
|
2787
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.X, { className: "h-3 w-3" })
|
|
2596
2788
|
}
|
|
2597
2789
|
) })
|
|
2598
2790
|
] }),
|
|
2599
|
-
attachment.kind === "video" && /* @__PURE__ */ (0,
|
|
2600
|
-
/* @__PURE__ */ (0,
|
|
2791
|
+
attachment.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
|
|
2792
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2601
2793
|
"video",
|
|
2602
2794
|
{
|
|
2603
2795
|
src: attachment.dataUrl,
|
|
@@ -2606,34 +2798,34 @@ var AttachmentPreview = ({ attachment, onRemove }) => {
|
|
|
2606
2798
|
muted: true
|
|
2607
2799
|
}
|
|
2608
2800
|
),
|
|
2609
|
-
/* @__PURE__ */ (0,
|
|
2801
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2610
2802
|
Button,
|
|
2611
2803
|
{
|
|
2612
2804
|
variant: "destructive",
|
|
2613
2805
|
size: "icon",
|
|
2614
2806
|
className: "h-6 w-6",
|
|
2615
2807
|
onClick: onRemove,
|
|
2616
|
-
children: /* @__PURE__ */ (0,
|
|
2808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.X, { className: "h-3 w-3" })
|
|
2617
2809
|
}
|
|
2618
2810
|
) }),
|
|
2619
|
-
/* @__PURE__ */ (0,
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration(attachment.durationMs) })
|
|
2620
2812
|
] }),
|
|
2621
|
-
attachment.kind === "audio" && /* @__PURE__ */ (0,
|
|
2622
|
-
/* @__PURE__ */ (0,
|
|
2813
|
+
attachment.kind === "audio" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 p-2", children: [
|
|
2814
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2623
2815
|
Button,
|
|
2624
2816
|
{
|
|
2625
2817
|
variant: "outline",
|
|
2626
2818
|
size: "icon",
|
|
2627
2819
|
className: "h-8 w-8",
|
|
2628
2820
|
onClick: handlePlayPause,
|
|
2629
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
2821
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Play, { className: "h-3 w-3" })
|
|
2630
2822
|
}
|
|
2631
2823
|
),
|
|
2632
|
-
/* @__PURE__ */ (0,
|
|
2633
|
-
/* @__PURE__ */ (0,
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
2824
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex-1", children: [
|
|
2825
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs font-medium", children: attachment.fileName || "\xC1udio" }),
|
|
2826
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-muted-foreground", children: formatDuration(attachment.durationMs) })
|
|
2635
2827
|
] }),
|
|
2636
|
-
/* @__PURE__ */ (0,
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2637
2829
|
"audio",
|
|
2638
2830
|
{
|
|
2639
2831
|
ref: audioRef,
|
|
@@ -2643,76 +2835,76 @@ var AttachmentPreview = ({ attachment, onRemove }) => {
|
|
|
2643
2835
|
onEnded: () => setIsPlaying(false)
|
|
2644
2836
|
}
|
|
2645
2837
|
),
|
|
2646
|
-
/* @__PURE__ */ (0,
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2647
2839
|
Button,
|
|
2648
2840
|
{
|
|
2649
2841
|
variant: "ghost",
|
|
2650
2842
|
size: "icon",
|
|
2651
2843
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2652
2844
|
onClick: onRemove,
|
|
2653
|
-
children: /* @__PURE__ */ (0,
|
|
2845
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.X, { className: "h-3 w-3" })
|
|
2654
2846
|
}
|
|
2655
2847
|
)
|
|
2656
2848
|
] }),
|
|
2657
|
-
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ (0,
|
|
2849
|
+
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)("p", { className: "truncate", children: attachment.fileName }) })
|
|
2658
2850
|
] }) });
|
|
2659
|
-
};
|
|
2660
|
-
var AudioRecorder = ({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config })
|
|
2851
|
+
});
|
|
2852
|
+
var AudioRecorder = (0, import_react5.memo)(function AudioRecorder2({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) {
|
|
2661
2853
|
const formatTime = (seconds) => {
|
|
2662
2854
|
const mins = Math.floor(seconds / 60);
|
|
2663
2855
|
const secs = seconds % 60;
|
|
2664
2856
|
return `${mins}:${secs.toString().padStart(2, "0")}`;
|
|
2665
2857
|
};
|
|
2666
2858
|
if (!isRecording) {
|
|
2667
|
-
return /* @__PURE__ */ (0,
|
|
2668
|
-
/* @__PURE__ */ (0,
|
|
2859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
2860
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2669
2861
|
Button,
|
|
2670
2862
|
{
|
|
2671
2863
|
variant: "outline",
|
|
2672
2864
|
size: "icon",
|
|
2673
2865
|
onClick: onStartRecording,
|
|
2674
2866
|
className: "h-10 w-10",
|
|
2675
|
-
children: /* @__PURE__ */ (0,
|
|
2867
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Mic, { className: "h-4 w-4" })
|
|
2676
2868
|
}
|
|
2677
2869
|
) }),
|
|
2678
|
-
/* @__PURE__ */ (0,
|
|
2870
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { children: config?.labels?.recordAudioTooltip })
|
|
2679
2871
|
] });
|
|
2680
2872
|
}
|
|
2681
|
-
return /* @__PURE__ */ (0,
|
|
2682
|
-
/* @__PURE__ */ (0,
|
|
2683
|
-
/* @__PURE__ */ (0,
|
|
2684
|
-
/* @__PURE__ */ (0,
|
|
2873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardContent, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2874
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2875
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: "Gravando" })
|
|
2685
2877
|
] }),
|
|
2686
|
-
/* @__PURE__ */ (0,
|
|
2687
|
-
/* @__PURE__ */ (0,
|
|
2688
|
-
/* @__PURE__ */ (0,
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
|
|
2879
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1 ml-auto", children: [
|
|
2880
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2689
2881
|
Button,
|
|
2690
2882
|
{
|
|
2691
2883
|
variant: "outline",
|
|
2692
2884
|
size: "sm",
|
|
2693
2885
|
onClick: onCancel,
|
|
2694
2886
|
children: [
|
|
2695
|
-
/* @__PURE__ */ (0,
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.X, { className: "h-3 w-3 mr-1" }),
|
|
2696
2888
|
"Cancelar"
|
|
2697
2889
|
]
|
|
2698
2890
|
}
|
|
2699
2891
|
),
|
|
2700
|
-
/* @__PURE__ */ (0,
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2701
2893
|
Button,
|
|
2702
2894
|
{
|
|
2703
2895
|
variant: "default",
|
|
2704
2896
|
size: "sm",
|
|
2705
2897
|
onClick: onStopRecording,
|
|
2706
2898
|
children: [
|
|
2707
|
-
/* @__PURE__ */ (0,
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Square, { className: "h-3 w-3 mr-1" }),
|
|
2708
2900
|
"Parar"
|
|
2709
2901
|
]
|
|
2710
2902
|
}
|
|
2711
2903
|
)
|
|
2712
2904
|
] })
|
|
2713
2905
|
] }) }) });
|
|
2714
|
-
};
|
|
2715
|
-
var ChatInput = ({
|
|
2906
|
+
});
|
|
2907
|
+
var ChatInput = (0, import_react5.memo)(function ChatInput2({
|
|
2716
2908
|
value,
|
|
2717
2909
|
onChange,
|
|
2718
2910
|
onSubmit,
|
|
@@ -2730,7 +2922,7 @@ var ChatInput = ({
|
|
|
2730
2922
|
acceptedFileTypes = ["image/*", "video/*", "audio/*"],
|
|
2731
2923
|
className = "",
|
|
2732
2924
|
config
|
|
2733
|
-
})
|
|
2925
|
+
}) {
|
|
2734
2926
|
const [isRecording, setIsRecording] = (0, import_react5.useState)(false);
|
|
2735
2927
|
const { setContext } = useChatUserContext();
|
|
2736
2928
|
const [recordingDuration, setRecordingDuration] = (0, import_react5.useState)(0);
|
|
@@ -2930,8 +3122,8 @@ var ChatInput = ({
|
|
|
2930
3122
|
onAttachmentsChange(newAttachments);
|
|
2931
3123
|
};
|
|
2932
3124
|
const canAddMoreAttachments = attachments.length < maxAttachments;
|
|
2933
|
-
return /* @__PURE__ */ (0,
|
|
2934
|
-
uploadProgress.size > 0 && /* @__PURE__ */ (0,
|
|
3125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
|
|
3126
|
+
uploadProgress.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2935
3127
|
FileUploadItem,
|
|
2936
3128
|
{
|
|
2937
3129
|
file: { name: progress.fileName },
|
|
@@ -2946,7 +3138,7 @@ var ChatInput = ({
|
|
|
2946
3138
|
},
|
|
2947
3139
|
id
|
|
2948
3140
|
)) }),
|
|
2949
|
-
isRecording && /* @__PURE__ */ (0,
|
|
3141
|
+
isRecording && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2950
3142
|
AudioRecorder,
|
|
2951
3143
|
{
|
|
2952
3144
|
isRecording,
|
|
@@ -2957,7 +3149,7 @@ var ChatInput = ({
|
|
|
2957
3149
|
config
|
|
2958
3150
|
}
|
|
2959
3151
|
),
|
|
2960
|
-
attachments.length > 0 && /* @__PURE__ */ (0,
|
|
3152
|
+
attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2961
3153
|
AttachmentPreview,
|
|
2962
3154
|
{
|
|
2963
3155
|
attachment,
|
|
@@ -2965,15 +3157,15 @@ var ChatInput = ({
|
|
|
2965
3157
|
},
|
|
2966
3158
|
index
|
|
2967
3159
|
)) }),
|
|
2968
|
-
/* @__PURE__ */ (0,
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2969
3161
|
"div",
|
|
2970
3162
|
{
|
|
2971
3163
|
className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
|
|
2972
3164
|
onDrop: handleDrop,
|
|
2973
3165
|
onDragOver: handleDragOver,
|
|
2974
3166
|
children: [
|
|
2975
|
-
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ (0,
|
|
2976
|
-
/* @__PURE__ */ (0,
|
|
3167
|
+
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3168
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2977
3169
|
"input",
|
|
2978
3170
|
{
|
|
2979
3171
|
ref: fileInputRef,
|
|
@@ -2984,8 +3176,8 @@ var ChatInput = ({
|
|
|
2984
3176
|
className: "hidden"
|
|
2985
3177
|
}
|
|
2986
3178
|
),
|
|
2987
|
-
/* @__PURE__ */ (0,
|
|
2988
|
-
/* @__PURE__ */ (0,
|
|
3179
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
3180
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2989
3181
|
Button,
|
|
2990
3182
|
{
|
|
2991
3183
|
type: "button",
|
|
@@ -2998,13 +3190,13 @@ var ChatInput = ({
|
|
|
2998
3190
|
fileInputRef.current?.click();
|
|
2999
3191
|
},
|
|
3000
3192
|
disabled,
|
|
3001
|
-
children: /* @__PURE__ */ (0,
|
|
3193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Paperclip, { className: "h-4 w-4" })
|
|
3002
3194
|
}
|
|
3003
3195
|
) }),
|
|
3004
|
-
/* @__PURE__ */ (0,
|
|
3196
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { children: config?.labels?.attachFileTooltip })
|
|
3005
3197
|
] })
|
|
3006
3198
|
] }),
|
|
3007
|
-
/* @__PURE__ */ (0,
|
|
3199
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3008
3200
|
Textarea,
|
|
3009
3201
|
{
|
|
3010
3202
|
ref: textareaRef,
|
|
@@ -3017,7 +3209,7 @@ var ChatInput = ({
|
|
|
3017
3209
|
rows: 1
|
|
3018
3210
|
}
|
|
3019
3211
|
) }),
|
|
3020
|
-
enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ (0,
|
|
3212
|
+
enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3021
3213
|
AudioRecorder,
|
|
3022
3214
|
{
|
|
3023
3215
|
isRecording,
|
|
@@ -3028,8 +3220,8 @@ var ChatInput = ({
|
|
|
3028
3220
|
config
|
|
3029
3221
|
}
|
|
3030
3222
|
),
|
|
3031
|
-
isGenerating ? /* @__PURE__ */ (0,
|
|
3032
|
-
/* @__PURE__ */ (0,
|
|
3223
|
+
isGenerating ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
3224
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3033
3225
|
Button,
|
|
3034
3226
|
{
|
|
3035
3227
|
type: "button",
|
|
@@ -3037,59 +3229,59 @@ var ChatInput = ({
|
|
|
3037
3229
|
size: "icon",
|
|
3038
3230
|
className: "h-10 w-10",
|
|
3039
3231
|
onClick: onStopGeneration,
|
|
3040
|
-
children: /* @__PURE__ */ (0,
|
|
3232
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Square, { className: "h-4 w-4" })
|
|
3041
3233
|
}
|
|
3042
3234
|
) }),
|
|
3043
|
-
/* @__PURE__ */ (0,
|
|
3044
|
-
] }) : /* @__PURE__ */ (0,
|
|
3045
|
-
/* @__PURE__ */ (0,
|
|
3235
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
|
|
3236
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
3237
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3046
3238
|
Button,
|
|
3047
3239
|
{
|
|
3048
3240
|
type: "submit",
|
|
3049
3241
|
size: "icon",
|
|
3050
3242
|
className: "h-10 w-10",
|
|
3051
3243
|
disabled: disabled || !value.trim() && attachments.length === 0,
|
|
3052
|
-
children: disabled ? /* @__PURE__ */ (0,
|
|
3244
|
+
children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Send, { className: "h-4 w-4" })
|
|
3053
3245
|
}
|
|
3054
3246
|
) }),
|
|
3055
|
-
/* @__PURE__ */ (0,
|
|
3247
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
3056
3248
|
] })
|
|
3057
3249
|
]
|
|
3058
3250
|
}
|
|
3059
3251
|
) }),
|
|
3060
|
-
/* @__PURE__ */ (0,
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "text-[10px] text-muted-foreground text-center", children: [
|
|
3061
3253
|
window.innerWidth > 768 ? config?.labels?.inputHelpText : "",
|
|
3062
|
-
attachments.length > 0 && /* @__PURE__ */ (0,
|
|
3254
|
+
attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3063
3255
|
" \u2022 ",
|
|
3064
3256
|
attachments.length,
|
|
3065
3257
|
"/",
|
|
3066
3258
|
maxAttachments,
|
|
3067
3259
|
" anexos"
|
|
3068
3260
|
] }),
|
|
3069
|
-
config?.labels?.footerLabel && /* @__PURE__ */ (0,
|
|
3261
|
+
config?.labels?.footerLabel && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3070
3262
|
" \u2022 ",
|
|
3071
3263
|
config.labels.footerLabel
|
|
3072
3264
|
] })
|
|
3073
3265
|
] })
|
|
3074
3266
|
] }) }) });
|
|
3075
|
-
};
|
|
3267
|
+
});
|
|
3076
3268
|
|
|
3077
3269
|
// src/components/chat/UserProfile.tsx
|
|
3078
3270
|
var import_react6 = require("react");
|
|
3079
3271
|
|
|
3080
3272
|
// src/components/ui/scroll-area.tsx
|
|
3081
|
-
var
|
|
3273
|
+
var React11 = __toESM(require("react"), 1);
|
|
3082
3274
|
var ScrollAreaPrimitive = __toESM(require("@radix-ui/react-scroll-area"), 1);
|
|
3083
|
-
var
|
|
3084
|
-
var ScrollArea =
|
|
3085
|
-
return /* @__PURE__ */ (0,
|
|
3275
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3276
|
+
var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
3277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3086
3278
|
ScrollAreaPrimitive.Root,
|
|
3087
3279
|
{
|
|
3088
3280
|
"data-slot": "scroll-area",
|
|
3089
3281
|
className: cn("relative", className),
|
|
3090
3282
|
...props,
|
|
3091
3283
|
children: [
|
|
3092
|
-
/* @__PURE__ */ (0,
|
|
3284
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3093
3285
|
ScrollAreaPrimitive.Viewport,
|
|
3094
3286
|
{
|
|
3095
3287
|
ref,
|
|
@@ -3103,8 +3295,8 @@ var ScrollArea = React8.forwardRef(({ className, children, viewportClassName, on
|
|
|
3103
3295
|
children
|
|
3104
3296
|
}
|
|
3105
3297
|
),
|
|
3106
|
-
/* @__PURE__ */ (0,
|
|
3107
|
-
/* @__PURE__ */ (0,
|
|
3298
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ScrollBar, {}),
|
|
3299
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ScrollAreaPrimitive.Corner, {})
|
|
3108
3300
|
]
|
|
3109
3301
|
}
|
|
3110
3302
|
);
|
|
@@ -3115,7 +3307,7 @@ function ScrollBar({
|
|
|
3115
3307
|
orientation = "vertical",
|
|
3116
3308
|
...props
|
|
3117
3309
|
}) {
|
|
3118
|
-
return /* @__PURE__ */ (0,
|
|
3310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3119
3311
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
3120
3312
|
{
|
|
3121
3313
|
"data-slot": "scroll-area-scrollbar",
|
|
@@ -3127,7 +3319,7 @@ function ScrollBar({
|
|
|
3127
3319
|
className
|
|
3128
3320
|
),
|
|
3129
3321
|
...props,
|
|
3130
|
-
children: /* @__PURE__ */ (0,
|
|
3322
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3131
3323
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
3132
3324
|
{
|
|
3133
3325
|
"data-slot": "scroll-area-thumb",
|
|
@@ -3140,7 +3332,7 @@ function ScrollBar({
|
|
|
3140
3332
|
|
|
3141
3333
|
// src/components/chat/UserProfile.tsx
|
|
3142
3334
|
var import_lucide_react10 = require("lucide-react");
|
|
3143
|
-
var
|
|
3335
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3144
3336
|
var getInitials2 = (name, email) => {
|
|
3145
3337
|
if (name) {
|
|
3146
3338
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -3154,29 +3346,29 @@ var getFieldIcon = (type, key) => {
|
|
|
3154
3346
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
3155
3347
|
switch (type) {
|
|
3156
3348
|
case "email":
|
|
3157
|
-
return /* @__PURE__ */ (0,
|
|
3349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Mail, { className: iconClass });
|
|
3158
3350
|
case "phone":
|
|
3159
|
-
return /* @__PURE__ */ (0,
|
|
3351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Phone, { className: iconClass });
|
|
3160
3352
|
case "url":
|
|
3161
|
-
return /* @__PURE__ */ (0,
|
|
3353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Globe, { className: iconClass });
|
|
3162
3354
|
case "date":
|
|
3163
|
-
return /* @__PURE__ */ (0,
|
|
3355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Calendar, { className: iconClass });
|
|
3164
3356
|
}
|
|
3165
3357
|
const lowerKey = key?.toLowerCase() || "";
|
|
3166
|
-
if (lowerKey.includes("follower")) return /* @__PURE__ */ (0,
|
|
3167
|
-
if (lowerKey.includes("following")) return /* @__PURE__ */ (0,
|
|
3168
|
-
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ (0,
|
|
3169
|
-
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ (0,
|
|
3170
|
-
if (lowerKey.includes("bio")) return /* @__PURE__ */ (0,
|
|
3171
|
-
if (lowerKey.includes("email")) return /* @__PURE__ */ (0,
|
|
3172
|
-
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ (0,
|
|
3173
|
-
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ (0,
|
|
3174
|
-
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ (0,
|
|
3175
|
-
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ (0,
|
|
3176
|
-
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ (0,
|
|
3177
|
-
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ (0,
|
|
3178
|
-
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ (0,
|
|
3179
|
-
return /* @__PURE__ */ (0,
|
|
3358
|
+
if (lowerKey.includes("follower")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Users, { className: iconClass });
|
|
3359
|
+
if (lowerKey.includes("following")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.UserPlus, { className: iconClass });
|
|
3360
|
+
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Image, { className: iconClass });
|
|
3361
|
+
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.BadgeCheck, { className: iconClass });
|
|
3362
|
+
if (lowerKey.includes("bio")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.FileText, { className: iconClass });
|
|
3363
|
+
if (lowerKey.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Mail, { className: iconClass });
|
|
3364
|
+
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Phone, { className: iconClass });
|
|
3365
|
+
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.MapPin, { className: iconClass });
|
|
3366
|
+
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Building, { className: iconClass });
|
|
3367
|
+
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Briefcase, { className: iconClass });
|
|
3368
|
+
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Globe, { className: iconClass });
|
|
3369
|
+
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.AtSign, { className: iconClass });
|
|
3370
|
+
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Calendar, { className: iconClass });
|
|
3371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.User, { className: iconClass });
|
|
3180
3372
|
};
|
|
3181
3373
|
var formatValue = (value, type, key) => {
|
|
3182
3374
|
if (value === null || value === void 0) return "-";
|
|
@@ -3210,15 +3402,15 @@ var getMemoryCategoryIcon = (category) => {
|
|
|
3210
3402
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
3211
3403
|
switch (category) {
|
|
3212
3404
|
case "preference":
|
|
3213
|
-
return /* @__PURE__ */ (0,
|
|
3405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Heart, { className: iconClass });
|
|
3214
3406
|
case "fact":
|
|
3215
|
-
return /* @__PURE__ */ (0,
|
|
3407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Info, { className: iconClass });
|
|
3216
3408
|
case "goal":
|
|
3217
|
-
return /* @__PURE__ */ (0,
|
|
3409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Target, { className: iconClass });
|
|
3218
3410
|
case "context":
|
|
3219
|
-
return /* @__PURE__ */ (0,
|
|
3411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Lightbulb, { className: iconClass });
|
|
3220
3412
|
default:
|
|
3221
|
-
return /* @__PURE__ */ (0,
|
|
3413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Brain, { className: iconClass });
|
|
3222
3414
|
}
|
|
3223
3415
|
};
|
|
3224
3416
|
var getMemoryCategoryLabel = (category) => {
|
|
@@ -3288,66 +3480,66 @@ var UserProfile = ({
|
|
|
3288
3480
|
const displayName = user?.name || user?.email?.split("@")[0] || "User";
|
|
3289
3481
|
const initials = getInitials2(user?.name, user?.email);
|
|
3290
3482
|
const normalizedFields = normalizeCustomFields(customFields);
|
|
3291
|
-
return /* @__PURE__ */ (0,
|
|
3483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3292
3484
|
SheetContent,
|
|
3293
3485
|
{
|
|
3294
3486
|
side: "right",
|
|
3295
3487
|
className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
|
|
3296
3488
|
children: [
|
|
3297
|
-
/* @__PURE__ */ (0,
|
|
3298
|
-
/* @__PURE__ */ (0,
|
|
3299
|
-
/* @__PURE__ */ (0,
|
|
3300
|
-
/* @__PURE__ */ (0,
|
|
3301
|
-
user?.avatar && /* @__PURE__ */ (0,
|
|
3302
|
-
/* @__PURE__ */ (0,
|
|
3489
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SheetTitle, { children: labels.title }) }) }),
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-6 space-y-6", children: [
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col items-center text-center space-y-4", children: [
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Avatar, { className: "h-24 w-24 shrink-0", children: [
|
|
3493
|
+
user?.avatar && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
3494
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
|
|
3303
3495
|
] }),
|
|
3304
|
-
/* @__PURE__ */ (0,
|
|
3305
|
-
/* @__PURE__ */ (0,
|
|
3306
|
-
user?.email && /* @__PURE__ */ (0,
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full px-2", children: [
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "text-xl font-semibold break-words", children: displayName }),
|
|
3498
|
+
user?.email && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
|
|
3307
3499
|
] })
|
|
3308
3500
|
] }),
|
|
3309
|
-
/* @__PURE__ */ (0,
|
|
3310
|
-
/* @__PURE__ */ (0,
|
|
3311
|
-
/* @__PURE__ */ (0,
|
|
3312
|
-
/* @__PURE__ */ (0,
|
|
3313
|
-
/* @__PURE__ */ (0,
|
|
3314
|
-
/* @__PURE__ */ (0,
|
|
3315
|
-
/* @__PURE__ */ (0,
|
|
3316
|
-
/* @__PURE__ */ (0,
|
|
3317
|
-
/* @__PURE__ */ (0,
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Separator, {}),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-3", children: [
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-2", children: [
|
|
3505
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
3506
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.User, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
3508
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", children: "Name" }),
|
|
3509
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-medium break-words", children: displayName })
|
|
3318
3510
|
] })
|
|
3319
3511
|
] }),
|
|
3320
|
-
user?.email && /* @__PURE__ */ (0,
|
|
3321
|
-
/* @__PURE__ */ (0,
|
|
3322
|
-
/* @__PURE__ */ (0,
|
|
3323
|
-
/* @__PURE__ */ (0,
|
|
3324
|
-
/* @__PURE__ */ (0,
|
|
3512
|
+
user?.email && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.AtSign, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
3514
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
3515
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-medium break-words", children: user.email })
|
|
3325
3517
|
] })
|
|
3326
3518
|
] }),
|
|
3327
|
-
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ (0,
|
|
3328
|
-
/* @__PURE__ */ (0,
|
|
3329
|
-
/* @__PURE__ */ (0,
|
|
3330
|
-
/* @__PURE__ */ (0,
|
|
3331
|
-
/* @__PURE__ */ (0,
|
|
3519
|
+
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.User, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", children: "ID" }),
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-medium break-words", children: user.id })
|
|
3332
3524
|
] })
|
|
3333
3525
|
] })
|
|
3334
3526
|
] })
|
|
3335
3527
|
] }),
|
|
3336
|
-
normalizedFields.length > 0 && /* @__PURE__ */ (0,
|
|
3337
|
-
/* @__PURE__ */ (0,
|
|
3338
|
-
/* @__PURE__ */ (0,
|
|
3339
|
-
/* @__PURE__ */ (0,
|
|
3340
|
-
/* @__PURE__ */ (0,
|
|
3528
|
+
normalizedFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
3529
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Separator, {}),
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-3", children: [
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
|
|
3532
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "space-y-2", children: normalizedFields.map((field) => {
|
|
3341
3533
|
const isBioField = field.key.toLowerCase().includes("bio");
|
|
3342
|
-
return /* @__PURE__ */ (0,
|
|
3534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3343
3535
|
"div",
|
|
3344
3536
|
{
|
|
3345
3537
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
|
|
3346
3538
|
children: [
|
|
3347
|
-
/* @__PURE__ */ (0,
|
|
3348
|
-
/* @__PURE__ */ (0,
|
|
3349
|
-
/* @__PURE__ */ (0,
|
|
3350
|
-
/* @__PURE__ */ (0,
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
|
|
3540
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
3541
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", children: field.label }),
|
|
3542
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: cn(
|
|
3351
3543
|
"text-sm font-medium",
|
|
3352
3544
|
isBioField ? "whitespace-pre-wrap break-words" : "break-words"
|
|
3353
3545
|
), children: formatValue(field.value, field.type, field.key) })
|
|
@@ -3359,26 +3551,26 @@ var UserProfile = ({
|
|
|
3359
3551
|
}) })
|
|
3360
3552
|
] })
|
|
3361
3553
|
] }),
|
|
3362
|
-
/* @__PURE__ */ (0,
|
|
3363
|
-
/* @__PURE__ */ (0,
|
|
3364
|
-
/* @__PURE__ */ (0,
|
|
3365
|
-
/* @__PURE__ */ (0,
|
|
3366
|
-
/* @__PURE__ */ (0,
|
|
3554
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Separator, {}),
|
|
3555
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-3", children: [
|
|
3556
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3557
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
|
|
3558
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Brain, { className: "h-4 w-4" }),
|
|
3367
3559
|
labels.memories
|
|
3368
3560
|
] }),
|
|
3369
|
-
onAddMemory && /* @__PURE__ */ (0,
|
|
3561
|
+
onAddMemory && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3370
3562
|
Button,
|
|
3371
3563
|
{
|
|
3372
3564
|
variant: "ghost",
|
|
3373
3565
|
size: "sm",
|
|
3374
3566
|
className: "h-7 px-2",
|
|
3375
3567
|
onClick: () => setIsAddingMemory(true),
|
|
3376
|
-
children: /* @__PURE__ */ (0,
|
|
3568
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" })
|
|
3377
3569
|
}
|
|
3378
3570
|
)
|
|
3379
3571
|
] }),
|
|
3380
|
-
isAddingMemory && onAddMemory && /* @__PURE__ */ (0,
|
|
3381
|
-
/* @__PURE__ */ (0,
|
|
3572
|
+
isAddingMemory && onAddMemory && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2", children: [
|
|
3573
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3382
3574
|
Input,
|
|
3383
3575
|
{
|
|
3384
3576
|
value: newMemoryContent,
|
|
@@ -3395,24 +3587,24 @@ var UserProfile = ({
|
|
|
3395
3587
|
autoFocus: true
|
|
3396
3588
|
}
|
|
3397
3589
|
),
|
|
3398
|
-
/* @__PURE__ */ (0,
|
|
3590
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
|
|
3399
3591
|
] }),
|
|
3400
|
-
/* @__PURE__ */ (0,
|
|
3592
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
|
|
3401
3593
|
const isEditing = editingMemoryId === memory.id;
|
|
3402
|
-
return /* @__PURE__ */ (0,
|
|
3594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3403
3595
|
"div",
|
|
3404
3596
|
{
|
|
3405
3597
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
|
|
3406
3598
|
children: [
|
|
3407
|
-
/* @__PURE__ */ (0,
|
|
3408
|
-
/* @__PURE__ */ (0,
|
|
3409
|
-
/* @__PURE__ */ (0,
|
|
3410
|
-
/* @__PURE__ */ (0,
|
|
3411
|
-
/* @__PURE__ */ (0,
|
|
3412
|
-
/* @__PURE__ */ (0,
|
|
3599
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Bot, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
|
|
3600
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
3601
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 mb-0.5", children: [
|
|
3602
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
|
|
3603
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
|
|
3604
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
|
|
3413
3605
|
] }),
|
|
3414
|
-
isEditing ? /* @__PURE__ */ (0,
|
|
3415
|
-
/* @__PURE__ */ (0,
|
|
3606
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-2", children: [
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3416
3608
|
Textarea,
|
|
3417
3609
|
{
|
|
3418
3610
|
value: editingMemoryContent,
|
|
@@ -3429,8 +3621,8 @@ var UserProfile = ({
|
|
|
3429
3621
|
}
|
|
3430
3622
|
}
|
|
3431
3623
|
),
|
|
3432
|
-
/* @__PURE__ */ (0,
|
|
3433
|
-
/* @__PURE__ */ (0,
|
|
3624
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1 justify-end", children: [
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3434
3626
|
Button,
|
|
3435
3627
|
{
|
|
3436
3628
|
variant: "ghost",
|
|
@@ -3438,12 +3630,12 @@ var UserProfile = ({
|
|
|
3438
3630
|
className: "h-7 px-2",
|
|
3439
3631
|
onClick: handleCancelEdit,
|
|
3440
3632
|
children: [
|
|
3441
|
-
/* @__PURE__ */ (0,
|
|
3633
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.X, { className: "h-3.5 w-3.5 mr-1" }),
|
|
3442
3634
|
"Cancelar"
|
|
3443
3635
|
]
|
|
3444
3636
|
}
|
|
3445
3637
|
),
|
|
3446
|
-
/* @__PURE__ */ (0,
|
|
3638
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3447
3639
|
Button,
|
|
3448
3640
|
{
|
|
3449
3641
|
size: "sm",
|
|
@@ -3451,33 +3643,33 @@ var UserProfile = ({
|
|
|
3451
3643
|
onClick: handleSaveEdit,
|
|
3452
3644
|
disabled: !editingMemoryContent.trim(),
|
|
3453
3645
|
children: [
|
|
3454
|
-
/* @__PURE__ */ (0,
|
|
3646
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Check, { className: "h-3.5 w-3.5 mr-1" }),
|
|
3455
3647
|
"Salvar"
|
|
3456
3648
|
]
|
|
3457
3649
|
}
|
|
3458
3650
|
)
|
|
3459
3651
|
] })
|
|
3460
|
-
] }) : /* @__PURE__ */ (0,
|
|
3652
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm break-words", children: memory.content })
|
|
3461
3653
|
] }),
|
|
3462
|
-
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ (0,
|
|
3463
|
-
onUpdateMemory && /* @__PURE__ */ (0,
|
|
3654
|
+
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
|
|
3655
|
+
onUpdateMemory && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3464
3656
|
Button,
|
|
3465
3657
|
{
|
|
3466
3658
|
variant: "ghost",
|
|
3467
3659
|
size: "icon",
|
|
3468
3660
|
className: "h-7 w-7",
|
|
3469
3661
|
onClick: () => handleStartEdit(memory),
|
|
3470
|
-
children: /* @__PURE__ */ (0,
|
|
3662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
3471
3663
|
}
|
|
3472
3664
|
),
|
|
3473
|
-
onDeleteMemory && /* @__PURE__ */ (0,
|
|
3665
|
+
onDeleteMemory && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3474
3666
|
Button,
|
|
3475
3667
|
{
|
|
3476
3668
|
variant: "ghost",
|
|
3477
3669
|
size: "icon",
|
|
3478
3670
|
className: "h-7 w-7",
|
|
3479
3671
|
onClick: () => onDeleteMemory(memory.id),
|
|
3480
|
-
children: /* @__PURE__ */ (0,
|
|
3672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Trash2, { className: "h-3.5 w-3.5 text-destructive" })
|
|
3481
3673
|
}
|
|
3482
3674
|
)
|
|
3483
3675
|
] })
|
|
@@ -3488,8 +3680,8 @@ var UserProfile = ({
|
|
|
3488
3680
|
}) })
|
|
3489
3681
|
] })
|
|
3490
3682
|
] }) }),
|
|
3491
|
-
/* @__PURE__ */ (0,
|
|
3492
|
-
onEditProfile && /* @__PURE__ */ (0,
|
|
3683
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
|
|
3684
|
+
onEditProfile && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3493
3685
|
Button,
|
|
3494
3686
|
{
|
|
3495
3687
|
variant: "outline",
|
|
@@ -3498,7 +3690,7 @@ var UserProfile = ({
|
|
|
3498
3690
|
children: "Edit Profile"
|
|
3499
3691
|
}
|
|
3500
3692
|
),
|
|
3501
|
-
onLogout && /* @__PURE__ */ (0,
|
|
3693
|
+
onLogout && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3502
3694
|
Button,
|
|
3503
3695
|
{
|
|
3504
3696
|
variant: "destructive",
|
|
@@ -3515,7 +3707,7 @@ var UserProfile = ({
|
|
|
3515
3707
|
|
|
3516
3708
|
// src/components/chat/ChatUI.tsx
|
|
3517
3709
|
var import_lucide_react11 = require("lucide-react");
|
|
3518
|
-
var
|
|
3710
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3519
3711
|
var ChatUI = ({
|
|
3520
3712
|
messages = [],
|
|
3521
3713
|
threads = [],
|
|
@@ -3523,14 +3715,21 @@ var ChatUI = ({
|
|
|
3523
3715
|
config: userConfig,
|
|
3524
3716
|
sidebar: _sidebar,
|
|
3525
3717
|
isGenerating = false,
|
|
3718
|
+
isMessagesLoading = false,
|
|
3526
3719
|
callbacks = {},
|
|
3527
3720
|
user,
|
|
3528
3721
|
assistant,
|
|
3529
3722
|
suggestions = [],
|
|
3723
|
+
messageSuggestions = {},
|
|
3724
|
+
agentOptions = [],
|
|
3725
|
+
selectedAgentId = null,
|
|
3726
|
+
onSelectAgent,
|
|
3530
3727
|
className = "",
|
|
3531
3728
|
onAddMemory,
|
|
3532
3729
|
onUpdateMemory,
|
|
3533
|
-
onDeleteMemory
|
|
3730
|
+
onDeleteMemory,
|
|
3731
|
+
initialInput,
|
|
3732
|
+
onInitialInputConsumed
|
|
3534
3733
|
}) => {
|
|
3535
3734
|
const config = mergeConfig(defaultChatConfig, userConfig);
|
|
3536
3735
|
const [isMobile, setIsMobile] = (0, import_react7.useState)(false);
|
|
@@ -3548,9 +3747,9 @@ var ChatUI = ({
|
|
|
3548
3747
|
}
|
|
3549
3748
|
return false;
|
|
3550
3749
|
};
|
|
3750
|
+
const [inputValue, setInputValue] = (0, import_react7.useState)("");
|
|
3751
|
+
const [attachments, setAttachments] = (0, import_react7.useState)([]);
|
|
3551
3752
|
const [state, setState] = (0, import_react7.useState)({
|
|
3552
|
-
input: "",
|
|
3553
|
-
attachments: [],
|
|
3554
3753
|
isRecording: false,
|
|
3555
3754
|
selectedThreadId: currentThreadId,
|
|
3556
3755
|
isAtBottom: true,
|
|
@@ -3567,16 +3766,41 @@ var ChatUI = ({
|
|
|
3567
3766
|
setState((prev) => ({ ...prev, selectedThreadId: currentThreadId }));
|
|
3568
3767
|
}
|
|
3569
3768
|
}, [currentThreadId]);
|
|
3769
|
+
const initialInputApplied = (0, import_react7.useRef)(false);
|
|
3770
|
+
const initialInputConsumedRef = (0, import_react7.useRef)(false);
|
|
3771
|
+
(0, import_react7.useEffect)(() => {
|
|
3772
|
+
if (initialInput && !initialInputApplied.current) {
|
|
3773
|
+
setInputValue(initialInput);
|
|
3774
|
+
initialInputApplied.current = true;
|
|
3775
|
+
}
|
|
3776
|
+
}, [initialInput]);
|
|
3570
3777
|
const messagesEndRef = (0, import_react7.useRef)(null);
|
|
3571
3778
|
const scrollAreaRef = (0, import_react7.useRef)(null);
|
|
3779
|
+
const stateRef = (0, import_react7.useRef)(state);
|
|
3780
|
+
const inputValueRef = (0, import_react7.useRef)(inputValue);
|
|
3781
|
+
const attachmentsRef = (0, import_react7.useRef)(attachments);
|
|
3782
|
+
(0, import_react7.useEffect)(() => {
|
|
3783
|
+
stateRef.current = state;
|
|
3784
|
+
}, [state]);
|
|
3785
|
+
(0, import_react7.useEffect)(() => {
|
|
3786
|
+
inputValueRef.current = inputValue;
|
|
3787
|
+
}, [inputValue]);
|
|
3788
|
+
(0, import_react7.useEffect)(() => {
|
|
3789
|
+
attachmentsRef.current = attachments;
|
|
3790
|
+
}, [attachments]);
|
|
3572
3791
|
const [isCustomMounted, setIsCustomMounted] = (0, import_react7.useState)(false);
|
|
3573
3792
|
const [isCustomVisible, setIsCustomVisible] = (0, import_react7.useState)(false);
|
|
3574
3793
|
const createStateCallback = (0, import_react7.useCallback)(
|
|
3575
3794
|
(setter) => ({
|
|
3576
3795
|
setState: (newState) => setter?.(newState),
|
|
3577
|
-
getState: () =>
|
|
3796
|
+
getState: () => ({
|
|
3797
|
+
...stateRef.current,
|
|
3798
|
+
input: inputValueRef.current,
|
|
3799
|
+
attachments: attachmentsRef.current
|
|
3800
|
+
})
|
|
3578
3801
|
}),
|
|
3579
|
-
[
|
|
3802
|
+
[]
|
|
3803
|
+
// No dependencies - uses refs for latest state
|
|
3580
3804
|
);
|
|
3581
3805
|
(0, import_react7.useEffect)(() => {
|
|
3582
3806
|
const checkMobile = () => {
|
|
@@ -3613,15 +3837,16 @@ var ChatUI = ({
|
|
|
3613
3837
|
const isAtBottom = scrollHeight - scrollTop - clientHeight < 50;
|
|
3614
3838
|
setState((prev) => ({ ...prev, isAtBottom }));
|
|
3615
3839
|
}, []);
|
|
3616
|
-
const handleSendMessage = (0, import_react7.useCallback)((content,
|
|
3617
|
-
if (!content.trim() &&
|
|
3618
|
-
callbacks.onSendMessage?.(content,
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3840
|
+
const handleSendMessage = (0, import_react7.useCallback)((content, messageAttachments = []) => {
|
|
3841
|
+
if (!content.trim() && messageAttachments.length === 0) return;
|
|
3842
|
+
callbacks.onSendMessage?.(content, messageAttachments, createStateCallback());
|
|
3843
|
+
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
3844
|
+
initialInputConsumedRef.current = true;
|
|
3845
|
+
onInitialInputConsumed?.();
|
|
3846
|
+
}
|
|
3847
|
+
setInputValue("");
|
|
3848
|
+
setAttachments([]);
|
|
3849
|
+
}, [callbacks, createStateCallback, onInitialInputConsumed]);
|
|
3625
3850
|
const handleMessageAction = (0, import_react7.useCallback)((event) => {
|
|
3626
3851
|
const { action, messageId, content } = event;
|
|
3627
3852
|
switch (action) {
|
|
@@ -3642,7 +3867,7 @@ var ChatUI = ({
|
|
|
3642
3867
|
}
|
|
3643
3868
|
}, [callbacks, createStateCallback]);
|
|
3644
3869
|
const handleCreateThread = (0, import_react7.useCallback)((title) => {
|
|
3645
|
-
callbacks.onCreateThread?.(title, createStateCallback(
|
|
3870
|
+
callbacks.onCreateThread?.(title, createStateCallback());
|
|
3646
3871
|
}, [callbacks, createStateCallback]);
|
|
3647
3872
|
const handleSelectThread = (0, import_react7.useCallback)((threadId) => {
|
|
3648
3873
|
callbacks.onSelectThread?.(threadId, createStateCallback());
|
|
@@ -3667,25 +3892,75 @@ var ChatUI = ({
|
|
|
3667
3892
|
}
|
|
3668
3893
|
return component;
|
|
3669
3894
|
}, [config?.customComponent?.component, closeSidebar, isMobile]);
|
|
3895
|
+
const SuggestionIconComponents = [import_lucide_react11.MessageSquare, import_lucide_react11.Lightbulb, import_lucide_react11.Zap, import_lucide_react11.HelpCircle];
|
|
3670
3896
|
const renderSuggestions = () => {
|
|
3671
3897
|
if (messages.length > 0 || !suggestions.length) return null;
|
|
3672
|
-
return /* @__PURE__ */ (0,
|
|
3673
|
-
/* @__PURE__ */ (0,
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
|
|
3899
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "text-center mb-8", children: [
|
|
3900
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)(import_lucide_react11.Sparkles, { className: "w-7 h-7 text-primary" }) }),
|
|
3901
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
|
|
3902
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
|
|
3903
|
+
] }),
|
|
3904
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3905
|
+
"button",
|
|
3678
3906
|
{
|
|
3679
|
-
|
|
3907
|
+
type: "button",
|
|
3680
3908
|
onClick: () => handleSendMessage(suggestion),
|
|
3681
|
-
|
|
3909
|
+
className: "group relative flex items-start gap-3 p-4 text-left rounded-xl border bg-card hover:bg-accent/50 hover:border-accent transition-all duration-200 hover:shadow-sm",
|
|
3910
|
+
children: [
|
|
3911
|
+
(() => {
|
|
3912
|
+
const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
|
|
3913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("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__ */ (0, import_jsx_runtime24.jsx)(IconComponent, { className: "h-4 w-4" }) });
|
|
3914
|
+
})(),
|
|
3915
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
|
|
3916
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.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" })
|
|
3917
|
+
]
|
|
3682
3918
|
},
|
|
3683
3919
|
index
|
|
3684
3920
|
)) })
|
|
3685
3921
|
] });
|
|
3686
3922
|
};
|
|
3687
|
-
|
|
3688
|
-
|
|
3923
|
+
const renderInlineSuggestions = (messageId) => {
|
|
3924
|
+
const items = messageSuggestions?.[messageId];
|
|
3925
|
+
if (!items || items.length === 0) return null;
|
|
3926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-wrap gap-2 mt-2 ml-11", children: items.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3927
|
+
"button",
|
|
3928
|
+
{
|
|
3929
|
+
type: "button",
|
|
3930
|
+
onClick: () => handleSendMessage(suggestion),
|
|
3931
|
+
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",
|
|
3932
|
+
children: [
|
|
3933
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
3934
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
3935
|
+
]
|
|
3936
|
+
},
|
|
3937
|
+
`${messageId}-suggestion-${index}`
|
|
3938
|
+
)) });
|
|
3939
|
+
};
|
|
3940
|
+
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
3941
|
+
const isUserRow = index % 2 === 1;
|
|
3942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3943
|
+
"div",
|
|
3944
|
+
{
|
|
3945
|
+
className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
|
|
3946
|
+
children: [
|
|
3947
|
+
!isUserRow && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
|
|
3948
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
|
|
3949
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Skeleton, { className: "h-4 w-24" }),
|
|
3950
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Skeleton, { className: "h-4 w-full" }),
|
|
3951
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Skeleton, { className: "h-4 w-[85%]" })
|
|
3952
|
+
] }),
|
|
3953
|
+
isUserRow && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
|
|
3954
|
+
]
|
|
3955
|
+
},
|
|
3956
|
+
`message-skeleton-${index}`
|
|
3957
|
+
);
|
|
3958
|
+
}) });
|
|
3959
|
+
const shouldShowAgentSelector = Boolean(
|
|
3960
|
+
config.agentSelector?.enabled && onSelectAgent && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1)
|
|
3961
|
+
);
|
|
3962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
|
|
3963
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3689
3964
|
Sidebar2,
|
|
3690
3965
|
{
|
|
3691
3966
|
threads,
|
|
@@ -3715,8 +3990,8 @@ var ChatUI = ({
|
|
|
3715
3990
|
showThemeOptions: !!callbacks.onThemeChange
|
|
3716
3991
|
}
|
|
3717
3992
|
),
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
3993
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SidebarInset, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
3994
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3720
3995
|
ChatHeader,
|
|
3721
3996
|
{
|
|
3722
3997
|
config,
|
|
@@ -3724,53 +3999,72 @@ var ChatUI = ({
|
|
|
3724
3999
|
isMobile,
|
|
3725
4000
|
onCustomComponentToggle: () => setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar })),
|
|
3726
4001
|
onNewThread: handleCreateThread,
|
|
3727
|
-
showCustomComponentButton: !!config?.customComponent?.component
|
|
4002
|
+
showCustomComponentButton: !!config?.customComponent?.component,
|
|
4003
|
+
showAgentSelector: shouldShowAgentSelector,
|
|
4004
|
+
agentOptions,
|
|
4005
|
+
selectedAgentId,
|
|
4006
|
+
onSelectAgent
|
|
3728
4007
|
}
|
|
3729
4008
|
),
|
|
3730
|
-
/* @__PURE__ */ (0,
|
|
3731
|
-
/* @__PURE__ */ (0,
|
|
3732
|
-
/* @__PURE__ */ (0,
|
|
4009
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
4010
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3733
4012
|
ScrollArea,
|
|
3734
4013
|
{
|
|
3735
4014
|
ref: scrollAreaRef,
|
|
3736
4015
|
className: "flex-1 min-h-0",
|
|
3737
4016
|
viewportClassName: "p-4 overscroll-contain",
|
|
3738
4017
|
onScrollCapture: handleScroll,
|
|
3739
|
-
children: /* @__PURE__ */ (0,
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
message
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
4018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "max-w-4xl mx-auto space-y-4 pb-4", children: [
|
|
4019
|
+
isMessagesLoading ? renderMessageLoadingSkeleton() : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4020
|
+
renderSuggestions(),
|
|
4021
|
+
messages.map((message, index) => {
|
|
4022
|
+
const prevMessage = index > 0 ? messages[index - 1] : null;
|
|
4023
|
+
const isGrouped = prevMessage !== null && prevMessage.role === message.role;
|
|
4024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: isGrouped ? "space-y-1 -mt-2" : "space-y-2", children: [
|
|
4025
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4026
|
+
Message,
|
|
4027
|
+
{
|
|
4028
|
+
message,
|
|
4029
|
+
userAvatar: user?.avatar,
|
|
4030
|
+
userName: user?.name,
|
|
4031
|
+
assistantAvatar: assistant?.avatar,
|
|
4032
|
+
assistantName: assistant?.name,
|
|
4033
|
+
showTimestamp: config.ui.showTimestamps,
|
|
4034
|
+
showAvatar: config.ui.showAvatars,
|
|
4035
|
+
enableCopy: config.features.enableMessageCopy,
|
|
4036
|
+
enableEdit: config.features.enableMessageEditing,
|
|
4037
|
+
enableRegenerate: config.features.enableRegeneration,
|
|
4038
|
+
enableToolCallsDisplay: config.features.enableToolCallsDisplay,
|
|
4039
|
+
compactMode: config.ui.compactMode,
|
|
4040
|
+
onAction: handleMessageAction,
|
|
4041
|
+
toolUsedLabel: config.labels.toolUsed,
|
|
4042
|
+
thinkingLabel: config.labels.thinking,
|
|
4043
|
+
isGrouped
|
|
4044
|
+
}
|
|
4045
|
+
),
|
|
4046
|
+
message.role === "assistant" && renderInlineSuggestions(message.id)
|
|
4047
|
+
] }, message.id);
|
|
4048
|
+
})
|
|
4049
|
+
] }),
|
|
4050
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: messagesEndRef })
|
|
3763
4051
|
] })
|
|
3764
4052
|
}
|
|
3765
4053
|
),
|
|
3766
|
-
/* @__PURE__ */ (0,
|
|
4054
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3767
4055
|
ChatInput,
|
|
3768
4056
|
{
|
|
3769
|
-
value:
|
|
3770
|
-
onChange: (value) =>
|
|
4057
|
+
value: inputValue,
|
|
4058
|
+
onChange: (value) => {
|
|
4059
|
+
setInputValue(value);
|
|
4060
|
+
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
4061
|
+
initialInputConsumedRef.current = true;
|
|
4062
|
+
onInitialInputConsumed?.();
|
|
4063
|
+
}
|
|
4064
|
+
},
|
|
3771
4065
|
onSubmit: handleSendMessage,
|
|
3772
|
-
attachments
|
|
3773
|
-
onAttachmentsChange:
|
|
4066
|
+
attachments,
|
|
4067
|
+
onAttachmentsChange: setAttachments,
|
|
3774
4068
|
placeholder: config.labels.inputPlaceholder,
|
|
3775
4069
|
disabled: false,
|
|
3776
4070
|
isGenerating,
|
|
@@ -3783,17 +4077,17 @@ var ChatUI = ({
|
|
|
3783
4077
|
}
|
|
3784
4078
|
) })
|
|
3785
4079
|
] }),
|
|
3786
|
-
config?.customComponent?.component && !isMobile && /* @__PURE__ */ (0,
|
|
4080
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3787
4081
|
"div",
|
|
3788
4082
|
{
|
|
3789
4083
|
className: `h-full transition-all duration-300 ease-in-out overflow-hidden ${state.showSidebar ? "w-80" : "w-0"}`,
|
|
3790
|
-
children: state.showSidebar && /* @__PURE__ */ (0,
|
|
4084
|
+
children: state.showSidebar && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col h-full border-l bg-background animate-in slide-in-from-right-4 duration-300 w-80", children: renderCustomComponent() })
|
|
3791
4085
|
}
|
|
3792
4086
|
)
|
|
3793
4087
|
] })
|
|
3794
4088
|
] }) }),
|
|
3795
|
-
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ (0,
|
|
3796
|
-
/* @__PURE__ */ (0,
|
|
4089
|
+
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fixed inset-0 z-50", children: [
|
|
4090
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3797
4091
|
"div",
|
|
3798
4092
|
{
|
|
3799
4093
|
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
@@ -3801,16 +4095,16 @@ var ChatUI = ({
|
|
|
3801
4095
|
onClick: closeSidebar
|
|
3802
4096
|
}
|
|
3803
4097
|
),
|
|
3804
|
-
/* @__PURE__ */ (0,
|
|
4098
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3805
4099
|
"div",
|
|
3806
4100
|
{
|
|
3807
4101
|
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"}`,
|
|
3808
4102
|
style: { willChange: "transform" },
|
|
3809
|
-
children: /* @__PURE__ */ (0,
|
|
4103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-full flex flex-col", children: renderCustomComponent() })
|
|
3810
4104
|
}
|
|
3811
4105
|
)
|
|
3812
4106
|
] }),
|
|
3813
|
-
/* @__PURE__ */ (0,
|
|
4107
|
+
isUserProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3814
4108
|
UserProfile,
|
|
3815
4109
|
{
|
|
3816
4110
|
isOpen: isUserProfileOpen,
|
|
@@ -3835,7 +4129,7 @@ var ChatUI = ({
|
|
|
3835
4129
|
// src/components/chat/ThreadManager.tsx
|
|
3836
4130
|
var import_react8 = require("react");
|
|
3837
4131
|
var import_lucide_react12 = require("lucide-react");
|
|
3838
|
-
var
|
|
4132
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3839
4133
|
var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onArchive }) => {
|
|
3840
4134
|
const [isEditing, setIsEditing] = (0, import_react8.useState)(false);
|
|
3841
4135
|
const [editTitle, setEditTitle] = (0, import_react8.useState)(thread.title);
|
|
@@ -3864,9 +4158,9 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
|
|
|
3864
4158
|
handleCancelEdit();
|
|
3865
4159
|
}
|
|
3866
4160
|
};
|
|
3867
|
-
return /* @__PURE__ */ (0,
|
|
3868
|
-
/* @__PURE__ */ (0,
|
|
3869
|
-
/* @__PURE__ */ (0,
|
|
4161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(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__ */ (0, import_jsx_runtime25.jsx)(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
|
|
4162
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4163
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3870
4164
|
Input,
|
|
3871
4165
|
{
|
|
3872
4166
|
ref: inputRef,
|
|
@@ -3878,44 +4172,44 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
|
|
|
3878
4172
|
placeholder: config?.labels?.threadNamePlaceholder || "Conversation name"
|
|
3879
4173
|
}
|
|
3880
4174
|
),
|
|
3881
|
-
/* @__PURE__ */ (0,
|
|
3882
|
-
/* @__PURE__ */ (0,
|
|
3883
|
-
] }) : /* @__PURE__ */ (0,
|
|
3884
|
-
/* @__PURE__ */ (0,
|
|
3885
|
-
/* @__PURE__ */ (0,
|
|
3886
|
-
/* @__PURE__ */ (0,
|
|
3887
|
-
/* @__PURE__ */ (0,
|
|
4175
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Check, { className: "h-3 w-3" }) }),
|
|
4176
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.X, { className: "h-3 w-3" }) })
|
|
4177
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4178
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
|
|
4179
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
4180
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4181
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Hash, { className: "h-3 w-3" }),
|
|
3888
4182
|
thread.messageCount,
|
|
3889
4183
|
" msgs"
|
|
3890
4184
|
] }),
|
|
3891
|
-
/* @__PURE__ */ (0,
|
|
3892
|
-
/* @__PURE__ */ (0,
|
|
3893
|
-
/* @__PURE__ */ (0,
|
|
4185
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Separator, { orientation: "vertical", className: "h-3" }),
|
|
4186
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4187
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Calendar, { className: "h-3 w-3" }),
|
|
3894
4188
|
formatDate(thread.updatedAt, config?.labels)
|
|
3895
4189
|
] }),
|
|
3896
|
-
thread.isArchived && /* @__PURE__ */ (0,
|
|
3897
|
-
/* @__PURE__ */ (0,
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3899
|
-
/* @__PURE__ */ (0,
|
|
4190
|
+
thread.isArchived && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4191
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Separator, { orientation: "vertical", className: "h-3" }),
|
|
4192
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Archive, { className: "h-2 w-2 mr-1" }),
|
|
3900
4194
|
config?.labels?.archiveThread || "Archived"
|
|
3901
4195
|
] })
|
|
3902
4196
|
] })
|
|
3903
4197
|
] })
|
|
3904
4198
|
] }) }),
|
|
3905
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
3906
|
-
/* @__PURE__ */ (0,
|
|
3907
|
-
/* @__PURE__ */ (0,
|
|
3908
|
-
/* @__PURE__ */ (0,
|
|
3909
|
-
/* @__PURE__ */ (0,
|
|
4199
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenu, { children: [
|
|
4200
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.MoreVertical, { className: "h-3 w-3" }) }) }),
|
|
4201
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
4202
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
|
|
4203
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Edit2, { className: "h-4 w-4 mr-2" }),
|
|
3910
4204
|
config?.labels?.renameThread || "Rename"
|
|
3911
4205
|
] }),
|
|
3912
|
-
/* @__PURE__ */ (0,
|
|
3913
|
-
/* @__PURE__ */ (0,
|
|
4206
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenuItem, { onClick: onArchive, children: [
|
|
4207
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Archive, { className: "h-4 w-4 mr-2" }),
|
|
3914
4208
|
thread.isArchived ? config?.labels?.unarchiveThread || "Unarchive" : config?.labels?.archiveThread || "Archive"
|
|
3915
4209
|
] }),
|
|
3916
|
-
/* @__PURE__ */ (0,
|
|
3917
|
-
/* @__PURE__ */ (0,
|
|
3918
|
-
/* @__PURE__ */ (0,
|
|
4210
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuSeparator, {}),
|
|
4211
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
|
|
4212
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Trash2, { className: "h-4 w-4 mr-2" }),
|
|
3919
4213
|
config?.labels?.deleteThread || "Delete"
|
|
3920
4214
|
] })
|
|
3921
4215
|
] })
|
|
@@ -3930,17 +4224,17 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
|
|
|
3930
4224
|
setTitle("");
|
|
3931
4225
|
setIsOpen(false);
|
|
3932
4226
|
};
|
|
3933
|
-
return /* @__PURE__ */ (0,
|
|
3934
|
-
/* @__PURE__ */ (0,
|
|
3935
|
-
/* @__PURE__ */ (0,
|
|
4227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
4228
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Button, { variant: "outline", className: "w-full", children: [
|
|
4229
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Plus, { className: "h-4 w-4 mr-2" }),
|
|
3936
4230
|
config?.labels?.createNewThread || "New Conversation"
|
|
3937
4231
|
] }) }),
|
|
3938
|
-
/* @__PURE__ */ (0,
|
|
3939
|
-
/* @__PURE__ */ (0,
|
|
3940
|
-
/* @__PURE__ */ (0,
|
|
3941
|
-
/* @__PURE__ */ (0,
|
|
4232
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogContent, { children: [
|
|
4233
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogHeader, { children: [
|
|
4234
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
|
|
4235
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
3942
4236
|
] }),
|
|
3943
|
-
/* @__PURE__ */ (0,
|
|
4237
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3944
4238
|
Input,
|
|
3945
4239
|
{
|
|
3946
4240
|
value: title,
|
|
@@ -3950,9 +4244,9 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
|
|
|
3950
4244
|
autoFocus: true
|
|
3951
4245
|
}
|
|
3952
4246
|
),
|
|
3953
|
-
/* @__PURE__ */ (0,
|
|
3954
|
-
/* @__PURE__ */ (0,
|
|
3955
|
-
/* @__PURE__ */ (0,
|
|
4247
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogFooter, { children: [
|
|
4248
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
|
|
4249
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
|
|
3956
4250
|
] })
|
|
3957
4251
|
] })
|
|
3958
4252
|
] });
|
|
@@ -4006,20 +4300,20 @@ var ThreadManager = ({
|
|
|
4006
4300
|
setDeleteThreadId(null);
|
|
4007
4301
|
};
|
|
4008
4302
|
if (!isOpen) return null;
|
|
4009
|
-
return /* @__PURE__ */ (0,
|
|
4010
|
-
/* @__PURE__ */ (0,
|
|
4011
|
-
/* @__PURE__ */ (0,
|
|
4012
|
-
/* @__PURE__ */ (0,
|
|
4013
|
-
/* @__PURE__ */ (0,
|
|
4014
|
-
/* @__PURE__ */ (0,
|
|
4303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Card, { className: "h-full border-0 rounded-none", children: [
|
|
4305
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(CardHeader, { className: "border-b", children: [
|
|
4306
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4307
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(CardTitle, { className: "flex items-center gap-2", children: [
|
|
4308
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.MessageSquare, { className: "h-5 w-5" }),
|
|
4015
4309
|
config?.labels?.newChat || "Conversations"
|
|
4016
4310
|
] }),
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4311
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.X, { className: "h-4 w-4" }) })
|
|
4018
4312
|
] }),
|
|
4019
|
-
/* @__PURE__ */ (0,
|
|
4020
|
-
/* @__PURE__ */ (0,
|
|
4021
|
-
/* @__PURE__ */ (0,
|
|
4022
|
-
/* @__PURE__ */ (0,
|
|
4313
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-3", children: [
|
|
4314
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "relative", children: [
|
|
4315
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
4316
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4023
4317
|
Input,
|
|
4024
4318
|
{
|
|
4025
4319
|
placeholder: config?.labels?.search || "Search conversations...",
|
|
@@ -4029,8 +4323,8 @@ var ThreadManager = ({
|
|
|
4029
4323
|
}
|
|
4030
4324
|
)
|
|
4031
4325
|
] }),
|
|
4032
|
-
/* @__PURE__ */ (0,
|
|
4033
|
-
/* @__PURE__ */ (0,
|
|
4326
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4327
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4034
4328
|
Button,
|
|
4035
4329
|
{
|
|
4036
4330
|
variant: "outline",
|
|
@@ -4038,12 +4332,12 @@ var ThreadManager = ({
|
|
|
4038
4332
|
onClick: () => setShowArchived(!showArchived),
|
|
4039
4333
|
className: "text-xs",
|
|
4040
4334
|
children: [
|
|
4041
|
-
/* @__PURE__ */ (0,
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Filter, { className: "h-3 w-3 mr-1" }),
|
|
4042
4336
|
showArchived ? config?.labels?.hideArchived || "Hide Archived" : config?.labels?.showArchived || "Show Archived"
|
|
4043
4337
|
]
|
|
4044
4338
|
}
|
|
4045
4339
|
),
|
|
4046
|
-
/* @__PURE__ */ (0,
|
|
4340
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
4047
4341
|
filteredThreads.length,
|
|
4048
4342
|
" / ",
|
|
4049
4343
|
threads.length
|
|
@@ -4051,14 +4345,14 @@ var ThreadManager = ({
|
|
|
4051
4345
|
] })
|
|
4052
4346
|
] })
|
|
4053
4347
|
] }),
|
|
4054
|
-
/* @__PURE__ */ (0,
|
|
4055
|
-
/* @__PURE__ */ (0,
|
|
4056
|
-
/* @__PURE__ */ (0,
|
|
4057
|
-
/* @__PURE__ */ (0,
|
|
4058
|
-
/* @__PURE__ */ (0,
|
|
4059
|
-
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0,
|
|
4060
|
-
/* @__PURE__ */ (0,
|
|
4061
|
-
/* @__PURE__ */ (0,
|
|
4348
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(CardContent, { className: "p-0 flex-1", children: [
|
|
4349
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CreateThreadDialog2, { onCreateThread, config }) }),
|
|
4350
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "text-center py-8 text-muted-foreground", children: [
|
|
4351
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.MessageSquare, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
|
|
4352
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
|
|
4353
|
+
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
|
|
4354
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
|
|
4355
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4062
4356
|
ThreadItem,
|
|
4063
4357
|
{
|
|
4064
4358
|
thread,
|
|
@@ -4074,14 +4368,14 @@ var ThreadManager = ({
|
|
|
4074
4368
|
] }, group)) }) })
|
|
4075
4369
|
] })
|
|
4076
4370
|
] }) }),
|
|
4077
|
-
/* @__PURE__ */ (0,
|
|
4078
|
-
/* @__PURE__ */ (0,
|
|
4079
|
-
/* @__PURE__ */ (0,
|
|
4080
|
-
/* @__PURE__ */ (0,
|
|
4371
|
+
deleteThreadId && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(AlertDialogContent, { children: [
|
|
4372
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(AlertDialogHeader, { children: [
|
|
4373
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
4374
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
4081
4375
|
] }),
|
|
4082
|
-
/* @__PURE__ */ (0,
|
|
4083
|
-
/* @__PURE__ */ (0,
|
|
4084
|
-
/* @__PURE__ */ (0,
|
|
4376
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(AlertDialogFooter, { children: [
|
|
4377
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
|
|
4378
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4085
4379
|
AlertDialogAction,
|
|
4086
4380
|
{
|
|
4087
4381
|
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|