@banbox/chat 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +215 -0
  2. package/dist/index.cjs +3408 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +556 -0
  5. package/dist/index.d.ts +556 -0
  6. package/dist/index.js +3385 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +83 -0
  9. package/src/adapter/types.ts +146 -0
  10. package/src/chat/ChatImagePreviewModal.tsx +194 -0
  11. package/src/chat/ChatRoot.tsx +67 -0
  12. package/src/chat/InboxPopup.tsx +312 -0
  13. package/src/chat/SinglePopup.tsx +240 -0
  14. package/src/contexts/ChatUIContext.tsx +30 -0
  15. package/src/contexts/ChatUIProvider.tsx +38 -0
  16. package/src/contexts/GalleryContext.tsx +40 -0
  17. package/src/contexts/GalleryProvider.tsx +89 -0
  18. package/src/hooks/useDisableBodyScroll.ts +16 -0
  19. package/src/icons/index.tsx +248 -0
  20. package/src/index.ts +56 -0
  21. package/src/lottie/typingdotanimation2.json +1 -0
  22. package/src/modals/chat/ChatConfirmModal.tsx +104 -0
  23. package/src/modals/chat/ChatTranslateSettingsModal.tsx +180 -0
  24. package/src/types/index.ts +163 -0
  25. package/src/ui/Button.tsx +83 -0
  26. package/src/ui/Portal.tsx +40 -0
  27. package/src/ui/Select.tsx +74 -0
  28. package/src/ui/chat/AttachmentPreviewStrip.tsx +166 -0
  29. package/src/ui/chat/ChatComposerBar.tsx +231 -0
  30. package/src/ui/chat/ChatFooter.tsx +442 -0
  31. package/src/ui/chat/ChatHeader.tsx +24 -0
  32. package/src/ui/chat/ChatIdentity.tsx +145 -0
  33. package/src/ui/chat/ChatInquiryBar.tsx +57 -0
  34. package/src/ui/chat/ChatListHeader.tsx +179 -0
  35. package/src/ui/chat/ChatMessageItem.tsx +214 -0
  36. package/src/ui/chat/ChatScroll.tsx +64 -0
  37. package/src/ui/chat/ChatSpinner.tsx +49 -0
  38. package/src/ui/chat/ChatThreadItem.tsx +140 -0
  39. package/src/ui/chat/MessageHoverActions.tsx +120 -0
  40. package/src/ui/chat/ReplyCard.tsx +217 -0
  41. package/src/ui/chat/TypingIndicator.tsx +93 -0
  42. package/src/ui/chat/drop-up/BusinessCardDropup.tsx +253 -0
  43. package/src/ui/chat/drop-up/EmojiDropup.tsx +132 -0
  44. package/src/ui/chat/message-items/ChatAddressCard.tsx +130 -0
  45. package/src/ui/chat/message-items/ChatBubbleAudio.tsx +209 -0
  46. package/src/ui/chat/message-items/ChatBubbleFiles.tsx +80 -0
  47. package/src/ui/chat/message-items/ChatBubbleImages.tsx +120 -0
  48. package/src/ui/chat/message-items/ChatBubbleText.tsx +16 -0
  49. package/src/ui/chat/message-items/ChatBusinessCard.tsx +95 -0
  50. package/src/ui/chat/scrollToMessage.ts +61 -0
  51. package/src/ui/chat/types.ts +37 -0
  52. package/src/utils/cn.ts +6 -0
package/dist/index.js ADDED
@@ -0,0 +1,3385 @@
1
+ import { AnimatePresence, motion } from 'framer-motion';
2
+ import { createPortal } from 'react-dom';
3
+ import React11, { createContext, useContext, useRef, useState, useEffect, useMemo, useCallback } from 'react';
4
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
+ import clsx2, { clsx } from 'clsx';
6
+ import { twMerge } from 'tailwind-merge';
7
+
8
+ // src/chat/ChatRoot.tsx
9
+ var ChatUIContext = createContext(null);
10
+ function useChatUI() {
11
+ const ctx = useContext(ChatUIContext);
12
+ if (!ctx) {
13
+ throw new Error("useChatUI must be used within ChatUIProvider");
14
+ }
15
+ return ctx;
16
+ }
17
+ function useDisableBodyScroll(active) {
18
+ useEffect(() => {
19
+ if (!active) return;
20
+ const original = document.body.style.overflow;
21
+ document.body.style.overflow = "hidden";
22
+ return () => {
23
+ document.body.style.overflow = original;
24
+ };
25
+ }, [active]);
26
+ }
27
+ var GalleryContext = createContext(
28
+ void 0
29
+ );
30
+ var useGallery = () => {
31
+ const context = useContext(GalleryContext);
32
+ if (!context) {
33
+ throw new Error("useGallery must be used within a GalleryProvider");
34
+ }
35
+ return context;
36
+ };
37
+ var INITIAL_STATE = {
38
+ images: [],
39
+ currentIndex: null,
40
+ isOpen: false,
41
+ uploadDate: null,
42
+ showDots: false
43
+ };
44
+ var GalleryProvider = ({ children }) => {
45
+ const [state, setState] = useState(INITIAL_STATE);
46
+ const setImages = useCallback((images) => {
47
+ setState((prev2) => ({ ...prev2, images }));
48
+ }, []);
49
+ const setCurrentIndex = useCallback((currentIndex) => {
50
+ setState((prev2) => ({ ...prev2, currentIndex }));
51
+ }, []);
52
+ const setUploadDate = useCallback((uploadDate) => {
53
+ setState((prev2) => ({ ...prev2, uploadDate }));
54
+ }, []);
55
+ const openGallery = useCallback(
56
+ (imgs, startIndex = 0, date = null, dots = false) => {
57
+ setState({
58
+ images: imgs,
59
+ currentIndex: startIndex,
60
+ uploadDate: imgs[startIndex]?.uploadDate ?? date,
61
+ isOpen: true,
62
+ showDots: dots
63
+ });
64
+ },
65
+ []
66
+ );
67
+ const closeGallery = useCallback(() => {
68
+ setState((prev2) => ({ ...prev2, isOpen: false, currentIndex: null }));
69
+ }, []);
70
+ const next = useCallback(() => {
71
+ setState((prev2) => {
72
+ if (prev2.currentIndex === null || prev2.images.length === 0) return prev2;
73
+ const newIndex = prev2.currentIndex < prev2.images.length - 1 ? prev2.currentIndex + 1 : 0;
74
+ return { ...prev2, currentIndex: newIndex, uploadDate: prev2.images[newIndex]?.uploadDate ?? null };
75
+ });
76
+ }, []);
77
+ const prev = useCallback(() => {
78
+ setState((prev2) => {
79
+ if (prev2.currentIndex === null || prev2.images.length === 0) return prev2;
80
+ const newIndex = prev2.currentIndex > 0 ? prev2.currentIndex - 1 : prev2.images.length - 1;
81
+ return { ...prev2, currentIndex: newIndex, uploadDate: prev2.images[newIndex]?.uploadDate ?? null };
82
+ });
83
+ }, []);
84
+ const value = {
85
+ images: state.images,
86
+ currentIndex: state.currentIndex,
87
+ isOpen: state.isOpen,
88
+ uploadDate: state.uploadDate,
89
+ showDots: state.showDots,
90
+ setImages,
91
+ setCurrentIndex,
92
+ setUploadDate,
93
+ openGallery,
94
+ closeGallery,
95
+ next,
96
+ prev
97
+ };
98
+ return /* @__PURE__ */ jsx(GalleryContext.Provider, { value, children });
99
+ };
100
+ function cn(...inputs) {
101
+ return twMerge(clsx(inputs));
102
+ }
103
+ var sizeClasses = {
104
+ "26": "h-[26px] px-[10px] text-[12px] rounded-[4px] gap-1",
105
+ "30": "h-[30px] px-[12px] text-[13px] rounded-[4px] gap-1.5",
106
+ "32": "h-[32px] px-[14px] text-[13px] rounded-[4px] gap-1.5",
107
+ "34": "h-[34px] px-[16px] text-[13px] rounded-[4px] gap-2",
108
+ "36": "h-[36px] px-[18px] text-[13px] rounded-[4px] gap-2",
109
+ "40": "h-[40px] px-[20px] text-[16px] rounded-[4px] gap-2"
110
+ };
111
+ var colorMap = {
112
+ primary: { bg: "bg-[#3D3D3D]", hover: "hover:bg-[#646464]", text: "text-[#3D3D3D]", border: "border-[#3D3D3D]", lightBg: "bg-[#3D3D3D]/10" },
113
+ success: { bg: "bg-[#3d6b42]", hover: "hover:bg-[#2e5939]", text: "text-[#3d6b42]", border: "border-[#3d6b42]", lightBg: "bg-[#3d6b42]/10" },
114
+ warning: { bg: "bg-[#f59e0b]", hover: "hover:bg-[#d97706]", text: "text-[#f59e0b]", border: "border-[#f59e0b]", lightBg: "bg-[#f59e0b]/10" },
115
+ error: { bg: "bg-[#ef4444]", hover: "hover:bg-[#c91b20]", text: "text-[#ef4444]", border: "border-[#ef4444]", lightBg: "bg-[#ef4444]/10" },
116
+ info: { bg: "bg-[#00b8d4]", hover: "hover:bg-[#009db3]", text: "text-[#00b8d4]", border: "border-[#00b8d4]", lightBg: "bg-[#00b8d4]/10" },
117
+ white: { bg: "bg-white", hover: "hover:bg-gray-50", text: "text-black", border: "border-[#cacaca]", borderHover: "hover:border-[#777]", lightBg: "bg-white" },
118
+ transparent: { bg: "bg-transparent", hover: "hover:bg-black/5", text: "text-black", border: "border-[#cacaca]", lightBg: "bg-transparent" },
119
+ black: { bg: "bg-[#3d3d3d]", hover: "hover:bg-[#646464]", text: "text-black", border: "border-[#3d3d3d]", lightBg: "bg-[#ececec]" },
120
+ orange: { bg: "bg-[#FF5300]", hover: "hover:bg-[#e04a00]", text: "text-[#FF5300]", border: "border-[#FF5300]", borderHover: "hover:border-[#e04a00]", lightBg: "bg-[#FFEAE0]" },
121
+ green: { bg: "bg-[#086600]", hover: "hover:bg-[#28A745]", text: "text-[#086600]", border: "border-[#086600]", lightBg: "bg-[#E6F5E6]" },
122
+ blue: { bg: "bg-[#005694]", hover: "hover:bg-[#00375E]", text: "text-[#005694]", border: "border-[#005694]", lightBg: "bg-[#E0EFF8]" }
123
+ };
124
+ var Button = React11.forwardRef(
125
+ ({ variant = "filled", color = "primary", size = "40", leftIcon, rightIcon, iconOnly = false, children, className, disabled, ...props }, ref) => {
126
+ const c = colorMap[color];
127
+ return /* @__PURE__ */ jsxs(
128
+ "button",
129
+ {
130
+ ref,
131
+ disabled,
132
+ className: cn(
133
+ "inline-flex cursor-pointer items-center justify-center font-semibold transition-all duration-200 select-none",
134
+ iconOnly ? `h-[${size === "40" ? "40" : size}px] w-[${size === "40" ? "40" : size}px]` : sizeClasses[size],
135
+ variant === "filled" && [c.bg, c.hover, "text-white", "border border-transparent"],
136
+ variant === "outlined" && [color === "white" ? "bg-white" : "bg-transparent", "border", c.border, c.borderHover, c.text],
137
+ variant === "text" && ["bg-transparent", "border border-transparent", c.text, "hover:bg-black/5"],
138
+ variant === "tonal" && [c.lightBg, c.text, "border border-transparent"],
139
+ disabled && "cursor-not-allowed opacity-50",
140
+ className
141
+ ),
142
+ ...props,
143
+ children: [
144
+ leftIcon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0", children: leftIcon }),
145
+ /* @__PURE__ */ jsx(Fragment, { children }),
146
+ rightIcon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0", children: rightIcon })
147
+ ]
148
+ }
149
+ );
150
+ }
151
+ );
152
+ Button.displayName = "Button";
153
+ var Button_default = Button;
154
+ function ChatConfirmModal({
155
+ open,
156
+ title = "DELETE CHAT",
157
+ confirmLabel = "Yes, Delete",
158
+ cancelLabel = "Not Now",
159
+ onConfirm,
160
+ onClose,
161
+ className
162
+ }) {
163
+ React11.useEffect(() => {
164
+ if (!open) return;
165
+ const onKey = (e) => e.key === "Escape" && onClose();
166
+ window.addEventListener("keydown", onKey);
167
+ return () => window.removeEventListener("keydown", onKey);
168
+ }, [open, onClose]);
169
+ if (!open) return null;
170
+ return /* @__PURE__ */ jsxs(
171
+ "div",
172
+ {
173
+ className: "absolute inset-0 z-70 flex items-center justify-center overflow-hidden",
174
+ onClick: (e) => {
175
+ e.stopPropagation();
176
+ onClose();
177
+ },
178
+ children: [
179
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/30" }),
180
+ /* @__PURE__ */ jsxs(
181
+ "div",
182
+ {
183
+ role: "dialog",
184
+ "aria-modal": "true",
185
+ className: cn(
186
+ "relative z-71 w-[420px] overflow-hidden rounded-md bg-white shadow-[0_12px_30px_rgba(0,0,0,0.18)]",
187
+ className
188
+ ),
189
+ onClick: (e) => e.stopPropagation(),
190
+ children: [
191
+ /* @__PURE__ */ jsx("div", { className: "flex h-[44px] items-center bg-[#ff5200] px-4 text-xl font-semibold uppercase tracking-wide text-white", children: title }),
192
+ /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
193
+ /* @__PURE__ */ jsx("h3", { className: "mb-2 text-[14px] font-semibold text-black", children: "Are you Sure you want to delete the chat" }),
194
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 mb-[24px] flex items-start gap-1.5 text-xs font-normal text-[#636363]", children: [
195
+ /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsxs("svg", { className: "h-4 w-4", viewBox: "0 0 16 16", fill: "none", children: [
196
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
197
+ /* @__PURE__ */ jsx("path", { d: "M8 4.5v4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
198
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "11", r: "0.75", fill: "currentColor" })
199
+ ] }) }),
200
+ /* @__PURE__ */ jsx("p", { children: "The chat history is permanently removed from your view; you won't be able to see previous messages anymore. Other person's copy stays, the other user may still have their copy of the conversation." })
201
+ ] }),
202
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-4 border-t border-[#e1e1e1] pt-[24px]", children: [
203
+ /* @__PURE__ */ jsx(
204
+ Button_default,
205
+ {
206
+ variant: "outlined",
207
+ color: "white",
208
+ size: "34",
209
+ className: "flex-1",
210
+ onClick: onClose,
211
+ children: cancelLabel
212
+ }
213
+ ),
214
+ /* @__PURE__ */ jsx(
215
+ Button_default,
216
+ {
217
+ variant: "filled",
218
+ color: "orange",
219
+ size: "34",
220
+ className: "flex-1",
221
+ onClick: () => {
222
+ onConfirm();
223
+ onClose();
224
+ },
225
+ children: confirmLabel
226
+ }
227
+ )
228
+ ] })
229
+ ] })
230
+ ]
231
+ }
232
+ )
233
+ ]
234
+ }
235
+ );
236
+ }
237
+ var ChatXIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "25", height: "24", viewBox: "0 0 25 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
238
+ /* @__PURE__ */ jsx("path", { d: "M18.5 6L6.5 18", stroke: "CurrentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }),
239
+ /* @__PURE__ */ jsx("path", { d: "M6.5 6L18.5 18", stroke: "CurrentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" })
240
+ ] });
241
+ var ChatSearchIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className, children: [
242
+ /* @__PURE__ */ jsx("path", { d: "m21 21-4.34-4.34" }),
243
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" })
244
+ ] });
245
+ var MessageIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
246
+ /* @__PURE__ */ jsx("rect", { x: "2.5", y: "4.16666", width: "15", height: "11.6667", rx: "2", stroke: "CurrentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
247
+ /* @__PURE__ */ jsx("path", { d: "M2.5 5.83334L10 10.8333L17.5 5.83334", stroke: "CurrentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
248
+ ] });
249
+ var BlueBadgeIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
250
+ /* @__PURE__ */ jsx("path", { d: "M12.225 8.47394C12.1812 8.6256 12.085 8.7481 11.9479 8.82685L11.0087 9.35185V10.4252C11.0087 10.746 10.7462 11.0085 10.4254 11.0085H9.34913L8.82705 11.9477C8.7483 12.0848 8.6258 12.181 8.47413 12.2248C8.32538 12.2656 8.16788 12.2481 8.0308 12.1723L6.9983 11.5948L5.9658 12.1723C5.87538 12.2219 5.77913 12.2452 5.67997 12.2452C5.62747 12.2452 5.57497 12.2394 5.52247 12.2248C5.3708 12.181 5.2483 12.0848 5.16955 11.9477L4.64747 11.0085H3.57122C3.25038 11.0085 2.98788 10.746 2.98788 10.4252V9.35185L2.04872 8.82685C1.91163 8.7481 1.81538 8.6256 1.77163 8.47394C1.7308 8.32519 1.7483 8.16769 1.82413 8.0306L2.40163 6.9981L1.82413 5.9656C1.66663 5.68269 1.76872 5.32685 2.04872 5.16935L2.98788 4.64435V3.57102C2.98788 3.25019 3.25038 2.98769 3.57122 2.98769H4.64747L5.16955 2.04852C5.2483 1.91144 5.3708 1.81519 5.52247 1.77144C5.67122 1.7306 5.82872 1.7481 5.9658 1.82394L6.9983 2.40144L8.0308 1.82394C8.16788 1.7481 8.32538 1.7306 8.47413 1.77144C8.6258 1.81519 8.7483 1.91144 8.82705 2.04852L9.34913 2.98769H10.4254C10.7462 2.98769 11.0087 3.25019 11.0087 3.57102V4.64435L11.9479 5.16935C12.2279 5.32685 12.33 5.68269 12.1725 5.9656L11.595 6.9981L12.1725 8.0306C12.2483 8.16769 12.2658 8.32519 12.225 8.47394Z", fill: "url(#badge_grad)" }),
251
+ /* @__PURE__ */ jsx("path", { d: "M10.2578 3.65234C9.46271 4.36337 8.79456 5.33232 8.29345 6.39886C7.81906 7.41661 7.49167 8.53194 7.35135 9.62637H5.50726V9.61243L4.70547 7.41661L4.39144 6.55919L4.25781 6.18974L5.03955 6.16882C5.24668 6.16882 5.43376 6.2943 5.48053 6.48251L5.94155 7.45146L6.31572 8.2322L6.41594 8.44132C6.5028 8.25311 6.58966 8.07187 6.6832 7.89063C7.18432 6.88682 7.7322 5.98061 8.38031 5.21382C8.75447 4.77465 9.16204 4.37731 9.61639 4.03574C9.79679 3.90329 9.97719 3.77782 10.171 3.65931H10.2578V3.65234Z", fill: "white" }),
252
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "badge_grad", x1: "6.9983", y1: "12.2464", x2: "6.9983", y2: "1.75015", gradientUnits: "userSpaceOnUse", children: [
253
+ /* @__PURE__ */ jsx("stop", { stopColor: "#0064E1" }),
254
+ /* @__PURE__ */ jsx("stop", { offset: "0.994", stopColor: "#26B7FF" })
255
+ ] }) })
256
+ ] });
257
+ var ArrowSendAngleIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
258
+ /* @__PURE__ */ jsx("path", { d: "M21.2929 1.29289C21.6834 0.902369 22.3164 0.902369 22.707 1.29289C23.0975 1.68342 23.0975 2.31643 22.707 2.70696L11.707 13.707C11.3164 14.0975 10.6834 14.0975 10.2929 13.707C9.90237 13.3164 9.90237 12.6834 10.2929 12.2929L21.2929 1.29289Z", fill: "url(#send_angle_g1)" }),
259
+ /* @__PURE__ */ jsx("path", { d: "M21.6698 1.05594C22.0323 0.929242 22.4354 1.02171 22.7069 1.29325C22.9784 1.56479 23.0709 1.96787 22.9442 2.33036L15.9442 22.3304C15.8088 22.7173 15.4504 22.9825 15.0409 22.9993C14.6312 23.016 14.2523 22.7812 14.0858 22.4065L10.242 13.7581L1.59361 9.91434C1.21893 9.74782 0.984123 9.36894 1.00084 8.95926C1.01765 8.54969 1.28286 8.19137 1.66978 8.05594L21.6698 1.05594ZM4.71177 9.11063L11.4061 12.0862L11.4891 12.1282C11.6764 12.2333 11.826 12.3963 11.9139 12.594L14.8885 19.2874L20.369 3.63016L4.71177 9.11063Z", fill: "url(#send_angle_g2)" }),
260
+ /* @__PURE__ */ jsxs("defs", { children: [
261
+ /* @__PURE__ */ jsxs("linearGradient", { id: "send_angle_g1", x1: "16.4999", y1: "1", x2: "16.4999", y2: "13.9998", gradientUnits: "userSpaceOnUse", children: [
262
+ /* @__PURE__ */ jsx("stop", { stopColor: "#33C9D4" }),
263
+ /* @__PURE__ */ jsx("stop", { offset: "0.65", stopColor: "#2753FB" })
264
+ ] }),
265
+ /* @__PURE__ */ jsxs("linearGradient", { id: "send_angle_g2", x1: "12.0001", y1: "1", x2: "12.0001", y2: "23.0001", gradientUnits: "userSpaceOnUse", children: [
266
+ /* @__PURE__ */ jsx("stop", { stopColor: "#33C9D4" }),
267
+ /* @__PURE__ */ jsx("stop", { offset: "0.65", stopColor: "#2753FB" })
268
+ ] })
269
+ ] })
270
+ ] });
271
+ var ArrowSendIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
272
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#send_clip)", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.061819 2.80424C-0.034006 2.44295 -0.018158 2.06324 0.107481 1.71021C0.23312 1.35718 0.463272 1.04566 0.770608 0.812635C1.07794 0.57961 1.44955 0.434872 1.84131 0.395609C2.23306 0.356346 2.6285 0.424206 2.98068 0.591132L22.8602 9.98918C23.2025 10.1507 23.4904 10.3991 23.6916 10.7067C23.8929 11.0143 23.9995 11.3689 23.9995 11.7305C23.9995 12.0922 23.8929 12.4468 23.6916 12.7543C23.4904 13.0619 23.2025 13.3104 22.8602 13.4719L2.98068 22.8699C2.6285 23.0369 2.23306 23.1047 1.84131 23.0655C1.44955 23.0262 1.07794 22.8815 0.770608 22.6484C0.463272 22.4154 0.23312 22.1039 0.107481 21.7509C-0.018158 21.3978 -0.034006 21.0181 0.061819 20.6568L2.14353 12.7859L14.232 11.7305L2.14353 10.6752L0.061819 2.80424Z", fill: "CurrentColor" }) }),
273
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "send_clip", children: /* @__PURE__ */ jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
274
+ ] });
275
+ var RecordMicIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
276
+ /* @__PURE__ */ jsx("path", { d: "M11.5298 20.0197V23.0399H6.47538C6.34807 23.0399 6.22598 23.0904 6.13596 23.1804C6.04595 23.2705 5.99537 23.3926 5.99537 23.5199C5.99537 23.6472 6.04595 23.7693 6.13596 23.8593C6.22598 23.9493 6.34807 23.9999 6.47538 23.9999H17.5443C17.6716 23.9999 17.7937 23.9493 17.8837 23.8593C17.9737 23.7693 18.0243 23.6472 18.0243 23.5199C18.0243 23.3926 17.9737 23.2705 17.8837 23.1804C17.7937 23.0904 17.6716 23.0399 17.5443 23.0399H12.4898V20.0197C16.6827 19.7696 20.0196 16.2891 20.0196 12.0343V10.23C20.0196 10.1027 19.9691 9.98061 19.879 9.89059C19.789 9.80057 19.6669 9.75 19.5396 9.75C19.4123 9.75 19.2902 9.80057 19.2002 9.89059C19.1102 9.98061 19.0596 10.1027 19.0596 10.23V12.0348C19.0596 15.9214 15.8974 19.0841 12.0098 19.0841C8.12227 19.0841 4.96001 15.9214 4.96001 12.0343V10.23C4.96001 10.1027 4.90944 9.98061 4.81942 9.89059C4.7294 9.80057 4.60731 9.75 4.48 9.75C4.3527 9.75 4.23061 9.80057 4.14059 9.89059C4.05057 9.98061 4 10.1027 4 10.23V12.0348C4 16.2891 7.33698 19.7696 11.5298 20.0197Z", fill: "CurrentColor" }),
277
+ /* @__PURE__ */ jsx("path", { d: "M12.0067 16.7132C14.5867 16.7132 16.6853 14.6147 16.6853 12.0346V4.67859C16.6853 2.09858 14.5867 0 12.0067 0C9.4267 0 7.32812 2.09858 7.32812 4.67859V12.0346C7.32812 14.6147 9.4267 16.7132 12.0067 16.7132ZM8.28813 4.67859C8.28813 2.62802 9.95662 0.960007 12.0067 0.960007C14.0568 0.960007 15.7253 2.62802 15.7253 4.67859V12.0346C15.7253 14.0852 14.0568 15.7532 12.0067 15.7532C9.95662 15.7532 8.28813 14.0852 8.28813 12.0346V4.67859Z", fill: "CurrentColor" })
278
+ ] });
279
+ var AttachIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
280
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#attach_clip)", children: /* @__PURE__ */ jsx("path", { d: "M4.17813 15.1695C3.35175 15.1697 2.54387 14.9248 1.85671 14.4658C1.16955 14.0068 0.634002 13.3542 0.317821 12.5907C0.00164127 11.8272 -0.0809573 10.9871 0.0804774 10.1766C0.241912 9.36615 0.640124 8.6218 1.22473 8.03772L7.38945 1.87227C7.49167 1.77005 7.63031 1.71262 7.77488 1.71262C7.91944 1.71262 8.05809 1.77005 8.16031 1.87227C8.26253 1.9745 8.31996 2.11314 8.31996 2.25771C8.31996 2.40227 8.26253 2.54092 8.16031 2.64314L1.99486 8.80786C1.41359 9.38914 1.08503 10.1729 1.08203 10.9913C1.07903 11.8097 1.40196 12.5959 1.97897 13.1814C2.55598 13.7668 3.33986 14.1017 4.15823 14.1075C4.97659 14.1132 5.76532 13.7893 6.35061 13.212L14.325 5.20856C14.6899 4.83175 14.8921 4.3266 14.8879 3.80208C14.8837 3.27756 14.6734 2.77572 14.3025 2.40482C13.9316 2.03392 13.4298 1.82368 12.9053 1.81947C12.3807 1.81526 11.8756 2.01741 11.4988 2.38231L5.07759 8.80786C4.90208 8.98338 4.80411 9.22076 4.80411 9.46823C4.80411 9.7157 4.90208 9.95308 5.07759 10.1286C5.25311 10.3041 5.49049 10.4021 5.73796 10.4021C5.98543 10.4021 6.22281 10.3041 6.39833 10.1286L10.4707 5.98306C10.521 5.93099 10.5811 5.88945 10.6475 5.86086C10.714 5.83227 10.7855 5.81721 10.8579 5.81655C10.9302 5.81588 11.002 5.82964 11.0689 5.857C11.1359 5.88437 11.1968 5.9248 11.248 5.97594C11.2992 6.02708 11.3396 6.0879 11.3671 6.15485C11.3945 6.22181 11.4083 6.29355 11.4077 6.36591C11.4071 6.43826 11.3921 6.50977 11.3636 6.57626C11.3351 6.64276 11.2936 6.7029 11.2416 6.75319L7.13225 10.8633C6.94673 11.0488 6.72646 11.196 6.48404 11.2965C6.24162 11.3969 5.98179 11.4487 5.71938 11.4487C5.45697 11.4487 5.19713 11.3971 4.95468 11.2967C4.71223 11.1963 4.49194 11.0491 4.30636 10.8636C4.12079 10.6781 3.97357 10.4578 3.87312 10.2154C3.77267 9.97299 3.72095 9.71315 3.72092 9.45074C3.72085 8.92079 3.93131 8.41251 4.306 8.03772L10.7286 1.61944C11.3077 1.0403 12.0931 0.714912 12.912 0.714844C13.731 0.714776 14.5164 1.04004 15.0955 1.61907C15.6747 2.19811 16.0001 2.98349 16.0001 3.80244C16.0002 4.6214 15.6749 5.40683 15.0959 5.98597L7.13298 13.946C6.74578 14.3351 6.28527 14.6436 5.77807 14.8536C5.27088 15.0636 4.72708 15.171 4.17813 15.1695Z", fill: "CurrentColor" }) }),
281
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "attach_clip", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white" }) }) })
282
+ ] });
283
+ var SmileIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
284
+ /* @__PURE__ */ jsx("path", { d: "M8.0026 14.6673C11.6845 14.6673 14.6693 11.6825 14.6693 8.00065C14.6693 4.31875 11.6845 1.33398 8.0026 1.33398C4.32071 1.33398 1.33594 4.31875 1.33594 8.00065C1.33594 11.6825 4.32071 14.6673 8.0026 14.6673Z", stroke: "black", strokeLinecap: "round", strokeLinejoin: "round" }),
285
+ /* @__PURE__ */ jsx("path", { d: "M5.33594 9.33398C5.33594 9.33398 6.33594 10.6673 8.0026 10.6673C9.66927 10.6673 10.6693 9.33398 10.6693 9.33398", stroke: "black", strokeLinecap: "round", strokeLinejoin: "round" }),
286
+ /* @__PURE__ */ jsx("path", { d: "M6 6H6.00667", stroke: "black", strokeLinecap: "round", strokeLinejoin: "round" }),
287
+ /* @__PURE__ */ jsx("path", { d: "M10 6H10.0067", stroke: "black", strokeLinecap: "round", strokeLinejoin: "round" })
288
+ ] });
289
+ var ProfileCardIcon = ({ className }) => /* @__PURE__ */ jsxs("svg", { className, width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
290
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "2.66406", width: "12", height: "10.6667", rx: "3", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
291
+ /* @__PURE__ */ jsx("circle", { cx: "5.99935", cy: "6.66927", r: "1.33333", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
292
+ /* @__PURE__ */ jsx("path", { d: "M10 5.33333H11.3333", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
293
+ /* @__PURE__ */ jsx("path", { d: "M10 7.9974H11.3333", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
294
+ /* @__PURE__ */ jsx("path", { d: "M4.66602 10.6693H11.3327", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })
295
+ ] });
296
+ var NewLanguageIcon = ({ className }) => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
297
+ /* @__PURE__ */ jsx("path", { d: "M9.99414 10.548C9.99414 10.5385 9.99731 10.521 10.0037 10.4955L10.8914 7.58423C10.9167 7.50464 10.9749 7.44336 11.0656 7.40039C11.1562 7.35742 11.2604 7.33594 11.3782 7.33594C11.4958 7.33594 11.6001 7.35742 11.6908 7.40039C11.7815 7.44336 11.8395 7.50464 11.865 7.58423L12.7574 10.4955C12.7638 10.521 12.7671 10.5385 12.7671 10.548C12.7671 10.6307 12.7153 10.7024 12.6119 10.7628C12.5085 10.8232 12.4011 10.8534 12.2898 10.8534C12.153 10.8534 12.0718 10.8074 12.0464 10.7151L11.8842 10.1185H10.8771L10.7148 10.7151C10.6893 10.8074 10.6082 10.8534 10.4714 10.8534C10.36 10.8534 10.2526 10.8232 10.1492 10.7628C10.0458 10.7024 9.99414 10.6307 9.99414 10.548ZM11.0298 9.54578H11.7266L11.3782 8.26672L11.0298 9.54578Z", fill: "currentColor" }),
298
+ /* @__PURE__ */ jsx("path", { d: "M13.7277 5.55713H10.5369V3.99109C10.5369 2.73816 9.51758 1.71875 8.26453 1.71875H2.27234C1.01941 1.71875 0 2.73816 0 3.99109V6.65881C0 7.89465 0.991577 8.9032 2.22107 8.93067C2.21289 9.18982 2.18396 9.47852 2.13452 9.79297C2.10107 10.0052 2.18005 10.2139 2.34558 10.3511C2.45667 10.4431 2.59204 10.491 2.73035 10.491C2.79919 10.491 2.86877 10.479 2.93652 10.4548C3.38696 10.2938 4.17053 9.8866 4.57458 8.93115H6.82654V10.4973C6.82654 11.7502 7.84595 12.7697 9.09888 12.7697H11.4254C11.8296 13.7251 12.613 14.1322 13.0636 14.2933C13.1312 14.3175 13.2008 14.3293 13.2697 14.3293C13.408 14.3293 13.5433 14.2815 13.6544 14.1895C13.8201 14.0524 13.8989 13.8436 13.8655 13.6313C13.816 13.317 13.7871 13.0282 13.7789 12.769C15.0084 12.7417 16 11.7332 16 10.4973V7.82959C16 6.57654 14.9806 5.55713 13.7277 5.55713ZM6.48767 4.29578C6.66028 4.29578 6.80017 4.15588 6.80017 3.98328C6.80017 3.81067 6.66028 3.67078 6.48767 3.67078H5.29553V3.20312C5.29553 3.03052 5.15564 2.89062 4.98303 2.89062C4.81055 2.89062 4.67053 3.03052 4.67053 3.20312V3.67078H3.47852C3.30591 3.67078 3.16602 3.81067 3.16602 3.98328C3.16602 4.15588 3.30591 4.29578 3.47852 4.29578H6.48767ZM15.375 10.4972C15.375 11.4056 14.636 12.1447 13.7277 12.1447H13.467C13.2991 12.1447 13.1611 12.2775 13.1548 12.4454C13.1412 12.8063 13.1708 13.226 13.2427 13.6934C12.7877 13.5238 12.2042 13.1554 11.9375 12.358C11.8949 12.2306 11.7755 12.1447 11.6412 12.1447H9.09888C8.19055 12.1447 7.45154 11.4056 7.45154 10.4972V7.82947C7.45154 7.54932 7.52307 7.27271 7.65833 7.02966C7.74231 6.87878 7.68811 6.6886 7.53723 6.60461C7.38647 6.52063 7.19617 6.57495 7.11218 6.72571C6.92529 7.06152 6.82654 7.44312 6.82654 7.82947V8.30615H4.35876C4.22437 8.30615 4.10498 8.39209 4.06238 8.51953C3.79578 9.3169 3.21228 9.68543 2.75732 9.85486C2.8291 9.38745 2.85864 8.96777 2.84521 8.60693C2.83887 8.43897 2.70093 8.30615 2.53284 8.30615H2.27234C1.36401 8.30615 0.625 7.56714 0.625 6.65881V3.99109C0.625 3.08276 1.36401 2.34375 2.27234 2.34375H8.26453C9.17285 2.34375 9.91187 3.08276 9.91187 3.99109V5.55725H9.46875C9.29614 5.55725 9.15625 5.69714 9.15625 5.86975C9.15625 6.04236 9.29614 6.18225 9.46875 6.18225H13.7277C14.636 6.18225 15.375 6.92127 15.375 7.82959V10.4972Z", fill: "currentColor" })
299
+ ] });
300
+ var ChatInfoIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
301
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "9", r: "6.75", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
302
+ /* @__PURE__ */ jsx("path", { d: "M9.00016 6H9.00766", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
303
+ /* @__PURE__ */ jsx("path", { d: "M8.25 9H9V12H9.75", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })
304
+ ] });
305
+ var ArrowBackUpIcon = ({ className = "" }) => /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: /* @__PURE__ */ jsx("path", { d: "M6.13128 10.3687C6.47299 10.7104 7.02701 10.7104 7.36872 10.3687C7.71043 10.027 7.71043 9.47299 7.36872 9.13128L6.75 9.75L6.13128 10.3687ZM3.75 6.75L3.13128 6.13128C2.78957 6.47299 2.78957 7.02701 3.13128 7.36872L3.75 6.75ZM7.36872 4.36872C7.71043 4.02701 7.71043 3.47299 7.36872 3.13128C7.02701 2.78957 6.47299 2.78957 6.13128 3.13128L6.75 3.75L7.36872 4.36872ZM3.75 5.875C3.26675 5.875 2.875 6.26675 2.875 6.75C2.875 7.23325 3.26675 7.625 3.75 7.625V6.75V5.875ZM11.25 11.875C10.7668 11.875 10.375 12.2668 10.375 12.75C10.375 13.2332 10.7668 13.625 11.25 13.625V12.75V11.875ZM6.75 9.75L7.36872 9.13128L4.36872 6.13128L3.75 6.75L3.13128 7.36872L6.13128 10.3687L6.75 9.75ZM3.75 6.75L4.36872 7.36872L7.36872 4.36872L6.75 3.75L6.13128 3.13128L3.13128 6.13128L3.75 6.75ZM3.75 6.75V7.625H12V6.75V5.875H3.75V6.75ZM12 6.75V7.625C13.1736 7.625 14.125 8.5764 14.125 9.75H15H15.875C15.875 7.6099 14.1401 5.875 12 5.875V6.75ZM15 9.75H14.125C14.125 10.9236 13.1736 11.875 12 11.875V12.75V13.625C14.1401 13.625 15.875 11.8901 15.875 9.75H15ZM12 12.75V11.875H11.25V12.75V13.625H12V12.75Z", fill: "CurrentColor" }) });
306
+ var FileIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
307
+ /* @__PURE__ */ jsx("path", { d: "M14 3V7C14 7.55228 14.4477 8 15 8H19", stroke: "CurrentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }),
308
+ /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M17 21H7C5.89543 21 5 20.1046 5 19V5C5 3.89543 5.89543 3 7 3H14L19 8V19C19 20.1046 18.1046 21 17 21Z", stroke: "CurrentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }),
309
+ /* @__PURE__ */ jsx("path", { d: "M9 9H10", stroke: "CurrentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }),
310
+ /* @__PURE__ */ jsx("path", { d: "M9 13H15", stroke: "CurrentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }),
311
+ /* @__PURE__ */ jsx("path", { d: "M9 17H15", stroke: "CurrentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" })
312
+ ] });
313
+ var MessageReplayIcon = ({ className = "" }) => /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: /* @__PURE__ */ jsx("path", { d: "M6.70469 2.33346C6.87969 2.3918 6.93802 2.5668 6.93802 2.80013C6.93802 3.50013 6.93802 4.25846 6.93802 4.95846V5.07513C7.17135 5.07513 7.40469 5.07513 7.63802 5.07513C8.27969 5.07513 8.97969 5.25013 9.62135 5.48346C10.788 5.95013 11.488 6.7668 11.7797 7.93346C12.013 8.6918 12.013 9.45013 12.0714 10.2668C12.0714 10.4418 12.0714 10.6168 12.0714 10.7335C12.0714 10.9085 11.9547 11.0835 11.7797 11.0835C11.6047 11.0835 11.488 11.0835 11.3714 10.8501C11.2547 10.6168 11.138 10.3835 10.963 10.1501C10.5547 9.45013 9.97135 8.98346 9.27135 8.75013C8.51302 8.45846 7.75469 8.40013 6.93802 8.40013V8.5168C6.93802 9.27513 6.93802 9.97513 6.93802 10.7335C6.93802 10.9085 6.93802 11.0251 6.70469 11.0835C6.52969 11.1418 6.41302 11.0835 6.29635 10.9668C4.83802 9.62513 3.37969 8.28346 1.97969 6.9418C1.92135 6.9418 1.86302 6.82513 1.80469 6.70846V6.53346C1.80469 6.47513 1.92135 6.4168 1.97969 6.35846C3.43802 5.0168 4.83802 3.73346 6.29635 2.3918C6.35469 2.33346 6.47135 2.27513 6.52969 2.2168H6.70469V2.33346Z", fill: "CurrentColor" }) });
314
+ var RightArrow = ({ className }) => /* @__PURE__ */ jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
315
+ /* @__PURE__ */ jsx("path", { d: "M7.5 18H28.5", stroke: "CurrentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }),
316
+ /* @__PURE__ */ jsx("path", { d: "M19.5 27L28.5 18", stroke: "CurrentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }),
317
+ /* @__PURE__ */ jsx("path", { d: "M19.5 9L28.5 18", stroke: "CurrentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })
318
+ ] });
319
+ var FileDownloadIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
320
+ /* @__PURE__ */ jsx("path", { d: "M11.6641 2.5V5.83333C11.6641 6.29357 12.0372 6.66667 12.4974 6.66667H15.8307", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
321
+ /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M14.1641 17.5H5.83073C4.91025 17.5 4.16406 16.7538 4.16406 15.8333V4.16667C4.16406 3.24619 4.91025 2.5 5.83073 2.5H11.6641L15.8307 6.66667V15.8333C15.8307 16.7538 15.0845 17.5 14.1641 17.5Z", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
322
+ /* @__PURE__ */ jsx("path", { d: "M10.0026 9.16602V14.166", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
323
+ /* @__PURE__ */ jsx("path", { d: "M7.5 11.666L10 14.166L12.5 11.666", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" })
324
+ ] });
325
+ var BusinessInfoIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
326
+ /* @__PURE__ */ jsx("path", { d: "M2 13.9993H14", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
327
+ /* @__PURE__ */ jsx("path", { d: "M3.33594 14V4.66667L8.66927 2V14", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
328
+ /* @__PURE__ */ jsx("path", { d: "M12.6641 13.9993V7.33268L8.66406 4.66602", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
329
+ /* @__PURE__ */ jsx("path", { d: "M5.9974 5.99992V6.00659", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
330
+ /* @__PURE__ */ jsx("path", { d: "M5.9974 7.99992V8.00659", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
331
+ /* @__PURE__ */ jsx("path", { d: "M5.9974 9.99992V10.0066", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
332
+ /* @__PURE__ */ jsx("path", { d: "M5.9974 11.9999V12.0066", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" })
333
+ ] });
334
+ var ChatMailIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
335
+ /* @__PURE__ */ jsx("rect", { x: "1.75", y: "2.91797", width: "10.5", height: "8.16667", rx: "2", stroke: "black", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }),
336
+ /* @__PURE__ */ jsx("path", { d: "M1.75 4.08203L7 7.58203L12.25 4.08203", stroke: "black", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
337
+ ] });
338
+ var ChatPhoneCallIcon = ({ className = "" }) => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: /* @__PURE__ */ jsx("path", { d: "M3.33333 2.66602H6L7.33333 5.99935L5.66667 6.99935C6.38064 8.44704 7.55231 9.61871 9 10.3327L10 8.66602L13.3333 9.99935V12.666C13.3333 13.4024 12.7364 13.9993 12 13.9993C6.61843 13.6723 2.32704 9.38092 2 3.99935C2 3.26297 2.59695 2.66602 3.33333 2.66602", stroke: "CurrentColor", strokeLinecap: "round", strokeLinejoin: "round" }) });
339
+ var BadgeHomeIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
340
+ /* @__PURE__ */ jsx("path", { d: "M2.91667 7H1.75L7 1.75L12.25 7H11.0833", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
341
+ /* @__PURE__ */ jsx("path", { d: "M2.91406 7V11.0833C2.91406 11.7277 3.4364 12.25 4.08073 12.25H9.91406C10.5584 12.25 11.0807 11.7277 11.0807 11.0833V7", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
342
+ /* @__PURE__ */ jsx("rect", { x: "5.83594", y: "7", width: "2.33333", height: "2.33333", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })
343
+ ] });
344
+ var BadgeOfficeIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
345
+ /* @__PURE__ */ jsx("path", { d: "M1.75 12.2507H12.25", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
346
+ /* @__PURE__ */ jsx("path", { d: "M2.91406 12.25V4.08333L7.58073 1.75V12.25", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
347
+ /* @__PURE__ */ jsx("path", { d: "M11.0859 12.2507V6.41732L7.58594 4.08398", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
348
+ /* @__PURE__ */ jsx("path", { d: "M5.2526 5.24969V5.25552", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
349
+ /* @__PURE__ */ jsx("path", { d: "M5.2526 6.99969V7.00552", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
350
+ /* @__PURE__ */ jsx("path", { d: "M5.2526 8.74969V8.75552", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
351
+ /* @__PURE__ */ jsx("path", { d: "M5.2526 10.4997V10.5055", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })
352
+ ] });
353
+ var MapPinIcon = ({ className = "" }) => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: [
354
+ /* @__PURE__ */ jsx("path", { d: "M11.9974 4.00188V4.00854", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
355
+ /* @__PURE__ */ jsx("path", { d: "M12.0028 8.66599L9.66942 5.33266C9.04883 4.21101 9.31413 2.8065 10.3011 1.9885C11.2881 1.1705 12.7174 1.1705 13.7044 1.9885C14.6914 2.8065 14.9567 4.21101 14.3361 5.33266L12.0028 8.66599", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
356
+ /* @__PURE__ */ jsx("path", { d: "M7 3.16797L6 2.66797L2 4.66797V13.3346L6 11.3346L10 13.3346L14 11.3346V10.0013", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
357
+ /* @__PURE__ */ jsx("path", { d: "M5.9974 2.66797V11.3346", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
358
+ /* @__PURE__ */ jsx("path", { d: "M9.9974 10V13.3333", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })
359
+ ] });
360
+ var Select = ({ options, value, onChange, placeholder = "Select...", size = 36, className, disabled }) => {
361
+ const [open, setOpen] = useState(false);
362
+ const ref = useRef(null);
363
+ const selected = options.find((o) => o.value === value);
364
+ useEffect(() => {
365
+ if (!open) return;
366
+ const onDoc = (e) => {
367
+ if (ref.current && !ref.current.contains(e.target)) setOpen(false);
368
+ };
369
+ document.addEventListener("mousedown", onDoc);
370
+ return () => document.removeEventListener("mousedown", onDoc);
371
+ }, [open]);
372
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("relative", className), children: [
373
+ /* @__PURE__ */ jsxs(
374
+ "button",
375
+ {
376
+ type: "button",
377
+ disabled,
378
+ onClick: () => setOpen((v) => !v),
379
+ className: cn(
380
+ "flex w-full items-center justify-between rounded-[4px] border border-[#cacaca] bg-white px-3 text-[13px] text-left",
381
+ disabled && "cursor-not-allowed opacity-50"
382
+ ),
383
+ style: { height: size },
384
+ children: [
385
+ /* @__PURE__ */ jsx("span", { className: cn(selected ? "text-black" : "text-[#9C9C9C]"), children: selected ? selected.label : placeholder }),
386
+ /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: cn("shrink-0 transition-transform", open && "rotate-180"), children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6" }) })
387
+ ]
388
+ }
389
+ ),
390
+ open && /* @__PURE__ */ jsx("div", { className: "absolute left-0 right-0 top-full z-50 mt-1 max-h-[200px] overflow-y-auto rounded-[4px] border border-[#e1e1e1] bg-white shadow-[0_4px_16px_rgba(0,0,0,0.08)]", children: options.map((opt) => /* @__PURE__ */ jsx(
391
+ "button",
392
+ {
393
+ type: "button",
394
+ className: cn(
395
+ "flex w-full items-center px-3 py-2 text-[13px] text-left hover:bg-black/5",
396
+ opt.value === value && "bg-black/5 font-medium"
397
+ ),
398
+ onClick: () => {
399
+ onChange?.(opt.value);
400
+ setOpen(false);
401
+ },
402
+ children: opt.label
403
+ },
404
+ opt.value
405
+ )) })
406
+ ] });
407
+ };
408
+ var Select_default = Select;
409
+ var LANG_OPTIONS = [
410
+ "English",
411
+ "Bangla",
412
+ "Arabic",
413
+ "Chinese",
414
+ "French",
415
+ "German",
416
+ "Hindi",
417
+ "Italian",
418
+ "Japanese",
419
+ "Korean",
420
+ "Portuguese",
421
+ "Russian",
422
+ "Spanish",
423
+ "Turkish",
424
+ "Urdu"
425
+ ].map((l) => ({ label: l, value: l }));
426
+ var ChatTranslateSettingsModal = ({
427
+ open,
428
+ onClose,
429
+ onSave,
430
+ initial,
431
+ className,
432
+ variant = "group"
433
+ }) => {
434
+ const [incomingTarget, setIncomingTarget] = useState(
435
+ initial?.incomingTarget ?? ""
436
+ );
437
+ React11.useEffect(() => {
438
+ if (!open) return;
439
+ const onKey = (e) => {
440
+ if (e.key === "Escape") onClose();
441
+ };
442
+ window.addEventListener("keydown", onKey);
443
+ return () => window.removeEventListener("keydown", onKey);
444
+ }, [open, onClose]);
445
+ if (!open) return null;
446
+ const isSingle = variant === "single";
447
+ const handleSave = () => {
448
+ onSave({
449
+ incomingTarget,
450
+ autoIncoming: true,
451
+ enableOutgoing: false,
452
+ outgoingFrom: "English",
453
+ outgoingTo: "Bangla"
454
+ });
455
+ };
456
+ const content = /* @__PURE__ */ jsxs(
457
+ "div",
458
+ {
459
+ className: clsx2(
460
+ isSingle ? "fixed inset-0 z-9999 flex" : "absolute inset-0 z-50 flex items-center justify-center"
461
+ ),
462
+ onClick: () => onClose(),
463
+ children: [
464
+ /* @__PURE__ */ jsx("div", { className: isSingle ? "fixed inset-0 bg-black/30" : "absolute inset-0 bg-black/30" }),
465
+ /* @__PURE__ */ jsxs(
466
+ "div",
467
+ {
468
+ role: "dialog",
469
+ "aria-modal": "true",
470
+ "aria-labelledby": "translate-settings-title",
471
+ onClick: (e) => e.stopPropagation(),
472
+ className: clsx2(
473
+ isSingle ? "fixed bottom-6 right-6 w-[500px] max-w-[95vw]" : "relative w-[500px] max-w-[95vw]",
474
+ "z-10000 overflow-visible rounded-md bg-white shadow-[0_12px_30px_rgba(0,0,0,0.18)]",
475
+ className
476
+ ),
477
+ children: [
478
+ /* @__PURE__ */ jsx("div", { className: "flex h-[44px] w-full items-center rounded-t-md bg-[#f8f8f8] px-6 py-[7px] shadow-[0px_2px_2px_rgba(47,47,47,0.08)]", children: /* @__PURE__ */ jsx(
479
+ "h2",
480
+ {
481
+ id: "translate-settings-title",
482
+ className: "w-full text-[20px] font-semibold text-black",
483
+ children: "Translation Settings"
484
+ }
485
+ ) }),
486
+ /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
487
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
488
+ /* @__PURE__ */ jsx("span", { className: "text-[12px] font-medium text-black", children: "Translate message into" }),
489
+ /* @__PURE__ */ jsx(
490
+ Select_default,
491
+ {
492
+ options: LANG_OPTIONS,
493
+ value: incomingTarget,
494
+ onChange: setIncomingTarget,
495
+ placeholder: "Select Language",
496
+ size: 36
497
+ }
498
+ )
499
+ ] }),
500
+ /* @__PURE__ */ jsxs("div", { className: "mt-6 flex items-start gap-1.5 text-[#FF5300]", children: [
501
+ /* @__PURE__ */ jsx(ChatInfoIcon, { className: "h-4 w-4 shrink-0" }),
502
+ /* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed", children: "Automatically translate incoming messages. The language you save here will be used to display all incoming messages. You can choose from Spanish, Russian, French, Arabic, Portuguese, Turkish, Bangla, and among others." })
503
+ ] })
504
+ ] }),
505
+ /* @__PURE__ */ jsx("div", { className: "flex h-[52px] items-center justify-end rounded-b-md bg-[#f8f8f8] px-6", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
506
+ /* @__PURE__ */ jsx(
507
+ Button_default,
508
+ {
509
+ onClick: onClose,
510
+ variant: "outlined",
511
+ color: "black",
512
+ size: "34",
513
+ children: "Cancel"
514
+ }
515
+ ),
516
+ /* @__PURE__ */ jsx(
517
+ Button_default,
518
+ {
519
+ onClick: handleSave,
520
+ variant: "filled",
521
+ color: "black",
522
+ size: "34",
523
+ children: "Update"
524
+ }
525
+ )
526
+ ] }) })
527
+ ]
528
+ }
529
+ )
530
+ ]
531
+ }
532
+ );
533
+ if (isSingle) {
534
+ return createPortal(content, document.body);
535
+ }
536
+ return content;
537
+ };
538
+ var ChatTranslateSettingsModal_default = ChatTranslateSettingsModal;
539
+ var extColor = (ext) => {
540
+ const e = ext.toLowerCase();
541
+ if (e === "pdf") {
542
+ return "text-[#D93025]";
543
+ }
544
+ if (e === "ppt" || e === "pptx") {
545
+ return "text-[#E69138]";
546
+ }
547
+ if (e === "doc" || e === "docx") {
548
+ return "text-[#2B579A]";
549
+ }
550
+ return "text-[#6B7280]";
551
+ };
552
+ var FilePreviewChip = ({ name, sizeMB, ext, onRemove }) => {
553
+ return /* @__PURE__ */ jsxs(
554
+ "div",
555
+ {
556
+ className: cn(
557
+ "mr-2 inline-flex h-[65px] max-w-[185px] items-center gap-3 whitespace-nowrap rounded-sm",
558
+ "border border-[#e1e1e1] bg-white px-3 py-2"
559
+ ),
560
+ children: [
561
+ /* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
562
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
563
+ /* @__PURE__ */ jsx(FileIcon, { className: cn("h-[18px] w-[18px]", extColor(ext)) }),
564
+ /* @__PURE__ */ jsx("div", { className: "truncate text-[13px] font-normal text-black", children: name })
565
+ ] }),
566
+ /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-2 text-xs text-[#636363]", children: [
567
+ /* @__PURE__ */ jsxs("span", { children: [
568
+ sizeMB.toFixed(1),
569
+ " MB"
570
+ ] }),
571
+ /* @__PURE__ */ jsx("span", { className: "h-3 w-px bg-[#e1e1e1]" }),
572
+ /* @__PURE__ */ jsx("span", { className: "uppercase", children: ext })
573
+ ] })
574
+ ] }) }),
575
+ /* @__PURE__ */ jsx(
576
+ "button",
577
+ {
578
+ type: "button",
579
+ onClick: onRemove,
580
+ title: "Remove",
581
+ "aria-label": "Remove file",
582
+ className: cn(
583
+ "grid h-8 w-8 place-items-center rounded-full bg-white text-[#3D3D3D]",
584
+ "shadow-[0px_2px_4px_0px_#A5A3AE4D] hover:bg-black/5"
585
+ ),
586
+ children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-[18px] w-[18px]" })
587
+ }
588
+ )
589
+ ]
590
+ }
591
+ );
592
+ };
593
+ var ImageThumb = ({ url, onRemove }) => {
594
+ return /* @__PURE__ */ jsxs(
595
+ "div",
596
+ {
597
+ className: cn(
598
+ "relative mr-2 inline-block h-[65px] w-[65px] rounded-sm",
599
+ "border border-[#e1e1e1] bg-[#F7F7F7]"
600
+ ),
601
+ children: [
602
+ /* @__PURE__ */ jsx("img", { src: url, alt: "", className: "h-full w-full rounded-sm object-cover", loading: "lazy" }),
603
+ /* @__PURE__ */ jsx(
604
+ "button",
605
+ {
606
+ type: "button",
607
+ onClick: onRemove,
608
+ "aria-label": "Remove image",
609
+ title: "Remove image",
610
+ className: cn(
611
+ "absolute left-1/2 top-1/2 z-10 grid h-6 w-6 -translate-x-1/2 -translate-y-1/2 place-items-center",
612
+ "rounded-full bg-black/30 text-white",
613
+ "shadow-[0px_2px_4px_0px_#A5A3AE4D]"
614
+ ),
615
+ children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-4 w-4 text-white" })
616
+ }
617
+ )
618
+ ]
619
+ }
620
+ );
621
+ };
622
+ var AttachmentPreviewStrip = ({
623
+ imgPreviews,
624
+ filePreviews,
625
+ onRemoveFile,
626
+ onRemoveImage
627
+ }) => {
628
+ const has = imgPreviews.length > 0 || filePreviews.length > 0;
629
+ if (!has) {
630
+ return null;
631
+ }
632
+ return /* @__PURE__ */ jsx("div", { className: cn("mx-auto mb-2 max-w-[410px] overflow-x-auto custom-scroll"), children: /* @__PURE__ */ jsxs("div", { className: "flex items-start whitespace-nowrap", children: [
633
+ filePreviews.map((file, index) => /* @__PURE__ */ jsx(
634
+ FilePreviewChip,
635
+ {
636
+ name: file.name,
637
+ sizeMB: file.sizeMB,
638
+ ext: file.ext,
639
+ onRemove: () => onRemoveFile(index)
640
+ },
641
+ `${file.name}-${index}`
642
+ )),
643
+ imgPreviews.map((url, index) => /* @__PURE__ */ jsx(ImageThumb, { url, onRemove: () => onRemoveImage(index) }, `${url}-${index}`))
644
+ ] }) });
645
+ };
646
+ var AttachmentPreviewStrip_default = AttachmentPreviewStrip;
647
+ var idleGradient = "linear-gradient(90.85deg, rgba(51, 201, 212, 0.5) 0%, rgba(39, 83, 251, 0.5) 29.98%, rgba(39, 83, 251, 0.5) 49.97%, rgba(39, 83, 251, 0.5) 64.96%, rgba(235, 67, 255, 0.5) 99.94%)";
648
+ var activeGradient = "linear-gradient(90.85deg, #33C9D4 0%, #2753FB 29.98%, #2753FB 49.97%, #2753FB 64.96%, #EB43FF 99.94%)";
649
+ var ChatComposerBar = ({
650
+ recording,
651
+ seconds,
652
+ isTyping,
653
+ textRef,
654
+ text,
655
+ onTextChange,
656
+ onAutoGrow,
657
+ hasAttachments,
658
+ canSendArrow,
659
+ startRecording,
660
+ stopRecording,
661
+ sendText,
662
+ sendAttachments,
663
+ fmtTime: fmtTime2
664
+ }) => {
665
+ const composingRef = useRef(false);
666
+ const [isFocused, setIsFocused] = useState(false);
667
+ const isActiveBorder = isFocused || recording;
668
+ if (!recording) {
669
+ return /* @__PURE__ */ jsx("div", { className: "flex w-full items-stretch gap-2", children: /* @__PURE__ */ jsx(
670
+ "div",
671
+ {
672
+ className: "w-full rounded-sm p-px transition-[background] duration-200",
673
+ style: {
674
+ background: isActiveBorder ? activeGradient : idleGradient
675
+ },
676
+ children: /* @__PURE__ */ jsxs("div", { className: "flex min-h-[50px] w-full items-center justify-between rounded-[3px] bg-white", children: [
677
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between p-[3px]", children: [
678
+ !isTyping ? /* @__PURE__ */ jsx(
679
+ "button",
680
+ {
681
+ type: "button",
682
+ onClick: startRecording,
683
+ className: "grid h-[46px] w-[46px] place-items-center rounded-xs bg-[#f8f8f8] text-[#ff5301] hover:brightness-95",
684
+ title: "Record voice",
685
+ "aria-label": "Record voice",
686
+ children: /* @__PURE__ */ jsx(RecordMicIcon, { className: "h-6 w-6" })
687
+ }
688
+ ) : null,
689
+ /* @__PURE__ */ jsx(
690
+ "textarea",
691
+ {
692
+ ref: textRef,
693
+ rows: 1,
694
+ autoFocus: true,
695
+ placeholder: "Type a message",
696
+ className: "custom-scroll-hidden max-h-[200px] flex-1 resize-none bg-transparent px-3 py-2 outline-none placeholder:text-[#777]",
697
+ value: text,
698
+ onChange: (e) => onTextChange(e.target.value),
699
+ onInput: onAutoGrow,
700
+ onFocus: () => setIsFocused(true),
701
+ onBlur: () => setIsFocused(false),
702
+ onCompositionStart: () => {
703
+ composingRef.current = true;
704
+ },
705
+ onCompositionEnd: () => {
706
+ composingRef.current = false;
707
+ onAutoGrow();
708
+ },
709
+ onKeyDown: (e) => {
710
+ if (e.key === "Enter" && e.shiftKey) {
711
+ return;
712
+ }
713
+ if (composingRef.current) {
714
+ return;
715
+ }
716
+ if (e.key === "Enter") {
717
+ e.preventDefault();
718
+ if (text.length > 0) {
719
+ sendText();
720
+ }
721
+ }
722
+ }
723
+ }
724
+ )
725
+ ] }),
726
+ !canSendArrow ? /* @__PURE__ */ jsx("div", { className: "grid h-full w-px place-items-center bg-[#E7E7E7]" }) : null,
727
+ /* @__PURE__ */ jsx("div", { className: "px-2", children: isTyping ? /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
728
+ /* @__PURE__ */ jsx("div", { className: "h-10 w-px border-l border-[#CCCCCC]" }),
729
+ /* @__PURE__ */ jsx(
730
+ "button",
731
+ {
732
+ type: "button",
733
+ onClick: sendText,
734
+ className: cn(
735
+ "ms-1 grid h-[40px] w-[40px] place-items-center rounded-full",
736
+ "text-[#ff5301] hover:bg-[#f8f8f8]"
737
+ ),
738
+ title: hasAttachments ? "Send attachments" : "Send",
739
+ "aria-label": "Send",
740
+ children: /* @__PURE__ */ jsx(ArrowSendAngleIcon, { className: "h-6 w-6" })
741
+ }
742
+ )
743
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
744
+ /* @__PURE__ */ jsx("div", { className: "h-10 w-px border-l border-[#CCCCCC]" }),
745
+ /* @__PURE__ */ jsx(
746
+ "button",
747
+ {
748
+ type: "button",
749
+ onClick: sendAttachments,
750
+ disabled: !hasAttachments,
751
+ className: cn(
752
+ "ms-1 grid h-[40px] w-[40px] place-items-center rounded-full hover:bg-[#f8f8f8]",
753
+ hasAttachments ? "text-[#ff5301]" : "text-[#B9C3D4]"
754
+ ),
755
+ title: hasAttachments ? "Send attachments" : "Send",
756
+ "aria-label": "Send",
757
+ children: /* @__PURE__ */ jsx(ArrowSendIcon, { className: "h-6 w-6" })
758
+ }
759
+ )
760
+ ] }) })
761
+ ] })
762
+ }
763
+ ) });
764
+ }
765
+ return /* @__PURE__ */ jsx("div", { className: "flex w-full items-stretch gap-2", children: /* @__PURE__ */ jsx("div", { className: "w-full rounded-sm p-px", style: { background: activeGradient }, children: /* @__PURE__ */ jsxs("div", { className: "flex h-[52px] w-full items-center justify-between rounded-[3px] bg-white", children: [
766
+ /* @__PURE__ */ jsx(
767
+ "button",
768
+ {
769
+ type: "button",
770
+ className: "ms-[3px] grid h-[46px] w-[46px] place-items-center rounded-xs bg-[#f8f8f8] text-[#ff5301] hover:brightness-95",
771
+ "aria-label": "Recording",
772
+ title: "Recording",
773
+ children: /* @__PURE__ */ jsx(
774
+ RecordMicIcon,
775
+ {
776
+ className: cn(
777
+ "h-6 w-6",
778
+ seconds % 2 === 0 ? "text-[#929292]" : "text-[#ff5301]"
779
+ )
780
+ }
781
+ )
782
+ }
783
+ ),
784
+ /* @__PURE__ */ jsx("div", { className: "px-3 text-[13px]", children: fmtTime2(seconds) }),
785
+ /* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-3 pr-2", children: [
786
+ /* @__PURE__ */ jsx(
787
+ "button",
788
+ {
789
+ type: "button",
790
+ onClick: () => stopRecording(false),
791
+ className: "grid h-8 w-8 place-items-center rounded-full text-[#3D3D3D] hover:bg-black/5",
792
+ title: "Discard",
793
+ "aria-label": "Discard recording",
794
+ children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-5 w-5" })
795
+ }
796
+ ),
797
+ /* @__PURE__ */ jsx("div", { className: "h-6 w-px bg-[#E7E7E7]" }),
798
+ /* @__PURE__ */ jsx(
799
+ "button",
800
+ {
801
+ type: "button",
802
+ onClick: () => stopRecording(true),
803
+ className: "grid h-10 w-[40px] place-items-center rounded-full text-[#ff5301]",
804
+ title: hasAttachments ? "Send attachments" : "Send",
805
+ "aria-label": "Send",
806
+ children: /* @__PURE__ */ jsx(ArrowSendAngleIcon, { className: "h-6 w-6" })
807
+ }
808
+ )
809
+ ] })
810
+ ] }) }) });
811
+ };
812
+ var ChatComposerBar_default = ChatComposerBar;
813
+ var WIDTH = 380;
814
+ var GAP_Y = 0;
815
+ var PADDING = 0;
816
+ var defaultCard = {
817
+ avatarSrc: "/chat/img/demo-a.jpg",
818
+ name: "Arman Hossain",
819
+ country: "Bangladesh",
820
+ flag: "\u{1F1E7}\u{1F1E9}",
821
+ company: "Easy Fashion",
822
+ email: "aminul@oceanget.com",
823
+ phone: "+880 1712 345678"
824
+ };
825
+ var BusinessCardDropup = ({
826
+ open,
827
+ onClose,
828
+ onSend,
829
+ anchorRef,
830
+ className
831
+ }) => {
832
+ const panelRef = useRef(null);
833
+ const [pos, setPos] = useState(null);
834
+ const [form] = useState(defaultCard);
835
+ const getPosition = useCallback(() => {
836
+ const anchor = anchorRef?.current;
837
+ const panel = panelRef.current;
838
+ if (!anchor || !panel) {
839
+ return null;
840
+ }
841
+ const ar = anchor.getBoundingClientRect();
842
+ const ph = panel.offsetHeight + 12;
843
+ let left = Math.min(ar.left, window.innerWidth - PADDING - WIDTH);
844
+ left = Math.max(left, PADDING);
845
+ let top = ar.top - GAP_Y - ph;
846
+ if (top < PADDING) {
847
+ top = Math.min(ar.bottom + GAP_Y, window.innerHeight - ph - PADDING);
848
+ }
849
+ return { left: Math.round(left - 18), top: Math.round(top) };
850
+ }, [anchorRef]);
851
+ useEffect(() => {
852
+ if (!open) {
853
+ return;
854
+ }
855
+ let rafId = 0;
856
+ const update = () => {
857
+ const next = getPosition();
858
+ if (next) {
859
+ setPos(next);
860
+ }
861
+ };
862
+ rafId = requestAnimationFrame(update);
863
+ const onScroll = () => {
864
+ cancelAnimationFrame(rafId);
865
+ rafId = requestAnimationFrame(update);
866
+ };
867
+ const onResize = () => {
868
+ cancelAnimationFrame(rafId);
869
+ rafId = requestAnimationFrame(update);
870
+ };
871
+ window.addEventListener("scroll", onScroll, true);
872
+ window.addEventListener("resize", onResize);
873
+ return () => {
874
+ cancelAnimationFrame(rafId);
875
+ window.removeEventListener("scroll", onScroll, true);
876
+ window.removeEventListener("resize", onResize);
877
+ };
878
+ }, [open, getPosition]);
879
+ useEffect(() => {
880
+ if (!open) {
881
+ return;
882
+ }
883
+ const onDoc = (e) => {
884
+ if (panelRef.current && !panelRef.current.contains(e.target)) {
885
+ onClose();
886
+ }
887
+ };
888
+ const onEsc = (e) => {
889
+ if (e.key === "Escape") {
890
+ onClose();
891
+ }
892
+ };
893
+ document.addEventListener("mousedown", onDoc);
894
+ document.addEventListener("keydown", onEsc);
895
+ return () => {
896
+ document.removeEventListener("mousedown", onDoc);
897
+ document.removeEventListener("keydown", onEsc);
898
+ };
899
+ }, [open, onClose]);
900
+ const disabled = useMemo(() => !form.name || !form.company || !form.email || !form.phone, [form]);
901
+ if (!open) {
902
+ return null;
903
+ }
904
+ const body = /* @__PURE__ */ jsxs(
905
+ "div",
906
+ {
907
+ ref: panelRef,
908
+ role: "dialog",
909
+ "aria-label": "Business card",
910
+ className: cn(
911
+ "z-9999 relative rounded-[12px] border border-[#EFEFEF] bg-white",
912
+ "p-3 shadow-[0_8px_24px_rgba(0,0,0,0.12)]",
913
+ className
914
+ ),
915
+ style: {
916
+ width: WIDTH,
917
+ left: pos?.left ?? -9999,
918
+ top: pos?.top ?? -9999,
919
+ position: "fixed"
920
+ },
921
+ children: [
922
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
923
+ /* @__PURE__ */ jsx("div", { className: "text-lg font-semibold text-black", children: "Business Card" }),
924
+ /* @__PURE__ */ jsx(
925
+ "button",
926
+ {
927
+ type: "button",
928
+ onClick: onClose,
929
+ "aria-label": "Close",
930
+ className: "grid h-8 w-8 place-items-center rounded-full hover:bg-black/5",
931
+ children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-6 w-6" })
932
+ }
933
+ )
934
+ ] }),
935
+ /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
936
+ "div",
937
+ {
938
+ className: cn(
939
+ "relative h-[208px] w-[355px] overflow-hidden rounded-[12px] bg-white",
940
+ "bg-cover bg-no-repeat shadow-[0_2px_12px_rgba(59,51,51,0.1)]"
941
+ ),
942
+ style: { backgroundImage: "url('/chat/img/card_bg_raw.svg')" },
943
+ children: /* @__PURE__ */ jsx("div", { className: "flex h-full justify-between gap-4 px-6 py-6", children: /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col justify-between", children: [
944
+ /* @__PURE__ */ jsxs("div", { children: [
945
+ /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-[#004F4F]", children: form.name }),
946
+ /* @__PURE__ */ jsx("div", { className: "h-px w-[105px] bg-black" }),
947
+ /* @__PURE__ */ jsx("div", { className: "mt-[6px] flex items-center gap-2", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-[#636363]", children: form.country }) })
948
+ ] }),
949
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 mb-10 space-y-1.5 text-xs text-black", children: [
950
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
951
+ /* @__PURE__ */ jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-[#FFE9DB]", children: /* @__PURE__ */ jsx(BusinessInfoIcon, { className: "h-3 w-3 text-[#EA580C]" }) }),
952
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: form.company })
953
+ ] }),
954
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
955
+ /* @__PURE__ */ jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-[#FFE9DB]", children: /* @__PURE__ */ jsx(ChatMailIcon, { className: "h-3 w-3 text-[#EA580C]" }) }),
956
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: form.email })
957
+ ] }),
958
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
959
+ /* @__PURE__ */ jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-[#FFE9DB]", children: /* @__PURE__ */ jsx(ChatPhoneCallIcon, { className: "h-3 w-3 text-[#EA580C]" }) }),
960
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: form.phone })
961
+ ] })
962
+ ] })
963
+ ] }) })
964
+ }
965
+ ) }),
966
+ /* @__PURE__ */ jsx("div", { className: "mt-3 flex justify-end gap-2", children: /* @__PURE__ */ jsx(
967
+ "button",
968
+ {
969
+ type: "button",
970
+ disabled,
971
+ className: "h-[34px] cursor-pointer rounded-[4px] border-none bg-[#ff5200] px-4 text-[13px] font-medium text-white hover:bg-[#e64a00] disabled:opacity-50",
972
+ onClick: () => {
973
+ onSend(form);
974
+ onClose();
975
+ },
976
+ children: "Send"
977
+ }
978
+ ) }),
979
+ /* @__PURE__ */ jsx(
980
+ "div",
981
+ {
982
+ "aria-hidden": true,
983
+ className: "pointer-events-none absolute -bottom-2 left-6 h-4 w-4 rotate-45 rounded-[3px] border border-[#EFEFEF] border-l-transparent border-t-transparent bg-white"
984
+ }
985
+ )
986
+ ]
987
+ }
988
+ );
989
+ return createPortal(body, document.body);
990
+ };
991
+ var BusinessCardDropup_default = BusinessCardDropup;
992
+ var EMOJIS = "\u{1F600} \u{1F601} \u{1F602} \u{1F923} \u{1F603} \u{1F604} \u{1F605} \u{1F60A} \u{1F607} \u{1F642} \u{1F643} \u{1F609} \u{1F60C} \u{1F60D} \u{1F970} \u{1F618} \u{1F617} \u{1F619} \u{1F61A} \u{1F60B} \u{1F61C} \u{1F61D} \u{1F61B} \u{1FAE2} \u{1F92B} \u{1F92D} \u{1F917} \u{1F914} \u{1F928} \u{1F610} \u{1F611} \u{1F636} \u{1F644} \u{1F62F} \u{1F62A} \u{1F634} \u{1F60C} \u{1F924} \u{1F62E}\u200D\u{1F4A8} \u{1F62E} \u{1F632} \u{1F92F} \u{1F974} \u{1F971} \u{1F62C} \u{1F60F} \u{1F925} \u{1F615} \u{1F61F} \u{1F641} \u2639\uFE0F \u{1F622} \u{1F62D}".split(
993
+ " "
994
+ );
995
+ var WIDTH2 = 300;
996
+ var GAP_Y2 = 1;
997
+ var GAP_X = 1;
998
+ var PADDING2 = 1;
999
+ var EmojiDropup = ({ open, onClose, onSelect, anchorRef, className }) => {
1000
+ const panelRef = React11.useRef(null);
1001
+ const [pos, setPos] = React11.useState(null);
1002
+ const place = React11.useCallback(() => {
1003
+ const anchor = anchorRef?.current;
1004
+ const panel = panelRef.current;
1005
+ if (!anchor || !panel) {
1006
+ return;
1007
+ }
1008
+ const ar = anchor.getBoundingClientRect();
1009
+ const ph = panel.offsetHeight + 10;
1010
+ let left = ar.right + GAP_X - 45;
1011
+ let top = ar.top - GAP_Y2 - ph;
1012
+ left = Math.min(left, window.innerWidth - PADDING2 - WIDTH2);
1013
+ left = Math.max(left, PADDING2);
1014
+ top = Math.max(top, PADDING2);
1015
+ const arrowLeft = Math.max(12, Math.min(24, Math.round(Math.min(ar.right + GAP_X - left, 40))));
1016
+ panel.style.setProperty("--arrow-left", `${arrowLeft}px`);
1017
+ setPos({ left: Math.round(left), top: Math.round(top) });
1018
+ }, [anchorRef]);
1019
+ useEffect(() => {
1020
+ if (!open) {
1021
+ return;
1022
+ }
1023
+ place();
1024
+ const onScroll = () => place();
1025
+ const onResize = () => place();
1026
+ window.addEventListener("scroll", onScroll, true);
1027
+ window.addEventListener("resize", onResize);
1028
+ return () => {
1029
+ window.removeEventListener("scroll", onScroll, true);
1030
+ window.removeEventListener("resize", onResize);
1031
+ };
1032
+ }, [open, place]);
1033
+ useEffect(() => {
1034
+ if (!open) {
1035
+ return;
1036
+ }
1037
+ const onDoc = (e) => {
1038
+ if (panelRef.current && !panelRef.current.contains(e.target)) {
1039
+ onClose();
1040
+ }
1041
+ };
1042
+ const onEsc = (e) => e.key === "Escape" && onClose();
1043
+ document.addEventListener("mousedown", onDoc);
1044
+ document.addEventListener("keydown", onEsc);
1045
+ return () => {
1046
+ document.removeEventListener("mousedown", onDoc);
1047
+ document.removeEventListener("keydown", onEsc);
1048
+ };
1049
+ }, [open, onClose]);
1050
+ if (!open) {
1051
+ return null;
1052
+ }
1053
+ const body = /* @__PURE__ */ jsx(
1054
+ "div",
1055
+ {
1056
+ ref: panelRef,
1057
+ role: "dialog",
1058
+ "aria-label": "Emoji picker",
1059
+ className: clsx2("emoji-dropup", className),
1060
+ style: {
1061
+ zIndex: "9999",
1062
+ width: WIDTH2,
1063
+ left: pos?.left ?? -9999,
1064
+ top: pos?.top ?? -9999,
1065
+ maxHeight: Math.max(140, window.innerHeight - 2 * PADDING2)
1066
+ // dynamic height
1067
+ },
1068
+ children: /* @__PURE__ */ jsx("div", { className: "emoji-dropup__scroll", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-0", children: EMOJIS.map((e, i) => /* @__PURE__ */ jsx(
1069
+ "button",
1070
+ {
1071
+ type: "button",
1072
+ className: "emoji-dropup__item",
1073
+ onClick: () => {
1074
+ onSelect(e);
1075
+ onClose();
1076
+ },
1077
+ "aria-label": `Insert ${e}`,
1078
+ children: e
1079
+ },
1080
+ i
1081
+ )) }) })
1082
+ }
1083
+ );
1084
+ return createPortal(body, document.body);
1085
+ };
1086
+ var EmojiDropup_default = EmojiDropup;
1087
+
1088
+ // src/ui/chat/scrollToMessage.ts
1089
+ function scrollToMessageById(messageId) {
1090
+ if (!messageId) {
1091
+ return;
1092
+ }
1093
+ const target = document.querySelector(`[data-msg-id="${messageId}"]`);
1094
+ if (!target) {
1095
+ return;
1096
+ }
1097
+ const scroller = target.closest("[data-chat-scroll]");
1098
+ if (scroller) {
1099
+ const top = target.offsetTop - scroller.clientHeight / 2 + target.clientHeight / 2;
1100
+ scroller.scrollTo({ top, behavior: "smooth" });
1101
+ } else {
1102
+ target.scrollIntoView({ behavior: "smooth", block: "center" });
1103
+ }
1104
+ const cleanupId = `focus-overlay-${Date.now()}`;
1105
+ const overlay = document.createElement("div");
1106
+ overlay.id = cleanupId;
1107
+ Object.assign(overlay.style, {
1108
+ position: "absolute",
1109
+ inset: "-4px",
1110
+ // tiny spread so it peeks outside rounded corners
1111
+ borderRadius: "6px",
1112
+ background: "rgba(0,0,0,0.05)",
1113
+ // black / 5% opacity
1114
+ pointerEvents: "none",
1115
+ zIndex: "1",
1116
+ transition: "opacity 220ms ease",
1117
+ opacity: "0"
1118
+ });
1119
+ const prevPos = target.style.position;
1120
+ if (getComputedStyle(target).position === "static") {
1121
+ target.style.position = "relative";
1122
+ }
1123
+ target.appendChild(overlay);
1124
+ requestAnimationFrame(() => overlay.style.opacity = "1");
1125
+ window.setTimeout(() => {
1126
+ overlay.style.opacity = "0";
1127
+ window.setTimeout(() => {
1128
+ overlay.remove();
1129
+ if (!prevPos) {
1130
+ target.style.removeProperty("position");
1131
+ } else {
1132
+ target.style.position = prevPos;
1133
+ }
1134
+ }, 240);
1135
+ }, 1200);
1136
+ }
1137
+ var fmt = (s) => {
1138
+ if (!Number.isFinite(s) || s <= 0) {
1139
+ return "0:00";
1140
+ }
1141
+ const m = Math.floor(s / 60);
1142
+ const sec = Math.round(s % 60).toString().padStart(2, "0");
1143
+ return `${m}:${sec}`;
1144
+ };
1145
+ var ReplyCard = ({ refMsg, onClose, compact, className, jumpOnClick }) => {
1146
+ const hasText = !!refMsg.text && refMsg.text.trim().length > 0;
1147
+ const hasFiles = (refMsg.files?.length ?? 0) > 0;
1148
+ const hasImages = (refMsg.images?.length ?? 0) > 0;
1149
+ const mode = hasText ? "text" : hasFiles ? "files" : hasImages ? "images" : "audio";
1150
+ const widthClamp = onClose ? "w-full" : "max-w-[200px] w-full";
1151
+ const heightClamp = compact ? "py-1.5" : "py-1.5";
1152
+ const [durTxt, setDurTxt] = React11.useState(refMsg.audio?.duration ?? "0:06");
1153
+ React11.useEffect(() => {
1154
+ if (mode !== "audio" || !refMsg.audio?.src) {
1155
+ setDurTxt(refMsg.audio?.duration ?? "0:06");
1156
+ return;
1157
+ }
1158
+ let disposed = false;
1159
+ const a = new Audio();
1160
+ a.preload = "metadata";
1161
+ a.src = refMsg.audio.src;
1162
+ const onLoaded = () => {
1163
+ if (disposed) {
1164
+ return;
1165
+ }
1166
+ const d = Number(a.duration);
1167
+ setDurTxt(fmt(d));
1168
+ };
1169
+ const onError = () => {
1170
+ if (disposed) {
1171
+ return;
1172
+ }
1173
+ setDurTxt(refMsg.audio?.duration ?? "0:06");
1174
+ };
1175
+ a.addEventListener("loadedmetadata", onLoaded);
1176
+ a.addEventListener("error", onError);
1177
+ try {
1178
+ a.load?.();
1179
+ } catch {
1180
+ }
1181
+ return () => {
1182
+ disposed = true;
1183
+ a.pause?.();
1184
+ a.src = "";
1185
+ a.removeAttribute?.("src");
1186
+ a.load?.();
1187
+ a.removeEventListener("loadedmetadata", onLoaded);
1188
+ a.removeEventListener("error", onError);
1189
+ };
1190
+ }, [mode, refMsg.audio?.src, refMsg.audio?.duration]);
1191
+ const clickToJump = React11.useCallback(() => {
1192
+ if (!jumpOnClick) {
1193
+ return;
1194
+ }
1195
+ if (refMsg.id) {
1196
+ scrollToMessageById(refMsg.id);
1197
+ }
1198
+ }, [jumpOnClick, refMsg.id]);
1199
+ return /* @__PURE__ */ jsxs(
1200
+ "div",
1201
+ {
1202
+ onClick: clickToJump,
1203
+ className: clsx2(
1204
+ widthClamp,
1205
+ "relative rounded-md bg-[#f8f8f8] px-3",
1206
+ "border-l-2 border-[#FF5300]",
1207
+ "shadow-[0_1px_2px_rgba(0,0,0,0.04)]",
1208
+ heightClamp,
1209
+ className
1210
+ ),
1211
+ children: [
1212
+ /* @__PURE__ */ jsxs("div", { className: "mb-1.5 flex items-center justify-between", children: [
1213
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1214
+ /* @__PURE__ */ jsx(ArrowBackUpIcon, { className: "h-[18px] w-[18px]" }),
1215
+ /* @__PURE__ */ jsx("div", { className: "text-[13px] font-normal text-[#2c2c2c]", children: "Reply" })
1216
+ ] }),
1217
+ onClose && /* @__PURE__ */ jsx(
1218
+ "button",
1219
+ {
1220
+ type: "button",
1221
+ onClick: onClose,
1222
+ className: "absolute right-3 top-1/2 -translate-y-1/2 grid h-8 w-8 place-items-center rounded-full bg-white text-[#3D3D3D] shadow-[0px_2px_4px_0px_#A5A3AE4D] hover:text-[#FF5300]",
1223
+ title: "Remove",
1224
+ "aria-label": "Remove",
1225
+ children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-[18px] w-[18px]" })
1226
+ }
1227
+ )
1228
+ ] }),
1229
+ /* @__PURE__ */ jsxs("div", { className: "pb-1", children: [
1230
+ mode === "text" && /* @__PURE__ */ jsx("div", { className: "truncate text-[13px] text-[#636363]", children: refMsg.text.replace(/\s+/g, " ") }),
1231
+ mode === "files" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 h-[21px]", children: [
1232
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 rounded-sm border-[0.7px] border-[#e1e1e1] bg-white px-2.5 py-[2px]", children: [
1233
+ /* @__PURE__ */ jsx(FileIcon, { className: "h-4 w-4 text-[#6B7280]" }),
1234
+ /* @__PURE__ */ jsx("span", { className: "max-w-[110px] truncate text-[10px] text-[#2c2c2c]", children: refMsg.files[0].name })
1235
+ ] }),
1236
+ refMsg.files.length > 1 && /* @__PURE__ */ jsxs("span", { className: " text-xs text-[#636363]", children: [
1237
+ "+",
1238
+ refMsg.files.length - 1
1239
+ ] })
1240
+ ] }),
1241
+ mode === "images" && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5", children: refMsg.images.slice(0, 3).map((src, i) => {
1242
+ const extra = refMsg.images.length - 3;
1243
+ const isLast = i === 2 && extra > 0;
1244
+ return /* @__PURE__ */ jsxs(
1245
+ "div",
1246
+ {
1247
+ className: "relative h-[21px] w-[26px] overflow-hidden rounded-sm border border-[#E5E5E5] bg-[#F5F7FA]",
1248
+ children: [
1249
+ /* @__PURE__ */ jsx("img", { src, alt: "", className: "h-full w-full object-cover" }),
1250
+ isLast && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grid place-items-center bg-black/40", children: /* @__PURE__ */ jsxs("span", { className: " text-xs font-semibold text-white", children: [
1251
+ "+",
1252
+ extra
1253
+ ] }) })
1254
+ ]
1255
+ },
1256
+ i
1257
+ );
1258
+ }) }),
1259
+ mode === "audio" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 h-[21px] border border-[#D8D8D8] rounded-[3.5px] p-[1.75px] max-w-[151px]", children: [
1260
+ /* @__PURE__ */ jsx("span", { className: "grid h-[17.5px] w-[18.08px] place-items-center rounded-[2.33px] bg-[#f1f1f1] text-[#00486F]", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", className: "h-3 w-3", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M6 4.5v11l9-5.5-9-5.5Z" }) }) }),
1261
+ /* @__PURE__ */ jsxs("div", { className: "relative h-[1.17px] w-[130px] rounded-full bg-[#BDBDBD]", children: [
1262
+ /* @__PURE__ */ jsx(
1263
+ "span",
1264
+ {
1265
+ className: "absolute left-0 top-0 h-full rounded-full bg-[#747474]",
1266
+ style: { width: "0%" }
1267
+ }
1268
+ ),
1269
+ /* @__PURE__ */ jsx(
1270
+ "span",
1271
+ {
1272
+ className: "absolute top-1/2 -translate-y-1/2 h-[5.5px] w-[5.5px] rounded-full bg-[#747474]",
1273
+ style: { left: "calc(0% - 4px)" }
1274
+ }
1275
+ )
1276
+ ] }),
1277
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-[#747474] me-1", children: durTxt })
1278
+ ] })
1279
+ ] })
1280
+ ]
1281
+ }
1282
+ );
1283
+ };
1284
+ var ReplyCard_default = ReplyCard;
1285
+ var Tooltip = ({ children, text }) => /* @__PURE__ */ jsx("span", { title: text, children });
1286
+ var fmtTime = (s) => `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
1287
+ var mb = (bytes) => Math.max(0.1, bytes / (1024 * 1024));
1288
+ var extFromName = (name) => {
1289
+ const dot = name.lastIndexOf(".");
1290
+ return dot >= 0 ? name.slice(dot + 1).toLowerCase() : "";
1291
+ };
1292
+ var ACCEPT = "image/*,.pdf,.doc,.docx,.ppt,.pptx,.xls,.xlsx,.txt,.csv,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1293
+ var ChatFooter = ({
1294
+ variant = "group",
1295
+ onSend,
1296
+ onAfterSend,
1297
+ className,
1298
+ maxRows = 4,
1299
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1300
+ actions: _actions,
1301
+ replyTo,
1302
+ clearReply
1303
+ }) => {
1304
+ const actionData = [
1305
+ { key: "attachment", title: "Attach file", icon: /* @__PURE__ */ jsx(AttachIcon, { className: "h-4 w-4" }) },
1306
+ { key: "emoji", title: "Add emoji", icon: /* @__PURE__ */ jsx(SmileIcon, { className: "h-4 w-4" }) },
1307
+ {
1308
+ key: "businessCard",
1309
+ title: "Share business card",
1310
+ icon: /* @__PURE__ */ jsx(ProfileCardIcon, { className: "h-4 w-4" })
1311
+ },
1312
+ {
1313
+ key: "translate",
1314
+ title: "Translation settings",
1315
+ icon: /* @__PURE__ */ jsx(NewLanguageIcon, { className: "h-4 w-4" })
1316
+ }
1317
+ ];
1318
+ const textRef = useRef(null);
1319
+ const emojiBtnRef = useRef(null);
1320
+ const [text, setText] = useState("");
1321
+ const [showEmoji, setShowEmoji] = useState(false);
1322
+ const [recording, setRecording] = useState(false);
1323
+ const [seconds, setSeconds] = useState(0);
1324
+ const mediaRecRef = useRef(null);
1325
+ const streamRef = useRef(null);
1326
+ const chunksRef = useRef([]);
1327
+ const [micError, setMicError] = useState("");
1328
+ const [imgPreviews, setImgPreviews] = useState([]);
1329
+ const [filePreviews, setFilePreviews] = useState([]);
1330
+ const fileInputRef = useRef(null);
1331
+ const [showTranslate, setShowTranslate] = useState(false);
1332
+ const [translateSettings, setTranslateSettings] = useState({
1333
+ incomingTarget: "",
1334
+ autoIncoming: true,
1335
+ enableOutgoing: false,
1336
+ outgoingFrom: "English",
1337
+ outgoingTo: "Bangla"
1338
+ });
1339
+ const bizBtnRef = useRef(null);
1340
+ const [showBiz, setShowBiz] = useState(false);
1341
+ const addrBtnRef = useRef(null);
1342
+ const [, setShowAddress] = useState(false);
1343
+ const insertEmoji = (emoji) => {
1344
+ const el = textRef.current;
1345
+ if (!el) {
1346
+ return;
1347
+ }
1348
+ const start = el.selectionStart ?? el.value.length;
1349
+ const end = el.selectionEnd ?? el.value.length;
1350
+ const next = `${text.slice(0, start)}${emoji}${text.slice(end)}`;
1351
+ setText(next);
1352
+ requestAnimationFrame(() => {
1353
+ el.focus();
1354
+ const pos = start + emoji.length;
1355
+ el.setSelectionRange(pos, pos);
1356
+ });
1357
+ };
1358
+ const handleAutoGrow = React11.useCallback(() => {
1359
+ const el = textRef.current;
1360
+ if (!el) {
1361
+ return;
1362
+ }
1363
+ el.style.height = "0px";
1364
+ const styles = window.getComputedStyle(el);
1365
+ const lh = parseFloat(styles.lineHeight || "20");
1366
+ const max = lh * maxRows + parseFloat(styles.paddingTop) + parseFloat(styles.paddingBottom);
1367
+ el.style.height = `${Math.min(el.scrollHeight, max)}px`;
1368
+ }, [maxRows]);
1369
+ useEffect(() => {
1370
+ handleAutoGrow();
1371
+ }, [text, handleAutoGrow]);
1372
+ useEffect(() => {
1373
+ if (!recording) {
1374
+ return;
1375
+ }
1376
+ setSeconds(0);
1377
+ const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
1378
+ return () => clearInterval(id);
1379
+ }, [recording]);
1380
+ useEffect(() => {
1381
+ return () => {
1382
+ imgPreviews.forEach((u) => u.startsWith("blob:") && URL.revokeObjectURL(u));
1383
+ filePreviews.forEach((f) => f.href?.startsWith("blob:") && URL.revokeObjectURL(f.href));
1384
+ if (streamRef.current) {
1385
+ streamRef.current.getTracks().forEach((t) => t.stop());
1386
+ }
1387
+ try {
1388
+ mediaRecRef.current?.stop();
1389
+ } catch {
1390
+ }
1391
+ };
1392
+ }, []);
1393
+ const isTyping = text.length > 0;
1394
+ const hasAttachments = imgPreviews.length > 0 || filePreviews.length > 0;
1395
+ const canSendArrow = useMemo(() => hasAttachments || isTyping, [hasAttachments, isTyping]);
1396
+ const onFilesPicked = (e) => {
1397
+ const files = Array.from(e.target.files ?? []);
1398
+ if (!files.length) {
1399
+ return;
1400
+ }
1401
+ const imgs = [];
1402
+ const docs = [];
1403
+ files.forEach((f) => {
1404
+ const url = URL.createObjectURL(f);
1405
+ if (f.type.startsWith("image/")) {
1406
+ imgs.push(url);
1407
+ } else {
1408
+ docs.push({ name: f.name, sizeMB: mb(f.size), ext: extFromName(f.name), href: url, downloadName: f.name });
1409
+ }
1410
+ });
1411
+ setImgPreviews((p) => [...p, ...imgs]);
1412
+ setFilePreviews((p) => [...p, ...docs]);
1413
+ e.target.value = "";
1414
+ };
1415
+ const previewFilesToPayload = (files) => files.map((f) => ({ name: f.name, sizeMB: f.sizeMB, ext: f.ext, href: f.href, downloadName: f.downloadName }));
1416
+ const clearAttachments = () => {
1417
+ imgPreviews.forEach((u) => u.startsWith("blob:") && URL.revokeObjectURL(u));
1418
+ filePreviews.forEach((f) => f.href?.startsWith("blob:") && URL.revokeObjectURL(f.href));
1419
+ setImgPreviews([]);
1420
+ setFilePreviews([]);
1421
+ };
1422
+ const sendText = async () => {
1423
+ const t = text.trim();
1424
+ const hasAttachmentsNow = imgPreviews.length > 0 || filePreviews.length > 0;
1425
+ if (!t && !hasAttachmentsNow) return;
1426
+ if (hasAttachmentsNow) {
1427
+ onSend({
1428
+ type: "combined",
1429
+ text: t,
1430
+ files: previewFilesToPayload(filePreviews),
1431
+ images: imgPreviews,
1432
+ replyTo
1433
+ });
1434
+ clearAttachments();
1435
+ } else {
1436
+ onSend({ type: "text", text: t, replyTo });
1437
+ }
1438
+ setText("");
1439
+ clearReply?.();
1440
+ onAfterSend?.();
1441
+ };
1442
+ const sendAttachments = async () => {
1443
+ if (text.length > 0) {
1444
+ await sendText();
1445
+ return;
1446
+ }
1447
+ const hasAttachmentsNow = imgPreviews.length > 0 || filePreviews.length > 0;
1448
+ if (!hasAttachmentsNow) return;
1449
+ onSend({
1450
+ type: "attachments",
1451
+ images: imgPreviews,
1452
+ files: previewFilesToPayload(filePreviews),
1453
+ replyTo
1454
+ });
1455
+ clearAttachments();
1456
+ clearReply?.();
1457
+ onAfterSend?.();
1458
+ };
1459
+ const startRecording = async () => {
1460
+ setMicError("");
1461
+ try {
1462
+ const stream = await navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true }, video: false });
1463
+ streamRef.current = stream;
1464
+ const canWebm = typeof MediaRecorder !== "undefined" && MediaRecorder.isTypeSupported?.("audio/webm;codecs=opus");
1465
+ const mime = canWebm ? "audio/webm;codecs=opus" : "audio/mp4";
1466
+ const rec = new MediaRecorder(stream, { mimeType: mime });
1467
+ mediaRecRef.current = rec;
1468
+ chunksRef.current = [];
1469
+ rec.ondataavailable = (e) => {
1470
+ if (e.data && e.data.size > 0) chunksRef.current.push(e.data);
1471
+ };
1472
+ rec.start();
1473
+ setRecording(true);
1474
+ } catch (err) {
1475
+ let name;
1476
+ if (err instanceof DOMException || err instanceof Error) {
1477
+ ({ name } = err);
1478
+ }
1479
+ const msg = name === "NotFoundError" ? "No audio input device found." : name === "NotAllowedError" ? "Microphone access was denied." : "Unable to access the microphone.";
1480
+ setMicError(msg);
1481
+ setRecording(false);
1482
+ streamRef.current?.getTracks().forEach((t) => t.stop());
1483
+ try {
1484
+ mediaRecRef.current?.stop();
1485
+ } catch {
1486
+ }
1487
+ streamRef.current = null;
1488
+ }
1489
+ };
1490
+ const finalizeBlob = (rec) => new Promise((resolve) => {
1491
+ const finish = () => resolve(new Blob(chunksRef.current, { type: rec.mimeType || "audio/webm" }));
1492
+ rec.onstop = finish;
1493
+ try {
1494
+ rec.stop();
1495
+ } catch {
1496
+ finish();
1497
+ }
1498
+ });
1499
+ const stopRecording = async (send = false) => {
1500
+ const rec = mediaRecRef.current;
1501
+ const stream = streamRef.current;
1502
+ setRecording(false);
1503
+ if (stream) {
1504
+ stream.getTracks().forEach((t) => t.stop());
1505
+ streamRef.current = null;
1506
+ }
1507
+ if (!rec) {
1508
+ if (send) onSend({ type: "voice", durationSec: seconds, durationText: fmtTime(seconds), replyTo });
1509
+ setSeconds(0);
1510
+ return;
1511
+ }
1512
+ const blob = await finalizeBlob(rec);
1513
+ mediaRecRef.current = null;
1514
+ if (send) {
1515
+ const src = URL.createObjectURL(blob);
1516
+ onSend({ type: "voice", src, durationSec: seconds, durationText: fmtTime(seconds), replyTo });
1517
+ clearReply?.();
1518
+ onAfterSend?.();
1519
+ }
1520
+ setSeconds(0);
1521
+ };
1522
+ return /* @__PURE__ */ jsxs("div", { className: clsx2("border-t border-[#ededed] bg-white p-3.5", className), children: [
1523
+ replyTo && /* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsx(ReplyCard_default, { refMsg: replyTo, onClose: clearReply }) }),
1524
+ /* @__PURE__ */ jsx(
1525
+ AttachmentPreviewStrip_default,
1526
+ {
1527
+ imgPreviews,
1528
+ filePreviews,
1529
+ onRemoveFile: (i) => setFilePreviews((prev) => {
1530
+ const cp = [...prev];
1531
+ const [rm] = cp.splice(i, 1);
1532
+ if (rm?.href?.startsWith("blob:")) URL.revokeObjectURL(rm.href);
1533
+ return cp;
1534
+ }),
1535
+ onRemoveImage: (i) => setImgPreviews((prev) => {
1536
+ const cp = [...prev];
1537
+ const [rm] = cp.splice(i, 1);
1538
+ if (rm?.startsWith("blob:")) URL.revokeObjectURL(rm);
1539
+ return cp;
1540
+ })
1541
+ }
1542
+ ),
1543
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-3", children: [
1544
+ (actionData ?? []).map((a) => {
1545
+ const isAttach = a.key === "attachment";
1546
+ const isEmoji = a.key === "emoji";
1547
+ const isTranslate = a.key === "translate";
1548
+ const isBiz = a.key === "businessCard";
1549
+ const isAddress = a.key === "addressCard";
1550
+ if (isEmoji) {
1551
+ return /* @__PURE__ */ jsx("span", { className: "relative inline-flex", children: /* @__PURE__ */ jsx(Tooltip, { text: a.title, children: /* @__PURE__ */ jsx("button", { ref: emojiBtnRef, type: "button", onClick: () => setShowEmoji((v) => !v), className: "flex h-6 w-6 items-center justify-center rounded-full text-[#0F0F0F] hover:bg-[#F4F6F8]", children: /* @__PURE__ */ jsx("span", { children: a.icon }) }) }) }, a.key);
1552
+ }
1553
+ if (isTranslate) {
1554
+ return /* @__PURE__ */ jsx(Tooltip, { text: a.title, children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setShowTranslate(true), className: "flex h-6 w-6 items-center justify-center rounded-full text-[#0F0F0F] hover:bg-[#F4F6F8]", children: /* @__PURE__ */ jsx("span", { children: a.icon }) }) }, a.key);
1555
+ }
1556
+ if (isBiz) {
1557
+ return /* @__PURE__ */ jsx("span", { className: "relative inline-flex", children: /* @__PURE__ */ jsx(Tooltip, { text: a.title, children: /* @__PURE__ */ jsx("button", { ref: bizBtnRef, type: "button", onClick: () => setShowBiz((v) => !v), className: "flex h-6 w-6 items-center justify-center rounded-full text-[#0F0F0F] hover:bg-[#F4F6F8]", children: /* @__PURE__ */ jsx("span", { children: a.icon }) }) }) }, a.key);
1558
+ }
1559
+ if (isAddress) {
1560
+ return /* @__PURE__ */ jsx("span", { className: "relative inline-flex", children: /* @__PURE__ */ jsx(Tooltip, { text: a.title, children: /* @__PURE__ */ jsx("button", { ref: addrBtnRef, type: "button", onClick: () => setShowAddress(true), className: "flex h-6 w-6 items-center justify-center rounded-full text-[#0F0F0F] hover:bg-[#F4F6F8]", children: /* @__PURE__ */ jsx("span", { children: a.icon }) }) }) }, a.key);
1561
+ }
1562
+ return /* @__PURE__ */ jsx(Tooltip, { text: a.title, children: /* @__PURE__ */ jsx("button", { type: "button", onClick: isAttach ? () => fileInputRef.current?.click() : a.onClick, className: "flex h-6 w-6 items-center justify-center rounded-full text-[#0F0F0F] hover:bg-[#F4F6F8]", children: /* @__PURE__ */ jsx("span", { children: a.icon }) }) }, a.key);
1563
+ }),
1564
+ /* @__PURE__ */ jsx("input", { ref: fileInputRef, type: "file", multiple: true, accept: ACCEPT, onChange: onFilesPicked, className: "hidden" }),
1565
+ /* @__PURE__ */ jsx(EmojiDropup_default, { open: showEmoji, onClose: () => setShowEmoji(false), onSelect: insertEmoji, anchorRef: emojiBtnRef }),
1566
+ /* @__PURE__ */ jsx(
1567
+ BusinessCardDropup_default,
1568
+ {
1569
+ open: showBiz,
1570
+ onClose: () => setShowBiz(false),
1571
+ anchorRef: bizBtnRef,
1572
+ onSend: async (card) => {
1573
+ onSend({ type: "businessCard", card, replyTo });
1574
+ clearReply?.();
1575
+ onAfterSend?.();
1576
+ }
1577
+ }
1578
+ )
1579
+ ] }),
1580
+ micError && /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-start gap-2 rounded-sm bg-[#f8f8f8] px-2 py-1.5 text-xs text-[#ff5301]", children: [
1581
+ /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(ChatInfoIcon, { className: "mt-0.5 h-3.5 w-3.5" }) }),
1582
+ /* @__PURE__ */ jsx("span", { children: micError }),
1583
+ /* @__PURE__ */ jsx("span", { className: "pointer flex cursor-pointer items-center justify-center rounded-full p-1 hover:bg-black/10", onClick: () => setMicError(""), children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-3.5 w-3.5" }) })
1584
+ ] }),
1585
+ /* @__PURE__ */ jsx(
1586
+ ChatComposerBar_default,
1587
+ {
1588
+ recording,
1589
+ seconds,
1590
+ isTyping,
1591
+ textRef,
1592
+ text,
1593
+ onTextChange: setText,
1594
+ onAutoGrow: handleAutoGrow,
1595
+ hasAttachments,
1596
+ canSendArrow,
1597
+ startRecording,
1598
+ stopRecording,
1599
+ sendText,
1600
+ sendAttachments,
1601
+ fmtTime
1602
+ }
1603
+ ),
1604
+ /* @__PURE__ */ jsx(
1605
+ ChatTranslateSettingsModal_default,
1606
+ {
1607
+ variant,
1608
+ open: showTranslate,
1609
+ onClose: () => setShowTranslate(false),
1610
+ initial: translateSettings,
1611
+ onSave: (s) => {
1612
+ setTranslateSettings(s);
1613
+ setShowTranslate(false);
1614
+ }
1615
+ }
1616
+ )
1617
+ ] });
1618
+ };
1619
+ var ChatFooter_default = ChatFooter;
1620
+ function ChatHeader({ left, right, below, className }) {
1621
+ return /* @__PURE__ */ jsxs("div", { children: [
1622
+ /* @__PURE__ */ jsx("div", { className: clsx2("border-b border-[#e1e1e1] h-[64px]", className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between px-4 pt-2.5", children: [
1623
+ /* @__PURE__ */ jsx("div", { className: "flex items-start gap-3", children: left }),
1624
+ right
1625
+ ] }) }),
1626
+ below && /* @__PURE__ */ jsx(Fragment, { children: below })
1627
+ ] });
1628
+ }
1629
+ var ChatIdentity = (props) => {
1630
+ const {
1631
+ title,
1632
+ subtitle,
1633
+ subtitleVariant = "muted",
1634
+ online = false,
1635
+ verified = false,
1636
+ size = 46,
1637
+ className
1638
+ } = props;
1639
+ const subtitleClass = cn(
1640
+ "text-[10px] font-medium",
1641
+ subtitleVariant === "live" ? "text-[#1E9E6A]" : "text-[#929292]"
1642
+ );
1643
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-start gap-3", className), children: [
1644
+ /* @__PURE__ */ jsxs("div", { className: "relative", style: { width: size, height: size }, children: [
1645
+ props.variant === "avatar" ? /* @__PURE__ */ jsx(
1646
+ "img",
1647
+ {
1648
+ src: props.src,
1649
+ alt: title,
1650
+ className: "h-full w-full rounded-xs object-cover border border-[#f1f1f1]"
1651
+ }
1652
+ ) : null,
1653
+ props.variant === "initial" ? /* @__PURE__ */ jsx(
1654
+ "div",
1655
+ {
1656
+ className: cn(
1657
+ "grid h-full w-full place-items-center rounded-xs text-[15px] font-semibold text-[#2c2c2c]",
1658
+ props.textClassName
1659
+ ),
1660
+ style: { backgroundColor: props.bg ?? "#FFE5DA" },
1661
+ children: props.initial
1662
+ }
1663
+ ) : null,
1664
+ props.variant === "logo" ? /* @__PURE__ */ jsx(
1665
+ "div",
1666
+ {
1667
+ className: "grid h-full w-full place-items-center rounded-xs",
1668
+ style: { boxShadow: `0 0 0 1px ${props.ringColor ?? "#EDEDED"} inset` },
1669
+ children: /* @__PURE__ */ jsx("img", { src: props.src, alt: title, className: "h-full w-full rounded-xs object-cover" })
1670
+ }
1671
+ ) : null,
1672
+ /* @__PURE__ */ jsx(
1673
+ "span",
1674
+ {
1675
+ className: cn(
1676
+ "absolute rounded-full ring-1 ring-white bottom-[-2px] right-[-2px]",
1677
+ online ? "bg-[#328545]" : "bg-[#eb2127]"
1678
+ ),
1679
+ style: {
1680
+ width: "15px",
1681
+ height: "15px",
1682
+ right: 0,
1683
+ bottom: 0
1684
+ }
1685
+ }
1686
+ )
1687
+ ] }),
1688
+ /* @__PURE__ */ jsxs("div", { children: [
1689
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-1 text-[14px] font-medium text-black", children: [
1690
+ /* @__PURE__ */ jsx("span", { className: "max-w-[300px] truncate", children: title }),
1691
+ verified ? /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(BlueBadgeIcon, {}) }) : null
1692
+ ] }),
1693
+ subtitle ? title.toLowerCase() === "banbox.com" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
1694
+ /* @__PURE__ */ jsx(
1695
+ "img",
1696
+ {
1697
+ src: "/chat/globe.gif",
1698
+ alt: "globe",
1699
+ className: "h-[12px] w-auto shrink-0 object-contain",
1700
+ style: { mixBlendMode: "multiply" }
1701
+ }
1702
+ ),
1703
+ /* @__PURE__ */ jsx("div", { className: subtitleClass, children: subtitle })
1704
+ ] }) : /* @__PURE__ */ jsx("div", { className: subtitleClass, children: subtitle }) : null
1705
+ ] })
1706
+ ] });
1707
+ };
1708
+ var ChatIdentity_default = ChatIdentity;
1709
+ var ChatInquiryBar = ({ id, onView, className, label, buttonLabel }) => {
1710
+ if (!id) {
1711
+ return null;
1712
+ }
1713
+ return /* @__PURE__ */ jsxs(
1714
+ "div",
1715
+ {
1716
+ className: clsx2(
1717
+ "flex items-center justify-between border-b border-[#ededed] bg-[#f8f8f8] ps-[16px] pe-[30px] h-[30px]",
1718
+ className
1719
+ ),
1720
+ children: [
1721
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [
1722
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-black", children: label }),
1723
+ /* @__PURE__ */ jsx("span", { className: "h-5 w-px bg-[#e1e1e1]" }),
1724
+ /* @__PURE__ */ jsx("span", { className: "text-[#636363]", children: id })
1725
+ ] }),
1726
+ /* @__PURE__ */ jsxs(
1727
+ "button",
1728
+ {
1729
+ type: "button",
1730
+ onClick: onView,
1731
+ className: "group relative inline-flex w-fit items-center justify-end text-xs font-medium text-black",
1732
+ children: [
1733
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center transition-opacity duration-300 ease-in-out group-hover:opacity-0", children: [
1734
+ /* @__PURE__ */ jsx("span", { children: buttonLabel }),
1735
+ /* @__PURE__ */ jsx("span", { className: "ml-[4px] flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ jsx(RightArrow, {}) })
1736
+ ] }),
1737
+ /* @__PURE__ */ jsxs("span", { className: "pointer-events-none absolute inset-0 flex items-center opacity-0 transition-opacity duration-300 ease-in-out group-hover:opacity-100", children: [
1738
+ /* @__PURE__ */ jsx("span", { children: buttonLabel }),
1739
+ /* @__PURE__ */ jsx("span", { className: "ml-[2px] flex h-4 w-4 items-center justify-center animate-slide-right", children: /* @__PURE__ */ jsx(RightArrow, {}) })
1740
+ ] })
1741
+ ]
1742
+ }
1743
+ )
1744
+ ]
1745
+ }
1746
+ );
1747
+ };
1748
+ var ChatInquiryBar_default = ChatInquiryBar;
1749
+ var ChatListHeader = ({ className, onClose, onSearchChange }) => {
1750
+ const [searching, setSearching] = useState(false);
1751
+ const [q, setQ] = useState("");
1752
+ const inputRef = useRef(null);
1753
+ useEffect(() => {
1754
+ if (searching) {
1755
+ const timer = setTimeout(() => inputRef.current?.focus(), 200);
1756
+ return () => clearTimeout(timer);
1757
+ }
1758
+ }, [searching]);
1759
+ useEffect(() => {
1760
+ if (!searching) {
1761
+ return;
1762
+ }
1763
+ const onKey = (e) => {
1764
+ if (e.key === "Escape") {
1765
+ setSearching(false);
1766
+ setQ("");
1767
+ onSearchChange?.("");
1768
+ }
1769
+ };
1770
+ window.addEventListener("keydown", onKey);
1771
+ return () => window.removeEventListener("keydown", onKey);
1772
+ }, [searching, onSearchChange]);
1773
+ const variants = {
1774
+ inFromRight: {
1775
+ opacity: 1,
1776
+ x: 0,
1777
+ transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] }
1778
+ },
1779
+ outToLeft: {
1780
+ opacity: 0,
1781
+ x: -24,
1782
+ transition: { duration: 0.16, ease: [0.4, 0, 1, 1] }
1783
+ },
1784
+ inFromLeft: {
1785
+ opacity: 1,
1786
+ x: 0,
1787
+ transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] }
1788
+ },
1789
+ outToRight: {
1790
+ opacity: 0,
1791
+ x: 24,
1792
+ transition: { duration: 0.16, ease: [0.4, 0, 1, 1] }
1793
+ }
1794
+ };
1795
+ return /* @__PURE__ */ jsx("div", { className: cn("h-[64px] border-b border-[#ededed]", className), children: /* @__PURE__ */ jsx("div", { className: "flex h-full items-center px-[20px]", children: /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: !searching ? (
1796
+ /* =======================
1797
+ Normal header
1798
+ ======================= */
1799
+ /* @__PURE__ */ jsxs(
1800
+ motion.div,
1801
+ {
1802
+ className: "flex w-full items-center justify-between",
1803
+ initial: { opacity: 0, x: -24 },
1804
+ animate: "inFromLeft",
1805
+ exit: "outToLeft",
1806
+ variants,
1807
+ children: [
1808
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[#2c2c2c]", children: [
1809
+ /* @__PURE__ */ jsx(MessageIcon, { className: "h-6 w-6" }),
1810
+ /* @__PURE__ */ jsx("span", { className: "text-[22px] font-semibold", children: "Messenger" })
1811
+ ] }) }),
1812
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1813
+ /* @__PURE__ */ jsx(
1814
+ "button",
1815
+ {
1816
+ type: "button",
1817
+ title: "Search",
1818
+ onClick: () => setSearching(true),
1819
+ className: "flex h-9 w-9 items-center justify-center rounded-full hover:bg-black/5",
1820
+ children: /* @__PURE__ */ jsx(ChatSearchIcon, { className: "h-6 w-6" })
1821
+ }
1822
+ ),
1823
+ /* @__PURE__ */ jsx(
1824
+ "button",
1825
+ {
1826
+ type: "button",
1827
+ title: "Close",
1828
+ onClick: onClose,
1829
+ className: "flex h-9 w-9 items-center justify-center rounded-full hover:bg-black/5",
1830
+ children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-6 w-6" })
1831
+ }
1832
+ )
1833
+ ] })
1834
+ ]
1835
+ },
1836
+ "normal"
1837
+ )
1838
+ ) : (
1839
+ /* =======================
1840
+ Search header
1841
+ ======================= */
1842
+ /* @__PURE__ */ jsx(
1843
+ motion.div,
1844
+ {
1845
+ className: "flex w-full items-center gap-3",
1846
+ initial: { opacity: 0, x: 24 },
1847
+ animate: "inFromRight",
1848
+ exit: "outToRight",
1849
+ variants,
1850
+ children: /* @__PURE__ */ jsx("div", { className: "relative flex-1", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between h-10 w-full items-center gap-1.5 rounded-full border border-[#6A6A6A] bg-white px-[4px]", children: [
1851
+ /* @__PURE__ */ jsxs("div", { className: "ms-[12px] flex items-center", children: [
1852
+ /* @__PURE__ */ jsx("span", { className: "mr-2 grid h-6 w-6 shrink-0 place-items-center text-#929292]", children: /* @__PURE__ */ jsx(ChatSearchIcon, { className: "h-5 w-5" }) }),
1853
+ /* @__PURE__ */ jsx("span", { className: "mr-2 h-6 w-px shrink-0 bg-[#e1e1e1]" }),
1854
+ /* @__PURE__ */ jsx(
1855
+ "input",
1856
+ {
1857
+ ref: inputRef,
1858
+ value: q,
1859
+ onChange: (e) => {
1860
+ setQ(e.target.value);
1861
+ onSearchChange?.(e.target.value);
1862
+ },
1863
+ placeholder: "Search",
1864
+ className: "h-full w-full flex-1 bg-transparent text-[15px] outline-none placeholder:text-[#9C9C9C]"
1865
+ }
1866
+ )
1867
+ ] }),
1868
+ /* @__PURE__ */ jsx(
1869
+ "button",
1870
+ {
1871
+ type: "button",
1872
+ title: "Close search",
1873
+ onClick: () => {
1874
+ setSearching(false);
1875
+ setQ("");
1876
+ onSearchChange?.("");
1877
+ },
1878
+ className: "flex h-8! w-8! items-center justify-center rounded-full hover:bg-black/5",
1879
+ children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-5 w-5" })
1880
+ }
1881
+ )
1882
+ ] }) })
1883
+ },
1884
+ "search"
1885
+ )
1886
+ ) }) }) });
1887
+ };
1888
+ var ChatListHeader_default = ChatListHeader;
1889
+ var Row = ({ icon, label, value, highlight }) => {
1890
+ if (value === null || value === void 0) {
1891
+ return null;
1892
+ }
1893
+ const trimmed = String(value).trim();
1894
+ if (!trimmed) {
1895
+ return null;
1896
+ }
1897
+ const display = trimmed.length > 0 ? trimmed : "N/A";
1898
+ return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[18px_120px_1fr] items-start gap-1 text-xs", children: [
1899
+ /* @__PURE__ */ jsx("span", { className: "pt-[2px] text-black", children: icon }),
1900
+ /* @__PURE__ */ jsx("strong", { className: "truncate font-medium text-black", children: label }),
1901
+ /* @__PURE__ */ jsx("span", { className: cn(highlight ? "text-black" : "text-[#747474]"), children: display })
1902
+ ] });
1903
+ };
1904
+ var ChatAddressCard = ({ mine, card, className }) => {
1905
+ const {
1906
+ name,
1907
+ label,
1908
+ businessName,
1909
+ mobileNumber,
1910
+ country,
1911
+ district,
1912
+ policeStation,
1913
+ postalCode,
1914
+ addressLine,
1915
+ landMark
1916
+ } = card;
1917
+ const addressParts = [];
1918
+ if (landMark?.trim()) {
1919
+ addressParts.push(landMark.trim());
1920
+ }
1921
+ if (addressLine?.trim()) {
1922
+ addressParts.push(addressLine.trim());
1923
+ }
1924
+ if (policeStation?.trim()) {
1925
+ addressParts.push(policeStation.trim());
1926
+ }
1927
+ if (district?.trim()) {
1928
+ addressParts.push(district.trim());
1929
+ }
1930
+ if (postalCode?.trim()) {
1931
+ addressParts.push(postalCode.trim());
1932
+ }
1933
+ if (country?.trim()) {
1934
+ addressParts.push(country.trim());
1935
+ }
1936
+ const combinedAddress = addressParts.length > 0 ? `${addressParts.join(", ")}.` : void 0;
1937
+ const badge = label ? /* @__PURE__ */ jsxs("span", { className: "inline-flex h-[21px] items-center gap-1 rounded-xs bg-[#FFDBCF] px-2 py-[2px] text-[10px] text-[#ff5301]", children: [
1938
+ label.toLowerCase() === "office" ? /* @__PURE__ */ jsx(BadgeOfficeIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(BadgeHomeIcon, { className: "h-3 w-3" }),
1939
+ label
1940
+ ] }) : null;
1941
+ return /* @__PURE__ */ jsxs(
1942
+ "div",
1943
+ {
1944
+ className: clsx2(
1945
+ "w-[340px] rounded-md bg-[#f8f8f8] p-2",
1946
+ mine ? "ml-auto" : "mr-auto",
1947
+ className
1948
+ ),
1949
+ children: [
1950
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-2", children: [
1951
+ /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-black", children: name || "Recipient" }),
1952
+ badge
1953
+ ] }),
1954
+ /* @__PURE__ */ jsxs("div", { className: "space-y-[2px]", children: [
1955
+ /* @__PURE__ */ jsx(
1956
+ Row,
1957
+ {
1958
+ highlight: true,
1959
+ icon: /* @__PURE__ */ jsx(BadgeOfficeIcon, { className: "h-[14px] w-[14px]" }),
1960
+ label: "Business Name",
1961
+ value: businessName ?? void 0
1962
+ }
1963
+ ),
1964
+ /* @__PURE__ */ jsx(
1965
+ Row,
1966
+ {
1967
+ highlight: true,
1968
+ icon: /* @__PURE__ */ jsx(ChatPhoneCallIcon, { className: "h-[14px] w-[14px]" }),
1969
+ label: "Mobile Number",
1970
+ value: mobileNumber ?? void 0
1971
+ }
1972
+ ),
1973
+ /* @__PURE__ */ jsx(Row, { icon: /* @__PURE__ */ jsx(MapPinIcon, { className: "h-4 w-4" }), label: "Address", value: combinedAddress })
1974
+ ] })
1975
+ ]
1976
+ }
1977
+ );
1978
+ };
1979
+ var ChatAddressCard_default = ChatAddressCard;
1980
+ var formatSec = (s) => {
1981
+ if (!isFinite(s) || s < 0) {
1982
+ return "0:00";
1983
+ }
1984
+ const m = Math.floor(s / 60);
1985
+ const ss = Math.floor(s % 60).toString().padStart(2, "0");
1986
+ return `${m}:${ss}`;
1987
+ };
1988
+ var PlayIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", className, fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M6 4.5v11l9-5.5-9-5.5Z" }) });
1989
+ var PauseIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", className, fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M5 4h4v12H5V4zm6 0h4v12h-4V4z" }) });
1990
+ var audioRegistry = /* @__PURE__ */ new Set();
1991
+ var ChatBubbleAudio = ({ mine, audio }) => {
1992
+ const ref = React11.useRef(null);
1993
+ const trackRef = React11.useRef(null);
1994
+ const [playing, setPlaying] = React11.useState(false);
1995
+ const [progress, setProgress] = React11.useState(0);
1996
+ const [durSec, setDurSec] = React11.useState(0);
1997
+ const [remain, setRemain] = React11.useState(audio.duration ?? "0:00");
1998
+ React11.useEffect(() => {
1999
+ const a = ref.current;
2000
+ if (!a) {
2001
+ return;
2002
+ }
2003
+ audioRegistry.add(a);
2004
+ const onPause = () => setPlaying(false);
2005
+ const onPlay = () => setPlaying(true);
2006
+ a.addEventListener("pause", onPause);
2007
+ a.addEventListener("play", onPlay);
2008
+ return () => {
2009
+ a.removeEventListener("pause", onPause);
2010
+ a.removeEventListener("play", onPlay);
2011
+ audioRegistry.delete(a);
2012
+ };
2013
+ }, []);
2014
+ const pauseOthers = (current) => {
2015
+ audioRegistry.forEach((a) => {
2016
+ if (a !== current && !a.paused) {
2017
+ a.pause();
2018
+ }
2019
+ });
2020
+ };
2021
+ const applyProgressToAudio = (pct) => {
2022
+ const a = ref.current;
2023
+ if (!a || !isFinite(a.duration) || a.duration <= 0) {
2024
+ return;
2025
+ }
2026
+ const clamped = Math.min(100, Math.max(0, pct));
2027
+ a.currentTime = clamped / 100 * a.duration;
2028
+ setProgress(clamped);
2029
+ setRemain(formatSec(a.duration - a.currentTime));
2030
+ };
2031
+ const toggle = () => {
2032
+ const a = ref.current;
2033
+ if (!a) {
2034
+ return;
2035
+ }
2036
+ if (a.paused) {
2037
+ pauseOthers(a);
2038
+ a.play();
2039
+ setPlaying(true);
2040
+ } else {
2041
+ a.pause();
2042
+ setPlaying(false);
2043
+ }
2044
+ };
2045
+ const onTime = () => {
2046
+ const a = ref.current;
2047
+ if (!a) {
2048
+ return;
2049
+ }
2050
+ const pct = a.currentTime / (a.duration || 1) * 100;
2051
+ setProgress(isFinite(pct) ? pct : 0);
2052
+ setRemain(formatSec((a.duration || 0) - a.currentTime));
2053
+ };
2054
+ const onLoaded = () => {
2055
+ const a = ref.current;
2056
+ if (!a) {
2057
+ return;
2058
+ }
2059
+ setDurSec(a.duration || 0);
2060
+ setRemain(formatSec(a.duration || 0));
2061
+ };
2062
+ const pctFromClientX = (clientX) => {
2063
+ const el = trackRef.current;
2064
+ if (!el) {
2065
+ return progress;
2066
+ }
2067
+ const rect = el.getBoundingClientRect();
2068
+ const x = clientX - rect.left;
2069
+ const pct = x / rect.width * 100;
2070
+ return Math.min(100, Math.max(0, pct));
2071
+ };
2072
+ const handleTrackClick = (e) => {
2073
+ applyProgressToAudio(pctFromClientX(e.clientX));
2074
+ };
2075
+ const handlePointerDown = (e) => {
2076
+ e.currentTarget.setPointerCapture(e.pointerId);
2077
+ applyProgressToAudio(pctFromClientX(e.clientX));
2078
+ };
2079
+ const handlePointerMove = (e) => {
2080
+ if (e.currentTarget.hasPointerCapture(e.pointerId)) {
2081
+ applyProgressToAudio(pctFromClientX(e.clientX));
2082
+ }
2083
+ };
2084
+ return /* @__PURE__ */ jsxs("div", { className: "h-9 max-w-[260px] rounded-lg border border-[#E5E5E5] bg-white px-[3px] py-[3px]", children: [
2085
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
2086
+ /* @__PURE__ */ jsx(
2087
+ "button",
2088
+ {
2089
+ type: "button",
2090
+ "aria-label": playing ? "Pause" : "Play",
2091
+ onClick: toggle,
2092
+ className: clsx2(
2093
+ "grid h-7 w-[34px] place-items-center rounded-md transition-colors",
2094
+ mine ? "bg-[#F1F1F1] text-[#00486F]" : "bg-[#F1F1F1] text-[#00486F]"
2095
+ ),
2096
+ children: playing ? /* @__PURE__ */ jsx(PauseIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(PlayIcon, { className: "h-4 w-4" })
2097
+ }
2098
+ ),
2099
+ /* @__PURE__ */ jsxs(
2100
+ "div",
2101
+ {
2102
+ ref: trackRef,
2103
+ onClick: handleTrackClick,
2104
+ onPointerDown: handlePointerDown,
2105
+ onPointerMove: handlePointerMove,
2106
+ className: "relative h-[4px] w-[186px] cursor-pointer select-none rounded-full bg-[#BDBDBD]",
2107
+ "aria-label": "Seek",
2108
+ role: "slider",
2109
+ "aria-valuemin": 0,
2110
+ "aria-valuemax": 100,
2111
+ "aria-valuenow": Math.round(progress),
2112
+ children: [
2113
+ /* @__PURE__ */ jsx(
2114
+ "div",
2115
+ {
2116
+ className: "absolute left-0 top-0 h-full rounded-full bg-[#747474]",
2117
+ style: { width: `${progress}%` }
2118
+ }
2119
+ ),
2120
+ /* @__PURE__ */ jsx(
2121
+ "div",
2122
+ {
2123
+ className: "absolute top-1/2 -translate-y-1/2 h-3 w-3 rounded-full bg-[#747474]",
2124
+ style: { left: `calc(${progress}% - 6px)` }
2125
+ }
2126
+ )
2127
+ ]
2128
+ }
2129
+ ),
2130
+ /* @__PURE__ */ jsx("span", { className: "pe-[4px] text-xs font-normal text-[#747474]", children: remain || (durSec ? formatSec(durSec) : "0:00") })
2131
+ ] }),
2132
+ audio.src ? /* @__PURE__ */ jsx(
2133
+ "audio",
2134
+ {
2135
+ ref,
2136
+ src: audio.src,
2137
+ preload: "metadata",
2138
+ onTimeUpdate: onTime,
2139
+ onLoadedMetadata: onLoaded,
2140
+ onEnded: () => setPlaying(false),
2141
+ className: "hidden"
2142
+ }
2143
+ ) : null
2144
+ ] });
2145
+ };
2146
+ var ChatBubbleAudio_default = ChatBubbleAudio;
2147
+ var extColor2 = (ext) => {
2148
+ const e = ext.toLowerCase();
2149
+ if (e === "pdf") {
2150
+ return "text-[#D93025]";
2151
+ }
2152
+ if (e === "ppt" || e === "pptx") {
2153
+ return "text-[#E69138]";
2154
+ }
2155
+ if (e === "doc" || e === "docx") {
2156
+ return "text-[#2B579A]";
2157
+ }
2158
+ return "text-[#6B7280]";
2159
+ };
2160
+ var FileChip = ({ file }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 rounded-sm border border-[#e1e1e1] bg-white px-3 py-2", children: [
2161
+ /* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2162
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
2163
+ /* @__PURE__ */ jsx(FileIcon, { className: clsx2("h-[18px] w-[18px]", extColor2(file.ext)) }),
2164
+ " ",
2165
+ /* @__PURE__ */ jsx("div", { className: "truncate text-xs font-normal text-black", children: file.name })
2166
+ ] }),
2167
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[10px] text-[#636363] mt-2", children: [
2168
+ /* @__PURE__ */ jsxs("span", { children: [
2169
+ file.sizeMB.toFixed(1),
2170
+ " MB"
2171
+ ] }),
2172
+ /* @__PURE__ */ jsx("span", { className: "h-3 w-px bg-[#e1e1e1]" }),
2173
+ /* @__PURE__ */ jsx("span", { className: "uppercase", children: file.ext })
2174
+ ] })
2175
+ ] }) }),
2176
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
2177
+ /* @__PURE__ */ jsx("span", { className: "h-[41px] w-px bg-[#cacaca]" }),
2178
+ file.href ? /* @__PURE__ */ jsx(
2179
+ "a",
2180
+ {
2181
+ href: file.href,
2182
+ download: file.downloadName,
2183
+ target: "_blank",
2184
+ rel: "noopener noreferrer",
2185
+ className: "flex h-7 w-[28px] items-center justify-center rounded-full text-black hover:text-[#ff5301] shadow-[0px_2px_4px_0px_#A5A3AE4D]",
2186
+ title: file.downloadName,
2187
+ "aria-label": file.downloadName,
2188
+ children: /* @__PURE__ */ jsx(FileDownloadIcon, { className: "h-5 w-5" })
2189
+ }
2190
+ ) : /* @__PURE__ */ jsx("span", { className: "flex h-7 w-[28px] items-center justify-center rounded-full text-[#9ca3af]", children: /* @__PURE__ */ jsx(FileDownloadIcon, { className: "h-5 w-5" }) })
2191
+ ] })
2192
+ ] });
2193
+ var ChatBubbleFiles = ({ files }) => {
2194
+ return /* @__PURE__ */ jsx("div", { className: "flex max-w-[260px] flex-col gap-1", children: files.map((f, i) => /* @__PURE__ */ jsx(FileChip, { file: f }, i)) });
2195
+ };
2196
+ var ChatBubbleFiles_default = ChatBubbleFiles;
2197
+ var ImgTile = ({ src, w, h, overlayText, onClick }) => {
2198
+ return /* @__PURE__ */ jsxs(
2199
+ "button",
2200
+ {
2201
+ type: "button",
2202
+ onClick,
2203
+ className: "relative cursor-zoom-in overflow-hidden rounded-sm border border-[#EFEFEF] bg-[#F5F7FA]",
2204
+ style: { width: w, height: h },
2205
+ "aria-label": "Open image",
2206
+ children: [
2207
+ /* @__PURE__ */ jsx(
2208
+ "img",
2209
+ {
2210
+ src,
2211
+ alt: "",
2212
+ width: w,
2213
+ height: h,
2214
+ className: "h-full w-full object-cover",
2215
+ loading: "lazy"
2216
+ }
2217
+ ),
2218
+ overlayText ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grid place-items-center bg-black/35", children: /* @__PURE__ */ jsxs("span", { className: "text-4xl font-semibold text-white", children: [
2219
+ "+",
2220
+ overlayText
2221
+ ] }) }) : null
2222
+ ]
2223
+ }
2224
+ );
2225
+ };
2226
+ var ChatBubbleImages = ({ images }) => {
2227
+ const { openGallery } = useGallery();
2228
+ const openAt = (index) => {
2229
+ openGallery(
2230
+ images.map((url) => ({
2231
+ type: "image",
2232
+ url,
2233
+ altText: "Chat image"
2234
+ })),
2235
+ index
2236
+ );
2237
+ };
2238
+ const count = images.length;
2239
+ if (count === 1) {
2240
+ return /* @__PURE__ */ jsx(ImgTile, { src: images[0], w: 260, h: 174, onClick: () => openAt(0) });
2241
+ }
2242
+ if (count === 2) {
2243
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-1", children: images.map((src, i) => /* @__PURE__ */ jsx(ImgTile, { src, w: 125, h: 83, onClick: () => openAt(i) }, src + i)) });
2244
+ }
2245
+ if (count === 3) {
2246
+ const [a, b, c] = images;
2247
+ return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[125px_125px] gap-1", children: [
2248
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
2249
+ /* @__PURE__ */ jsx("div", { style: { width: 125, height: 83 } }),
2250
+ /* @__PURE__ */ jsx(ImgTile, { src: a, w: 125, h: 83, onClick: () => openAt(0) })
2251
+ ] }),
2252
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
2253
+ /* @__PURE__ */ jsx(ImgTile, { src: b, w: 125, h: 83, onClick: () => openAt(1) }),
2254
+ /* @__PURE__ */ jsx(ImgTile, { src: c, w: 125, h: 83, onClick: () => openAt(2) })
2255
+ ] })
2256
+ ] });
2257
+ }
2258
+ const visible = images.slice(0, 4);
2259
+ const extraCount = count - 4;
2260
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-1", children: visible.map((src, i) => /* @__PURE__ */ jsx(
2261
+ ImgTile,
2262
+ {
2263
+ src,
2264
+ w: 125,
2265
+ h: 83,
2266
+ overlayText: i === 3 && extraCount > 0 ? String(extraCount) : void 0,
2267
+ onClick: () => openAt(i)
2268
+ },
2269
+ src + i
2270
+ )) });
2271
+ };
2272
+ var ChatBubbleImages_default = ChatBubbleImages;
2273
+ var ChatBubbleText = ({ mine, text }) => {
2274
+ const base = "max-w-[289px] rounded-sm border border-[#f1f1f1] px-4 py-2.5 text-xs font-normal";
2275
+ const color = mine ? "bg-[#f8f8f8] border-[#f1f1f1]" : "bg-white border-[#EFEFEF]";
2276
+ const corner = mine ? "rounded-tr-[6px]" : "rounded-tl-md";
2277
+ const textFormatting = "whitespace-pre-wrap break-words";
2278
+ return /* @__PURE__ */ jsx("div", { className: clsx2(base, color, corner, textFormatting), children: text });
2279
+ };
2280
+ var ChatBubbleText_default = ChatBubbleText;
2281
+ var ChatBusinessCard = ({ mine, card }) => {
2282
+ return /* @__PURE__ */ jsx(
2283
+ "div",
2284
+ {
2285
+ className: clsx2(
2286
+ "relative h-[208px] w-[355px] overflow-hidden rounded-[12px] bg-white bg-cover bg-no-repeat",
2287
+ "shadow-[0_2px_12px_rgba(59,51,51,0.1)]",
2288
+ mine ? "ml-auto" : "mr-auto"
2289
+ ),
2290
+ style: { backgroundImage: "url('/chat/img/card_bg_raw.svg')" },
2291
+ children: /* @__PURE__ */ jsx("div", { className: "flex h-full items-stretch justify-between gap-4 px-6 py-6", children: /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col justify-between", children: [
2292
+ /* @__PURE__ */ jsxs("div", { children: [
2293
+ /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-[#004F4F]", children: card.name }),
2294
+ /* @__PURE__ */ jsx("div", { className: "h-px w-[105px] bg-black" }),
2295
+ /* @__PURE__ */ jsxs("div", { className: "mt-[6px] flex items-center gap-2", children: [
2296
+ /* @__PURE__ */ jsx(
2297
+ "img",
2298
+ {
2299
+ src: "https://flagcdn.com/bd.svg",
2300
+ alt: "Bangladesh flag",
2301
+ width: 24,
2302
+ height: 14,
2303
+ className: "h-[14px] w-6 rounded-xs object-cover",
2304
+ loading: "lazy"
2305
+ }
2306
+ ),
2307
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-[#636363]", children: card.country })
2308
+ ] })
2309
+ ] }),
2310
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 mb-10 space-y-1.5 text-xs text-black", children: [
2311
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
2312
+ /* @__PURE__ */ jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-[#FFE9DB]", children: /* @__PURE__ */ jsx(BusinessInfoIcon, { className: "h-3 w-3 text-[#EA580C]" }) }),
2313
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: card.company })
2314
+ ] }),
2315
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
2316
+ /* @__PURE__ */ jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-[#FFE9DB]", children: /* @__PURE__ */ jsx(ChatMailIcon, { className: "h-3 w-3 text-[#EA580C]" }) }),
2317
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: card.email })
2318
+ ] }),
2319
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
2320
+ /* @__PURE__ */ jsx("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-[#FFE9DB]", children: /* @__PURE__ */ jsx(ChatPhoneCallIcon, { className: "h-3 w-3 text-[#EA580C]" }) }),
2321
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: card.phone })
2322
+ ] })
2323
+ ] })
2324
+ ] }) })
2325
+ }
2326
+ );
2327
+ };
2328
+ var ChatBusinessCard_default = ChatBusinessCard;
2329
+ var MessageHoverActions = ({
2330
+ mine,
2331
+ onReply,
2332
+ onTranslate,
2333
+ children,
2334
+ className,
2335
+ alwaysVisible = false,
2336
+ isItemButton,
2337
+ activeButtons
2338
+ }) => {
2339
+ const sidePos = mine ? "right-full" : "left-full";
2340
+ const railNudge = mine ? "-translate-x-1.5" : "translate-x-1.5";
2341
+ const showReplay = !isItemButton || isItemButton.includes("replay");
2342
+ const showTranslate = !isItemButton || isItemButton.includes("translate");
2343
+ const hasAny = showReplay || showTranslate;
2344
+ const isActive = (k) => Boolean(activeButtons?.includes(k));
2345
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative inline-flex group/message", className), children: [
2346
+ children,
2347
+ hasAny ? /* @__PURE__ */ jsx(
2348
+ "div",
2349
+ {
2350
+ "aria-hidden": true,
2351
+ className: cn(
2352
+ "pointer-events-auto absolute inset-y-0 w-2",
2353
+ mine ? "right-full" : "left-full"
2354
+ )
2355
+ }
2356
+ ) : null,
2357
+ hasAny ? /* @__PURE__ */ jsx(
2358
+ "div",
2359
+ {
2360
+ className: cn(
2361
+ "pointer-events-auto absolute bottom-0 transition-opacity",
2362
+ sidePos,
2363
+ railNudge,
2364
+ alwaysVisible ? "opacity-100" : "opacity-0 group-hover/message:opacity-100"
2365
+ ),
2366
+ children: /* @__PURE__ */ jsxs("div", { className: "flex gap-2 pb-[2px]", children: [
2367
+ showReplay ? /* @__PURE__ */ jsx(
2368
+ "button",
2369
+ {
2370
+ type: "button",
2371
+ onClick: (e) => {
2372
+ e.stopPropagation();
2373
+ onReply?.();
2374
+ },
2375
+ className: cn(
2376
+ "inline-flex h-[22px] w-[22px] items-center justify-center rounded-xs bg-white ",
2377
+ "shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:bg-[#f8f8f8]",
2378
+ isActive("replay") ? "bg-[#636363] text-white" : "text-[#2c2c2c]"
2379
+ ),
2380
+ title: "Reply",
2381
+ "aria-label": "Reply",
2382
+ children: /* @__PURE__ */ jsx(MessageReplayIcon, { className: "h-[14px] w-[14px]" })
2383
+ }
2384
+ ) : null,
2385
+ showTranslate ? /* @__PURE__ */ jsx(
2386
+ "button",
2387
+ {
2388
+ type: "button",
2389
+ onClick: (e) => {
2390
+ e.stopPropagation();
2391
+ onTranslate?.();
2392
+ },
2393
+ className: cn(
2394
+ "inline-flex h-[22px] w-[22px] items-center justify-center rounded-xs bg-white ",
2395
+ "shadow-banbox-card-secondary hover:bg-[#f8f8f8]",
2396
+ isActive("translate") ? "bg-[#636363]! text-white" : "text-[#2c2c2c]"
2397
+ ),
2398
+ title: "Translate",
2399
+ "aria-label": "Translate",
2400
+ children: /* @__PURE__ */ jsx(NewLanguageIcon, { className: "h-[14px] w-[14px]" })
2401
+ }
2402
+ ) : null
2403
+ ] })
2404
+ }
2405
+ ) : null
2406
+ ] });
2407
+ };
2408
+ var MessageHoverActions_default = MessageHoverActions;
2409
+ var toBanglaDemo = (s) => {
2410
+ const map = {
2411
+ Hi: "\u09B9\u09BE\u0987",
2412
+ "Do you have a freight forwarder in China?": "\u0986\u09AA\u09A8\u09BE\u09B0 \u0995\u09BF \u099A\u09C0\u09A8\u09C7 \u0995\u09CB\u09A8\u09CB \u09AB\u09CD\u09B0\u09C7\u0987\u099F \u09AB\u09B0\u0993\u09DF\u09BE\u09B0\u09CD\u09A1\u09BE\u09B0 \u0986\u099B\u09C7?",
2413
+ "This conversation is empty. Say hi \u{1F44B}": "\u098F\u0987 \u0995\u09A5\u09CB\u09AA\u0995\u09A5\u09A8\u099F\u09BF \u0996\u09BE\u09B2\u09BF \u0964 \u09B9\u09BE\u0987 \u09B9\u09BE\u0987 \u09B9\u09BE\u0987 \u09AC\u09B2\u09C1\u09A8 \u{1F44B}",
2414
+ "Can we schedule a call for tomorrow?": "\u0986\u09AE\u09B0\u09BE \u0995\u09BF \u0986\u0997\u09BE\u09AE\u09C0\u0995\u09BE\u09B2 \u098F\u0995\u099F\u09BF \u0995\u09B2 \u09A8\u09BF\u09B0\u09CD\u09A7\u09BE\u09B0\u09A3 \u0995\u09B0\u09A4\u09C7 \u09AA\u09BE\u09B0\u09BF?",
2415
+ "Sure, what time suits you?": "\u0985\u09AC\u09B6\u09CD\u09AF\u0987, \u0986\u09AA\u09A8\u09BE\u09B0 \u099C\u09A8\u09CD\u09AF \u0995\u09CB\u09A8 \u09B8\u09AE\u09AF\u09BC\u099F\u09BF \u09B8\u09C1\u09AC\u09BF\u09A7\u09BE\u099C\u09A8\u0995?",
2416
+ "Welcome to Global Marketplace": "\u0997\u09CD\u09B2\u09CB\u09AC\u09BE\u09B2 \u09AE\u09BE\u09B0\u09CD\u0995\u09C7\u099F\u09AA\u09CD\u09B2\u09C7\u09B8\u09C7 \u0986\u09AA\u09A8\u09BE\u0995\u09C7 \u09B8\u09CD\u09AC\u09BE\u0997\u09A4\u09AE \u{1F389}",
2417
+ "Happy to be here!": "\u098F\u0996\u09BE\u09A8\u09C7 \u09A5\u09BE\u0995\u09A4\u09C7 \u09AA\u09C7\u09B0\u09C7 \u0986\u09A8\u09A8\u09CD\u09A6\u09BF\u09A4!"
2418
+ };
2419
+ if (map[s]) {
2420
+ return map[s];
2421
+ }
2422
+ return `\u09AC\u09BE\u0982\u09B2\u09BE ${s}`;
2423
+ };
2424
+ var ChatMessageItem = ({
2425
+ id,
2426
+ mine = false,
2427
+ time,
2428
+ authorInitial = "U",
2429
+ avatarBg = "#ffffff",
2430
+ text,
2431
+ businessCard,
2432
+ addressCard,
2433
+ images,
2434
+ files,
2435
+ audio,
2436
+ replyTo,
2437
+ showStatus = false,
2438
+ status = "Seen",
2439
+ className,
2440
+ onReply,
2441
+ onTranslate,
2442
+ initialSrc
2443
+ }) => {
2444
+ const originalText = useMemo(() => text ?? "", [text]);
2445
+ const [translated, setTranslated] = useState(false);
2446
+ const displayText = translated ? toBanglaDemo(originalText) : originalText;
2447
+ const handleTranslateClick = () => {
2448
+ setTranslated((v) => !v);
2449
+ onTranslate?.();
2450
+ };
2451
+ return /* @__PURE__ */ jsx("div", { className: cn("mb-4", className), "data-msg-id": id, children: /* @__PURE__ */ jsxs("div", { className: cn("flex items-end gap-3", mine && "justify-end"), children: [
2452
+ !mine ? /* @__PURE__ */ jsx("div", { className: cn(showStatus ? "mb-5" : "mb-0"), children: initialSrc ? /* @__PURE__ */ jsxs("div", { className: "relative h-10 w-10 shrink-0 rounded-full border border-[#F1F1F1]", children: [
2453
+ /* @__PURE__ */ jsx(
2454
+ "img",
2455
+ {
2456
+ src: initialSrc,
2457
+ alt: "avatar image",
2458
+ className: "h-full w-full rounded-full object-cover"
2459
+ }
2460
+ ),
2461
+ /* @__PURE__ */ jsx("span", { className: "absolute bottom-0 right-0 h-[11.25px] w-[11.25px] rounded-full bg-[#328545] ring-1 ring-white" })
2462
+ ] }) : /* @__PURE__ */ jsxs(
2463
+ "div",
2464
+ {
2465
+ className: "relative grid h-10 w-10 shrink-0 place-items-center rounded-full border border-[#f1f1f1] font-semibold text-[#2c2c2c]",
2466
+ style: { backgroundColor: avatarBg },
2467
+ children: [
2468
+ authorInitial,
2469
+ /* @__PURE__ */ jsx("span", { className: "absolute bottom-0 right-0 h-[11.25px] w-[11.25px] rounded-full bg-[#328545] ring-1 ring-white" })
2470
+ ]
2471
+ }
2472
+ ) }) : null,
2473
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-1", children: [
2474
+ /* @__PURE__ */ jsx(
2475
+ "div",
2476
+ {
2477
+ className: cn(
2478
+ "text-xs font-light text-[#636363]",
2479
+ mine ? "text-right" : "text-left"
2480
+ ),
2481
+ children: time
2482
+ }
2483
+ ),
2484
+ /* @__PURE__ */ jsxs("div", { className: cn("flex w-full flex-col gap-1", mine ? "items-end" : "items-start"), children: [
2485
+ /* @__PURE__ */ jsx("div", { className: cn("flex w-full", mine ? "justify-end" : "justify-start"), children: replyTo ? /* @__PURE__ */ jsx(ReplyCard_default, { jumpOnClick: true, refMsg: replyTo, compact: true, className: "mb-1" }) : null }),
2486
+ businessCard ? /* @__PURE__ */ jsx(ChatBusinessCard_default, { mine, card: businessCard }) : null,
2487
+ addressCard ? /* @__PURE__ */ jsx(ChatAddressCard_default, { mine, card: addressCard }) : null,
2488
+ files?.length ? /* @__PURE__ */ jsx(MessageHoverActions_default, { mine, onReply, isItemButton: ["replay"], children: /* @__PURE__ */ jsx(ChatBubbleFiles_default, { files }) }) : null,
2489
+ images?.length ? /* @__PURE__ */ jsx(MessageHoverActions_default, { mine, onReply, isItemButton: ["replay"], children: /* @__PURE__ */ jsx(ChatBubbleImages_default, { images }) }) : null,
2490
+ audio ? /* @__PURE__ */ jsx(
2491
+ MessageHoverActions_default,
2492
+ {
2493
+ mine,
2494
+ onReply,
2495
+ onTranslate,
2496
+ isItemButton: ["replay", "translate"],
2497
+ children: /* @__PURE__ */ jsx(ChatBubbleAudio_default, { mine, audio })
2498
+ }
2499
+ ) : null,
2500
+ typeof text === "string" && text.length > 0 ? /* @__PURE__ */ jsx(
2501
+ MessageHoverActions_default,
2502
+ {
2503
+ mine,
2504
+ onReply,
2505
+ onTranslate: handleTranslateClick,
2506
+ isItemButton: ["replay", "translate"],
2507
+ activeButtons: translated ? ["translate"] : [],
2508
+ children: /* @__PURE__ */ jsx(ChatBubbleText_default, { mine, text: displayText })
2509
+ }
2510
+ ) : null,
2511
+ showStatus ? /* @__PURE__ */ jsx("div", { className: cn("text-xs text-[#9AA1A9]", mine ? "text-right" : "text-left"), children: status }) : null
2512
+ ] })
2513
+ ] })
2514
+ ] }) });
2515
+ };
2516
+ var ChatMessageItem_default = ChatMessageItem;
2517
+ var ChatScroll = ({
2518
+ top,
2519
+ children,
2520
+ className,
2521
+ bottomAlignWhenShort = false,
2522
+ scrollKey
2523
+ }) => {
2524
+ const ref = React11.useRef(null);
2525
+ const scrollToBottom = React11.useCallback(() => {
2526
+ const el = ref.current;
2527
+ if (!el) {
2528
+ return;
2529
+ }
2530
+ el.scrollTop = el.scrollHeight;
2531
+ }, []);
2532
+ React11.useEffect(() => {
2533
+ scrollToBottom();
2534
+ const id = window.setTimeout(scrollToBottom, 0);
2535
+ return () => window.clearTimeout(id);
2536
+ }, [scrollKey, scrollToBottom]);
2537
+ return /* @__PURE__ */ jsx(
2538
+ "div",
2539
+ {
2540
+ ref,
2541
+ "data-chat-scroll": true,
2542
+ className: clsx2(
2543
+ "h-full min-h-0 overflow-y-auto bg-white p-4 custom-scroll-hidden",
2544
+ className
2545
+ ),
2546
+ children: /* @__PURE__ */ jsxs(
2547
+ "div",
2548
+ {
2549
+ className: clsx2(
2550
+ "min-h-full flex flex-col",
2551
+ bottomAlignWhenShort ? "justify-end" : "justify-start"
2552
+ ),
2553
+ children: [
2554
+ top,
2555
+ children
2556
+ ]
2557
+ }
2558
+ )
2559
+ }
2560
+ );
2561
+ };
2562
+ var ChatScroll_default = ChatScroll;
2563
+ var formatTwoDigits = (value) => {
2564
+ return String(Math.max(0, value)).padStart(2, "0");
2565
+ };
2566
+ var ChatThreadItem = ({
2567
+ active = false,
2568
+ pinned = false,
2569
+ online = false,
2570
+ verified = false,
2571
+ title,
2572
+ preview,
2573
+ time,
2574
+ status,
2575
+ avatarText,
2576
+ avatarSrc,
2577
+ avatarBg = "#FFE5DA",
2578
+ className,
2579
+ onClick
2580
+ }) => {
2581
+ const statusEl = (() => {
2582
+ switch (status.kind) {
2583
+ case "seen":
2584
+ return /* @__PURE__ */ jsx("span", { className: "text-[#005694]", children: "Seen" });
2585
+ case "delivered":
2586
+ return /* @__PURE__ */ jsx("span", { className: "text-[#929292]", children: "Delivered" });
2587
+ case "new":
2588
+ return /* @__PURE__ */ jsxs("span", { className: "text-[#EB2127]", children: [
2589
+ "New ",
2590
+ formatTwoDigits(status.count)
2591
+ ] });
2592
+ }
2593
+ })();
2594
+ return /* @__PURE__ */ jsxs(
2595
+ "button",
2596
+ {
2597
+ type: "button",
2598
+ onClick,
2599
+ className: cn(
2600
+ "relative w-full px-5 py-2 text-left focus:outline-none border-b border-[#f1f1f1]",
2601
+ "hover:bg-[#f8f8f8]",
2602
+ active && "bg-[#f8f8f8]",
2603
+ className
2604
+ ),
2605
+ children: [
2606
+ pinned ? /* @__PURE__ */ jsx("span", { className: "absolute right-0 top-0 h-0 w-0 border-l-16 border-t-16 border-l-transparent border-t-[#FFD2BD]" }) : null,
2607
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
2608
+ /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", style: { width: 36, height: 36 }, children: [
2609
+ avatarSrc ? /* @__PURE__ */ jsx("div", { className: "h-9 w-9 overflow-hidden rounded-[2px] border border-[#f1f1f1]", children: /* @__PURE__ */ jsx("img", { src: avatarSrc, alt: title, className: "h-full w-full rounded-[2px] object-cover" }) }) : /* @__PURE__ */ jsx(
2610
+ "div",
2611
+ {
2612
+ className: "grid h-9 w-9 place-items-center rounded-[2px] border border-[#f1f1f1] text-[15px] font-semibold text-[#2c2c2c]",
2613
+ style: { backgroundColor: avatarBg },
2614
+ children: avatarText
2615
+ }
2616
+ ),
2617
+ /* @__PURE__ */ jsx(
2618
+ "span",
2619
+ {
2620
+ className: cn(
2621
+ "absolute rounded-full",
2622
+ online ? "bg-[#74A380]" : "bg-[#EB2127]"
2623
+ ),
2624
+ style: { bottom: -1.5, right: -1.5, width: 11.25, height: 11.25, border: "1px solid #FFFFFF" }
2625
+ }
2626
+ )
2627
+ ] }),
2628
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2629
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-[14px]", children: [
2630
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium text-black", children: title }),
2631
+ verified ? /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(BlueBadgeIcon, {}) }) : null
2632
+ ] }),
2633
+ /* @__PURE__ */ jsx("div", { className: "truncate text-xs font-normal text-[#2c2c2c]", children: preview }),
2634
+ /* @__PURE__ */ jsxs("div", { className: "mt-0.5 flex items-center justify-between text-[12px]", children: [
2635
+ /* @__PURE__ */ jsx("div", { children: statusEl }),
2636
+ /* @__PURE__ */ jsx("span", { className: "font-light text-[#636363] tracking-[0.5px]", children: time })
2637
+ ] })
2638
+ ] })
2639
+ ] })
2640
+ ]
2641
+ }
2642
+ );
2643
+ };
2644
+ var ChatThreadItem_default = ChatThreadItem;
2645
+ var TypingDots = () => /* @__PURE__ */ jsxs(Fragment, { children: [
2646
+ /* @__PURE__ */ jsx("style", { children: `
2647
+ @keyframes banbox-typing-bounce {
2648
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
2649
+ 30% { transform: translateY(-5px); opacity: 1; }
2650
+ }
2651
+ .banbox-typing-dot {
2652
+ width: 7px;
2653
+ height: 7px;
2654
+ border-radius: 50%;
2655
+ background: #888;
2656
+ display: inline-block;
2657
+ animation: banbox-typing-bounce 1.2s infinite ease-in-out;
2658
+ }
2659
+ .banbox-typing-dot:nth-child(1) { animation-delay: 0s; }
2660
+ .banbox-typing-dot:nth-child(2) { animation-delay: 0.2s; }
2661
+ .banbox-typing-dot:nth-child(3) { animation-delay: 0.4s; }
2662
+ ` }),
2663
+ /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", gap: "4px", alignItems: "center", height: "28px", padding: "0 8px" }, children: [
2664
+ /* @__PURE__ */ jsx("span", { className: "banbox-typing-dot" }),
2665
+ /* @__PURE__ */ jsx("span", { className: "banbox-typing-dot" }),
2666
+ /* @__PURE__ */ jsx("span", { className: "banbox-typing-dot" })
2667
+ ] })
2668
+ ] });
2669
+ var TypingIndicator = ({
2670
+ className,
2671
+ ariaLabel = "Typing\u2026",
2672
+ avatarSize = 40
2673
+ }) => {
2674
+ return /* @__PURE__ */ jsxs(
2675
+ "div",
2676
+ {
2677
+ className: cn("relative flex items-end gap-[6px]", className),
2678
+ role: "status",
2679
+ "aria-label": ariaLabel,
2680
+ children: [
2681
+ /* @__PURE__ */ jsxs(
2682
+ "div",
2683
+ {
2684
+ className: "relative shrink-0 rounded-full border border-[#F1F1F1]",
2685
+ style: { width: avatarSize, height: avatarSize },
2686
+ children: [
2687
+ /* @__PURE__ */ jsx(
2688
+ "img",
2689
+ {
2690
+ src: "/chat/img/girl_support.png",
2691
+ alt: "avatar image",
2692
+ className: "h-full w-full rounded-full object-cover"
2693
+ }
2694
+ ),
2695
+ /* @__PURE__ */ jsx("span", { className: "absolute bottom-0 right-0 h-[11.25px] w-[11.25px] rounded-full bg-[#328545] ring-1 ring-white" })
2696
+ ]
2697
+ }
2698
+ ),
2699
+ /* @__PURE__ */ jsx("span", { className: "absolute bottom-[-13px] left-[30px]", children: /* @__PURE__ */ jsx(TypingDots, {}) })
2700
+ ]
2701
+ }
2702
+ );
2703
+ };
2704
+ var TypingIndicator_default = TypingIndicator;
2705
+ var ChatSpinner = ({ className, size = 32 }) => /* @__PURE__ */ jsxs(Fragment, { children: [
2706
+ /* @__PURE__ */ jsx("style", { children: `
2707
+ @keyframes banbox-chat-spin {
2708
+ to { transform: rotate(360deg); }
2709
+ }
2710
+ ` }),
2711
+ /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center", className), children: /* @__PURE__ */ jsxs(
2712
+ "svg",
2713
+ {
2714
+ style: {
2715
+ width: size,
2716
+ height: size,
2717
+ animation: "banbox-chat-spin 1.4s linear infinite"
2718
+ },
2719
+ viewBox: "0 0 36 36",
2720
+ fill: "none",
2721
+ "aria-hidden": "true",
2722
+ children: [
2723
+ /* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "15", stroke: "#e5e7eb", strokeWidth: "3" }),
2724
+ /* @__PURE__ */ jsx(
2725
+ "circle",
2726
+ {
2727
+ cx: "18",
2728
+ cy: "18",
2729
+ r: "15",
2730
+ stroke: "#3d3d3d",
2731
+ strokeWidth: "3",
2732
+ strokeLinecap: "round",
2733
+ strokeDasharray: "22 72"
2734
+ }
2735
+ )
2736
+ ]
2737
+ }
2738
+ ) })
2739
+ ] });
2740
+ var ChatSpinner_default = ChatSpinner;
2741
+ function Portal({ children, containerId = "portal-root" }) {
2742
+ const [container, setContainer] = useState(null);
2743
+ useEffect(() => {
2744
+ let node = document.getElementById(containerId);
2745
+ let created = false;
2746
+ if (!node) {
2747
+ node = document.createElement("div");
2748
+ node.setAttribute("id", containerId);
2749
+ document.body.appendChild(node);
2750
+ created = true;
2751
+ }
2752
+ queueMicrotask(() => {
2753
+ setContainer(node);
2754
+ });
2755
+ return () => {
2756
+ if (created && node?.parentNode) {
2757
+ node.parentNode.removeChild(node);
2758
+ }
2759
+ };
2760
+ }, [containerId]);
2761
+ if (!container) {
2762
+ return null;
2763
+ }
2764
+ return createPortal(children, container);
2765
+ }
2766
+ var slideVariants = {
2767
+ enter: (dir) => ({
2768
+ x: dir > 0 ? 300 : -300,
2769
+ opacity: 0
2770
+ }),
2771
+ center: { x: 0, opacity: 1 },
2772
+ exit: (dir) => ({
2773
+ x: dir > 0 ? -300 : 300,
2774
+ opacity: 0
2775
+ })
2776
+ };
2777
+ var ChatImagePreviewModal = ({
2778
+ isOpen,
2779
+ onClose
2780
+ }) => {
2781
+ const { images, currentIndex, setCurrentIndex } = useGallery();
2782
+ const current = currentIndex ?? 0;
2783
+ const total = images?.length ?? 0;
2784
+ const hasPrev = current > 0;
2785
+ const hasNext = current < total - 1;
2786
+ const [direction, setDirection] = useState(0);
2787
+ const goPrev = useCallback(() => {
2788
+ if (current > 0) {
2789
+ setDirection(-1);
2790
+ setCurrentIndex(current - 1);
2791
+ }
2792
+ }, [current, setCurrentIndex]);
2793
+ const goNext = useCallback(() => {
2794
+ if (images && current < images.length - 1) {
2795
+ setDirection(1);
2796
+ setCurrentIndex(current + 1);
2797
+ }
2798
+ }, [current, images, setCurrentIndex]);
2799
+ useEffect(() => {
2800
+ if (!isOpen) return;
2801
+ const handleKey = (e) => {
2802
+ if (e.key === "Escape") onClose();
2803
+ if (e.key === "ArrowLeft") goPrev();
2804
+ if (e.key === "ArrowRight") goNext();
2805
+ };
2806
+ window.addEventListener("keydown", handleKey);
2807
+ return () => window.removeEventListener("keydown", handleKey);
2808
+ }, [isOpen, onClose, goPrev, goNext]);
2809
+ const currentImage = images?.[current];
2810
+ return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && total > 0 && /* @__PURE__ */ jsx(
2811
+ motion.div,
2812
+ {
2813
+ className: "fixed inset-0 z-999 flex items-center justify-center",
2814
+ initial: { opacity: 0, backgroundColor: "rgba(0,0,0,0)" },
2815
+ animate: { opacity: 1, backgroundColor: "rgba(0,0,0,0.55)" },
2816
+ exit: { opacity: 0, backgroundColor: "rgba(0,0,0,0)" },
2817
+ transition: { duration: 0.25, ease: "easeInOut" },
2818
+ onClick: onClose,
2819
+ children: /* @__PURE__ */ jsxs(
2820
+ motion.div,
2821
+ {
2822
+ className: "relative flex items-center justify-center",
2823
+ initial: { opacity: 0, scale: 0.92 },
2824
+ animate: { opacity: 1, scale: 1 },
2825
+ exit: { opacity: 0, scale: 0.92 },
2826
+ transition: { duration: 0.25, ease: "easeInOut" },
2827
+ onClick: (e) => e.stopPropagation(),
2828
+ children: [
2829
+ /* @__PURE__ */ jsxs(
2830
+ "div",
2831
+ {
2832
+ className: "relative flex items-center justify-center overflow-hidden rounded-[6px] bg-white",
2833
+ style: { width: 850, height: 850 },
2834
+ children: [
2835
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, custom: direction, children: /* @__PURE__ */ jsx(
2836
+ motion.img,
2837
+ {
2838
+ custom: direction,
2839
+ variants: slideVariants,
2840
+ initial: "enter",
2841
+ animate: "center",
2842
+ exit: "exit",
2843
+ transition: { duration: 0.3, ease: "easeInOut" },
2844
+ src: currentImage?.url,
2845
+ alt: currentImage?.altText ?? `Image ${current + 1}`,
2846
+ className: "w-full rounded-[6px] object-contain",
2847
+ draggable: false
2848
+ },
2849
+ current
2850
+ ) }),
2851
+ /* @__PURE__ */ jsx(
2852
+ "button",
2853
+ {
2854
+ type: "button",
2855
+ onClick: goPrev,
2856
+ disabled: !hasPrev,
2857
+ className: `absolute left-0 top-1/2 -translate-y-1/2 flex h-[100px] items-center rounded-tr-[3px] rounded-br-[3px] p-[7px] backdrop-blur-[2px] shadow-[3px_0px_6px_0px_rgba(0,0,0,0.1)] transition-opacity ${hasPrev ? "cursor-pointer opacity-100" : "cursor-default opacity-30"}`,
2858
+ style: { backgroundColor: "rgba(255,255,255,0.7)" },
2859
+ "aria-label": "Previous image",
2860
+ children: /* @__PURE__ */ jsx("svg", { width: "42", height: "42", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
2861
+ "path",
2862
+ {
2863
+ d: "M15 18L9 12L15 6",
2864
+ stroke: "#2C2C2C",
2865
+ strokeWidth: "2",
2866
+ strokeLinecap: "round",
2867
+ strokeLinejoin: "round"
2868
+ }
2869
+ ) })
2870
+ }
2871
+ ),
2872
+ /* @__PURE__ */ jsx(
2873
+ "button",
2874
+ {
2875
+ type: "button",
2876
+ onClick: goNext,
2877
+ disabled: !hasNext,
2878
+ className: `absolute right-0 top-1/2 -translate-y-1/2 flex h-[100px] items-center rounded-tl-[3px] rounded-bl-[3px] p-[7px] backdrop-blur-[2px] shadow-[-3px_0px_6px_0px_rgba(0,0,0,0.1)] transition-opacity ${hasNext ? "cursor-pointer opacity-100" : "cursor-default opacity-30"}`,
2879
+ style: { backgroundColor: "rgba(255,255,255,0.7)" },
2880
+ "aria-label": "Next image",
2881
+ children: /* @__PURE__ */ jsx("svg", { width: "42", height: "42", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
2882
+ "path",
2883
+ {
2884
+ d: "M9 18L15 12L9 6",
2885
+ stroke: "#2C2C2C",
2886
+ strokeWidth: "2",
2887
+ strokeLinecap: "round",
2888
+ strokeLinejoin: "round"
2889
+ }
2890
+ ) })
2891
+ }
2892
+ )
2893
+ ]
2894
+ }
2895
+ ),
2896
+ /* @__PURE__ */ jsx(
2897
+ "button",
2898
+ {
2899
+ type: "button",
2900
+ onClick: onClose,
2901
+ className: "absolute top-[-4px] right-[-63px] flex h-[36px] w-[36px] cursor-pointer items-center justify-center rounded-full bg-white shadow-[0_2px_8px_rgba(0,0,0,0.15)] transition-colors hover:bg-[#f1f1f1]",
2902
+ "aria-label": "Close preview",
2903
+ children: /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
2904
+ /* @__PURE__ */ jsx(
2905
+ "path",
2906
+ {
2907
+ d: "M18 6L6 18",
2908
+ stroke: "black",
2909
+ strokeWidth: "2",
2910
+ strokeLinecap: "round",
2911
+ strokeLinejoin: "round"
2912
+ }
2913
+ ),
2914
+ /* @__PURE__ */ jsx(
2915
+ "path",
2916
+ {
2917
+ d: "M6 6L18 18",
2918
+ stroke: "black",
2919
+ strokeWidth: "2",
2920
+ strokeLinecap: "round",
2921
+ strokeLinejoin: "round"
2922
+ }
2923
+ )
2924
+ ] })
2925
+ }
2926
+ )
2927
+ ]
2928
+ }
2929
+ )
2930
+ }
2931
+ ) }) });
2932
+ };
2933
+ var ChatImagePreviewModal_default = ChatImagePreviewModal;
2934
+ var avatarBgByInitial = {
2935
+ K: "#FFE7DB",
2936
+ A: "#FFE5DA",
2937
+ F: "#E8F7FF",
2938
+ B: "#F0EDEB",
2939
+ b: "#F0EDEB"
2940
+ };
2941
+ var InboxPopup = ({ adapter, uiCallbacks }) => {
2942
+ const { close, selectThread, selectedThreadId, reference } = useChatUI();
2943
+ const { isOpen: isGalleryOpen, closeGallery } = useGallery();
2944
+ const [threads, setThreads] = useState(() => adapter.threads.list(reference));
2945
+ const refreshThreads = useCallback(
2946
+ () => setThreads(adapter.threads.list(reference)),
2947
+ [adapter, reference]
2948
+ );
2949
+ useEffect(() => {
2950
+ let rafId = 0;
2951
+ rafId = requestAnimationFrame(refreshThreads);
2952
+ const unsub = adapter.threads.subscribe(refreshThreads);
2953
+ return () => {
2954
+ cancelAnimationFrame(rafId);
2955
+ unsub();
2956
+ };
2957
+ }, [adapter, reference, refreshThreads]);
2958
+ const [rev, setRev] = useState(0);
2959
+ const [replyTo, setReplyTo] = useState(void 0);
2960
+ const [searchQuery, setSearchQuery] = useState("");
2961
+ const activeId = selectedThreadId ?? threads[0]?.id;
2962
+ const activeThread = threads.find((t) => t.id === activeId);
2963
+ const [messages, setMessages] = useState(
2964
+ () => activeId ? adapter.messages.list(activeId) : []
2965
+ );
2966
+ useEffect(() => {
2967
+ if (activeId) setMessages(adapter.messages.list(activeId));
2968
+ }, [activeId, rev, adapter]);
2969
+ useEffect(() => {
2970
+ if (!activeId || !adapter.messages.subscribe) return;
2971
+ const unsub = adapter.messages.subscribe(activeId, () => {
2972
+ setMessages(adapter.messages.list(activeId));
2973
+ });
2974
+ return unsub;
2975
+ }, [activeId, adapter]);
2976
+ const initial = activeThread?.avatarText ?? "U";
2977
+ const title = activeThread?.title ?? "Unknown";
2978
+ const subtitle = activeThread?.subTitle ?? "";
2979
+ const online = Boolean(activeThread?.online);
2980
+ const isVerified = Boolean(activeThread?.badge);
2981
+ const avatarBg = avatarBgByInitial[initial] ?? "#FFF1EC";
2982
+ const idLabel = activeThread?.orderId ? "Order ID" : activeThread?.inquiryId ? "Inquiry ID" : void 0;
2983
+ const idButtonLabel = activeThread?.orderId ? "View Order" : activeThread?.inquiryId ? "View Inquiry" : void 0;
2984
+ const idValue = activeThread?.orderId ?? activeThread?.inquiryId ?? void 0;
2985
+ const [showDelete, setShowDelete] = useState(false);
2986
+ const [isLoading, setIsLoading] = useState(false);
2987
+ const scrollKey = `${activeId}-${messages.length}-${rev}`;
2988
+ const prevActiveIdRef = React11.useRef(activeId);
2989
+ useEffect(() => {
2990
+ if (prevActiveIdRef.current !== activeId) {
2991
+ prevActiveIdRef.current = activeId;
2992
+ setIsLoading(true);
2993
+ const t = setTimeout(() => setIsLoading(false), 300);
2994
+ if (activeId) adapter.threads.markRead?.(activeId);
2995
+ return () => clearTimeout(t);
2996
+ }
2997
+ }, [activeId, adapter]);
2998
+ const toRef2 = (m) => ({
2999
+ id: m.id,
3000
+ author: typeof m.author === "string" ? m.author : "U",
3001
+ time: m.time,
3002
+ text: m.text ?? m.content,
3003
+ images: m.images,
3004
+ files: m.files,
3005
+ audio: m.audio
3006
+ });
3007
+ const handleConfirmDelete = () => {
3008
+ if (!activeId) {
3009
+ setShowDelete(false);
3010
+ return;
3011
+ }
3012
+ adapter.threads.delete(activeId);
3013
+ const nextId = threads.filter((t) => t.id !== activeId)[0]?.id;
3014
+ if (nextId) selectThread(nextId);
3015
+ setReplyTo(void 0);
3016
+ setShowDelete(false);
3017
+ uiCallbacks?.showToast?.({
3018
+ type: "success",
3019
+ title: "Chat Deleted",
3020
+ message: "The chat has been deleted successfully."
3021
+ });
3022
+ };
3023
+ return /* @__PURE__ */ jsxs("div", { className: "fixed bottom-4 right-[40px] z-50", children: [
3024
+ /* @__PURE__ */ jsx(
3025
+ motion.button,
3026
+ {
3027
+ "aria-label": "Close chat",
3028
+ onClick: close,
3029
+ className: "fixed inset-0 bg-black/20",
3030
+ initial: { opacity: 0 },
3031
+ animate: { opacity: 1 },
3032
+ exit: { opacity: 0 },
3033
+ transition: { duration: 0.3 }
3034
+ }
3035
+ ),
3036
+ /* @__PURE__ */ jsx(
3037
+ motion.div,
3038
+ {
3039
+ role: "dialog",
3040
+ "aria-modal": "true",
3041
+ className: "relative rounded-[16px]",
3042
+ style: { width: 800, height: 650, boxShadow: "0px 2px 12px 0px rgba(59,51,51,0.1)" },
3043
+ initial: { x: "100%", opacity: 0 },
3044
+ animate: { x: 0, opacity: 1 },
3045
+ exit: { x: "100%", opacity: 0 },
3046
+ transition: { type: "tween", duration: 0.4, ease: "easeOut" },
3047
+ children: /* @__PURE__ */ jsxs(
3048
+ "div",
3049
+ {
3050
+ className: "relative h-full w-full overflow-hidden rounded-[16px]",
3051
+ style: {
3052
+ border: "2px solid transparent",
3053
+ background: "linear-gradient(white, white) padding-box, linear-gradient(236.83deg, rgba(51, 201, 212, 0.3) 0.4%, rgba(39, 83, 251, 0.3) 30.28%, rgba(39, 83, 251, 0.3) 50.2%, rgba(39, 83, 251, 0.3) 65.14%, rgba(235, 67, 255, 0.3) 100%) border-box"
3054
+ },
3055
+ children: [
3056
+ /* @__PURE__ */ jsxs("div", { className: "grid h-full min-h-0 grid-cols-[1fr_350px]", children: [
3057
+ /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-col border-r border-[#9BBCCF]", children: [
3058
+ /* @__PURE__ */ jsx("div", { className: "h-[64px] shrink-0", children: /* @__PURE__ */ jsx(
3059
+ ChatHeader,
3060
+ {
3061
+ left: activeThread?.avatarSrc ? /* @__PURE__ */ jsx(ChatIdentity_default, { variant: "avatar", src: activeThread.avatarSrc, online, title, subtitle, verified: isVerified, subtitleVariant: "muted" }) : /* @__PURE__ */ jsx(ChatIdentity_default, { variant: "initial", initial, bg: avatarBg, online, title, subtitle, verified: isVerified, subtitleVariant: "muted" }),
3062
+ right: uiCallbacks?.renderKebabMenu?.({
3063
+ pinned: Boolean(activeThread?.pinned),
3064
+ onPinToggle: () => {
3065
+ if (activeId) adapter.threads.pin(activeId, !activeThread?.pinned);
3066
+ },
3067
+ onDelete: () => setShowDelete(true)
3068
+ }) ?? null
3069
+ }
3070
+ ) }),
3071
+ idValue && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
3072
+ ChatInquiryBar_default,
3073
+ {
3074
+ id: idValue,
3075
+ label: idLabel,
3076
+ buttonLabel: idButtonLabel,
3077
+ onView: () => {
3078
+ const type = activeThread?.orderId ? "order" : "inquiry";
3079
+ uiCallbacks?.onNavigate?.({ type, id: idValue });
3080
+ }
3081
+ }
3082
+ ) }),
3083
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs("div", { className: "relative h-full min-h-0", children: [
3084
+ isLoading ? /* @__PURE__ */ jsx(ChatSpinner_default, { className: "h-full min-h-[200px]" }) : /* @__PURE__ */ jsx(ChatScroll_default, { className: "h-full pb-10", bottomAlignWhenShort: false, scrollKey, children: messages.map((m, idx) => {
3085
+ const mine = m.author === "you";
3086
+ const isLast = idx === messages.length - 1;
3087
+ return /* @__PURE__ */ jsx(
3088
+ ChatMessageItem_default,
3089
+ {
3090
+ id: m.id,
3091
+ mine,
3092
+ time: m.time ?? "",
3093
+ authorInitial: typeof m.author === "string" ? m.author : "U",
3094
+ avatarBg,
3095
+ text: m.text ?? m.content,
3096
+ businessCard: m.businessCard,
3097
+ addressCard: m.addressCard,
3098
+ images: m.images,
3099
+ files: m.files,
3100
+ audio: m.audio,
3101
+ replyTo: m.replyTo,
3102
+ showStatus: isLast,
3103
+ status: activeThread?.status?.kind === "seen" ? "Seen" : "Delivered",
3104
+ onReply: () => setReplyTo(toRef2(m)),
3105
+ initialSrc: m.avatarSrc
3106
+ },
3107
+ m.id
3108
+ );
3109
+ }) }),
3110
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 flex items-center px-4 pb-2 pt-1 bg-white", children: /* @__PURE__ */ jsx(TypingIndicator_default, { className: "pointer-events-auto" }) })
3111
+ ] }) }),
3112
+ /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
3113
+ ChatFooter_default,
3114
+ {
3115
+ replyTo,
3116
+ clearReply: () => setReplyTo(void 0),
3117
+ onAfterSend: () => setRev((v) => v + 1),
3118
+ onSend: (payload) => {
3119
+ if (activeId) adapter.messages.send(activeId, payload);
3120
+ }
3121
+ },
3122
+ activeId
3123
+ ) })
3124
+ ] }),
3125
+ /* @__PURE__ */ jsxs("div", { className: "h-full min-h-0", children: [
3126
+ /* @__PURE__ */ jsx(ChatListHeader_default, { onClose: close, onSearchChange: (val) => setSearchQuery(val) }),
3127
+ /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-auto custom-scroll", children: threads.filter((t) => {
3128
+ if (!searchQuery.trim()) return true;
3129
+ const q = searchQuery.toLowerCase();
3130
+ return t.title.toLowerCase().includes(q) || t.last?.toLowerCase().includes(q) || t.orderId?.toLowerCase().includes(q) || t.inquiryId?.toLowerCase().includes(q);
3131
+ }).map((t) => {
3132
+ const status = t.status ?? (t.unread && t.unread > 0 ? { kind: "new", count: t.unread } : { kind: "seen" });
3133
+ return /* @__PURE__ */ jsx(
3134
+ ChatThreadItem_default,
3135
+ {
3136
+ onClick: () => {
3137
+ setReplyTo(void 0);
3138
+ selectThread(t.id);
3139
+ },
3140
+ active: t.id === activeId,
3141
+ pinned: Boolean(t.pinned),
3142
+ online: t.online,
3143
+ verified: Boolean(t.badge),
3144
+ title: t.title,
3145
+ preview: t.last ?? "",
3146
+ time: t.time ?? "",
3147
+ status,
3148
+ avatarText: t.avatarText ?? "",
3149
+ avatarSrc: t.avatarSrc
3150
+ },
3151
+ t.id
3152
+ );
3153
+ }) })
3154
+ ] })
3155
+ ] }),
3156
+ /* @__PURE__ */ jsx(ChatConfirmModal, { open: showDelete, onClose: () => setShowDelete(false), onConfirm: handleConfirmDelete }),
3157
+ /* @__PURE__ */ jsx(ChatImagePreviewModal_default, { isOpen: isGalleryOpen, onClose: closeGallery })
3158
+ ]
3159
+ }
3160
+ )
3161
+ }
3162
+ )
3163
+ ] });
3164
+ };
3165
+ var InboxPopup_default = InboxPopup;
3166
+ function coalesceThreadId(reference, threads) {
3167
+ const referenceId = reference?.id;
3168
+ if (reference?.kind === "quotation") {
3169
+ return threads.find((t) => t.id === "t4")?.id ?? (threads[0]?.id ?? "");
3170
+ }
3171
+ return referenceId && (threads.find((t) => t.id === referenceId)?.id || threads.find((t) => t.inquiryId === referenceId)?.id) || (threads.length ? threads[0].id : "");
3172
+ }
3173
+ function toRef(m) {
3174
+ return {
3175
+ id: m.id,
3176
+ author: m.author,
3177
+ time: m.time,
3178
+ text: m.text ?? m.content,
3179
+ images: m.images,
3180
+ files: m.files,
3181
+ audio: m.audio
3182
+ };
3183
+ }
3184
+ var SinglePopup = ({ adapter, uiCallbacks }) => {
3185
+ const { close, reference } = useChatUI();
3186
+ const threads = adapter.threads.list(reference);
3187
+ const initialThreadId = React11.useMemo(
3188
+ () => coalesceThreadId(reference, threads),
3189
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3190
+ [reference]
3191
+ );
3192
+ const [activeId] = React11.useState(initialThreadId);
3193
+ const activeThread = threads.find((t) => t.id === activeId);
3194
+ const isVerified = activeThread?.badge === true;
3195
+ const meta = reference?.meta ?? {};
3196
+ const initial = meta.initial ?? activeThread?.avatarText ?? "A";
3197
+ const title = meta.title ?? activeThread?.title ?? "Unknown";
3198
+ const online = meta.online ?? activeThread?.online ?? true;
3199
+ const subtitle = meta.subtitle ?? "Customer";
3200
+ const [messages, setMessages] = React11.useState(
3201
+ () => activeId ? adapter.messages.list(activeId) : []
3202
+ );
3203
+ const [scrollKey, setScrollKey] = React11.useState(0);
3204
+ const [replyTo, setReplyTo] = React11.useState(void 0);
3205
+ const [isLoading, setIsLoading] = React11.useState(true);
3206
+ React11.useEffect(() => {
3207
+ const t = setTimeout(() => setIsLoading(false), 300);
3208
+ return () => clearTimeout(t);
3209
+ }, []);
3210
+ React11.useEffect(() => {
3211
+ if (!activeId || !adapter.messages.subscribe) return;
3212
+ const unsub = adapter.messages.subscribe(activeId, () => {
3213
+ setMessages(adapter.messages.list(activeId));
3214
+ setScrollKey(Date.now());
3215
+ });
3216
+ return unsub;
3217
+ }, [activeId, adapter]);
3218
+ const handleAfterSend = React11.useCallback(() => {
3219
+ setMessages(adapter.messages.list(activeId));
3220
+ setScrollKey(Date.now());
3221
+ setReplyTo(void 0);
3222
+ }, [activeId, adapter]);
3223
+ const statusText = activeThread?.status?.kind === "seen" ? "Seen" : "Delivered";
3224
+ return /* @__PURE__ */ jsxs("div", { className: "fixed bottom-4 right-[40px] z-50", children: [
3225
+ /* @__PURE__ */ jsx(
3226
+ motion.button,
3227
+ {
3228
+ "aria-label": "Close chat",
3229
+ onClick: close,
3230
+ className: "fixed inset-0 bg-black/20 cursor-auto!",
3231
+ initial: { opacity: 0 },
3232
+ animate: { opacity: 1 },
3233
+ exit: { opacity: 0 },
3234
+ transition: { duration: 0.3 }
3235
+ }
3236
+ ),
3237
+ /* @__PURE__ */ jsx(
3238
+ motion.div,
3239
+ {
3240
+ role: "dialog",
3241
+ "aria-modal": "true",
3242
+ className: "relative h-[650px] w-[450px] rounded-[20px] p-[2px]",
3243
+ style: {
3244
+ boxShadow: "0px 2px 12px 0px #3B33331A",
3245
+ background: "linear-gradient(236.83deg, rgba(51, 201, 212, 0.3) 0.4%, rgba(39, 83, 251, 0.3) 30.28%, rgba(39, 83, 251, 0.3) 50.2%, rgba(39, 83, 251, 0.3) 65.14%, rgba(235, 67, 255, 0.3) 100%)"
3246
+ },
3247
+ initial: { x: "100%", opacity: 0 },
3248
+ animate: { x: 0, opacity: 1 },
3249
+ exit: { x: "100%", opacity: 0 },
3250
+ transition: { type: "tween", duration: 0.4, ease: "easeOut" },
3251
+ children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col overflow-hidden rounded-[18px] bg-white", children: [
3252
+ /* @__PURE__ */ jsx("div", { className: "h-[64px] shrink-0", children: /* @__PURE__ */ jsx(
3253
+ ChatHeader,
3254
+ {
3255
+ left: /* @__PURE__ */ jsx(
3256
+ ChatIdentity_default,
3257
+ {
3258
+ variant: "initial",
3259
+ initial,
3260
+ bg: "#FFE5DA",
3261
+ online,
3262
+ title,
3263
+ subtitle,
3264
+ verified: isVerified,
3265
+ subtitleVariant: "muted"
3266
+ }
3267
+ ),
3268
+ right: /* @__PURE__ */ jsx(
3269
+ "button",
3270
+ {
3271
+ type: "button",
3272
+ onClick: close,
3273
+ className: "flex h-[34px] w-[34px] items-center justify-center rounded-full bg-white text-black shadow-[0px_2px_4px_0px_#A5A3AE4D] hover:bg-black/5 hover:text-[#ff5301] cursor-pointer",
3274
+ children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-6 w-6" })
3275
+ }
3276
+ )
3277
+ }
3278
+ ) }),
3279
+ /* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-h-0", children: [
3280
+ isLoading ? /* @__PURE__ */ jsx(ChatSpinner_default, { className: "h-full" }) : /* @__PURE__ */ jsx(ChatScroll_default, { className: "h-full", bottomAlignWhenShort: false, scrollKey, children: messages.map((m, idx) => {
3281
+ const mine = m.author === "you";
3282
+ const isLast = idx === messages.length - 1;
3283
+ return /* @__PURE__ */ jsx(
3284
+ ChatMessageItem_default,
3285
+ {
3286
+ id: m.id,
3287
+ mine,
3288
+ time: m.time ?? "",
3289
+ authorInitial: typeof m.author === "string" ? m.author : "U",
3290
+ text: m.text ?? m.content,
3291
+ businessCard: m.businessCard,
3292
+ addressCard: m.addressCard,
3293
+ images: m.images,
3294
+ files: m.files,
3295
+ audio: m.audio,
3296
+ replyTo: m.replyTo,
3297
+ initialSrc: m.avatarSrc,
3298
+ showStatus: isLast,
3299
+ status: statusText,
3300
+ onReply: () => setReplyTo(toRef(m))
3301
+ },
3302
+ m.id
3303
+ );
3304
+ }) }),
3305
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-0 left-0 w-full bg-white px-4 pb-2", children: /* @__PURE__ */ jsx("div", { className: "pointer-events-auto flex items-center justify-start", children: /* @__PURE__ */ jsx(TypingIndicator_default, {}) }) })
3306
+ ] }),
3307
+ /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
3308
+ ChatFooter_default,
3309
+ {
3310
+ variant: "single",
3311
+ replyTo,
3312
+ clearReply: () => setReplyTo(void 0),
3313
+ onAfterSend: handleAfterSend,
3314
+ onSend: (payload) => {
3315
+ if (activeId) adapter.messages.send(activeId, payload);
3316
+ }
3317
+ }
3318
+ ) })
3319
+ ] })
3320
+ }
3321
+ )
3322
+ ] });
3323
+ };
3324
+ var SinglePopup_default = SinglePopup;
3325
+ function ChatRoot({ adapter, uiCallbacks }) {
3326
+ const { isOpen, variant } = useChatUI();
3327
+ useDisableBodyScroll(isOpen);
3328
+ if (typeof window === "undefined") {
3329
+ return null;
3330
+ }
3331
+ return createPortal(
3332
+ // GalleryProvider is scoped to the chat only.
3333
+ // It is completely separate from the host app's own gallery context.
3334
+ /* @__PURE__ */ jsx(GalleryProvider, { children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isOpen && (variant === "inbox" ? /* @__PURE__ */ jsx(
3335
+ InboxPopup_default,
3336
+ {
3337
+ adapter,
3338
+ uiCallbacks
3339
+ },
3340
+ "inbox"
3341
+ ) : /* @__PURE__ */ jsx(
3342
+ SinglePopup_default,
3343
+ {
3344
+ adapter,
3345
+ uiCallbacks
3346
+ },
3347
+ "single"
3348
+ )) }) }),
3349
+ document.body
3350
+ );
3351
+ }
3352
+ function ChatUIProvider({ children }) {
3353
+ const [isOpen, setOpen] = useState(false);
3354
+ const [variant, setVariant] = useState("inbox");
3355
+ const [reference, setReference] = useState();
3356
+ const [selectedThreadId, setSelected] = useState(null);
3357
+ const api = useMemo(
3358
+ () => ({
3359
+ isOpen,
3360
+ variant,
3361
+ reference,
3362
+ selectedThreadId,
3363
+ openInbox: (opts) => {
3364
+ setReference(opts?.reference);
3365
+ setSelected(opts?.threadId ?? null);
3366
+ setVariant("inbox");
3367
+ setOpen(true);
3368
+ },
3369
+ openSingle: (opts) => {
3370
+ setReference(opts?.reference);
3371
+ setVariant("single");
3372
+ setSelected(null);
3373
+ setOpen(true);
3374
+ },
3375
+ close: () => setOpen(false),
3376
+ selectThread: (id) => setSelected(id)
3377
+ }),
3378
+ [isOpen, variant, reference, selectedThreadId]
3379
+ );
3380
+ return /* @__PURE__ */ jsx(ChatUIContext.Provider, { value: api, children });
3381
+ }
3382
+
3383
+ export { ChatFooter_default as ChatFooter, ChatHeader, ChatIdentity_default as ChatIdentity, ChatInquiryBar_default as ChatInquiryBar, ChatListHeader_default as ChatListHeader, ChatMessageItem_default as ChatMessageItem, ChatRoot, ChatScroll_default as ChatScroll, ChatSpinner_default as ChatSpinner, ChatThreadItem_default as ChatThreadItem, ChatUIContext, ChatUIProvider, Portal, ReplyCard_default as ReplyCard, TypingIndicator_default as TypingIndicator, cn, useChatUI };
3384
+ //# sourceMappingURL=index.js.map
3385
+ //# sourceMappingURL=index.js.map