@arbidocs/react 0.3.184 → 0.4.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.
- package/dist/chunk-3CLGHHME.js +3882 -0
- package/dist/chunk-3CLGHHME.js.map +1 -0
- package/dist/chunk-6ALMBER7.js +176 -0
- package/dist/chunk-6ALMBER7.js.map +1 -0
- package/dist/chunk-BXP6S34V.cjs +284 -0
- package/dist/chunk-BXP6S34V.cjs.map +1 -0
- package/dist/chunk-EJ2BMHYK.js +272 -0
- package/dist/chunk-EJ2BMHYK.js.map +1 -0
- package/dist/chunk-OU2QLIKS.cjs +4060 -0
- package/dist/chunk-OU2QLIKS.cjs.map +1 -0
- package/dist/chunk-RZQACYNQ.cjs +218 -0
- package/dist/chunk-RZQACYNQ.cjs.map +1 -0
- package/dist/index-CcbVSNSP.d.cts +116 -0
- package/dist/index-CcbVSNSP.d.ts +116 -0
- package/dist/index.cjs +955 -2796
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -901
- package/dist/index.d.ts +13 -901
- package/dist/index.js +312 -2303
- package/dist/index.js.map +1 -1
- package/dist/shell/index.cjs +29 -0
- package/dist/shell/index.cjs.map +1 -0
- package/dist/shell/index.d.cts +4 -0
- package/dist/shell/index.d.ts +4 -0
- package/dist/shell/index.js +4 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/ui/index.cjs +288 -147
- package/dist/ui/index.d.cts +878 -3
- package/dist/ui/index.d.ts +878 -3
- package/dist/ui/index.js +2 -1
- package/dist/viewers/index.cjs +327 -76
- package/dist/viewers/index.cjs.map +1 -1
- package/dist/viewers/index.d.cts +90 -4
- package/dist/viewers/index.d.ts +90 -4
- package/dist/viewers/index.js +316 -78
- package/dist/viewers/index.js.map +1 -1
- package/package.json +12 -3
- package/dist/chunk-FIPS3VPH.cjs +0 -1975
- package/dist/chunk-FIPS3VPH.cjs.map +0 -1
- package/dist/chunk-I256BUCX.js +0 -1819
- package/dist/chunk-I256BUCX.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { formatRelativeTime } from './chunk-EJ2BMHYK.js';
|
|
2
|
+
export { DEFAULT_NOTIFY_TONE, NotificationBell, Toaster, formatRelativeTime, notify, seedNotifications, selectUnread, toast, useNotify } from './chunk-EJ2BMHYK.js';
|
|
3
|
+
import { MarkMenu, AiMarkdown, Card, Button, Badge, TagEntity, MarkdownRenderer, Input, FILE_TYPE_COLORS, getEntityIcon, UserEntity, getEntityColorStyles, AgentBadge, Textarea, Slider, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DocumentEntity, DocumentCard, useAudioRecorder, MicWaveformIndicator, IconToggle, classifyMediaError, formatElapsed, PassageCard } from './chunk-3CLGHHME.js';
|
|
4
|
+
export { AgentBadge, AiMarkdown, ArbiBotHeadIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkMenu, MarkdownRenderer, MarkdownStreamingContext, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, PdfIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, 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, UserMenu, VISIBILITY_ICONS, VidIcon, VisibilityIcon, badgeVariants, buttonVariants, cardVariants, configureEntityRegistry, configureRagLabels, configureStatusRegistry, formatElapsed, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, markdownBaseComponents, splitMarkdownBlocks, toggleVariants, useAudioRecorder } from './chunk-3CLGHHME.js';
|
|
5
|
+
import { cn, ScrollArea, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from './chunk-6ALMBER7.js';
|
|
6
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ScrollArea, ScrollBar, cn } from './chunk-6ALMBER7.js';
|
|
3
7
|
import { useArbi, ArbiProvider, AudioViewer, ImageViewer, VideoViewer } from './chunk-JKO3NR5L.js';
|
|
4
8
|
export { ArbiProvider, useArbi } from './chunk-JKO3NR5L.js';
|
|
5
|
-
import
|
|
9
|
+
import React, { memo, useState, createContext, useMemo, useCallback, useEffect, useRef, useLayoutEffect, useContext, useId, Fragment as Fragment$1 } from 'react';
|
|
6
10
|
import { useQuery, useMutation, useQueries, QueryClient, QueryClientProvider, useQueryClient } from '@tanstack/react-query';
|
|
7
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
12
|
import { connectWithReconnect, resolveCitations, summarizeCitations } from '@arbidocs/sdk/browser';
|
|
9
13
|
export { Arbi, ArbiError } from '@arbidocs/sdk/browser';
|
|
10
|
-
import { Link, Trash2, CheckCheck, Check,
|
|
14
|
+
import { Link, Trash2, CheckCheck, Check, Loader2, AlertTriangle, ShieldCheck, Copy, Sparkles, FileText, GitCompareArrows, Download, Image as Image$1, Search, CornerDownLeft, X, ArrowLeft, Send, Tags, Crown, Info, Activity, Gauge, Gift, PartyPopper, UserCheck, MessageCircleMore, FileX2, FileCheck2, Pencil, FolderPlus, SquareArrowOutUpRight, MessagesSquare, ArrowRight, MoreHorizontal, SquarePen, Mic, Pause, Play, Square, RotateCcw, Camera, Circle } from 'lucide-react';
|
|
11
15
|
import { isMessageType } from '@arbidocs/client';
|
|
12
16
|
export { isMessageType } from '@arbidocs/client';
|
|
13
17
|
import { create } from 'zustand';
|
|
14
18
|
import { diffWords } from 'diff';
|
|
15
19
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
20
|
+
import { createPortal } from 'react-dom';
|
|
16
21
|
import ReactMarkdown from 'react-markdown';
|
|
17
|
-
import { Toaster as Toaster$1, toast } from 'sonner';
|
|
18
|
-
export { toast } from 'sonner';
|
|
19
22
|
import Cropper from 'react-easy-crop';
|
|
20
23
|
import { AgGridReact } from 'ag-grid-react';
|
|
21
24
|
import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community';
|
|
@@ -1440,8 +1443,8 @@ var ChatBubble = memo(function ChatBubble2({
|
|
|
1440
1443
|
isSent ? "justify-end" : "justify-start"
|
|
1441
1444
|
),
|
|
1442
1445
|
children: [
|
|
1443
|
-
senderName && /* @__PURE__ */ jsx("span", { className: "text-
|
|
1444
|
-
/* @__PURE__ */ jsx("span", { className: "text-
|
|
1446
|
+
senderName && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium leading-none opacity-90", children: senderName }),
|
|
1447
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
1445
1448
|
isSent && (read ? /* @__PURE__ */ jsx(CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
1446
1449
|
]
|
|
1447
1450
|
}
|
|
@@ -2192,7 +2195,7 @@ function DocSearch({
|
|
|
2192
2195
|
"p.",
|
|
2193
2196
|
r.page
|
|
2194
2197
|
] }),
|
|
2195
|
-
r.score != null && /* @__PURE__ */ jsxs("span", { className: "ml-auto text-
|
|
2198
|
+
r.score != null && /* @__PURE__ */ jsxs("span", { className: "ml-auto text-xs text-muted-foreground", children: [
|
|
2196
2199
|
"score ",
|
|
2197
2200
|
r.score.toFixed(2)
|
|
2198
2201
|
] })
|
|
@@ -2205,350 +2208,6 @@ function DocSearch({
|
|
|
2205
2208
|
] })
|
|
2206
2209
|
] });
|
|
2207
2210
|
}
|
|
2208
|
-
var EntityPill = forwardRef(function EntityPill2({
|
|
2209
|
-
icon,
|
|
2210
|
-
label,
|
|
2211
|
-
secondaryText,
|
|
2212
|
-
size = "sm",
|
|
2213
|
-
shape = "rounded",
|
|
2214
|
-
className,
|
|
2215
|
-
labelMaxWidth = "max-w-[320px]",
|
|
2216
|
-
labelClassName,
|
|
2217
|
-
fullWidth = false,
|
|
2218
|
-
highlight = false,
|
|
2219
|
-
onClick,
|
|
2220
|
-
onIconClick,
|
|
2221
|
-
onMoreClick,
|
|
2222
|
-
moreContent,
|
|
2223
|
-
href,
|
|
2224
|
-
disabled = false,
|
|
2225
|
-
tooltipContent,
|
|
2226
|
-
tooltipSide = "bottom",
|
|
2227
|
-
"data-testid": testId
|
|
2228
|
-
}, ref) {
|
|
2229
|
-
const shapeClass = shape === "pill" ? "rounded-full" : "rounded-md";
|
|
2230
|
-
const sizeClasses2 = size === "base" ? "gap-1.5 px-1.5 py-0.5" : "gap-1 px-1";
|
|
2231
|
-
const textSizeClass = size === "base" ? "text-base" : "text-sm";
|
|
2232
|
-
const baseClasses = cn(
|
|
2233
|
-
"group/pill items-center",
|
|
2234
|
-
fullWidth ? "flex w-full" : "inline-flex",
|
|
2235
|
-
sizeClasses2,
|
|
2236
|
-
shapeClass,
|
|
2237
|
-
"bg-muted",
|
|
2238
|
-
"border border-border",
|
|
2239
|
-
"transition-all",
|
|
2240
|
-
className
|
|
2241
|
-
);
|
|
2242
|
-
const interactiveClasses = "cursor-pointer hover:bg-muted/80";
|
|
2243
|
-
const disabledClasses = "cursor-default opacity-60";
|
|
2244
|
-
const highlightClasses = "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground";
|
|
2245
|
-
const mainContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2246
|
-
onIconClick ? /* @__PURE__ */ jsx(
|
|
2247
|
-
"span",
|
|
2248
|
-
{
|
|
2249
|
-
role: "button",
|
|
2250
|
-
tabIndex: 0,
|
|
2251
|
-
className: "flex-shrink-0 cursor-pointer hover:opacity-70 transition-opacity",
|
|
2252
|
-
onClick: (e) => {
|
|
2253
|
-
e.stopPropagation();
|
|
2254
|
-
onIconClick(e);
|
|
2255
|
-
},
|
|
2256
|
-
children: icon
|
|
2257
|
-
}
|
|
2258
|
-
) : icon,
|
|
2259
|
-
/* @__PURE__ */ jsx(
|
|
2260
|
-
"span",
|
|
2261
|
-
{
|
|
2262
|
-
className: cn(
|
|
2263
|
-
textSizeClass,
|
|
2264
|
-
"font-medium truncate leading-tight min-w-0",
|
|
2265
|
-
labelMaxWidth,
|
|
2266
|
-
labelClassName
|
|
2267
|
-
),
|
|
2268
|
-
children: label
|
|
2269
|
-
}
|
|
2270
|
-
),
|
|
2271
|
-
secondaryText && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground flex-shrink-0 leading-none", children: secondaryText })
|
|
2272
|
-
] });
|
|
2273
|
-
const tooltipWrap = (content, tip, side = tooltipSide, triggerClassName, triggerProps) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
2274
|
-
/* @__PURE__ */ jsx(
|
|
2275
|
-
TooltipTrigger,
|
|
2276
|
-
{
|
|
2277
|
-
onFocusCapture: (e) => e.stopPropagation(),
|
|
2278
|
-
className: triggerClassName,
|
|
2279
|
-
...triggerProps,
|
|
2280
|
-
children: content
|
|
2281
|
-
}
|
|
2282
|
-
),
|
|
2283
|
-
/* @__PURE__ */ jsx(TooltipContent, { side, className: "p-2", children: tip })
|
|
2284
|
-
] });
|
|
2285
|
-
const mainAreaClass = cn("inline-flex items-center gap-1", fullWidth && "min-w-0 flex-1");
|
|
2286
|
-
if (onMoreClick || moreContent) {
|
|
2287
|
-
let mainArea;
|
|
2288
|
-
if (tooltipContent) {
|
|
2289
|
-
mainArea = tooltipWrap(
|
|
2290
|
-
mainContent,
|
|
2291
|
-
tooltipContent,
|
|
2292
|
-
tooltipSide,
|
|
2293
|
-
cn(mainAreaClass, disabled && "opacity-60"),
|
|
2294
|
-
{
|
|
2295
|
-
type: "button",
|
|
2296
|
-
onClick: href ? onClick : disabled ? void 0 : onClick,
|
|
2297
|
-
disabled: disabled || void 0
|
|
2298
|
-
}
|
|
2299
|
-
);
|
|
2300
|
-
} else if (href) {
|
|
2301
|
-
mainArea = /* @__PURE__ */ jsx(
|
|
2302
|
-
"a",
|
|
2303
|
-
{
|
|
2304
|
-
href,
|
|
2305
|
-
target: "_blank",
|
|
2306
|
-
rel: "noopener noreferrer",
|
|
2307
|
-
className: mainAreaClass,
|
|
2308
|
-
onClick,
|
|
2309
|
-
children: mainContent
|
|
2310
|
-
}
|
|
2311
|
-
);
|
|
2312
|
-
} else if (onClick) {
|
|
2313
|
-
mainArea = /* @__PURE__ */ jsx(
|
|
2314
|
-
"button",
|
|
2315
|
-
{
|
|
2316
|
-
type: "button",
|
|
2317
|
-
onClick: disabled ? void 0 : onClick,
|
|
2318
|
-
disabled,
|
|
2319
|
-
className: cn("inline-flex items-center gap-1", disabled && "opacity-60"),
|
|
2320
|
-
children: mainContent
|
|
2321
|
-
}
|
|
2322
|
-
);
|
|
2323
|
-
} else {
|
|
2324
|
-
mainArea = /* @__PURE__ */ jsx("span", { className: mainAreaClass, children: mainContent });
|
|
2325
|
-
}
|
|
2326
|
-
const moreArea = moreContent ? /* @__PURE__ */ jsx("span", { className: "flex-shrink-0 leading-none", children: moreContent }) : tooltipWrap(
|
|
2327
|
-
/* @__PURE__ */ jsx(MoreVertical, { className: "w-3.5 h-3.5" }),
|
|
2328
|
-
"Click for more",
|
|
2329
|
-
tooltipSide,
|
|
2330
|
-
"flex-shrink-0 leading-none text-muted-foreground hover:text-foreground",
|
|
2331
|
-
{
|
|
2332
|
-
type: "button",
|
|
2333
|
-
onClick: (e) => {
|
|
2334
|
-
e.stopPropagation();
|
|
2335
|
-
onMoreClick?.(e);
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
);
|
|
2339
|
-
return /* @__PURE__ */ jsxs(
|
|
2340
|
-
"span",
|
|
2341
|
-
{
|
|
2342
|
-
ref,
|
|
2343
|
-
className: cn(
|
|
2344
|
-
baseClasses,
|
|
2345
|
-
(onClick || href) && !disabled && interactiveClasses,
|
|
2346
|
-
highlight && highlightClasses
|
|
2347
|
-
),
|
|
2348
|
-
"data-testid": testId,
|
|
2349
|
-
children: [
|
|
2350
|
-
mainArea,
|
|
2351
|
-
moreArea
|
|
2352
|
-
]
|
|
2353
|
-
}
|
|
2354
|
-
);
|
|
2355
|
-
}
|
|
2356
|
-
if (tooltipContent) {
|
|
2357
|
-
if (href) {
|
|
2358
|
-
return tooltipWrap(
|
|
2359
|
-
/* @__PURE__ */ jsx(
|
|
2360
|
-
"a",
|
|
2361
|
-
{
|
|
2362
|
-
href,
|
|
2363
|
-
target: "_blank",
|
|
2364
|
-
rel: "noopener noreferrer",
|
|
2365
|
-
className: mainAreaClass,
|
|
2366
|
-
onClick,
|
|
2367
|
-
children: mainContent
|
|
2368
|
-
}
|
|
2369
|
-
),
|
|
2370
|
-
tooltipContent,
|
|
2371
|
-
tooltipSide,
|
|
2372
|
-
cn(baseClasses, interactiveClasses),
|
|
2373
|
-
{ "data-testid": testId }
|
|
2374
|
-
);
|
|
2375
|
-
}
|
|
2376
|
-
return tooltipWrap(
|
|
2377
|
-
mainContent,
|
|
2378
|
-
tooltipContent,
|
|
2379
|
-
tooltipSide,
|
|
2380
|
-
cn(
|
|
2381
|
-
baseClasses,
|
|
2382
|
-
onClick && !disabled ? interactiveClasses : "",
|
|
2383
|
-
disabled ? disabledClasses : "",
|
|
2384
|
-
highlight && highlightClasses
|
|
2385
|
-
),
|
|
2386
|
-
{
|
|
2387
|
-
type: "button",
|
|
2388
|
-
ref,
|
|
2389
|
-
onClick: onClick && !disabled ? onClick : void 0,
|
|
2390
|
-
disabled: disabled || void 0,
|
|
2391
|
-
"data-testid": testId
|
|
2392
|
-
}
|
|
2393
|
-
);
|
|
2394
|
-
}
|
|
2395
|
-
if (href) {
|
|
2396
|
-
return /* @__PURE__ */ jsx(
|
|
2397
|
-
"a",
|
|
2398
|
-
{
|
|
2399
|
-
ref,
|
|
2400
|
-
href,
|
|
2401
|
-
target: "_blank",
|
|
2402
|
-
rel: "noopener noreferrer",
|
|
2403
|
-
className: cn(baseClasses, interactiveClasses),
|
|
2404
|
-
"data-testid": testId,
|
|
2405
|
-
onClick,
|
|
2406
|
-
children: mainContent
|
|
2407
|
-
}
|
|
2408
|
-
);
|
|
2409
|
-
}
|
|
2410
|
-
if (onClick) {
|
|
2411
|
-
return /* @__PURE__ */ jsx(
|
|
2412
|
-
"button",
|
|
2413
|
-
{
|
|
2414
|
-
ref,
|
|
2415
|
-
type: "button",
|
|
2416
|
-
onClick: disabled ? void 0 : onClick,
|
|
2417
|
-
disabled,
|
|
2418
|
-
className: cn(
|
|
2419
|
-
baseClasses,
|
|
2420
|
-
disabled ? disabledClasses : interactiveClasses,
|
|
2421
|
-
highlight && highlightClasses
|
|
2422
|
-
),
|
|
2423
|
-
"data-testid": testId,
|
|
2424
|
-
children: mainContent
|
|
2425
|
-
}
|
|
2426
|
-
);
|
|
2427
|
-
}
|
|
2428
|
-
return /* @__PURE__ */ jsx(
|
|
2429
|
-
"span",
|
|
2430
|
-
{
|
|
2431
|
-
ref,
|
|
2432
|
-
className: cn(baseClasses, highlight && highlightClasses),
|
|
2433
|
-
"data-testid": testId,
|
|
2434
|
-
children: mainContent
|
|
2435
|
-
}
|
|
2436
|
-
);
|
|
2437
|
-
});
|
|
2438
|
-
var TAG_TYPE_LABELS = {
|
|
2439
|
-
checkbox: "Checkbox",
|
|
2440
|
-
select: "Select",
|
|
2441
|
-
number: "Number",
|
|
2442
|
-
text: "Text",
|
|
2443
|
-
folder: "Folder",
|
|
2444
|
-
search: "Saved Search",
|
|
2445
|
-
date: "Date",
|
|
2446
|
-
assistant: "AI Assistant"
|
|
2447
|
-
};
|
|
2448
|
-
var TAG_TYPE_ICONS = {
|
|
2449
|
-
checkbox: SquareCheckBig,
|
|
2450
|
-
select: List,
|
|
2451
|
-
number: Hash,
|
|
2452
|
-
text: NotebookPen,
|
|
2453
|
-
folder: Folder,
|
|
2454
|
-
search: Search,
|
|
2455
|
-
date: Calendar,
|
|
2456
|
-
assistant: Bot
|
|
2457
|
-
};
|
|
2458
|
-
function getTagTypeIcon(type) {
|
|
2459
|
-
return TAG_TYPE_ICONS[type ?? "text"] || NotebookPen;
|
|
2460
|
-
}
|
|
2461
|
-
function getTagTypeLabel(type) {
|
|
2462
|
-
const t = type ?? "text";
|
|
2463
|
-
return TAG_TYPE_LABELS[t] || t;
|
|
2464
|
-
}
|
|
2465
|
-
var BASE_COLORS = {
|
|
2466
|
-
"0": "#10b981",
|
|
2467
|
-
"1": "#3b82f6",
|
|
2468
|
-
"2": "#8b5cf6",
|
|
2469
|
-
"3": "#f43f5e",
|
|
2470
|
-
"4": "#f59e0b",
|
|
2471
|
-
"5": "#84cc16",
|
|
2472
|
-
"6": "#a855f7",
|
|
2473
|
-
"7": "#06b6d4",
|
|
2474
|
-
"8": "#f97316",
|
|
2475
|
-
"9": "#14b8a6",
|
|
2476
|
-
a: "#ef4444",
|
|
2477
|
-
b: "#6366f1",
|
|
2478
|
-
c: "#ec4899",
|
|
2479
|
-
d: "#22c55e",
|
|
2480
|
-
e: "#eab308",
|
|
2481
|
-
f: "#0ea5e9"
|
|
2482
|
-
};
|
|
2483
|
-
function getEntityColor(entityId) {
|
|
2484
|
-
return BASE_COLORS[entityId[4]] || BASE_COLORS["0"];
|
|
2485
|
-
}
|
|
2486
|
-
function TagEntity({
|
|
2487
|
-
tag,
|
|
2488
|
-
size = "md",
|
|
2489
|
-
className = "",
|
|
2490
|
-
onClick,
|
|
2491
|
-
showTooltip = true,
|
|
2492
|
-
tooltipContent
|
|
2493
|
-
}) {
|
|
2494
|
-
const tagType = tag.tag_type?.type ?? "text";
|
|
2495
|
-
const iconSize = size === "sm" ? 12 : size === "md" ? 14 : 16;
|
|
2496
|
-
const Icon = getTagTypeIcon(tagType);
|
|
2497
|
-
const sizeClasses2 = {
|
|
2498
|
-
sm: "p-0.5",
|
|
2499
|
-
md: "p-1",
|
|
2500
|
-
lg: "p-1.5"
|
|
2501
|
-
};
|
|
2502
|
-
const tagColor = tag.color ?? getEntityColor(tag.external_id);
|
|
2503
|
-
const iconElement = /* @__PURE__ */ jsx(
|
|
2504
|
-
"span",
|
|
2505
|
-
{
|
|
2506
|
-
className: `inline-flex items-center justify-center rounded-md text-white flex-shrink-0 ${sizeClasses2[size]}`,
|
|
2507
|
-
style: { backgroundColor: tagColor },
|
|
2508
|
-
children: /* @__PURE__ */ jsx(Icon, { size: iconSize, className: "flex-shrink-0" })
|
|
2509
|
-
}
|
|
2510
|
-
);
|
|
2511
|
-
const pillSize = size === "lg" ? "base" : "sm";
|
|
2512
|
-
const defaultTooltip = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
2513
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2514
|
-
/* @__PURE__ */ jsx(
|
|
2515
|
-
"span",
|
|
2516
|
-
{
|
|
2517
|
-
className: "inline-flex items-center justify-center rounded-md text-white p-1",
|
|
2518
|
-
style: { backgroundColor: tagColor },
|
|
2519
|
-
children: /* @__PURE__ */ jsx(Icon, { size: 16 })
|
|
2520
|
-
}
|
|
2521
|
-
),
|
|
2522
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: tag.name })
|
|
2523
|
-
] }),
|
|
2524
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 text-sm", children: [
|
|
2525
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2526
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
|
|
2527
|
-
/* @__PURE__ */ jsx("span", { children: getTagTypeLabel(tagType) })
|
|
2528
|
-
] }),
|
|
2529
|
-
tag.doctag_count != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2530
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Documents:" }),
|
|
2531
|
-
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "h-5 min-w-[20px] justify-center", children: tag.doctag_count ?? 0 })
|
|
2532
|
-
] }),
|
|
2533
|
-
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" }) })
|
|
2534
|
-
] })
|
|
2535
|
-
] });
|
|
2536
|
-
const resolvedTooltip = showTooltip ? tooltipContent ?? defaultTooltip : void 0;
|
|
2537
|
-
return /* @__PURE__ */ jsx(
|
|
2538
|
-
EntityPill,
|
|
2539
|
-
{
|
|
2540
|
-
icon: iconElement,
|
|
2541
|
-
label: tag.name,
|
|
2542
|
-
size: pillSize,
|
|
2543
|
-
shape: "rounded",
|
|
2544
|
-
labelMaxWidth: "max-w-[180px]",
|
|
2545
|
-
tooltipContent: resolvedTooltip,
|
|
2546
|
-
onClick,
|
|
2547
|
-
className,
|
|
2548
|
-
"data-testid": `tag-entity-${tag.external_id}`
|
|
2549
|
-
}
|
|
2550
|
-
);
|
|
2551
|
-
}
|
|
2552
2211
|
function DocumentReview({
|
|
2553
2212
|
docId,
|
|
2554
2213
|
doc,
|
|
@@ -2560,7 +2219,7 @@ function DocumentReview({
|
|
|
2560
2219
|
}) {
|
|
2561
2220
|
const parsedQuery = useParsedDocument(docId, stage);
|
|
2562
2221
|
const tagsQuery = useTags(workspaceId);
|
|
2563
|
-
const tagNameById =
|
|
2222
|
+
const tagNameById = React.useMemo(() => {
|
|
2564
2223
|
const map = /* @__PURE__ */ new Map();
|
|
2565
2224
|
for (const t of tagsQuery.data ?? []) {
|
|
2566
2225
|
if (t.external_id) map.set(t.external_id, t.name ?? t.external_id.slice(0, 8));
|
|
@@ -2568,7 +2227,7 @@ function DocumentReview({
|
|
|
2568
2227
|
return map;
|
|
2569
2228
|
}, [tagsQuery.data]);
|
|
2570
2229
|
const title = doc?.doc_metadata?.title || doc?.file_name || "Document";
|
|
2571
|
-
const { findings, chunkToTag } =
|
|
2230
|
+
const { findings, chunkToTag } = React.useMemo(() => {
|
|
2572
2231
|
const list = [];
|
|
2573
2232
|
const chunkTag = /* @__PURE__ */ new Map();
|
|
2574
2233
|
for (const dt of doc?.doctags ?? []) {
|
|
@@ -2584,7 +2243,7 @@ function DocumentReview({
|
|
|
2584
2243
|
}
|
|
2585
2244
|
return { findings: list, chunkToTag: chunkTag };
|
|
2586
2245
|
}, [doc?.doctags]);
|
|
2587
|
-
const pages =
|
|
2246
|
+
const pages = React.useMemo(() => {
|
|
2588
2247
|
const chunks = parsedQuery.data?.chunks ?? [];
|
|
2589
2248
|
const byPage = /* @__PURE__ */ new Map();
|
|
2590
2249
|
for (const c of chunks) {
|
|
@@ -2594,9 +2253,9 @@ function DocumentReview({
|
|
|
2594
2253
|
}
|
|
2595
2254
|
return [...byPage.entries()].sort((a, b) => a[0] - b[0]);
|
|
2596
2255
|
}, [parsedQuery.data]);
|
|
2597
|
-
const scrollRef =
|
|
2598
|
-
const [flash, setFlash] =
|
|
2599
|
-
const jumpToChunk =
|
|
2256
|
+
const scrollRef = React.useRef(null);
|
|
2257
|
+
const [flash, setFlash] = React.useState(null);
|
|
2258
|
+
const jumpToChunk = React.useCallback((chunkId) => {
|
|
2600
2259
|
const el = scrollRef.current?.querySelector(`[data-chunk-id="${chunkId}"]`);
|
|
2601
2260
|
if (!el) return;
|
|
2602
2261
|
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -2604,7 +2263,7 @@ function DocumentReview({
|
|
|
2604
2263
|
window.setTimeout(() => setFlash((c) => c === chunkId ? null : c), 1600);
|
|
2605
2264
|
}, []);
|
|
2606
2265
|
const parsedReady = !parsedQuery.isLoading && !!parsedQuery.data;
|
|
2607
|
-
|
|
2266
|
+
React.useEffect(() => {
|
|
2608
2267
|
if (!activeChunkId || !parsedReady) return;
|
|
2609
2268
|
const raf = window.requestAnimationFrame(() => jumpToChunk(activeChunkId));
|
|
2610
2269
|
return () => window.cancelAnimationFrame(raf);
|
|
@@ -2729,79 +2388,6 @@ function DocumentReview({
|
|
|
2729
2388
|
}
|
|
2730
2389
|
);
|
|
2731
2390
|
}
|
|
2732
|
-
var TIERS = [
|
|
2733
|
-
{ min: 0.7, tone: "bg-emerald-500", label: "High relevance" },
|
|
2734
|
-
{ min: 0.4, tone: "bg-amber-500", label: "Medium relevance" },
|
|
2735
|
-
{ min: -Infinity, tone: "bg-muted-foreground/40", label: "Low relevance" }
|
|
2736
|
-
];
|
|
2737
|
-
function RelevanceDot({ score }) {
|
|
2738
|
-
if (score == null) return null;
|
|
2739
|
-
const tier = TIERS.find((t) => score >= t.min) ?? TIERS[TIERS.length - 1];
|
|
2740
|
-
return /* @__PURE__ */ jsx(
|
|
2741
|
-
"span",
|
|
2742
|
-
{
|
|
2743
|
-
role: "img",
|
|
2744
|
-
"aria-label": tier.label,
|
|
2745
|
-
title: `${tier.label} (${score.toFixed(2)})`,
|
|
2746
|
-
className: cn("size-1.5 shrink-0 rounded-full", tier.tone),
|
|
2747
|
-
"data-testid": "passage-relevance"
|
|
2748
|
-
}
|
|
2749
|
-
);
|
|
2750
|
-
}
|
|
2751
|
-
function PassageCard({
|
|
2752
|
-
header,
|
|
2753
|
-
score,
|
|
2754
|
-
headerRight,
|
|
2755
|
-
active,
|
|
2756
|
-
onClick,
|
|
2757
|
-
footer,
|
|
2758
|
-
className,
|
|
2759
|
-
children,
|
|
2760
|
-
"data-testid": testId
|
|
2761
|
-
}) {
|
|
2762
|
-
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2763
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-1.5 flex items-center gap-2", children: [
|
|
2764
|
-
header,
|
|
2765
|
-
(score != null || headerRight) && /* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
2766
|
-
/* @__PURE__ */ jsx(RelevanceDot, { score }),
|
|
2767
|
-
headerRight
|
|
2768
|
-
] })
|
|
2769
|
-
] }),
|
|
2770
|
-
/* @__PURE__ */ jsx("div", { className: "[&_mark]:rounded-sm [&_mark]:bg-ai-accent/20 [&_mark]:px-0.5 [&_mark]:font-medium [&_mark]:text-foreground", children })
|
|
2771
|
-
] });
|
|
2772
|
-
return /* @__PURE__ */ jsxs(
|
|
2773
|
-
"div",
|
|
2774
|
-
{
|
|
2775
|
-
className: cn(
|
|
2776
|
-
"group rounded-lg border border-border bg-card p-3 text-left transition-colors",
|
|
2777
|
-
onClick && "hover:border-ai-accent/40 focus-within:ring-2 focus-within:ring-ai-accent/40",
|
|
2778
|
-
active && "border-ai-accent/60 ring-1 ring-ai-accent/30",
|
|
2779
|
-
className
|
|
2780
|
-
),
|
|
2781
|
-
children: [
|
|
2782
|
-
onClick ? /* @__PURE__ */ jsx(
|
|
2783
|
-
"div",
|
|
2784
|
-
{
|
|
2785
|
-
role: "button",
|
|
2786
|
-
tabIndex: 0,
|
|
2787
|
-
onClick,
|
|
2788
|
-
onKeyDown: (e) => {
|
|
2789
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
2790
|
-
e.preventDefault();
|
|
2791
|
-
onClick(e);
|
|
2792
|
-
}
|
|
2793
|
-
},
|
|
2794
|
-
"aria-current": active || void 0,
|
|
2795
|
-
"data-testid": testId,
|
|
2796
|
-
className: "cursor-pointer focus:outline-none",
|
|
2797
|
-
children: body
|
|
2798
|
-
}
|
|
2799
|
-
) : /* @__PURE__ */ jsx("div", { "aria-current": active || void 0, "data-testid": testId, children: body }),
|
|
2800
|
-
footer
|
|
2801
|
-
]
|
|
2802
|
-
}
|
|
2803
|
-
);
|
|
2804
|
-
}
|
|
2805
2391
|
function queryTerms(query) {
|
|
2806
2392
|
const terms = /* @__PURE__ */ new Set();
|
|
2807
2393
|
for (const phrase of query.match(/"([^"]+)"/g) ?? []) {
|
|
@@ -3093,7 +2679,8 @@ var CitationRendererComponent = ({
|
|
|
3093
2679
|
onActivateChunk,
|
|
3094
2680
|
useCitationState,
|
|
3095
2681
|
onCloseCitation,
|
|
3096
|
-
onDismissCitation
|
|
2682
|
+
onDismissCitation,
|
|
2683
|
+
notify: notify2
|
|
3097
2684
|
}) => {
|
|
3098
2685
|
const chunkMap = useMemo(() => {
|
|
3099
2686
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -3145,6 +2732,7 @@ var CitationRendererComponent = ({
|
|
|
3145
2732
|
useCitationState,
|
|
3146
2733
|
onCloseCitation,
|
|
3147
2734
|
onDismissCitation,
|
|
2735
|
+
notify: notify2,
|
|
3148
2736
|
children
|
|
3149
2737
|
},
|
|
3150
2738
|
citationKey
|
|
@@ -3162,7 +2750,8 @@ var CitationRendererComponent = ({
|
|
|
3162
2750
|
ExternalLink,
|
|
3163
2751
|
useCitationState,
|
|
3164
2752
|
onCloseCitation,
|
|
3165
|
-
onDismissCitation
|
|
2753
|
+
onDismissCitation,
|
|
2754
|
+
notify2
|
|
3166
2755
|
]);
|
|
3167
2756
|
return /* @__PURE__ */ jsx("div", { className: cn("citation-container", className), "data-testid": "citation-renderer", children: renderMarkdown({ components: markdownComponents, isStreaming, children: content }) });
|
|
3168
2757
|
};
|
|
@@ -3176,28 +2765,51 @@ var CitationPopover = ({
|
|
|
3176
2765
|
useCitationState,
|
|
3177
2766
|
onCloseCitation,
|
|
3178
2767
|
onDismissCitation,
|
|
2768
|
+
notify: notify2,
|
|
3179
2769
|
children
|
|
3180
2770
|
}) => {
|
|
3181
2771
|
const { activeCitationKey, viewingPassageId, isOnConversationPage } = useCitationState();
|
|
3182
2772
|
const isActive = activeCitationKey === `${messageId}-${citationNum}`;
|
|
3183
2773
|
const open = isActive && isOnConversationPage;
|
|
3184
|
-
|
|
3185
|
-
()
|
|
3186
|
-
|
|
3187
|
-
);
|
|
2774
|
+
useEffect(() => {
|
|
2775
|
+
if (isActive && !isOnConversationPage) onDismissCitation();
|
|
2776
|
+
}, [isActive, isOnConversationPage, onDismissCitation]);
|
|
3188
2777
|
const triggerRef = useRef(null);
|
|
3189
|
-
const
|
|
2778
|
+
const dialogRef = useRef(null);
|
|
2779
|
+
const restoreFocusRef = useRef(false);
|
|
2780
|
+
const dismiss = useCallback(() => {
|
|
2781
|
+
restoreFocusRef.current = true;
|
|
2782
|
+
onDismissCitation();
|
|
2783
|
+
}, [onDismissCitation]);
|
|
2784
|
+
useEffect(() => {
|
|
2785
|
+
if (!open) return;
|
|
2786
|
+
dialogRef.current?.focus({ preventScroll: true });
|
|
2787
|
+
return () => {
|
|
2788
|
+
if (!restoreFocusRef.current) return;
|
|
2789
|
+
restoreFocusRef.current = false;
|
|
2790
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
2791
|
+
};
|
|
2792
|
+
}, [open]);
|
|
2793
|
+
useEffect(() => {
|
|
2794
|
+
if (!open) return;
|
|
2795
|
+
const onKeyDown = (e) => {
|
|
2796
|
+
if (e.key === "Escape") dismiss();
|
|
2797
|
+
};
|
|
2798
|
+
document.addEventListener("keydown", onKeyDown);
|
|
2799
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
2800
|
+
}, [open, dismiss]);
|
|
2801
|
+
const [dock, setDock] = useState({ left: 0, top: 0, width: 0 });
|
|
2802
|
+
useLayoutEffect(() => {
|
|
2803
|
+
if (!open) return;
|
|
2804
|
+
const edge = (document.querySelector('[data-testid="message-input-container"]') ?? document.querySelector('main[data-testid^="conversation-"]') ?? document.body).getBoundingClientRect();
|
|
2805
|
+
setDock({ left: edge.left, top: edge.top, width: edge.width });
|
|
2806
|
+
}, [open]);
|
|
3190
2807
|
const handleOpen = useCallback(() => {
|
|
3191
|
-
if (triggerRef.current && chatContainer) {
|
|
3192
|
-
const triggerLeft = triggerRef.current.getBoundingClientRect().left;
|
|
3193
|
-
const chatLeft = chatContainer.getBoundingClientRect().left;
|
|
3194
|
-
setAlignOffset(-(triggerLeft - chatLeft));
|
|
3195
|
-
}
|
|
3196
2808
|
onOpen();
|
|
3197
2809
|
if (chunks.length > 0) {
|
|
3198
2810
|
onChunkClick(chunks[0]);
|
|
3199
2811
|
}
|
|
3200
|
-
}, [onOpen, onChunkClick, chunks
|
|
2812
|
+
}, [onOpen, onChunkClick, chunks]);
|
|
3201
2813
|
const byDoc = useMemo(() => {
|
|
3202
2814
|
const map = /* @__PURE__ */ new Map();
|
|
3203
2815
|
chunks.forEach((chunk) => {
|
|
@@ -3208,182 +2820,187 @@ var CitationPopover = ({
|
|
|
3208
2820
|
});
|
|
3209
2821
|
return Array.from(map.entries()).map(([docId, val]) => ({ docId, ...val }));
|
|
3210
2822
|
}, [chunks]);
|
|
3211
|
-
|
|
3212
|
-
|
|
2823
|
+
const first = chunks[0];
|
|
2824
|
+
const firstText = first ? first.content.replace(/\n+/g, " ").trim() : "";
|
|
2825
|
+
const firstTitle = first ? first.metadata.doc_title ?? first.metadata.doc_ext_id ?? "" : "";
|
|
2826
|
+
const firstPage = first?.metadata.page_number;
|
|
2827
|
+
const copyCitation = useCallback(async () => {
|
|
2828
|
+
const source = [firstTitle, firstPage != null ? `p.${firstPage}` : null].filter(Boolean).join(", ");
|
|
2829
|
+
try {
|
|
2830
|
+
await navigator.clipboard.writeText(source ? `\u201C${firstText}\u201D (${source})` : firstText);
|
|
2831
|
+
notify2?.("Citation copied", "success");
|
|
2832
|
+
} catch {
|
|
2833
|
+
notify2?.("Could not copy the citation", "error");
|
|
2834
|
+
}
|
|
2835
|
+
}, [firstText, firstTitle, firstPage, notify2]);
|
|
2836
|
+
const items = isStreaming || chunks.length === 0 ? [] : [
|
|
3213
2837
|
{
|
|
3214
|
-
open,
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
2838
|
+
id: "open",
|
|
2839
|
+
label: "Open in viewer",
|
|
2840
|
+
primary: true,
|
|
2841
|
+
onSelect: handleOpen,
|
|
2842
|
+
testId: `citation-open-${citationNum}`
|
|
2843
|
+
},
|
|
2844
|
+
{
|
|
2845
|
+
id: "copy",
|
|
2846
|
+
label: "Copy citation",
|
|
2847
|
+
onSelect: () => void copyCitation(),
|
|
2848
|
+
testId: `citation-copy-${citationNum}`
|
|
2849
|
+
}
|
|
2850
|
+
];
|
|
2851
|
+
const preview = first ? /* @__PURE__ */ jsxs("div", { className: "max-w-xs", "data-testid": `citation-preview-${citationNum}`, children: [
|
|
2852
|
+
/* @__PURE__ */ jsx("span", { className: "block text-xs font-medium text-foreground", children: firstTitle }),
|
|
2853
|
+
firstPage != null && /* @__PURE__ */ jsxs("span", { className: "block text-xs text-muted-foreground", children: [
|
|
2854
|
+
"Page ",
|
|
2855
|
+
firstPage
|
|
2856
|
+
] }),
|
|
2857
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 line-clamp-4 block text-xs italic text-muted-foreground", children: /* @__PURE__ */ jsx(ReactMarkdown, { components: INLINE_MD_COMPONENTS, children: firstText }) }),
|
|
2858
|
+
chunks.length > 1 && /* @__PURE__ */ jsxs("span", { className: "mt-1 block text-xs text-muted-foreground", children: [
|
|
2859
|
+
"+",
|
|
2860
|
+
chunks.length - 1,
|
|
2861
|
+
" more passage",
|
|
2862
|
+
chunks.length > 2 ? "s" : ""
|
|
2863
|
+
] })
|
|
2864
|
+
] }) : void 0;
|
|
2865
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2866
|
+
/* @__PURE__ */ jsx(
|
|
2867
|
+
CitationLink,
|
|
2868
|
+
{
|
|
2869
|
+
triggerRef,
|
|
2870
|
+
citationNum,
|
|
2871
|
+
isActive,
|
|
2872
|
+
isStreaming,
|
|
2873
|
+
items,
|
|
2874
|
+
preview,
|
|
2875
|
+
children
|
|
2876
|
+
}
|
|
2877
|
+
),
|
|
2878
|
+
open && createPortal(
|
|
2879
|
+
/* @__PURE__ */ jsx(
|
|
2880
|
+
"div",
|
|
2881
|
+
{
|
|
2882
|
+
className: "pointer-events-none fixed z-[42] flex justify-center px-2",
|
|
2883
|
+
style: {
|
|
2884
|
+
left: dock.left,
|
|
2885
|
+
width: dock.width,
|
|
2886
|
+
bottom: window.innerHeight - dock.top + 8
|
|
2887
|
+
},
|
|
2888
|
+
children: /* @__PURE__ */ jsxs(
|
|
2889
|
+
"div",
|
|
2890
|
+
{
|
|
2891
|
+
ref: dialogRef,
|
|
2892
|
+
role: "dialog",
|
|
2893
|
+
tabIndex: -1,
|
|
2894
|
+
"aria-label": `Citation ${citationNum}`,
|
|
2895
|
+
className: "pointer-events-auto z-[42] max-h-[45vh] outline-none w-[min(100%,48rem)] min-w-0 overflow-y-auto rounded-md border border-border bg-popover p-0 text-popover-foreground shadow-xl",
|
|
2896
|
+
"data-testid": `citation-popover-${citationNum}`,
|
|
2897
|
+
children: [
|
|
2898
|
+
/* @__PURE__ */ jsxs("div", { className: "px-3 py-2 pointer-coarse:py-0 border-b border-border sticky top-0 bg-popover z-10 flex items-center justify-between gap-2", children: [
|
|
2899
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-semibold text-muted-foreground tracking-wide", children: [
|
|
2900
|
+
"Citation ",
|
|
2901
|
+
citationNum,
|
|
2902
|
+
" (",
|
|
2903
|
+
chunks.length,
|
|
2904
|
+
" passage",
|
|
2905
|
+
chunks.length !== 1 ? "s" : "",
|
|
2906
|
+
")"
|
|
2907
|
+
] }),
|
|
2908
|
+
/* @__PURE__ */ jsx(
|
|
2909
|
+
"button",
|
|
2910
|
+
{
|
|
2911
|
+
onClick: dismiss,
|
|
2912
|
+
className: "-m-1.5 flex shrink-0 items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground pointer-coarse:m-0 pointer-coarse:size-11 pointer-coarse:p-0",
|
|
2913
|
+
"aria-label": "Close",
|
|
2914
|
+
"data-testid": `citation-popover-close-${citationNum}`,
|
|
2915
|
+
children: /* @__PURE__ */ jsx(
|
|
2916
|
+
"svg",
|
|
2917
|
+
{
|
|
2918
|
+
width: "14",
|
|
2919
|
+
height: "14",
|
|
2920
|
+
viewBox: "0 0 12 12",
|
|
2921
|
+
fill: "none",
|
|
2922
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2923
|
+
children: /* @__PURE__ */ jsx(
|
|
2924
|
+
"path",
|
|
2925
|
+
{
|
|
2926
|
+
d: "M1 1L11 11M11 1L1 11",
|
|
2927
|
+
stroke: "currentColor",
|
|
2928
|
+
strokeWidth: "1.5",
|
|
2929
|
+
strokeLinecap: "round"
|
|
2930
|
+
}
|
|
2931
|
+
)
|
|
2932
|
+
}
|
|
2933
|
+
)
|
|
2934
|
+
}
|
|
2935
|
+
)
|
|
3260
2936
|
] }),
|
|
3261
|
-
/* @__PURE__ */
|
|
3262
|
-
"
|
|
3263
|
-
{
|
|
3264
|
-
onClick: onDismissCitation,
|
|
3265
|
-
className: "-m-1.5 flex shrink-0 items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
3266
|
-
"aria-label": "Close",
|
|
3267
|
-
"data-testid": `citation-popover-close-${citationNum}`,
|
|
3268
|
-
children: /* @__PURE__ */ jsx(
|
|
3269
|
-
"svg",
|
|
3270
|
-
{
|
|
3271
|
-
width: "14",
|
|
3272
|
-
height: "14",
|
|
3273
|
-
viewBox: "0 0 12 12",
|
|
3274
|
-
fill: "none",
|
|
3275
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3276
|
-
children: /* @__PURE__ */ jsx(
|
|
3277
|
-
"path",
|
|
3278
|
-
{
|
|
3279
|
-
d: "M1 1L11 11M11 1L1 11",
|
|
3280
|
-
stroke: "currentColor",
|
|
3281
|
-
strokeWidth: "1.5",
|
|
3282
|
-
strokeLinecap: "round"
|
|
3283
|
-
}
|
|
3284
|
-
)
|
|
3285
|
-
}
|
|
3286
|
-
)
|
|
3287
|
-
}
|
|
3288
|
-
)
|
|
3289
|
-
] }),
|
|
3290
|
-
(() => {
|
|
3291
|
-
let idx = 0;
|
|
3292
|
-
return byDoc.map(({ docId, title, chunks: docChunks }) => /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 border-b border-border last:border-0", children: [
|
|
3293
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-primary mb-1 truncate", title, children: title }),
|
|
2937
|
+
byDoc.map(({ docId, title, chunks: docChunks }) => /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 border-b border-border last:border-0", children: [
|
|
2938
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground mb-1 truncate", title, children: title }),
|
|
3294
2939
|
docChunks.map((chunk) => {
|
|
3295
|
-
idx++;
|
|
3296
2940
|
const isSelected = viewingPassageId === chunk.metadata.chunk_ext_id;
|
|
3297
|
-
return /* @__PURE__ */
|
|
2941
|
+
return /* @__PURE__ */ jsx(
|
|
3298
2942
|
"button",
|
|
3299
2943
|
{
|
|
3300
2944
|
"data-testid": `citation-chunk-${chunk.metadata.chunk_ext_id}`,
|
|
3301
2945
|
onClick: () => onChunkClick(chunk),
|
|
3302
2946
|
className: cn(
|
|
3303
|
-
"w-full text-left text-
|
|
3304
|
-
isSelected ? "bg-
|
|
2947
|
+
"w-full text-left text-sm rounded-md px-2 py-1.5 pointer-coarse:min-h-11 pointer-coarse:py-3 transition-colors flex items-start gap-2 mb-1 last:mb-0",
|
|
2948
|
+
isSelected ? "bg-ai-soft text-foreground ring-1 ring-ai-accent/40" : "text-muted-foreground hover:text-primary hover:bg-muted"
|
|
3305
2949
|
),
|
|
3306
|
-
children: [
|
|
3307
|
-
/* @__PURE__ */ jsxs("span", { className: "
|
|
3308
|
-
|
|
3309
|
-
"."
|
|
3310
|
-
] }),
|
|
3311
|
-
chunk.metadata.page_number != null && /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-[10px] font-mono bg-muted text-muted-foreground rounded-full px-1.5 py-0.5 mt-0.5", children: [
|
|
3312
|
-
"p.",
|
|
2950
|
+
children: /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
2951
|
+
chunk.metadata.page_number != null && /* @__PURE__ */ jsxs("span", { className: "block text-xs text-muted-foreground", children: [
|
|
2952
|
+
"Page ",
|
|
3313
2953
|
chunk.metadata.page_number
|
|
3314
2954
|
] }),
|
|
3315
|
-
/* @__PURE__ */
|
|
3316
|
-
|
|
3317
|
-
" ",
|
|
3318
|
-
/* @__PURE__ */ jsx(ReactMarkdown, { components: INLINE_MD_COMPONENTS, children: chunk.content.replace(/\n+/g, " ").trim() }),
|
|
3319
|
-
" ",
|
|
3320
|
-
/* @__PURE__ */ jsx("span", { children: "\u201D)" })
|
|
3321
|
-
] })
|
|
3322
|
-
]
|
|
2955
|
+
/* @__PURE__ */ jsx("span", { className: "line-clamp-3 italic", children: /* @__PURE__ */ jsx(ReactMarkdown, { components: INLINE_MD_COMPONENTS, children: chunk.content.replace(/\n+/g, " ").trim() }) })
|
|
2956
|
+
] })
|
|
3323
2957
|
},
|
|
3324
2958
|
chunk.metadata.chunk_ext_id
|
|
3325
2959
|
);
|
|
3326
2960
|
})
|
|
3327
|
-
] }, docId))
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
]
|
|
3333
|
-
}
|
|
3334
|
-
);
|
|
3335
|
-
};
|
|
3336
|
-
var CitationLink = React2.forwardRef(
|
|
3337
|
-
({ citationNum, isActive, isStreaming, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
3338
|
-
"span",
|
|
3339
|
-
{
|
|
3340
|
-
ref,
|
|
3341
|
-
className: cn(
|
|
3342
|
-
"cited-text transition-colors px-0.5 rounded inline-block",
|
|
3343
|
-
isStreaming ? "cursor-default" : "cursor-pointer",
|
|
3344
|
-
isActive ? "bg-yellow-100 dark:bg-yellow-900/30 hover:bg-yellow-200 dark:hover:bg-yellow-900/40" : "hover:bg-yellow-50 dark:hover:bg-yellow-900/20"
|
|
2961
|
+
] }, docId))
|
|
2962
|
+
]
|
|
2963
|
+
}
|
|
2964
|
+
)
|
|
2965
|
+
}
|
|
3345
2966
|
),
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
children,
|
|
3350
|
-
/* @__PURE__ */ jsx("sup", { className: "relative -top-2", children: /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center min-w-4 h-4 px-1 text-[10px] border border-muted bg-muted text-primary rounded font-normal cursor-pointer antialiased tabular-nums font-heading", children: citationNum }) })
|
|
3351
|
-
]
|
|
3352
|
-
}
|
|
3353
|
-
)
|
|
3354
|
-
);
|
|
3355
|
-
CitationLink.displayName = "CitationLink";
|
|
3356
|
-
var CitationRenderer = React2.memo(CitationRendererComponent);
|
|
3357
|
-
|
|
3358
|
-
// src/icons/colors.ts
|
|
3359
|
-
var NEUTRAL_GRAY = "#64748b";
|
|
3360
|
-
var FILE_TYPE_COLORS = {
|
|
3361
|
-
pdf: "#ef4444",
|
|
3362
|
-
// red
|
|
3363
|
-
doc: "#3b82f6",
|
|
3364
|
-
// blue (Word docs)
|
|
3365
|
-
docx: "#3b82f6",
|
|
3366
|
-
// blue
|
|
3367
|
-
html: "#0284c7",
|
|
3368
|
-
// sky-600 (web files)
|
|
3369
|
-
img: "#8b5cf6",
|
|
3370
|
-
// violet-500 (images)
|
|
3371
|
-
vid: "#10b981",
|
|
3372
|
-
// emerald-500 (video)
|
|
3373
|
-
aud: "#f59e0b",
|
|
3374
|
-
// amber-500 (audio)
|
|
3375
|
-
xls: "#16a34a",
|
|
3376
|
-
// green-600 (Excel)
|
|
3377
|
-
eml: "#0d9488",
|
|
3378
|
-
// teal-600 (email)
|
|
3379
|
-
txt: NEUTRAL_GRAY,
|
|
3380
|
-
// gray (plain text)
|
|
3381
|
-
generic: NEUTRAL_GRAY,
|
|
3382
|
-
// gray (unknown)
|
|
3383
|
-
white: "#ffffff"
|
|
3384
|
-
// for strokes/text on colored backgrounds
|
|
2967
|
+
document.body
|
|
2968
|
+
)
|
|
2969
|
+
] });
|
|
3385
2970
|
};
|
|
3386
|
-
var
|
|
2971
|
+
var CitationLink = ({
|
|
2972
|
+
citationNum,
|
|
2973
|
+
isActive,
|
|
2974
|
+
isStreaming,
|
|
2975
|
+
items,
|
|
2976
|
+
preview,
|
|
2977
|
+
triggerRef,
|
|
2978
|
+
children
|
|
2979
|
+
}) => /* @__PURE__ */ jsxs(
|
|
2980
|
+
MarkMenu,
|
|
2981
|
+
{
|
|
2982
|
+
triggerRef,
|
|
2983
|
+
items,
|
|
2984
|
+
preview: isStreaming ? void 0 : preview,
|
|
2985
|
+
menuLabel: `Citation ${citationNum}`,
|
|
2986
|
+
testId: `citation-link-${citationNum}`,
|
|
2987
|
+
tabIndex: isStreaming ? -1 : 0,
|
|
2988
|
+
"data-mark-kind": "citation",
|
|
2989
|
+
className: cn(
|
|
2990
|
+
"cited-text relative rounded-sm px-0.5 transition-colors",
|
|
2991
|
+
// 44px touch hit area without changing the text layout.
|
|
2992
|
+
"pointer-coarse:after:absolute pointer-coarse:after:content-[''] pointer-coarse:after:-inset-x-3 pointer-coarse:after:-inset-y-4",
|
|
2993
|
+
isStreaming ? "cursor-default" : "cursor-pointer",
|
|
2994
|
+
isActive ? "bg-ai-soft text-foreground" : "bg-ai-soft/30 hover:bg-ai-soft/70"
|
|
2995
|
+
),
|
|
2996
|
+
children: [
|
|
2997
|
+
children,
|
|
2998
|
+
/* @__PURE__ */ jsx("sup", { className: "ml-px align-super text-[0.7em] font-semibold leading-none tabular-nums text-ai-ink", children: citationNum })
|
|
2999
|
+
]
|
|
3000
|
+
}
|
|
3001
|
+
);
|
|
3002
|
+
var CitationRenderer = React.memo(CitationRendererComponent);
|
|
3003
|
+
var DocIcon = ({ size = 16, className = "" }) => {
|
|
3387
3004
|
return /* @__PURE__ */ jsxs(
|
|
3388
3005
|
"svg",
|
|
3389
3006
|
{
|
|
@@ -3398,8 +3015,8 @@ var PdfIcon = ({ size = 16, className = "" }) => {
|
|
|
3398
3015
|
"path",
|
|
3399
3016
|
{
|
|
3400
3017
|
d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
|
|
3401
|
-
fill: FILE_TYPE_COLORS.
|
|
3402
|
-
stroke: FILE_TYPE_COLORS.
|
|
3018
|
+
fill: FILE_TYPE_COLORS.doc,
|
|
3019
|
+
stroke: FILE_TYPE_COLORS.doc,
|
|
3403
3020
|
strokeWidth: "1",
|
|
3404
3021
|
strokeLinecap: "round",
|
|
3405
3022
|
strokeLinejoin: "round"
|
|
@@ -3426,14 +3043,14 @@ var PdfIcon = ({ size = 16, className = "" }) => {
|
|
|
3426
3043
|
textAnchor: "middle",
|
|
3427
3044
|
fontWeight: "bold",
|
|
3428
3045
|
fontFamily: "Arial, sans-serif",
|
|
3429
|
-
children: "
|
|
3046
|
+
children: "DOC"
|
|
3430
3047
|
}
|
|
3431
3048
|
)
|
|
3432
3049
|
]
|
|
3433
3050
|
}
|
|
3434
3051
|
);
|
|
3435
3052
|
};
|
|
3436
|
-
var
|
|
3053
|
+
var HtmlIcon = ({ size = 16, className = "" }) => {
|
|
3437
3054
|
return /* @__PURE__ */ jsxs(
|
|
3438
3055
|
"svg",
|
|
3439
3056
|
{
|
|
@@ -3448,8 +3065,8 @@ var DocIcon = ({ size = 16, className = "" }) => {
|
|
|
3448
3065
|
"path",
|
|
3449
3066
|
{
|
|
3450
3067
|
d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
|
|
3451
|
-
fill: FILE_TYPE_COLORS.
|
|
3452
|
-
stroke: FILE_TYPE_COLORS.
|
|
3068
|
+
fill: FILE_TYPE_COLORS.html,
|
|
3069
|
+
stroke: FILE_TYPE_COLORS.html,
|
|
3453
3070
|
strokeWidth: "1",
|
|
3454
3071
|
strokeLinecap: "round",
|
|
3455
3072
|
strokeLinejoin: "round"
|
|
@@ -3471,62 +3088,12 @@ var DocIcon = ({ size = 16, className = "" }) => {
|
|
|
3471
3088
|
{
|
|
3472
3089
|
x: "12",
|
|
3473
3090
|
y: "16",
|
|
3474
|
-
fontSize: "
|
|
3091
|
+
fontSize: "5",
|
|
3475
3092
|
fill: "white",
|
|
3476
3093
|
textAnchor: "middle",
|
|
3477
3094
|
fontWeight: "bold",
|
|
3478
3095
|
fontFamily: "Arial, sans-serif",
|
|
3479
|
-
children: "
|
|
3480
|
-
}
|
|
3481
|
-
)
|
|
3482
|
-
]
|
|
3483
|
-
}
|
|
3484
|
-
);
|
|
3485
|
-
};
|
|
3486
|
-
var HtmlIcon = ({ size = 16, className = "" }) => {
|
|
3487
|
-
return /* @__PURE__ */ jsxs(
|
|
3488
|
-
"svg",
|
|
3489
|
-
{
|
|
3490
|
-
width: size,
|
|
3491
|
-
height: size,
|
|
3492
|
-
viewBox: "0 0 24 24",
|
|
3493
|
-
fill: "none",
|
|
3494
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3495
|
-
className,
|
|
3496
|
-
children: [
|
|
3497
|
-
/* @__PURE__ */ jsx(
|
|
3498
|
-
"path",
|
|
3499
|
-
{
|
|
3500
|
-
d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
|
|
3501
|
-
fill: FILE_TYPE_COLORS.html,
|
|
3502
|
-
stroke: FILE_TYPE_COLORS.html,
|
|
3503
|
-
strokeWidth: "1",
|
|
3504
|
-
strokeLinecap: "round",
|
|
3505
|
-
strokeLinejoin: "round"
|
|
3506
|
-
}
|
|
3507
|
-
),
|
|
3508
|
-
/* @__PURE__ */ jsx(
|
|
3509
|
-
"path",
|
|
3510
|
-
{
|
|
3511
|
-
d: "M14 2v6h6",
|
|
3512
|
-
fill: "none",
|
|
3513
|
-
stroke: FILE_TYPE_COLORS.white,
|
|
3514
|
-
strokeWidth: "1",
|
|
3515
|
-
strokeLinecap: "round",
|
|
3516
|
-
strokeLinejoin: "round"
|
|
3517
|
-
}
|
|
3518
|
-
),
|
|
3519
|
-
/* @__PURE__ */ jsx(
|
|
3520
|
-
"text",
|
|
3521
|
-
{
|
|
3522
|
-
x: "12",
|
|
3523
|
-
y: "16",
|
|
3524
|
-
fontSize: "5",
|
|
3525
|
-
fill: "white",
|
|
3526
|
-
textAnchor: "middle",
|
|
3527
|
-
fontWeight: "bold",
|
|
3528
|
-
fontFamily: "Arial, sans-serif",
|
|
3529
|
-
children: "HTML"
|
|
3096
|
+
children: "HTML"
|
|
3530
3097
|
}
|
|
3531
3098
|
)
|
|
3532
3099
|
]
|
|
@@ -3633,207 +3200,6 @@ var XlsIcon = ({ size = 16, className = "" }) => {
|
|
|
3633
3200
|
}
|
|
3634
3201
|
);
|
|
3635
3202
|
};
|
|
3636
|
-
var AudIcon = ({ size = 16, className = "" }) => {
|
|
3637
|
-
return /* @__PURE__ */ jsxs(
|
|
3638
|
-
"svg",
|
|
3639
|
-
{
|
|
3640
|
-
width: size,
|
|
3641
|
-
height: size,
|
|
3642
|
-
viewBox: "0 0 24 24",
|
|
3643
|
-
fill: "none",
|
|
3644
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3645
|
-
className,
|
|
3646
|
-
children: [
|
|
3647
|
-
/* @__PURE__ */ jsx(
|
|
3648
|
-
"path",
|
|
3649
|
-
{
|
|
3650
|
-
d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
|
|
3651
|
-
fill: FILE_TYPE_COLORS.aud,
|
|
3652
|
-
stroke: FILE_TYPE_COLORS.aud,
|
|
3653
|
-
strokeWidth: "1",
|
|
3654
|
-
strokeLinecap: "round",
|
|
3655
|
-
strokeLinejoin: "round"
|
|
3656
|
-
}
|
|
3657
|
-
),
|
|
3658
|
-
/* @__PURE__ */ jsx(
|
|
3659
|
-
"path",
|
|
3660
|
-
{
|
|
3661
|
-
d: "M14 2v6h6",
|
|
3662
|
-
fill: "none",
|
|
3663
|
-
stroke: FILE_TYPE_COLORS.white,
|
|
3664
|
-
strokeWidth: "1",
|
|
3665
|
-
strokeLinecap: "round",
|
|
3666
|
-
strokeLinejoin: "round"
|
|
3667
|
-
}
|
|
3668
|
-
),
|
|
3669
|
-
/* @__PURE__ */ jsx(
|
|
3670
|
-
"text",
|
|
3671
|
-
{
|
|
3672
|
-
x: "12",
|
|
3673
|
-
y: "16",
|
|
3674
|
-
fontSize: "6",
|
|
3675
|
-
fill: "white",
|
|
3676
|
-
textAnchor: "middle",
|
|
3677
|
-
fontWeight: "bold",
|
|
3678
|
-
fontFamily: "Arial, sans-serif",
|
|
3679
|
-
children: "AUD"
|
|
3680
|
-
}
|
|
3681
|
-
)
|
|
3682
|
-
]
|
|
3683
|
-
}
|
|
3684
|
-
);
|
|
3685
|
-
};
|
|
3686
|
-
var ImgIcon = ({ size = 16, className = "" }) => {
|
|
3687
|
-
return /* @__PURE__ */ jsxs(
|
|
3688
|
-
"svg",
|
|
3689
|
-
{
|
|
3690
|
-
width: size,
|
|
3691
|
-
height: size,
|
|
3692
|
-
viewBox: "0 0 24 24",
|
|
3693
|
-
fill: "none",
|
|
3694
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3695
|
-
className,
|
|
3696
|
-
children: [
|
|
3697
|
-
/* @__PURE__ */ jsx(
|
|
3698
|
-
"path",
|
|
3699
|
-
{
|
|
3700
|
-
d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
|
|
3701
|
-
fill: FILE_TYPE_COLORS.img,
|
|
3702
|
-
stroke: FILE_TYPE_COLORS.img,
|
|
3703
|
-
strokeWidth: "1",
|
|
3704
|
-
strokeLinecap: "round",
|
|
3705
|
-
strokeLinejoin: "round"
|
|
3706
|
-
}
|
|
3707
|
-
),
|
|
3708
|
-
/* @__PURE__ */ jsx(
|
|
3709
|
-
"path",
|
|
3710
|
-
{
|
|
3711
|
-
d: "M14 2v6h6",
|
|
3712
|
-
fill: "none",
|
|
3713
|
-
stroke: FILE_TYPE_COLORS.white,
|
|
3714
|
-
strokeWidth: "1",
|
|
3715
|
-
strokeLinecap: "round",
|
|
3716
|
-
strokeLinejoin: "round"
|
|
3717
|
-
}
|
|
3718
|
-
),
|
|
3719
|
-
/* @__PURE__ */ jsx(
|
|
3720
|
-
"text",
|
|
3721
|
-
{
|
|
3722
|
-
x: "12",
|
|
3723
|
-
y: "16",
|
|
3724
|
-
fontSize: "6",
|
|
3725
|
-
fill: "white",
|
|
3726
|
-
textAnchor: "middle",
|
|
3727
|
-
fontWeight: "bold",
|
|
3728
|
-
fontFamily: "Arial, sans-serif",
|
|
3729
|
-
children: "IMG"
|
|
3730
|
-
}
|
|
3731
|
-
)
|
|
3732
|
-
]
|
|
3733
|
-
}
|
|
3734
|
-
);
|
|
3735
|
-
};
|
|
3736
|
-
var VidIcon = ({ size = 16, className = "" }) => {
|
|
3737
|
-
return /* @__PURE__ */ jsxs(
|
|
3738
|
-
"svg",
|
|
3739
|
-
{
|
|
3740
|
-
width: size,
|
|
3741
|
-
height: size,
|
|
3742
|
-
viewBox: "0 0 24 24",
|
|
3743
|
-
fill: "none",
|
|
3744
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3745
|
-
className,
|
|
3746
|
-
children: [
|
|
3747
|
-
/* @__PURE__ */ jsx(
|
|
3748
|
-
"path",
|
|
3749
|
-
{
|
|
3750
|
-
d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
|
|
3751
|
-
fill: FILE_TYPE_COLORS.vid,
|
|
3752
|
-
stroke: FILE_TYPE_COLORS.vid,
|
|
3753
|
-
strokeWidth: "1",
|
|
3754
|
-
strokeLinecap: "round",
|
|
3755
|
-
strokeLinejoin: "round"
|
|
3756
|
-
}
|
|
3757
|
-
),
|
|
3758
|
-
/* @__PURE__ */ jsx(
|
|
3759
|
-
"path",
|
|
3760
|
-
{
|
|
3761
|
-
d: "M14 2v6h6",
|
|
3762
|
-
fill: "none",
|
|
3763
|
-
stroke: FILE_TYPE_COLORS.white,
|
|
3764
|
-
strokeWidth: "1",
|
|
3765
|
-
strokeLinecap: "round",
|
|
3766
|
-
strokeLinejoin: "round"
|
|
3767
|
-
}
|
|
3768
|
-
),
|
|
3769
|
-
/* @__PURE__ */ jsx(
|
|
3770
|
-
"text",
|
|
3771
|
-
{
|
|
3772
|
-
x: "12",
|
|
3773
|
-
y: "16",
|
|
3774
|
-
fontSize: "6",
|
|
3775
|
-
fill: "white",
|
|
3776
|
-
textAnchor: "middle",
|
|
3777
|
-
fontWeight: "bold",
|
|
3778
|
-
fontFamily: "Arial, sans-serif",
|
|
3779
|
-
children: "VID"
|
|
3780
|
-
}
|
|
3781
|
-
)
|
|
3782
|
-
]
|
|
3783
|
-
}
|
|
3784
|
-
);
|
|
3785
|
-
};
|
|
3786
|
-
var EmlIcon = ({ size = 16, className = "" }) => {
|
|
3787
|
-
return /* @__PURE__ */ jsxs(
|
|
3788
|
-
"svg",
|
|
3789
|
-
{
|
|
3790
|
-
width: size,
|
|
3791
|
-
height: size,
|
|
3792
|
-
viewBox: "0 0 24 24",
|
|
3793
|
-
fill: "none",
|
|
3794
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3795
|
-
className,
|
|
3796
|
-
children: [
|
|
3797
|
-
/* @__PURE__ */ jsx(
|
|
3798
|
-
"path",
|
|
3799
|
-
{
|
|
3800
|
-
d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z",
|
|
3801
|
-
fill: FILE_TYPE_COLORS.eml,
|
|
3802
|
-
stroke: FILE_TYPE_COLORS.eml,
|
|
3803
|
-
strokeWidth: "1",
|
|
3804
|
-
strokeLinecap: "round",
|
|
3805
|
-
strokeLinejoin: "round"
|
|
3806
|
-
}
|
|
3807
|
-
),
|
|
3808
|
-
/* @__PURE__ */ jsx(
|
|
3809
|
-
"path",
|
|
3810
|
-
{
|
|
3811
|
-
d: "M14 2v6h6",
|
|
3812
|
-
fill: "none",
|
|
3813
|
-
stroke: FILE_TYPE_COLORS.white,
|
|
3814
|
-
strokeWidth: "1",
|
|
3815
|
-
strokeLinecap: "round",
|
|
3816
|
-
strokeLinejoin: "round"
|
|
3817
|
-
}
|
|
3818
|
-
),
|
|
3819
|
-
/* @__PURE__ */ jsx(
|
|
3820
|
-
"rect",
|
|
3821
|
-
{
|
|
3822
|
-
x: "7",
|
|
3823
|
-
y: "12",
|
|
3824
|
-
width: "10",
|
|
3825
|
-
height: "7",
|
|
3826
|
-
rx: "1",
|
|
3827
|
-
fill: "none",
|
|
3828
|
-
stroke: "white",
|
|
3829
|
-
strokeWidth: "1.2"
|
|
3830
|
-
}
|
|
3831
|
-
),
|
|
3832
|
-
/* @__PURE__ */ jsx("path", { d: "M7 13l5 3 5-3", fill: "none", stroke: "white", strokeWidth: "1.2", strokeLinejoin: "round" })
|
|
3833
|
-
]
|
|
3834
|
-
}
|
|
3835
|
-
);
|
|
3836
|
-
};
|
|
3837
3203
|
var FileIcon = ({ size = 16, className = "" }) => {
|
|
3838
3204
|
return /* @__PURE__ */ jsxs(
|
|
3839
3205
|
"svg",
|
|
@@ -4154,855 +3520,67 @@ var ArbiIcon = ({
|
|
|
4154
3520
|
size = 20,
|
|
4155
3521
|
className = "",
|
|
4156
3522
|
"aria-label": ariaLabel = "ARBI Docs",
|
|
4157
|
-
"aria-hidden": ariaHidden = false
|
|
4158
|
-
}) => {
|
|
4159
|
-
return /* @__PURE__ */ jsx(
|
|
4160
|
-
"img",
|
|
4161
|
-
{
|
|
4162
|
-
src: "/favicon.svg",
|
|
4163
|
-
alt: ariaLabel,
|
|
4164
|
-
className: `rounded object-contain ${className}`,
|
|
4165
|
-
style: { width: size, height: size },
|
|
4166
|
-
"aria-label": ariaLabel,
|
|
4167
|
-
"aria-hidden": ariaHidden
|
|
4168
|
-
}
|
|
4169
|
-
);
|
|
4170
|
-
};
|
|
4171
|
-
var ArbiBotHeadIcon = ({ size = 24, className = "" }) => {
|
|
4172
|
-
const maskId = useId();
|
|
4173
|
-
return /* @__PURE__ */ jsxs(
|
|
4174
|
-
"svg",
|
|
4175
|
-
{
|
|
4176
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4177
|
-
width: size,
|
|
4178
|
-
height: size,
|
|
4179
|
-
viewBox: "30 -5 190 190",
|
|
4180
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
4181
|
-
className,
|
|
4182
|
-
children: [
|
|
4183
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("mask", { id: maskId, children: /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", children: [
|
|
4184
|
-
/* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "2500", height: "2500", fill: "white" }),
|
|
4185
|
-
/* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "190", fill: "black" }),
|
|
4186
|
-
/* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "50", fill: "white" }),
|
|
4187
|
-
/* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "190", fill: "black" }),
|
|
4188
|
-
/* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "50", fill: "white" })
|
|
4189
|
-
] }) }) }),
|
|
4190
|
-
/* @__PURE__ */ jsxs("g", { mask: `url(#${maskId})`, children: [
|
|
4191
|
-
/* @__PURE__ */ jsx(
|
|
4192
|
-
"g",
|
|
4193
|
-
{
|
|
4194
|
-
transform: "translate(0,250) scale(0.1,-0.1)",
|
|
4195
|
-
fill: "currentColor",
|
|
4196
|
-
stroke: "currentColor",
|
|
4197
|
-
strokeWidth: "100",
|
|
4198
|
-
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" })
|
|
4199
|
-
}
|
|
4200
|
-
),
|
|
4201
|
-
/* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
|
|
4202
|
-
/* @__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" }),
|
|
4203
|
-
/* @__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" }),
|
|
4204
|
-
/* @__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" })
|
|
4205
|
-
] })
|
|
4206
|
-
] })
|
|
4207
|
-
]
|
|
4208
|
-
}
|
|
4209
|
-
);
|
|
4210
|
-
};
|
|
4211
|
-
var ArbiBotIcon = ({ size = 24, className = "" }) => {
|
|
4212
|
-
const maskId = useId();
|
|
4213
|
-
return /* @__PURE__ */ jsxs(
|
|
4214
|
-
"svg",
|
|
4215
|
-
{
|
|
4216
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4217
|
-
width: size,
|
|
4218
|
-
height: size,
|
|
4219
|
-
viewBox: "0 0 250 250",
|
|
4220
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
4221
|
-
className,
|
|
4222
|
-
children: [
|
|
4223
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("mask", { id: maskId, children: /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", children: [
|
|
4224
|
-
/* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "2500", height: "2500", fill: "white" }),
|
|
4225
|
-
/* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "190", fill: "black" }),
|
|
4226
|
-
/* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "50", fill: "white" }),
|
|
4227
|
-
/* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "190", fill: "black" }),
|
|
4228
|
-
/* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "50", fill: "white" })
|
|
4229
|
-
] }) }) }),
|
|
4230
|
-
/* @__PURE__ */ jsxs("g", { mask: `url(#${maskId})`, children: [
|
|
4231
|
-
/* @__PURE__ */ jsx(
|
|
4232
|
-
"g",
|
|
4233
|
-
{
|
|
4234
|
-
transform: "translate(0,250) scale(0.1,-0.1)",
|
|
4235
|
-
fill: "currentColor",
|
|
4236
|
-
stroke: "currentColor",
|
|
4237
|
-
strokeWidth: "100",
|
|
4238
|
-
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" })
|
|
4239
|
-
}
|
|
4240
|
-
),
|
|
4241
|
-
/* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
|
|
4242
|
-
/* @__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" }),
|
|
4243
|
-
/* @__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" }),
|
|
4244
|
-
/* @__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" }),
|
|
4245
|
-
/* @__PURE__ */ jsx("g", { transform: "translate(564,0)", children: /* @__PURE__ */ jsx(
|
|
4246
|
-
"path",
|
|
4247
|
-
{
|
|
4248
|
-
d: "M515 353 c-49 -136 -91 -253 -93 -261 -3 -10 11 -12 60 -10 l63 3 19 53 19 52 91 0 92 0 18 -55 17 -56 62 3 c76 4 79 -24 -30 275 l-88 243 -70 0 -70 0 -90 -247z m215 -55 c0 -4 -27 -8 -59 -8 l-60 0 31 92 31 93 29 -85 c15 -46 28 -88 28 -92z",
|
|
4249
|
-
stroke: "currentColor",
|
|
4250
|
-
strokeWidth: "30"
|
|
4251
|
-
}
|
|
4252
|
-
) })
|
|
4253
|
-
] })
|
|
4254
|
-
] })
|
|
4255
|
-
]
|
|
4256
|
-
}
|
|
4257
|
-
);
|
|
4258
|
-
};
|
|
4259
|
-
function getDocumentTitle(document2, defaultValue = "") {
|
|
4260
|
-
if (!document2) return defaultValue;
|
|
4261
|
-
return document2.doc_metadata?.title || document2.file_name || defaultValue;
|
|
4262
|
-
}
|
|
4263
|
-
var MAX_LABEL_CHARS = 30;
|
|
4264
|
-
function clampLabel(text) {
|
|
4265
|
-
return text.length > MAX_LABEL_CHARS ? `${text.slice(0, MAX_LABEL_CHARS).trimEnd()}\u2026` : text;
|
|
4266
|
-
}
|
|
4267
|
-
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp"]);
|
|
4268
|
-
var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set(["mp4", "mpeg", "mpg", "webm", "mov", "avi", "mkv"]);
|
|
4269
|
-
var AUDIO_EXTENSIONS = /* @__PURE__ */ new Set(["mp3", "wav", "m4a", "aac", "ogg", "flac"]);
|
|
4270
|
-
var EMAIL_EXTENSIONS = /* @__PURE__ */ new Set(["eml", "msg"]);
|
|
4271
|
-
function getDocIcon(fileName, iconSize = 14) {
|
|
4272
|
-
const ext = fileName?.split(".").pop()?.toLowerCase();
|
|
4273
|
-
if (ext && VIDEO_EXTENSIONS.has(ext)) return /* @__PURE__ */ jsx(VidIcon, { size: iconSize, className: "flex-shrink-0" });
|
|
4274
|
-
if (ext && AUDIO_EXTENSIONS.has(ext)) return /* @__PURE__ */ jsx(AudIcon, { size: iconSize, className: "flex-shrink-0" });
|
|
4275
|
-
if (ext && IMAGE_EXTENSIONS.has(ext)) return /* @__PURE__ */ jsx(ImgIcon, { size: iconSize, className: "flex-shrink-0" });
|
|
4276
|
-
if (ext && EMAIL_EXTENSIONS.has(ext)) return /* @__PURE__ */ jsx(EmlIcon, { size: iconSize, className: "flex-shrink-0" });
|
|
4277
|
-
return /* @__PURE__ */ jsx(PdfIcon, { size: iconSize, className: "flex-shrink-0" });
|
|
4278
|
-
}
|
|
4279
|
-
function DocumentEntity({
|
|
4280
|
-
doc,
|
|
4281
|
-
icon,
|
|
4282
|
-
size = "sm",
|
|
4283
|
-
labelMaxWidth,
|
|
4284
|
-
labelClassName,
|
|
4285
|
-
onClick,
|
|
4286
|
-
onIconClick,
|
|
4287
|
-
viewing,
|
|
4288
|
-
iconBadge,
|
|
4289
|
-
actions,
|
|
4290
|
-
tooltipContent,
|
|
4291
|
-
className,
|
|
4292
|
-
fullWidth,
|
|
4293
|
-
noClamp
|
|
4294
|
-
}) {
|
|
4295
|
-
const title = getDocumentTitle(doc);
|
|
4296
|
-
const ext = doc.file_name?.split(".").pop()?.toLowerCase();
|
|
4297
|
-
const iconSize = size === "base" ? 16 : 14;
|
|
4298
|
-
const eyeSizeClass = size === "base" ? "h-4 w-4" : "h-3.5 w-3.5";
|
|
4299
|
-
const baseIcon = icon ?? getDocIcon(doc.file_name, iconSize);
|
|
4300
|
-
const displayIcon = viewing || iconBadge ? /* @__PURE__ */ jsxs("span", { className: "relative inline-flex flex-shrink-0 items-center justify-center", children: [
|
|
4301
|
-
viewing ? /* @__PURE__ */ jsx(Eye, { className: cn("text-primary-foreground", eyeSizeClass) }) : baseIcon,
|
|
4302
|
-
iconBadge
|
|
4303
|
-
] }) : baseIcon;
|
|
4304
|
-
const defaultTooltip = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 text-xs max-w-[440px]", children: [
|
|
4305
|
-
doc.folder && // `flex-wrap` so a deep folder path wraps WITHIN the balloon instead of
|
|
4306
|
-
// spilling out of it (each path segment is atomic and wraps as a unit;
|
|
4307
|
-
// `min-w-0` + `break-all` lets a single over-long segment break too).
|
|
4308
|
-
/* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-center gap-0.5 text-muted-foreground", children: [
|
|
4309
|
-
/* @__PURE__ */ jsx(FolderOpen, { className: "h-3 w-3 text-yellow-600 shrink-0" }),
|
|
4310
|
-
doc.folder.split("/").map((part, i, arr) => /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
4311
|
-
i > 0 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/50 mx-0.5", children: "/" }),
|
|
4312
|
-
/* @__PURE__ */ jsx("span", { className: `break-all ${i < arr.length - 1 ? "text-muted-foreground/70" : ""}`, children: part })
|
|
4313
|
-
] }, i))
|
|
4314
|
-
] }),
|
|
4315
|
-
/* @__PURE__ */ jsxs("span", { className: "font-medium break-words", children: [
|
|
4316
|
-
title,
|
|
4317
|
-
ext ? `.${ext}` : ""
|
|
4318
|
-
] })
|
|
4319
|
-
] });
|
|
4320
|
-
return /* @__PURE__ */ jsx(
|
|
4321
|
-
EntityPill,
|
|
4322
|
-
{
|
|
4323
|
-
icon: displayIcon,
|
|
4324
|
-
size,
|
|
4325
|
-
label: fullWidth || noClamp ? title : clampLabel(title),
|
|
4326
|
-
labelMaxWidth: labelMaxWidth ?? "max-w-[140px]",
|
|
4327
|
-
labelClassName,
|
|
4328
|
-
fullWidth,
|
|
4329
|
-
onClick,
|
|
4330
|
-
onIconClick,
|
|
4331
|
-
moreContent: actions,
|
|
4332
|
-
className,
|
|
4333
|
-
highlight: viewing,
|
|
4334
|
-
tooltipContent: tooltipContent ?? defaultTooltip
|
|
4335
|
-
}
|
|
4336
|
-
);
|
|
4337
|
-
}
|
|
4338
|
-
var VARIANT_STYLES = {
|
|
4339
|
-
"mine-paid": {
|
|
4340
|
-
pill: "bg-primary/10 text-primary border-border/60",
|
|
4341
|
-
icon: "text-primary"
|
|
4342
|
-
},
|
|
4343
|
-
other: {
|
|
4344
|
-
pill: "bg-secondary/10 text-secondary border-border/60",
|
|
4345
|
-
icon: "text-secondary"
|
|
4346
|
-
},
|
|
4347
|
-
"mine-free": {
|
|
4348
|
-
pill: "bg-muted-foreground/10 text-muted-foreground border-border/60",
|
|
4349
|
-
icon: "text-muted-foreground"
|
|
4350
|
-
},
|
|
4351
|
-
common: {
|
|
4352
|
-
pill: "",
|
|
4353
|
-
icon: "text-muted-foreground"
|
|
4354
|
-
}
|
|
4355
|
-
};
|
|
4356
|
-
function resolveVariant(relation, paid, hasCollaborators) {
|
|
4357
|
-
if (relation === "common") return "common";
|
|
4358
|
-
if (relation === "other") return "other";
|
|
4359
|
-
if (relation === "mine") return paid ? "mine-paid" : "mine-free";
|
|
4360
|
-
if (paid) return hasCollaborators ? "other" : "mine-paid";
|
|
4361
|
-
return "mine-free";
|
|
4362
|
-
}
|
|
4363
|
-
function ProjectEntity({
|
|
4364
|
-
name,
|
|
4365
|
-
label,
|
|
4366
|
-
icon,
|
|
4367
|
-
subscription = "none",
|
|
4368
|
-
hasCollaborators = false,
|
|
4369
|
-
size = "sm",
|
|
4370
|
-
className,
|
|
4371
|
-
onClick,
|
|
4372
|
-
relation,
|
|
4373
|
-
isPaid,
|
|
4374
|
-
tooltipContent
|
|
4375
|
-
}) {
|
|
4376
|
-
const paid = isPaid ?? (subscription === "active" || subscription === "past_due" || subscription === "dev");
|
|
4377
|
-
const variant = resolveVariant(relation, paid, hasCollaborators);
|
|
4378
|
-
const { pill, icon: iconClass } = VARIANT_STYLES[variant];
|
|
4379
|
-
const iconSizeClass = size === "base" ? "h-4 w-4" : "h-3.5 w-3.5";
|
|
4380
|
-
const iconNode = icon ?? /* @__PURE__ */ jsx(CreditCard, { className: cn(iconSizeClass, iconClass) });
|
|
4381
|
-
return /* @__PURE__ */ jsx(
|
|
4382
|
-
EntityPill,
|
|
4383
|
-
{
|
|
4384
|
-
icon: iconNode,
|
|
4385
|
-
label: label ?? name,
|
|
4386
|
-
size,
|
|
4387
|
-
shape: "rounded",
|
|
4388
|
-
className: cn(pill, className),
|
|
4389
|
-
onClick,
|
|
4390
|
-
tooltipContent
|
|
4391
|
-
}
|
|
4392
|
-
);
|
|
4393
|
-
}
|
|
4394
|
-
var sizeClasses = {
|
|
4395
|
-
xs: "h-5 w-5",
|
|
4396
|
-
sm: "h-6 w-6",
|
|
4397
|
-
md: "h-8 w-8",
|
|
4398
|
-
lg: "h-10 w-10"
|
|
4399
|
-
};
|
|
4400
|
-
var textSizeClasses = {
|
|
4401
|
-
xs: "text-xs",
|
|
4402
|
-
sm: "text-xs",
|
|
4403
|
-
md: "text-xs",
|
|
4404
|
-
lg: "text-sm"
|
|
4405
|
-
};
|
|
4406
|
-
var presenceDotClasses = {
|
|
4407
|
-
xs: "w-2 h-2 border",
|
|
4408
|
-
sm: "w-2.5 h-2.5 border",
|
|
4409
|
-
md: "w-3 h-3 border-2",
|
|
4410
|
-
lg: "w-3.5 h-3.5 border-2"
|
|
4411
|
-
};
|
|
4412
|
-
var presencePositionClasses = {
|
|
4413
|
-
xs: "-right-1 bottom-0",
|
|
4414
|
-
sm: "-right-1 bottom-0",
|
|
4415
|
-
md: "-right-1.5 -bottom-0.5",
|
|
4416
|
-
lg: "-right-1.5 -bottom-0.5"
|
|
4417
|
-
};
|
|
4418
|
-
var PRESENCE_LABELS = {
|
|
4419
|
-
connected: "Online",
|
|
4420
|
-
connecting: "Connecting",
|
|
4421
|
-
disconnected: "Offline",
|
|
4422
|
-
error: "Connection problem",
|
|
4423
|
-
hidden: "Status hidden"
|
|
4424
|
-
};
|
|
4425
|
-
var presenceColorClasses = {
|
|
4426
|
-
connected: "bg-status-online",
|
|
4427
|
-
connecting: "bg-status-connecting",
|
|
4428
|
-
disconnected: "bg-status-away",
|
|
4429
|
-
error: "bg-status-busy",
|
|
4430
|
-
hidden: "bg-status-offline"
|
|
4431
|
-
};
|
|
4432
|
-
var UserEntity = memo(function UserEntity2({
|
|
4433
|
-
size = "md",
|
|
4434
|
-
variant = "pill",
|
|
4435
|
-
className,
|
|
4436
|
-
showTooltip = true,
|
|
4437
|
-
interactive = true,
|
|
4438
|
-
hasUnreadMessages = false,
|
|
4439
|
-
initials = "",
|
|
4440
|
-
displayName = "",
|
|
4441
|
-
picture,
|
|
4442
|
-
colorClass = "",
|
|
4443
|
-
isAgent = false,
|
|
4444
|
-
agentStyle,
|
|
4445
|
-
avatarStyle,
|
|
4446
|
-
isMe = false,
|
|
4447
|
-
displayStatus,
|
|
4448
|
-
onClick,
|
|
4449
|
-
tooltipContent,
|
|
4450
|
-
empty = false
|
|
4451
|
-
}) {
|
|
4452
|
-
if (empty) {
|
|
4453
|
-
return /* @__PURE__ */ jsx(
|
|
4454
|
-
Avatar,
|
|
4455
|
-
{
|
|
4456
|
-
className: cn(sizeClasses[size], "border border-border", className),
|
|
4457
|
-
"data-testid": "user-entity",
|
|
4458
|
-
children: /* @__PURE__ */ jsx(AvatarFallback, { className: "bg-status-empty text-muted-foreground text-xs font-semibold", children: "?" })
|
|
4459
|
-
}
|
|
4460
|
-
);
|
|
4461
|
-
}
|
|
4462
|
-
const agentBadge = isAgent ? /* @__PURE__ */ jsx(ArbiBotHeadIcon, { className: "w-3.5 h-3.5 text-muted-foreground" }) : void 0;
|
|
4463
|
-
const canMessage = interactive && !isMe && !isAgent;
|
|
4464
|
-
const showUnread = hasUnreadMessages && !isMe && !isAgent;
|
|
4465
|
-
const surfaceStyle = avatarStyle ?? agentStyle;
|
|
4466
|
-
const avatarCore = /* @__PURE__ */ jsxs(
|
|
4467
|
-
Avatar,
|
|
4468
|
-
{
|
|
4469
|
-
className: cn(
|
|
4470
|
-
sizeClasses[size],
|
|
4471
|
-
isAgent ? "rounded-full border-2 border-dashed" : "border border-white"
|
|
4472
|
-
),
|
|
4473
|
-
style: surfaceStyle,
|
|
4474
|
-
"data-testid": "user-entity",
|
|
4475
|
-
children: [
|
|
4476
|
-
picture && /* @__PURE__ */ jsx(AvatarImage, { src: picture, alt: initials }),
|
|
4477
|
-
/* @__PURE__ */ jsx(
|
|
4478
|
-
AvatarFallback,
|
|
4479
|
-
{
|
|
4480
|
-
className: cn(
|
|
4481
|
-
textSizeClasses[size],
|
|
4482
|
-
"font-semibold leading-none",
|
|
4483
|
-
isAgent ? "rounded-full bg-transparent" : `text-white ${colorClass}`
|
|
4484
|
-
),
|
|
4485
|
-
style: surfaceStyle,
|
|
4486
|
-
children: initials
|
|
4487
|
-
}
|
|
4488
|
-
)
|
|
4489
|
-
]
|
|
4490
|
-
}
|
|
4491
|
-
);
|
|
4492
|
-
const statusDot = showUnread || displayStatus ? /* @__PURE__ */ jsx(
|
|
4493
|
-
"span",
|
|
4494
|
-
{
|
|
4495
|
-
className: cn(
|
|
4496
|
-
"absolute rounded-full border-white",
|
|
4497
|
-
presenceDotClasses[size],
|
|
4498
|
-
presencePositionClasses[size],
|
|
4499
|
-
!showUnread && displayStatus ? presenceColorClasses[displayStatus] : ""
|
|
4500
|
-
),
|
|
4501
|
-
style: showUnread ? { backgroundColor: "#00adef" } : void 0,
|
|
4502
|
-
"data-testid": "user-entity-presence",
|
|
4503
|
-
role: "img",
|
|
4504
|
-
"aria-label": showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus],
|
|
4505
|
-
title: showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus]
|
|
4506
|
-
}
|
|
4507
|
-
) : null;
|
|
4508
|
-
const avatarElement = statusDot ? /* @__PURE__ */ jsxs(
|
|
4509
|
-
"div",
|
|
4510
|
-
{
|
|
4511
|
-
className: cn(
|
|
4512
|
-
"relative inline-block",
|
|
4513
|
-
sizeClasses[size],
|
|
4514
|
-
variant === "pill" ? "" : className
|
|
4515
|
-
),
|
|
4516
|
-
children: [
|
|
4517
|
-
avatarCore,
|
|
4518
|
-
statusDot
|
|
4519
|
-
]
|
|
4520
|
-
}
|
|
4521
|
-
) : /* @__PURE__ */ jsx("div", { className: cn("inline-block", variant === "pill" ? "" : className), children: avatarCore });
|
|
4522
|
-
const pillAvatar = (
|
|
4523
|
-
// shrink-0: when the pill is squeezed the NAME truncates away — the avatar
|
|
4524
|
-
// must never collapse under it and overflow onto neighbouring text.
|
|
4525
|
-
/* @__PURE__ */ jsxs("span", { className: cn("relative inline-block shrink-0", sizeClasses[size]), children: [
|
|
4526
|
-
/* @__PURE__ */ jsx("span", { className: cn("block transition-opacity", canMessage && "group-hover/pill:opacity-0"), children: avatarCore }),
|
|
4527
|
-
canMessage && /* @__PURE__ */ jsx(
|
|
4528
|
-
"span",
|
|
4529
|
-
{
|
|
4530
|
-
"aria-hidden": true,
|
|
4531
|
-
className: "absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100",
|
|
4532
|
-
children: /* @__PURE__ */ jsx(MessageCircleMore, { className: size === "xs" ? "h-3 w-3" : "h-4 w-4" })
|
|
4533
|
-
}
|
|
4534
|
-
),
|
|
4535
|
-
statusDot
|
|
4536
|
-
] })
|
|
4537
|
-
);
|
|
4538
|
-
const resolvedTooltip = showTooltip ? tooltipContent : void 0;
|
|
4539
|
-
if (variant === "pill") {
|
|
4540
|
-
const row = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4541
|
-
pillAvatar,
|
|
4542
|
-
displayName && /* @__PURE__ */ jsx("span", { className: "min-w-0 max-w-[320px] truncate text-sm leading-tight", children: displayName }),
|
|
4543
|
-
agentBadge
|
|
4544
|
-
] });
|
|
4545
|
-
const rowClass = "group/pill inline-flex min-w-0 items-center gap-2";
|
|
4546
|
-
const clickable = interactive && !!onClick;
|
|
4547
|
-
const clickableClass = "cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors hover:bg-muted/60";
|
|
4548
|
-
if (resolvedTooltip) {
|
|
4549
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4550
|
-
/* @__PURE__ */ jsx(
|
|
4551
|
-
TooltipTrigger,
|
|
4552
|
-
{
|
|
4553
|
-
type: "button",
|
|
4554
|
-
onClick: clickable ? onClick : void 0,
|
|
4555
|
-
onFocusCapture: (e) => e.stopPropagation(),
|
|
4556
|
-
className: cn(rowClass, clickable && clickableClass, className),
|
|
4557
|
-
"data-testid": "user-entity-pill",
|
|
4558
|
-
children: row
|
|
4559
|
-
}
|
|
4560
|
-
),
|
|
4561
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "p-2", children: resolvedTooltip })
|
|
4562
|
-
] });
|
|
4563
|
-
}
|
|
4564
|
-
if (clickable) {
|
|
4565
|
-
return /* @__PURE__ */ jsx(
|
|
4566
|
-
"button",
|
|
4567
|
-
{
|
|
4568
|
-
type: "button",
|
|
4569
|
-
onClick,
|
|
4570
|
-
className: cn(rowClass, clickableClass, className),
|
|
4571
|
-
"data-testid": "user-entity-pill",
|
|
4572
|
-
children: row
|
|
4573
|
-
}
|
|
4574
|
-
);
|
|
4575
|
-
}
|
|
4576
|
-
return /* @__PURE__ */ jsx("span", { className: cn(rowClass, className), "data-testid": "user-entity-pill", children: row });
|
|
4577
|
-
}
|
|
4578
|
-
if (showTooltip) {
|
|
4579
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4580
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { onFocusCapture: (e) => e.stopPropagation(), className: "inline-flex", children: avatarElement }),
|
|
4581
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "p-2", children: tooltipContent })
|
|
4582
|
-
] });
|
|
4583
|
-
}
|
|
4584
|
-
return avatarElement;
|
|
4585
|
-
});
|
|
4586
|
-
function AgentBadge({ className }) {
|
|
4587
|
-
return /* @__PURE__ */ jsxs(
|
|
4588
|
-
"span",
|
|
4589
|
-
{
|
|
4590
|
-
"data-testid": "agent-badge",
|
|
4591
|
-
className: cn(
|
|
4592
|
-
"inline-flex shrink-0 items-center gap-1 rounded-full border border-ai-accent/50",
|
|
4593
|
-
"bg-ai-accent-soft px-2 py-0.5 text-[11px] font-bold uppercase tracking-wider text-ai-accent",
|
|
4594
|
-
className
|
|
4595
|
-
),
|
|
4596
|
-
children: [
|
|
4597
|
-
/* @__PURE__ */ jsx(ArbiBotHeadIcon, { size: 14, className: "text-ai-accent" }),
|
|
4598
|
-
"Agent"
|
|
4599
|
-
]
|
|
4600
|
-
}
|
|
4601
|
-
);
|
|
4602
|
-
}
|
|
4603
|
-
var PRESENCE_WORDS = {
|
|
4604
|
-
connected: "Online",
|
|
4605
|
-
connecting: "Connecting",
|
|
4606
|
-
disconnected: "Offline",
|
|
4607
|
-
error: "Connection problem",
|
|
4608
|
-
hidden: null
|
|
4609
|
-
};
|
|
4610
|
-
function PresenceLabel({
|
|
4611
|
-
status,
|
|
4612
|
-
className
|
|
4613
|
-
}) {
|
|
4614
|
-
if (!status) return null;
|
|
4615
|
-
const word = PRESENCE_WORDS[status];
|
|
4616
|
-
if (!word) return null;
|
|
4617
|
-
const online = status === "connected";
|
|
4618
|
-
return /* @__PURE__ */ jsxs(
|
|
4619
|
-
"span",
|
|
4620
|
-
{
|
|
4621
|
-
"data-testid": "presence-label",
|
|
4622
|
-
className: cn("inline-flex shrink-0 items-center gap-1 text-xs", className),
|
|
4623
|
-
children: [
|
|
4624
|
-
/* @__PURE__ */ jsx(
|
|
4625
|
-
"span",
|
|
4626
|
-
{
|
|
4627
|
-
className: cn(
|
|
4628
|
-
"size-1.5 rounded-full",
|
|
4629
|
-
online ? "bg-status-online" : "bg-muted-foreground/50"
|
|
4630
|
-
),
|
|
4631
|
-
"aria-hidden": "true"
|
|
4632
|
-
}
|
|
4633
|
-
),
|
|
4634
|
-
/* @__PURE__ */ jsx("span", { className: online ? "font-medium text-status-online" : "text-muted-foreground", children: word })
|
|
4635
|
-
]
|
|
4636
|
-
}
|
|
4637
|
-
);
|
|
4638
|
-
}
|
|
4639
|
-
var PACKAGE_BADGE_VARIANTS = [
|
|
4640
|
-
"default",
|
|
4641
|
-
"accent",
|
|
4642
|
-
"secondary",
|
|
4643
|
-
"destructive",
|
|
4644
|
-
"outline"
|
|
4645
|
-
];
|
|
4646
|
-
function isPackageBadgeVariant(v) {
|
|
4647
|
-
return PACKAGE_BADGE_VARIANTS.some((known) => known === v);
|
|
4648
|
-
}
|
|
4649
|
-
function PackageStatusBadge({ variant, ...rest }) {
|
|
4650
|
-
return /* @__PURE__ */ jsx(Badge, { variant: isPackageBadgeVariant(variant) ? variant : "outline", ...rest });
|
|
4651
|
-
}
|
|
4652
|
-
var registry = {
|
|
4653
|
-
variants: {},
|
|
4654
|
-
fallback: "outline",
|
|
4655
|
-
Badge: PackageStatusBadge
|
|
4656
|
-
};
|
|
4657
|
-
function configureStatusRegistry(map, opts) {
|
|
4658
|
-
Object.assign(registry.variants, map);
|
|
4659
|
-
if (opts?.fallback) registry.fallback = opts.fallback;
|
|
4660
|
-
if (opts?.Badge) registry.Badge = opts.Badge;
|
|
4661
|
-
}
|
|
4662
|
-
function getStatusVariant(status) {
|
|
4663
|
-
return registry.variants[status] ?? registry.fallback;
|
|
4664
|
-
}
|
|
4665
|
-
function StatusPill({ status, label, variant, className, testId }) {
|
|
4666
|
-
const Badge2 = registry.Badge;
|
|
4667
|
-
return /* @__PURE__ */ jsx(Badge2, { variant: variant ?? getStatusVariant(status), className, "data-testid": testId, children: label ?? status });
|
|
4668
|
-
}
|
|
4669
|
-
var RAG_LABELS = { red: "At risk", amber: "Attention", green: "On track" };
|
|
4670
|
-
function configureRagLabels(labels) {
|
|
4671
|
-
RAG_LABELS = { ...RAG_LABELS, ...labels };
|
|
4672
|
-
}
|
|
4673
|
-
function RagDot({
|
|
4674
|
-
rag,
|
|
4675
|
-
withLabel,
|
|
4676
|
-
className
|
|
4677
|
-
}) {
|
|
4678
|
-
const color = rag === "red" ? "bg-destructive" : rag === "amber" ? "bg-warning" : "bg-success";
|
|
4679
|
-
return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex items-center gap-1.5", className), "data-testid": `rag-${rag}`, children: [
|
|
4680
|
-
/* @__PURE__ */ jsx("span", { className: cn("size-2 rounded-full", color) }),
|
|
4681
|
-
withLabel && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: RAG_LABELS[rag] })
|
|
4682
|
-
] });
|
|
4683
|
-
}
|
|
4684
|
-
var ENTITY_MAPPINGS = {
|
|
4685
|
-
PRODUCT: {
|
|
4686
|
-
NAMES: {
|
|
4687
|
-
SINGULAR: "ARBI Docs"
|
|
4688
|
-
},
|
|
4689
|
-
ICONS: {
|
|
4690
|
-
DEFAULT: MessageSquareLock
|
|
4691
|
-
}
|
|
4692
|
-
},
|
|
4693
|
-
SECTION: {
|
|
4694
|
-
NAMES: {
|
|
4695
|
-
SINGULAR: "Section"
|
|
4696
|
-
},
|
|
4697
|
-
ICONS: {
|
|
4698
|
-
DEFAULT: ChevronsDown
|
|
4699
|
-
}
|
|
4700
|
-
},
|
|
4701
|
-
WORKSPACE: {
|
|
4702
|
-
NAMES: {
|
|
4703
|
-
SINGULAR: "Workspace",
|
|
4704
|
-
PLURAL: "Workspaces"
|
|
4705
|
-
},
|
|
4706
|
-
ICONS: {
|
|
4707
|
-
DEFAULT: SquareM,
|
|
4708
|
-
NEW: SquarePlus,
|
|
4709
|
-
LIST: LayoutGrid,
|
|
4710
|
-
SETTINGS: Columns3Cog
|
|
4711
|
-
}
|
|
4712
|
-
},
|
|
4713
|
-
CONVERSATION: {
|
|
4714
|
-
NAMES: {
|
|
4715
|
-
SINGULAR: "Chat",
|
|
4716
|
-
PLURAL: "Chats",
|
|
4717
|
-
NEW: "New ARBI Chat"
|
|
4718
|
-
},
|
|
4719
|
-
ICONS: {
|
|
4720
|
-
DEFAULT: MessagesSquare,
|
|
4721
|
-
OFF: MessageSquareOff,
|
|
4722
|
-
ACTIVE: MessageSquareText,
|
|
4723
|
-
NEW: MessageSquarePlus,
|
|
4724
|
-
LIST: MessageSquareMore
|
|
4725
|
-
}
|
|
4726
|
-
},
|
|
4727
|
-
DOCUMENT: {
|
|
4728
|
-
NAMES: {
|
|
4729
|
-
SINGULAR: "File",
|
|
4730
|
-
PLURAL: "Files"
|
|
4731
|
-
},
|
|
4732
|
-
ICONS: {
|
|
4733
|
-
DEFAULT: FolderOpen,
|
|
4734
|
-
OFF: CaptionsOff
|
|
4735
|
-
}
|
|
4736
|
-
},
|
|
4737
|
-
VIEWER: {
|
|
4738
|
-
NAMES: {
|
|
4739
|
-
SINGULAR: "Viewer",
|
|
4740
|
-
PLURAL: "Viewers"
|
|
4741
|
-
},
|
|
4742
|
-
ICONS: {
|
|
4743
|
-
DEFAULT: Eye,
|
|
4744
|
-
OFF: EyeOff
|
|
4745
|
-
}
|
|
4746
|
-
},
|
|
4747
|
-
TAG: {
|
|
4748
|
-
NAMES: {
|
|
4749
|
-
SINGULAR: "Field",
|
|
4750
|
-
PLURAL: "Fields"
|
|
4751
|
-
},
|
|
4752
|
-
ICONS: {
|
|
4753
|
-
DEFAULT: Hash,
|
|
4754
|
-
NEW: FolderPlus
|
|
4755
|
-
}
|
|
4756
|
-
},
|
|
4757
|
-
ANNOTATION: {
|
|
4758
|
-
NAMES: {
|
|
4759
|
-
SINGULAR: "Annotation",
|
|
4760
|
-
PLURAL: "Annotations"
|
|
4761
|
-
},
|
|
4762
|
-
ICONS: {
|
|
4763
|
-
DEFAULT: StickyNote,
|
|
4764
|
-
NEW: StickyNote
|
|
4765
|
-
}
|
|
4766
|
-
},
|
|
4767
|
-
// Workspace knowledge the assistant retains and recalls — durable free text,
|
|
4768
|
-
// optionally grounded in source passages. Distinct from ANNOTATION, which is
|
|
4769
|
-
// attached TO a document field; a NOTE is workspace-scoped and stands alone.
|
|
4770
|
-
// Stored server-side as `memories` (mem-*); "Note" is the user-facing name.
|
|
4771
|
-
NOTE: {
|
|
4772
|
-
NAMES: {
|
|
4773
|
-
SINGULAR: "Note",
|
|
4774
|
-
PLURAL: "Notes"
|
|
4775
|
-
},
|
|
4776
|
-
ICONS: {
|
|
4777
|
-
DEFAULT: NotebookText,
|
|
4778
|
-
NEW: NotebookPen
|
|
4779
|
-
}
|
|
4780
|
-
},
|
|
4781
|
-
USER: {
|
|
4782
|
-
NAMES: {
|
|
4783
|
-
SINGULAR: "User",
|
|
4784
|
-
PLURAL: "Users"
|
|
4785
|
-
},
|
|
4786
|
-
ICONS: {
|
|
4787
|
-
DEFAULT: User,
|
|
4788
|
-
NEW: UserPlus,
|
|
4789
|
-
SETTINGS: Settings2
|
|
4790
|
-
}
|
|
4791
|
-
},
|
|
4792
|
-
WORKSPACEUSER: {
|
|
4793
|
-
NAMES: {
|
|
4794
|
-
SINGULAR: "Member",
|
|
4795
|
-
PLURAL: "Members"
|
|
4796
|
-
},
|
|
4797
|
-
ICONS: {
|
|
4798
|
-
DEFAULT: User,
|
|
4799
|
-
PLURAL: Users,
|
|
4800
|
-
NEW: UserPlus,
|
|
4801
|
-
SETTINGS: Settings2
|
|
4802
|
-
}
|
|
4803
|
-
},
|
|
4804
|
-
CONTACT: {
|
|
4805
|
-
NAMES: {
|
|
4806
|
-
SINGULAR: "Contact",
|
|
4807
|
-
PLURAL: "Contacts"
|
|
4808
|
-
},
|
|
4809
|
-
ICONS: {
|
|
4810
|
-
// A starred person, not an address-book card: contacts here are the
|
|
4811
|
-
// people you talk to, and the star reads as "your people".
|
|
4812
|
-
DEFAULT: UserStar,
|
|
4813
|
-
NEW: UserPlus
|
|
4814
|
-
}
|
|
4815
|
-
},
|
|
4816
|
-
TASK: {
|
|
4817
|
-
NAMES: {
|
|
4818
|
-
SINGULAR: "Job",
|
|
4819
|
-
PLURAL: "Jobs"
|
|
4820
|
-
},
|
|
4821
|
-
ICONS: {
|
|
4822
|
-
DEFAULT: ClipboardList
|
|
4823
|
-
}
|
|
4824
|
-
},
|
|
4825
|
-
PROJECT: {
|
|
4826
|
-
NAMES: {
|
|
4827
|
-
SINGULAR: "Project",
|
|
4828
|
-
PLURAL: "Projects"
|
|
4829
|
-
},
|
|
4830
|
-
ICONS: {
|
|
4831
|
-
DEFAULT: CreditCard
|
|
4832
|
-
}
|
|
4833
|
-
},
|
|
4834
|
-
SKILL: {
|
|
4835
|
-
NAMES: {
|
|
4836
|
-
SINGULAR: "Skill",
|
|
4837
|
-
PLURAL: "Skills"
|
|
4838
|
-
},
|
|
4839
|
-
ICONS: {
|
|
4840
|
-
DEFAULT: Wrench
|
|
4841
|
-
}
|
|
4842
|
-
},
|
|
4843
|
-
ACCOUNT: {
|
|
4844
|
-
NAMES: {
|
|
4845
|
-
SINGULAR: "Account"
|
|
4846
|
-
},
|
|
4847
|
-
ICONS: {
|
|
4848
|
-
DEFAULT: CircleUserRound
|
|
4849
|
-
}
|
|
4850
|
-
},
|
|
4851
|
-
NOTIFICATIONS: {
|
|
4852
|
-
NAMES: {
|
|
4853
|
-
SINGULAR: "Activity",
|
|
4854
|
-
PLURAL: "Activities"
|
|
4855
|
-
},
|
|
4856
|
-
ICONS: {
|
|
4857
|
-
DEFAULT: Bell
|
|
4858
|
-
}
|
|
4859
|
-
},
|
|
4860
|
-
MESSAGE: {
|
|
4861
|
-
NAMES: {
|
|
4862
|
-
SINGULAR: "Message",
|
|
4863
|
-
PLURAL: "Messages"
|
|
4864
|
-
},
|
|
4865
|
-
ICONS: {
|
|
4866
|
-
DEFAULT: MessageSquare
|
|
4867
|
-
}
|
|
4868
|
-
},
|
|
4869
|
-
NOTIFICATION: {
|
|
4870
|
-
NAMES: {
|
|
4871
|
-
SINGULAR: "Notification",
|
|
4872
|
-
PLURAL: "Notifications"
|
|
4873
|
-
},
|
|
4874
|
-
ICONS: {
|
|
4875
|
-
DEFAULT: Bell
|
|
4876
|
-
}
|
|
4877
|
-
},
|
|
4878
|
-
APP: {
|
|
4879
|
-
NAMES: {
|
|
4880
|
-
SINGULAR: "Application",
|
|
4881
|
-
PLURAL: "Applications"
|
|
4882
|
-
},
|
|
4883
|
-
ICONS: {
|
|
4884
|
-
DEFAULT: LayoutGrid,
|
|
4885
|
-
HOME: LayoutGrid,
|
|
4886
|
-
LOGOUT: LogOut,
|
|
4887
|
-
UPLOAD: Upload
|
|
4888
|
-
}
|
|
4889
|
-
},
|
|
4890
|
-
HELP: {
|
|
4891
|
-
NAMES: {
|
|
4892
|
-
SINGULAR: "Help",
|
|
4893
|
-
PLURAL: "Help"
|
|
4894
|
-
},
|
|
4895
|
-
ICONS: {
|
|
4896
|
-
DEFAULT: MessageSquareLock,
|
|
4897
|
-
DOCS: BookOpen,
|
|
4898
|
-
FAQ: FileQuestion,
|
|
4899
|
-
ABOUT: Info
|
|
4900
|
-
}
|
|
4901
|
-
},
|
|
4902
|
-
USERSHIELD: {
|
|
4903
|
-
NAMES: {
|
|
4904
|
-
SINGULAR: "User Shield",
|
|
4905
|
-
PLURAL: "User Shields"
|
|
4906
|
-
},
|
|
4907
|
-
ICONS: {
|
|
4908
|
-
DEFAULT: MessageSquareLock
|
|
4909
|
-
}
|
|
4910
|
-
}
|
|
4911
|
-
};
|
|
4912
|
-
function configureEntityRegistry(overrides) {
|
|
4913
|
-
for (const [type, def] of Object.entries(overrides)) {
|
|
4914
|
-
const target = ENTITY_MAPPINGS[type];
|
|
4915
|
-
if (!target) continue;
|
|
4916
|
-
if (def?.NAMES) Object.assign(target.NAMES, def.NAMES);
|
|
4917
|
-
if (def?.ICONS) Object.assign(target.ICONS, def.ICONS);
|
|
4918
|
-
}
|
|
4919
|
-
}
|
|
4920
|
-
var getEntityIcon = (entityType, variant = "DEFAULT") => {
|
|
4921
|
-
const icons = ENTITY_MAPPINGS[entityType]?.ICONS;
|
|
4922
|
-
return icons?.[variant] || icons?.DEFAULT;
|
|
4923
|
-
};
|
|
4924
|
-
var getEntityLabel = (entityType, form = "SINGULAR") => {
|
|
4925
|
-
const entityMapping = ENTITY_MAPPINGS[entityType];
|
|
4926
|
-
if (!entityMapping) return "";
|
|
4927
|
-
const names = entityMapping.NAMES;
|
|
4928
|
-
const singularName = names.SINGULAR || "";
|
|
4929
|
-
if (form === "NEW") return names.NEW !== void 0 ? names.NEW : "New " + singularName;
|
|
4930
|
-
if (form === "SHORT")
|
|
4931
|
-
return names.SHORT !== void 0 ? names.SHORT : singularName.substring(0, 3) + ".";
|
|
4932
|
-
if (form === "PLURAL") return names.PLURAL !== void 0 ? names.PLURAL : singularName + "s";
|
|
4933
|
-
return singularName;
|
|
4934
|
-
};
|
|
4935
|
-
var EntityIcon = ({ entityType, variant = "DEFAULT", ...props }) => {
|
|
4936
|
-
const IconComponent = getEntityIcon(entityType, variant);
|
|
4937
|
-
return IconComponent ? React2.createElement(IconComponent, props) : null;
|
|
4938
|
-
};
|
|
4939
|
-
var VISIBILITY_ICONS = {
|
|
4940
|
-
PRIVATE: MessageSquareLock,
|
|
4941
|
-
SHARED: Users
|
|
4942
|
-
};
|
|
4943
|
-
var VisibilityIcon = ({
|
|
4944
|
-
isShared,
|
|
4945
|
-
...props
|
|
3523
|
+
"aria-hidden": ariaHidden = false
|
|
4946
3524
|
}) => {
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
"0": "#10b981",
|
|
4959
|
-
"1": "#3b82f6",
|
|
4960
|
-
"2": "#8b5cf6",
|
|
4961
|
-
"3": "#f43f5e",
|
|
4962
|
-
"4": "#f59e0b",
|
|
4963
|
-
"5": "#84cc16",
|
|
4964
|
-
"6": "#a855f7",
|
|
4965
|
-
"7": "#06b6d4",
|
|
4966
|
-
"8": "#f97316",
|
|
4967
|
-
"9": "#14b8a6",
|
|
4968
|
-
a: "#ef4444",
|
|
4969
|
-
b: "#6366f1",
|
|
4970
|
-
c: "#ec4899",
|
|
4971
|
-
d: "#22c55e",
|
|
4972
|
-
e: "#eab308",
|
|
4973
|
-
f: "#0ea5e9"
|
|
3525
|
+
return /* @__PURE__ */ jsx(
|
|
3526
|
+
"img",
|
|
3527
|
+
{
|
|
3528
|
+
src: "/favicon.svg",
|
|
3529
|
+
alt: ariaLabel,
|
|
3530
|
+
className: `rounded object-contain ${className}`,
|
|
3531
|
+
style: { width: size, height: size },
|
|
3532
|
+
"aria-label": ariaLabel,
|
|
3533
|
+
"aria-hidden": ariaHidden
|
|
3534
|
+
}
|
|
3535
|
+
);
|
|
4974
3536
|
};
|
|
4975
|
-
|
|
4976
|
-
const
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
}
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
3537
|
+
var ArbiBotIcon = ({ size = 24, className = "" }) => {
|
|
3538
|
+
const maskId = useId();
|
|
3539
|
+
return /* @__PURE__ */ jsxs(
|
|
3540
|
+
"svg",
|
|
3541
|
+
{
|
|
3542
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3543
|
+
width: size,
|
|
3544
|
+
height: size,
|
|
3545
|
+
viewBox: "0 0 250 250",
|
|
3546
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
3547
|
+
className,
|
|
3548
|
+
children: [
|
|
3549
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("mask", { id: maskId, children: /* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", children: [
|
|
3550
|
+
/* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "2500", height: "2500", fill: "white" }),
|
|
3551
|
+
/* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "190", fill: "black" }),
|
|
3552
|
+
/* @__PURE__ */ jsx("circle", { cx: "855", cy: "1715", r: "50", fill: "white" }),
|
|
3553
|
+
/* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "190", fill: "black" }),
|
|
3554
|
+
/* @__PURE__ */ jsx("circle", { cx: "1665", cy: "1700", r: "50", fill: "white" })
|
|
3555
|
+
] }) }) }),
|
|
3556
|
+
/* @__PURE__ */ jsxs("g", { mask: `url(#${maskId})`, children: [
|
|
3557
|
+
/* @__PURE__ */ jsx(
|
|
3558
|
+
"g",
|
|
3559
|
+
{
|
|
3560
|
+
transform: "translate(0,250) scale(0.1,-0.1)",
|
|
3561
|
+
fill: "currentColor",
|
|
3562
|
+
stroke: "currentColor",
|
|
3563
|
+
strokeWidth: "100",
|
|
3564
|
+
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" })
|
|
3565
|
+
}
|
|
3566
|
+
),
|
|
3567
|
+
/* @__PURE__ */ jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
|
|
3568
|
+
/* @__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" }),
|
|
3569
|
+
/* @__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" }),
|
|
3570
|
+
/* @__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" }),
|
|
3571
|
+
/* @__PURE__ */ jsx("g", { transform: "translate(564,0)", children: /* @__PURE__ */ jsx(
|
|
3572
|
+
"path",
|
|
3573
|
+
{
|
|
3574
|
+
d: "M515 353 c-49 -136 -91 -253 -93 -261 -3 -10 11 -12 60 -10 l63 3 19 53 19 52 91 0 92 0 18 -55 17 -56 62 3 c76 4 79 -24 -30 275 l-88 243 -70 0 -70 0 -90 -247z m215 -55 c0 -4 -27 -8 -59 -8 l-60 0 31 92 31 93 29 -85 c15 -46 28 -88 28 -92z",
|
|
3575
|
+
stroke: "currentColor",
|
|
3576
|
+
strokeWidth: "30"
|
|
3577
|
+
}
|
|
3578
|
+
) })
|
|
3579
|
+
] })
|
|
3580
|
+
] })
|
|
3581
|
+
]
|
|
3582
|
+
}
|
|
3583
|
+
);
|
|
5006
3584
|
};
|
|
5007
3585
|
function getNotificationTypeMeta(type) {
|
|
5008
3586
|
const WorkspaceIcon = getEntityIcon("WORKSPACE");
|
|
@@ -5191,65 +3769,6 @@ function ActivityFeed({
|
|
|
5191
3769
|
);
|
|
5192
3770
|
}) });
|
|
5193
3771
|
}
|
|
5194
|
-
var seq = 0;
|
|
5195
|
-
var uid = () => `n${Date.now().toString(36)}${(seq++).toString(36)}`;
|
|
5196
|
-
var useNotify = create((set) => ({
|
|
5197
|
-
notifications: [],
|
|
5198
|
-
markRead: (id) => set((s) => ({
|
|
5199
|
-
notifications: s.notifications.map((n) => n.id === id ? { ...n, read: true } : n)
|
|
5200
|
-
})),
|
|
5201
|
-
markAllRead: () => set((s) => ({ notifications: s.notifications.map((n) => ({ ...n, read: true })) })),
|
|
5202
|
-
removeNotification: (id) => set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),
|
|
5203
|
-
clearNotifications: () => set({ notifications: [] }),
|
|
5204
|
-
seed: (items) => set({ notifications: items }),
|
|
5205
|
-
record: (note) => set((s) => ({ notifications: [note, ...s.notifications].slice(0, 50) })),
|
|
5206
|
-
syncSource: (source, items) => set((s) => ({
|
|
5207
|
-
notifications: [
|
|
5208
|
-
...items.map((n) => ({ ...n, source })),
|
|
5209
|
-
...s.notifications.filter((n) => n.source !== source)
|
|
5210
|
-
].sort((a, b) => b.ts - a.ts).slice(0, 100)
|
|
5211
|
-
}))
|
|
5212
|
-
}));
|
|
5213
|
-
function make(variant) {
|
|
5214
|
-
return (title, opts = {}) => {
|
|
5215
|
-
toast[variant](title, {
|
|
5216
|
-
description: opts.description,
|
|
5217
|
-
duration: opts.duration,
|
|
5218
|
-
action: opts.action,
|
|
5219
|
-
icon: opts.icon
|
|
5220
|
-
});
|
|
5221
|
-
const id = uid();
|
|
5222
|
-
if (opts.record !== false) {
|
|
5223
|
-
useNotify.getState().record({
|
|
5224
|
-
id,
|
|
5225
|
-
title,
|
|
5226
|
-
description: opts.description,
|
|
5227
|
-
variant,
|
|
5228
|
-
ts: Date.now(),
|
|
5229
|
-
read: false,
|
|
5230
|
-
href: opts.href,
|
|
5231
|
-
ambient: opts.ambient
|
|
5232
|
-
});
|
|
5233
|
-
}
|
|
5234
|
-
return id;
|
|
5235
|
-
};
|
|
5236
|
-
}
|
|
5237
|
-
var notify = {
|
|
5238
|
-
success: make("success"),
|
|
5239
|
-
error: make("error"),
|
|
5240
|
-
info: make("info"),
|
|
5241
|
-
warning: make("warning")
|
|
5242
|
-
};
|
|
5243
|
-
function seedNotifications(items) {
|
|
5244
|
-
useNotify.getState().seed(items);
|
|
5245
|
-
}
|
|
5246
|
-
var selectUnread = (s) => s.notifications.filter((n) => !n.read && !n.ambient).length;
|
|
5247
|
-
var DEFAULT_NOTIFY_TONE = {
|
|
5248
|
-
success: "text-green-600",
|
|
5249
|
-
error: "text-destructive",
|
|
5250
|
-
warning: "text-amber-500",
|
|
5251
|
-
info: "text-blue-500"
|
|
5252
|
-
};
|
|
5253
3772
|
|
|
5254
3773
|
// src/directmessages/utils.ts
|
|
5255
3774
|
function userInitials(user) {
|
|
@@ -5267,196 +3786,6 @@ function userDisplayName(user) {
|
|
|
5267
3786
|
function isAgentUser(user) {
|
|
5268
3787
|
return user.external_id.startsWith("agt-");
|
|
5269
3788
|
}
|
|
5270
|
-
var RELATIVE = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
5271
|
-
var DIVISIONS = [
|
|
5272
|
-
{ amount: 60, unit: "seconds" },
|
|
5273
|
-
{ amount: 60, unit: "minutes" },
|
|
5274
|
-
{ amount: 24, unit: "hours" },
|
|
5275
|
-
{ amount: 7, unit: "days" },
|
|
5276
|
-
{ amount: 4.34524, unit: "weeks" },
|
|
5277
|
-
{ amount: 12, unit: "months" },
|
|
5278
|
-
{ amount: Number.POSITIVE_INFINITY, unit: "years" }
|
|
5279
|
-
];
|
|
5280
|
-
function formatRelativeTime(iso) {
|
|
5281
|
-
const then = Date.parse(iso);
|
|
5282
|
-
if (Number.isNaN(then)) return "";
|
|
5283
|
-
let duration = (then - Date.now()) / 1e3;
|
|
5284
|
-
if (Math.abs(duration) < 45) return "just now";
|
|
5285
|
-
for (const division of DIVISIONS) {
|
|
5286
|
-
if (Math.abs(duration) < division.amount) {
|
|
5287
|
-
return RELATIVE.format(Math.round(duration), division.unit);
|
|
5288
|
-
}
|
|
5289
|
-
duration /= division.amount;
|
|
5290
|
-
}
|
|
5291
|
-
return "";
|
|
5292
|
-
}
|
|
5293
|
-
var GLYPH = {
|
|
5294
|
-
success: CheckCircle2,
|
|
5295
|
-
error: XCircle,
|
|
5296
|
-
warning: AlertTriangle,
|
|
5297
|
-
info: Info
|
|
5298
|
-
};
|
|
5299
|
-
function NotificationBell({
|
|
5300
|
-
onNavigate,
|
|
5301
|
-
onMarkRead,
|
|
5302
|
-
onMarkAllRead,
|
|
5303
|
-
muted = false,
|
|
5304
|
-
onToggleMute,
|
|
5305
|
-
toneClassNames,
|
|
5306
|
-
emptyText = "You're all caught up.",
|
|
5307
|
-
onViewAll,
|
|
5308
|
-
viewAllLabel = "View all",
|
|
5309
|
-
testId = "notifications"
|
|
5310
|
-
}) {
|
|
5311
|
-
const notifications = useNotify((s) => s.notifications);
|
|
5312
|
-
const unread = useNotify(selectUnread);
|
|
5313
|
-
const markAllRead = useNotify((s) => s.markAllRead);
|
|
5314
|
-
const markRead = useNotify((s) => s.markRead);
|
|
5315
|
-
const tone = (v) => toneClassNames?.[v] ?? DEFAULT_NOTIFY_TONE[v];
|
|
5316
|
-
const visible = notifications.filter((n) => !n.ambient);
|
|
5317
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5318
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
5319
|
-
"button",
|
|
5320
|
-
{
|
|
5321
|
-
className: "relative flex size-9 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
5322
|
-
"data-testid": testId,
|
|
5323
|
-
"aria-label": `Notifications${unread ? ` (${unread} unread)` : ""}`,
|
|
5324
|
-
children: [
|
|
5325
|
-
/* @__PURE__ */ jsx(Bell, { className: "size-5" }),
|
|
5326
|
-
unread > 0 && /* @__PURE__ */ jsx(
|
|
5327
|
-
"span",
|
|
5328
|
-
{
|
|
5329
|
-
className: "absolute -right-0.5 -top-0.5 flex min-w-4 items-center justify-center rounded-full bg-secondary px-1 text-[10px] font-semibold leading-4 text-secondary-foreground",
|
|
5330
|
-
"data-testid": `${testId}-badge`,
|
|
5331
|
-
children: unread > 9 ? "9+" : unread
|
|
5332
|
-
}
|
|
5333
|
-
)
|
|
5334
|
-
]
|
|
5335
|
-
}
|
|
5336
|
-
) }),
|
|
5337
|
-
/* @__PURE__ */ jsxs(
|
|
5338
|
-
DropdownMenuContent,
|
|
5339
|
-
{
|
|
5340
|
-
align: "end",
|
|
5341
|
-
sideOffset: 8,
|
|
5342
|
-
collisionPadding: 12,
|
|
5343
|
-
className: "w-[360px] rounded-lg border-border/60 p-0 shadow-lg",
|
|
5344
|
-
"data-testid": `${testId}-panel`,
|
|
5345
|
-
children: [
|
|
5346
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-border px-3.5 py-2.5", children: [
|
|
5347
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: "Notifications" }),
|
|
5348
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
5349
|
-
unread > 0 && /* @__PURE__ */ jsxs(
|
|
5350
|
-
"button",
|
|
5351
|
-
{
|
|
5352
|
-
onClick: () => {
|
|
5353
|
-
markAllRead();
|
|
5354
|
-
onMarkAllRead?.();
|
|
5355
|
-
},
|
|
5356
|
-
className: "flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:opacity-80",
|
|
5357
|
-
"data-testid": `${testId}-mark-all`,
|
|
5358
|
-
children: [
|
|
5359
|
-
/* @__PURE__ */ jsx(CheckCheck, { className: "size-3.5" }),
|
|
5360
|
-
" Mark all read"
|
|
5361
|
-
]
|
|
5362
|
-
}
|
|
5363
|
-
),
|
|
5364
|
-
onToggleMute && /* @__PURE__ */ jsx(
|
|
5365
|
-
"button",
|
|
5366
|
-
{
|
|
5367
|
-
onClick: onToggleMute,
|
|
5368
|
-
"aria-pressed": muted,
|
|
5369
|
-
title: muted ? "Unmute notifications" : "Mute notifications",
|
|
5370
|
-
"aria-label": muted ? "Unmute notifications" : "Mute notifications",
|
|
5371
|
-
className: cn(
|
|
5372
|
-
"flex size-6 items-center justify-center rounded-md transition-colors hover:bg-accent",
|
|
5373
|
-
muted ? "text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
5374
|
-
),
|
|
5375
|
-
"data-testid": `${testId}-mute`,
|
|
5376
|
-
children: /* @__PURE__ */ jsx(BellOff, { className: "size-3.5" })
|
|
5377
|
-
}
|
|
5378
|
-
),
|
|
5379
|
-
/* @__PURE__ */ jsx(
|
|
5380
|
-
DropdownMenuItem,
|
|
5381
|
-
{
|
|
5382
|
-
className: "flex size-6 items-center justify-center rounded-md p-0 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:bg-accent",
|
|
5383
|
-
"aria-label": "Close notifications",
|
|
5384
|
-
"data-testid": `${testId}-close`,
|
|
5385
|
-
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
5386
|
-
}
|
|
5387
|
-
)
|
|
5388
|
-
] })
|
|
5389
|
-
] }),
|
|
5390
|
-
muted && /* @__PURE__ */ jsx(
|
|
5391
|
-
"p",
|
|
5392
|
-
{
|
|
5393
|
-
className: "border-b border-border/60 bg-amber-500/10 px-3.5 py-1.5 text-[11px] text-muted-foreground",
|
|
5394
|
-
"data-testid": `${testId}-muted-note`,
|
|
5395
|
-
children: "Toasts are muted \u2014 everything still lands here."
|
|
5396
|
-
}
|
|
5397
|
-
),
|
|
5398
|
-
visible.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3.5 py-10 text-center text-sm text-muted-foreground", children: emptyText }) : /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[380px]", children: /* @__PURE__ */ jsx("ul", { "data-testid": `${testId}-list`, children: visible.map((n) => {
|
|
5399
|
-
const Glyph = GLYPH[n.variant];
|
|
5400
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
5401
|
-
"button",
|
|
5402
|
-
{
|
|
5403
|
-
onClick: () => {
|
|
5404
|
-
markRead(n.id);
|
|
5405
|
-
if (!n.read) onMarkRead?.(n.id);
|
|
5406
|
-
if (n.onSelect) n.onSelect();
|
|
5407
|
-
else if (n.href) onNavigate?.(n.href);
|
|
5408
|
-
},
|
|
5409
|
-
className: cn(
|
|
5410
|
-
"flex w-full items-start gap-3 border-b border-border/60 px-3.5 py-3 text-left transition-colors hover:bg-accent",
|
|
5411
|
-
!n.read && "bg-accent/40"
|
|
5412
|
-
),
|
|
5413
|
-
"data-testid": `${testId}-item`,
|
|
5414
|
-
children: [
|
|
5415
|
-
/* @__PURE__ */ jsx(Glyph, { className: cn("mt-0.5 size-4 shrink-0", tone(n.variant)) }),
|
|
5416
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
5417
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-snug text-foreground", children: n.title }),
|
|
5418
|
-
n.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground", children: n.description }),
|
|
5419
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-muted-foreground/80", children: formatRelativeTime(new Date(n.ts).toISOString()) })
|
|
5420
|
-
] }),
|
|
5421
|
-
!n.read && /* @__PURE__ */ jsx("span", { className: "mt-1.5 size-2 shrink-0 rounded-full bg-primary" })
|
|
5422
|
-
]
|
|
5423
|
-
}
|
|
5424
|
-
) }, n.id);
|
|
5425
|
-
}) }) }),
|
|
5426
|
-
onViewAll && // A real menu item, not a bare button: selecting it must CLOSE the
|
|
5427
|
-
// dropdown on its way to the full surface.
|
|
5428
|
-
/* @__PURE__ */ jsx(
|
|
5429
|
-
DropdownMenuItem,
|
|
5430
|
-
{
|
|
5431
|
-
onClick: onViewAll,
|
|
5432
|
-
className: "justify-center rounded-none border-t border-border px-3.5 py-2.5 text-xs font-medium text-primary focus:text-primary",
|
|
5433
|
-
"data-testid": `${testId}-view-all`,
|
|
5434
|
-
children: viewAllLabel
|
|
5435
|
-
}
|
|
5436
|
-
)
|
|
5437
|
-
]
|
|
5438
|
-
}
|
|
5439
|
-
)
|
|
5440
|
-
] });
|
|
5441
|
-
}
|
|
5442
|
-
var DEFAULT_TOAST_OPTIONS = {
|
|
5443
|
-
classNames: {
|
|
5444
|
-
toast: "group toast group-[.toaster]:bg-card group-[.toaster]:text-foreground group-[.toaster]:border group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:rounded-lg",
|
|
5445
|
-
description: "group-[.toast]:text-muted-foreground",
|
|
5446
|
-
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
5447
|
-
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
|
|
5448
|
-
}
|
|
5449
|
-
};
|
|
5450
|
-
function Toaster({ toastOptions, ...props }) {
|
|
5451
|
-
return /* @__PURE__ */ jsx(
|
|
5452
|
-
Toaster$1,
|
|
5453
|
-
{
|
|
5454
|
-
className: "toaster group",
|
|
5455
|
-
toastOptions: toastOptions ?? DEFAULT_TOAST_OPTIONS,
|
|
5456
|
-
...props
|
|
5457
|
-
}
|
|
5458
|
-
);
|
|
5459
|
-
}
|
|
5460
3789
|
var DM_QUERY_KEY = ["arbi", "directMessages"];
|
|
5461
3790
|
var CONTACTS_QUERY_KEY = ["arbi", "contacts"];
|
|
5462
3791
|
function mergeContacts(threads, contacts) {
|
|
@@ -5655,7 +3984,7 @@ function ConversationList({
|
|
|
5655
3984
|
Badge,
|
|
5656
3985
|
{
|
|
5657
3986
|
variant: "outline",
|
|
5658
|
-
className: "shrink-0 rounded-full px-2 py-0 text-
|
|
3987
|
+
className: "shrink-0 rounded-full px-2 py-0 text-xs font-medium text-muted-foreground",
|
|
5659
3988
|
children: c.statusLabel
|
|
5660
3989
|
}
|
|
5661
3990
|
) : unreadCount > 0 ? (
|
|
@@ -5667,7 +3996,7 @@ function ConversationList({
|
|
|
5667
3996
|
{
|
|
5668
3997
|
variant: "accent",
|
|
5669
3998
|
className: cn(
|
|
5670
|
-
"min-w-[1.125rem] justify-center rounded-full px-1 py-0 text-
|
|
3999
|
+
"min-w-[1.125rem] justify-center rounded-full px-1 py-0 text-xs font-medium leading-[1.125rem] shadow-none",
|
|
5671
4000
|
classNames?.unreadBadge
|
|
5672
4001
|
),
|
|
5673
4002
|
children: unreadCount
|
|
@@ -5699,7 +4028,7 @@ function ConversationList({
|
|
|
5699
4028
|
children: c.subtitle ?? preview
|
|
5700
4029
|
}
|
|
5701
4030
|
),
|
|
5702
|
-
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-
|
|
4031
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: lastMessage ? formatRelativeTime(lastMessage.createdAt) : "" })
|
|
5703
4032
|
] })
|
|
5704
4033
|
] })
|
|
5705
4034
|
] });
|
|
@@ -5714,7 +4043,7 @@ function ConversationList({
|
|
|
5714
4043
|
newSection && /* @__PURE__ */ jsx(
|
|
5715
4044
|
"p",
|
|
5716
4045
|
{
|
|
5717
|
-
className: "bg-muted/40 px-4 py-1.5 text-
|
|
4046
|
+
className: "bg-muted/40 px-4 py-1.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",
|
|
5718
4047
|
"data-testid": "arbi-dm-section",
|
|
5719
4048
|
children: c.sectionLabel
|
|
5720
4049
|
}
|
|
@@ -6039,7 +4368,7 @@ function ImageCropper({
|
|
|
6039
4368
|
}
|
|
6040
4369
|
) }),
|
|
6041
4370
|
aspectOptions && aspectOptions.length > 1 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "image-cropper-aspects", children: [
|
|
6042
|
-
/* @__PURE__ */ jsx("span", { className: "mr-1 text-
|
|
4371
|
+
/* @__PURE__ */ jsx("span", { className: "mr-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Ratio" }),
|
|
6043
4372
|
aspectOptions.map((opt) => {
|
|
6044
4373
|
const on = opt.value === activeAspect;
|
|
6045
4374
|
return /* @__PURE__ */ jsx(
|
|
@@ -6059,7 +4388,7 @@ function ImageCropper({
|
|
|
6059
4388
|
})
|
|
6060
4389
|
] }) : null,
|
|
6061
4390
|
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
6062
|
-
/* @__PURE__ */ jsx("label", { className: "text-
|
|
4391
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Zoom" }),
|
|
6063
4392
|
/* @__PURE__ */ jsx(
|
|
6064
4393
|
Slider,
|
|
6065
4394
|
{
|
|
@@ -6250,7 +4579,7 @@ function CommandPalette({
|
|
|
6250
4579
|
"data-testid": `${testId}-input`
|
|
6251
4580
|
}
|
|
6252
4581
|
),
|
|
6253
|
-
/* @__PURE__ */ jsx("kbd", { className: "hidden rounded border border-border px-1.5 py-0.5 text-
|
|
4582
|
+
/* @__PURE__ */ jsx("kbd", { className: "hidden rounded border border-border px-1.5 py-0.5 text-xs text-muted-foreground sm:inline", children: "\u2318K" })
|
|
6254
4583
|
] }),
|
|
6255
4584
|
/* @__PURE__ */ jsxs("div", { className: "max-h-[60vh] overflow-y-auto p-2", children: [
|
|
6256
4585
|
query.trim() && !showingAnswer && /* @__PURE__ */ jsxs(
|
|
@@ -6309,7 +4638,7 @@ function CommandPalette({
|
|
|
6309
4638
|
) })
|
|
6310
4639
|
] }),
|
|
6311
4640
|
!showingAnswer && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6312
|
-
/* @__PURE__ */ jsx("p", { className: "px-3 pb-1 pt-2 text-
|
|
4641
|
+
/* @__PURE__ */ jsx("p", { className: "px-3 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: query.trim() ? "Jump to" : "Go to" }),
|
|
6313
4642
|
navMatches.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-2 text-sm text-muted-foreground", children: "No pages match \u2014 press Enter to ask AI." }),
|
|
6314
4643
|
navMatches.map((item) => /* @__PURE__ */ jsxs(
|
|
6315
4644
|
"button",
|
|
@@ -6330,7 +4659,7 @@ function CommandPalette({
|
|
|
6330
4659
|
item.id
|
|
6331
4660
|
)),
|
|
6332
4661
|
searchable && query.trim().length >= 2 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6333
|
-
/* @__PURE__ */ jsx("p", { className: "px-3 pb-1 pt-3 text-
|
|
4662
|
+
/* @__PURE__ */ jsx("p", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Documents" }),
|
|
6334
4663
|
searchStatus === "done" && docHits.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-2 text-sm text-muted-foreground", children: "No passages matched." }),
|
|
6335
4664
|
docHits.map((hit, i) => /* @__PURE__ */ jsxs(
|
|
6336
4665
|
"button",
|
|
@@ -6394,114 +4723,6 @@ function CommandPaletteProvider({
|
|
|
6394
4723
|
/* @__PURE__ */ jsx(CommandPalette, { open: isOpen, onOpenChange: setIsOpen, ...paletteProps })
|
|
6395
4724
|
] });
|
|
6396
4725
|
}
|
|
6397
|
-
function nameInitials(name) {
|
|
6398
|
-
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
6399
|
-
if (!parts.length) return "?";
|
|
6400
|
-
return parts.slice(0, 2).map((p) => p[0]?.toUpperCase() ?? "").join("");
|
|
6401
|
-
}
|
|
6402
|
-
var STATUS_DOT = {
|
|
6403
|
-
online: "bg-emerald-500",
|
|
6404
|
-
busy: "bg-amber-500",
|
|
6405
|
-
offline: "bg-destructive"
|
|
6406
|
-
};
|
|
6407
|
-
function UserMenu({
|
|
6408
|
-
user,
|
|
6409
|
-
status,
|
|
6410
|
-
items = [],
|
|
6411
|
-
onLogout,
|
|
6412
|
-
logoutLabel = "Sign out",
|
|
6413
|
-
align = "end",
|
|
6414
|
-
classNames,
|
|
6415
|
-
testId = "user-menu",
|
|
6416
|
-
logoutTestId
|
|
6417
|
-
}) {
|
|
6418
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
6419
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
6420
|
-
"button",
|
|
6421
|
-
{
|
|
6422
|
-
className: cn(
|
|
6423
|
-
"flex items-center gap-2 rounded-md px-1.5 py-1 transition-colors hover:bg-accent",
|
|
6424
|
-
classNames?.trigger
|
|
6425
|
-
),
|
|
6426
|
-
"data-testid": testId,
|
|
6427
|
-
children: [
|
|
6428
|
-
/* @__PURE__ */ jsxs("span", { className: "relative", children: [
|
|
6429
|
-
/* @__PURE__ */ jsxs(Avatar, { className: "size-8", children: [
|
|
6430
|
-
user.picture ? /* @__PURE__ */ jsx(AvatarImage, { src: user.picture, alt: user.name }) : null,
|
|
6431
|
-
/* @__PURE__ */ jsx(
|
|
6432
|
-
AvatarFallback,
|
|
6433
|
-
{
|
|
6434
|
-
className: cn("bg-primary text-primary-foreground", classNames?.fallback),
|
|
6435
|
-
children: nameInitials(user.name)
|
|
6436
|
-
}
|
|
6437
|
-
)
|
|
6438
|
-
] }),
|
|
6439
|
-
status && /* @__PURE__ */ jsx(
|
|
6440
|
-
"span",
|
|
6441
|
-
{
|
|
6442
|
-
className: cn(
|
|
6443
|
-
"absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-background",
|
|
6444
|
-
STATUS_DOT[status.tone]
|
|
6445
|
-
),
|
|
6446
|
-
title: status.detail ? `${status.label} \xB7 ${status.detail}` : status.label,
|
|
6447
|
-
"data-testid": status.testId ? `${status.testId}-dot` : void 0
|
|
6448
|
-
}
|
|
6449
|
-
)
|
|
6450
|
-
] }),
|
|
6451
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "size-4 text-muted-foreground" })
|
|
6452
|
-
]
|
|
6453
|
-
}
|
|
6454
|
-
) }),
|
|
6455
|
-
/* @__PURE__ */ jsxs(
|
|
6456
|
-
DropdownMenuContent,
|
|
6457
|
-
{
|
|
6458
|
-
align,
|
|
6459
|
-
sideOffset: 8,
|
|
6460
|
-
collisionPadding: 12,
|
|
6461
|
-
className: "w-56 rounded-lg border-border/60 shadow-lg",
|
|
6462
|
-
"data-testid": "user-menu-panel",
|
|
6463
|
-
children: [
|
|
6464
|
-
/* @__PURE__ */ jsxs(DropdownMenuLabel, { className: "relative pr-8", children: [
|
|
6465
|
-
/* @__PURE__ */ jsx(
|
|
6466
|
-
DropdownMenuItem,
|
|
6467
|
-
{
|
|
6468
|
-
className: "absolute right-1 top-1 flex size-6 items-center justify-center rounded-md p-0 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:bg-accent",
|
|
6469
|
-
"aria-label": "Close account menu",
|
|
6470
|
-
"data-testid": "user-menu-close",
|
|
6471
|
-
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
6472
|
-
}
|
|
6473
|
-
),
|
|
6474
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium text-foreground", children: user.name }),
|
|
6475
|
-
user.email && /* @__PURE__ */ jsx("div", { className: "text-xs font-normal text-muted-foreground", children: user.email }),
|
|
6476
|
-
status && /* @__PURE__ */ jsxs(
|
|
6477
|
-
"div",
|
|
6478
|
-
{
|
|
6479
|
-
className: "mt-1 text-xs font-normal text-muted-foreground",
|
|
6480
|
-
"data-testid": status.testId,
|
|
6481
|
-
children: [
|
|
6482
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
6483
|
-
/* @__PURE__ */ jsx("span", { className: cn("size-2 shrink-0 rounded-full", STATUS_DOT[status.tone]) }),
|
|
6484
|
-
status.label
|
|
6485
|
-
] }),
|
|
6486
|
-
status.detail && /* @__PURE__ */ jsx("div", { className: "mt-0.5 truncate pl-3.5 text-[10px] leading-tight text-muted-foreground/70", children: status.detail })
|
|
6487
|
-
]
|
|
6488
|
-
}
|
|
6489
|
-
)
|
|
6490
|
-
] }),
|
|
6491
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
6492
|
-
items.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: item.onSelect, "data-testid": item.testId, children: [
|
|
6493
|
-
item.icon && /* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
6494
|
-
item.label
|
|
6495
|
-
] }, item.label)),
|
|
6496
|
-
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: onLogout, "data-testid": logoutTestId ?? `${testId}-logout`, children: [
|
|
6497
|
-
/* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
|
|
6498
|
-
logoutLabel
|
|
6499
|
-
] })
|
|
6500
|
-
]
|
|
6501
|
-
}
|
|
6502
|
-
)
|
|
6503
|
-
] });
|
|
6504
|
-
}
|
|
6505
4726
|
var useArbiUiStore = create((set) => ({
|
|
6506
4727
|
selectedDocIds: [],
|
|
6507
4728
|
setSelectedDocIds: (ids) => set({ selectedDocIds: ids }),
|
|
@@ -6545,7 +4766,7 @@ function DocumentTable({
|
|
|
6545
4766
|
const rows = documents ?? query.data ?? [];
|
|
6546
4767
|
const isLoading = !documents && query.isLoading;
|
|
6547
4768
|
const tagsQuery = useTags(workspaceId);
|
|
6548
|
-
const tagNameById =
|
|
4769
|
+
const tagNameById = React.useMemo(() => {
|
|
6549
4770
|
const map = /* @__PURE__ */ new Map();
|
|
6550
4771
|
for (const t of tagsQuery.data ?? []) {
|
|
6551
4772
|
if (t.external_id) map.set(t.external_id, t.name ?? t.external_id.slice(0, 8));
|
|
@@ -6558,15 +4779,15 @@ function DocumentTable({
|
|
|
6558
4779
|
const setViewingDocId = useArbiUiStore((s) => s.setViewingDocId);
|
|
6559
4780
|
const effectiveSelected = selectedIds ?? storeSelected;
|
|
6560
4781
|
const emitSelection = onSelectionChange ?? storeSetSelected;
|
|
6561
|
-
const gridApiRef =
|
|
6562
|
-
const openDocument =
|
|
4782
|
+
const gridApiRef = React.useRef(null);
|
|
4783
|
+
const openDocument = React.useCallback(
|
|
6563
4784
|
(id) => {
|
|
6564
4785
|
setViewingDocId(id);
|
|
6565
4786
|
onOpenDocument?.(id);
|
|
6566
4787
|
},
|
|
6567
4788
|
[onOpenDocument, setViewingDocId]
|
|
6568
4789
|
);
|
|
6569
|
-
const applySelection =
|
|
4790
|
+
const applySelection = React.useCallback(() => {
|
|
6570
4791
|
const api = gridApiRef.current;
|
|
6571
4792
|
if (!api) return;
|
|
6572
4793
|
const wanted = new Set(effectiveSelected);
|
|
@@ -6576,10 +4797,10 @@ function DocumentTable({
|
|
|
6576
4797
|
if (node.isSelected() !== shouldSelect) node.setSelected(shouldSelect);
|
|
6577
4798
|
});
|
|
6578
4799
|
}, [effectiveSelected]);
|
|
6579
|
-
|
|
4800
|
+
React.useEffect(() => {
|
|
6580
4801
|
applySelection();
|
|
6581
4802
|
}, [applySelection]);
|
|
6582
|
-
const columnDefs =
|
|
4803
|
+
const columnDefs = React.useMemo(
|
|
6583
4804
|
() => [
|
|
6584
4805
|
{
|
|
6585
4806
|
colId: "select",
|
|
@@ -6687,7 +4908,7 @@ function DocumentTable({
|
|
|
6687
4908
|
const id = e.data?.external_id;
|
|
6688
4909
|
if (id) openDocument(id);
|
|
6689
4910
|
};
|
|
6690
|
-
const getRowId =
|
|
4911
|
+
const getRowId = React.useCallback((params) => params.data.external_id, []);
|
|
6691
4912
|
const autoHeight = height === "auto";
|
|
6692
4913
|
const style = autoHeight ? {} : { height: typeof height === "number" ? `${height}px` : height, width: "100%" };
|
|
6693
4914
|
if (isLoading) {
|
|
@@ -6712,218 +4933,6 @@ function DocumentTable({
|
|
|
6712
4933
|
}
|
|
6713
4934
|
) });
|
|
6714
4935
|
}
|
|
6715
|
-
var ACTIVE_STATUSES = /* @__PURE__ */ new Set([
|
|
6716
|
-
"queued",
|
|
6717
|
-
"processing",
|
|
6718
|
-
"parsing",
|
|
6719
|
-
"encrypting",
|
|
6720
|
-
"indexing",
|
|
6721
|
-
"analysing"
|
|
6722
|
-
]);
|
|
6723
|
-
var TERMINAL_STATUSES2 = /* @__PURE__ */ new Set(["completed", "failed", "skipped", "empty", "low-content"]);
|
|
6724
|
-
var STATUS_LABEL = {
|
|
6725
|
-
queued: "Queued",
|
|
6726
|
-
processing: "Processing",
|
|
6727
|
-
parsing: "Parsing",
|
|
6728
|
-
encrypting: "Encrypting",
|
|
6729
|
-
indexing: "Indexing",
|
|
6730
|
-
analysing: "Analysing"
|
|
6731
|
-
};
|
|
6732
|
-
var IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp"]);
|
|
6733
|
-
var VIDEO_EXTENSIONS2 = /* @__PURE__ */ new Set(["mp4", "mpeg", "mpg", "webm", "mov", "avi", "mkv"]);
|
|
6734
|
-
var AUDIO_EXTENSIONS2 = /* @__PURE__ */ new Set(["mp3", "wav", "m4a", "aac", "ogg", "flac"]);
|
|
6735
|
-
var EMAIL_EXTENSIONS2 = /* @__PURE__ */ new Set(["eml", "msg"]);
|
|
6736
|
-
function fileIcon(fileName, size) {
|
|
6737
|
-
const ext = fileName?.split(".").pop()?.toLowerCase();
|
|
6738
|
-
if (ext && VIDEO_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsx(VidIcon, { size });
|
|
6739
|
-
if (ext && AUDIO_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsx(AudIcon, { size });
|
|
6740
|
-
if (ext && IMAGE_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsx(ImgIcon, { size });
|
|
6741
|
-
if (ext && EMAIL_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsx(EmlIcon, { size });
|
|
6742
|
-
return /* @__PURE__ */ jsx(PdfIcon, { size });
|
|
6743
|
-
}
|
|
6744
|
-
function RenameField({
|
|
6745
|
-
seed,
|
|
6746
|
-
onCommit,
|
|
6747
|
-
onCancel,
|
|
6748
|
-
testId
|
|
6749
|
-
}) {
|
|
6750
|
-
const done = React2.useRef(false);
|
|
6751
|
-
const commit = (value) => {
|
|
6752
|
-
if (done.current) return;
|
|
6753
|
-
done.current = true;
|
|
6754
|
-
const trimmed = value.trim();
|
|
6755
|
-
if (trimmed && trimmed !== seed) onCommit(trimmed);
|
|
6756
|
-
else onCancel();
|
|
6757
|
-
};
|
|
6758
|
-
return /* @__PURE__ */ jsx(
|
|
6759
|
-
"input",
|
|
6760
|
-
{
|
|
6761
|
-
autoFocus: true,
|
|
6762
|
-
defaultValue: seed,
|
|
6763
|
-
"data-testid": testId,
|
|
6764
|
-
onFocus: (e) => e.currentTarget.select(),
|
|
6765
|
-
onClick: (e) => e.stopPropagation(),
|
|
6766
|
-
onKeyDown: (e) => {
|
|
6767
|
-
if (e.key === "Enter") {
|
|
6768
|
-
e.preventDefault();
|
|
6769
|
-
commit(e.currentTarget.value);
|
|
6770
|
-
} else if (e.key === "Escape") {
|
|
6771
|
-
e.preventDefault();
|
|
6772
|
-
done.current = true;
|
|
6773
|
-
onCancel();
|
|
6774
|
-
}
|
|
6775
|
-
},
|
|
6776
|
-
onBlur: (e) => commit(e.currentTarget.value),
|
|
6777
|
-
className: "w-full rounded border border-primary bg-background px-1 py-0.5 text-xs text-foreground outline-none"
|
|
6778
|
-
}
|
|
6779
|
-
);
|
|
6780
|
-
}
|
|
6781
|
-
function StatusMarker({ status, testId }) {
|
|
6782
|
-
let icon = null;
|
|
6783
|
-
let title = "";
|
|
6784
|
-
switch (status) {
|
|
6785
|
-
case "completed":
|
|
6786
|
-
icon = /* @__PURE__ */ jsx(CheckCircle, { className: "size-4 text-success", strokeWidth: 2.75 });
|
|
6787
|
-
title = "Ready";
|
|
6788
|
-
break;
|
|
6789
|
-
case "failed":
|
|
6790
|
-
icon = /* @__PURE__ */ jsx(XCircle, { className: "size-4 text-destructive", strokeWidth: 2.75 });
|
|
6791
|
-
title = "Failed";
|
|
6792
|
-
break;
|
|
6793
|
-
case "skipped":
|
|
6794
|
-
icon = /* @__PURE__ */ jsx(SkipForward, { className: "size-4 text-muted-foreground", strokeWidth: 2.75 });
|
|
6795
|
-
title = "Skipped";
|
|
6796
|
-
break;
|
|
6797
|
-
case "empty":
|
|
6798
|
-
icon = /* @__PURE__ */ jsx(FileX, { className: "size-4 text-warning", strokeWidth: 2.75 });
|
|
6799
|
-
title = "Empty \u2014 no extractable content";
|
|
6800
|
-
break;
|
|
6801
|
-
case "low-content":
|
|
6802
|
-
icon = /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4 text-warning", strokeWidth: 2.75 });
|
|
6803
|
-
title = "Low content \u2014 minimal extractable content";
|
|
6804
|
-
break;
|
|
6805
|
-
default:
|
|
6806
|
-
return null;
|
|
6807
|
-
}
|
|
6808
|
-
return /* @__PURE__ */ jsx(
|
|
6809
|
-
"span",
|
|
6810
|
-
{
|
|
6811
|
-
title,
|
|
6812
|
-
"data-testid": testId,
|
|
6813
|
-
className: "flex size-6 items-center justify-center rounded-full bg-background shadow-sm",
|
|
6814
|
-
children: icon
|
|
6815
|
-
}
|
|
6816
|
-
);
|
|
6817
|
-
}
|
|
6818
|
-
function DocumentCard({
|
|
6819
|
-
doc,
|
|
6820
|
-
thumbnailUrl,
|
|
6821
|
-
status,
|
|
6822
|
-
selected = false,
|
|
6823
|
-
onToggleSelect,
|
|
6824
|
-
viewing = false,
|
|
6825
|
-
onOpen,
|
|
6826
|
-
actions,
|
|
6827
|
-
renaming = false,
|
|
6828
|
-
onCommitRename,
|
|
6829
|
-
onCancelRename,
|
|
6830
|
-
tooltipContent,
|
|
6831
|
-
marker,
|
|
6832
|
-
testId = "document-card",
|
|
6833
|
-
className
|
|
6834
|
-
}) {
|
|
6835
|
-
const normalised = (status ?? "").toLowerCase();
|
|
6836
|
-
const isProcessing = ACTIVE_STATUSES.has(normalised);
|
|
6837
|
-
const showStatusMarker = !isProcessing && TERMINAL_STATUSES2.has(normalised);
|
|
6838
|
-
const [thumbFailed, setThumbFailed] = React2.useState(false);
|
|
6839
|
-
const [thumbLandscape, setThumbLandscape] = React2.useState(false);
|
|
6840
|
-
const showThumbnail = !!thumbnailUrl && !thumbFailed && !isProcessing;
|
|
6841
|
-
return /* @__PURE__ */ jsxs(
|
|
6842
|
-
"div",
|
|
6843
|
-
{
|
|
6844
|
-
"data-testid": testId,
|
|
6845
|
-
className: cn(
|
|
6846
|
-
// Square corners and a portrait-page aspect (height = 1.3 × width), so a
|
|
6847
|
-
// cover-page thumbnail reads edge-to-edge.
|
|
6848
|
-
"group relative aspect-[10/13] select-none overflow-hidden border bg-muted/20 transition",
|
|
6849
|
-
selected ? "border-primary bg-primary/10" : "border-border shadow-sm hover:border-border/80 hover:bg-muted/50",
|
|
6850
|
-
className
|
|
6851
|
-
),
|
|
6852
|
-
children: [
|
|
6853
|
-
showThumbnail ? /* @__PURE__ */ jsx(
|
|
6854
|
-
"img",
|
|
6855
|
-
{
|
|
6856
|
-
src: thumbnailUrl,
|
|
6857
|
-
alt: "",
|
|
6858
|
-
loading: "lazy",
|
|
6859
|
-
draggable: false,
|
|
6860
|
-
onError: () => setThumbFailed(true),
|
|
6861
|
-
onLoad: (e) => setThumbLandscape(e.currentTarget.naturalWidth > e.currentTarget.naturalHeight),
|
|
6862
|
-
className: cn(
|
|
6863
|
-
"absolute inset-0 size-full bg-white",
|
|
6864
|
-
thumbLandscape ? "object-contain" : "object-cover object-top"
|
|
6865
|
-
)
|
|
6866
|
-
}
|
|
6867
|
-
) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center text-muted-foreground", children: fileIcon(doc.file_name, 44) }),
|
|
6868
|
-
isProcessing && /* @__PURE__ */ jsxs(
|
|
6869
|
-
"div",
|
|
6870
|
-
{
|
|
6871
|
-
"data-testid": `${testId}-processing`,
|
|
6872
|
-
className: "absolute inset-0 z-10 flex flex-col items-center justify-center gap-1.5 bg-background/80 px-3",
|
|
6873
|
-
children: [
|
|
6874
|
-
/* @__PURE__ */ jsx("div", { className: "h-1.5 w-full overflow-hidden rounded-sm bg-muted", children: /* @__PURE__ */ jsx("div", { className: "h-full w-1/3 animate-pulse rounded-sm bg-primary" }) }),
|
|
6875
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-primary", children: STATUS_LABEL[normalised] ?? normalised })
|
|
6876
|
-
]
|
|
6877
|
-
}
|
|
6878
|
-
),
|
|
6879
|
-
onToggleSelect && /* @__PURE__ */ jsx(
|
|
6880
|
-
Checkbox,
|
|
6881
|
-
{
|
|
6882
|
-
checked: selected,
|
|
6883
|
-
onCheckedChange: () => onToggleSelect(),
|
|
6884
|
-
onClick: (e) => e.stopPropagation(),
|
|
6885
|
-
"aria-label": selected ? "Deselect" : "Select",
|
|
6886
|
-
"data-testid": `${testId}-select`,
|
|
6887
|
-
className: cn(
|
|
6888
|
-
"absolute left-1.5 top-1.5 z-20 size-6 rounded-none border-muted-foreground/60 bg-background shadow-sm transition",
|
|
6889
|
-
selected ? "opacity-100" : "opacity-40 group-hover:opacity-100"
|
|
6890
|
-
)
|
|
6891
|
-
}
|
|
6892
|
-
),
|
|
6893
|
-
actions && /* @__PURE__ */ jsx("div", { className: "absolute right-1.5 top-1.5 z-20", children: actions }),
|
|
6894
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute inset-x-1.5 bottom-1.5 z-20 flex flex-col gap-1", children: [
|
|
6895
|
-
(marker || showStatusMarker) && /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
6896
|
-
marker,
|
|
6897
|
-
showStatusMarker && /* @__PURE__ */ jsx("div", { className: "ml-auto flex", children: /* @__PURE__ */ jsx(StatusMarker, { status: normalised, testId: `${testId}-status` }) })
|
|
6898
|
-
] }),
|
|
6899
|
-
renaming ? /* @__PURE__ */ jsx(
|
|
6900
|
-
RenameField,
|
|
6901
|
-
{
|
|
6902
|
-
seed: doc.doc_metadata?.title || doc.file_name || "",
|
|
6903
|
-
onCommit: (name) => onCommitRename?.(name),
|
|
6904
|
-
onCancel: () => onCancelRename?.(),
|
|
6905
|
-
testId: `${testId}-rename-input`
|
|
6906
|
-
}
|
|
6907
|
-
) : /* @__PURE__ */ jsx(
|
|
6908
|
-
DocumentEntity,
|
|
6909
|
-
{
|
|
6910
|
-
doc,
|
|
6911
|
-
fullWidth: true,
|
|
6912
|
-
viewing,
|
|
6913
|
-
tooltipContent,
|
|
6914
|
-
labelClassName: "font-semibold",
|
|
6915
|
-
className: "w-full min-w-0 max-w-full bg-background/90 backdrop-blur-sm",
|
|
6916
|
-
onClick: (e) => {
|
|
6917
|
-
e.stopPropagation();
|
|
6918
|
-
onOpen?.();
|
|
6919
|
-
}
|
|
6920
|
-
}
|
|
6921
|
-
)
|
|
6922
|
-
] })
|
|
6923
|
-
]
|
|
6924
|
-
}
|
|
6925
|
-
);
|
|
6926
|
-
}
|
|
6927
4936
|
function DocumentCardMenu({
|
|
6928
4937
|
docId,
|
|
6929
4938
|
fileName,
|
|
@@ -7020,7 +5029,7 @@ function TileTooltip({ title, labels }) {
|
|
|
7020
5029
|
labels.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 border-t border-border/60 pt-1.5", children: labels.map((label) => /* @__PURE__ */ jsx(
|
|
7021
5030
|
"span",
|
|
7022
5031
|
{
|
|
7023
|
-
className: "rounded bg-muted px-1.5 py-0.5 text-
|
|
5032
|
+
className: "rounded bg-muted px-1.5 py-0.5 text-xs font-medium text-foreground/80",
|
|
7024
5033
|
children: label
|
|
7025
5034
|
},
|
|
7026
5035
|
label
|
|
@@ -7040,14 +5049,14 @@ function DocumentGallery({
|
|
|
7040
5049
|
const rows = documents ?? query.data ?? [];
|
|
7041
5050
|
const isLoading = !documents && query.isLoading;
|
|
7042
5051
|
const tagsQuery = useTags(workspaceId);
|
|
7043
|
-
const tagNameById =
|
|
5052
|
+
const tagNameById = React.useMemo(() => {
|
|
7044
5053
|
const map = /* @__PURE__ */ new Map();
|
|
7045
5054
|
for (const t of tagsQuery.data ?? []) {
|
|
7046
5055
|
if (t.external_id) map.set(t.external_id, t.name ?? t.external_id.slice(0, 8));
|
|
7047
5056
|
}
|
|
7048
5057
|
return map;
|
|
7049
5058
|
}, [tagsQuery.data]);
|
|
7050
|
-
const docIds =
|
|
5059
|
+
const docIds = React.useMemo(
|
|
7051
5060
|
() => rows.map((d) => d.external_id).filter((id) => !!id),
|
|
7052
5061
|
[rows]
|
|
7053
5062
|
);
|
|
@@ -7059,8 +5068,8 @@ function DocumentGallery({
|
|
|
7059
5068
|
const setViewingDocId = useArbiUiStore((s) => s.setViewingDocId);
|
|
7060
5069
|
const effectiveSelected = selectedIds ?? storeSelected;
|
|
7061
5070
|
const emitSelection = onSelectionChange ?? storeSetSelected;
|
|
7062
|
-
const selectedSet =
|
|
7063
|
-
const toggleSelected =
|
|
5071
|
+
const selectedSet = React.useMemo(() => new Set(effectiveSelected), [effectiveSelected]);
|
|
5072
|
+
const toggleSelected = React.useCallback(
|
|
7064
5073
|
(id) => {
|
|
7065
5074
|
const next = new Set(effectiveSelected);
|
|
7066
5075
|
if (next.has(id)) next.delete(id);
|
|
@@ -7069,7 +5078,7 @@ function DocumentGallery({
|
|
|
7069
5078
|
},
|
|
7070
5079
|
[effectiveSelected, emitSelection]
|
|
7071
5080
|
);
|
|
7072
|
-
const openDocument =
|
|
5081
|
+
const openDocument = React.useCallback(
|
|
7073
5082
|
(id) => {
|
|
7074
5083
|
setViewingDocId(id);
|
|
7075
5084
|
onOpenDocument?.(id);
|
|
@@ -7078,7 +5087,7 @@ function DocumentGallery({
|
|
|
7078
5087
|
);
|
|
7079
5088
|
const arbi = useArbi();
|
|
7080
5089
|
const queryClient = useQueryClient();
|
|
7081
|
-
const [renamingId, setRenamingId] =
|
|
5090
|
+
const [renamingId, setRenamingId] = React.useState(null);
|
|
7082
5091
|
const rename = useMutation({
|
|
7083
5092
|
mutationFn: ({ doc, title }) => arbi.documents.update([
|
|
7084
5093
|
{ external_id: doc.external_id, doc_metadata: { ...doc.doc_metadata, title } }
|
|
@@ -7703,6 +5712,6 @@ function hasVideoTrack(blob) {
|
|
|
7703
5712
|
});
|
|
7704
5713
|
}
|
|
7705
5714
|
|
|
7706
|
-
export { ActivityFeed,
|
|
5715
|
+
export { ActivityFeed, AiActionCard, AiAnswer, AppleIcon, ArbiBotIcon, ArbiChat, ArbiChatPanel, ArbiIcon, ArbiWebSocketProvider, ArtifactCanvas, ChatBubble, CitationRenderer, ClaudeIcon, CommandPalette, CommandPaletteProvider, ConversationList, DEFAULT_ASPECT_OPTIONS, DateSeparator, DirectMessages, DmAvatar, DmComposer, DocIcon, DocQaPanel, DocSearch, DocumentCardMenu, DocumentGallery, DocumentReview, DocumentTable, DraftTitleControls, FileIcon, FireworksIcon, GeminiIcon, GitHubIcon, GoogleIcon, HtmlIcon, ImageCropModal, ImageCropper, LinkedInIcon, MessageArtifactCard, MessageBubble2 as MessageBubble, MessageThread, OpenAIIcon, PhotoCapture, ProviderIcon, RUN_WINDOW_MS, SemanticSearch, TxtIcon, TypingIndicator, VideoCapture, VoiceNoteRecorder, XlsIcon, annotateThread, arbiQueryKeys, captureFrameAsBlob, cropImage, dayKey, describeActivity, getNotificationTypeMeta, getWorkspaceActionText, getWorkspaceSentPhrase, hasVideoTrack, isWorkspaceNotificationType, parseActivityContent, redlineStats, textToArtifact, toRedlineMarkdown, useActivity, useAgents, useAiTask, useArbiConnected, useArbiDocumentSync, useArbiUiStore, useArbiWebSocket, useArbiWsContext, useArbiWsMessage, useArbiWsStatus, useArbiWsStore, useArbiWsTask, useArbiWsTasks, useAssistantQuery, useCameraStream, useCommandPalette, useConfigs, useConversations, useDeleteAgents, useDirectMessages, useDocuments, useFacts, useHealth, useParsedDocument, useProjectInvoices, useProjectUsage, useProjects, useProjectsUsage, useSemanticSearch, useSessions, useTags, useTasks, useThumbnails, useUserUsageToday, useVideoRecorder, useWorkspaceDocs, useWorkspaces, userDisplayName, userInitials };
|
|
7707
5716
|
//# sourceMappingURL=index.js.map
|
|
7708
5717
|
//# sourceMappingURL=index.js.map
|