@arbidocs/react 0.3.184 → 0.3.185

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.
@@ -2,11 +2,11 @@ import { clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import * as React2 from 'react';
5
- import React2__default, { createContext, useMemo, useContext, useState, useRef, useEffect, useCallback } from 'react';
5
+ import React2__default, { createContext, forwardRef, memo, useMemo, useContext, useState, useRef, useEffect, useCallback, useId } from 'react';
6
6
  import Markdown from 'react-markdown';
7
7
  import remarkGfm from 'remark-gfm';
8
8
  import rehypeRaw from 'rehype-raw';
9
- import { Circle, Check, X, ChevronRight, ChevronDown, ChevronUp, Search, Loader2, Square, Mic, Copy, Minus, Plus } from 'lucide-react';
9
+ import { Circle, Check, X, ChevronRight, ChevronDown, ChevronUp, Search, MessageCircleMore, Loader2, Square, Mic, MoreVertical, Copy, MessageSquareLock, Info, FileQuestion, BookOpen, Upload, LogOut, LayoutGrid, Bell, MessageSquare, CircleUserRound, Wrench, CreditCard, ClipboardList, UserPlus, UserStar, Settings2, Users, User, NotebookPen, NotebookText, StickyNote, FolderPlus, Hash, EyeOff, Eye, CaptionsOff, FolderOpen, MessageSquareMore, MessageSquarePlus, MessageSquareText, MessageSquareOff, MessagesSquare, Columns3Cog, SquarePlus, SquareM, ChevronsDown, Bot, Calendar, Folder, List, SquareCheckBig, Minus, Plus } from 'lucide-react';
10
10
  import { createPortal } from 'react-dom';
11
11
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
12
12
  import { cva } from 'class-variance-authority';
@@ -1389,6 +1389,13 @@ var ToggleGroupItem = React2.forwardRef(({ className, children, variant, size, .
1389
1389
  );
1390
1390
  });
1391
1391
  ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
1392
+
1393
+ // src/lib/toast-interaction.ts
1394
+ function isToastInteraction(event) {
1395
+ const original = event.detail?.originalEvent;
1396
+ const target = original?.target ?? event.target;
1397
+ return target instanceof Element && target.closest("[data-sonner-toaster]") !== null;
1398
+ }
1392
1399
  var Dialog = DialogPrimitive.Root;
1393
1400
  var DialogTrigger = DialogPrimitive.Trigger;
1394
1401
  var DialogPortal = DialogPrimitive.Portal;
@@ -1405,12 +1412,16 @@ var DialogOverlay = React2.forwardRef(({ className, ...props }, ref) => /* @__PU
1405
1412
  }
1406
1413
  ));
1407
1414
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
1408
- var DialogContent = React2.forwardRef(({ className, children, hideCloseButton, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
1415
+ var DialogContent = React2.forwardRef(({ className, children, hideCloseButton, onInteractOutside, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
1409
1416
  /* @__PURE__ */ jsx(DialogOverlay, {}),
1410
1417
  /* @__PURE__ */ jsxs(
1411
1418
  DialogPrimitive.Content,
1412
1419
  {
1413
1420
  ref,
1421
+ onInteractOutside: (event) => {
1422
+ if (isToastInteraction(event)) event.preventDefault();
1423
+ onInteractOutside?.(event);
1424
+ },
1414
1425
  className: cn(
1415
1426
  "fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg max-h-[90vh] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-md",
1416
1427
  className
@@ -1813,7 +1824,1419 @@ function AiMarkdown({
1813
1824
  }
1814
1825
  );
1815
1826
  }
1827
+ var EntityPill = forwardRef(function EntityPill2({
1828
+ icon,
1829
+ label,
1830
+ secondaryText,
1831
+ size = "sm",
1832
+ shape = "rounded",
1833
+ className,
1834
+ labelMaxWidth = "max-w-[320px]",
1835
+ labelClassName,
1836
+ fullWidth = false,
1837
+ highlight = false,
1838
+ onClick,
1839
+ onIconClick,
1840
+ onMoreClick,
1841
+ moreContent,
1842
+ href,
1843
+ disabled = false,
1844
+ tooltipContent,
1845
+ tooltipSide = "bottom",
1846
+ "data-testid": testId
1847
+ }, ref) {
1848
+ const shapeClass = shape === "pill" ? "rounded-full" : "rounded-md";
1849
+ const sizeClasses2 = size === "base" ? "gap-1.5 px-1.5 py-0.5" : "gap-1 px-1";
1850
+ const textSizeClass = size === "base" ? "text-base" : "text-sm";
1851
+ const baseClasses = cn(
1852
+ "group/pill items-center",
1853
+ fullWidth ? "flex w-full" : "inline-flex",
1854
+ sizeClasses2,
1855
+ shapeClass,
1856
+ "bg-muted",
1857
+ "border border-border",
1858
+ "transition-all",
1859
+ className
1860
+ );
1861
+ const interactiveClasses = "cursor-pointer hover:bg-muted/80";
1862
+ const disabledClasses = "cursor-default opacity-60";
1863
+ const highlightClasses = "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground";
1864
+ const mainContent = /* @__PURE__ */ jsxs(Fragment, { children: [
1865
+ onIconClick ? /* @__PURE__ */ jsx(
1866
+ "span",
1867
+ {
1868
+ role: "button",
1869
+ tabIndex: 0,
1870
+ className: "flex-shrink-0 cursor-pointer hover:opacity-70 transition-opacity",
1871
+ onClick: (e) => {
1872
+ e.stopPropagation();
1873
+ onIconClick(e);
1874
+ },
1875
+ children: icon
1876
+ }
1877
+ ) : icon,
1878
+ /* @__PURE__ */ jsx(
1879
+ "span",
1880
+ {
1881
+ className: cn(
1882
+ textSizeClass,
1883
+ "font-medium truncate leading-tight min-w-0",
1884
+ labelMaxWidth,
1885
+ labelClassName
1886
+ ),
1887
+ children: label
1888
+ }
1889
+ ),
1890
+ secondaryText && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground flex-shrink-0 leading-none", children: secondaryText })
1891
+ ] });
1892
+ const tooltipWrap = (content, tip, side = tooltipSide, triggerClassName, triggerProps) => /* @__PURE__ */ jsxs(Tooltip, { children: [
1893
+ /* @__PURE__ */ jsx(
1894
+ TooltipTrigger,
1895
+ {
1896
+ onFocusCapture: (e) => e.stopPropagation(),
1897
+ className: triggerClassName,
1898
+ ...triggerProps,
1899
+ children: content
1900
+ }
1901
+ ),
1902
+ /* @__PURE__ */ jsx(TooltipContent, { side, className: "p-2", children: tip })
1903
+ ] });
1904
+ const mainAreaClass = cn("inline-flex items-center gap-1", fullWidth && "min-w-0 flex-1");
1905
+ if (onMoreClick || moreContent) {
1906
+ let mainArea;
1907
+ if (tooltipContent) {
1908
+ mainArea = tooltipWrap(
1909
+ mainContent,
1910
+ tooltipContent,
1911
+ tooltipSide,
1912
+ cn(mainAreaClass, disabled && "opacity-60"),
1913
+ {
1914
+ type: "button",
1915
+ onClick: href ? onClick : disabled ? void 0 : onClick,
1916
+ disabled: disabled || void 0
1917
+ }
1918
+ );
1919
+ } else if (href) {
1920
+ mainArea = /* @__PURE__ */ jsx(
1921
+ "a",
1922
+ {
1923
+ href,
1924
+ target: "_blank",
1925
+ rel: "noopener noreferrer",
1926
+ className: mainAreaClass,
1927
+ onClick,
1928
+ children: mainContent
1929
+ }
1930
+ );
1931
+ } else if (onClick) {
1932
+ mainArea = /* @__PURE__ */ jsx(
1933
+ "button",
1934
+ {
1935
+ type: "button",
1936
+ onClick: disabled ? void 0 : onClick,
1937
+ disabled,
1938
+ className: cn("inline-flex items-center gap-1", disabled && "opacity-60"),
1939
+ children: mainContent
1940
+ }
1941
+ );
1942
+ } else {
1943
+ mainArea = /* @__PURE__ */ jsx("span", { className: mainAreaClass, children: mainContent });
1944
+ }
1945
+ const moreArea = moreContent ? /* @__PURE__ */ jsx("span", { className: "flex-shrink-0 leading-none", children: moreContent }) : tooltipWrap(
1946
+ /* @__PURE__ */ jsx(MoreVertical, { className: "w-3.5 h-3.5" }),
1947
+ "Click for more",
1948
+ tooltipSide,
1949
+ "flex-shrink-0 leading-none text-muted-foreground hover:text-foreground",
1950
+ {
1951
+ type: "button",
1952
+ onClick: (e) => {
1953
+ e.stopPropagation();
1954
+ onMoreClick?.(e);
1955
+ }
1956
+ }
1957
+ );
1958
+ return /* @__PURE__ */ jsxs(
1959
+ "span",
1960
+ {
1961
+ ref,
1962
+ className: cn(
1963
+ baseClasses,
1964
+ (onClick || href) && !disabled && interactiveClasses,
1965
+ highlight && highlightClasses
1966
+ ),
1967
+ "data-testid": testId,
1968
+ children: [
1969
+ mainArea,
1970
+ moreArea
1971
+ ]
1972
+ }
1973
+ );
1974
+ }
1975
+ if (tooltipContent) {
1976
+ if (href) {
1977
+ return tooltipWrap(
1978
+ /* @__PURE__ */ jsx(
1979
+ "a",
1980
+ {
1981
+ href,
1982
+ target: "_blank",
1983
+ rel: "noopener noreferrer",
1984
+ className: mainAreaClass,
1985
+ onClick,
1986
+ children: mainContent
1987
+ }
1988
+ ),
1989
+ tooltipContent,
1990
+ tooltipSide,
1991
+ cn(baseClasses, interactiveClasses),
1992
+ { "data-testid": testId }
1993
+ );
1994
+ }
1995
+ return tooltipWrap(
1996
+ mainContent,
1997
+ tooltipContent,
1998
+ tooltipSide,
1999
+ cn(
2000
+ baseClasses,
2001
+ onClick && !disabled ? interactiveClasses : "",
2002
+ disabled ? disabledClasses : "",
2003
+ highlight && highlightClasses
2004
+ ),
2005
+ {
2006
+ type: "button",
2007
+ ref,
2008
+ onClick: onClick && !disabled ? onClick : void 0,
2009
+ disabled: disabled || void 0,
2010
+ "data-testid": testId
2011
+ }
2012
+ );
2013
+ }
2014
+ if (href) {
2015
+ return /* @__PURE__ */ jsx(
2016
+ "a",
2017
+ {
2018
+ ref,
2019
+ href,
2020
+ target: "_blank",
2021
+ rel: "noopener noreferrer",
2022
+ className: cn(baseClasses, interactiveClasses),
2023
+ "data-testid": testId,
2024
+ onClick,
2025
+ children: mainContent
2026
+ }
2027
+ );
2028
+ }
2029
+ if (onClick) {
2030
+ return /* @__PURE__ */ jsx(
2031
+ "button",
2032
+ {
2033
+ ref,
2034
+ type: "button",
2035
+ onClick: disabled ? void 0 : onClick,
2036
+ disabled,
2037
+ className: cn(
2038
+ baseClasses,
2039
+ disabled ? disabledClasses : interactiveClasses,
2040
+ highlight && highlightClasses
2041
+ ),
2042
+ "data-testid": testId,
2043
+ children: mainContent
2044
+ }
2045
+ );
2046
+ }
2047
+ return /* @__PURE__ */ jsx(
2048
+ "span",
2049
+ {
2050
+ ref,
2051
+ className: cn(baseClasses, highlight && highlightClasses),
2052
+ "data-testid": testId,
2053
+ children: mainContent
2054
+ }
2055
+ );
2056
+ });
2057
+ var TAG_TYPE_LABELS = {
2058
+ checkbox: "Checkbox",
2059
+ select: "Select",
2060
+ number: "Number",
2061
+ text: "Text",
2062
+ folder: "Folder",
2063
+ search: "Saved Search",
2064
+ date: "Date",
2065
+ assistant: "AI Assistant"
2066
+ };
2067
+ var TAG_TYPE_ICONS = {
2068
+ checkbox: SquareCheckBig,
2069
+ select: List,
2070
+ number: Hash,
2071
+ text: NotebookPen,
2072
+ folder: Folder,
2073
+ search: Search,
2074
+ date: Calendar,
2075
+ assistant: Bot
2076
+ };
2077
+ function getTagTypeIcon(type) {
2078
+ return TAG_TYPE_ICONS[type ?? "text"] || NotebookPen;
2079
+ }
2080
+ function getTagTypeLabel(type) {
2081
+ const t = type ?? "text";
2082
+ return TAG_TYPE_LABELS[t] || t;
2083
+ }
2084
+ var BASE_COLORS = {
2085
+ "0": "#10b981",
2086
+ "1": "#3b82f6",
2087
+ "2": "#8b5cf6",
2088
+ "3": "#f43f5e",
2089
+ "4": "#f59e0b",
2090
+ "5": "#84cc16",
2091
+ "6": "#a855f7",
2092
+ "7": "#06b6d4",
2093
+ "8": "#f97316",
2094
+ "9": "#14b8a6",
2095
+ a: "#ef4444",
2096
+ b: "#6366f1",
2097
+ c: "#ec4899",
2098
+ d: "#22c55e",
2099
+ e: "#eab308",
2100
+ f: "#0ea5e9"
2101
+ };
2102
+ function getEntityColor(entityId) {
2103
+ return BASE_COLORS[entityId[4]] || BASE_COLORS["0"];
2104
+ }
2105
+ function TagEntity({
2106
+ tag,
2107
+ size = "md",
2108
+ className = "",
2109
+ onClick,
2110
+ showTooltip = true,
2111
+ tooltipContent
2112
+ }) {
2113
+ const tagType = tag.tag_type?.type ?? "text";
2114
+ const iconSize = size === "sm" ? 12 : size === "md" ? 14 : 16;
2115
+ const Icon2 = getTagTypeIcon(tagType);
2116
+ const sizeClasses2 = {
2117
+ sm: "p-0.5",
2118
+ md: "p-1",
2119
+ lg: "p-1.5"
2120
+ };
2121
+ const tagColor = tag.color ?? getEntityColor(tag.external_id);
2122
+ const iconElement = /* @__PURE__ */ jsx(
2123
+ "span",
2124
+ {
2125
+ className: `inline-flex items-center justify-center rounded-md text-white flex-shrink-0 ${sizeClasses2[size]}`,
2126
+ style: { backgroundColor: tagColor },
2127
+ children: /* @__PURE__ */ jsx(Icon2, { size: iconSize, className: "flex-shrink-0" })
2128
+ }
2129
+ );
2130
+ const pillSize = size === "lg" ? "base" : "sm";
2131
+ const defaultTooltip = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
2132
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2133
+ /* @__PURE__ */ jsx(
2134
+ "span",
2135
+ {
2136
+ className: "inline-flex items-center justify-center rounded-md text-white p-1",
2137
+ style: { backgroundColor: tagColor },
2138
+ children: /* @__PURE__ */ jsx(Icon2, { size: 16 })
2139
+ }
2140
+ ),
2141
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: tag.name })
2142
+ ] }),
2143
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 text-sm", children: [
2144
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2145
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
2146
+ /* @__PURE__ */ jsx("span", { children: getTagTypeLabel(tagType) })
2147
+ ] }),
2148
+ tag.doctag_count != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2149
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Documents:" }),
2150
+ /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "h-5 min-w-[20px] justify-center", children: tag.doctag_count ?? 0 })
2151
+ ] }),
2152
+ tag.shared != null && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: tag.shared ? "Shared" : "Private" }) })
2153
+ ] })
2154
+ ] });
2155
+ const resolvedTooltip = showTooltip ? tooltipContent ?? defaultTooltip : void 0;
2156
+ return /* @__PURE__ */ jsx(
2157
+ EntityPill,
2158
+ {
2159
+ icon: iconElement,
2160
+ label: tag.name,
2161
+ size: pillSize,
2162
+ shape: "rounded",
2163
+ labelMaxWidth: "max-w-[180px]",
2164
+ tooltipContent: resolvedTooltip,
2165
+ onClick,
2166
+ className,
2167
+ "data-testid": `tag-entity-${tag.external_id}`
2168
+ }
2169
+ );
2170
+ }
2171
+
2172
+ // src/icons/colors.ts
2173
+ var NEUTRAL_GRAY = "#64748b";
2174
+ var FILE_TYPE_COLORS = {
2175
+ pdf: "#ef4444",
2176
+ // red
2177
+ doc: "#3b82f6",
2178
+ // blue (Word docs)
2179
+ docx: "#3b82f6",
2180
+ // blue
2181
+ html: "#0284c7",
2182
+ // sky-600 (web files)
2183
+ img: "#8b5cf6",
2184
+ // violet-500 (images)
2185
+ vid: "#10b981",
2186
+ // emerald-500 (video)
2187
+ aud: "#f59e0b",
2188
+ // amber-500 (audio)
2189
+ xls: "#16a34a",
2190
+ // green-600 (Excel)
2191
+ eml: "#0d9488",
2192
+ // teal-600 (email)
2193
+ txt: NEUTRAL_GRAY,
2194
+ // gray (plain text)
2195
+ generic: NEUTRAL_GRAY,
2196
+ // gray (unknown)
2197
+ white: "#ffffff"
2198
+ // for strokes/text on colored backgrounds
2199
+ };
2200
+ var PdfIcon = ({ size = 16, className = "" }) => {
2201
+ return /* @__PURE__ */ jsxs(
2202
+ "svg",
2203
+ {
2204
+ width: size,
2205
+ height: size,
2206
+ viewBox: "0 0 24 24",
2207
+ fill: "none",
2208
+ xmlns: "http://www.w3.org/2000/svg",
2209
+ className,
2210
+ children: [
2211
+ /* @__PURE__ */ jsx(
2212
+ "path",
2213
+ {
2214
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
2215
+ fill: FILE_TYPE_COLORS.pdf,
2216
+ stroke: FILE_TYPE_COLORS.pdf,
2217
+ strokeWidth: "1",
2218
+ strokeLinecap: "round",
2219
+ strokeLinejoin: "round"
2220
+ }
2221
+ ),
2222
+ /* @__PURE__ */ jsx(
2223
+ "path",
2224
+ {
2225
+ d: "M14 2v6h6",
2226
+ fill: "none",
2227
+ stroke: FILE_TYPE_COLORS.white,
2228
+ strokeWidth: "1",
2229
+ strokeLinecap: "round",
2230
+ strokeLinejoin: "round"
2231
+ }
2232
+ ),
2233
+ /* @__PURE__ */ jsx(
2234
+ "text",
2235
+ {
2236
+ x: "12",
2237
+ y: "16",
2238
+ fontSize: "6",
2239
+ fill: "white",
2240
+ textAnchor: "middle",
2241
+ fontWeight: "bold",
2242
+ fontFamily: "Arial, sans-serif",
2243
+ children: "PDF"
2244
+ }
2245
+ )
2246
+ ]
2247
+ }
2248
+ );
2249
+ };
2250
+ var AudIcon = ({ size = 16, className = "" }) => {
2251
+ return /* @__PURE__ */ jsxs(
2252
+ "svg",
2253
+ {
2254
+ width: size,
2255
+ height: size,
2256
+ viewBox: "0 0 24 24",
2257
+ fill: "none",
2258
+ xmlns: "http://www.w3.org/2000/svg",
2259
+ className,
2260
+ children: [
2261
+ /* @__PURE__ */ jsx(
2262
+ "path",
2263
+ {
2264
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
2265
+ fill: FILE_TYPE_COLORS.aud,
2266
+ stroke: FILE_TYPE_COLORS.aud,
2267
+ strokeWidth: "1",
2268
+ strokeLinecap: "round",
2269
+ strokeLinejoin: "round"
2270
+ }
2271
+ ),
2272
+ /* @__PURE__ */ jsx(
2273
+ "path",
2274
+ {
2275
+ d: "M14 2v6h6",
2276
+ fill: "none",
2277
+ stroke: FILE_TYPE_COLORS.white,
2278
+ strokeWidth: "1",
2279
+ strokeLinecap: "round",
2280
+ strokeLinejoin: "round"
2281
+ }
2282
+ ),
2283
+ /* @__PURE__ */ jsx(
2284
+ "text",
2285
+ {
2286
+ x: "12",
2287
+ y: "16",
2288
+ fontSize: "6",
2289
+ fill: "white",
2290
+ textAnchor: "middle",
2291
+ fontWeight: "bold",
2292
+ fontFamily: "Arial, sans-serif",
2293
+ children: "AUD"
2294
+ }
2295
+ )
2296
+ ]
2297
+ }
2298
+ );
2299
+ };
2300
+ var ImgIcon = ({ size = 16, className = "" }) => {
2301
+ return /* @__PURE__ */ jsxs(
2302
+ "svg",
2303
+ {
2304
+ width: size,
2305
+ height: size,
2306
+ viewBox: "0 0 24 24",
2307
+ fill: "none",
2308
+ xmlns: "http://www.w3.org/2000/svg",
2309
+ className,
2310
+ children: [
2311
+ /* @__PURE__ */ jsx(
2312
+ "path",
2313
+ {
2314
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
2315
+ fill: FILE_TYPE_COLORS.img,
2316
+ stroke: FILE_TYPE_COLORS.img,
2317
+ strokeWidth: "1",
2318
+ strokeLinecap: "round",
2319
+ strokeLinejoin: "round"
2320
+ }
2321
+ ),
2322
+ /* @__PURE__ */ jsx(
2323
+ "path",
2324
+ {
2325
+ d: "M14 2v6h6",
2326
+ fill: "none",
2327
+ stroke: FILE_TYPE_COLORS.white,
2328
+ strokeWidth: "1",
2329
+ strokeLinecap: "round",
2330
+ strokeLinejoin: "round"
2331
+ }
2332
+ ),
2333
+ /* @__PURE__ */ jsx(
2334
+ "text",
2335
+ {
2336
+ x: "12",
2337
+ y: "16",
2338
+ fontSize: "6",
2339
+ fill: "white",
2340
+ textAnchor: "middle",
2341
+ fontWeight: "bold",
2342
+ fontFamily: "Arial, sans-serif",
2343
+ children: "IMG"
2344
+ }
2345
+ )
2346
+ ]
2347
+ }
2348
+ );
2349
+ };
2350
+ var VidIcon = ({ size = 16, className = "" }) => {
2351
+ return /* @__PURE__ */ jsxs(
2352
+ "svg",
2353
+ {
2354
+ width: size,
2355
+ height: size,
2356
+ viewBox: "0 0 24 24",
2357
+ fill: "none",
2358
+ xmlns: "http://www.w3.org/2000/svg",
2359
+ className,
2360
+ children: [
2361
+ /* @__PURE__ */ jsx(
2362
+ "path",
2363
+ {
2364
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
2365
+ fill: FILE_TYPE_COLORS.vid,
2366
+ stroke: FILE_TYPE_COLORS.vid,
2367
+ strokeWidth: "1",
2368
+ strokeLinecap: "round",
2369
+ strokeLinejoin: "round"
2370
+ }
2371
+ ),
2372
+ /* @__PURE__ */ jsx(
2373
+ "path",
2374
+ {
2375
+ d: "M14 2v6h6",
2376
+ fill: "none",
2377
+ stroke: FILE_TYPE_COLORS.white,
2378
+ strokeWidth: "1",
2379
+ strokeLinecap: "round",
2380
+ strokeLinejoin: "round"
2381
+ }
2382
+ ),
2383
+ /* @__PURE__ */ jsx(
2384
+ "text",
2385
+ {
2386
+ x: "12",
2387
+ y: "16",
2388
+ fontSize: "6",
2389
+ fill: "white",
2390
+ textAnchor: "middle",
2391
+ fontWeight: "bold",
2392
+ fontFamily: "Arial, sans-serif",
2393
+ children: "VID"
2394
+ }
2395
+ )
2396
+ ]
2397
+ }
2398
+ );
2399
+ };
2400
+ var EmlIcon = ({ size = 16, className = "" }) => {
2401
+ return /* @__PURE__ */ jsxs(
2402
+ "svg",
2403
+ {
2404
+ width: size,
2405
+ height: size,
2406
+ viewBox: "0 0 24 24",
2407
+ fill: "none",
2408
+ xmlns: "http://www.w3.org/2000/svg",
2409
+ className,
2410
+ children: [
2411
+ /* @__PURE__ */ jsx(
2412
+ "path",
2413
+ {
2414
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
2415
+ fill: FILE_TYPE_COLORS.eml,
2416
+ stroke: FILE_TYPE_COLORS.eml,
2417
+ strokeWidth: "1",
2418
+ strokeLinecap: "round",
2419
+ strokeLinejoin: "round"
2420
+ }
2421
+ ),
2422
+ /* @__PURE__ */ jsx(
2423
+ "path",
2424
+ {
2425
+ d: "M14 2v6h6",
2426
+ fill: "none",
2427
+ stroke: FILE_TYPE_COLORS.white,
2428
+ strokeWidth: "1",
2429
+ strokeLinecap: "round",
2430
+ strokeLinejoin: "round"
2431
+ }
2432
+ ),
2433
+ /* @__PURE__ */ jsx(
2434
+ "rect",
2435
+ {
2436
+ x: "7",
2437
+ y: "12",
2438
+ width: "10",
2439
+ height: "7",
2440
+ rx: "1",
2441
+ fill: "none",
2442
+ stroke: "white",
2443
+ strokeWidth: "1.2"
2444
+ }
2445
+ ),
2446
+ /* @__PURE__ */ jsx("path", { d: "M7 13l5 3 5-3", fill: "none", stroke: "white", strokeWidth: "1.2", strokeLinejoin: "round" })
2447
+ ]
2448
+ }
2449
+ );
2450
+ };
2451
+ var ArbiBotHeadIcon = ({ size = 24, className = "" }) => {
2452
+ const maskId = useId();
2453
+ return /* @__PURE__ */ jsxs(
2454
+ "svg",
2455
+ {
2456
+ xmlns: "http://www.w3.org/2000/svg",
2457
+ width: size,
2458
+ height: size,
2459
+ viewBox: "30 -5 190 190",
2460
+ preserveAspectRatio: "xMidYMid meet",
2461
+ className,
2462
+ children: [
2463
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("mask", { id: maskId, children: /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", children: [
2464
+ /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "2500", height: "2500", fill: "white" }),
2465
+ /* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "190", fill: "black" }),
2466
+ /* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "50", fill: "white" }),
2467
+ /* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "190", fill: "black" }),
2468
+ /* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "50", fill: "white" })
2469
+ ] }) }) }),
2470
+ /* @__PURE__ */ jsxs("g", { mask: `url(#${maskId})`, children: [
2471
+ /* @__PURE__ */ jsx(
2472
+ "g",
2473
+ {
2474
+ transform: "translate(0,250) scale(0.1,-0.1)",
2475
+ fill: "currentColor",
2476
+ stroke: "currentColor",
2477
+ strokeWidth: "100",
2478
+ children: /* @__PURE__ */ jsx("path", { d: "M1038 2434 c-217 -39 -406 -154 -522 -318 -121 -170 -176 -376 -103 -384 l27 -3 0 -106 c0 -88 -3 -108 -17 -118 -15 -11 -16 -18 -5 -66 44 -188 209 -369 420 -459 l65 -28 -74 -7 c-283 -26 -444 -152 -535 -418 -70 -204 -73 -507 -5 -507 4 0 12 75 19 168 18 263 68 419 167 530 78 87 224 162 263 134 9 -6 43 -26 76 -43 224 -117 802 -95 948 38 38 34 165 -22 253 -111 117 -119 168 -268 187 -549 6 -92 15 -167 19 -167 89 0 53 415 -54 627 -88 173 -238 270 -458 295 l-99 11 75 32 c201 88 367 274 406 454 10 47 9 56 -5 66 -13 10 -16 32 -16 118 l0 106 28 3 c91 10 -12 297 -165 459 -202 214 -544 307 -895 243z m472 -84 c170 -43 323 -140 416 -264 47 -61 117 -197 128 -248 l6 -28 -65 0 c-64 0 -65 1 -78 33 -43 102 -109 136 -262 137 l-110 0 -38 -40 c-25 -27 -46 -40 -65 -41 -134 -5 -394 1 -410 10 -11 6 -30 24 -42 41 l-21 30 -112 0 c-156 -1 -219 -33 -262 -136 -14 -34 -14 -34 -80 -34 -76 0 -74 -7 -30 103 96 243 311 406 595 452 118 20 319 13 430 -15z m-561 -505 c97 -50 126 -174 61 -263 -118 -163 -380 -23 -309 165 35 93 162 143 248 98z m799 -15 c129 -96 69 -304 -92 -318 -189 -16 -265 218 -106 326 48 33 149 29 198 -8z m272 -389 c0 -23 -45 -110 -86 -168 -245 -343 -856 -408 -1231 -130 -90 67 -213 236 -213 294 0 11 132 13 765 13 457 0 765 -4 765 -9z" })
2479
+ }
2480
+ ),
2481
+ /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
2482
+ /* @__PURE__ */ jsx("path", { d: "M785 1777 c-60 -60 -59 -134 1 -186 92 -82 236 9 204 128 -25 93 -138 125 -205 58z m161 -29 c7 -22 -19 -52 -40 -45 -21 7 -30 35 -17 51 19 23 48 20 57 -6z" }),
2483
+ /* @__PURE__ */ jsx("path", { d: "M1591 1803 c-128 -67 -85 -243 60 -243 83 0 141 99 105 178 -32 69 -103 97 -165 65z m127 -59 c4 -25 -19 -47 -41 -38 -22 8 -30 34 -16 51 17 20 53 12 57 -13z" }),
2484
+ /* @__PURE__ */ jsx("path", { d: "M843 1347 c-9 -15 9 -63 41 -108 148 -202 565 -209 730 -12 37 44 60 103 47 116 -13 13 -810 17 -818 4z" })
2485
+ ] })
2486
+ ] })
2487
+ ]
2488
+ }
2489
+ );
2490
+ };
2491
+ function getDocumentTitle(document2, defaultValue = "") {
2492
+ if (!document2) return defaultValue;
2493
+ return document2.doc_metadata?.title || document2.file_name || defaultValue;
2494
+ }
2495
+ var MAX_LABEL_CHARS = 30;
2496
+ function clampLabel(text) {
2497
+ return text.length > MAX_LABEL_CHARS ? `${text.slice(0, MAX_LABEL_CHARS).trimEnd()}\u2026` : text;
2498
+ }
2499
+ var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp"]);
2500
+ var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set(["mp4", "mpeg", "mpg", "webm", "mov", "avi", "mkv"]);
2501
+ var AUDIO_EXTENSIONS = /* @__PURE__ */ new Set(["mp3", "wav", "m4a", "aac", "ogg", "flac"]);
2502
+ var EMAIL_EXTENSIONS = /* @__PURE__ */ new Set(["eml", "msg"]);
2503
+ function getDocIcon(fileName, iconSize = 14) {
2504
+ const ext = fileName?.split(".").pop()?.toLowerCase();
2505
+ if (ext && VIDEO_EXTENSIONS.has(ext)) return /* @__PURE__ */ jsx(VidIcon, { size: iconSize, className: "flex-shrink-0" });
2506
+ if (ext && AUDIO_EXTENSIONS.has(ext)) return /* @__PURE__ */ jsx(AudIcon, { size: iconSize, className: "flex-shrink-0" });
2507
+ if (ext && IMAGE_EXTENSIONS.has(ext)) return /* @__PURE__ */ jsx(ImgIcon, { size: iconSize, className: "flex-shrink-0" });
2508
+ if (ext && EMAIL_EXTENSIONS.has(ext)) return /* @__PURE__ */ jsx(EmlIcon, { size: iconSize, className: "flex-shrink-0" });
2509
+ return /* @__PURE__ */ jsx(PdfIcon, { size: iconSize, className: "flex-shrink-0" });
2510
+ }
2511
+ function DocumentEntity({
2512
+ doc,
2513
+ icon,
2514
+ size = "sm",
2515
+ labelMaxWidth,
2516
+ labelClassName,
2517
+ onClick,
2518
+ onIconClick,
2519
+ viewing,
2520
+ iconBadge,
2521
+ actions,
2522
+ tooltipContent,
2523
+ className,
2524
+ fullWidth,
2525
+ noClamp
2526
+ }) {
2527
+ const title = getDocumentTitle(doc);
2528
+ const ext = doc.file_name?.split(".").pop()?.toLowerCase();
2529
+ const iconSize = size === "base" ? 16 : 14;
2530
+ const eyeSizeClass = size === "base" ? "h-4 w-4" : "h-3.5 w-3.5";
2531
+ const baseIcon = icon ?? getDocIcon(doc.file_name, iconSize);
2532
+ const displayIcon = viewing || iconBadge ? /* @__PURE__ */ jsxs("span", { className: "relative inline-flex flex-shrink-0 items-center justify-center", children: [
2533
+ viewing ? /* @__PURE__ */ jsx(Eye, { className: cn("text-primary-foreground", eyeSizeClass) }) : baseIcon,
2534
+ iconBadge
2535
+ ] }) : baseIcon;
2536
+ const defaultTooltip = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 text-xs max-w-[440px]", children: [
2537
+ doc.folder && // `flex-wrap` so a deep folder path wraps WITHIN the balloon instead of
2538
+ // spilling out of it (each path segment is atomic and wraps as a unit;
2539
+ // `min-w-0` + `break-all` lets a single over-long segment break too).
2540
+ /* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-center gap-0.5 text-muted-foreground", children: [
2541
+ /* @__PURE__ */ jsx(FolderOpen, { className: "h-3 w-3 text-yellow-600 shrink-0" }),
2542
+ doc.folder.split("/").map((part, i, arr) => /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-0.5", children: [
2543
+ i > 0 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/50 mx-0.5", children: "/" }),
2544
+ /* @__PURE__ */ jsx("span", { className: `break-all ${i < arr.length - 1 ? "text-muted-foreground/70" : ""}`, children: part })
2545
+ ] }, i))
2546
+ ] }),
2547
+ /* @__PURE__ */ jsxs("span", { className: "font-medium break-words", children: [
2548
+ title,
2549
+ ext ? `.${ext}` : ""
2550
+ ] })
2551
+ ] });
2552
+ return /* @__PURE__ */ jsx(
2553
+ EntityPill,
2554
+ {
2555
+ icon: displayIcon,
2556
+ size,
2557
+ label: fullWidth || noClamp ? title : clampLabel(title),
2558
+ labelMaxWidth: labelMaxWidth ?? "max-w-[140px]",
2559
+ labelClassName,
2560
+ fullWidth,
2561
+ onClick,
2562
+ onIconClick,
2563
+ moreContent: actions,
2564
+ className,
2565
+ highlight: viewing,
2566
+ tooltipContent: tooltipContent ?? defaultTooltip
2567
+ }
2568
+ );
2569
+ }
2570
+ var VARIANT_STYLES = {
2571
+ "mine-paid": {
2572
+ pill: "bg-primary/10 text-primary border-border/60",
2573
+ icon: "text-primary"
2574
+ },
2575
+ other: {
2576
+ pill: "bg-secondary/10 text-secondary border-border/60",
2577
+ icon: "text-secondary"
2578
+ },
2579
+ "mine-free": {
2580
+ pill: "bg-muted-foreground/10 text-muted-foreground border-border/60",
2581
+ icon: "text-muted-foreground"
2582
+ },
2583
+ common: {
2584
+ pill: "",
2585
+ icon: "text-muted-foreground"
2586
+ }
2587
+ };
2588
+ function resolveVariant(relation, paid, hasCollaborators) {
2589
+ if (relation === "common") return "common";
2590
+ if (relation === "other") return "other";
2591
+ if (relation === "mine") return paid ? "mine-paid" : "mine-free";
2592
+ if (paid) return hasCollaborators ? "other" : "mine-paid";
2593
+ return "mine-free";
2594
+ }
2595
+ function ProjectEntity({
2596
+ name,
2597
+ label,
2598
+ icon,
2599
+ subscription = "none",
2600
+ hasCollaborators = false,
2601
+ size = "sm",
2602
+ className,
2603
+ onClick,
2604
+ relation,
2605
+ isPaid,
2606
+ tooltipContent
2607
+ }) {
2608
+ const paid = isPaid ?? (subscription === "active" || subscription === "past_due" || subscription === "dev");
2609
+ const variant = resolveVariant(relation, paid, hasCollaborators);
2610
+ const { pill, icon: iconClass } = VARIANT_STYLES[variant];
2611
+ const iconSizeClass = size === "base" ? "h-4 w-4" : "h-3.5 w-3.5";
2612
+ const iconNode = icon ?? /* @__PURE__ */ jsx(CreditCard, { className: cn(iconSizeClass, iconClass) });
2613
+ return /* @__PURE__ */ jsx(
2614
+ EntityPill,
2615
+ {
2616
+ icon: iconNode,
2617
+ label: label ?? name,
2618
+ size,
2619
+ shape: "rounded",
2620
+ className: cn(pill, className),
2621
+ onClick,
2622
+ tooltipContent
2623
+ }
2624
+ );
2625
+ }
2626
+ var sizeClasses = {
2627
+ xs: "h-5 w-5",
2628
+ sm: "h-6 w-6",
2629
+ md: "h-8 w-8",
2630
+ lg: "h-10 w-10"
2631
+ };
2632
+ var textSizeClasses = {
2633
+ xs: "text-xs",
2634
+ sm: "text-xs",
2635
+ md: "text-xs",
2636
+ lg: "text-sm"
2637
+ };
2638
+ var presenceDotClasses = {
2639
+ xs: "w-2 h-2 border",
2640
+ sm: "w-2.5 h-2.5 border",
2641
+ md: "w-3 h-3 border-2",
2642
+ lg: "w-3.5 h-3.5 border-2"
2643
+ };
2644
+ var presencePositionClasses = {
2645
+ xs: "-right-1 bottom-0",
2646
+ sm: "-right-1 bottom-0",
2647
+ md: "-right-1.5 -bottom-0.5",
2648
+ lg: "-right-1.5 -bottom-0.5"
2649
+ };
2650
+ var PRESENCE_LABELS = {
2651
+ connected: "Online",
2652
+ connecting: "Connecting",
2653
+ disconnected: "Offline",
2654
+ error: "Connection problem",
2655
+ hidden: "Status hidden"
2656
+ };
2657
+ var presenceColorClasses = {
2658
+ connected: "bg-status-online",
2659
+ connecting: "bg-status-connecting",
2660
+ disconnected: "bg-status-away",
2661
+ error: "bg-status-busy",
2662
+ hidden: "bg-status-offline"
2663
+ };
2664
+ var UserEntity = memo(function UserEntity2({
2665
+ size = "md",
2666
+ variant = "pill",
2667
+ className,
2668
+ showTooltip = true,
2669
+ interactive = true,
2670
+ hasUnreadMessages = false,
2671
+ initials = "",
2672
+ displayName = "",
2673
+ picture,
2674
+ colorClass = "",
2675
+ isAgent = false,
2676
+ agentStyle,
2677
+ avatarStyle,
2678
+ isMe = false,
2679
+ displayStatus,
2680
+ onClick,
2681
+ tooltipContent,
2682
+ empty = false
2683
+ }) {
2684
+ if (empty) {
2685
+ return /* @__PURE__ */ jsx(
2686
+ Avatar,
2687
+ {
2688
+ className: cn(sizeClasses[size], "border border-border", className),
2689
+ "data-testid": "user-entity",
2690
+ children: /* @__PURE__ */ jsx(AvatarFallback, { className: "bg-status-empty text-muted-foreground text-xs font-semibold", children: "?" })
2691
+ }
2692
+ );
2693
+ }
2694
+ const agentBadge = isAgent ? /* @__PURE__ */ jsx(ArbiBotHeadIcon, { className: "w-3.5 h-3.5 text-muted-foreground" }) : void 0;
2695
+ const canMessage = interactive && !isMe && !isAgent;
2696
+ const showUnread = hasUnreadMessages && !isMe && !isAgent;
2697
+ const surfaceStyle = avatarStyle ?? agentStyle;
2698
+ const avatarCore = /* @__PURE__ */ jsxs(
2699
+ Avatar,
2700
+ {
2701
+ className: cn(
2702
+ sizeClasses[size],
2703
+ isAgent ? "rounded-full border-2 border-dashed" : "border border-white"
2704
+ ),
2705
+ style: surfaceStyle,
2706
+ "data-testid": "user-entity",
2707
+ children: [
2708
+ picture && /* @__PURE__ */ jsx(AvatarImage, { src: picture, alt: initials }),
2709
+ /* @__PURE__ */ jsx(
2710
+ AvatarFallback,
2711
+ {
2712
+ className: cn(
2713
+ textSizeClasses[size],
2714
+ "font-semibold leading-none",
2715
+ isAgent ? "rounded-full bg-transparent" : `text-white ${colorClass}`
2716
+ ),
2717
+ style: surfaceStyle,
2718
+ children: initials
2719
+ }
2720
+ )
2721
+ ]
2722
+ }
2723
+ );
2724
+ const statusDot = showUnread || displayStatus ? /* @__PURE__ */ jsx(
2725
+ "span",
2726
+ {
2727
+ className: cn(
2728
+ "absolute rounded-full border-white",
2729
+ presenceDotClasses[size],
2730
+ presencePositionClasses[size],
2731
+ !showUnread && displayStatus ? presenceColorClasses[displayStatus] : ""
2732
+ ),
2733
+ style: showUnread ? { backgroundColor: "#00adef" } : void 0,
2734
+ "data-testid": "user-entity-presence",
2735
+ role: "img",
2736
+ "aria-label": showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus],
2737
+ title: showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus]
2738
+ }
2739
+ ) : null;
2740
+ const avatarElement = statusDot ? /* @__PURE__ */ jsxs(
2741
+ "div",
2742
+ {
2743
+ className: cn(
2744
+ "relative inline-block",
2745
+ sizeClasses[size],
2746
+ variant === "pill" ? "" : className
2747
+ ),
2748
+ children: [
2749
+ avatarCore,
2750
+ statusDot
2751
+ ]
2752
+ }
2753
+ ) : /* @__PURE__ */ jsx("div", { className: cn("inline-block", variant === "pill" ? "" : className), children: avatarCore });
2754
+ const pillAvatar = (
2755
+ // shrink-0: when the pill is squeezed the NAME truncates away — the avatar
2756
+ // must never collapse under it and overflow onto neighbouring text.
2757
+ /* @__PURE__ */ jsxs("span", { className: cn("relative inline-block shrink-0", sizeClasses[size]), children: [
2758
+ /* @__PURE__ */ jsx("span", { className: cn("block transition-opacity", canMessage && "group-hover/pill:opacity-0"), children: avatarCore }),
2759
+ canMessage && /* @__PURE__ */ jsx(
2760
+ "span",
2761
+ {
2762
+ "aria-hidden": true,
2763
+ className: "absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100",
2764
+ children: /* @__PURE__ */ jsx(MessageCircleMore, { className: size === "xs" ? "h-3 w-3" : "h-4 w-4" })
2765
+ }
2766
+ ),
2767
+ statusDot
2768
+ ] })
2769
+ );
2770
+ const resolvedTooltip = showTooltip ? tooltipContent : void 0;
2771
+ if (variant === "pill") {
2772
+ const row = /* @__PURE__ */ jsxs(Fragment, { children: [
2773
+ pillAvatar,
2774
+ displayName && /* @__PURE__ */ jsx("span", { className: "min-w-0 max-w-[320px] truncate text-sm leading-tight", children: displayName }),
2775
+ agentBadge
2776
+ ] });
2777
+ const rowClass = "group/pill inline-flex min-w-0 items-center gap-2";
2778
+ const clickable = interactive && !!onClick;
2779
+ const clickableClass = "cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors hover:bg-muted/60";
2780
+ if (resolvedTooltip) {
2781
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
2782
+ /* @__PURE__ */ jsx(
2783
+ TooltipTrigger,
2784
+ {
2785
+ type: "button",
2786
+ onClick: clickable ? onClick : void 0,
2787
+ onFocusCapture: (e) => e.stopPropagation(),
2788
+ className: cn(rowClass, clickable && clickableClass, className),
2789
+ "data-testid": "user-entity-pill",
2790
+ children: row
2791
+ }
2792
+ ),
2793
+ /* @__PURE__ */ jsx(TooltipContent, { className: "p-2", children: resolvedTooltip })
2794
+ ] });
2795
+ }
2796
+ if (clickable) {
2797
+ return /* @__PURE__ */ jsx(
2798
+ "button",
2799
+ {
2800
+ type: "button",
2801
+ onClick,
2802
+ className: cn(rowClass, clickableClass, className),
2803
+ "data-testid": "user-entity-pill",
2804
+ children: row
2805
+ }
2806
+ );
2807
+ }
2808
+ return /* @__PURE__ */ jsx("span", { className: cn(rowClass, className), "data-testid": "user-entity-pill", children: row });
2809
+ }
2810
+ if (showTooltip) {
2811
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
2812
+ /* @__PURE__ */ jsx(TooltipTrigger, { onFocusCapture: (e) => e.stopPropagation(), className: "inline-flex", children: avatarElement }),
2813
+ /* @__PURE__ */ jsx(TooltipContent, { className: "p-2", children: tooltipContent })
2814
+ ] });
2815
+ }
2816
+ return avatarElement;
2817
+ });
2818
+ function AgentBadge({ className }) {
2819
+ return /* @__PURE__ */ jsxs(
2820
+ "span",
2821
+ {
2822
+ "data-testid": "agent-badge",
2823
+ className: cn(
2824
+ "inline-flex shrink-0 items-center gap-1 rounded-full border border-ai-accent/50",
2825
+ "bg-ai-accent-soft px-2 py-0.5 text-[11px] font-bold uppercase tracking-wider text-ai-accent",
2826
+ className
2827
+ ),
2828
+ children: [
2829
+ /* @__PURE__ */ jsx(ArbiBotHeadIcon, { size: 14, className: "text-ai-accent" }),
2830
+ "Agent"
2831
+ ]
2832
+ }
2833
+ );
2834
+ }
2835
+ var PRESENCE_WORDS = {
2836
+ connected: "Online",
2837
+ connecting: "Connecting",
2838
+ disconnected: "Offline",
2839
+ error: "Connection problem",
2840
+ hidden: null
2841
+ };
2842
+ function PresenceLabel({
2843
+ status,
2844
+ className
2845
+ }) {
2846
+ if (!status) return null;
2847
+ const word = PRESENCE_WORDS[status];
2848
+ if (!word) return null;
2849
+ const online = status === "connected";
2850
+ return /* @__PURE__ */ jsxs(
2851
+ "span",
2852
+ {
2853
+ "data-testid": "presence-label",
2854
+ className: cn("inline-flex shrink-0 items-center gap-1 text-xs", className),
2855
+ children: [
2856
+ /* @__PURE__ */ jsx(
2857
+ "span",
2858
+ {
2859
+ className: cn(
2860
+ "size-1.5 rounded-full",
2861
+ online ? "bg-status-online" : "bg-muted-foreground/50"
2862
+ ),
2863
+ "aria-hidden": "true"
2864
+ }
2865
+ ),
2866
+ /* @__PURE__ */ jsx("span", { className: online ? "font-medium text-status-online" : "text-muted-foreground", children: word })
2867
+ ]
2868
+ }
2869
+ );
2870
+ }
2871
+ var PACKAGE_BADGE_VARIANTS = [
2872
+ "default",
2873
+ "accent",
2874
+ "secondary",
2875
+ "destructive",
2876
+ "outline"
2877
+ ];
2878
+ function isPackageBadgeVariant(v) {
2879
+ return PACKAGE_BADGE_VARIANTS.some((known) => known === v);
2880
+ }
2881
+ function PackageStatusBadge({ variant, ...rest }) {
2882
+ return /* @__PURE__ */ jsx(Badge, { variant: isPackageBadgeVariant(variant) ? variant : "outline", ...rest });
2883
+ }
2884
+ var registry = {
2885
+ variants: {},
2886
+ fallback: "outline",
2887
+ Badge: PackageStatusBadge
2888
+ };
2889
+ function configureStatusRegistry(map, opts) {
2890
+ Object.assign(registry.variants, map);
2891
+ if (opts?.fallback) registry.fallback = opts.fallback;
2892
+ if (opts?.Badge) registry.Badge = opts.Badge;
2893
+ }
2894
+ function getStatusVariant(status) {
2895
+ return registry.variants[status] ?? registry.fallback;
2896
+ }
2897
+ function StatusPill({ status, label, variant, className, testId }) {
2898
+ const Badge2 = registry.Badge;
2899
+ return /* @__PURE__ */ jsx(Badge2, { variant: variant ?? getStatusVariant(status), className, "data-testid": testId, children: label ?? status });
2900
+ }
2901
+ var RAG_LABELS = { red: "At risk", amber: "Attention", green: "On track" };
2902
+ function configureRagLabels(labels) {
2903
+ RAG_LABELS = { ...RAG_LABELS, ...labels };
2904
+ }
2905
+ function RagDot({
2906
+ rag,
2907
+ withLabel,
2908
+ className
2909
+ }) {
2910
+ const color = rag === "red" ? "bg-destructive" : rag === "amber" ? "bg-warning" : "bg-success";
2911
+ return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex items-center gap-1.5", className), "data-testid": `rag-${rag}`, children: [
2912
+ /* @__PURE__ */ jsx("span", { className: cn("size-2 rounded-full", color) }),
2913
+ withLabel && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: RAG_LABELS[rag] })
2914
+ ] });
2915
+ }
2916
+ var ENTITY_MAPPINGS = {
2917
+ PRODUCT: {
2918
+ NAMES: {
2919
+ SINGULAR: "ARBI Docs"
2920
+ },
2921
+ ICONS: {
2922
+ DEFAULT: MessageSquareLock
2923
+ }
2924
+ },
2925
+ SECTION: {
2926
+ NAMES: {
2927
+ SINGULAR: "Section"
2928
+ },
2929
+ ICONS: {
2930
+ DEFAULT: ChevronsDown
2931
+ }
2932
+ },
2933
+ WORKSPACE: {
2934
+ NAMES: {
2935
+ SINGULAR: "Workspace",
2936
+ PLURAL: "Workspaces"
2937
+ },
2938
+ ICONS: {
2939
+ DEFAULT: SquareM,
2940
+ NEW: SquarePlus,
2941
+ LIST: LayoutGrid,
2942
+ SETTINGS: Columns3Cog
2943
+ }
2944
+ },
2945
+ CONVERSATION: {
2946
+ NAMES: {
2947
+ SINGULAR: "Chat",
2948
+ PLURAL: "Chats",
2949
+ NEW: "New ARBI Chat"
2950
+ },
2951
+ ICONS: {
2952
+ DEFAULT: MessagesSquare,
2953
+ OFF: MessageSquareOff,
2954
+ ACTIVE: MessageSquareText,
2955
+ NEW: MessageSquarePlus,
2956
+ LIST: MessageSquareMore
2957
+ }
2958
+ },
2959
+ DOCUMENT: {
2960
+ NAMES: {
2961
+ SINGULAR: "File",
2962
+ PLURAL: "Files"
2963
+ },
2964
+ ICONS: {
2965
+ DEFAULT: FolderOpen,
2966
+ OFF: CaptionsOff
2967
+ }
2968
+ },
2969
+ VIEWER: {
2970
+ NAMES: {
2971
+ SINGULAR: "Viewer",
2972
+ PLURAL: "Viewers"
2973
+ },
2974
+ ICONS: {
2975
+ DEFAULT: Eye,
2976
+ OFF: EyeOff
2977
+ }
2978
+ },
2979
+ TAG: {
2980
+ NAMES: {
2981
+ SINGULAR: "Field",
2982
+ PLURAL: "Fields"
2983
+ },
2984
+ ICONS: {
2985
+ DEFAULT: Hash,
2986
+ NEW: FolderPlus
2987
+ }
2988
+ },
2989
+ ANNOTATION: {
2990
+ NAMES: {
2991
+ SINGULAR: "Annotation",
2992
+ PLURAL: "Annotations"
2993
+ },
2994
+ ICONS: {
2995
+ DEFAULT: StickyNote,
2996
+ NEW: StickyNote
2997
+ }
2998
+ },
2999
+ // Workspace knowledge the assistant retains and recalls — durable free text,
3000
+ // optionally grounded in source passages. Distinct from ANNOTATION, which is
3001
+ // attached TO a document field; a NOTE is workspace-scoped and stands alone.
3002
+ // Stored server-side as `memories` (mem-*); "Note" is the user-facing name.
3003
+ NOTE: {
3004
+ NAMES: {
3005
+ SINGULAR: "Note",
3006
+ PLURAL: "Notes"
3007
+ },
3008
+ ICONS: {
3009
+ DEFAULT: NotebookText,
3010
+ NEW: NotebookPen
3011
+ }
3012
+ },
3013
+ USER: {
3014
+ NAMES: {
3015
+ SINGULAR: "User",
3016
+ PLURAL: "Users"
3017
+ },
3018
+ ICONS: {
3019
+ DEFAULT: User,
3020
+ NEW: UserPlus,
3021
+ SETTINGS: Settings2
3022
+ }
3023
+ },
3024
+ WORKSPACEUSER: {
3025
+ NAMES: {
3026
+ SINGULAR: "Member",
3027
+ PLURAL: "Members"
3028
+ },
3029
+ ICONS: {
3030
+ DEFAULT: User,
3031
+ PLURAL: Users,
3032
+ NEW: UserPlus,
3033
+ SETTINGS: Settings2
3034
+ }
3035
+ },
3036
+ CONTACT: {
3037
+ NAMES: {
3038
+ SINGULAR: "Contact",
3039
+ PLURAL: "Contacts"
3040
+ },
3041
+ ICONS: {
3042
+ // A starred person, not an address-book card: contacts here are the
3043
+ // people you talk to, and the star reads as "your people".
3044
+ DEFAULT: UserStar,
3045
+ NEW: UserPlus
3046
+ }
3047
+ },
3048
+ TASK: {
3049
+ NAMES: {
3050
+ SINGULAR: "Job",
3051
+ PLURAL: "Jobs"
3052
+ },
3053
+ ICONS: {
3054
+ DEFAULT: ClipboardList
3055
+ }
3056
+ },
3057
+ PROJECT: {
3058
+ NAMES: {
3059
+ SINGULAR: "Project",
3060
+ PLURAL: "Projects"
3061
+ },
3062
+ ICONS: {
3063
+ DEFAULT: CreditCard
3064
+ }
3065
+ },
3066
+ SKILL: {
3067
+ NAMES: {
3068
+ SINGULAR: "Skill",
3069
+ PLURAL: "Skills"
3070
+ },
3071
+ ICONS: {
3072
+ DEFAULT: Wrench
3073
+ }
3074
+ },
3075
+ ACCOUNT: {
3076
+ NAMES: {
3077
+ SINGULAR: "Account"
3078
+ },
3079
+ ICONS: {
3080
+ DEFAULT: CircleUserRound
3081
+ }
3082
+ },
3083
+ NOTIFICATIONS: {
3084
+ NAMES: {
3085
+ SINGULAR: "Activity",
3086
+ PLURAL: "Activities"
3087
+ },
3088
+ ICONS: {
3089
+ DEFAULT: Bell
3090
+ }
3091
+ },
3092
+ MESSAGE: {
3093
+ NAMES: {
3094
+ SINGULAR: "Message",
3095
+ PLURAL: "Messages"
3096
+ },
3097
+ ICONS: {
3098
+ DEFAULT: MessageSquare
3099
+ }
3100
+ },
3101
+ NOTIFICATION: {
3102
+ NAMES: {
3103
+ SINGULAR: "Notification",
3104
+ PLURAL: "Notifications"
3105
+ },
3106
+ ICONS: {
3107
+ DEFAULT: Bell
3108
+ }
3109
+ },
3110
+ APP: {
3111
+ NAMES: {
3112
+ SINGULAR: "Application",
3113
+ PLURAL: "Applications"
3114
+ },
3115
+ ICONS: {
3116
+ DEFAULT: LayoutGrid,
3117
+ HOME: LayoutGrid,
3118
+ LOGOUT: LogOut,
3119
+ UPLOAD: Upload
3120
+ }
3121
+ },
3122
+ HELP: {
3123
+ NAMES: {
3124
+ SINGULAR: "Help",
3125
+ PLURAL: "Help"
3126
+ },
3127
+ ICONS: {
3128
+ DEFAULT: MessageSquareLock,
3129
+ DOCS: BookOpen,
3130
+ FAQ: FileQuestion,
3131
+ ABOUT: Info
3132
+ }
3133
+ },
3134
+ USERSHIELD: {
3135
+ NAMES: {
3136
+ SINGULAR: "User Shield",
3137
+ PLURAL: "User Shields"
3138
+ },
3139
+ ICONS: {
3140
+ DEFAULT: MessageSquareLock
3141
+ }
3142
+ }
3143
+ };
3144
+ function configureEntityRegistry(overrides) {
3145
+ for (const [type, def] of Object.entries(overrides)) {
3146
+ const target = ENTITY_MAPPINGS[type];
3147
+ if (!target) continue;
3148
+ if (def?.NAMES) Object.assign(target.NAMES, def.NAMES);
3149
+ if (def?.ICONS) Object.assign(target.ICONS, def.ICONS);
3150
+ }
3151
+ }
3152
+ var getEntityIcon = (entityType, variant = "DEFAULT") => {
3153
+ const icons = ENTITY_MAPPINGS[entityType]?.ICONS;
3154
+ return icons?.[variant] || icons?.DEFAULT;
3155
+ };
3156
+ var getEntityLabel = (entityType, form = "SINGULAR") => {
3157
+ const entityMapping = ENTITY_MAPPINGS[entityType];
3158
+ if (!entityMapping) return "";
3159
+ const names = entityMapping.NAMES;
3160
+ const singularName = names.SINGULAR || "";
3161
+ if (form === "NEW") return names.NEW !== void 0 ? names.NEW : "New " + singularName;
3162
+ if (form === "SHORT")
3163
+ return names.SHORT !== void 0 ? names.SHORT : singularName.substring(0, 3) + ".";
3164
+ if (form === "PLURAL") return names.PLURAL !== void 0 ? names.PLURAL : singularName + "s";
3165
+ return singularName;
3166
+ };
3167
+ var EntityIcon = ({ entityType, variant = "DEFAULT", ...props }) => {
3168
+ const IconComponent = getEntityIcon(entityType, variant);
3169
+ return IconComponent ? React2__default.createElement(IconComponent, props) : null;
3170
+ };
3171
+ var VISIBILITY_ICONS = {
3172
+ PRIVATE: MessageSquareLock,
3173
+ SHARED: Users
3174
+ };
3175
+ var VisibilityIcon = ({
3176
+ isShared,
3177
+ ...props
3178
+ }) => {
3179
+ const IconComponent = isShared ? VISIBILITY_ICONS.SHARED : VISIBILITY_ICONS.PRIVATE;
3180
+ return React2__default.createElement(IconComponent, props);
3181
+ };
3182
+
3183
+ // src/entities/colors.ts
3184
+ var OPACITY_LIGHT = 0.15;
3185
+ var OPACITY_MEDIUM = 1;
3186
+ var OPACITY_BORDER = 0.3;
3187
+ var PLACEHOLDER_COLOR = "#9ca3af";
3188
+ var NEUTRAL_GRAY2 = "#64748b";
3189
+ var BASE_COLORS2 = {
3190
+ "0": "#10b981",
3191
+ "1": "#3b82f6",
3192
+ "2": "#8b5cf6",
3193
+ "3": "#f43f5e",
3194
+ "4": "#f59e0b",
3195
+ "5": "#84cc16",
3196
+ "6": "#a855f7",
3197
+ "7": "#06b6d4",
3198
+ "8": "#f97316",
3199
+ "9": "#14b8a6",
3200
+ a: "#ef4444",
3201
+ b: "#6366f1",
3202
+ c: "#ec4899",
3203
+ d: "#22c55e",
3204
+ e: "#eab308",
3205
+ f: "#0ea5e9"
3206
+ };
3207
+ function hexToRgba(hex, opacity) {
3208
+ const r = parseInt(hex.slice(1, 3), 16);
3209
+ const g = parseInt(hex.slice(3, 5), 16);
3210
+ const b = parseInt(hex.slice(5, 7), 16);
3211
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
3212
+ }
3213
+ function getEntityColor2(entityId, variant = "medium") {
3214
+ const baseColor = BASE_COLORS2[entityId[4]] || BASE_COLORS2["0"];
3215
+ switch (variant) {
3216
+ case "light":
3217
+ return hexToRgba(baseColor, OPACITY_LIGHT);
3218
+ case "medium":
3219
+ return hexToRgba(baseColor, OPACITY_MEDIUM);
3220
+ case "text":
3221
+ return baseColor;
3222
+ }
3223
+ }
3224
+ function getEntityColorStyles(entityId) {
3225
+ const baseColor = BASE_COLORS2[entityId[4]] || BASE_COLORS2["0"];
3226
+ return {
3227
+ backgroundColor: getEntityColor2(entityId, "light"),
3228
+ color: baseColor,
3229
+ borderColor: hexToRgba(baseColor, OPACITY_BORDER)
3230
+ };
3231
+ }
3232
+ var getWorkspaceColor = (workspaceId, useWorkspaceColors) => {
3233
+ const shouldUseWorkspaceColors = useWorkspaceColors !== void 0 ? useWorkspaceColors : true;
3234
+ if (!shouldUseWorkspaceColors) return "hsl(var(--primary))";
3235
+ const isValidId = workspaceId && workspaceId.startsWith("wrk-") && workspaceId.length >= 5;
3236
+ if (!isValidId) return "hsl(var(--primary))";
3237
+ return getEntityColor2(workspaceId, "medium");
3238
+ };
1816
3239
 
1817
- export { AiMarkdown, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DictateProvider, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, InlineMicButton, Input, Label, MarkdownRenderer, MarkdownStreamingContext, MicRecordingOverlay, MicWaveformIndicator, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cardVariants, classifyMediaError, cn, formatElapsed, markdownBaseComponents, splitMarkdownBlocks, toggleVariants, useAudioRecorder };
1818
- //# sourceMappingURL=chunk-I256BUCX.js.map
1819
- //# sourceMappingURL=chunk-I256BUCX.js.map
3240
+ export { AgentBadge, AiMarkdown, ArbiBotHeadIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS2 as BASE_COLORS, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DictateProvider, DocumentEntity, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkdownRenderer, MarkdownStreamingContext, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY2 as NEUTRAL_GRAY, PLACEHOLDER_COLOR, PdfIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, VISIBILITY_ICONS, VidIcon, VisibilityIcon, badgeVariants, buttonVariants, cardVariants, classifyMediaError, cn, configureEntityRegistry, configureRagLabels, configureStatusRegistry, formatElapsed, getDocIcon, getEntityColor2 as getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, markdownBaseComponents, splitMarkdownBlocks, toggleVariants, useAudioRecorder };
3241
+ //# sourceMappingURL=chunk-YJAYST7S.js.map
3242
+ //# sourceMappingURL=chunk-YJAYST7S.js.map