@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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/components/chat/ChatUI.tsx
2
- import { useState as useState8, useEffect as useEffect7, useRef as useRef4, useCallback as useCallback4 } from "react";
2
+ import { useState as useState8, useEffect as useEffect10, useRef as useRef7, useCallback as useCallback4 } from "react";
3
3
 
4
4
  // src/config/chatConfig.ts
5
5
  var defaultChatConfig = {
@@ -9,6 +9,11 @@ var defaultChatConfig = {
9
9
  title: "Chat Assistant",
10
10
  subtitle: "How can I help you today?"
11
11
  },
12
+ agentSelector: {
13
+ enabled: false,
14
+ label: "Select agent",
15
+ hideIfSingle: true
16
+ },
12
17
  labels: {
13
18
  inputPlaceholder: "Type your message...",
14
19
  sendButton: "Send",
@@ -101,6 +106,10 @@ function mergeConfig(_baseConfig, userConfig) {
101
106
  ...defaultChatConfig.ui,
102
107
  ...userConfig.ui
103
108
  },
109
+ agentSelector: {
110
+ ...defaultChatConfig.agentSelector,
111
+ ...userConfig.agentSelector
112
+ },
104
113
  customComponent: userConfig.customComponent || defaultChatConfig.customComponent,
105
114
  headerActions: userConfig.headerActions || defaultChatConfig.headerActions
106
115
  };
@@ -228,7 +237,7 @@ var configUtils = {
228
237
  };
229
238
 
230
239
  // src/components/chat/Message.tsx
231
- import { useState, useRef } from "react";
240
+ import { useState, useRef, memo } from "react";
232
241
  import ReactMarkdown from "react-markdown";
233
242
  import remarkGfm from "remark-gfm";
234
243
  import rehypeHighlight from "rehype-highlight";
@@ -521,7 +530,7 @@ import {
521
530
  ChevronDown
522
531
  } from "lucide-react";
523
532
  import { Fragment, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
524
- var ThinkingIndicator = ({ label = "Thinking..." }) => {
533
+ var ThinkingIndicator = memo(function ThinkingIndicator2({ label = "Thinking..." }) {
525
534
  return /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 py-2", children: [
526
535
  /* @__PURE__ */ jsxs2("div", { className: "flex gap-1", children: [
527
536
  /* @__PURE__ */ jsx7(
@@ -548,26 +557,30 @@ var ThinkingIndicator = ({ label = "Thinking..." }) => {
548
557
  ] }),
549
558
  /* @__PURE__ */ jsx7("span", { className: "text-sm text-muted-foreground animate-pulse", children: label })
550
559
  ] });
560
+ });
561
+ var markdownComponents = {
562
+ code: ({ node, className, children, ...props }) => {
563
+ const inline = props.inline;
564
+ const match = /language-(\w+)/.exec(className || "");
565
+ return !inline && match ? /* @__PURE__ */ jsx7("pre", { className: "relative", children: /* @__PURE__ */ jsx7("code", { className, ...props, children }) }) : /* @__PURE__ */ jsx7("code", { className: "bg-muted px-1 py-0.5 rounded text-sm", ...props, children });
566
+ }
551
567
  };
552
- var StreamingText = ({
568
+ var remarkPluginsDefault = [remarkGfm];
569
+ var rehypePluginsDefault = [rehypeHighlight];
570
+ var rehypePluginsEmpty = [];
571
+ var StreamingText = memo(function StreamingText2({
553
572
  content,
554
573
  isStreaming = false,
555
574
  thinkingLabel = "Thinking..."
556
- }) => {
575
+ }) {
557
576
  const hasContent = content.trim().length > 0;
558
577
  return /* @__PURE__ */ jsxs2("div", { className: "prose prose-sm max-w-none dark:prose-invert", children: [
559
578
  hasContent ? /* @__PURE__ */ jsx7(
560
579
  ReactMarkdown,
561
580
  {
562
- remarkPlugins: [remarkGfm],
563
- rehypePlugins: isStreaming ? [] : [rehypeHighlight],
564
- components: {
565
- code: ({ node, className, children, ...props }) => {
566
- const inline = props.inline;
567
- const match = /language-(\w+)/.exec(className || "");
568
- return !inline && match ? /* @__PURE__ */ jsx7("pre", { className: "relative", children: /* @__PURE__ */ jsx7("code", { className, ...props, children }) }) : /* @__PURE__ */ jsx7("code", { className: "bg-muted px-1 py-0.5 rounded text-sm", ...props, children });
569
- }
570
- },
581
+ remarkPlugins: remarkPluginsDefault,
582
+ rehypePlugins: isStreaming ? rehypePluginsEmpty : rehypePluginsDefault,
583
+ components: markdownComponents,
571
584
  children: content
572
585
  }
573
586
  ) : isStreaming ? (
@@ -576,8 +589,8 @@ var StreamingText = ({
576
589
  ) : null,
577
590
  isStreaming && hasContent && /* @__PURE__ */ jsx7("span", { className: "inline-block w-2 h-4 bg-primary animate-pulse ml-1" })
578
591
  ] });
579
- };
580
- var MediaRenderer = ({ attachment }) => {
592
+ });
593
+ var MediaRenderer = memo(function MediaRenderer2({ attachment }) {
581
594
  const [isPlaying, setIsPlaying] = useState(false);
582
595
  const audioRef = useRef(null);
583
596
  const videoRef = useRef(null);
@@ -651,8 +664,8 @@ var MediaRenderer = ({ attachment }) => {
651
664
  default:
652
665
  return null;
653
666
  }
654
- };
655
- var ToolCallsDisplay = ({ toolCalls, label }) => {
667
+ });
668
+ var ToolCallsDisplay = memo(function ToolCallsDisplay2({ toolCalls, label }) {
656
669
  const [expandedCall, setExpandedCall] = useState(null);
657
670
  const getStatusIcon = (status) => {
658
671
  switch (status) {
@@ -721,8 +734,48 @@ var ToolCallsDisplay = ({ toolCalls, label }) => {
721
734
  ] }, call.id);
722
735
  })
723
736
  ] });
737
+ });
738
+ var arePropsEqual = (prevProps, nextProps) => {
739
+ if (prevProps.message.id !== nextProps.message.id) return false;
740
+ if (prevProps.message.content !== nextProps.message.content) return false;
741
+ if (prevProps.message.isStreaming !== nextProps.message.isStreaming) return false;
742
+ if (prevProps.message.isComplete !== nextProps.message.isComplete) return false;
743
+ if (prevProps.message.isEdited !== nextProps.message.isEdited) return false;
744
+ if (prevProps.message.timestamp !== nextProps.message.timestamp) return false;
745
+ if (prevProps.message.toolCalls !== nextProps.message.toolCalls) {
746
+ const prevCalls = prevProps.message.toolCalls;
747
+ const nextCalls = nextProps.message.toolCalls;
748
+ if (!prevCalls || !nextCalls || prevCalls.length !== nextCalls.length) return false;
749
+ for (let i = 0; i < prevCalls.length; i++) {
750
+ if (prevCalls[i].id !== nextCalls[i].id || prevCalls[i].status !== nextCalls[i].status || prevCalls[i].result !== nextCalls[i].result) {
751
+ return false;
752
+ }
753
+ }
754
+ }
755
+ if (prevProps.message.attachments !== nextProps.message.attachments) {
756
+ const prevAtt = prevProps.message.attachments;
757
+ const nextAtt = nextProps.message.attachments;
758
+ if (!prevAtt || !nextAtt || prevAtt.length !== nextAtt.length) return false;
759
+ }
760
+ if (prevProps.isUser !== nextProps.isUser) return false;
761
+ if (prevProps.userAvatar !== nextProps.userAvatar) return false;
762
+ if (prevProps.userName !== nextProps.userName) return false;
763
+ if (prevProps.assistantName !== nextProps.assistantName) return false;
764
+ if (prevProps.showTimestamp !== nextProps.showTimestamp) return false;
765
+ if (prevProps.showAvatar !== nextProps.showAvatar) return false;
766
+ if (prevProps.enableCopy !== nextProps.enableCopy) return false;
767
+ if (prevProps.enableEdit !== nextProps.enableEdit) return false;
768
+ if (prevProps.enableRegenerate !== nextProps.enableRegenerate) return false;
769
+ if (prevProps.enableToolCallsDisplay !== nextProps.enableToolCallsDisplay) return false;
770
+ if (prevProps.compactMode !== nextProps.compactMode) return false;
771
+ if (prevProps.className !== nextProps.className) return false;
772
+ if (prevProps.toolUsedLabel !== nextProps.toolUsedLabel) return false;
773
+ if (prevProps.thinkingLabel !== nextProps.thinkingLabel) return false;
774
+ if (prevProps.isGrouped !== nextProps.isGrouped) return false;
775
+ if (prevProps.assistantAvatar !== nextProps.assistantAvatar) return false;
776
+ return true;
724
777
  };
725
- var Message = ({
778
+ var Message = memo(({
726
779
  message,
727
780
  isUser,
728
781
  userAvatar,
@@ -739,7 +792,8 @@ var Message = ({
739
792
  onAction,
740
793
  className = "",
741
794
  toolUsedLabel,
742
- thinkingLabel = "Thinking..."
795
+ thinkingLabel = "Thinking...",
796
+ isGrouped = false
743
797
  }) => {
744
798
  const [isEditing, setIsEditing] = useState(false);
745
799
  const [editContent, setEditContent] = useState(message.content);
@@ -789,7 +843,7 @@ var Message = ({
789
843
  onMouseEnter: () => setShowActions(true),
790
844
  onMouseLeave: () => setShowActions(false),
791
845
  children: [
792
- /* @__PURE__ */ jsxs2("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
846
+ !isGrouped && /* @__PURE__ */ jsxs2("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
793
847
  showAvatar && /* @__PURE__ */ jsx7("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ jsx7(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: messageIsUser ? /* @__PURE__ */ jsxs2(Fragment, { children: [
794
848
  /* @__PURE__ */ jsx7(AvatarImage, { src: userAvatar, alt: userName }),
795
849
  /* @__PURE__ */ jsx7(AvatarFallback, { className: "bg-primary text-primary-foreground", children: userName.charAt(0).toUpperCase() })
@@ -800,7 +854,7 @@ var Message = ({
800
854
  message.isEdited && /* @__PURE__ */ jsx7(Badge, { variant: "outline", className: "text-xs", children: "editado" })
801
855
  ] })
802
856
  ] }),
803
- /* @__PURE__ */ jsx7("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"}`, children: /* @__PURE__ */ jsxs2("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: [
857
+ /* @__PURE__ */ jsx7("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__ */ jsxs2("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: [
804
858
  isEditing ? /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
805
859
  /* @__PURE__ */ jsx7(
806
860
  Textarea,
@@ -878,10 +932,10 @@ var Message = ({
878
932
  ]
879
933
  }
880
934
  ) });
881
- };
935
+ }, arePropsEqual);
882
936
 
883
937
  // src/components/chat/Sidebar.tsx
884
- import { useState as useState4, useRef as useRef2, useEffect as useEffect4 } from "react";
938
+ import { useState as useState4, useRef as useRef5, useEffect as useEffect7 } from "react";
885
939
 
886
940
  // src/components/ui/input.tsx
887
941
  import { jsx as jsx8 } from "react/jsx-runtime";
@@ -903,7 +957,7 @@ function Input({ className, type, ...props }) {
903
957
  }
904
958
 
905
959
  // src/components/ui/sidebar.tsx
906
- import * as React3 from "react";
960
+ import * as React4 from "react";
907
961
  import { Slot as Slot3 } from "@radix-ui/react-slot";
908
962
  import { cva as cva3 } from "class-variance-authority";
909
963
  import { PanelLeftIcon } from "lucide-react";
@@ -950,11 +1004,30 @@ function Separator({
950
1004
  }
951
1005
 
952
1006
  // src/components/ui/sheet.tsx
1007
+ import * as React3 from "react";
953
1008
  import * as SheetPrimitive from "@radix-ui/react-dialog";
954
1009
  import { XIcon } from "lucide-react";
955
1010
  import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
956
- function Sheet({ ...props }) {
957
- return /* @__PURE__ */ jsx10(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
1011
+ function cleanupBodyStyles() {
1012
+ if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
1013
+ document.body.style.pointerEvents = "";
1014
+ }
1015
+ }
1016
+ function Sheet({ open, onOpenChange, ...props }) {
1017
+ const prevOpenRef = React3.useRef(open);
1018
+ React3.useEffect(() => {
1019
+ if (prevOpenRef.current === true && open === false) {
1020
+ const timeout = setTimeout(cleanupBodyStyles, 350);
1021
+ return () => clearTimeout(timeout);
1022
+ }
1023
+ prevOpenRef.current = open;
1024
+ }, [open]);
1025
+ React3.useEffect(() => {
1026
+ return () => {
1027
+ cleanupBodyStyles();
1028
+ };
1029
+ }, []);
1030
+ return /* @__PURE__ */ jsx10(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
958
1031
  }
959
1032
  function SheetPortal({
960
1033
  ...props
@@ -970,7 +1043,10 @@ function SheetOverlay({
970
1043
  {
971
1044
  "data-slot": "sheet-overlay",
972
1045
  className: cn(
973
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
1046
+ "fixed inset-0 z-50 bg-black/50",
1047
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
1048
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1049
+ "data-[state=closed]:pointer-events-none",
974
1050
  className
975
1051
  ),
976
1052
  ...props
@@ -989,6 +1065,7 @@ function SheetContent({
989
1065
  SheetPrimitive.Content,
990
1066
  {
991
1067
  "data-slot": "sheet-content",
1068
+ "aria-describedby": void 0,
992
1069
  className: cn(
993
1070
  "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",
994
1071
  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",
@@ -1046,17 +1123,30 @@ function SheetDescription({
1046
1123
  );
1047
1124
  }
1048
1125
 
1126
+ // src/components/ui/skeleton.tsx
1127
+ import { jsx as jsx11 } from "react/jsx-runtime";
1128
+ function Skeleton({ className, ...props }) {
1129
+ return /* @__PURE__ */ jsx11(
1130
+ "div",
1131
+ {
1132
+ "data-slot": "skeleton",
1133
+ className: cn("bg-accent animate-pulse rounded-md", className),
1134
+ ...props
1135
+ }
1136
+ );
1137
+ }
1138
+
1049
1139
  // src/components/ui/sidebar.tsx
1050
- import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
1140
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
1051
1141
  var SIDEBAR_COOKIE_NAME = "sidebar_state";
1052
1142
  var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
1053
1143
  var SIDEBAR_WIDTH = "16rem";
1054
1144
  var SIDEBAR_WIDTH_MOBILE = "18rem";
1055
1145
  var SIDEBAR_WIDTH_ICON = "3rem";
1056
1146
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
1057
- var SidebarContext = React3.createContext(null);
1147
+ var SidebarContext = React4.createContext(null);
1058
1148
  function useSidebar() {
1059
- const context = React3.useContext(SidebarContext);
1149
+ const context = React4.useContext(SidebarContext);
1060
1150
  if (!context) {
1061
1151
  throw new Error("useSidebar must be used within a SidebarProvider.");
1062
1152
  }
@@ -1072,10 +1162,10 @@ function SidebarProvider({
1072
1162
  ...props
1073
1163
  }) {
1074
1164
  const isMobile = useIsMobile();
1075
- const [openMobile, setOpenMobile] = React3.useState(false);
1076
- const [_open, _setOpen] = React3.useState(defaultOpen);
1165
+ const [openMobile, setOpenMobile] = React4.useState(false);
1166
+ const [_open, _setOpen] = React4.useState(defaultOpen);
1077
1167
  const open = openProp ?? _open;
1078
- const setOpen = React3.useCallback(
1168
+ const setOpen = React4.useCallback(
1079
1169
  (value) => {
1080
1170
  const openState = typeof value === "function" ? value(open) : value;
1081
1171
  if (setOpenProp) {
@@ -1087,10 +1177,10 @@ function SidebarProvider({
1087
1177
  },
1088
1178
  [setOpenProp, open]
1089
1179
  );
1090
- const toggleSidebar = React3.useCallback(() => {
1180
+ const toggleSidebar = React4.useCallback(() => {
1091
1181
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
1092
1182
  }, [isMobile, setOpen, setOpenMobile]);
1093
- React3.useEffect(() => {
1183
+ React4.useEffect(() => {
1094
1184
  const handleKeyDown = (event) => {
1095
1185
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
1096
1186
  event.preventDefault();
@@ -1101,7 +1191,7 @@ function SidebarProvider({
1101
1191
  return () => window.removeEventListener("keydown", handleKeyDown);
1102
1192
  }, [toggleSidebar]);
1103
1193
  const state = open ? "expanded" : "collapsed";
1104
- const contextValue = React3.useMemo(
1194
+ const contextValue = React4.useMemo(
1105
1195
  () => ({
1106
1196
  state,
1107
1197
  open,
@@ -1113,7 +1203,7 @@ function SidebarProvider({
1113
1203
  }),
1114
1204
  [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
1115
1205
  );
1116
- return /* @__PURE__ */ jsx11(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx11(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx11(
1206
+ return /* @__PURE__ */ jsx12(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx12(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx12(
1117
1207
  "div",
1118
1208
  {
1119
1209
  "data-slot": "sidebar-wrapper",
@@ -1141,7 +1231,7 @@ function Sidebar({
1141
1231
  }) {
1142
1232
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
1143
1233
  if (collapsible === "none") {
1144
- return /* @__PURE__ */ jsx11(
1234
+ return /* @__PURE__ */ jsx12(
1145
1235
  "div",
1146
1236
  {
1147
1237
  "data-slot": "sidebar",
@@ -1155,7 +1245,7 @@ function Sidebar({
1155
1245
  );
1156
1246
  }
1157
1247
  if (isMobile) {
1158
- return /* @__PURE__ */ jsx11(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs4(
1248
+ return /* @__PURE__ */ jsx12(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs4(
1159
1249
  SheetContent,
1160
1250
  {
1161
1251
  "data-sidebar": "sidebar",
@@ -1168,10 +1258,10 @@ function Sidebar({
1168
1258
  side,
1169
1259
  children: [
1170
1260
  /* @__PURE__ */ jsxs4(SheetHeader, { className: "sr-only", children: [
1171
- /* @__PURE__ */ jsx11(SheetTitle, { children: "Sidebar" }),
1172
- /* @__PURE__ */ jsx11(SheetDescription, { children: "Displays the mobile sidebar." })
1261
+ /* @__PURE__ */ jsx12(SheetTitle, { children: "Sidebar" }),
1262
+ /* @__PURE__ */ jsx12(SheetDescription, { children: "Displays the mobile sidebar." })
1173
1263
  ] }),
1174
- /* @__PURE__ */ jsx11("div", { className: "flex h-full w-full flex-col", children })
1264
+ /* @__PURE__ */ jsx12("div", { className: "flex h-full w-full flex-col", children })
1175
1265
  ]
1176
1266
  }
1177
1267
  ) });
@@ -1186,7 +1276,7 @@ function Sidebar({
1186
1276
  "data-side": side,
1187
1277
  "data-slot": "sidebar",
1188
1278
  children: [
1189
- /* @__PURE__ */ jsx11(
1279
+ /* @__PURE__ */ jsx12(
1190
1280
  "div",
1191
1281
  {
1192
1282
  "data-slot": "sidebar-gap",
@@ -1198,7 +1288,7 @@ function Sidebar({
1198
1288
  )
1199
1289
  }
1200
1290
  ),
1201
- /* @__PURE__ */ jsx11(
1291
+ /* @__PURE__ */ jsx12(
1202
1292
  "div",
1203
1293
  {
1204
1294
  "data-slot": "sidebar-container",
@@ -1210,7 +1300,7 @@ function Sidebar({
1210
1300
  className
1211
1301
  ),
1212
1302
  ...props,
1213
- children: /* @__PURE__ */ jsx11(
1303
+ children: /* @__PURE__ */ jsx12(
1214
1304
  "div",
1215
1305
  {
1216
1306
  "data-sidebar": "sidebar",
@@ -1245,15 +1335,15 @@ function SidebarTrigger({
1245
1335
  },
1246
1336
  ...props,
1247
1337
  children: [
1248
- /* @__PURE__ */ jsx11(PanelLeftIcon, {}),
1249
- /* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Toggle Sidebar" })
1338
+ /* @__PURE__ */ jsx12(PanelLeftIcon, {}),
1339
+ /* @__PURE__ */ jsx12("span", { className: "sr-only", children: "Toggle Sidebar" })
1250
1340
  ]
1251
1341
  }
1252
1342
  );
1253
1343
  }
1254
1344
  function SidebarRail({ className, ...props }) {
1255
1345
  const { toggleSidebar } = useSidebar();
1256
- return /* @__PURE__ */ jsx11(
1346
+ return /* @__PURE__ */ jsx12(
1257
1347
  "button",
1258
1348
  {
1259
1349
  "data-sidebar": "rail",
@@ -1276,7 +1366,7 @@ function SidebarRail({ className, ...props }) {
1276
1366
  );
1277
1367
  }
1278
1368
  function SidebarInset({ className, ...props }) {
1279
- return /* @__PURE__ */ jsx11(
1369
+ return /* @__PURE__ */ jsx12(
1280
1370
  "main",
1281
1371
  {
1282
1372
  "data-slot": "sidebar-inset",
@@ -1290,7 +1380,7 @@ function SidebarInset({ className, ...props }) {
1290
1380
  );
1291
1381
  }
1292
1382
  function SidebarHeader({ className, ...props }) {
1293
- return /* @__PURE__ */ jsx11(
1383
+ return /* @__PURE__ */ jsx12(
1294
1384
  "div",
1295
1385
  {
1296
1386
  "data-slot": "sidebar-header",
@@ -1301,7 +1391,7 @@ function SidebarHeader({ className, ...props }) {
1301
1391
  );
1302
1392
  }
1303
1393
  function SidebarFooter({ className, ...props }) {
1304
- return /* @__PURE__ */ jsx11(
1394
+ return /* @__PURE__ */ jsx12(
1305
1395
  "div",
1306
1396
  {
1307
1397
  "data-slot": "sidebar-footer",
@@ -1312,7 +1402,7 @@ function SidebarFooter({ className, ...props }) {
1312
1402
  );
1313
1403
  }
1314
1404
  function SidebarContent({ className, ...props }) {
1315
- return /* @__PURE__ */ jsx11(
1405
+ return /* @__PURE__ */ jsx12(
1316
1406
  "div",
1317
1407
  {
1318
1408
  "data-slot": "sidebar-content",
@@ -1326,7 +1416,7 @@ function SidebarContent({ className, ...props }) {
1326
1416
  );
1327
1417
  }
1328
1418
  function SidebarGroup({ className, ...props }) {
1329
- return /* @__PURE__ */ jsx11(
1419
+ return /* @__PURE__ */ jsx12(
1330
1420
  "div",
1331
1421
  {
1332
1422
  "data-slot": "sidebar-group",
@@ -1342,7 +1432,7 @@ function SidebarGroupLabel({
1342
1432
  ...props
1343
1433
  }) {
1344
1434
  const Comp = asChild ? Slot3 : "div";
1345
- return /* @__PURE__ */ jsx11(
1435
+ return /* @__PURE__ */ jsx12(
1346
1436
  Comp,
1347
1437
  {
1348
1438
  "data-slot": "sidebar-group-label",
@@ -1360,7 +1450,7 @@ function SidebarGroupContent({
1360
1450
  className,
1361
1451
  ...props
1362
1452
  }) {
1363
- return /* @__PURE__ */ jsx11(
1453
+ return /* @__PURE__ */ jsx12(
1364
1454
  "div",
1365
1455
  {
1366
1456
  "data-slot": "sidebar-group-content",
@@ -1371,7 +1461,7 @@ function SidebarGroupContent({
1371
1461
  );
1372
1462
  }
1373
1463
  function SidebarMenu({ className, ...props }) {
1374
- return /* @__PURE__ */ jsx11(
1464
+ return /* @__PURE__ */ jsx12(
1375
1465
  "ul",
1376
1466
  {
1377
1467
  "data-slot": "sidebar-menu",
@@ -1382,7 +1472,7 @@ function SidebarMenu({ className, ...props }) {
1382
1472
  );
1383
1473
  }
1384
1474
  function SidebarMenuItem({ className, ...props }) {
1385
- return /* @__PURE__ */ jsx11(
1475
+ return /* @__PURE__ */ jsx12(
1386
1476
  "li",
1387
1477
  {
1388
1478
  "data-slot": "sidebar-menu-item",
@@ -1423,7 +1513,7 @@ function SidebarMenuButton({
1423
1513
  }) {
1424
1514
  const Comp = asChild ? Slot3 : "button";
1425
1515
  const { isMobile, state } = useSidebar();
1426
- const button = /* @__PURE__ */ jsx11(
1516
+ const button = /* @__PURE__ */ jsx12(
1427
1517
  Comp,
1428
1518
  {
1429
1519
  "data-slot": "sidebar-menu-button",
@@ -1443,8 +1533,8 @@ function SidebarMenuButton({
1443
1533
  };
1444
1534
  }
1445
1535
  return /* @__PURE__ */ jsxs4(Tooltip, { children: [
1446
- /* @__PURE__ */ jsx11(TooltipTrigger, { asChild: true, children: button }),
1447
- /* @__PURE__ */ jsx11(
1536
+ /* @__PURE__ */ jsx12(TooltipTrigger, { asChild: true, children: button }),
1537
+ /* @__PURE__ */ jsx12(
1448
1538
  TooltipContent,
1449
1539
  {
1450
1540
  side: "right",
@@ -1462,7 +1552,7 @@ function SidebarMenuAction({
1462
1552
  ...props
1463
1553
  }) {
1464
1554
  const Comp = asChild ? Slot3 : "button";
1465
- return /* @__PURE__ */ jsx11(
1555
+ return /* @__PURE__ */ jsx12(
1466
1556
  Comp,
1467
1557
  {
1468
1558
  "data-slot": "sidebar-menu-action",
@@ -1484,34 +1574,58 @@ function SidebarMenuAction({
1484
1574
  }
1485
1575
 
1486
1576
  // src/components/ui/dialog.tsx
1577
+ import * as React5 from "react";
1487
1578
  import * as DialogPrimitive from "@radix-ui/react-dialog";
1488
1579
  import { XIcon as XIcon2 } from "lucide-react";
1489
- import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
1580
+ import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
1581
+ function cleanupBodyStyles2() {
1582
+ if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
1583
+ document.body.style.pointerEvents = "";
1584
+ }
1585
+ }
1490
1586
  function Dialog({
1587
+ open,
1588
+ onOpenChange,
1491
1589
  ...props
1492
1590
  }) {
1493
- return /* @__PURE__ */ jsx12(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
1591
+ const prevOpenRef = React5.useRef(open);
1592
+ React5.useEffect(() => {
1593
+ if (prevOpenRef.current === true && open === false) {
1594
+ const timeout = setTimeout(cleanupBodyStyles2, 250);
1595
+ return () => clearTimeout(timeout);
1596
+ }
1597
+ prevOpenRef.current = open;
1598
+ }, [open]);
1599
+ React5.useEffect(() => {
1600
+ return () => {
1601
+ cleanupBodyStyles2();
1602
+ };
1603
+ }, []);
1604
+ return /* @__PURE__ */ jsx13(DialogPrimitive.Root, { "data-slot": "dialog", open, onOpenChange, ...props });
1494
1605
  }
1495
1606
  function DialogTrigger({
1496
1607
  ...props
1497
1608
  }) {
1498
- return /* @__PURE__ */ jsx12(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
1609
+ return /* @__PURE__ */ jsx13(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
1499
1610
  }
1500
1611
  function DialogPortal({
1501
1612
  ...props
1502
1613
  }) {
1503
- return /* @__PURE__ */ jsx12(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
1614
+ return /* @__PURE__ */ jsx13(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
1504
1615
  }
1505
1616
  function DialogOverlay({
1506
1617
  className,
1507
1618
  ...props
1508
1619
  }) {
1509
- return /* @__PURE__ */ jsx12(
1620
+ return /* @__PURE__ */ jsx13(
1510
1621
  DialogPrimitive.Overlay,
1511
1622
  {
1512
1623
  "data-slot": "dialog-overlay",
1513
1624
  className: cn(
1514
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
1625
+ "fixed inset-0 z-50 bg-black/50",
1626
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
1627
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1628
+ "data-[state=closed]:pointer-events-none",
1515
1629
  className
1516
1630
  ),
1517
1631
  ...props
@@ -1525,11 +1639,12 @@ function DialogContent({
1525
1639
  ...props
1526
1640
  }) {
1527
1641
  return /* @__PURE__ */ jsxs5(DialogPortal, { "data-slot": "dialog-portal", children: [
1528
- /* @__PURE__ */ jsx12(DialogOverlay, {}),
1642
+ /* @__PURE__ */ jsx13(DialogOverlay, {}),
1529
1643
  /* @__PURE__ */ jsxs5(
1530
1644
  DialogPrimitive.Content,
1531
1645
  {
1532
1646
  "data-slot": "dialog-content",
1647
+ "aria-describedby": void 0,
1533
1648
  className: cn(
1534
1649
  "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",
1535
1650
  className
@@ -1543,8 +1658,8 @@ function DialogContent({
1543
1658
  "data-slot": "dialog-close",
1544
1659
  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",
1545
1660
  children: [
1546
- /* @__PURE__ */ jsx12(XIcon2, {}),
1547
- /* @__PURE__ */ jsx12("span", { className: "sr-only", children: "Close" })
1661
+ /* @__PURE__ */ jsx13(XIcon2, {}),
1662
+ /* @__PURE__ */ jsx13("span", { className: "sr-only", children: "Close" })
1548
1663
  ]
1549
1664
  }
1550
1665
  )
@@ -1554,7 +1669,7 @@ function DialogContent({
1554
1669
  ] });
1555
1670
  }
1556
1671
  function DialogHeader({ className, ...props }) {
1557
- return /* @__PURE__ */ jsx12(
1672
+ return /* @__PURE__ */ jsx13(
1558
1673
  "div",
1559
1674
  {
1560
1675
  "data-slot": "dialog-header",
@@ -1564,7 +1679,7 @@ function DialogHeader({ className, ...props }) {
1564
1679
  );
1565
1680
  }
1566
1681
  function DialogFooter({ className, ...props }) {
1567
- return /* @__PURE__ */ jsx12(
1682
+ return /* @__PURE__ */ jsx13(
1568
1683
  "div",
1569
1684
  {
1570
1685
  "data-slot": "dialog-footer",
@@ -1580,7 +1695,7 @@ function DialogTitle({
1580
1695
  className,
1581
1696
  ...props
1582
1697
  }) {
1583
- return /* @__PURE__ */ jsx12(
1698
+ return /* @__PURE__ */ jsx13(
1584
1699
  DialogPrimitive.Title,
1585
1700
  {
1586
1701
  "data-slot": "dialog-title",
@@ -1593,7 +1708,7 @@ function DialogDescription({
1593
1708
  className,
1594
1709
  ...props
1595
1710
  }) {
1596
- return /* @__PURE__ */ jsx12(
1711
+ return /* @__PURE__ */ jsx13(
1597
1712
  DialogPrimitive.Description,
1598
1713
  {
1599
1714
  "data-slot": "dialog-description",
@@ -1604,28 +1719,52 @@ function DialogDescription({
1604
1719
  }
1605
1720
 
1606
1721
  // src/components/ui/alert-dialog.tsx
1722
+ import * as React6 from "react";
1607
1723
  import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
1608
- import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
1724
+ import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1725
+ function cleanupBodyStyles3() {
1726
+ if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
1727
+ document.body.style.pointerEvents = "";
1728
+ }
1729
+ }
1609
1730
  function AlertDialog({
1731
+ open,
1732
+ onOpenChange,
1610
1733
  ...props
1611
1734
  }) {
1612
- return /* @__PURE__ */ jsx13(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
1735
+ const prevOpenRef = React6.useRef(open);
1736
+ React6.useEffect(() => {
1737
+ if (prevOpenRef.current === true && open === false) {
1738
+ const timeout = setTimeout(cleanupBodyStyles3, 250);
1739
+ return () => clearTimeout(timeout);
1740
+ }
1741
+ prevOpenRef.current = open;
1742
+ }, [open]);
1743
+ React6.useEffect(() => {
1744
+ return () => {
1745
+ cleanupBodyStyles3();
1746
+ };
1747
+ }, []);
1748
+ return /* @__PURE__ */ jsx14(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", open, onOpenChange, ...props });
1613
1749
  }
1614
1750
  function AlertDialogPortal({
1615
1751
  ...props
1616
1752
  }) {
1617
- return /* @__PURE__ */ jsx13(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
1753
+ return /* @__PURE__ */ jsx14(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
1618
1754
  }
1619
1755
  function AlertDialogOverlay({
1620
1756
  className,
1621
1757
  ...props
1622
1758
  }) {
1623
- return /* @__PURE__ */ jsx13(
1759
+ return /* @__PURE__ */ jsx14(
1624
1760
  AlertDialogPrimitive.Overlay,
1625
1761
  {
1626
1762
  "data-slot": "alert-dialog-overlay",
1627
1763
  className: cn(
1628
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
1764
+ "fixed inset-0 z-50 bg-black/50",
1765
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
1766
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1767
+ "data-[state=closed]:pointer-events-none",
1629
1768
  className
1630
1769
  ),
1631
1770
  ...props
@@ -1637,8 +1776,8 @@ function AlertDialogContent({
1637
1776
  ...props
1638
1777
  }) {
1639
1778
  return /* @__PURE__ */ jsxs6(AlertDialogPortal, { children: [
1640
- /* @__PURE__ */ jsx13(AlertDialogOverlay, {}),
1641
- /* @__PURE__ */ jsx13(
1779
+ /* @__PURE__ */ jsx14(AlertDialogOverlay, {}),
1780
+ /* @__PURE__ */ jsx14(
1642
1781
  AlertDialogPrimitive.Content,
1643
1782
  {
1644
1783
  "data-slot": "alert-dialog-content",
@@ -1655,7 +1794,7 @@ function AlertDialogHeader({
1655
1794
  className,
1656
1795
  ...props
1657
1796
  }) {
1658
- return /* @__PURE__ */ jsx13(
1797
+ return /* @__PURE__ */ jsx14(
1659
1798
  "div",
1660
1799
  {
1661
1800
  "data-slot": "alert-dialog-header",
@@ -1668,7 +1807,7 @@ function AlertDialogFooter({
1668
1807
  className,
1669
1808
  ...props
1670
1809
  }) {
1671
- return /* @__PURE__ */ jsx13(
1810
+ return /* @__PURE__ */ jsx14(
1672
1811
  "div",
1673
1812
  {
1674
1813
  "data-slot": "alert-dialog-footer",
@@ -1684,7 +1823,7 @@ function AlertDialogTitle({
1684
1823
  className,
1685
1824
  ...props
1686
1825
  }) {
1687
- return /* @__PURE__ */ jsx13(
1826
+ return /* @__PURE__ */ jsx14(
1688
1827
  AlertDialogPrimitive.Title,
1689
1828
  {
1690
1829
  "data-slot": "alert-dialog-title",
@@ -1697,7 +1836,7 @@ function AlertDialogDescription({
1697
1836
  className,
1698
1837
  ...props
1699
1838
  }) {
1700
- return /* @__PURE__ */ jsx13(
1839
+ return /* @__PURE__ */ jsx14(
1701
1840
  AlertDialogPrimitive.Description,
1702
1841
  {
1703
1842
  "data-slot": "alert-dialog-description",
@@ -1710,7 +1849,7 @@ function AlertDialogAction({
1710
1849
  className,
1711
1850
  ...props
1712
1851
  }) {
1713
- return /* @__PURE__ */ jsx13(
1852
+ return /* @__PURE__ */ jsx14(
1714
1853
  AlertDialogPrimitive.Action,
1715
1854
  {
1716
1855
  className: cn(buttonVariants(), className),
@@ -1722,7 +1861,7 @@ function AlertDialogCancel({
1722
1861
  className,
1723
1862
  ...props
1724
1863
  }) {
1725
- return /* @__PURE__ */ jsx13(
1864
+ return /* @__PURE__ */ jsx14(
1726
1865
  AlertDialogPrimitive.Cancel,
1727
1866
  {
1728
1867
  className: cn(buttonVariants({ variant: "outline" }), className),
@@ -1734,16 +1873,16 @@ function AlertDialogCancel({
1734
1873
  // src/components/ui/dropdown-menu.tsx
1735
1874
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
1736
1875
  import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
1737
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
1876
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1738
1877
  function DropdownMenu({
1739
1878
  ...props
1740
1879
  }) {
1741
- return /* @__PURE__ */ jsx14(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
1880
+ return /* @__PURE__ */ jsx15(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
1742
1881
  }
1743
1882
  function DropdownMenuTrigger({
1744
1883
  ...props
1745
1884
  }) {
1746
- return /* @__PURE__ */ jsx14(
1885
+ return /* @__PURE__ */ jsx15(
1747
1886
  DropdownMenuPrimitive.Trigger,
1748
1887
  {
1749
1888
  "data-slot": "dropdown-menu-trigger",
@@ -1756,7 +1895,7 @@ function DropdownMenuContent({
1756
1895
  sideOffset = 4,
1757
1896
  ...props
1758
1897
  }) {
1759
- return /* @__PURE__ */ jsx14(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx14(
1898
+ return /* @__PURE__ */ jsx15(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx15(
1760
1899
  DropdownMenuPrimitive.Content,
1761
1900
  {
1762
1901
  "data-slot": "dropdown-menu-content",
@@ -1775,7 +1914,7 @@ function DropdownMenuItem({
1775
1914
  variant = "default",
1776
1915
  ...props
1777
1916
  }) {
1778
- return /* @__PURE__ */ jsx14(
1917
+ return /* @__PURE__ */ jsx15(
1779
1918
  DropdownMenuPrimitive.Item,
1780
1919
  {
1781
1920
  "data-slot": "dropdown-menu-item",
@@ -1794,7 +1933,7 @@ function DropdownMenuLabel({
1794
1933
  inset,
1795
1934
  ...props
1796
1935
  }) {
1797
- return /* @__PURE__ */ jsx14(
1936
+ return /* @__PURE__ */ jsx15(
1798
1937
  DropdownMenuPrimitive.Label,
1799
1938
  {
1800
1939
  "data-slot": "dropdown-menu-label",
@@ -1811,7 +1950,7 @@ function DropdownMenuSeparator({
1811
1950
  className,
1812
1951
  ...props
1813
1952
  }) {
1814
- return /* @__PURE__ */ jsx14(
1953
+ return /* @__PURE__ */ jsx15(
1815
1954
  DropdownMenuPrimitive.Separator,
1816
1955
  {
1817
1956
  "data-slot": "dropdown-menu-separator",
@@ -1829,7 +1968,8 @@ import {
1829
1968
  Trash2,
1830
1969
  Archive,
1831
1970
  Search,
1832
- Filter
1971
+ Filter,
1972
+ Bot
1833
1973
  } from "lucide-react";
1834
1974
 
1835
1975
  // src/components/chat/UserMenu.tsx
@@ -1842,7 +1982,7 @@ import {
1842
1982
  Sun,
1843
1983
  Palette
1844
1984
  } from "lucide-react";
1845
- import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
1985
+ import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
1846
1986
  var getInitials = (name, email) => {
1847
1987
  if (name) {
1848
1988
  return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
@@ -1877,8 +2017,8 @@ var UserMenu = ({
1877
2017
  };
1878
2018
  const displayName = getDisplayName(user, labels.guest);
1879
2019
  const initials = getInitials(user?.name, user?.email);
1880
- return /* @__PURE__ */ jsx15(SidebarMenu, { children: /* @__PURE__ */ jsx15(SidebarMenuItem, { children: /* @__PURE__ */ jsxs8(DropdownMenu, { children: [
1881
- /* @__PURE__ */ jsx15(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
2020
+ return /* @__PURE__ */ jsx16(SidebarMenu, { children: /* @__PURE__ */ jsx16(SidebarMenuItem, { children: /* @__PURE__ */ jsxs8(DropdownMenu, { children: [
2021
+ /* @__PURE__ */ jsx16(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
1882
2022
  SidebarMenuButton,
1883
2023
  {
1884
2024
  size: "lg",
@@ -1886,14 +2026,14 @@ var UserMenu = ({
1886
2026
  tooltip: displayName,
1887
2027
  children: [
1888
2028
  /* @__PURE__ */ jsxs8(Avatar, { className: "h-8 w-8 rounded-lg", children: [
1889
- user?.avatar && /* @__PURE__ */ jsx15(AvatarImage, { src: user.avatar, alt: displayName }),
1890
- /* @__PURE__ */ jsx15(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
2029
+ user?.avatar && /* @__PURE__ */ jsx16(AvatarImage, { src: user.avatar, alt: displayName }),
2030
+ /* @__PURE__ */ jsx16(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
1891
2031
  ] }),
1892
2032
  /* @__PURE__ */ jsxs8("div", { className: "grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
1893
- /* @__PURE__ */ jsx15("span", { className: "truncate font-medium", children: displayName }),
1894
- user?.email && /* @__PURE__ */ jsx15("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
2033
+ /* @__PURE__ */ jsx16("span", { className: "truncate font-medium", children: displayName }),
2034
+ user?.email && /* @__PURE__ */ jsx16("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
1895
2035
  ] }),
1896
- /* @__PURE__ */ jsx15(ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
2036
+ /* @__PURE__ */ jsx16(ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
1897
2037
  ]
1898
2038
  }
1899
2039
  ) }),
@@ -1905,36 +2045,36 @@ var UserMenu = ({
1905
2045
  align: "end",
1906
2046
  sideOffset: 4,
1907
2047
  children: [
1908
- /* @__PURE__ */ jsx15(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
2048
+ /* @__PURE__ */ jsx16(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
1909
2049
  /* @__PURE__ */ jsxs8(Avatar, { className: "h-8 w-8 rounded-lg", children: [
1910
- user?.avatar && /* @__PURE__ */ jsx15(AvatarImage, { src: user.avatar, alt: displayName }),
1911
- /* @__PURE__ */ jsx15(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
2050
+ user?.avatar && /* @__PURE__ */ jsx16(AvatarImage, { src: user.avatar, alt: displayName }),
2051
+ /* @__PURE__ */ jsx16(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
1912
2052
  ] }),
1913
2053
  /* @__PURE__ */ jsxs8("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
1914
- /* @__PURE__ */ jsx15("span", { className: "truncate font-medium", children: displayName }),
1915
- user?.email && /* @__PURE__ */ jsx15("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
2054
+ /* @__PURE__ */ jsx16("span", { className: "truncate font-medium", children: displayName }),
2055
+ user?.email && /* @__PURE__ */ jsx16("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
1916
2056
  ] })
1917
2057
  ] }) }),
1918
- /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
2058
+ /* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
1919
2059
  callbacks?.onViewProfile && /* @__PURE__ */ jsxs8(DropdownMenuItem, { onClick: callbacks.onViewProfile, children: [
1920
- /* @__PURE__ */ jsx15(User, { className: "mr-2 h-4 w-4" }),
1921
- /* @__PURE__ */ jsx15("span", { children: labels.profile })
2060
+ /* @__PURE__ */ jsx16(User, { className: "mr-2 h-4 w-4" }),
2061
+ /* @__PURE__ */ jsx16("span", { children: labels.profile })
1922
2062
  ] }),
1923
2063
  callbacks?.onOpenSettings && /* @__PURE__ */ jsxs8(DropdownMenuItem, { onClick: callbacks.onOpenSettings, children: [
1924
- /* @__PURE__ */ jsx15(Settings, { className: "mr-2 h-4 w-4" }),
1925
- /* @__PURE__ */ jsx15("span", { children: labels.settings })
2064
+ /* @__PURE__ */ jsx16(Settings, { className: "mr-2 h-4 w-4" }),
2065
+ /* @__PURE__ */ jsx16("span", { children: labels.settings })
1926
2066
  ] }),
1927
2067
  additionalItems,
1928
2068
  showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ jsxs8(Fragment2, { children: [
1929
- /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
2069
+ /* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
1930
2070
  /* @__PURE__ */ jsxs8(
1931
2071
  DropdownMenuItem,
1932
2072
  {
1933
2073
  onClick: () => callbacks.onThemeChange?.("light"),
1934
2074
  className: currentTheme === "light" ? "bg-accent" : "",
1935
2075
  children: [
1936
- /* @__PURE__ */ jsx15(Sun, { className: "mr-2 h-4 w-4" }),
1937
- /* @__PURE__ */ jsx15("span", { children: labels.lightMode })
2076
+ /* @__PURE__ */ jsx16(Sun, { className: "mr-2 h-4 w-4" }),
2077
+ /* @__PURE__ */ jsx16("span", { children: labels.lightMode })
1938
2078
  ]
1939
2079
  }
1940
2080
  ),
@@ -1944,8 +2084,8 @@ var UserMenu = ({
1944
2084
  onClick: () => callbacks.onThemeChange?.("dark"),
1945
2085
  className: currentTheme === "dark" ? "bg-accent" : "",
1946
2086
  children: [
1947
- /* @__PURE__ */ jsx15(Moon, { className: "mr-2 h-4 w-4" }),
1948
- /* @__PURE__ */ jsx15("span", { children: labels.darkMode })
2087
+ /* @__PURE__ */ jsx16(Moon, { className: "mr-2 h-4 w-4" }),
2088
+ /* @__PURE__ */ jsx16("span", { children: labels.darkMode })
1949
2089
  ]
1950
2090
  }
1951
2091
  ),
@@ -1955,22 +2095,22 @@ var UserMenu = ({
1955
2095
  onClick: () => callbacks.onThemeChange?.("system"),
1956
2096
  className: currentTheme === "system" ? "bg-accent" : "",
1957
2097
  children: [
1958
- /* @__PURE__ */ jsx15(Palette, { className: "mr-2 h-4 w-4" }),
1959
- /* @__PURE__ */ jsx15("span", { children: labels.systemTheme })
2098
+ /* @__PURE__ */ jsx16(Palette, { className: "mr-2 h-4 w-4" }),
2099
+ /* @__PURE__ */ jsx16("span", { children: labels.systemTheme })
1960
2100
  ]
1961
2101
  }
1962
2102
  )
1963
2103
  ] }),
1964
2104
  callbacks?.onLogout && /* @__PURE__ */ jsxs8(Fragment2, { children: [
1965
- /* @__PURE__ */ jsx15(DropdownMenuSeparator, {}),
2105
+ /* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
1966
2106
  /* @__PURE__ */ jsxs8(
1967
2107
  DropdownMenuItem,
1968
2108
  {
1969
2109
  onClick: callbacks.onLogout,
1970
2110
  className: "text-destructive focus:text-destructive focus:bg-destructive/10",
1971
2111
  children: [
1972
- /* @__PURE__ */ jsx15(LogOut, { className: "mr-2 h-4 w-4" }),
1973
- /* @__PURE__ */ jsx15("span", { children: labels.logout })
2112
+ /* @__PURE__ */ jsx16(LogOut, { className: "mr-2 h-4 w-4" }),
2113
+ /* @__PURE__ */ jsx16("span", { children: labels.logout })
1974
2114
  ]
1975
2115
  }
1976
2116
  )
@@ -1982,7 +2122,7 @@ var UserMenu = ({
1982
2122
  };
1983
2123
 
1984
2124
  // src/components/chat/Sidebar.tsx
1985
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
2125
+ import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
1986
2126
  var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
1987
2127
  const [title, setTitle] = useState4("");
1988
2128
  const [isOpen, setIsOpen] = useState4(false);
@@ -1992,16 +2132,16 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
1992
2132
  setIsOpen(false);
1993
2133
  };
1994
2134
  return /* @__PURE__ */ jsxs9(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
1995
- /* @__PURE__ */ jsx16(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ jsxs9(Button, { className: "w-full justify-start", variant: "outline", children: [
1996
- /* @__PURE__ */ jsx16(Plus, { className: "mr-2 h-4 w-4" }),
2135
+ /* @__PURE__ */ jsx17(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ jsxs9(Button, { className: "w-full justify-start", variant: "outline", children: [
2136
+ /* @__PURE__ */ jsx17(Plus, { className: "mr-2 h-4 w-4" }),
1997
2137
  config.labels?.newChat || "New Chat"
1998
2138
  ] }) }),
1999
2139
  /* @__PURE__ */ jsxs9(DialogContent, { children: [
2000
2140
  /* @__PURE__ */ jsxs9(DialogHeader, { children: [
2001
- /* @__PURE__ */ jsx16(DialogTitle, { children: config.labels?.createNewThread || "New Conversation" }),
2002
- /* @__PURE__ */ jsx16(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
2141
+ /* @__PURE__ */ jsx17(DialogTitle, { children: config.labels?.createNewThread || "New Conversation" }),
2142
+ /* @__PURE__ */ jsx17(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
2003
2143
  ] }),
2004
- /* @__PURE__ */ jsx16(
2144
+ /* @__PURE__ */ jsx17(
2005
2145
  Input,
2006
2146
  {
2007
2147
  value: title,
@@ -2012,15 +2152,15 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
2012
2152
  }
2013
2153
  ),
2014
2154
  /* @__PURE__ */ jsxs9(DialogFooter, { children: [
2015
- /* @__PURE__ */ jsx16(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config.labels?.cancel || "Cancel" }),
2016
- /* @__PURE__ */ jsx16(Button, { onClick: handleCreate, children: config.labels?.create || "Create" })
2155
+ /* @__PURE__ */ jsx17(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config.labels?.cancel || "Cancel" }),
2156
+ /* @__PURE__ */ jsx17(Button, { onClick: handleCreate, children: config.labels?.create || "Create" })
2017
2157
  ] })
2018
2158
  ] })
2019
2159
  ] });
2020
2160
  };
2021
2161
  var ThreadInitialsIcon = ({ title }) => {
2022
2162
  const initials = title?.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase() || "?";
2023
- return /* @__PURE__ */ jsx16("div", { className: "flex shrink-0 items-center justify-center rounded bg-muted text-[10px] font-medium", children: initials });
2163
+ return /* @__PURE__ */ jsx17("div", { className: "flex shrink-0 items-center justify-center rounded bg-muted text-[10px] font-medium", children: initials });
2024
2164
  };
2025
2165
  var Sidebar2 = ({
2026
2166
  threads,
@@ -2044,9 +2184,9 @@ var Sidebar2 = ({
2044
2184
  const [deleteThreadId, setDeleteThreadId] = useState4(null);
2045
2185
  const [editingThreadId, setEditingThreadId] = useState4(null);
2046
2186
  const [editTitle, setEditTitle] = useState4("");
2047
- const inputRef = useRef2(null);
2187
+ const inputRef = useRef5(null);
2048
2188
  const { setOpen } = useSidebar();
2049
- useEffect4(() => {
2189
+ useEffect7(() => {
2050
2190
  if (editingThreadId && inputRef.current) {
2051
2191
  inputRef.current.focus();
2052
2192
  inputRef.current.select();
@@ -2099,29 +2239,36 @@ var Sidebar2 = ({
2099
2239
  };
2100
2240
  return /* @__PURE__ */ jsxs9(Sidebar, { collapsible: "icon", ...props, children: [
2101
2241
  /* @__PURE__ */ jsxs9(SidebarHeader, { children: [
2102
- onCreateThread && /* @__PURE__ */ jsx16(
2242
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3 px-2 py-3", children: [
2243
+ /* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center shrink-0", children: config.branding?.logo || /* @__PURE__ */ jsx17(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ jsx17(AvatarFallback, { className: "bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx17(Bot, { className: "h-4 w-4" }) }) }) }),
2244
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
2245
+ /* @__PURE__ */ jsx17("span", { className: "text-sm font-semibold truncate", children: config.branding?.title || "Chat" }),
2246
+ config.branding?.subtitle && /* @__PURE__ */ jsx17("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
2247
+ ] })
2248
+ ] }),
2249
+ onCreateThread && /* @__PURE__ */ jsx17(
2103
2250
  CreateThreadDialog,
2104
2251
  {
2105
2252
  config,
2106
2253
  onCreateThread,
2107
- trigger: /* @__PURE__ */ jsx16(SidebarMenu, { children: /* @__PURE__ */ jsx16(SidebarMenuItem, { children: /* @__PURE__ */ jsxs9(
2254
+ trigger: /* @__PURE__ */ jsx17(SidebarMenu, { children: /* @__PURE__ */ jsx17(SidebarMenuItem, { children: /* @__PURE__ */ jsxs9(
2108
2255
  SidebarMenuButton,
2109
2256
  {
2110
2257
  size: "lg",
2111
2258
  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",
2112
2259
  tooltip: config.labels?.newChat || "New Chat",
2113
2260
  children: [
2114
- /* @__PURE__ */ jsx16(Plus, { className: "size-4" }),
2115
- /* @__PURE__ */ jsx16("span", { className: "group-data-[collapsible=icon]:hidden", children: config.labels?.newChat || "New Chat" })
2261
+ /* @__PURE__ */ jsx17(Plus, { className: "size-4" }),
2262
+ /* @__PURE__ */ jsx17("span", { className: "group-data-[collapsible=icon]:hidden", children: config.labels?.newChat || "New Chat" })
2116
2263
  ]
2117
2264
  }
2118
2265
  ) }) })
2119
2266
  }
2120
2267
  ),
2121
- /* @__PURE__ */ jsxs9("div", { className: "px-2 py-1 mt-6", children: [
2268
+ /* @__PURE__ */ jsxs9("div", { className: "px-2 py-1 mt-4", children: [
2122
2269
  /* @__PURE__ */ jsxs9("div", { className: "relative group-data-[collapsible=icon]:hidden", children: [
2123
- /* @__PURE__ */ jsx16(Search, { className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 select-none opacity-50" }),
2124
- /* @__PURE__ */ jsx16(
2270
+ /* @__PURE__ */ jsx17(Search, { className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 select-none opacity-50" }),
2271
+ /* @__PURE__ */ jsx17(
2125
2272
  Input,
2126
2273
  {
2127
2274
  className: "pl-8 h-8 bg-sidebar-accent/50 border-sidebar-border focus-visible:ring-1 focus-visible:ring-sidebar-ring",
@@ -2131,7 +2278,7 @@ var Sidebar2 = ({
2131
2278
  }
2132
2279
  )
2133
2280
  ] }),
2134
- /* @__PURE__ */ jsx16("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ jsx16(
2281
+ /* @__PURE__ */ jsx17("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ jsx17(
2135
2282
  Button,
2136
2283
  {
2137
2284
  variant: "ghost",
@@ -2139,13 +2286,13 @@ var Sidebar2 = ({
2139
2286
  className: "h-7 w-7",
2140
2287
  onClick: () => setOpen(true),
2141
2288
  title: config.labels?.search || "Search",
2142
- children: /* @__PURE__ */ jsx16(Search, { className: "h-4 w-4" })
2289
+ children: /* @__PURE__ */ jsx17(Search, { className: "h-4 w-4" })
2143
2290
  }
2144
2291
  ) })
2145
2292
  ] })
2146
2293
  ] }),
2147
2294
  /* @__PURE__ */ jsxs9(SidebarContent, { children: [
2148
- threads.some((t) => t.isArchived) && /* @__PURE__ */ jsx16("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsxs9(
2295
+ threads.some((t) => t.isArchived) && /* @__PURE__ */ jsx17("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsxs9(
2149
2296
  Button,
2150
2297
  {
2151
2298
  variant: "ghost",
@@ -2153,18 +2300,18 @@ var Sidebar2 = ({
2153
2300
  onClick: () => setShowArchived(!showArchived),
2154
2301
  className: "h-6 text-xs w-full justify-start text-muted-foreground",
2155
2302
  children: [
2156
- /* @__PURE__ */ jsx16(Filter, { className: "mr-2 h-3 w-3" }),
2303
+ /* @__PURE__ */ jsx17(Filter, { className: "mr-2 h-3 w-3" }),
2157
2304
  showArchived ? config.labels?.hideArchived || "Hide Archived" : config.labels?.showArchived || "Show Archived"
2158
2305
  ]
2159
2306
  }
2160
2307
  ) }),
2161
2308
  Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs9("div", { className: "px-4 py-8 text-center text-muted-foreground group-data-[collapsible=icon]:hidden", children: [
2162
- /* @__PURE__ */ jsx16("div", { className: "mx-auto h-8 w-8 mb-2 flex items-center justify-center rounded-full bg-muted/50", children: /* @__PURE__ */ jsx16(Plus, { className: "h-4 w-4 opacity-50" }) }),
2163
- /* @__PURE__ */ jsx16("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
2309
+ /* @__PURE__ */ jsx17("div", { className: "mx-auto h-8 w-8 mb-2 flex items-center justify-center rounded-full bg-muted/50", children: /* @__PURE__ */ jsx17(Plus, { className: "h-4 w-4 opacity-50" }) }),
2310
+ /* @__PURE__ */ jsx17("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
2164
2311
  ] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs9(SidebarGroup, { className: "mt-2", children: [
2165
- /* @__PURE__ */ jsx16(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: group }),
2166
- /* @__PURE__ */ jsx16(SidebarGroupContent, { children: /* @__PURE__ */ jsx16(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */ jsxs9(SidebarMenuItem, { children: [
2167
- editingThreadId === thread.id ? /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-1 px-2 py-1", children: /* @__PURE__ */ jsx16(
2312
+ /* @__PURE__ */ jsx17(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: group }),
2313
+ /* @__PURE__ */ jsx17(SidebarGroupContent, { children: /* @__PURE__ */ jsx17(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */ jsxs9(SidebarMenuItem, { children: [
2314
+ editingThreadId === thread.id ? /* @__PURE__ */ jsx17("div", { className: "flex items-center gap-1 px-2 py-1", children: /* @__PURE__ */ jsx17(
2168
2315
  Input,
2169
2316
  {
2170
2317
  ref: inputRef,
@@ -2184,35 +2331,35 @@ var Sidebar2 = ({
2184
2331
  onClick: () => onSelectThread?.(thread.id),
2185
2332
  tooltip: thread.title,
2186
2333
  children: [
2187
- /* @__PURE__ */ jsx16(ThreadInitialsIcon, { title: thread.title || "?" }),
2188
- /* @__PURE__ */ jsx16("div", { className: "flex flex-col items-start gap-0.5 flex-1 min-w-0 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsx16("span", { className: "truncate w-full", children: thread.title || "New Chat" }) }),
2189
- thread.isArchived && /* @__PURE__ */ jsx16(Archive, { className: "ml-auto h-3 w-3 opacity-50 group-data-[collapsible=icon]:hidden" })
2334
+ /* @__PURE__ */ jsx17(ThreadInitialsIcon, { title: thread.title || "?" }),
2335
+ /* @__PURE__ */ jsx17("div", { className: "flex flex-col items-start gap-0.5 flex-1 min-w-0 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsx17("span", { className: "truncate w-full", children: thread.title || "New Chat" }) }),
2336
+ thread.isArchived && /* @__PURE__ */ jsx17(Archive, { className: "ml-auto h-3 w-3 opacity-50 group-data-[collapsible=icon]:hidden" })
2190
2337
  ]
2191
2338
  }
2192
2339
  ),
2193
2340
  !editingThreadId && /* @__PURE__ */ jsxs9(DropdownMenu, { children: [
2194
- /* @__PURE__ */ jsx16(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(SidebarMenuAction, { showOnHover: true, children: [
2195
- /* @__PURE__ */ jsx16(MoreHorizontal, {}),
2196
- /* @__PURE__ */ jsx16("span", { className: "sr-only", children: "More" })
2341
+ /* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(SidebarMenuAction, { showOnHover: true, children: [
2342
+ /* @__PURE__ */ jsx17(MoreHorizontal, {}),
2343
+ /* @__PURE__ */ jsx17("span", { className: "sr-only", children: "More" })
2197
2344
  ] }) }),
2198
2345
  /* @__PURE__ */ jsxs9(DropdownMenuContent, { className: "w-48", side: "right", align: "start", children: [
2199
2346
  /* @__PURE__ */ jsxs9(DropdownMenuItem, { onClick: () => startEditing(thread), children: [
2200
- /* @__PURE__ */ jsx16(Edit2, { className: "mr-2 h-4 w-4" }),
2201
- /* @__PURE__ */ jsx16("span", { children: config.labels?.renameThread || "Rename" })
2347
+ /* @__PURE__ */ jsx17(Edit2, { className: "mr-2 h-4 w-4" }),
2348
+ /* @__PURE__ */ jsx17("span", { children: config.labels?.renameThread || "Rename" })
2202
2349
  ] }),
2203
2350
  /* @__PURE__ */ jsxs9(DropdownMenuItem, { onClick: () => onArchiveThread?.(thread.id), children: [
2204
- /* @__PURE__ */ jsx16(Archive, { className: "mr-2 h-4 w-4" }),
2205
- /* @__PURE__ */ jsx16("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
2351
+ /* @__PURE__ */ jsx17(Archive, { className: "mr-2 h-4 w-4" }),
2352
+ /* @__PURE__ */ jsx17("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
2206
2353
  ] }),
2207
- /* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
2354
+ /* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
2208
2355
  /* @__PURE__ */ jsxs9(
2209
2356
  DropdownMenuItem,
2210
2357
  {
2211
2358
  onClick: () => setDeleteThreadId(thread.id),
2212
2359
  className: "text-destructive focus:text-destructive",
2213
2360
  children: [
2214
- /* @__PURE__ */ jsx16(Trash2, { className: "mr-2 h-4 w-4" }),
2215
- /* @__PURE__ */ jsx16("span", { children: config.labels?.deleteThread || "Delete" })
2361
+ /* @__PURE__ */ jsx17(Trash2, { className: "mr-2 h-4 w-4" }),
2362
+ /* @__PURE__ */ jsx17("span", { children: config.labels?.deleteThread || "Delete" })
2216
2363
  ]
2217
2364
  }
2218
2365
  )
@@ -2221,7 +2368,7 @@ var Sidebar2 = ({
2221
2368
  ] }, thread.id)) }) })
2222
2369
  ] }, group))
2223
2370
  ] }),
2224
- /* @__PURE__ */ jsx16(SidebarFooter, { children: /* @__PURE__ */ jsx16(
2371
+ /* @__PURE__ */ jsx17(SidebarFooter, { children: /* @__PURE__ */ jsx17(
2225
2372
  UserMenu,
2226
2373
  {
2227
2374
  user,
@@ -2232,15 +2379,15 @@ var Sidebar2 = ({
2232
2379
  additionalItems: userMenuAdditionalItems
2233
2380
  }
2234
2381
  ) }),
2235
- /* @__PURE__ */ jsx16(SidebarRail, {}),
2236
- /* @__PURE__ */ jsx16(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs9(AlertDialogContent, { children: [
2382
+ /* @__PURE__ */ jsx17(SidebarRail, {}),
2383
+ deleteThreadId && /* @__PURE__ */ jsx17(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs9(AlertDialogContent, { children: [
2237
2384
  /* @__PURE__ */ jsxs9(AlertDialogHeader, { children: [
2238
- /* @__PURE__ */ jsx16(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
2239
- /* @__PURE__ */ jsx16(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
2385
+ /* @__PURE__ */ jsx17(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
2386
+ /* @__PURE__ */ jsx17(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
2240
2387
  ] }),
2241
2388
  /* @__PURE__ */ jsxs9(AlertDialogFooter, { children: [
2242
- /* @__PURE__ */ jsx16(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
2243
- /* @__PURE__ */ jsx16(
2389
+ /* @__PURE__ */ jsx17(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
2390
+ /* @__PURE__ */ jsx17(
2244
2391
  AlertDialogAction,
2245
2392
  {
2246
2393
  onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
@@ -2254,9 +2401,9 @@ var Sidebar2 = ({
2254
2401
  };
2255
2402
 
2256
2403
  // src/components/chat/ChatHeader.tsx
2257
- import React5 from "react";
2404
+ import React8 from "react";
2258
2405
  import {
2259
- Bot,
2406
+ Bot as Bot2,
2260
2407
  MoreVertical,
2261
2408
  Download,
2262
2409
  Upload,
@@ -2264,9 +2411,11 @@ import {
2264
2411
  Plus as Plus2,
2265
2412
  Menu,
2266
2413
  Moon as Moon2,
2267
- Sun as Sun2
2414
+ Sun as Sun2,
2415
+ ChevronDown as ChevronDown2,
2416
+ Check as Check2
2268
2417
  } from "lucide-react";
2269
- import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
2418
+ import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
2270
2419
  var ChatHeader = ({
2271
2420
  config,
2272
2421
  currentThreadTitle,
@@ -2278,13 +2427,17 @@ var ChatHeader = ({
2278
2427
  onClearAll,
2279
2428
  showCustomComponentButton,
2280
2429
  isMobile,
2430
+ showAgentSelector = false,
2431
+ agentOptions = [],
2432
+ selectedAgentId = null,
2433
+ onSelectAgent,
2281
2434
  className = ""
2282
2435
  }) => {
2283
- const [isDarkMode, setIsDarkMode] = React5.useState(() => {
2436
+ const [isDarkMode, setIsDarkMode] = React8.useState(() => {
2284
2437
  if (typeof window === "undefined") return false;
2285
2438
  return document.documentElement.classList.contains("dark");
2286
2439
  });
2287
- React5.useEffect(() => {
2440
+ React8.useEffect(() => {
2288
2441
  const observer = new MutationObserver(() => {
2289
2442
  setIsDarkMode(document.documentElement.classList.contains("dark"));
2290
2443
  });
@@ -2328,72 +2481,114 @@ var ChatHeader = ({
2328
2481
  };
2329
2482
  input.click();
2330
2483
  };
2331
- return /* @__PURE__ */ jsx17(
2484
+ const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
2485
+ const agentPlaceholder = config.agentSelector?.label || "Select agent";
2486
+ return /* @__PURE__ */ jsx18(
2332
2487
  Card,
2333
2488
  {
2334
2489
  "data-chat-header": true,
2335
2490
  className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
2336
2491
  style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
2337
- children: /* @__PURE__ */ jsx17(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
2338
- /* @__PURE__ */ jsx17("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs10(Tooltip, { children: [
2339
- /* @__PURE__ */ jsx17(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx17(SidebarTrigger, { className: "-ml-1" }) }),
2340
- /* @__PURE__ */ jsx17(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
2341
- ] }) }),
2342
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3 flex-1 justify-center", children: [
2343
- config.branding?.logo || /* @__PURE__ */ jsx17(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ jsx17(AvatarFallback, { children: /* @__PURE__ */ jsx17(Bot, { className: "h-4 w-4" }) }) }),
2344
- /* @__PURE__ */ jsx17("div", { className: "text-center hidden md:block", children: /* @__PURE__ */ jsx17(CardTitle, { className: "text-sm font-medium", children: config.branding?.title || "Chat Assistant" }) }),
2345
- /* @__PURE__ */ jsx17("div", { className: "md:hidden text-sm font-medium truncate max-w-[150px]", children: currentThreadTitle || config.branding?.title || "Chat" })
2492
+ children: /* @__PURE__ */ jsx18(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-2", children: [
2493
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2494
+ /* @__PURE__ */ jsxs10(Tooltip, { children: [
2495
+ /* @__PURE__ */ jsx18(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(SidebarTrigger, { className: "-ml-1" }) }),
2496
+ /* @__PURE__ */ jsx18(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
2497
+ ] }),
2498
+ showAgentSelector && /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
2499
+ /* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
2500
+ Button,
2501
+ {
2502
+ variant: "ghost",
2503
+ className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
2504
+ children: [
2505
+ selectedAgent?.avatarUrl ? /* @__PURE__ */ jsxs10(Avatar, { className: "h-5 w-5", children: [
2506
+ /* @__PURE__ */ jsx18(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
2507
+ /* @__PURE__ */ jsx18(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
2508
+ ] }) : null,
2509
+ /* @__PURE__ */ jsx18("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
2510
+ /* @__PURE__ */ jsx18(ChevronDown2, { className: "h-4 w-4 opacity-50" })
2511
+ ]
2512
+ }
2513
+ ) }),
2514
+ /* @__PURE__ */ jsx18(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
2515
+ const isSelected = agent.id === selectedAgentId;
2516
+ return /* @__PURE__ */ jsxs10(
2517
+ DropdownMenuItem,
2518
+ {
2519
+ onClick: () => onSelectAgent?.(agent.id),
2520
+ className: "flex items-start gap-3 p-3 cursor-pointer",
2521
+ children: [
2522
+ agent.avatarUrl ? /* @__PURE__ */ jsxs10(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
2523
+ /* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2524
+ /* @__PURE__ */ jsx18(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
2525
+ ] }) : /* @__PURE__ */ jsx18("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx18(Bot2, { className: "h-3.5 w-3.5 text-primary" }) }),
2526
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
2527
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
2528
+ /* @__PURE__ */ jsx18("span", { className: "font-medium text-sm", children: agent.name }),
2529
+ isSelected && /* @__PURE__ */ jsx18(Check2, { className: "h-4 w-4 text-primary shrink-0" })
2530
+ ] }),
2531
+ agent.description && /* @__PURE__ */ jsx18("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
2532
+ ] })
2533
+ ]
2534
+ },
2535
+ agent.id
2536
+ );
2537
+ }) })
2538
+ ] }),
2539
+ !showAgentSelector && isMobile && /* @__PURE__ */ jsx18("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
2346
2540
  ] }),
2541
+ /* @__PURE__ */ jsx18("div", { className: "flex-1" }),
2347
2542
  /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2348
2543
  showCustomComponentButton && config.customComponent && /* @__PURE__ */ jsxs10(Tooltip, { children: [
2349
- /* @__PURE__ */ jsx17(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx17(
2544
+ /* @__PURE__ */ jsx18(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(
2350
2545
  Button,
2351
2546
  {
2352
2547
  variant: "ghost",
2353
2548
  size: "icon",
2354
2549
  className: "h-8 w-8",
2355
2550
  onClick: onCustomComponentToggle,
2356
- children: config.customComponent.icon || /* @__PURE__ */ jsx17(Menu, { className: "h-4 w-4" })
2551
+ children: config.customComponent.icon || /* @__PURE__ */ jsx18(Menu, { className: "h-4 w-4" })
2357
2552
  }
2358
2553
  ) }),
2359
- /* @__PURE__ */ jsx17(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
2554
+ /* @__PURE__ */ jsx18(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
2360
2555
  ] }),
2361
2556
  config.headerActions,
2362
2557
  /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
2363
- /* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx17(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx17(MoreVertical, { className: "h-4 w-4" }) }) }),
2558
+ /* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx18(MoreVertical, { className: "h-4 w-4" }) }) }),
2364
2559
  /* @__PURE__ */ jsxs10(DropdownMenuContent, { align: "end", children: [
2365
2560
  onNewThread && /* @__PURE__ */ jsxs10(Fragment3, { children: [
2366
2561
  /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
2367
- /* @__PURE__ */ jsx17(Plus2, { className: "h-4 w-4 mr-2" }),
2562
+ /* @__PURE__ */ jsx18(Plus2, { className: "h-4 w-4 mr-2" }),
2368
2563
  config.labels?.newThread || "New Thread"
2369
2564
  ] }),
2370
- /* @__PURE__ */ jsx17(DropdownMenuSeparator, {})
2565
+ /* @__PURE__ */ jsx18(DropdownMenuSeparator, {})
2371
2566
  ] }),
2372
2567
  onExportData && /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: onExportData, children: [
2373
- /* @__PURE__ */ jsx17(Download, { className: "h-4 w-4 mr-2" }),
2568
+ /* @__PURE__ */ jsx18(Download, { className: "h-4 w-4 mr-2" }),
2374
2569
  config.labels?.exportData || "Export Data"
2375
2570
  ] }),
2376
2571
  onImportData && /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: handleImportClick, children: [
2377
- /* @__PURE__ */ jsx17(Upload, { className: "h-4 w-4 mr-2" }),
2572
+ /* @__PURE__ */ jsx18(Upload, { className: "h-4 w-4 mr-2" }),
2378
2573
  config.labels?.importData || "Import Data"
2379
2574
  ] }),
2380
- (onExportData || onImportData) && /* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
2381
- /* @__PURE__ */ jsx17(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
2382
- /* @__PURE__ */ jsx17(Sun2, { className: "h-4 w-4 mr-2" }),
2575
+ (onExportData || onImportData) && /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
2576
+ /* @__PURE__ */ jsx18(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
2577
+ /* @__PURE__ */ jsx18(Sun2, { className: "h-4 w-4 mr-2" }),
2383
2578
  config.labels?.lightMode || "Light Mode"
2384
2579
  ] }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
2385
- /* @__PURE__ */ jsx17(Moon2, { className: "h-4 w-4 mr-2" }),
2580
+ /* @__PURE__ */ jsx18(Moon2, { className: "h-4 w-4 mr-2" }),
2386
2581
  config.labels?.darkMode || "Dark Mode"
2387
2582
  ] }) }),
2388
2583
  onClearAll && /* @__PURE__ */ jsxs10(Fragment3, { children: [
2389
- /* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
2584
+ /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
2390
2585
  /* @__PURE__ */ jsxs10(
2391
2586
  DropdownMenuItem,
2392
2587
  {
2393
2588
  onClick: onClearAll,
2394
2589
  className: "text-destructive",
2395
2590
  children: [
2396
- /* @__PURE__ */ jsx17(Trash22, { className: "h-4 w-4 mr-2" }),
2591
+ /* @__PURE__ */ jsx18(Trash22, { className: "h-4 w-4 mr-2" }),
2397
2592
  config.labels?.clearAll || "Clear All"
2398
2593
  ]
2399
2594
  }
@@ -2408,18 +2603,18 @@ var ChatHeader = ({
2408
2603
  };
2409
2604
 
2410
2605
  // src/components/chat/ChatInput.tsx
2411
- import { useState as useState6, useRef as useRef3, useCallback as useCallback3, useEffect as useEffect6 } from "react";
2606
+ import { useState as useState6, useRef as useRef6, useCallback as useCallback3, useEffect as useEffect9, memo as memo2 } from "react";
2412
2607
 
2413
2608
  // src/components/chat/UserContext.tsx
2414
- import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo2, useState as useState5 } from "react";
2415
- import { jsx as jsx18 } from "react/jsx-runtime";
2609
+ import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect8, useMemo as useMemo2, useState as useState5 } from "react";
2610
+ import { jsx as jsx19 } from "react/jsx-runtime";
2416
2611
  var Ctx = createContext2(void 0);
2417
2612
  var ChatUserContextProvider = ({ children, initial }) => {
2418
2613
  const [ctx, setCtx] = useState5(() => ({
2419
2614
  updatedAt: Date.now(),
2420
2615
  ...initial ?? {}
2421
2616
  }));
2422
- useEffect5(() => {
2617
+ useEffect8(() => {
2423
2618
  if (!initial) return;
2424
2619
  setCtx((prev) => ({
2425
2620
  ...prev,
@@ -2438,7 +2633,7 @@ var ChatUserContextProvider = ({ children, initial }) => {
2438
2633
  setContext: setPartial,
2439
2634
  resetContext: () => setCtx({ updatedAt: Date.now() })
2440
2635
  }), [ctx, setPartial]);
2441
- return /* @__PURE__ */ jsx18(Ctx.Provider, { value, children });
2636
+ return /* @__PURE__ */ jsx19(Ctx.Provider, { value, children });
2442
2637
  };
2443
2638
  function useChatUserContext() {
2444
2639
  const v = useContext2(Ctx);
@@ -2448,13 +2643,13 @@ function useChatUserContext() {
2448
2643
 
2449
2644
  // src/components/ui/progress.tsx
2450
2645
  import * as ProgressPrimitive from "@radix-ui/react-progress";
2451
- import { jsx as jsx19 } from "react/jsx-runtime";
2646
+ import { jsx as jsx20 } from "react/jsx-runtime";
2452
2647
  function Progress({
2453
2648
  className,
2454
2649
  value,
2455
2650
  ...props
2456
2651
  }) {
2457
- return /* @__PURE__ */ jsx19(
2652
+ return /* @__PURE__ */ jsx20(
2458
2653
  ProgressPrimitive.Root,
2459
2654
  {
2460
2655
  "data-slot": "progress",
@@ -2463,7 +2658,7 @@ function Progress({
2463
2658
  className
2464
2659
  ),
2465
2660
  ...props,
2466
- children: /* @__PURE__ */ jsx19(
2661
+ children: /* @__PURE__ */ jsx20(
2467
2662
  ProgressPrimitive.Indicator,
2468
2663
  {
2469
2664
  "data-slot": "progress-indicator",
@@ -2489,8 +2684,8 @@ import {
2489
2684
  Pause as Pause2,
2490
2685
  Loader2
2491
2686
  } from "lucide-react";
2492
- import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
2493
- var FileUploadItem = ({ file, progress, onCancel }) => {
2687
+ import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
2688
+ var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }) {
2494
2689
  const guessTypeFromName = (name) => {
2495
2690
  const ext = (name || "").split(".").pop()?.toLowerCase();
2496
2691
  switch (ext) {
@@ -2518,10 +2713,10 @@ var FileUploadItem = ({ file, progress, onCancel }) => {
2518
2713
  };
2519
2714
  const getFileIcon = (type, name) => {
2520
2715
  const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
2521
- if (t.startsWith("image/")) return /* @__PURE__ */ jsx20(Image2, { className: "h-4 w-4" });
2522
- if (t.startsWith("video/")) return /* @__PURE__ */ jsx20(Video, { className: "h-4 w-4" });
2523
- if (t.startsWith("audio/")) return /* @__PURE__ */ jsx20(Mic, { className: "h-4 w-4" });
2524
- return /* @__PURE__ */ jsx20(FileText, { className: "h-4 w-4" });
2716
+ if (t.startsWith("image/")) return /* @__PURE__ */ jsx21(Image2, { className: "h-4 w-4" });
2717
+ if (t.startsWith("video/")) return /* @__PURE__ */ jsx21(Video, { className: "h-4 w-4" });
2718
+ if (t.startsWith("audio/")) return /* @__PURE__ */ jsx21(Mic, { className: "h-4 w-4" });
2719
+ return /* @__PURE__ */ jsx21(FileText, { className: "h-4 w-4" });
2525
2720
  };
2526
2721
  const formatFileSize = (bytes) => {
2527
2722
  if (bytes === 0) return "0 Bytes";
@@ -2530,28 +2725,28 @@ var FileUploadItem = ({ file, progress, onCancel }) => {
2530
2725
  const i = Math.floor(Math.log(bytes) / Math.log(k));
2531
2726
  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
2532
2727
  };
2533
- return /* @__PURE__ */ jsx20(Card, { className: "relative", children: /* @__PURE__ */ jsx20(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3", children: [
2728
+ return /* @__PURE__ */ jsx21(Card, { className: "relative", children: /* @__PURE__ */ jsx21(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3", children: [
2534
2729
  getFileIcon(file.type, file.name),
2535
2730
  /* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
2536
- /* @__PURE__ */ jsx20("p", { className: "text-sm font-medium truncate", children: file.name }),
2537
- /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
2538
- /* @__PURE__ */ jsx20(Progress, { value: progress, className: "h-1 mt-1" })
2731
+ /* @__PURE__ */ jsx21("p", { className: "text-sm font-medium truncate", children: file.name }),
2732
+ /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
2733
+ /* @__PURE__ */ jsx21(Progress, { value: progress, className: "h-1 mt-1" })
2539
2734
  ] }),
2540
- /* @__PURE__ */ jsx20(
2735
+ /* @__PURE__ */ jsx21(
2541
2736
  Button,
2542
2737
  {
2543
2738
  variant: "ghost",
2544
2739
  size: "icon",
2545
2740
  className: "h-6 w-6",
2546
2741
  onClick: onCancel,
2547
- children: /* @__PURE__ */ jsx20(X2, { className: "h-3 w-3" })
2742
+ children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
2548
2743
  }
2549
2744
  )
2550
2745
  ] }) }) });
2551
- };
2552
- var AttachmentPreview = ({ attachment, onRemove }) => {
2746
+ });
2747
+ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove }) {
2553
2748
  const [isPlaying, setIsPlaying] = useState6(false);
2554
- const audioRef = useRef3(null);
2749
+ const audioRef = useRef6(null);
2555
2750
  const handlePlayPause = () => {
2556
2751
  if (audioRef.current) {
2557
2752
  if (isPlaying) {
@@ -2568,9 +2763,9 @@ var AttachmentPreview = ({ attachment, onRemove }) => {
2568
2763
  const minutes = Math.floor(seconds / 60);
2569
2764
  return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
2570
2765
  };
2571
- return /* @__PURE__ */ jsx20(Card, { className: "relative group", children: /* @__PURE__ */ jsxs11(CardContent, { className: "p-2", children: [
2766
+ return /* @__PURE__ */ jsx21(Card, { className: "relative group", children: /* @__PURE__ */ jsxs11(CardContent, { className: "p-2", children: [
2572
2767
  attachment.kind === "image" && /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
2573
- /* @__PURE__ */ jsx20(
2768
+ /* @__PURE__ */ jsx21(
2574
2769
  "img",
2575
2770
  {
2576
2771
  src: attachment.dataUrl,
@@ -2578,19 +2773,19 @@ var AttachmentPreview = ({ attachment, onRemove }) => {
2578
2773
  className: "w-full h-20 object-cover rounded"
2579
2774
  }
2580
2775
  ),
2581
- /* @__PURE__ */ jsx20("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx20(
2776
+ /* @__PURE__ */ jsx21("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx21(
2582
2777
  Button,
2583
2778
  {
2584
2779
  variant: "destructive",
2585
2780
  size: "icon",
2586
2781
  className: "h-6 w-6",
2587
2782
  onClick: onRemove,
2588
- children: /* @__PURE__ */ jsx20(X2, { className: "h-3 w-3" })
2783
+ children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
2589
2784
  }
2590
2785
  ) })
2591
2786
  ] }),
2592
2787
  attachment.kind === "video" && /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
2593
- /* @__PURE__ */ jsx20(
2788
+ /* @__PURE__ */ jsx21(
2594
2789
  "video",
2595
2790
  {
2596
2791
  src: attachment.dataUrl,
@@ -2599,34 +2794,34 @@ var AttachmentPreview = ({ attachment, onRemove }) => {
2599
2794
  muted: true
2600
2795
  }
2601
2796
  ),
2602
- /* @__PURE__ */ jsx20("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx20(
2797
+ /* @__PURE__ */ jsx21("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx21(
2603
2798
  Button,
2604
2799
  {
2605
2800
  variant: "destructive",
2606
2801
  size: "icon",
2607
2802
  className: "h-6 w-6",
2608
2803
  onClick: onRemove,
2609
- children: /* @__PURE__ */ jsx20(X2, { className: "h-3 w-3" })
2804
+ children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
2610
2805
  }
2611
2806
  ) }),
2612
- /* @__PURE__ */ jsx20(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration(attachment.durationMs) })
2807
+ /* @__PURE__ */ jsx21(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration(attachment.durationMs) })
2613
2808
  ] }),
2614
2809
  attachment.kind === "audio" && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 p-2", children: [
2615
- /* @__PURE__ */ jsx20(
2810
+ /* @__PURE__ */ jsx21(
2616
2811
  Button,
2617
2812
  {
2618
2813
  variant: "outline",
2619
2814
  size: "icon",
2620
2815
  className: "h-8 w-8",
2621
2816
  onClick: handlePlayPause,
2622
- children: isPlaying ? /* @__PURE__ */ jsx20(Pause2, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx20(Play2, { className: "h-3 w-3" })
2817
+ children: isPlaying ? /* @__PURE__ */ jsx21(Pause2, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx21(Play2, { className: "h-3 w-3" })
2623
2818
  }
2624
2819
  ),
2625
2820
  /* @__PURE__ */ jsxs11("div", { className: "flex-1", children: [
2626
- /* @__PURE__ */ jsx20("p", { className: "text-xs font-medium", children: attachment.fileName || "\xC1udio" }),
2627
- /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: formatDuration(attachment.durationMs) })
2821
+ /* @__PURE__ */ jsx21("p", { className: "text-xs font-medium", children: attachment.fileName || "\xC1udio" }),
2822
+ /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: formatDuration(attachment.durationMs) })
2628
2823
  ] }),
2629
- /* @__PURE__ */ jsx20(
2824
+ /* @__PURE__ */ jsx21(
2630
2825
  "audio",
2631
2826
  {
2632
2827
  ref: audioRef,
@@ -2636,21 +2831,21 @@ var AttachmentPreview = ({ attachment, onRemove }) => {
2636
2831
  onEnded: () => setIsPlaying(false)
2637
2832
  }
2638
2833
  ),
2639
- /* @__PURE__ */ jsx20(
2834
+ /* @__PURE__ */ jsx21(
2640
2835
  Button,
2641
2836
  {
2642
2837
  variant: "ghost",
2643
2838
  size: "icon",
2644
2839
  className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
2645
2840
  onClick: onRemove,
2646
- children: /* @__PURE__ */ jsx20(X2, { className: "h-3 w-3" })
2841
+ children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
2647
2842
  }
2648
2843
  )
2649
2844
  ] }),
2650
- attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ jsx20("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ jsx20("p", { className: "truncate", children: attachment.fileName }) })
2845
+ attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ jsx21("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ jsx21("p", { className: "truncate", children: attachment.fileName }) })
2651
2846
  ] }) });
2652
- };
2653
- var AudioRecorder = ({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) => {
2847
+ });
2848
+ var AudioRecorder = memo2(function AudioRecorder2({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) {
2654
2849
  const formatTime = (seconds) => {
2655
2850
  const mins = Math.floor(seconds / 60);
2656
2851
  const secs = seconds % 60;
@@ -2658,25 +2853,25 @@ var AudioRecorder = ({ isRecording, onStartRecording, onStopRecording, onCancel,
2658
2853
  };
2659
2854
  if (!isRecording) {
2660
2855
  return /* @__PURE__ */ jsxs11(Tooltip, { children: [
2661
- /* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(
2856
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
2662
2857
  Button,
2663
2858
  {
2664
2859
  variant: "outline",
2665
2860
  size: "icon",
2666
2861
  onClick: onStartRecording,
2667
2862
  className: "h-10 w-10",
2668
- children: /* @__PURE__ */ jsx20(Mic, { className: "h-4 w-4" })
2863
+ children: /* @__PURE__ */ jsx21(Mic, { className: "h-4 w-4" })
2669
2864
  }
2670
2865
  ) }),
2671
- /* @__PURE__ */ jsx20(TooltipContent, { children: config?.labels?.recordAudioTooltip })
2866
+ /* @__PURE__ */ jsx21(TooltipContent, { children: config?.labels?.recordAudioTooltip })
2672
2867
  ] });
2673
2868
  }
2674
- return /* @__PURE__ */ jsx20(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ jsx20(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3", children: [
2869
+ return /* @__PURE__ */ jsx21(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ jsx21(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3", children: [
2675
2870
  /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
2676
- /* @__PURE__ */ jsx20("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
2677
- /* @__PURE__ */ jsx20("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: "Gravando" })
2871
+ /* @__PURE__ */ jsx21("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
2872
+ /* @__PURE__ */ jsx21("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: "Gravando" })
2678
2873
  ] }),
2679
- /* @__PURE__ */ jsx20(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
2874
+ /* @__PURE__ */ jsx21(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
2680
2875
  /* @__PURE__ */ jsxs11("div", { className: "flex gap-1 ml-auto", children: [
2681
2876
  /* @__PURE__ */ jsxs11(
2682
2877
  Button,
@@ -2685,7 +2880,7 @@ var AudioRecorder = ({ isRecording, onStartRecording, onStopRecording, onCancel,
2685
2880
  size: "sm",
2686
2881
  onClick: onCancel,
2687
2882
  children: [
2688
- /* @__PURE__ */ jsx20(X2, { className: "h-3 w-3 mr-1" }),
2883
+ /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3 mr-1" }),
2689
2884
  "Cancelar"
2690
2885
  ]
2691
2886
  }
@@ -2697,15 +2892,15 @@ var AudioRecorder = ({ isRecording, onStartRecording, onStopRecording, onCancel,
2697
2892
  size: "sm",
2698
2893
  onClick: onStopRecording,
2699
2894
  children: [
2700
- /* @__PURE__ */ jsx20(Square, { className: "h-3 w-3 mr-1" }),
2895
+ /* @__PURE__ */ jsx21(Square, { className: "h-3 w-3 mr-1" }),
2701
2896
  "Parar"
2702
2897
  ]
2703
2898
  }
2704
2899
  )
2705
2900
  ] })
2706
2901
  ] }) }) });
2707
- };
2708
- var ChatInput = ({
2902
+ });
2903
+ var ChatInput = memo2(function ChatInput2({
2709
2904
  value,
2710
2905
  onChange,
2711
2906
  onSubmit,
@@ -2723,18 +2918,18 @@ var ChatInput = ({
2723
2918
  acceptedFileTypes = ["image/*", "video/*", "audio/*"],
2724
2919
  className = "",
2725
2920
  config
2726
- }) => {
2921
+ }) {
2727
2922
  const [isRecording, setIsRecording] = useState6(false);
2728
2923
  const { setContext } = useChatUserContext();
2729
2924
  const [recordingDuration, setRecordingDuration] = useState6(0);
2730
2925
  const [uploadProgress, setUploadProgress] = useState6(/* @__PURE__ */ new Map());
2731
- const textareaRef = useRef3(null);
2732
- const fileInputRef = useRef3(null);
2733
- const mediaRecorderRef = useRef3(null);
2734
- const recordingStartTime = useRef3(0);
2735
- const recordingInterval = useRef3(null);
2736
- const mediaStreamRef = useRef3(null);
2737
- useEffect6(() => {
2926
+ const textareaRef = useRef6(null);
2927
+ const fileInputRef = useRef6(null);
2928
+ const mediaRecorderRef = useRef6(null);
2929
+ const recordingStartTime = useRef6(0);
2930
+ const recordingInterval = useRef6(null);
2931
+ const mediaStreamRef = useRef6(null);
2932
+ useEffect9(() => {
2738
2933
  return () => {
2739
2934
  if (mediaStreamRef.current) {
2740
2935
  mediaStreamRef.current.getTracks().forEach((track) => track.stop());
@@ -2923,8 +3118,8 @@ var ChatInput = ({
2923
3118
  onAttachmentsChange(newAttachments);
2924
3119
  };
2925
3120
  const canAddMoreAttachments = attachments.length < maxAttachments;
2926
- return /* @__PURE__ */ jsx20(TooltipProvider, { children: /* @__PURE__ */ jsx20("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ jsxs11("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
2927
- uploadProgress.size > 0 && /* @__PURE__ */ jsx20("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx20(
3121
+ return /* @__PURE__ */ jsx21(TooltipProvider, { children: /* @__PURE__ */ jsx21("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ jsxs11("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
3122
+ uploadProgress.size > 0 && /* @__PURE__ */ jsx21("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx21(
2928
3123
  FileUploadItem,
2929
3124
  {
2930
3125
  file: { name: progress.fileName },
@@ -2939,7 +3134,7 @@ var ChatInput = ({
2939
3134
  },
2940
3135
  id
2941
3136
  )) }),
2942
- isRecording && /* @__PURE__ */ jsx20(
3137
+ isRecording && /* @__PURE__ */ jsx21(
2943
3138
  AudioRecorder,
2944
3139
  {
2945
3140
  isRecording,
@@ -2950,7 +3145,7 @@ var ChatInput = ({
2950
3145
  config
2951
3146
  }
2952
3147
  ),
2953
- attachments.length > 0 && /* @__PURE__ */ jsx20("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx20(
3148
+ attachments.length > 0 && /* @__PURE__ */ jsx21("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx21(
2954
3149
  AttachmentPreview,
2955
3150
  {
2956
3151
  attachment,
@@ -2958,7 +3153,7 @@ var ChatInput = ({
2958
3153
  },
2959
3154
  index
2960
3155
  )) }),
2961
- /* @__PURE__ */ jsx20("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs11(
3156
+ /* @__PURE__ */ jsx21("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs11(
2962
3157
  "div",
2963
3158
  {
2964
3159
  className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
@@ -2966,7 +3161,7 @@ var ChatInput = ({
2966
3161
  onDragOver: handleDragOver,
2967
3162
  children: [
2968
3163
  enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ jsxs11(Fragment4, { children: [
2969
- /* @__PURE__ */ jsx20(
3164
+ /* @__PURE__ */ jsx21(
2970
3165
  "input",
2971
3166
  {
2972
3167
  ref: fileInputRef,
@@ -2978,7 +3173,7 @@ var ChatInput = ({
2978
3173
  }
2979
3174
  ),
2980
3175
  /* @__PURE__ */ jsxs11(Tooltip, { children: [
2981
- /* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(
3176
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
2982
3177
  Button,
2983
3178
  {
2984
3179
  type: "button",
@@ -2991,13 +3186,13 @@ var ChatInput = ({
2991
3186
  fileInputRef.current?.click();
2992
3187
  },
2993
3188
  disabled,
2994
- children: /* @__PURE__ */ jsx20(Paperclip, { className: "h-4 w-4" })
3189
+ children: /* @__PURE__ */ jsx21(Paperclip, { className: "h-4 w-4" })
2995
3190
  }
2996
3191
  ) }),
2997
- /* @__PURE__ */ jsx20(TooltipContent, { children: config?.labels?.attachFileTooltip })
3192
+ /* @__PURE__ */ jsx21(TooltipContent, { children: config?.labels?.attachFileTooltip })
2998
3193
  ] })
2999
3194
  ] }),
3000
- /* @__PURE__ */ jsx20("div", { className: "flex-1", children: /* @__PURE__ */ jsx20(
3195
+ /* @__PURE__ */ jsx21("div", { className: "flex-1", children: /* @__PURE__ */ jsx21(
3001
3196
  Textarea,
3002
3197
  {
3003
3198
  ref: textareaRef,
@@ -3010,7 +3205,7 @@ var ChatInput = ({
3010
3205
  rows: 1
3011
3206
  }
3012
3207
  ) }),
3013
- enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ jsx20(
3208
+ enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ jsx21(
3014
3209
  AudioRecorder,
3015
3210
  {
3016
3211
  isRecording,
@@ -3022,7 +3217,7 @@ var ChatInput = ({
3022
3217
  }
3023
3218
  ),
3024
3219
  isGenerating ? /* @__PURE__ */ jsxs11(Tooltip, { children: [
3025
- /* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(
3220
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
3026
3221
  Button,
3027
3222
  {
3028
3223
  type: "button",
@@ -3030,22 +3225,22 @@ var ChatInput = ({
3030
3225
  size: "icon",
3031
3226
  className: "h-10 w-10",
3032
3227
  onClick: onStopGeneration,
3033
- children: /* @__PURE__ */ jsx20(Square, { className: "h-4 w-4" })
3228
+ children: /* @__PURE__ */ jsx21(Square, { className: "h-4 w-4" })
3034
3229
  }
3035
3230
  ) }),
3036
- /* @__PURE__ */ jsx20(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
3231
+ /* @__PURE__ */ jsx21(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
3037
3232
  ] }) : /* @__PURE__ */ jsxs11(Tooltip, { children: [
3038
- /* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(
3233
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
3039
3234
  Button,
3040
3235
  {
3041
3236
  type: "submit",
3042
3237
  size: "icon",
3043
3238
  className: "h-10 w-10",
3044
3239
  disabled: disabled || !value.trim() && attachments.length === 0,
3045
- children: disabled ? /* @__PURE__ */ jsx20(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx20(Send, { className: "h-4 w-4" })
3240
+ children: disabled ? /* @__PURE__ */ jsx21(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx21(Send, { className: "h-4 w-4" })
3046
3241
  }
3047
3242
  ) }),
3048
- /* @__PURE__ */ jsx20(TooltipContent, { children: config?.labels?.sendMessageTooltip })
3243
+ /* @__PURE__ */ jsx21(TooltipContent, { children: config?.labels?.sendMessageTooltip })
3049
3244
  ] })
3050
3245
  ]
3051
3246
  }
@@ -3065,16 +3260,16 @@ var ChatInput = ({
3065
3260
  ] })
3066
3261
  ] })
3067
3262
  ] }) }) });
3068
- };
3263
+ });
3069
3264
 
3070
3265
  // src/components/chat/UserProfile.tsx
3071
3266
  import { useState as useState7 } from "react";
3072
3267
 
3073
3268
  // src/components/ui/scroll-area.tsx
3074
- import * as React8 from "react";
3269
+ import * as React11 from "react";
3075
3270
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
3076
- import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
3077
- var ScrollArea = React8.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
3271
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
3272
+ var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
3078
3273
  return /* @__PURE__ */ jsxs12(
3079
3274
  ScrollAreaPrimitive.Root,
3080
3275
  {
@@ -3082,7 +3277,7 @@ var ScrollArea = React8.forwardRef(({ className, children, viewportClassName, on
3082
3277
  className: cn("relative", className),
3083
3278
  ...props,
3084
3279
  children: [
3085
- /* @__PURE__ */ jsx21(
3280
+ /* @__PURE__ */ jsx22(
3086
3281
  ScrollAreaPrimitive.Viewport,
3087
3282
  {
3088
3283
  ref,
@@ -3096,8 +3291,8 @@ var ScrollArea = React8.forwardRef(({ className, children, viewportClassName, on
3096
3291
  children
3097
3292
  }
3098
3293
  ),
3099
- /* @__PURE__ */ jsx21(ScrollBar, {}),
3100
- /* @__PURE__ */ jsx21(ScrollAreaPrimitive.Corner, {})
3294
+ /* @__PURE__ */ jsx22(ScrollBar, {}),
3295
+ /* @__PURE__ */ jsx22(ScrollAreaPrimitive.Corner, {})
3101
3296
  ]
3102
3297
  }
3103
3298
  );
@@ -3108,7 +3303,7 @@ function ScrollBar({
3108
3303
  orientation = "vertical",
3109
3304
  ...props
3110
3305
  }) {
3111
- return /* @__PURE__ */ jsx21(
3306
+ return /* @__PURE__ */ jsx22(
3112
3307
  ScrollAreaPrimitive.ScrollAreaScrollbar,
3113
3308
  {
3114
3309
  "data-slot": "scroll-area-scrollbar",
@@ -3120,7 +3315,7 @@ function ScrollBar({
3120
3315
  className
3121
3316
  ),
3122
3317
  ...props,
3123
- children: /* @__PURE__ */ jsx21(
3318
+ children: /* @__PURE__ */ jsx22(
3124
3319
  ScrollAreaPrimitive.ScrollAreaThumb,
3125
3320
  {
3126
3321
  "data-slot": "scroll-area-thumb",
@@ -3154,12 +3349,12 @@ import {
3154
3349
  Lightbulb,
3155
3350
  Info,
3156
3351
  Heart,
3157
- Bot as Bot2,
3352
+ Bot as Bot3,
3158
3353
  Pencil,
3159
- Check as Check2,
3354
+ Check as Check3,
3160
3355
  X as X3
3161
3356
  } from "lucide-react";
3162
- import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
3357
+ import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
3163
3358
  var getInitials2 = (name, email) => {
3164
3359
  if (name) {
3165
3360
  return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
@@ -3173,29 +3368,29 @@ var getFieldIcon = (type, key) => {
3173
3368
  const iconClass = "h-4 w-4 text-muted-foreground";
3174
3369
  switch (type) {
3175
3370
  case "email":
3176
- return /* @__PURE__ */ jsx22(Mail, { className: iconClass });
3371
+ return /* @__PURE__ */ jsx23(Mail, { className: iconClass });
3177
3372
  case "phone":
3178
- return /* @__PURE__ */ jsx22(Phone, { className: iconClass });
3373
+ return /* @__PURE__ */ jsx23(Phone, { className: iconClass });
3179
3374
  case "url":
3180
- return /* @__PURE__ */ jsx22(Globe, { className: iconClass });
3375
+ return /* @__PURE__ */ jsx23(Globe, { className: iconClass });
3181
3376
  case "date":
3182
- return /* @__PURE__ */ jsx22(Calendar, { className: iconClass });
3377
+ return /* @__PURE__ */ jsx23(Calendar, { className: iconClass });
3183
3378
  }
3184
3379
  const lowerKey = key?.toLowerCase() || "";
3185
- if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx22(Users, { className: iconClass });
3186
- if (lowerKey.includes("following")) return /* @__PURE__ */ jsx22(UserPlus, { className: iconClass });
3187
- if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx22(Image3, { className: iconClass });
3188
- if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx22(BadgeCheck, { className: iconClass });
3189
- if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx22(FileText2, { className: iconClass });
3190
- if (lowerKey.includes("email")) return /* @__PURE__ */ jsx22(Mail, { className: iconClass });
3191
- if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx22(Phone, { className: iconClass });
3192
- if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx22(MapPin, { className: iconClass });
3193
- if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx22(Building, { className: iconClass });
3194
- if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx22(Briefcase, { className: iconClass });
3195
- if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx22(Globe, { className: iconClass });
3196
- if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx22(AtSign, { className: iconClass });
3197
- if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx22(Calendar, { className: iconClass });
3198
- return /* @__PURE__ */ jsx22(User2, { className: iconClass });
3380
+ if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx23(Users, { className: iconClass });
3381
+ if (lowerKey.includes("following")) return /* @__PURE__ */ jsx23(UserPlus, { className: iconClass });
3382
+ if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx23(Image3, { className: iconClass });
3383
+ if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx23(BadgeCheck, { className: iconClass });
3384
+ if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx23(FileText2, { className: iconClass });
3385
+ if (lowerKey.includes("email")) return /* @__PURE__ */ jsx23(Mail, { className: iconClass });
3386
+ if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx23(Phone, { className: iconClass });
3387
+ if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx23(MapPin, { className: iconClass });
3388
+ if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx23(Building, { className: iconClass });
3389
+ if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx23(Briefcase, { className: iconClass });
3390
+ if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx23(Globe, { className: iconClass });
3391
+ if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx23(AtSign, { className: iconClass });
3392
+ if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx23(Calendar, { className: iconClass });
3393
+ return /* @__PURE__ */ jsx23(User2, { className: iconClass });
3199
3394
  };
3200
3395
  var formatValue = (value, type, key) => {
3201
3396
  if (value === null || value === void 0) return "-";
@@ -3229,15 +3424,15 @@ var getMemoryCategoryIcon = (category) => {
3229
3424
  const iconClass = "h-4 w-4 text-muted-foreground";
3230
3425
  switch (category) {
3231
3426
  case "preference":
3232
- return /* @__PURE__ */ jsx22(Heart, { className: iconClass });
3427
+ return /* @__PURE__ */ jsx23(Heart, { className: iconClass });
3233
3428
  case "fact":
3234
- return /* @__PURE__ */ jsx22(Info, { className: iconClass });
3429
+ return /* @__PURE__ */ jsx23(Info, { className: iconClass });
3235
3430
  case "goal":
3236
- return /* @__PURE__ */ jsx22(Target, { className: iconClass });
3431
+ return /* @__PURE__ */ jsx23(Target, { className: iconClass });
3237
3432
  case "context":
3238
- return /* @__PURE__ */ jsx22(Lightbulb, { className: iconClass });
3433
+ return /* @__PURE__ */ jsx23(Lightbulb, { className: iconClass });
3239
3434
  default:
3240
- return /* @__PURE__ */ jsx22(Brain, { className: iconClass });
3435
+ return /* @__PURE__ */ jsx23(Brain, { className: iconClass });
3241
3436
  }
3242
3437
  };
3243
3438
  var getMemoryCategoryLabel = (category) => {
@@ -3307,66 +3502,66 @@ var UserProfile = ({
3307
3502
  const displayName = user?.name || user?.email?.split("@")[0] || "User";
3308
3503
  const initials = getInitials2(user?.name, user?.email);
3309
3504
  const normalizedFields = normalizeCustomFields(customFields);
3310
- return /* @__PURE__ */ jsx22(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs13(
3505
+ return /* @__PURE__ */ jsx23(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs13(
3311
3506
  SheetContent,
3312
3507
  {
3313
3508
  side: "right",
3314
3509
  className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
3315
3510
  children: [
3316
- /* @__PURE__ */ jsx22(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ jsx22("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx22(SheetTitle, { children: labels.title }) }) }),
3317
- /* @__PURE__ */ jsx22(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs13("div", { className: "p-6 space-y-6", children: [
3511
+ /* @__PURE__ */ jsx23(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ jsx23("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx23(SheetTitle, { children: labels.title }) }) }),
3512
+ /* @__PURE__ */ jsx23(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs13("div", { className: "p-6 space-y-6", children: [
3318
3513
  /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center text-center space-y-4", children: [
3319
3514
  /* @__PURE__ */ jsxs13(Avatar, { className: "h-24 w-24 shrink-0", children: [
3320
- user?.avatar && /* @__PURE__ */ jsx22(AvatarImage, { src: user.avatar, alt: displayName }),
3321
- /* @__PURE__ */ jsx22(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
3515
+ user?.avatar && /* @__PURE__ */ jsx23(AvatarImage, { src: user.avatar, alt: displayName }),
3516
+ /* @__PURE__ */ jsx23(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
3322
3517
  ] }),
3323
3518
  /* @__PURE__ */ jsxs13("div", { className: "w-full px-2", children: [
3324
- /* @__PURE__ */ jsx22("h2", { className: "text-xl font-semibold break-words", children: displayName }),
3325
- user?.email && /* @__PURE__ */ jsx22("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
3519
+ /* @__PURE__ */ jsx23("h2", { className: "text-xl font-semibold break-words", children: displayName }),
3520
+ user?.email && /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
3326
3521
  ] })
3327
3522
  ] }),
3328
- /* @__PURE__ */ jsx22(Separator, {}),
3523
+ /* @__PURE__ */ jsx23(Separator, {}),
3329
3524
  /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
3330
- /* @__PURE__ */ jsx22("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
3525
+ /* @__PURE__ */ jsx23("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
3331
3526
  /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
3332
3527
  /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
3333
- /* @__PURE__ */ jsx22(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
3528
+ /* @__PURE__ */ jsx23(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
3334
3529
  /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
3335
- /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: "Name" }),
3336
- /* @__PURE__ */ jsx22("p", { className: "text-sm font-medium break-words", children: displayName })
3530
+ /* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: "Name" }),
3531
+ /* @__PURE__ */ jsx23("p", { className: "text-sm font-medium break-words", children: displayName })
3337
3532
  ] })
3338
3533
  ] }),
3339
3534
  user?.email && /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
3340
- /* @__PURE__ */ jsx22(AtSign, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
3535
+ /* @__PURE__ */ jsx23(AtSign, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
3341
3536
  /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
3342
- /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
3343
- /* @__PURE__ */ jsx22("p", { className: "text-sm font-medium break-words", children: user.email })
3537
+ /* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
3538
+ /* @__PURE__ */ jsx23("p", { className: "text-sm font-medium break-words", children: user.email })
3344
3539
  ] })
3345
3540
  ] }),
3346
3541
  user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
3347
- /* @__PURE__ */ jsx22(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
3542
+ /* @__PURE__ */ jsx23(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
3348
3543
  /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
3349
- /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: "ID" }),
3350
- /* @__PURE__ */ jsx22("p", { className: "text-sm font-medium break-words", children: user.id })
3544
+ /* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: "ID" }),
3545
+ /* @__PURE__ */ jsx23("p", { className: "text-sm font-medium break-words", children: user.id })
3351
3546
  ] })
3352
3547
  ] })
3353
3548
  ] })
3354
3549
  ] }),
3355
3550
  normalizedFields.length > 0 && /* @__PURE__ */ jsxs13(Fragment5, { children: [
3356
- /* @__PURE__ */ jsx22(Separator, {}),
3551
+ /* @__PURE__ */ jsx23(Separator, {}),
3357
3552
  /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
3358
- /* @__PURE__ */ jsx22("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
3359
- /* @__PURE__ */ jsx22("div", { className: "space-y-2", children: normalizedFields.map((field) => {
3553
+ /* @__PURE__ */ jsx23("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
3554
+ /* @__PURE__ */ jsx23("div", { className: "space-y-2", children: normalizedFields.map((field) => {
3360
3555
  const isBioField = field.key.toLowerCase().includes("bio");
3361
3556
  return /* @__PURE__ */ jsxs13(
3362
3557
  "div",
3363
3558
  {
3364
3559
  className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
3365
3560
  children: [
3366
- /* @__PURE__ */ jsx22("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
3561
+ /* @__PURE__ */ jsx23("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
3367
3562
  /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
3368
- /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: field.label }),
3369
- /* @__PURE__ */ jsx22("p", { className: cn(
3563
+ /* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: field.label }),
3564
+ /* @__PURE__ */ jsx23("p", { className: cn(
3370
3565
  "text-sm font-medium",
3371
3566
  isBioField ? "whitespace-pre-wrap break-words" : "break-words"
3372
3567
  ), children: formatValue(field.value, field.type, field.key) })
@@ -3378,26 +3573,26 @@ var UserProfile = ({
3378
3573
  }) })
3379
3574
  ] })
3380
3575
  ] }),
3381
- /* @__PURE__ */ jsx22(Separator, {}),
3576
+ /* @__PURE__ */ jsx23(Separator, {}),
3382
3577
  /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
3383
3578
  /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
3384
3579
  /* @__PURE__ */ jsxs13("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
3385
- /* @__PURE__ */ jsx22(Brain, { className: "h-4 w-4" }),
3580
+ /* @__PURE__ */ jsx23(Brain, { className: "h-4 w-4" }),
3386
3581
  labels.memories
3387
3582
  ] }),
3388
- onAddMemory && /* @__PURE__ */ jsx22(
3583
+ onAddMemory && /* @__PURE__ */ jsx23(
3389
3584
  Button,
3390
3585
  {
3391
3586
  variant: "ghost",
3392
3587
  size: "sm",
3393
3588
  className: "h-7 px-2",
3394
3589
  onClick: () => setIsAddingMemory(true),
3395
- children: /* @__PURE__ */ jsx22(Plus3, { className: "h-4 w-4" })
3590
+ children: /* @__PURE__ */ jsx23(Plus3, { className: "h-4 w-4" })
3396
3591
  }
3397
3592
  )
3398
3593
  ] }),
3399
3594
  isAddingMemory && onAddMemory && /* @__PURE__ */ jsxs13("div", { className: "flex gap-2", children: [
3400
- /* @__PURE__ */ jsx22(
3595
+ /* @__PURE__ */ jsx23(
3401
3596
  Input,
3402
3597
  {
3403
3598
  value: newMemoryContent,
@@ -3414,24 +3609,24 @@ var UserProfile = ({
3414
3609
  autoFocus: true
3415
3610
  }
3416
3611
  ),
3417
- /* @__PURE__ */ jsx22(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
3612
+ /* @__PURE__ */ jsx23(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
3418
3613
  ] }),
3419
- /* @__PURE__ */ jsx22("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ jsx22("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
3614
+ /* @__PURE__ */ jsx23("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
3420
3615
  const isEditing = editingMemoryId === memory.id;
3421
3616
  return /* @__PURE__ */ jsxs13(
3422
3617
  "div",
3423
3618
  {
3424
3619
  className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
3425
3620
  children: [
3426
- /* @__PURE__ */ jsx22("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ jsx22(Bot2, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
3621
+ /* @__PURE__ */ jsx23("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ jsx23(Bot3, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
3427
3622
  /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
3428
3623
  /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 mb-0.5", children: [
3429
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
3430
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
3431
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
3624
+ /* @__PURE__ */ jsx23("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
3625
+ /* @__PURE__ */ jsx23("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
3626
+ /* @__PURE__ */ jsx23("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
3432
3627
  ] }),
3433
3628
  isEditing ? /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
3434
- /* @__PURE__ */ jsx22(
3629
+ /* @__PURE__ */ jsx23(
3435
3630
  Textarea,
3436
3631
  {
3437
3632
  value: editingMemoryContent,
@@ -3457,7 +3652,7 @@ var UserProfile = ({
3457
3652
  className: "h-7 px-2",
3458
3653
  onClick: handleCancelEdit,
3459
3654
  children: [
3460
- /* @__PURE__ */ jsx22(X3, { className: "h-3.5 w-3.5 mr-1" }),
3655
+ /* @__PURE__ */ jsx23(X3, { className: "h-3.5 w-3.5 mr-1" }),
3461
3656
  "Cancelar"
3462
3657
  ]
3463
3658
  }
@@ -3470,33 +3665,33 @@ var UserProfile = ({
3470
3665
  onClick: handleSaveEdit,
3471
3666
  disabled: !editingMemoryContent.trim(),
3472
3667
  children: [
3473
- /* @__PURE__ */ jsx22(Check2, { className: "h-3.5 w-3.5 mr-1" }),
3668
+ /* @__PURE__ */ jsx23(Check3, { className: "h-3.5 w-3.5 mr-1" }),
3474
3669
  "Salvar"
3475
3670
  ]
3476
3671
  }
3477
3672
  )
3478
3673
  ] })
3479
- ] }) : /* @__PURE__ */ jsx22("p", { className: "text-sm break-words", children: memory.content })
3674
+ ] }) : /* @__PURE__ */ jsx23("p", { className: "text-sm break-words", children: memory.content })
3480
3675
  ] }),
3481
3676
  !isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ jsxs13("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
3482
- onUpdateMemory && /* @__PURE__ */ jsx22(
3677
+ onUpdateMemory && /* @__PURE__ */ jsx23(
3483
3678
  Button,
3484
3679
  {
3485
3680
  variant: "ghost",
3486
3681
  size: "icon",
3487
3682
  className: "h-7 w-7",
3488
3683
  onClick: () => handleStartEdit(memory),
3489
- children: /* @__PURE__ */ jsx22(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
3684
+ children: /* @__PURE__ */ jsx23(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
3490
3685
  }
3491
3686
  ),
3492
- onDeleteMemory && /* @__PURE__ */ jsx22(
3687
+ onDeleteMemory && /* @__PURE__ */ jsx23(
3493
3688
  Button,
3494
3689
  {
3495
3690
  variant: "ghost",
3496
3691
  size: "icon",
3497
3692
  className: "h-7 w-7",
3498
3693
  onClick: () => onDeleteMemory(memory.id),
3499
- children: /* @__PURE__ */ jsx22(Trash23, { className: "h-3.5 w-3.5 text-destructive" })
3694
+ children: /* @__PURE__ */ jsx23(Trash23, { className: "h-3.5 w-3.5 text-destructive" })
3500
3695
  }
3501
3696
  )
3502
3697
  ] })
@@ -3508,7 +3703,7 @@ var UserProfile = ({
3508
3703
  ] })
3509
3704
  ] }) }),
3510
3705
  /* @__PURE__ */ jsxs13("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
3511
- onEditProfile && /* @__PURE__ */ jsx22(
3706
+ onEditProfile && /* @__PURE__ */ jsx23(
3512
3707
  Button,
3513
3708
  {
3514
3709
  variant: "outline",
@@ -3517,7 +3712,7 @@ var UserProfile = ({
3517
3712
  children: "Edit Profile"
3518
3713
  }
3519
3714
  ),
3520
- onLogout && /* @__PURE__ */ jsx22(
3715
+ onLogout && /* @__PURE__ */ jsx23(
3521
3716
  Button,
3522
3717
  {
3523
3718
  variant: "destructive",
@@ -3533,8 +3728,8 @@ var UserProfile = ({
3533
3728
  };
3534
3729
 
3535
3730
  // src/components/chat/ChatUI.tsx
3536
- import { Sparkles } from "lucide-react";
3537
- import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
3731
+ import { Sparkles, ArrowRight, MessageSquare, Lightbulb as Lightbulb2, Zap, HelpCircle } from "lucide-react";
3732
+ import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
3538
3733
  var ChatUI = ({
3539
3734
  messages = [],
3540
3735
  threads = [],
@@ -3542,14 +3737,21 @@ var ChatUI = ({
3542
3737
  config: userConfig,
3543
3738
  sidebar: _sidebar,
3544
3739
  isGenerating = false,
3740
+ isMessagesLoading = false,
3545
3741
  callbacks = {},
3546
3742
  user,
3547
3743
  assistant,
3548
3744
  suggestions = [],
3745
+ messageSuggestions = {},
3746
+ agentOptions = [],
3747
+ selectedAgentId = null,
3748
+ onSelectAgent,
3549
3749
  className = "",
3550
3750
  onAddMemory,
3551
3751
  onUpdateMemory,
3552
- onDeleteMemory
3752
+ onDeleteMemory,
3753
+ initialInput,
3754
+ onInitialInputConsumed
3553
3755
  }) => {
3554
3756
  const config = mergeConfig(defaultChatConfig, userConfig);
3555
3757
  const [isMobile, setIsMobile] = useState8(false);
@@ -3567,9 +3769,9 @@ var ChatUI = ({
3567
3769
  }
3568
3770
  return false;
3569
3771
  };
3772
+ const [inputValue, setInputValue] = useState8("");
3773
+ const [attachments, setAttachments] = useState8([]);
3570
3774
  const [state, setState] = useState8({
3571
- input: "",
3572
- attachments: [],
3573
3775
  isRecording: false,
3574
3776
  selectedThreadId: currentThreadId,
3575
3777
  isAtBottom: true,
@@ -3581,23 +3783,48 @@ var ChatUI = ({
3581
3783
  isSidebarCollapsed: false
3582
3784
  // No longer used for main sidebar
3583
3785
  });
3584
- useEffect7(() => {
3786
+ useEffect10(() => {
3585
3787
  if (currentThreadId !== state.selectedThreadId) {
3586
3788
  setState((prev) => ({ ...prev, selectedThreadId: currentThreadId }));
3587
3789
  }
3588
3790
  }, [currentThreadId]);
3589
- const messagesEndRef = useRef4(null);
3590
- const scrollAreaRef = useRef4(null);
3791
+ const initialInputApplied = useRef7(false);
3792
+ const initialInputConsumedRef = useRef7(false);
3793
+ useEffect10(() => {
3794
+ if (initialInput && !initialInputApplied.current) {
3795
+ setInputValue(initialInput);
3796
+ initialInputApplied.current = true;
3797
+ }
3798
+ }, [initialInput]);
3799
+ const messagesEndRef = useRef7(null);
3800
+ const scrollAreaRef = useRef7(null);
3801
+ const stateRef = useRef7(state);
3802
+ const inputValueRef = useRef7(inputValue);
3803
+ const attachmentsRef = useRef7(attachments);
3804
+ useEffect10(() => {
3805
+ stateRef.current = state;
3806
+ }, [state]);
3807
+ useEffect10(() => {
3808
+ inputValueRef.current = inputValue;
3809
+ }, [inputValue]);
3810
+ useEffect10(() => {
3811
+ attachmentsRef.current = attachments;
3812
+ }, [attachments]);
3591
3813
  const [isCustomMounted, setIsCustomMounted] = useState8(false);
3592
3814
  const [isCustomVisible, setIsCustomVisible] = useState8(false);
3593
3815
  const createStateCallback = useCallback4(
3594
3816
  (setter) => ({
3595
3817
  setState: (newState) => setter?.(newState),
3596
- getState: () => state
3818
+ getState: () => ({
3819
+ ...stateRef.current,
3820
+ input: inputValueRef.current,
3821
+ attachments: attachmentsRef.current
3822
+ })
3597
3823
  }),
3598
- [state]
3824
+ []
3825
+ // No dependencies - uses refs for latest state
3599
3826
  );
3600
- useEffect7(() => {
3827
+ useEffect10(() => {
3601
3828
  const checkMobile = () => {
3602
3829
  setIsMobile(globalThis.innerWidth < 1024);
3603
3830
  };
@@ -3605,7 +3832,7 @@ var ChatUI = ({
3605
3832
  globalThis.addEventListener("resize", checkMobile);
3606
3833
  return () => globalThis.removeEventListener("resize", checkMobile);
3607
3834
  }, []);
3608
- useEffect7(() => {
3835
+ useEffect10(() => {
3609
3836
  if (!isMobile || !config.customComponent?.component) return;
3610
3837
  if (state.showSidebar) {
3611
3838
  setIsCustomMounted(true);
@@ -3616,7 +3843,7 @@ var ChatUI = ({
3616
3843
  return () => clearTimeout(t);
3617
3844
  }
3618
3845
  }, [state.showSidebar, isMobile, config.customComponent]);
3619
- useEffect7(() => {
3846
+ useEffect10(() => {
3620
3847
  if (!state.isAtBottom) return;
3621
3848
  const viewport = scrollAreaRef.current;
3622
3849
  if (!viewport) return;
@@ -3632,15 +3859,16 @@ var ChatUI = ({
3632
3859
  const isAtBottom = scrollHeight - scrollTop - clientHeight < 50;
3633
3860
  setState((prev) => ({ ...prev, isAtBottom }));
3634
3861
  }, []);
3635
- const handleSendMessage = useCallback4((content, attachments = []) => {
3636
- if (!content.trim() && attachments.length === 0) return;
3637
- callbacks.onSendMessage?.(content, attachments, createStateCallback());
3638
- setState((prev) => ({
3639
- ...prev,
3640
- input: "",
3641
- attachments: []
3642
- }));
3643
- }, [callbacks, createStateCallback]);
3862
+ const handleSendMessage = useCallback4((content, messageAttachments = []) => {
3863
+ if (!content.trim() && messageAttachments.length === 0) return;
3864
+ callbacks.onSendMessage?.(content, messageAttachments, createStateCallback());
3865
+ if (initialInputApplied.current && !initialInputConsumedRef.current) {
3866
+ initialInputConsumedRef.current = true;
3867
+ onInitialInputConsumed?.();
3868
+ }
3869
+ setInputValue("");
3870
+ setAttachments([]);
3871
+ }, [callbacks, createStateCallback, onInitialInputConsumed]);
3644
3872
  const handleMessageAction = useCallback4((event) => {
3645
3873
  const { action, messageId, content } = event;
3646
3874
  switch (action) {
@@ -3661,7 +3889,7 @@ var ChatUI = ({
3661
3889
  }
3662
3890
  }, [callbacks, createStateCallback]);
3663
3891
  const handleCreateThread = useCallback4((title) => {
3664
- callbacks.onCreateThread?.(title, createStateCallback(setState));
3892
+ callbacks.onCreateThread?.(title, createStateCallback());
3665
3893
  }, [callbacks, createStateCallback]);
3666
3894
  const handleSelectThread = useCallback4((threadId) => {
3667
3895
  callbacks.onSelectThread?.(threadId, createStateCallback());
@@ -3686,25 +3914,75 @@ var ChatUI = ({
3686
3914
  }
3687
3915
  return component;
3688
3916
  }, [config?.customComponent?.component, closeSidebar, isMobile]);
3917
+ const SuggestionIconComponents = [MessageSquare, Lightbulb2, Zap, HelpCircle];
3689
3918
  const renderSuggestions = () => {
3690
3919
  if (messages.length > 0 || !suggestions.length) return null;
3691
- return /* @__PURE__ */ jsxs14("div", { className: "text-center py-8", children: [
3692
- /* @__PURE__ */ jsx23("div", { className: "inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-4", children: /* @__PURE__ */ jsx23(Sparkles, { className: "w-8 h-8 text-primary" }) }),
3693
- /* @__PURE__ */ jsx23("h3", { className: "text-lg font-semibold mb-2", children: config.branding.title }),
3694
- /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground mb-6", children: config.branding.subtitle }),
3695
- /* @__PURE__ */ jsx23("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-3 max-w-2xl mx-auto", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsx23(
3696
- Card,
3920
+ return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
3921
+ /* @__PURE__ */ jsxs14("div", { className: "text-center mb-8", children: [
3922
+ /* @__PURE__ */ jsx24("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__ */ jsx24(Sparkles, { className: "w-7 h-7 text-primary" }) }),
3923
+ /* @__PURE__ */ jsx24("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
3924
+ /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
3925
+ ] }),
3926
+ /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs14(
3927
+ "button",
3697
3928
  {
3698
- className: "cursor-pointer hover:bg-muted/50 transition-colors",
3929
+ type: "button",
3699
3930
  onClick: () => handleSendMessage(suggestion),
3700
- children: /* @__PURE__ */ jsx23(CardContent, { className: "p-4 text-left", children: /* @__PURE__ */ jsx23("p", { className: "text-sm", children: suggestion }) })
3931
+ 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",
3932
+ children: [
3933
+ (() => {
3934
+ const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
3935
+ return /* @__PURE__ */ jsx24("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__ */ jsx24(IconComponent, { className: "h-4 w-4" }) });
3936
+ })(),
3937
+ /* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ jsx24("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
3938
+ /* @__PURE__ */ jsx24(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" })
3939
+ ]
3701
3940
  },
3702
3941
  index
3703
3942
  )) })
3704
3943
  ] });
3705
3944
  };
3706
- return /* @__PURE__ */ jsx23(TooltipProvider, { children: /* @__PURE__ */ jsx23(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs14("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
3707
- /* @__PURE__ */ jsx23(
3945
+ const renderInlineSuggestions = (messageId) => {
3946
+ const items = messageSuggestions?.[messageId];
3947
+ if (!items || items.length === 0) return null;
3948
+ return /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-2 mt-2 ml-11", children: items.map((suggestion, index) => /* @__PURE__ */ jsxs14(
3949
+ "button",
3950
+ {
3951
+ type: "button",
3952
+ onClick: () => handleSendMessage(suggestion),
3953
+ 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",
3954
+ children: [
3955
+ /* @__PURE__ */ jsx24(Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
3956
+ /* @__PURE__ */ jsx24("span", { className: "max-w-[200px] truncate", children: suggestion })
3957
+ ]
3958
+ },
3959
+ `${messageId}-suggestion-${index}`
3960
+ )) });
3961
+ };
3962
+ const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx24("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
3963
+ const isUserRow = index % 2 === 1;
3964
+ return /* @__PURE__ */ jsxs14(
3965
+ "div",
3966
+ {
3967
+ className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
3968
+ children: [
3969
+ !isUserRow && /* @__PURE__ */ jsx24(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
3970
+ /* @__PURE__ */ jsxs14("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
3971
+ /* @__PURE__ */ jsx24(Skeleton, { className: "h-4 w-24" }),
3972
+ /* @__PURE__ */ jsx24(Skeleton, { className: "h-4 w-full" }),
3973
+ /* @__PURE__ */ jsx24(Skeleton, { className: "h-4 w-[85%]" })
3974
+ ] }),
3975
+ isUserRow && /* @__PURE__ */ jsx24(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
3976
+ ]
3977
+ },
3978
+ `message-skeleton-${index}`
3979
+ );
3980
+ }) });
3981
+ const shouldShowAgentSelector = Boolean(
3982
+ config.agentSelector?.enabled && onSelectAgent && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1)
3983
+ );
3984
+ return /* @__PURE__ */ jsx24(TooltipProvider, { children: /* @__PURE__ */ jsx24(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs14("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
3985
+ /* @__PURE__ */ jsx24(
3708
3986
  Sidebar2,
3709
3987
  {
3710
3988
  threads,
@@ -3734,8 +4012,8 @@ var ChatUI = ({
3734
4012
  showThemeOptions: !!callbacks.onThemeChange
3735
4013
  }
3736
4014
  ),
3737
- /* @__PURE__ */ jsx23(SidebarInset, { children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col h-full min-h-0", children: [
3738
- /* @__PURE__ */ jsx23(
4015
+ /* @__PURE__ */ jsx24(SidebarInset, { children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col h-full min-h-0", children: [
4016
+ /* @__PURE__ */ jsx24(
3739
4017
  ChatHeader,
3740
4018
  {
3741
4019
  config,
@@ -3743,12 +4021,16 @@ var ChatUI = ({
3743
4021
  isMobile,
3744
4022
  onCustomComponentToggle: () => setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar })),
3745
4023
  onNewThread: handleCreateThread,
3746
- showCustomComponentButton: !!config?.customComponent?.component
4024
+ showCustomComponentButton: !!config?.customComponent?.component,
4025
+ showAgentSelector: shouldShowAgentSelector,
4026
+ agentOptions,
4027
+ selectedAgentId,
4028
+ onSelectAgent
3747
4029
  }
3748
4030
  ),
3749
4031
  /* @__PURE__ */ jsxs14("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
3750
4032
  /* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col min-h-0", children: [
3751
- /* @__PURE__ */ jsx23(
4033
+ /* @__PURE__ */ jsx24(
3752
4034
  ScrollArea,
3753
4035
  {
3754
4036
  ref: scrollAreaRef,
@@ -3756,40 +4038,55 @@ var ChatUI = ({
3756
4038
  viewportClassName: "p-4 overscroll-contain",
3757
4039
  onScrollCapture: handleScroll,
3758
4040
  children: /* @__PURE__ */ jsxs14("div", { className: "max-w-4xl mx-auto space-y-4 pb-4", children: [
3759
- renderSuggestions(),
3760
- messages.map((message) => /* @__PURE__ */ jsx23(
3761
- Message,
3762
- {
3763
- message,
3764
- userAvatar: user?.avatar,
3765
- userName: user?.name,
3766
- assistantAvatar: assistant?.avatar,
3767
- assistantName: assistant?.name,
3768
- showTimestamp: config.ui.showTimestamps,
3769
- showAvatar: config.ui.showAvatars,
3770
- enableCopy: config.features.enableMessageCopy,
3771
- enableEdit: config.features.enableMessageEditing,
3772
- enableRegenerate: config.features.enableRegeneration,
3773
- enableToolCallsDisplay: config.features.enableToolCallsDisplay,
3774
- compactMode: config.ui.compactMode,
3775
- onAction: handleMessageAction,
3776
- toolUsedLabel: config.labels.toolUsed,
3777
- thinkingLabel: config.labels.thinking
3778
- },
3779
- message.id
3780
- )),
3781
- /* @__PURE__ */ jsx23("div", { ref: messagesEndRef })
4041
+ isMessagesLoading ? renderMessageLoadingSkeleton() : /* @__PURE__ */ jsxs14(Fragment6, { children: [
4042
+ renderSuggestions(),
4043
+ messages.map((message, index) => {
4044
+ const prevMessage = index > 0 ? messages[index - 1] : null;
4045
+ const isGrouped = prevMessage !== null && prevMessage.role === message.role;
4046
+ return /* @__PURE__ */ jsxs14("div", { className: isGrouped ? "space-y-1 -mt-2" : "space-y-2", children: [
4047
+ /* @__PURE__ */ jsx24(
4048
+ Message,
4049
+ {
4050
+ message,
4051
+ userAvatar: user?.avatar,
4052
+ userName: user?.name,
4053
+ assistantAvatar: assistant?.avatar,
4054
+ assistantName: assistant?.name,
4055
+ showTimestamp: config.ui.showTimestamps,
4056
+ showAvatar: config.ui.showAvatars,
4057
+ enableCopy: config.features.enableMessageCopy,
4058
+ enableEdit: config.features.enableMessageEditing,
4059
+ enableRegenerate: config.features.enableRegeneration,
4060
+ enableToolCallsDisplay: config.features.enableToolCallsDisplay,
4061
+ compactMode: config.ui.compactMode,
4062
+ onAction: handleMessageAction,
4063
+ toolUsedLabel: config.labels.toolUsed,
4064
+ thinkingLabel: config.labels.thinking,
4065
+ isGrouped
4066
+ }
4067
+ ),
4068
+ message.role === "assistant" && renderInlineSuggestions(message.id)
4069
+ ] }, message.id);
4070
+ })
4071
+ ] }),
4072
+ /* @__PURE__ */ jsx24("div", { ref: messagesEndRef })
3782
4073
  ] })
3783
4074
  }
3784
4075
  ),
3785
- /* @__PURE__ */ jsx23("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: /* @__PURE__ */ jsx23(
4076
+ /* @__PURE__ */ jsx24("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: /* @__PURE__ */ jsx24(
3786
4077
  ChatInput,
3787
4078
  {
3788
- value: state.input,
3789
- onChange: (value) => setState((prev) => ({ ...prev, input: value })),
4079
+ value: inputValue,
4080
+ onChange: (value) => {
4081
+ setInputValue(value);
4082
+ if (initialInputApplied.current && !initialInputConsumedRef.current) {
4083
+ initialInputConsumedRef.current = true;
4084
+ onInitialInputConsumed?.();
4085
+ }
4086
+ },
3790
4087
  onSubmit: handleSendMessage,
3791
- attachments: state.attachments,
3792
- onAttachmentsChange: (attachments) => setState((prev) => ({ ...prev, attachments })),
4088
+ attachments,
4089
+ onAttachmentsChange: setAttachments,
3793
4090
  placeholder: config.labels.inputPlaceholder,
3794
4091
  disabled: false,
3795
4092
  isGenerating,
@@ -3802,17 +4099,17 @@ var ChatUI = ({
3802
4099
  }
3803
4100
  ) })
3804
4101
  ] }),
3805
- config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx23(
4102
+ config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx24(
3806
4103
  "div",
3807
4104
  {
3808
4105
  className: `h-full transition-all duration-300 ease-in-out overflow-hidden ${state.showSidebar ? "w-80" : "w-0"}`,
3809
- children: state.showSidebar && /* @__PURE__ */ jsx23("div", { className: "flex flex-col h-full border-l bg-background animate-in slide-in-from-right-4 duration-300 w-80", children: renderCustomComponent() })
4106
+ children: state.showSidebar && /* @__PURE__ */ jsx24("div", { className: "flex flex-col h-full border-l bg-background animate-in slide-in-from-right-4 duration-300 w-80", children: renderCustomComponent() })
3810
4107
  }
3811
4108
  )
3812
4109
  ] })
3813
4110
  ] }) }),
3814
4111
  isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs14("div", { className: "fixed inset-0 z-50", children: [
3815
- /* @__PURE__ */ jsx23(
4112
+ /* @__PURE__ */ jsx24(
3816
4113
  "div",
3817
4114
  {
3818
4115
  className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
@@ -3820,16 +4117,16 @@ var ChatUI = ({
3820
4117
  onClick: closeSidebar
3821
4118
  }
3822
4119
  ),
3823
- /* @__PURE__ */ jsx23(
4120
+ /* @__PURE__ */ jsx24(
3824
4121
  "div",
3825
4122
  {
3826
4123
  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"}`,
3827
4124
  style: { willChange: "transform" },
3828
- children: /* @__PURE__ */ jsx23("div", { className: "h-full flex flex-col", children: renderCustomComponent() })
4125
+ children: /* @__PURE__ */ jsx24("div", { className: "h-full flex flex-col", children: renderCustomComponent() })
3829
4126
  }
3830
4127
  )
3831
4128
  ] }),
3832
- /* @__PURE__ */ jsx23(
4129
+ isUserProfileOpen && /* @__PURE__ */ jsx24(
3833
4130
  UserProfile,
3834
4131
  {
3835
4132
  isOpen: isUserProfileOpen,
@@ -3852,10 +4149,10 @@ var ChatUI = ({
3852
4149
  };
3853
4150
 
3854
4151
  // src/components/chat/ThreadManager.tsx
3855
- import { useState as useState9, useRef as useRef5, useEffect as useEffect8 } from "react";
4152
+ import { useState as useState9, useRef as useRef8, useEffect as useEffect11 } from "react";
3856
4153
  import {
3857
4154
  Plus as Plus4,
3858
- MessageSquare,
4155
+ MessageSquare as MessageSquare2,
3859
4156
  MoreVertical as MoreVertical2,
3860
4157
  Edit2 as Edit22,
3861
4158
  Trash2 as Trash24,
@@ -3865,14 +4162,14 @@ import {
3865
4162
  Calendar as Calendar2,
3866
4163
  Hash,
3867
4164
  X as X4,
3868
- Check as Check3
4165
+ Check as Check4
3869
4166
  } from "lucide-react";
3870
- import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
4167
+ import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
3871
4168
  var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onArchive }) => {
3872
4169
  const [isEditing, setIsEditing] = useState9(false);
3873
4170
  const [editTitle, setEditTitle] = useState9(thread.title);
3874
- const inputRef = useRef5(null);
3875
- useEffect8(() => {
4171
+ const inputRef = useRef8(null);
4172
+ useEffect11(() => {
3876
4173
  if (isEditing && inputRef.current) {
3877
4174
  inputRef.current.focus();
3878
4175
  inputRef.current.select();
@@ -3896,9 +4193,9 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
3896
4193
  handleCancelEdit();
3897
4194
  }
3898
4195
  };
3899
- return /* @__PURE__ */ jsx24(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__ */ jsx24(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ jsxs15("div", { className: "flex items-start justify-between gap-2", children: [
3900
- /* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
3901
- /* @__PURE__ */ jsx24(
4196
+ return /* @__PURE__ */ jsx25(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__ */ jsx25(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ jsxs15("div", { className: "flex items-start justify-between gap-2", children: [
4197
+ /* @__PURE__ */ jsx25("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
4198
+ /* @__PURE__ */ jsx25(
3902
4199
  Input,
3903
4200
  {
3904
4201
  ref: inputRef,
@@ -3910,44 +4207,44 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
3910
4207
  placeholder: config?.labels?.threadNamePlaceholder || "Conversation name"
3911
4208
  }
3912
4209
  ),
3913
- /* @__PURE__ */ jsx24(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ jsx24(Check3, { className: "h-3 w-3" }) }),
3914
- /* @__PURE__ */ jsx24(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" }) })
3915
- ] }) : /* @__PURE__ */ jsxs15(Fragment6, { children: [
3916
- /* @__PURE__ */ jsx24("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
4210
+ /* @__PURE__ */ jsx25(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ jsx25(Check4, { className: "h-3 w-3" }) }),
4211
+ /* @__PURE__ */ jsx25(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ jsx25(X4, { className: "h-3 w-3" }) })
4212
+ ] }) : /* @__PURE__ */ jsxs15(Fragment7, { children: [
4213
+ /* @__PURE__ */ jsx25("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
3917
4214
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
3918
4215
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
3919
- /* @__PURE__ */ jsx24(Hash, { className: "h-3 w-3" }),
4216
+ /* @__PURE__ */ jsx25(Hash, { className: "h-3 w-3" }),
3920
4217
  thread.messageCount,
3921
4218
  " msgs"
3922
4219
  ] }),
3923
- /* @__PURE__ */ jsx24(Separator, { orientation: "vertical", className: "h-3" }),
4220
+ /* @__PURE__ */ jsx25(Separator, { orientation: "vertical", className: "h-3" }),
3924
4221
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
3925
- /* @__PURE__ */ jsx24(Calendar2, { className: "h-3 w-3" }),
4222
+ /* @__PURE__ */ jsx25(Calendar2, { className: "h-3 w-3" }),
3926
4223
  formatDate(thread.updatedAt, config?.labels)
3927
4224
  ] }),
3928
- thread.isArchived && /* @__PURE__ */ jsxs15(Fragment6, { children: [
3929
- /* @__PURE__ */ jsx24(Separator, { orientation: "vertical", className: "h-3" }),
4225
+ thread.isArchived && /* @__PURE__ */ jsxs15(Fragment7, { children: [
4226
+ /* @__PURE__ */ jsx25(Separator, { orientation: "vertical", className: "h-3" }),
3930
4227
  /* @__PURE__ */ jsxs15(Badge, { variant: "secondary", className: "text-xs", children: [
3931
- /* @__PURE__ */ jsx24(Archive2, { className: "h-2 w-2 mr-1" }),
4228
+ /* @__PURE__ */ jsx25(Archive2, { className: "h-2 w-2 mr-1" }),
3932
4229
  config?.labels?.archiveThread || "Archived"
3933
4230
  ] })
3934
4231
  ] })
3935
4232
  ] })
3936
4233
  ] }) }),
3937
4234
  !isEditing && /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
3938
- /* @__PURE__ */ jsx24(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ jsx24(MoreVertical2, { className: "h-3 w-3" }) }) }),
4235
+ /* @__PURE__ */ jsx25(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ jsx25(MoreVertical2, { className: "h-3 w-3" }) }) }),
3939
4236
  /* @__PURE__ */ jsxs15(DropdownMenuContent, { align: "end", children: [
3940
4237
  /* @__PURE__ */ jsxs15(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
3941
- /* @__PURE__ */ jsx24(Edit22, { className: "h-4 w-4 mr-2" }),
4238
+ /* @__PURE__ */ jsx25(Edit22, { className: "h-4 w-4 mr-2" }),
3942
4239
  config?.labels?.renameThread || "Rename"
3943
4240
  ] }),
3944
4241
  /* @__PURE__ */ jsxs15(DropdownMenuItem, { onClick: onArchive, children: [
3945
- /* @__PURE__ */ jsx24(Archive2, { className: "h-4 w-4 mr-2" }),
4242
+ /* @__PURE__ */ jsx25(Archive2, { className: "h-4 w-4 mr-2" }),
3946
4243
  thread.isArchived ? config?.labels?.unarchiveThread || "Unarchive" : config?.labels?.archiveThread || "Archive"
3947
4244
  ] }),
3948
- /* @__PURE__ */ jsx24(DropdownMenuSeparator, {}),
4245
+ /* @__PURE__ */ jsx25(DropdownMenuSeparator, {}),
3949
4246
  /* @__PURE__ */ jsxs15(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
3950
- /* @__PURE__ */ jsx24(Trash24, { className: "h-4 w-4 mr-2" }),
4247
+ /* @__PURE__ */ jsx25(Trash24, { className: "h-4 w-4 mr-2" }),
3951
4248
  config?.labels?.deleteThread || "Delete"
3952
4249
  ] })
3953
4250
  ] })
@@ -3963,16 +4260,16 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
3963
4260
  setIsOpen(false);
3964
4261
  };
3965
4262
  return /* @__PURE__ */ jsxs15(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
3966
- /* @__PURE__ */ jsx24(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(Button, { variant: "outline", className: "w-full", children: [
3967
- /* @__PURE__ */ jsx24(Plus4, { className: "h-4 w-4 mr-2" }),
4263
+ /* @__PURE__ */ jsx25(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(Button, { variant: "outline", className: "w-full", children: [
4264
+ /* @__PURE__ */ jsx25(Plus4, { className: "h-4 w-4 mr-2" }),
3968
4265
  config?.labels?.createNewThread || "New Conversation"
3969
4266
  ] }) }),
3970
4267
  /* @__PURE__ */ jsxs15(DialogContent, { children: [
3971
4268
  /* @__PURE__ */ jsxs15(DialogHeader, { children: [
3972
- /* @__PURE__ */ jsx24(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
3973
- /* @__PURE__ */ jsx24(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
4269
+ /* @__PURE__ */ jsx25(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
4270
+ /* @__PURE__ */ jsx25(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
3974
4271
  ] }),
3975
- /* @__PURE__ */ jsx24(
4272
+ /* @__PURE__ */ jsx25(
3976
4273
  Input,
3977
4274
  {
3978
4275
  value: title,
@@ -3983,8 +4280,8 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
3983
4280
  }
3984
4281
  ),
3985
4282
  /* @__PURE__ */ jsxs15(DialogFooter, { children: [
3986
- /* @__PURE__ */ jsx24(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
3987
- /* @__PURE__ */ jsx24(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
4283
+ /* @__PURE__ */ jsx25(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
4284
+ /* @__PURE__ */ jsx25(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
3988
4285
  ] })
3989
4286
  ] })
3990
4287
  ] });
@@ -4038,20 +4335,20 @@ var ThreadManager = ({
4038
4335
  setDeleteThreadId(null);
4039
4336
  };
4040
4337
  if (!isOpen) return null;
4041
- return /* @__PURE__ */ jsx24(TooltipProvider, { children: /* @__PURE__ */ jsxs15("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
4042
- /* @__PURE__ */ jsx24("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ jsxs15(Card, { className: "h-full border-0 rounded-none", children: [
4338
+ return /* @__PURE__ */ jsx25(TooltipProvider, { children: /* @__PURE__ */ jsxs15("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
4339
+ /* @__PURE__ */ jsx25("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ jsxs15(Card, { className: "h-full border-0 rounded-none", children: [
4043
4340
  /* @__PURE__ */ jsxs15(CardHeader, { className: "border-b", children: [
4044
4341
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
4045
4342
  /* @__PURE__ */ jsxs15(CardTitle, { className: "flex items-center gap-2", children: [
4046
- /* @__PURE__ */ jsx24(MessageSquare, { className: "h-5 w-5" }),
4343
+ /* @__PURE__ */ jsx25(MessageSquare2, { className: "h-5 w-5" }),
4047
4344
  config?.labels?.newChat || "Conversations"
4048
4345
  ] }),
4049
- /* @__PURE__ */ jsx24(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx24(X4, { className: "h-4 w-4" }) })
4346
+ /* @__PURE__ */ jsx25(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx25(X4, { className: "h-4 w-4" }) })
4050
4347
  ] }),
4051
4348
  /* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
4052
4349
  /* @__PURE__ */ jsxs15("div", { className: "relative", children: [
4053
- /* @__PURE__ */ jsx24(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4054
- /* @__PURE__ */ jsx24(
4350
+ /* @__PURE__ */ jsx25(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4351
+ /* @__PURE__ */ jsx25(
4055
4352
  Input,
4056
4353
  {
4057
4354
  placeholder: config?.labels?.search || "Search conversations...",
@@ -4070,7 +4367,7 @@ var ThreadManager = ({
4070
4367
  onClick: () => setShowArchived(!showArchived),
4071
4368
  className: "text-xs",
4072
4369
  children: [
4073
- /* @__PURE__ */ jsx24(Filter2, { className: "h-3 w-3 mr-1" }),
4370
+ /* @__PURE__ */ jsx25(Filter2, { className: "h-3 w-3 mr-1" }),
4074
4371
  showArchived ? config?.labels?.hideArchived || "Hide Archived" : config?.labels?.showArchived || "Show Archived"
4075
4372
  ]
4076
4373
  }
@@ -4084,13 +4381,13 @@ var ThreadManager = ({
4084
4381
  ] })
4085
4382
  ] }),
4086
4383
  /* @__PURE__ */ jsxs15(CardContent, { className: "p-0 flex-1", children: [
4087
- /* @__PURE__ */ jsx24("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ jsx24(CreateThreadDialog2, { onCreateThread, config }) }),
4088
- /* @__PURE__ */ jsx24(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ jsx24("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs15("div", { className: "text-center py-8 text-muted-foreground", children: [
4089
- /* @__PURE__ */ jsx24(MessageSquare, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
4090
- /* @__PURE__ */ jsx24("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
4384
+ /* @__PURE__ */ jsx25("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ jsx25(CreateThreadDialog2, { onCreateThread, config }) }),
4385
+ /* @__PURE__ */ jsx25(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ jsx25("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs15("div", { className: "text-center py-8 text-muted-foreground", children: [
4386
+ /* @__PURE__ */ jsx25(MessageSquare2, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
4387
+ /* @__PURE__ */ jsx25("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
4091
4388
  ] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs15("div", { children: [
4092
- /* @__PURE__ */ jsx24("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
4093
- /* @__PURE__ */ jsx24("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ jsx24(
4389
+ /* @__PURE__ */ jsx25("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
4390
+ /* @__PURE__ */ jsx25("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ jsx25(
4094
4391
  ThreadItem,
4095
4392
  {
4096
4393
  thread,
@@ -4106,14 +4403,14 @@ var ThreadManager = ({
4106
4403
  ] }, group)) }) })
4107
4404
  ] })
4108
4405
  ] }) }),
4109
- /* @__PURE__ */ jsx24(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs15(AlertDialogContent, { children: [
4406
+ deleteThreadId && /* @__PURE__ */ jsx25(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs15(AlertDialogContent, { children: [
4110
4407
  /* @__PURE__ */ jsxs15(AlertDialogHeader, { children: [
4111
- /* @__PURE__ */ jsx24(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
4112
- /* @__PURE__ */ jsx24(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
4408
+ /* @__PURE__ */ jsx25(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
4409
+ /* @__PURE__ */ jsx25(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
4113
4410
  ] }),
4114
4411
  /* @__PURE__ */ jsxs15(AlertDialogFooter, { children: [
4115
- /* @__PURE__ */ jsx24(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
4116
- /* @__PURE__ */ jsx24(
4412
+ /* @__PURE__ */ jsx25(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
4413
+ /* @__PURE__ */ jsx25(
4117
4414
  AlertDialogAction,
4118
4415
  {
4119
4416
  onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),