@flexkit/studio 0.0.35 → 0.0.36

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/ui.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
3
  import { JSX, ReactNode, Dispatch, SetStateAction, HTMLAttributes, ComponentProps, RefObject, FormEvent, PropsWithChildren, ElementType } from 'react';
4
- import { Avatar as Avatar$1, Dialog as Dialog$1, DropdownMenu as DropdownMenu$1, Slot, Label as Label$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, Separator as Separator$1, ScrollArea as ScrollArea$1, Select as Select$1, Tooltip as Tooltip$1, Switch as Switch$1, Tabs as Tabs$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, HoverCard as HoverCard$1 } from 'radix-ui';
4
+ import { Avatar as Avatar$1, Dialog as Dialog$1, DropdownMenu as DropdownMenu$1, Slot, Label as Label$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, Popover as Popover$1, Separator as Separator$1, ScrollArea as ScrollArea$1, Select as Select$1, Tooltip as Tooltip$1, Switch as Switch$1, Tabs as Tabs$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, HoverCard as HoverCard$1 } from 'radix-ui';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
7
7
  import * as react_hook_form from 'react-hook-form';
@@ -129,6 +129,11 @@ declare function CommandShortcut({ className, ...props }: React$1.ComponentProps
129
129
 
130
130
  declare function Label({ className, ...props }: React$1.ComponentProps<typeof Label$1.Root>): react_jsx_runtime.JSX.Element;
131
131
 
132
+ declare function Popover({ ...props }: React$1.ComponentProps<typeof Popover$1.Root>): react_jsx_runtime.JSX.Element;
133
+ declare function PopoverTrigger({ ...props }: React$1.ComponentProps<typeof Popover$1.Trigger>): react_jsx_runtime.JSX.Element;
134
+ declare function PopoverContent({ className, align, sideOffset, ...props }: React$1.ComponentProps<typeof Popover$1.Content>): react_jsx_runtime.JSX.Element;
135
+ declare function PopoverAnchor({ ...props }: React$1.ComponentProps<typeof Popover$1.Anchor>): react_jsx_runtime.JSX.Element;
136
+
132
137
  declare function ResizablePanelGroup({ className, ...props }: ResizablePrimitive.GroupProps): react_jsx_runtime.JSX.Element;
133
138
  declare function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps): react_jsx_runtime.JSX.Element;
134
139
  declare function ResizableHandle({ withHandle, className, ...props }: ResizablePrimitive.SeparatorProps & {
@@ -735,4 +740,4 @@ declare function Alert({ className, variant, ...props }: React$1.ComponentProps<
735
740
  declare function AlertTitle({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
736
741
  declare function AlertDescription({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
737
742
 
738
- export { Alert, AlertDescription, AlertTitle, Attachment, type AttachmentData, AttachmentEmpty, type AttachmentEmptyProps, AttachmentHoverCard, AttachmentHoverCardContent, type AttachmentHoverCardContentProps, type AttachmentHoverCardProps, AttachmentHoverCardTrigger, type AttachmentHoverCardTriggerProps, AttachmentInfo, type AttachmentInfoProps, type AttachmentMediaCategory, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, type AttachmentVariant, Attachments, type AttachmentsContext, type AttachmentsProps, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, type CodeBlockCopyButtonProps, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, type CodeBlockLanguageSelectorContentProps, CodeBlockLanguageSelectorItem, type CodeBlockLanguageSelectorItemProps, type CodeBlockLanguageSelectorProps, CodeBlockLanguageSelectorTrigger, type CodeBlockLanguageSelectorTriggerProps, CodeBlockLanguageSelectorValue, type CodeBlockLanguageSelectorValueProps, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Conversation, ConversationContent, type ConversationContentProps, ConversationDownload, type ConversationDownloadProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DrawerModal, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ExternalLink, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InsufficientPermissionsTooltipContent, Label, LocalReferencedSourcesContext, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, PermissionTooltip, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, type PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, type PromptInputButtonTooltip, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, type ReferencedSourcesContext, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shimmer, Sidebar$1 as Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, Sidebar as SidebarPanel, SidebarProvider, SidebarRail, SidebarTrigger, Skeleton, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpeechInput, type SpeechInputProps, Spinner, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TextInputContext, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolPart, type ToolProps, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, getAttachmentLabel, getMediaCategory, getStatusBadge, highlightCode, messagesToMarkdown, toggleVariants, useAttachmentContext, useAttachmentsContext, useFormField, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments, useReasoning, useSidebar };
743
+ export { Alert, AlertDescription, AlertTitle, Attachment, type AttachmentData, AttachmentEmpty, type AttachmentEmptyProps, AttachmentHoverCard, AttachmentHoverCardContent, type AttachmentHoverCardContentProps, type AttachmentHoverCardProps, AttachmentHoverCardTrigger, type AttachmentHoverCardTriggerProps, AttachmentInfo, type AttachmentInfoProps, type AttachmentMediaCategory, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, type AttachmentVariant, Attachments, type AttachmentsContext, type AttachmentsProps, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, type CodeBlockCopyButtonProps, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, type CodeBlockLanguageSelectorContentProps, CodeBlockLanguageSelectorItem, type CodeBlockLanguageSelectorItemProps, type CodeBlockLanguageSelectorProps, CodeBlockLanguageSelectorTrigger, type CodeBlockLanguageSelectorTriggerProps, CodeBlockLanguageSelectorValue, type CodeBlockLanguageSelectorValueProps, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Conversation, ConversationContent, type ConversationContentProps, ConversationDownload, type ConversationDownloadProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DrawerModal, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ExternalLink, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InsufficientPermissionsTooltipContent, Label, LocalReferencedSourcesContext, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, PermissionTooltip, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, type PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, type PromptInputButtonTooltip, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, type ReferencedSourcesContext, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shimmer, Sidebar$1 as Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, Sidebar as SidebarPanel, SidebarProvider, SidebarRail, SidebarTrigger, Skeleton, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpeechInput, type SpeechInputProps, Spinner, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TextInputContext, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolPart, type ToolProps, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, getAttachmentLabel, getMediaCategory, getStatusBadge, highlightCode, messagesToMarkdown, toggleVariants, useAttachmentContext, useAttachmentsContext, useFormField, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments, useReasoning, useSidebar };
package/dist/ui.js CHANGED
@@ -1,7 +1,7 @@
1
- import'./index.css';import {o,p,q}from'./chunk-CCXRYZ5I.js';export{e as Alert,g as AlertDescription,f as AlertTitle,o as Collapsible,q as CollapsibleContent,p as CollapsibleTrigger,j as DrawerModal,z as InsufficientPermissionsTooltipContent,A as PermissionTooltip,r as Table,t as TableBody,y as TableCaption,x as TableCell,u as TableFooter,w as TableHead,s as TableHeader,v as TableRow,k as Tabs,n as TabsContent,l as TabsList,m as TabsTrigger,i as Toaster,b as Toggle,c as ToggleGroup,d as ToggleGroupItem,h as toast,a as toggleVariants}from'./chunk-CCXRYZ5I.js';import {a as a$2}from'./chunk-YSLN4XT6.js';export{a as Input}from'./chunk-YSLN4XT6.js';import {a as a$3}from'./chunk-7BOX7HHO.js';export{a as Textarea}from'./chunk-7BOX7HHO.js';import {a as a$1,b as b$1,c,e}from'./chunk-USNXQOMJ.js';export{b as Tooltip,e as TooltipContent,d as TooltipPortal,a as TooltipProvider,c as TooltipTrigger}from'./chunk-USNXQOMJ.js';import {b as b$2,c as c$2}from'./chunk-AICNS7KW.js';export{b as ButtonGroup,d as ButtonGroupSeparator,c as ButtonGroupText,a as buttonGroupVariants}from'./chunk-AICNS7KW.js';import {d as d$1,e as e$2,i,l,n,o as o$1,p as p$1,q as q$1,r,s,u,v,t,w,x,b as b$3}from'./chunk-W3Z33ETA.js';export{b as Badge,n as Command,o as CommandDialog,r as CommandEmpty,s as CommandGroup,p as CommandInput,u as CommandItem,q as CommandList,t as CommandSeparator,v as CommandShortcut,d as Dialog,g as DialogClose,i as DialogContent,m as DialogDescription,k as DialogFooter,j as DialogHeader,h as DialogOverlay,f as DialogPortal,l as DialogTitle,e as DialogTrigger,w as ScrollArea,x as ScrollBar,c as Separator,a as badgeVariants}from'./chunk-W3Z33ETA.js';import {a as a$4,d,c as c$1,e as e$1,g}from'./chunk-HDOIOXMP.js';export{a as Select,e as SelectContent,b as SelectGroup,g as SelectItem,f as SelectLabel,j as SelectScrollDownButton,i as SelectScrollUpButton,h as SelectSeparator,d as SelectTrigger,c as SelectValue}from'./chunk-HDOIOXMP.js';export{a as Avatar,c as AvatarFallback,d as AvatarGroup,b as AvatarImage}from'./chunk-IRY4KWB5.js';import {h,c as c$3,e as e$3,f}from'./chunk-HMMBYXYA.js';export{c as DropdownMenu,i as DropdownMenuCheckboxItem,f as DropdownMenuContent,g as DropdownMenuGroup,h as DropdownMenuItem,l as DropdownMenuLabel,d as DropdownMenuPortal,j as DropdownMenuRadioGroup,k as DropdownMenuRadioItem,m as DropdownMenuSeparator,n as DropdownMenuShortcut,o as DropdownMenuSub,q as DropdownMenuSubContent,p as DropdownMenuSubTrigger,e as DropdownMenuTrigger,r as Skeleton}from'./chunk-HMMBYXYA.js';import {b}from'./chunk-6NRQMG26.js';export{b as Button,a as buttonVariants}from'./chunk-6NRQMG26.js';export{a as Switch}from'./chunk-QVBNGGOE.js';export{j as Checkbox,b as Form,g as FormControl,h as FormDescription,c as FormField,e as FormItem,f as FormLabel,i as FormMessage,a as Label,d as useFormField}from'./chunk-GBM7VKFS.js';import {a}from'./chunk-O2QMYUPS.js';import*as rt from'lucide-react';import {BrainIcon,ChevronDownIcon,XCircleIcon,CheckCircleIcon,CircleIcon,ClockIcon,SquareArrowOutUpRight,GripVerticalIcon,XIcon,PanelLeftIcon,Loader2Icon,CheckIcon,CopyIcon,ArrowDownIcon,DownloadIcon,ChevronLeftIcon,ChevronRightIcon,ImageIcon,Monitor,PlusIcon,CornerDownLeftIcon,SquareIcon,BookIcon,LoaderIcon,MicIcon,WrenchIcon,VideoIcon,PaperclipIcon,GlobeIcon,FileTextIcon,Music2Icon}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import*as fe from'react-resizable-panels';import {Dialog,Slot,HoverCard}from'radix-ui';import*as H from'react';import {createContext,memo,useMemo,useRef,useState,useEffect,useCallback,useContext,createElement,Children,isValidElement}from'react';import Dn from'fuse.js';import {NavLink}from'react-router-dom';import {cva}from'class-variance-authority';import {groupBy}from'ramda';import {createHighlighter}from'shiki';import {StickToBottom,useStickToBottomContext}from'use-stick-to-bottom';import {cjk}from'@streamdown/cjk';import {code}from'@streamdown/code';import {math}from'@streamdown/math';import {mermaid}from'@streamdown/mermaid';import {Streamdown}from'streamdown';import {nanoid}from'nanoid';import {useControllableState}from'@radix-ui/react-use-controllable-state';import {motion}from'motion/react';function fn({href:e,children:t}){return jsx(b,{asChild:true,className:"fk:h-6 fk:px-1! fk:py-0 fk:text-sm fk:font-light fk:text-link",size:"sm",variant:"link",children:jsxs("a",{href:e,target:"_blank",children:[t," ",jsx(SquareArrowOutUpRight,{className:"fk:size-3",strokeWidth:3})]})})}function mn({className:e,...t}){return jsx(fe.Group,{"data-slot":"resizable-panel-group",className:a("fk:flex fk:h-full fk:w-full fk:aria-[orientation=vertical]:flex-col",e),...t})}function kn({...e}){return jsx(fe.Panel,{"data-slot":"resizable-panel",...e})}function gn({withHandle:e,className:t,...o}){return jsx(fe.Separator,{"data-slot":"resizable-handle",className:a("fk:relative fk:flex fk:w-px fk:items-center fk:justify-center fk:bg-border fk:after:absolute fk:after:inset-y-0 fk:after:left-1/2 fk:after:w-1 fk:after:-translate-x-1/2 fk:focus-visible:ring-1 fk:focus-visible:ring-ring fk:focus-visible:ring-offset-1 fk:focus-visible:outline-hidden fk:aria-[orientation=horizontal]:h-px fk:aria-[orientation=horizontal]:w-full fk:aria-[orientation=horizontal]:after:left-0 fk:aria-[orientation=horizontal]:after:h-1 fk:aria-[orientation=horizontal]:after:w-full fk:aria-[orientation=horizontal]:after:translate-x-0 fk:aria-[orientation=horizontal]:after:-translate-y-1/2 fk:[&[aria-orientation=horizontal]>div]:rotate-90",t),...o,children:e&&jsx("div",{className:"fk:z-10 fk:flex fk:h-8 fk:w-3 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:bg-border fk:corner-squircle",children:jsx(GripVerticalIcon,{className:"fk:size-2.5"})})})}function Nt({...e}){return jsx(Dialog.Root,{"data-slot":"sheet",...e})}function hn({...e}){return jsx(Dialog.Trigger,{"data-slot":"sheet-trigger",...e})}function xn({...e}){return jsx(Dialog.Close,{"data-slot":"sheet-close",...e})}function no({...e}){return jsx(Dialog.Portal,{"data-slot":"sheet-portal",...e})}function ao({className:e,...t}){return jsx(Dialog.Overlay,{"data-slot":"sheet-overlay",className:a("fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0",e),...t})}function Rt({className:e,children:t,side:o="right",showCloseButton:r=true,...a$1}){return jsxs(no,{children:[jsx(ao,{}),jsxs(Dialog.Content,{"data-slot":"sheet-content",className:a("fk:fixed fk:z-50 fk:flex fk:flex-col fk:gap-4 fk:bg-background fk:shadow-lg fk:transition fk:ease-in-out fk:data-[state=closed]:animate-out fk:data-[state=closed]:duration-300 fk:data-[state=open]:animate-in fk:data-[state=open]:duration-500",o==="right"&&"fk:inset-y-0 fk:right-0 fk:h-full fk:w-3/4 fk:border-l fk:data-[state=closed]:slide-out-to-right fk:data-[state=open]:slide-in-from-right fk:sm:max-w-sm",o==="left"&&"fk:inset-y-0 fk:left-0 fk:h-full fk:w-3/4 fk:border-r fk:data-[state=closed]:slide-out-to-left fk:data-[state=open]:slide-in-from-left fk:sm:max-w-sm",o==="top"&&"fk:inset-x-0 fk:top-0 fk:h-auto fk:border-b fk:data-[state=closed]:slide-out-to-top fk:data-[state=open]:slide-in-from-top",o==="bottom"&&"fk:inset-x-0 fk:bottom-0 fk:h-auto fk:border-t fk:data-[state=closed]:slide-out-to-bottom fk:data-[state=open]:slide-in-from-bottom",e),...a$1,children:[t,r&&jsxs(Dialog.Close,{className:"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-secondary fk:corner-squircle",children:[jsx(XIcon,{className:"fk:size-4"}),jsx("span",{className:"fk:sr-only",children:"Close"})]})]})]})}function At({className:e,...t}){return jsx("div",{"data-slot":"sheet-header",className:a("fk:flex fk:flex-col fk:gap-1.5 fk:p-4",e),...t})}function vn({className:e,...t}){return jsx("div",{"data-slot":"sheet-footer",className:a("fk:mt-auto fk:flex fk:flex-col fk:gap-2 fk:p-4",e),...t})}function Bt({className:e,...t}){return jsx(Dialog.Title,{"data-slot":"sheet-title",className:a("fk:font-semibold fk:text-foreground",e),...t})}function Lt({className:e,...t}){return jsx(Dialog.Description,{"data-slot":"sheet-description",className:a("fk:text-sm fk:text-muted-foreground",e),...t})}var Dt=768;function so(){let[e,t]=H.useState(void 0);return H.useEffect(()=>{let o=window.matchMedia(`(max-width: ${Dt-1}px)`),r=()=>{t(window.innerWidth<Dt);};return o.addEventListener("change",r),t(window.innerWidth<Dt),()=>o.removeEventListener("change",r)},[]),!!e}var yn="flexkit:sidebar:state",Sn=3600*24*7,Tn="16rem",In="18rem",wn="2rem",Mn="b",lo=H.createContext(null);function Ge(){let e=H.useContext(lo);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Nn({defaultOpen:e=true,open:t,onOpenChange:o,className:r,style:a$2,children:i,...s}){let l=so(),[p,c]=H.useState(false),[m,k]=H.useState(e),g=t??m,T=H.useCallback(f=>{let x=typeof f=="function"?f(g):f;o?o(x):k(x),document.cookie=`${yn}=${x}; path=/; max-age=${Sn}`;},[o,g]),b=H.useCallback(()=>l?c(f=>!f):T(f=>!f),[l,T,c]);H.useEffect(()=>{let f=x=>{x.key===Mn&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),b());};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[b]);let C=g?"expanded":"collapsed",N=H.useMemo(()=>({state:C,open:g,setOpen:T,isMobile:l,openMobile:p,setOpenMobile:c,toggleSidebar:b}),[C,g,T,l,p,c,b]);return jsx(lo.Provider,{value:N,children:jsx(a$1,{delayDuration:0,children:jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Tn,"--sidebar-width-icon":wn,...a$2},className:a("fk:group/sidebar-wrapper fk:flex fk:w-full fk:has-data-[variant=inset]:bg-sidebar fk:overflow-hidden",r),...s,children:i})})})}function Et({side:e="left",variant:t="sidebar",collapsible:o="offcanvas",className:r,children:a$1,...i}){let{isMobile:s,state:l,openMobile:p,setOpenMobile:c}=Ge();return o==="none"?jsx("div",{"data-slot":"sidebar",className:a("fk:flex fk:h-full fk:w-(--sidebar-width) fk:flex-col fk:bg-sidebar fk:text-sidebar-foreground",r),...i,children:a$1}):s?jsx(Nt,{open:p,onOpenChange:c,...i,children:jsxs(Rt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"fk:w-(--sidebar-width) fk:bg-sidebar fk:p-0 fk:text-sidebar-foreground fk:[&>button]:hidden",style:{"--sidebar-width":In},side:e,children:[jsxs(At,{className:"fk:sr-only",children:[jsx(Bt,{children:"Sidebar"}),jsx(Lt,{children:"Displays the mobile sidebar."})]}),jsx("div",{className:"fk:flex fk:h-full fk:w-full fk:flex-col",children:a$1})]})}):jsxs("div",{className:"fk:group fk:peer flexkit-sidebar-desktop-block fk:text-sidebar-foreground","data-state":l,"data-collapsible":l==="collapsed"?o:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[jsx("div",{"data-slot":"sidebar-gap",className:a("fk:relative fk:w-(--sidebar-width) fk:bg-transparent fk:transition-[width] fk:duration-200 fk:ease-linear","fk:group-data-[collapsible=offcanvas]:w-0","fk:group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"fk:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"fk:group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),jsx("div",{"data-slot":"sidebar-container",className:a("fk:relative fk:inset-y-0 fk:z-10 flexkit-sidebar-desktop-flex fk:h-[calc(100svh-3.5rem)] fk:w-(--sidebar-width) fk:transition-[left,right,width] fk:duration-200 fk:ease-linear",e==="left"?"fk:left-0 fk:group-data-[collapsible=offcanvas]:-left-(--sidebar-width)":"fk:right-0 k:group-data-[collapsible=offcanvas]:-right-(--sidebar-width)",t==="floating"||t==="inset"?"fk:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)] fk:group-data-[side=left]:border-r":"fk:group-data-[collapsible=icon]:w-(--sidebar-width-icon) fk:group-data-[side=left]:border-r fk:group-data-[side=right]:border-l",r),...i,children:jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"fk:flex fk:h-full fk:w-full fk:flex-col fk:bg-sidebar fk:group-data-[variant=floating]:rounded-lg fk:group-data-[variant=floating]:border fk:group-data-[variant=floating]:border-sidebar-border fk:group-data-[variant=floating]:shadow-sm",children:a$1})})]})}function Rn({className:e,onClick:t,...o}){let{toggleSidebar:r}=Ge();return jsxs(b,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:a("fk:size-7",e),onClick:a=>{t?.(a),r();},...o,children:[jsx(PanelLeftIcon,{}),jsx("span",{className:"fk:sr-only",children:"Toggle Sidebar"})]})}function zt({className:e,...t}){let{toggleSidebar:o}=Ge();return jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:o,title:"Toggle Sidebar",className:a("fk:absolute fk:inset-y-0 fk:z-20 flexkit-sidebar-sm-flex fk:w-4 fk:-translate-x-1/2 fk:transition-all fk:ease-linear fk:group-data-[side=left]:-right-4 fk:group-data-[side=right]:left-0 fk:after:absolute fk:after:inset-y-0 fk:after:left-1/2 fk:after:w-[2px] fk:hover:after:bg-sidebar-border","fk:in-data-[side=left]:cursor-w-resize fk:in-data-[side=right]:cursor-e-resize","fk:[[data-side=left][data-state=collapsed]_&]:cursor-e-resize fk:[[data-side=right][data-state=collapsed]_&]:cursor-w-resize","fk:group-data-[collapsible=offcanvas]:translate-x-0 fk:group-data-[collapsible=offcanvas]:after:left-full fk:hover:group-data-[collapsible=offcanvas]:bg-sidebar","fk:[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","fk:[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function An({className:e,...t}){return jsx("main",{"data-slot":"sidebar-inset",className:a("fk:relative fk:flex fk:flex-1 fk:flex-col fk:bg-background fk:overflow-hidden fk:peer-data-[variant=inset]:h-[calc(100svh-3.625rem)]",e),...t})}function Ht({className:e,...t}){return jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a("fk:flex fk:min-h-0 fk:flex-1 fk:flex-col fk:overflow-auto fk:group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Ze({className:e,...t}){return jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a("fk:relative fk:flex fk:w-full fk:min-w-0 fk:flex-col fk:p-2",e),...t})}function Gt({className:e,asChild:t=false,...o}){let r=t?Slot.Root:"div";return jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:a("fk:flex fk:h-8 fk:shrink-0 fk:items-center fk:rounded-md fk:px-2 fk:text-xs fk:font-medium fk:text-sidebar-foreground/70 fk:ring-sidebar-ring fk:outline-hidden fk:transition-[margin,opacity] fk:duration-200 fk:ease-linear fk:focus-visible:ring-2 fk:[&>svg]:size-4 fk:[&>svg]:shrink-0 fk:corner-squircle","fk:group-data-[collapsible=icon]:-mt-8 fk:group-data-[collapsible=icon]:opacity-0",e),...o})}function Bn({className:e,...t}){return jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a("fk:w-full fk:text-sm",e),...t})}function Qe({className:e,...t}){return jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a("fk:flex fk:w-full fk:min-w-0 fk:flex-col fk:gap-1",e),...t})}function et({className:e,...t}){return jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a("fk:group/menu-item fk:relative",e),...t})}var Ln=cva("fk:peer/menu-button fk:flex fk:w-full fk:items-center fk:gap-2 fk:overflow-hidden fk:rounded-md fk:p-2 fk:text-left fk:text-sm fk:ring-sidebar-ring fk:outline-hidden fk:transition-[width,height,padding] fk:group-has-data-[sidebar=menu-action]/menu-item:pr-8 fk:group-data-[collapsible=icon]:size-8! fk:group-data-[collapsible=icon]:p-2! fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground fk:focus-visible:ring-2 fk:active:bg-sidebar-accent fk:active:text-sidebar-accent-foreground fk:disabled:pointer-events-none fk:disabled:opacity-50 fk:aria-disabled:pointer-events-none fk:aria-disabled:opacity-50 fk:data-[active=true]:bg-sidebar-accent fk:data-[active=true]:font-medium fk:data-[active=true]:text-sidebar-accent-foreground fk:data-[state=open]:hover:bg-sidebar-accent fk:data-[state=open]:hover:text-sidebar-accent-foreground fk:[&>span:last-child]:truncate fk:[&>svg]:size-4 fk:[&>svg]:shrink-0 fk:corner-squircle",{variants:{variant:{default:"fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground",outline:"fk:bg-background fk:shadow-[0_0_0_1px_hsl(var(--sidebar-border))] fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground fk:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"fk:h-8 fk:text-sm",sm:"fk:h-7 fk:text-xs",lg:"fk:h-12 fk:text-sm fk:group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function tt({asChild:e$1=false,isActive:t=false,variant:o="default",size:r="default",tooltip:a$1,className:i,...s}){let l=e$1?Slot.Root:"button",{isMobile:p,state:c$1}=Ge(),m=jsx(l,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":t,className:a(Ln({variant:o,size:r}),i),...s});return a$1?(typeof a$1=="string"&&(a$1={children:a$1}),jsxs(b$1,{children:[jsx(c,{asChild:true,children:m}),jsx(e,{side:"right",align:"center",hidden:c$1!=="collapsed"||p,...a$1})]})):m}var co=NavLink,Hn=Object.keys(rt).map(e=>({name:e,icon:rt[e]})),Gn=new Dn(Hn,{keys:["name"],threshold:.5});function On({className:e,menuGroups:t,schema:o}){let r=o.filter(s=>!(s.menu&&"hidden"in s.menu)),a=groupBy(s=>s.menu?.group&&t?.find(l=>l.name===s.menu?.group)?.name||"ungrouped",r),i=t?.filter(s=>a[s.name]?.length);return jsxs(Et,{className:e,collapsible:"icon",variant:"inset",children:[jsxs(Ht,{children:[i?.map(s=>jsxs(Ze,{children:[jsx(Gt,{children:s.title}),jsx(Qe,{children:a[s.name]?.map(l=>jsx(et,{children:jsx(tt,{asChild:true,isActive:location.pathname.includes(`/list/${l.plural}`),tooltip:ot(l.menu?.label??l.plural),children:jsxs(co,{to:`list/${l.plural}`,children:[l.menu?.icon??createElement(rt[fo(l.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:ot(l.menu?.label??l.plural)})]})})},l.plural))})]},s.name)),jsx(Ze,{children:jsx(Qe,{children:a.ungrouped?.map(s=>jsx(et,{children:jsx(tt,{asChild:true,isActive:location.pathname.includes(`/list/${s.plural}`),tooltip:ot(s.menu?.label??s.plural),children:jsxs(co,{to:`list/${s.plural}`,children:[createElement(rt[fo(s.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:ot(s.menu?.label??s.plural)})]})})},s.plural))})})]}),jsx(zt,{})]})}function ot(e){let t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1).trim()}function fo(e){let t=Gn.search(e);return t.length>0?t[0].item.name:"Dock"}function Ue({...e}){return jsx(HoverCard.Root,{"data-slot":"hover-card",...e})}function Fe({...e}){return jsx(HoverCard.Trigger,{"data-slot":"hover-card-trigger",...e})}function _e({className:e,align:t="center",sideOffset:o=4,...r}){return jsx(HoverCard.Portal,{"data-slot":"hover-card-portal",children:jsx(HoverCard.Content,{"data-slot":"hover-card-content",align:t,sideOffset:o,className:a("fk:z-50 fk:w-64 fk:origin-(--radix-hover-card-content-transform-origin) fk:rounded-md fk:border fk:bg-popover fk:p-4 fk:text-popover-foreground fk:shadow-md fk:outline-hidden fk:data-[side=bottom]:slide-in-from-top-2 fk:data-[side=left]:slide-in-from-right-2 fk:data-[side=right]:slide-in-from-left-2 fk:data-[side=top]:slide-in-from-bottom-2 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:corner-squircle",e),...r})})}function Ot({className:e,...t}){return jsx(Loader2Icon,{role:"status","aria-label":"Loading",className:a("fk:size-4 fk:animate-spin",e),...t})}function Ut({className:e,...t}){return jsx("div",{"data-slot":"input-group",role:"group",className:a("fk:group/input-group fk:border-input fk:dark:bg-input/30 fk:shadow-xs fk:relative fk:flex fk:w-full fk:items-center fk:rounded-md fk:border fk:outline-none fk:transition-[color,box-shadow] fk:corner-squircle","fk:h-9 fk:has-[>textarea]:h-auto","fk:has-[>[data-align=inline-start]]:[&>input]:pl-2","fk:has-[>[data-align=inline-end]]:[&>input]:pr-2","fk:has-[>[data-align=block-start]]:h-auto fk:has-[>[data-align=block-start]]:flex-col fk:has-[>[data-align=block-start]]:[&>input]:pb-3","fk:has-[>[data-align=block-end]]:h-auto fk:has-[>[data-align=block-end]]:flex-col fk:has-[>[data-align=block-end]]:[&>input]:pt-3","fk:has-[[data-slot=input-group-control]:focus-visible]:ring-ring fk:has-[[data-slot=input-group-control]:focus-visible]:ring-1","fk:has-[[data-slot][aria-invalid=true]]:ring-destructive/20 fk:has-[[data-slot][aria-invalid=true]]:border-destructive fk:dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}var _n=cva("fk:text-muted-foreground fk:flex fk:h-auto fk:cursor-text fk:select-none fk:items-center fk:justify-center fk:gap-2 fk:py-1.5 fk:text-sm fk:font-medium fk:group-data-[disabled=true]/input-group:opacity-50 fk:[&>kbd]:rounded-[calc(var(--radius)-5px)] fk:[&>svg:not([class*=size-])]:size-4",{variants:{align:{"inline-start":"fk:order-first fk:pl-3 fk:has-[>button]:ml-[-0.45rem] fk:has-[>kbd]:ml-[-0.35rem]","inline-end":"fk:order-last fk:pr-3 fk:has-[>button]:mr-[-0.4rem] fk:has-[>kbd]:mr-[-0.35rem]","block-start":"fk:[.border-b]:pb-3 fk:order-first fk:w-full fk:justify-start fk:px-3 fk:pt-3 fk:group-has-[>input]/input-group:pt-2.5","block-end":"fk:[.border-t]:pt-3 fk:order-last fk:w-full fk:justify-start fk:px-3 fk:pb-3 fk:group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function st({className:e,align:t="inline-start",...o}){return jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:a(_n({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus();},...o})}var Vn=cva("fk:flex fk:items-center fk:gap-2 fk:text-sm fk:shadow-none",{variants:{size:{xs:"fk:h-6 fk:gap-1 fk:rounded-[calc(var(--radius)-5px)] fk:px-2 fk:has-[>svg]:px-2 fk:[&>svg:not([class*=size-])]:size-3.5 fk:corner-squircle",sm:"fk:h-8 fk:gap-1.5 fk:rounded-md fk:px-2.5 fk:has-[>svg]:px-2.5 fk:corner-squircle","icon-xs":"fk:size-6 fk:rounded-[calc(var(--radius)-5px)] fk:p-0 fk:has-[>svg]:p-0 fk:corner-squircle","icon-sm":"fk:size-8 fk:p-0 fk:has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function it({className:e,type:t="button",variant:o="ghost",size:r="xs",...a$1}){return jsx(b,{type:t,"data-size":r,variant:o,className:a(Vn({size:r}),e),...a$1})}function qn({className:e,...t}){return jsx("span",{className:a("fk:text-muted-foreground fk:flex fk:items-center fk:gap-2 fk:text-sm fk:[&_svg:not([class*=size-])]:size-4 fk:[&_svg]:pointer-events-none",e),...t})}function jn({className:e,...t}){return jsx(a$2,{"data-slot":"input-group-control",className:a("fk:flex-1 fk:rounded-none fk:border-0 fk:bg-transparent fk:shadow-none fk:focus-visible:ring-0 fk:dark:bg-transparent fk:corner-squircle",e),...t})}function Ft({className:e,...t}){return jsx(a$3,{"data-slot":"input-group-control",className:a("fk:flex-1 fk:resize-none fk:rounded-none fk:border-0 fk:bg-transparent fk:py-3 fk:shadow-none fk:focus-visible:ring-0 fk:dark:bg-transparent fk:corner-squircle",e),...t})}var ea={audio:Music2Icon,document:FileTextIcon,image:ImageIcon,source:GlobeIcon,unknown:PaperclipIcon,video:VideoIcon},bo=e=>{if(e.type==="source-document")return "source";let t=e.mediaType??"";return t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/")||t.startsWith("text/")?"document":"unknown"},ta=e=>{if(e.type==="source-document")return e.title||e.filename||"Source";let t=bo(e);return e.filename||(t==="image"?"Image":"Attachment")},oa=(e,t,o)=>o?jsx("img",{alt:t||"Image",className:"fk:size-full fk:object-cover",height:96,src:e,width:96}):jsx("img",{alt:t||"Image",className:"fk:size-full fk:rounded fk:object-cover fk:corner-squircle",height:20,src:e,width:20}),ho=createContext(null),xo=createContext(null),ra=()=>useContext(ho)??{variant:"grid"},_t=()=>{let e=useContext(xo);if(!e)throw new Error("Attachment components must be used within <Attachment>");return e},Wi=({variant:e="grid",className:t,children:o,...r})=>{let a$1=useMemo(()=>({variant:e}),[e]);return jsx(ho.Provider,{value:a$1,children:jsx("div",{className:a("fk:flex fk:items-start",e==="list"?"fk:flex-col fk:gap-2":"fk:flex-wrap fk:gap-2",e==="grid"&&"fk:ml-auto fk:w-fit",t),...r,children:o})})},$i=({data:e,onRemove:t,className:o,children:r,...a$1})=>{let{variant:i}=ra(),s=bo(e),l=useMemo(()=>({data:e,mediaCategory:s,onRemove:t,variant:i}),[e,s,t,i]);return jsx(xo.Provider,{value:l,children:jsx("div",{className:a("fk:group fk:relative",i==="grid"&&"fk:size-24 fk:overflow-hidden fk:rounded-lg fk:corner-squircle",i==="inline"&&["fk:flex fk:h-8 fk:cursor-pointer fk:select-none fk:items-center fk:gap-1.5","fk:rounded-md fk:border fk:border-border fk:px-1.5 fk:corner-squircle","fk:font-medium fk:text-sm fk:transition-all","fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:hover:bg-accent/50"],i==="list"&&["fk:flex fk:w-full fk:items-center fk:gap-3 fk:rounded-lg fk:border fk:p-3 fk:corner-squircle","fk:hover:bg-accent/50"],o),...a$1,children:r})})},Ki=({fallbackIcon:e,className:t,...o})=>{let{data:r,mediaCategory:a$1,variant:i}=_t(),s=i==="inline"?"fk:size-3":"fk:size-4",l=c=>jsx(c,{className:a(s,"fk:text-muted-foreground")}),p=()=>{if(a$1==="image"&&r.type==="file"&&r.url)return oa(r.url,r.filename,i==="grid");if(a$1==="video"&&r.type==="file"&&r.url)return jsx("video",{className:"fk:size-full fk:object-cover",muted:true,src:r.url});let c=ea[a$1];return e??l(c)};return jsx("div",{className:a("fk:flex fk:shrink-0 fk:items-center fk:justify-center fk:overflow-hidden",i==="grid"&&"fk:size-full fk:bg-muted",i==="inline"&&"fk:size-5 fk:rounded fk:bg-background fk:corner-squircle",i==="list"&&"fk:size-12 fk:rounded fk:bg-muted fk:corner-squircle",t),...o,children:p()})},Xi=({showMediaType:e=false,className:t,...o})=>{let{data:r,variant:a$1}=_t(),i=ta(r);return a$1==="grid"?null:jsxs("div",{className:a("fk:min-w-0 fk:flex-1",t),...o,children:[jsx("span",{className:"fk:block fk:truncate",children:i}),e&&r.mediaType&&jsx("span",{className:"fk:block fk:truncate fk:text-muted-foreground fk:text-xs",children:r.mediaType})]})},Ji=({label:e="Remove",className:t,children:o,...r})=>{let{onRemove:a$1,variant:i}=_t(),s=useCallback(l=>{l.stopPropagation(),a$1?.();},[a$1]);return a$1?jsxs(b,{"aria-label":e,className:a(i==="grid"&&["fk:absolute fk:top-2 fk:right-2 fk:size-6 fk:rounded-full fk:p-0 fk:corner-squircle","fk:bg-background/80 fk:backdrop-blur-sm","fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100","fk:hover:bg-background","fk:[&>svg]:size-3"],i==="inline"&&["fk:size-5 fk:rounded fk:p-0 fk:corner-squircle","fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100","fk:[&>svg]:size-2.5"],i==="list"&&["fk:size-8 fk:shrink-0 fk:rounded fk:p-0 fk:corner-squircle","fk:[&>svg]:size-4"],t),onClick:s,type:"button",variant:"ghost",...r,children:[o??jsx(XIcon,{}),jsx("span",{className:"fk:sr-only",children:e})]}):null},Yi=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Ue,{closeDelay:t,openDelay:e,...o}),Zi=e=>jsx(Fe,{...e}),Qi=({align:e="start",className:t,...o})=>jsx(_e,{align:e,className:a("fk:w-auto fk:p-2",t),...o}),el=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:justify-center fk:p-4 fk:text-muted-foreground fk:text-sm",e),...o,children:t??"No attachments"});var fa=e=>e&&e&1,da=e=>e&&e&2,ua=e=>e&&e&4,ma=e=>e.map((t,o)=>({key:`line-${o}`,tokens:t.map((r,a)=>({key:`line-${o}-${a}`,token:r}))})),ka=({token:e})=>jsx("span",{className:"fk:dark:bg-(--shiki-dark-bg)! fk:dark:text-(--shiki-dark)!",style:{backgroundColor:e.bgColor,color:e.color,fontStyle:fa(e.fontStyle)?"italic":void 0,fontWeight:da(e.fontStyle)?"bold":void 0,textDecoration:ua(e.fontStyle)?"underline":void 0,...e.htmlStyle},children:e.content}),ga=a("fk:block","fk:before:content-[counter(line)]","fk:before:inline-block","fk:before:[counter-increment:line]","fk:before:w-8","fk:before:mr-4","fk:before:text-right","fk:before:text-muted-foreground/50","fk:before:font-mono","fk:before:select-none"),ba=({keyedLine:e,showLineNumbers:t})=>jsx("span",{className:t?ga:"fk:block",children:e.tokens.length===0?`
2
- `:e.tokens.map(({token:o,key:r})=>jsx(ka,{token:o},r))}),wo=createContext({code:""}),Co=new Map,Po=new Map,ue=new Map,ha=(e,t)=>{let o=e.slice(0,100),r=e.length>100?e.slice(-100):"";return `${t}:${e.length}:${o}:${r}`},xa=e=>{let t=Co.get(e);if(t)return t;let o=createHighlighter({langs:[e],themes:["github-light","github-dark"]});return Co.set(e,o),o},va=e=>({bg:"transparent",fg:"inherit",tokens:e.split(`
3
- `).map(t=>t===""?[]:[{color:"inherit",content:t}])}),yo=(e,t,o)=>{let r=ha(e,t),a=Po.get(r);return a||(o&&(ue.has(r)||ue.set(r,new Set),ue.get(r)?.add(o)),xa(t).then(i=>{let l=i.getLoadedLanguages().includes(t)?t:"text",p=i.codeToTokens(e,{lang:l,themes:{dark:"github-dark",light:"github-light"}}),c={bg:p.bg??"transparent",fg:p.fg??"inherit",tokens:p.tokens};Po.set(r,c);let m=ue.get(r);if(m){for(let k of m)k(c);ue.delete(r);}}).catch(i=>{console.error("Failed to highlight code:",i),ue.delete(r);}),null)},Mo=memo(({tokenized:e,showLineNumbers:t,className:o})=>{let r=useMemo(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),a$1=useMemo(()=>ma(e.tokens),[e.tokens]);return jsx("pre",{className:a("fk:dark:bg-(--shiki-dark-bg)! fk:dark:text-(--shiki-dark)! fk:m-0 fk:p-4 fk:text-sm",o),style:r,children:jsx("code",{className:a("fk:font-mono fk:text-sm",t&&"fk:[counter-increment:line_0] fk:[counter-reset:line]"),children:a$1.map(i=>jsx(ba,{keyedLine:i,showLineNumbers:t},i.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className);Mo.displayName="CodeBlockBody";var Ca=({className:e,language:t,style:o,...r})=>jsx("div",{className:a("fk:group fk:relative fk:w-full fk:overflow-hidden fk:rounded-md fk:border fk:bg-background fk:text-foreground fk:corner-squircle",e),"data-language":t,style:{containIntrinsicSize:"auto 200px",contentVisibility:"auto",...o},...r}),pl=({children:e,className:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:justify-between fk:border-b fk:bg-muted/80 fk:px-3 fk:py-2 fk:text-muted-foreground fk:text-xs",t),...o,children:e}),cl=({children:e,className:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-2",t),...o,children:e}),fl=({children:e,className:t,...o})=>jsx("span",{className:a("fk:font-mono",t),...o,children:e}),dl=({children:e,className:t,...o})=>jsx("div",{className:a("fk:-my-1 fk:-mr-1 fk:flex fk:items-center fk:gap-2",t),...o,children:e}),Pa=({code:e,language:t,showLineNumbers:o=false})=>{let r=useMemo(()=>va(e),[e]),a=useMemo(()=>yo(e,t)??r,[e,t,r]),[i,s]=useState(null),l=useRef({code:e,language:t});return (l.current.code!==e||l.current.language!==t)&&(l.current={code:e,language:t},s(null)),useEffect(()=>{let c=false;return yo(e,t,m=>{c||s(m);}),()=>{c=true;}},[e,t]),jsx("div",{className:"fk:relative fk:overflow-auto",children:jsx(Mo,{showLineNumbers:o,tokenized:i??a})})},lt=({code:e,language:t,showLineNumbers:o=false,className:r,children:a,...i})=>{let s=useMemo(()=>({code:e}),[e]);return jsx(wo.Provider,{value:s,children:jsxs(Ca,{className:r,language:t,...i,children:[a,jsx(Pa,{code:e,language:t,showLineNumbers:o})]})})},ul=({onCopy:e,onError:t,timeout:o=2e3,children:r,className:a$1,...i})=>{let[s,l]=useState(false),p=useRef(0),{code:c}=useContext(wo),m=useCallback(async()=>{if(typeof window>"u"||!navigator?.clipboard?.writeText){t?.(new Error("Clipboard API not available"));return}try{s||(await navigator.clipboard.writeText(c),l(!0),e?.(),p.current=window.setTimeout(()=>l(!1),o));}catch(g){t?.(g);}},[c,e,t,o,s]);useEffect(()=>()=>{window.clearTimeout(p.current);},[]);let k=s?CheckIcon:CopyIcon;return jsx(b,{className:a("fk:shrink-0",a$1),onClick:m,size:"icon",variant:"ghost",...i,children:r??jsx(k,{size:14})})},ml=e=>jsx(a$4,{...e}),kl=({className:e,...t})=>jsx(d,{className:a("fk:h-7 fk:border-none fk:bg-transparent fk:px-2 fk:text-xs fk:shadow-none",e),size:"sm",...t}),gl=e=>jsx(c$1,{...e}),bl=({align:e="end",...t})=>jsx(e$1,{align:e,...t}),hl=e=>jsx(g,{...e});var Il=({className:e,...t})=>jsx(StickToBottom,{className:a("fk:relative fk:flex-1 fk:overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),wl=({className:e,...t})=>jsx(StickToBottom.Content,{className:a("fk:flex fk:flex-col fk:gap-8 fk:p-4",e),...t}),Ml=({className:e,title:t="No messages yet",description:o="Start a conversation to see messages here",icon:r,children:a$1,...i})=>jsx("div",{className:a("fk:flex fk:size-full fk:flex-col fk:items-center fk:justify-center fk:gap-3 fk:p-8 fk:text-center",e),...i,children:a$1??jsxs(Fragment,{children:[r&&jsx("div",{className:"fk:text-muted-foreground",children:r}),jsxs("div",{className:"fk:space-y-1",children:[jsx("h3",{className:"fk:font-medium fk:text-sm",children:t}),o&&jsx("p",{className:"fk:text-muted-foreground fk:text-sm",children:o})]})]})}),Nl=({className:e,...t})=>{let{isAtBottom:o,scrollToBottom:r}=useStickToBottomContext(),a$1=useCallback(()=>{r();},[r]);return !o&&jsx(b,{className:a("fk:absolute fk:bottom-4 fk:left-[50%] fk:translate-x-[-50%] fk:rounded-full fk:dark:bg-background fk:dark:hover:bg-muted fk:corner-squircle",e),onClick:a$1,size:"icon",type:"button",variant:"outline",...t,children:jsx(ArrowDownIcon,{className:"fk:size-4"})})},wa=e=>e.parts.filter(t=>t.type==="text").map(t=>t.text).join(""),Bo=e=>`**${e.role.charAt(0).toUpperCase()+e.role.slice(1)}:** ${wa(e)}`,Ma=(e,t=Bo)=>e.map((o,r)=>t(o,r)).join(`
1
+ import'./index.css';import {o,p,q}from'./chunk-7ZJN4MWQ.js';export{e as Alert,g as AlertDescription,f as AlertTitle,o as Collapsible,q as CollapsibleContent,p as CollapsibleTrigger,j as DrawerModal,D as InsufficientPermissionsTooltipContent,E as PermissionTooltip,r as Popover,u as PopoverAnchor,t as PopoverContent,s as PopoverTrigger,v as Table,x as TableBody,C as TableCaption,B as TableCell,y as TableFooter,A as TableHead,w as TableHeader,z as TableRow,k as Tabs,n as TabsContent,l as TabsList,m as TabsTrigger,i as Toaster,b as Toggle,c as ToggleGroup,d as ToggleGroupItem,h as toast,a as toggleVariants}from'./chunk-7ZJN4MWQ.js';import {a as a$2}from'./chunk-YSLN4XT6.js';export{a as Input}from'./chunk-YSLN4XT6.js';import {a as a$3}from'./chunk-7BOX7HHO.js';export{a as Textarea}from'./chunk-7BOX7HHO.js';import {a as a$1,b as b$1,c,e}from'./chunk-USNXQOMJ.js';export{b as Tooltip,e as TooltipContent,d as TooltipPortal,a as TooltipProvider,c as TooltipTrigger}from'./chunk-USNXQOMJ.js';import {b as b$2,c as c$2}from'./chunk-AICNS7KW.js';export{b as ButtonGroup,d as ButtonGroupSeparator,c as ButtonGroupText,a as buttonGroupVariants}from'./chunk-AICNS7KW.js';import {d as d$1,e as e$2,i,l,n,o as o$1,p as p$1,q as q$1,r,s,u,v,t,w,x,b as b$3}from'./chunk-W3Z33ETA.js';export{b as Badge,n as Command,o as CommandDialog,r as CommandEmpty,s as CommandGroup,p as CommandInput,u as CommandItem,q as CommandList,t as CommandSeparator,v as CommandShortcut,d as Dialog,g as DialogClose,i as DialogContent,m as DialogDescription,k as DialogFooter,j as DialogHeader,h as DialogOverlay,f as DialogPortal,l as DialogTitle,e as DialogTrigger,w as ScrollArea,x as ScrollBar,c as Separator,a as badgeVariants}from'./chunk-W3Z33ETA.js';import {a as a$4,d,c as c$1,e as e$1,g}from'./chunk-HDOIOXMP.js';export{a as Select,e as SelectContent,b as SelectGroup,g as SelectItem,f as SelectLabel,j as SelectScrollDownButton,i as SelectScrollUpButton,h as SelectSeparator,d as SelectTrigger,c as SelectValue}from'./chunk-HDOIOXMP.js';export{a as Avatar,c as AvatarFallback,d as AvatarGroup,b as AvatarImage}from'./chunk-IRY4KWB5.js';import {h,c as c$3,e as e$3,f}from'./chunk-HMMBYXYA.js';export{c as DropdownMenu,i as DropdownMenuCheckboxItem,f as DropdownMenuContent,g as DropdownMenuGroup,h as DropdownMenuItem,l as DropdownMenuLabel,d as DropdownMenuPortal,j as DropdownMenuRadioGroup,k as DropdownMenuRadioItem,m as DropdownMenuSeparator,n as DropdownMenuShortcut,o as DropdownMenuSub,q as DropdownMenuSubContent,p as DropdownMenuSubTrigger,e as DropdownMenuTrigger,r as Skeleton}from'./chunk-HMMBYXYA.js';import {b}from'./chunk-6NRQMG26.js';export{b as Button,a as buttonVariants}from'./chunk-6NRQMG26.js';export{a as Switch}from'./chunk-QVBNGGOE.js';export{j as Checkbox,b as Form,g as FormControl,h as FormDescription,c as FormField,e as FormItem,f as FormLabel,i as FormMessage,a as Label,d as useFormField}from'./chunk-GBM7VKFS.js';import {a}from'./chunk-O2QMYUPS.js';import*as rt from'lucide-react';import {BrainIcon,ChevronDownIcon,XCircleIcon,CheckCircleIcon,CircleIcon,ClockIcon,SquareArrowOutUpRight,GripVerticalIcon,XIcon,PanelLeftIcon,Loader2Icon,CheckIcon,CopyIcon,ArrowDownIcon,DownloadIcon,ChevronLeftIcon,ChevronRightIcon,ImageIcon,Monitor,PlusIcon,CornerDownLeftIcon,SquareIcon,BookIcon,LoaderIcon,MicIcon,WrenchIcon,VideoIcon,PaperclipIcon,GlobeIcon,FileTextIcon,Music2Icon}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import*as fe from'react-resizable-panels';import {Dialog,Slot,HoverCard}from'radix-ui';import*as H from'react';import {createContext,memo,useMemo,useRef,useState,useEffect,useCallback,useContext,createElement,Children,isValidElement}from'react';import Gn from'fuse.js';import {NavLink}from'react-router-dom';import {cva}from'class-variance-authority';import {groupBy}from'ramda';import {createHighlighter}from'shiki';import {StickToBottom,useStickToBottomContext}from'use-stick-to-bottom';import {cjk}from'@streamdown/cjk';import {code}from'@streamdown/code';import {math}from'@streamdown/math';import {mermaid}from'@streamdown/mermaid';import {Streamdown}from'streamdown';import {nanoid}from'nanoid';import {useControllableState}from'@radix-ui/react-use-controllable-state';import {motion}from'motion/react';function kn({href:e,children:t}){return jsx(b,{asChild:true,className:"fk:h-6 fk:px-1! fk:py-0 fk:text-sm fk:font-light fk:text-link",size:"sm",variant:"link",children:jsxs("a",{href:e,target:"_blank",children:[t," ",jsx(SquareArrowOutUpRight,{className:"fk:size-3",strokeWidth:3})]})})}function hn({className:e,...t}){return jsx(fe.Group,{"data-slot":"resizable-panel-group",className:a("fk:flex fk:h-full fk:w-full fk:aria-[orientation=vertical]:flex-col",e),...t})}function xn({...e}){return jsx(fe.Panel,{"data-slot":"resizable-panel",...e})}function vn({withHandle:e,className:t,...o}){return jsx(fe.Separator,{"data-slot":"resizable-handle",className:a("fk:relative fk:flex fk:w-px fk:items-center fk:justify-center fk:bg-border fk:after:absolute fk:after:inset-y-0 fk:after:left-1/2 fk:after:w-1 fk:after:-translate-x-1/2 fk:focus-visible:ring-1 fk:focus-visible:ring-ring fk:focus-visible:ring-offset-1 fk:focus-visible:outline-hidden fk:aria-[orientation=horizontal]:h-px fk:aria-[orientation=horizontal]:w-full fk:aria-[orientation=horizontal]:after:left-0 fk:aria-[orientation=horizontal]:after:h-1 fk:aria-[orientation=horizontal]:after:w-full fk:aria-[orientation=horizontal]:after:translate-x-0 fk:aria-[orientation=horizontal]:after:-translate-y-1/2 fk:[&[aria-orientation=horizontal]>div]:rotate-90",t),...o,children:e&&jsx("div",{className:"fk:z-10 fk:flex fk:h-8 fk:w-3 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:bg-border fk:corner-squircle",children:jsx(GripVerticalIcon,{className:"fk:size-2.5"})})})}function Nt({...e}){return jsx(Dialog.Root,{"data-slot":"sheet",...e})}function Pn({...e}){return jsx(Dialog.Trigger,{"data-slot":"sheet-trigger",...e})}function yn({...e}){return jsx(Dialog.Close,{"data-slot":"sheet-close",...e})}function no({...e}){return jsx(Dialog.Portal,{"data-slot":"sheet-portal",...e})}function ao({className:e,...t}){return jsx(Dialog.Overlay,{"data-slot":"sheet-overlay",className:a("fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0",e),...t})}function Rt({className:e,children:t,side:o="right",showCloseButton:r=true,...a$1}){return jsxs(no,{children:[jsx(ao,{}),jsxs(Dialog.Content,{"data-slot":"sheet-content",className:a("fk:fixed fk:z-50 fk:flex fk:flex-col fk:gap-4 fk:bg-background fk:shadow-lg fk:transition fk:ease-in-out fk:data-[state=closed]:animate-out fk:data-[state=closed]:duration-300 fk:data-[state=open]:animate-in fk:data-[state=open]:duration-500",o==="right"&&"fk:inset-y-0 fk:right-0 fk:h-full fk:w-3/4 fk:border-l fk:data-[state=closed]:slide-out-to-right fk:data-[state=open]:slide-in-from-right fk:sm:max-w-sm",o==="left"&&"fk:inset-y-0 fk:left-0 fk:h-full fk:w-3/4 fk:border-r fk:data-[state=closed]:slide-out-to-left fk:data-[state=open]:slide-in-from-left fk:sm:max-w-sm",o==="top"&&"fk:inset-x-0 fk:top-0 fk:h-auto fk:border-b fk:data-[state=closed]:slide-out-to-top fk:data-[state=open]:slide-in-from-top",o==="bottom"&&"fk:inset-x-0 fk:bottom-0 fk:h-auto fk:border-t fk:data-[state=closed]:slide-out-to-bottom fk:data-[state=open]:slide-in-from-bottom",e),...a$1,children:[t,r&&jsxs(Dialog.Close,{className:"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-secondary fk:corner-squircle",children:[jsx(XIcon,{className:"fk:size-4"}),jsx("span",{className:"fk:sr-only",children:"Close"})]})]})]})}function At({className:e,...t}){return jsx("div",{"data-slot":"sheet-header",className:a("fk:flex fk:flex-col fk:gap-1.5 fk:p-4",e),...t})}function Sn({className:e,...t}){return jsx("div",{"data-slot":"sheet-footer",className:a("fk:mt-auto fk:flex fk:flex-col fk:gap-2 fk:p-4",e),...t})}function Bt({className:e,...t}){return jsx(Dialog.Title,{"data-slot":"sheet-title",className:a("fk:font-semibold fk:text-foreground",e),...t})}function Lt({className:e,...t}){return jsx(Dialog.Description,{"data-slot":"sheet-description",className:a("fk:text-sm fk:text-muted-foreground",e),...t})}var Dt=768;function so(){let[e,t]=H.useState(void 0);return H.useEffect(()=>{let o=window.matchMedia(`(max-width: ${Dt-1}px)`),r=()=>{t(window.innerWidth<Dt);};return o.addEventListener("change",r),t(window.innerWidth<Dt),()=>o.removeEventListener("change",r)},[]),!!e}var wn="flexkit:sidebar:state",Mn=3600*24*7,Nn="16rem",Rn="18rem",An="2rem",Bn="b",lo=H.createContext(null);function Ge(){let e=H.useContext(lo);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Ln({defaultOpen:e=true,open:t,onOpenChange:o,className:r,style:a$2,children:i,...s}){let l=so(),[p,c]=H.useState(false),[m,k]=H.useState(e),g=t??m,T=H.useCallback(f=>{let x=typeof f=="function"?f(g):f;o?o(x):k(x),document.cookie=`${wn}=${x}; path=/; max-age=${Mn}`;},[o,g]),b=H.useCallback(()=>l?c(f=>!f):T(f=>!f),[l,T,c]);H.useEffect(()=>{let f=x=>{x.key===Bn&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),b());};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[b]);let C=g?"expanded":"collapsed",N=H.useMemo(()=>({state:C,open:g,setOpen:T,isMobile:l,openMobile:p,setOpenMobile:c,toggleSidebar:b}),[C,g,T,l,p,c,b]);return jsx(lo.Provider,{value:N,children:jsx(a$1,{delayDuration:0,children:jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Nn,"--sidebar-width-icon":An,...a$2},className:a("fk:group/sidebar-wrapper fk:flex fk:w-full fk:has-data-[variant=inset]:bg-sidebar fk:overflow-hidden",r),...s,children:i})})})}function Et({side:e="left",variant:t="sidebar",collapsible:o="offcanvas",className:r,children:a$1,...i}){let{isMobile:s,state:l,openMobile:p,setOpenMobile:c}=Ge();return o==="none"?jsx("div",{"data-slot":"sidebar",className:a("fk:flex fk:h-full fk:w-(--sidebar-width) fk:flex-col fk:bg-sidebar fk:text-sidebar-foreground",r),...i,children:a$1}):s?jsx(Nt,{open:p,onOpenChange:c,...i,children:jsxs(Rt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"fk:w-(--sidebar-width) fk:bg-sidebar fk:p-0 fk:text-sidebar-foreground fk:[&>button]:hidden",style:{"--sidebar-width":Rn},side:e,children:[jsxs(At,{className:"fk:sr-only",children:[jsx(Bt,{children:"Sidebar"}),jsx(Lt,{children:"Displays the mobile sidebar."})]}),jsx("div",{className:"fk:flex fk:h-full fk:w-full fk:flex-col",children:a$1})]})}):jsxs("div",{className:"fk:group fk:peer flexkit-sidebar-desktop-block fk:text-sidebar-foreground","data-state":l,"data-collapsible":l==="collapsed"?o:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[jsx("div",{"data-slot":"sidebar-gap",className:a("fk:relative fk:w-(--sidebar-width) fk:bg-transparent fk:transition-[width] fk:duration-200 fk:ease-linear","fk:group-data-[collapsible=offcanvas]:w-0","fk:group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"fk:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"fk:group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),jsx("div",{"data-slot":"sidebar-container",className:a("fk:relative fk:inset-y-0 fk:z-10 flexkit-sidebar-desktop-flex fk:h-[calc(100svh-3.5rem)] fk:w-(--sidebar-width) fk:transition-[left,right,width] fk:duration-200 fk:ease-linear",e==="left"?"fk:left-0 fk:group-data-[collapsible=offcanvas]:-left-(--sidebar-width)":"fk:right-0 k:group-data-[collapsible=offcanvas]:-right-(--sidebar-width)",t==="floating"||t==="inset"?"fk:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)] fk:group-data-[side=left]:border-r":"fk:group-data-[collapsible=icon]:w-(--sidebar-width-icon) fk:group-data-[side=left]:border-r fk:group-data-[side=right]:border-l",r),...i,children:jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"fk:flex fk:h-full fk:w-full fk:flex-col fk:bg-sidebar fk:group-data-[variant=floating]:rounded-lg fk:group-data-[variant=floating]:border fk:group-data-[variant=floating]:border-sidebar-border fk:group-data-[variant=floating]:shadow-sm",children:a$1})})]})}function Dn({className:e,onClick:t,...o}){let{toggleSidebar:r}=Ge();return jsxs(b,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:a("fk:size-7",e),onClick:a=>{t?.(a),r();},...o,children:[jsx(PanelLeftIcon,{}),jsx("span",{className:"fk:sr-only",children:"Toggle Sidebar"})]})}function zt({className:e,...t}){let{toggleSidebar:o}=Ge();return jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:o,title:"Toggle Sidebar",className:a("fk:absolute fk:inset-y-0 fk:z-20 flexkit-sidebar-sm-flex fk:w-4 fk:-translate-x-1/2 fk:transition-all fk:ease-linear fk:group-data-[side=left]:-right-4 fk:group-data-[side=right]:left-0 fk:after:absolute fk:after:inset-y-0 fk:after:left-1/2 fk:after:w-[2px] fk:hover:after:bg-sidebar-border","fk:in-data-[side=left]:cursor-w-resize fk:in-data-[side=right]:cursor-e-resize","fk:[[data-side=left][data-state=collapsed]_&]:cursor-e-resize fk:[[data-side=right][data-state=collapsed]_&]:cursor-w-resize","fk:group-data-[collapsible=offcanvas]:translate-x-0 fk:group-data-[collapsible=offcanvas]:after:left-full fk:hover:group-data-[collapsible=offcanvas]:bg-sidebar","fk:[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","fk:[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function En({className:e,...t}){return jsx("main",{"data-slot":"sidebar-inset",className:a("fk:relative fk:flex fk:flex-1 fk:flex-col fk:bg-background fk:overflow-hidden fk:peer-data-[variant=inset]:h-[calc(100svh-3.625rem)]",e),...t})}function Ht({className:e,...t}){return jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a("fk:flex fk:min-h-0 fk:flex-1 fk:flex-col fk:overflow-auto fk:group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Ze({className:e,...t}){return jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a("fk:relative fk:flex fk:w-full fk:min-w-0 fk:flex-col fk:p-2",e),...t})}function Gt({className:e,asChild:t=false,...o}){let r=t?Slot.Root:"div";return jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:a("fk:flex fk:h-8 fk:shrink-0 fk:items-center fk:rounded-md fk:px-2 fk:text-xs fk:font-medium fk:text-sidebar-foreground/70 fk:ring-sidebar-ring fk:outline-hidden fk:transition-[margin,opacity] fk:duration-200 fk:ease-linear fk:focus-visible:ring-2 fk:[&>svg]:size-4 fk:[&>svg]:shrink-0 fk:corner-squircle","fk:group-data-[collapsible=icon]:-mt-8 fk:group-data-[collapsible=icon]:opacity-0",e),...o})}function zn({className:e,...t}){return jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a("fk:w-full fk:text-sm",e),...t})}function Qe({className:e,...t}){return jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a("fk:flex fk:w-full fk:min-w-0 fk:flex-col fk:gap-1",e),...t})}function et({className:e,...t}){return jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a("fk:group/menu-item fk:relative",e),...t})}var Hn=cva("fk:peer/menu-button fk:flex fk:w-full fk:items-center fk:gap-2 fk:overflow-hidden fk:rounded-md fk:p-2 fk:text-left fk:text-sm fk:ring-sidebar-ring fk:outline-hidden fk:transition-[width,height,padding] fk:group-has-data-[sidebar=menu-action]/menu-item:pr-8 fk:group-data-[collapsible=icon]:size-8! fk:group-data-[collapsible=icon]:p-2! fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground fk:focus-visible:ring-2 fk:active:bg-sidebar-accent fk:active:text-sidebar-accent-foreground fk:disabled:pointer-events-none fk:disabled:opacity-50 fk:aria-disabled:pointer-events-none fk:aria-disabled:opacity-50 fk:data-[active=true]:bg-sidebar-accent fk:data-[active=true]:font-medium fk:data-[active=true]:text-sidebar-accent-foreground fk:data-[state=open]:hover:bg-sidebar-accent fk:data-[state=open]:hover:text-sidebar-accent-foreground fk:[&>span:last-child]:truncate fk:[&>svg]:size-4 fk:[&>svg]:shrink-0 fk:corner-squircle",{variants:{variant:{default:"fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground",outline:"fk:bg-background fk:shadow-[0_0_0_1px_hsl(var(--sidebar-border))] fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground fk:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"fk:h-8 fk:text-sm",sm:"fk:h-7 fk:text-xs",lg:"fk:h-12 fk:text-sm fk:group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function tt({asChild:e$1=false,isActive:t=false,variant:o="default",size:r="default",tooltip:a$1,className:i,...s}){let l=e$1?Slot.Root:"button",{isMobile:p,state:c$1}=Ge(),m=jsx(l,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":t,className:a(Hn({variant:o,size:r}),i),...s});return a$1?(typeof a$1=="string"&&(a$1={children:a$1}),jsxs(b$1,{children:[jsx(c,{asChild:true,children:m}),jsx(e,{side:"right",align:"center",hidden:c$1!=="collapsed"||p,...a$1})]})):m}var co=NavLink,Fn=Object.keys(rt).map(e=>({name:e,icon:rt[e]})),_n=new Gn(Fn,{keys:["name"],threshold:.5});function Vn({className:e,menuGroups:t,schema:o}){let r=o.filter(s=>!(s.menu&&"hidden"in s.menu)),a=groupBy(s=>s.menu?.group&&t?.find(l=>l.name===s.menu?.group)?.name||"ungrouped",r),i=t?.filter(s=>a[s.name]?.length);return jsxs(Et,{className:e,collapsible:"icon",variant:"inset",children:[jsxs(Ht,{children:[i?.map(s=>jsxs(Ze,{children:[jsx(Gt,{children:s.title}),jsx(Qe,{children:a[s.name]?.map(l=>jsx(et,{children:jsx(tt,{asChild:true,isActive:location.pathname.includes(`/list/${l.plural}`),tooltip:ot(l.menu?.label??l.plural),children:jsxs(co,{to:`list/${l.plural}`,children:[l.menu?.icon??createElement(rt[fo(l.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:ot(l.menu?.label??l.plural)})]})})},l.plural))})]},s.name)),jsx(Ze,{children:jsx(Qe,{children:a.ungrouped?.map(s=>jsx(et,{children:jsx(tt,{asChild:true,isActive:location.pathname.includes(`/list/${s.plural}`),tooltip:ot(s.menu?.label??s.plural),children:jsxs(co,{to:`list/${s.plural}`,children:[createElement(rt[fo(s.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:ot(s.menu?.label??s.plural)})]})})},s.plural))})})]}),jsx(zt,{})]})}function ot(e){let t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1).trim()}function fo(e){let t=_n.search(e);return t.length>0?t[0].item.name:"Dock"}function Ue({...e}){return jsx(HoverCard.Root,{"data-slot":"hover-card",...e})}function Fe({...e}){return jsx(HoverCard.Trigger,{"data-slot":"hover-card-trigger",...e})}function _e({className:e,align:t="center",sideOffset:o=4,...r}){return jsx(HoverCard.Portal,{"data-slot":"hover-card-portal",children:jsx(HoverCard.Content,{"data-slot":"hover-card-content",align:t,sideOffset:o,className:a("fk:z-50 fk:w-64 fk:origin-(--radix-hover-card-content-transform-origin) fk:rounded-md fk:border fk:bg-popover fk:p-4 fk:text-popover-foreground fk:shadow-md fk:outline-hidden fk:data-[side=bottom]:slide-in-from-top-2 fk:data-[side=left]:slide-in-from-right-2 fk:data-[side=right]:slide-in-from-left-2 fk:data-[side=top]:slide-in-from-bottom-2 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95 fk:corner-squircle",e),...r})})}function Ot({className:e,...t}){return jsx(Loader2Icon,{role:"status","aria-label":"Loading",className:a("fk:size-4 fk:animate-spin",e),...t})}function Ut({className:e,...t}){return jsx("div",{"data-slot":"input-group",role:"group",className:a("fk:group/input-group fk:border-input fk:dark:bg-input/30 fk:shadow-xs fk:relative fk:flex fk:w-full fk:items-center fk:rounded-lg fk:border fk:outline-none fk:transition-[color,box-shadow] fk:corner-squircle","fk:h-9 fk:has-[>textarea]:h-auto","fk:has-[>[data-align=inline-start]]:[&>input]:pl-2","fk:has-[>[data-align=inline-end]]:[&>input]:pr-2","fk:has-[>[data-align=block-start]]:h-auto fk:has-[>[data-align=block-start]]:flex-col fk:has-[>[data-align=block-start]]:[&>input]:pb-3","fk:has-[>[data-align=block-end]]:h-auto fk:has-[>[data-align=block-end]]:flex-col fk:has-[>[data-align=block-end]]:[&>input]:pt-3","fk:has-[[data-slot=input-group-control]:focus-visible]:ring-ring fk:has-[[data-slot=input-group-control]:focus-visible]:ring-1","fk:has-[[data-slot][aria-invalid=true]]:ring-destructive/20 fk:has-[[data-slot][aria-invalid=true]]:border-destructive fk:dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}var Wn=cva("fk:text-muted-foreground fk:flex fk:h-auto fk:cursor-text fk:select-none fk:items-center fk:justify-center fk:gap-2 fk:py-1.5 fk:text-sm fk:font-medium fk:group-data-[disabled=true]/input-group:opacity-50 fk:[&>kbd]:rounded-[calc(var(--radius)-5px)] fk:[&>svg:not([class*=size-])]:size-4",{variants:{align:{"inline-start":"fk:order-first fk:pl-3 fk:has-[>button]:ml-[-0.45rem] fk:has-[>kbd]:ml-[-0.35rem]","inline-end":"fk:order-last fk:pr-3 fk:has-[>button]:mr-[-0.4rem] fk:has-[>kbd]:mr-[-0.35rem]","block-start":"fk:[.border-b]:pb-3 fk:order-first fk:w-full fk:justify-start fk:px-3 fk:pt-3 fk:group-has-[>input]/input-group:pt-2.5","block-end":"fk:[.border-t]:pt-3 fk:order-last fk:w-full fk:justify-start fk:px-3 fk:pb-3 fk:group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function st({className:e,align:t="inline-start",...o}){return jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:a(Wn({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus();},...o})}var $n=cva("fk:flex fk:items-center fk:gap-2 fk:text-sm fk:shadow-none",{variants:{size:{xs:"fk:h-6 fk:gap-1 fk:rounded-[calc(var(--radius)-5px)] fk:px-2 fk:has-[>svg]:px-2 fk:[&>svg:not([class*=size-])]:size-3.5 fk:corner-squircle",sm:"fk:h-8 fk:gap-1.5 fk:rounded-lg fk:px-2.5 fk:has-[>svg]:px-2.5 fk:corner-squircle","icon-xs":"fk:size-6 fk:rounded-[calc(var(--radius)-5px)] fk:p-0 fk:has-[>svg]:p-0 fk:corner-squircle","icon-sm":"fk:size-8 fk:p-0 fk:has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function it({className:e,type:t="button",variant:o="ghost",size:r="xs",...a$1}){return jsx(b,{type:t,"data-size":r,variant:o,className:a($n({size:r}),e),...a$1})}function Kn({className:e,...t}){return jsx("span",{className:a("fk:text-muted-foreground fk:flex fk:items-center fk:gap-2 fk:text-sm fk:[&_svg:not([class*=size-])]:size-4 fk:[&_svg]:pointer-events-none",e),...t})}function Xn({className:e,...t}){return jsx(a$2,{"data-slot":"input-group-control",className:a("fk:flex-1 fk:rounded-none fk:border-0 fk:bg-transparent fk:shadow-none fk:focus-visible:ring-0 fk:dark:bg-transparent fk:corner-squircle",e),...t})}function Ft({className:e,...t}){return jsx(a$3,{"data-slot":"input-group-control",className:a("fk:flex-1 fk:resize-none fk:rounded-none fk:border-0 fk:bg-transparent fk:py-3 fk:shadow-none fk:focus-visible:ring-0 fk:dark:bg-transparent fk:corner-squircle",e),...t})}var na={audio:Music2Icon,document:FileTextIcon,image:ImageIcon,source:GlobeIcon,unknown:PaperclipIcon,video:VideoIcon},bo=e=>{if(e.type==="source-document")return "source";let t=e.mediaType??"";return t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/")||t.startsWith("text/")?"document":"unknown"},aa=e=>{if(e.type==="source-document")return e.title||e.filename||"Source";let t=bo(e);return e.filename||(t==="image"?"Image":"Attachment")},sa=(e,t,o)=>o?jsx("img",{alt:t||"Image",className:"fk:size-full fk:object-cover",height:96,src:e,width:96}):jsx("img",{alt:t||"Image",className:"fk:size-full fk:rounded fk:object-cover fk:corner-squircle",height:20,src:e,width:20}),ho=createContext(null),xo=createContext(null),ia=()=>useContext(ho)??{variant:"grid"},_t=()=>{let e=useContext(xo);if(!e)throw new Error("Attachment components must be used within <Attachment>");return e},Ji=({variant:e="grid",className:t,children:o,...r})=>{let a$1=useMemo(()=>({variant:e}),[e]);return jsx(ho.Provider,{value:a$1,children:jsx("div",{className:a("fk:flex fk:items-start",e==="list"?"fk:flex-col fk:gap-2":"fk:flex-wrap fk:gap-2",e==="grid"&&"fk:ml-auto fk:w-fit",t),...r,children:o})})},Yi=({data:e,onRemove:t,className:o,children:r,...a$1})=>{let{variant:i}=ia(),s=bo(e),l=useMemo(()=>({data:e,mediaCategory:s,onRemove:t,variant:i}),[e,s,t,i]);return jsx(xo.Provider,{value:l,children:jsx("div",{className:a("fk:group fk:relative",i==="grid"&&"fk:size-24 fk:overflow-hidden fk:rounded-lg fk:corner-squircle",i==="inline"&&["fk:flex fk:h-8 fk:cursor-pointer fk:select-none fk:items-center fk:gap-1.5","fk:rounded-md fk:border fk:border-border fk:px-1.5 fk:corner-squircle","fk:font-medium fk:text-sm fk:transition-all","fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:hover:bg-accent/50"],i==="list"&&["fk:flex fk:w-full fk:items-center fk:gap-3 fk:rounded-lg fk:border fk:p-3 fk:corner-squircle","fk:hover:bg-accent/50"],o),...a$1,children:r})})},Zi=({fallbackIcon:e,className:t,...o})=>{let{data:r,mediaCategory:a$1,variant:i}=_t(),s=i==="inline"?"fk:size-3":"fk:size-4",l=c=>jsx(c,{className:a(s,"fk:text-muted-foreground")}),p=()=>{if(a$1==="image"&&r.type==="file"&&r.url)return sa(r.url,r.filename,i==="grid");if(a$1==="video"&&r.type==="file"&&r.url)return jsx("video",{className:"fk:size-full fk:object-cover",muted:true,src:r.url});let c=na[a$1];return e??l(c)};return jsx("div",{className:a("fk:flex fk:shrink-0 fk:items-center fk:justify-center fk:overflow-hidden",i==="grid"&&"fk:size-full fk:bg-muted",i==="inline"&&"fk:size-5 fk:rounded fk:bg-background fk:corner-squircle",i==="list"&&"fk:size-12 fk:rounded fk:bg-muted fk:corner-squircle",t),...o,children:p()})},Qi=({showMediaType:e=false,className:t,...o})=>{let{data:r,variant:a$1}=_t(),i=aa(r);return a$1==="grid"?null:jsxs("div",{className:a("fk:min-w-0 fk:flex-1",t),...o,children:[jsx("span",{className:"fk:block fk:truncate",children:i}),e&&r.mediaType&&jsx("span",{className:"fk:block fk:truncate fk:text-muted-foreground fk:text-xs",children:r.mediaType})]})},el=({label:e="Remove",className:t,children:o,...r})=>{let{onRemove:a$1,variant:i}=_t(),s=useCallback(l=>{l.stopPropagation(),a$1?.();},[a$1]);return a$1?jsxs(b,{"aria-label":e,className:a(i==="grid"&&["fk:absolute fk:top-2 fk:right-2 fk:size-6 fk:rounded-full fk:p-0 fk:corner-squircle","fk:bg-background/80 fk:backdrop-blur-sm","fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100","fk:hover:bg-background","fk:[&>svg]:size-3"],i==="inline"&&["fk:size-5 fk:rounded fk:p-0 fk:corner-squircle","fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100","fk:[&>svg]:size-2.5"],i==="list"&&["fk:size-8 fk:shrink-0 fk:rounded fk:p-0 fk:corner-squircle","fk:[&>svg]:size-4"],t),onClick:s,type:"button",variant:"ghost",...r,children:[o??jsx(XIcon,{}),jsx("span",{className:"fk:sr-only",children:e})]}):null},tl=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Ue,{closeDelay:t,openDelay:e,...o}),ol=e=>jsx(Fe,{...e}),rl=({align:e="start",className:t,...o})=>jsx(_e,{align:e,className:a("fk:w-auto fk:p-2",t),...o}),nl=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:justify-center fk:p-4 fk:text-muted-foreground fk:text-sm",e),...o,children:t??"No attachments"});var ka=e=>e&&e&1,ga=e=>e&&e&2,ba=e=>e&&e&4,ha=e=>e.map((t,o)=>({key:`line-${o}`,tokens:t.map((r,a)=>({key:`line-${o}-${a}`,token:r}))})),xa=({token:e})=>jsx("span",{className:"fk:dark:bg-(--shiki-dark-bg)! fk:dark:text-(--shiki-dark)!",style:{backgroundColor:e.bgColor,color:e.color,fontStyle:ka(e.fontStyle)?"italic":void 0,fontWeight:ga(e.fontStyle)?"bold":void 0,textDecoration:ba(e.fontStyle)?"underline":void 0,...e.htmlStyle},children:e.content}),va=a("fk:block","fk:before:content-[counter(line)]","fk:before:inline-block","fk:before:[counter-increment:line]","fk:before:w-8","fk:before:mr-4","fk:before:text-right","fk:before:text-muted-foreground/50","fk:before:font-mono","fk:before:select-none"),Ca=({keyedLine:e,showLineNumbers:t})=>jsx("span",{className:t?va:"fk:block",children:e.tokens.length===0?`
2
+ `:e.tokens.map(({token:o,key:r})=>jsx(xa,{token:o},r))}),wo=createContext({code:""}),Co=new Map,Po=new Map,ue=new Map,Pa=(e,t)=>{let o=e.slice(0,100),r=e.length>100?e.slice(-100):"";return `${t}:${e.length}:${o}:${r}`},ya=e=>{let t=Co.get(e);if(t)return t;let o=createHighlighter({langs:[e],themes:["github-light","github-dark"]});return Co.set(e,o),o},Sa=e=>({bg:"transparent",fg:"inherit",tokens:e.split(`
3
+ `).map(t=>t===""?[]:[{color:"inherit",content:t}])}),yo=(e,t,o)=>{let r=Pa(e,t),a=Po.get(r);return a||(o&&(ue.has(r)||ue.set(r,new Set),ue.get(r)?.add(o)),ya(t).then(i=>{let l=i.getLoadedLanguages().includes(t)?t:"text",p=i.codeToTokens(e,{lang:l,themes:{dark:"github-dark",light:"github-light"}}),c={bg:p.bg??"transparent",fg:p.fg??"inherit",tokens:p.tokens};Po.set(r,c);let m=ue.get(r);if(m){for(let k of m)k(c);ue.delete(r);}}).catch(i=>{console.error("Failed to highlight code:",i),ue.delete(r);}),null)},Mo=memo(({tokenized:e,showLineNumbers:t,className:o})=>{let r=useMemo(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),a$1=useMemo(()=>ha(e.tokens),[e.tokens]);return jsx("pre",{className:a("fk:dark:bg-(--shiki-dark-bg)! fk:dark:text-(--shiki-dark)! fk:m-0 fk:p-4 fk:text-sm",o),style:r,children:jsx("code",{className:a("fk:font-mono fk:text-sm",t&&"fk:[counter-increment:line_0] fk:[counter-reset:line]"),children:a$1.map(i=>jsx(Ca,{keyedLine:i,showLineNumbers:t},i.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className);Mo.displayName="CodeBlockBody";var Ta=({className:e,language:t,style:o,...r})=>jsx("div",{className:a("fk:group fk:relative fk:w-full fk:overflow-hidden fk:rounded-md fk:border fk:bg-background fk:text-foreground fk:corner-squircle",e),"data-language":t,style:{containIntrinsicSize:"auto 200px",contentVisibility:"auto",...o},...r}),ul=({children:e,className:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:justify-between fk:border-b fk:bg-muted/80 fk:px-3 fk:py-2 fk:text-muted-foreground fk:text-xs",t),...o,children:e}),ml=({children:e,className:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-2",t),...o,children:e}),kl=({children:e,className:t,...o})=>jsx("span",{className:a("fk:font-mono",t),...o,children:e}),gl=({children:e,className:t,...o})=>jsx("div",{className:a("fk:-my-1 fk:-mr-1 fk:flex fk:items-center fk:gap-2",t),...o,children:e}),Ia=({code:e,language:t,showLineNumbers:o=false})=>{let r=useMemo(()=>Sa(e),[e]),a=useMemo(()=>yo(e,t)??r,[e,t,r]),[i,s]=useState(null),l=useRef({code:e,language:t});return (l.current.code!==e||l.current.language!==t)&&(l.current={code:e,language:t},s(null)),useEffect(()=>{let c=false;return yo(e,t,m=>{c||s(m);}),()=>{c=true;}},[e,t]),jsx("div",{className:"fk:relative fk:overflow-auto",children:jsx(Mo,{showLineNumbers:o,tokenized:i??a})})},lt=({code:e,language:t,showLineNumbers:o=false,className:r,children:a,...i})=>{let s=useMemo(()=>({code:e}),[e]);return jsx(wo.Provider,{value:s,children:jsxs(Ta,{className:r,language:t,...i,children:[a,jsx(Ia,{code:e,language:t,showLineNumbers:o})]})})},bl=({onCopy:e,onError:t,timeout:o=2e3,children:r,className:a$1,...i})=>{let[s,l]=useState(false),p=useRef(0),{code:c}=useContext(wo),m=useCallback(async()=>{if(typeof window>"u"||!navigator?.clipboard?.writeText){t?.(new Error("Clipboard API not available"));return}try{s||(await navigator.clipboard.writeText(c),l(!0),e?.(),p.current=window.setTimeout(()=>l(!1),o));}catch(g){t?.(g);}},[c,e,t,o,s]);useEffect(()=>()=>{window.clearTimeout(p.current);},[]);let k=s?CheckIcon:CopyIcon;return jsx(b,{className:a("fk:shrink-0",a$1),onClick:m,size:"icon",variant:"ghost",...i,children:r??jsx(k,{size:14})})},hl=e=>jsx(a$4,{...e}),xl=({className:e,...t})=>jsx(d,{className:a("fk:h-7 fk:border-none fk:bg-transparent fk:px-2 fk:text-xs fk:shadow-none",e),size:"sm",...t}),vl=e=>jsx(c$1,{...e}),Cl=({align:e="end",...t})=>jsx(e$1,{align:e,...t}),Pl=e=>jsx(g,{...e});var Rl=({className:e,...t})=>jsx(StickToBottom,{className:a("fk:relative fk:flex-1 fk:overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Al=({className:e,...t})=>jsx(StickToBottom.Content,{className:a("fk:flex fk:flex-col fk:gap-8 fk:p-4",e),...t}),Bl=({className:e,title:t="No messages yet",description:o="Start a conversation to see messages here",icon:r,children:a$1,...i})=>jsx("div",{className:a("fk:flex fk:size-full fk:flex-col fk:items-center fk:justify-center fk:gap-3 fk:p-8 fk:text-center",e),...i,children:a$1??jsxs(Fragment,{children:[r&&jsx("div",{className:"fk:text-muted-foreground",children:r}),jsxs("div",{className:"fk:space-y-1",children:[jsx("h3",{className:"fk:font-medium fk:text-sm",children:t}),o&&jsx("p",{className:"fk:text-muted-foreground fk:text-sm",children:o})]})]})}),Ll=({className:e,...t})=>{let{isAtBottom:o,scrollToBottom:r}=useStickToBottomContext(),a$1=useCallback(()=>{r();},[r]);return !o&&jsx(b,{className:a("fk:absolute fk:bottom-4 fk:left-[50%] fk:translate-x-[-50%] fk:rounded-full fk:dark:bg-background fk:dark:hover:bg-muted fk:corner-squircle",e),onClick:a$1,size:"icon",type:"button",variant:"outline",...t,children:jsx(ArrowDownIcon,{className:"fk:size-4"})})},Aa=e=>e.parts.filter(t=>t.type==="text").map(t=>t.text).join(""),Bo=e=>`**${e.role.charAt(0).toUpperCase()+e.role.slice(1)}:** ${Aa(e)}`,Ba=(e,t=Bo)=>e.map((o,r)=>t(o,r)).join(`
4
4
 
5
- `),Rl=({messages:e,filename:t="conversation.md",formatMessage:o=Bo,className:r,children:a$1,...i})=>{let s=useCallback(()=>{let l=Ma(e,o),p=new Blob([l],{type:"text/markdown"}),c=URL.createObjectURL(p),m=document.createElement("a");m.href=c,m.download=t,document.body.append(m),m.click(),m.remove(),URL.revokeObjectURL(c);},[e,t,o]);return jsx(b,{className:a("fk:absolute fk:top-4 fk:right-4 fk:rounded-full fk:dark:bg-background fk:dark:hover:bg-muted fk:corner-squircle",r),onClick:s,size:"icon",type:"button",variant:"outline",...i,children:a$1??jsx(DownloadIcon,{className:"fk:size-4"})})};var ql=({className:e,from:t,...o})=>jsx("div",{className:a("fk:group fk:flex fk:w-full fk:max-w-[95%] fk:flex-col fk:gap-2",t==="user"?"fk:is-user fk:ml-auto fk:justify-end":"fk:is-assistant",e),...o}),jl=({children:e,className:t,...o})=>jsx("div",{className:a("fk:is-user:dark fk:flex fk:w-fit fk:min-w-0 fk:max-w-full fk:flex-col fk:gap-2 fk:overflow-hidden fk:text-sm","fk:group-[.is-user]:ml-auto fk:group-[.is-user]:rounded-lg fk:group-[.is-user]:bg-secondary fk:group-[.is-user]:px-4 fk:group-[.is-user]:py-3 fk:group-[.is-user]:text-foreground","fk:group-[.is-assistant]:text-foreground",t),...o,children:e}),Wl=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-1",e),...o,children:t}),$l=({tooltip:e$1,children:t,label:o,variant:r="ghost",size:a="icon-sm",...i})=>{let s=jsxs(b,{size:a,type:"button",variant:r,...i,children:[t,jsx("span",{className:"fk:sr-only",children:o||e$1})]});return e$1?jsx(a$1,{children:jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsx(e,{children:jsx("p",{children:e$1})})]})}):s},Eo=createContext(null),qe=()=>{let e=useContext(Eo);if(!e)throw new Error("MessageBranch components must be used within MessageBranch");return e},Kl=({defaultBranch:e=0,onBranchChange:t,className:o,...r})=>{let[a$1,i]=useState(e),[s,l]=useState([]),p=useCallback(g=>{i(g),t?.(g);},[t]),c=useCallback(()=>{let g=a$1>0?a$1-1:s.length-1;p(g);},[a$1,s.length,p]),m=useCallback(()=>{let g=a$1<s.length-1?a$1+1:0;p(g);},[a$1,s.length,p]),k=useMemo(()=>({branches:s,currentBranch:a$1,goToNext:m,goToPrevious:c,setBranches:l,totalBranches:s.length}),[s,a$1,m,c]);return jsx(Eo.Provider,{value:k,children:jsx("div",{className:a("fk:grid fk:w-full fk:gap-2 fk:[&>div]:pb-0",o),...r})})},Xl=({children:e,...t})=>{let{currentBranch:o,setBranches:r,branches:a$1}=qe(),i=useMemo(()=>Array.isArray(e)?e:[e],[e]);return useEffect(()=>{a$1.length!==i.length&&r(i);},[i,a$1,r]),i.map((s,l)=>jsx("div",{className:a("fk:grid fk:gap-2 fk:overflow-hidden fk:[&>div]:pb-0",l===o?"fk:block":"fk:hidden"),...t,children:s},s.key))},Jl=({className:e,...t})=>{let{totalBranches:o}=qe();return o<=1?null:jsx(b$2,{className:a("fk:[&>*:not(:first-child)]:rounded-l-md fk:[&>*:not(:last-child)]:rounded-r-md",e),orientation:"horizontal",...t})},Yl=({children:e,...t})=>{let{goToPrevious:o,totalBranches:r}=qe();return jsx(b,{"aria-label":"Previous branch",disabled:r<=1,onClick:o,size:"icon-sm",type:"button",variant:"ghost",...t,children:e??jsx(ChevronLeftIcon,{size:14})})},Zl=({children:e,...t})=>{let{goToNext:o,totalBranches:r}=qe();return jsx(b,{"aria-label":"Next branch",disabled:r<=1,onClick:o,size:"icon-sm",type:"button",variant:"ghost",...t,children:e??jsx(ChevronRightIcon,{size:14})})},Ql=({className:e,...t})=>{let{currentBranch:o,totalBranches:r}=qe();return jsxs(c$2,{className:a("fk:border-none fk:bg-transparent fk:text-muted-foreground fk:shadow-none",e),...t,children:[o+1," of ",r]})},Fa={cjk:cjk,code:code,math:math,mermaid:mermaid},_a=memo(({className:e,...t})=>jsx(Streamdown,{className:a("fk:size-full fk:[&>*:first-child]:mt-0 fk:[&>*:last-child]:mb-0",e),plugins:Fa,prefix:"fk",...t}),(e,t)=>e.children===t.children&&t.isAnimating===e.isAnimating);_a.displayName="MessageResponse";var ep=({className:e,children:t,...o})=>jsx("div",{className:a("fk:mt-4 fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-4",e),...o,children:t});var sp=e=>jsx(d$1,{...e}),ip=e=>jsx(e$2,{...e}),lp=({className:e,children:t,title:o="Model Selector",...r})=>jsxs(i,{"aria-describedby":void 0,className:a("fk:outline! fk:border-none! fk:p-0 fk:outline-border! fk:outline-solid!",e),...r,children:[jsx(l,{className:"fk:sr-only",children:o}),jsx(n,{className:"fk:**:data-[slot=command-input-wrapper]:h-auto",children:t})]}),pp=e=>jsx(o$1,{...e}),cp=({className:e,...t})=>jsx(p$1,{className:a("fk:h-auto fk:py-3.5",e),...t}),fp=e=>jsx(q$1,{...e}),dp=e=>jsx(r,{...e}),up=e=>jsx(s,{...e}),mp=e=>jsx(u,{...e}),kp=e=>jsx(v,{...e}),gp=e=>jsx(t,{...e}),bp=({provider:e,className:t,...o})=>jsx("img",{...o,alt:`${e} logo`,className:a("fk:size-3 fk:dark:invert",t),height:12,src:`https://models.dev/logos/${e}.svg`,width:12}),hp=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:shrink-0 fk:items-center fk:-space-x-1 fk:[&>img]:rounded-full fk:[&>img]:bg-background fk:[&>img]:p-px fk:[&>img]:ring-1 fk:dark:[&>img]:bg-foreground",e),...t}),xp=({className:e,...t})=>jsx("span",{className:a("fk:flex-1 fk:truncate fk:text-left",e),...t});var Ya=async e=>{try{let o=await(await fetch(e)).blob();return new Promise(r=>{let a=new FileReader;a.onloadend=()=>r(a.result),a.onerror=()=>r(null),a.readAsDataURL(o);})}catch{return null}},Za=async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getDisplayMedia)return null;let e=null,t=document.createElement("video");t.muted=true,t.playsInline=true;try{e=await navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}),t.srcObject=e,await new Promise((p,c)=>{t.onloadedmetadata=()=>p(),t.onerror=()=>c(new Error("Failed to load screen stream"));}),await t.play();let o=t.videoWidth,r=t.videoHeight;if(!o||!r)return null;let a=document.createElement("canvas");a.width=o,a.height=r;let i=a.getContext("2d");if(!i)return null;i.drawImage(t,0,0,o,r);let s=await new Promise(p=>{a.toBlob(p,"image/png");});if(!s)return null;let l=new Date().toISOString().replaceAll(/[:.]/g,"-").replace("T","_").replace("Z","");return new File([s],`screenshot-${l}.png`,{lastModified:Date.now(),type:"image/png"})}finally{if(e)for(let o of e.getTracks())o.stop();t.pause(),t.srcObject=null;}},Wt=createContext(null),$t=createContext(null),Lp=()=>{let e=useContext(Wt);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return e},zo=()=>useContext(Wt),Dp=()=>{let e=useContext($t);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return e},Qa=()=>useContext($t),Ep=({initialInput:e="",children:t})=>{let[o,r]=useState(e),a=useCallback(()=>r(""),[]),[i,s]=useState([]),l=useRef(null),p=useRef(()=>{}),c=useCallback(f=>{let x=Array.from(f);x.length!==0&&s(z=>[...z,...x.map(R=>({filename:R.name,id:nanoid(),mediaType:R.type,type:"file",url:URL.createObjectURL(R)}))]);},[]),m=useCallback(f=>{s(x=>{let z=x.find(R=>R.id===f);return z?.url&&URL.revokeObjectURL(z.url),x.filter(R=>R.id!==f)});},[]),k=useCallback(()=>{s(f=>{for(let x of f)x.url&&URL.revokeObjectURL(x.url);return []});},[]),g=useRef(i);useEffect(()=>{g.current=i;},[i]),useEffect(()=>()=>{for(let f of g.current)f.url&&URL.revokeObjectURL(f.url);},[]);let T=useCallback(()=>{p.current?.();},[]),b=useMemo(()=>({add:c,clear:k,fileInputRef:l,files:i,openFileDialog:T,remove:m}),[i,c,m,k,T]),C=useCallback((f,x)=>{l.current=f.current,p.current=x;},[]),N=useMemo(()=>({__registerFileInput:C,attachments:b,textInput:{clear:a,setInput:r,value:o}}),[o,a,b,C]);return jsx(Wt.Provider,{value:N,children:jsx($t.Provider,{value:b,children:t})})},Ho=createContext(null),Kt=()=>{let e=Qa(),o=useContext(Ho)??e;if(!o)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return o},Go=createContext(null),zp=()=>{let e=useContext(Go);if(!e)throw new Error("usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider");return e},Hp=({label:e="Add photos or files",onSelect:t,...o})=>{let r=Kt(),a=useCallback(i=>{t?.(i),!i.defaultPrevented&&r.openFileDialog();},[r,t]);return jsxs(h,{...o,onSelect:a,children:[jsx(ImageIcon,{className:"fk:mr-2 fk:size-4"})," ",e]})},Gp=({label:e="Take screenshot",onSelect:t,...o})=>{let r=Kt(),a=useCallback(async i=>{if(t?.(i),!i.defaultPrevented)try{let s=await Za();s&&r.add([s]);}catch(s){if(s instanceof DOMException&&(s.name==="NotAllowedError"||s.name==="AbortError"))return;throw s}},[t,r]);return jsxs(h,{...o,onSelect:a,children:[jsx(Monitor,{className:"fk:mr-2 fk:size-4"}),e]})},Op=({className:e,accept:t,multiple:o,globalDrop:r,syncHiddenInput:a$1,maxFiles:i,maxFileSize:s,onError:l,onSubmit:p,children:c,...m})=>{let k=zo(),g=!!k,T=useRef(null),b=useRef(null),[C,N]=useState([]),f=g?k.attachments.files:C,[x,z]=useState([]),R=useRef(f);useEffect(()=>{R.current=f;},[f]);let he=useCallback(()=>{T.current?.click();},[]),_=useCallback(u=>!t||t.trim()===""?true:t.split(",").map(h=>h.trim()).filter(Boolean).some(h=>{if(h.startsWith("."))return u.name.toLowerCase().endsWith(h.toLowerCase());if(h.endsWith("/*")){let y=h.slice(0,-1);return u.type.startsWith(y)}return u.type===h}),[t]),$e=useCallback(u=>{let v=Array.from(u),h=v.filter(X=>_(X));if(v.length&&h.length===0){l?.({code:"accept",message:"No files match the accepted types."});return}let y=X=>s?X.size<=s:true,O=h.filter(y);if(h.length>0&&O.length===0){l?.({code:"max_file_size",message:"All files exceed the maximum size."});return}N(X=>{let D=typeof i=="number"?Math.max(0,i-X.length):void 0,pe=typeof D=="number"?O.slice(0,D):O;typeof D=="number"&&O.length>D&&l?.({code:"max_files",message:"Too many files. Some were not added."});let ce=[];for(let ft of pe)ce.push({filename:ft.name,id:nanoid(),mediaType:ft.type,type:"file",url:URL.createObjectURL(ft)});return [...X,...ce]});},[_,i,s,l]),te=useCallback(u=>N(v=>{let h=v.find(y=>y.id===u);return h?.url&&URL.revokeObjectURL(h.url),v.filter(y=>y.id!==u)}),[]),j=useCallback(u=>{let v=Array.from(u),h=v.filter(ce=>_(ce));if(v.length&&h.length===0){l?.({code:"accept",message:"No files match the accepted types."});return}let y=ce=>s?ce.size<=s:true,O=h.filter(y);if(h.length>0&&O.length===0){l?.({code:"max_file_size",message:"All files exceed the maximum size."});return}let X=f.length,D=typeof i=="number"?Math.max(0,i-X):void 0,pe=typeof D=="number"?O.slice(0,D):O;typeof D=="number"&&O.length>D&&l?.({code:"max_files",message:"Too many files. Some were not added."}),pe.length>0&&k?.attachments.add(pe);},[_,s,i,l,f.length,k]),W=useCallback(()=>g?k?.attachments.clear():N(u=>{for(let v of u)v.url&&URL.revokeObjectURL(v.url);return []}),[g,k]),$=useCallback(()=>z([]),[]),G=g?j:$e,xe=g?k.attachments.remove:te,Ke=g?k.attachments.openFileDialog:he,ve=useCallback(()=>{W(),$();},[W,$]);useEffect(()=>{g&&k.__registerFileInput(T,()=>T.current?.click());},[g,k]),useEffect(()=>{a$1&&T.current&&f.length===0&&(T.current.value="");},[f,a$1]),useEffect(()=>{let u=b.current;if(!u||r)return;let v=y=>{y.dataTransfer?.types?.includes("Files")&&y.preventDefault();},h=y=>{y.dataTransfer?.types?.includes("Files")&&y.preventDefault(),y.dataTransfer?.files&&y.dataTransfer.files.length>0&&G(y.dataTransfer.files);};return u.addEventListener("dragover",v),u.addEventListener("drop",h),()=>{u.removeEventListener("dragover",v),u.removeEventListener("drop",h);}},[G,r]),useEffect(()=>{if(!r)return;let u=h=>{h.dataTransfer?.types?.includes("Files")&&h.preventDefault();},v=h=>{h.dataTransfer?.types?.includes("Files")&&h.preventDefault(),h.dataTransfer?.files&&h.dataTransfer.files.length>0&&G(h.dataTransfer.files);};return document.addEventListener("dragover",u),document.addEventListener("drop",v),()=>{document.removeEventListener("dragover",u),document.removeEventListener("drop",v);}},[G,r]),useEffect(()=>()=>{if(!g)for(let u of R.current)u.url&&URL.revokeObjectURL(u.url);},[g]);let Xe=useCallback(u=>{u.currentTarget.files&&G(u.currentTarget.files),u.currentTarget.value="";},[G]),L=useMemo(()=>({add:G,clear:W,fileInputRef:T,files:f.map(u=>({...u,id:u.id})),openFileDialog:Ke,remove:xe}),[f,G,xe,W,Ke]),Je=useMemo(()=>({add:u=>{let v=Array.isArray(u)?u:[u];z(h=>[...h,...v.map(y=>({...y,id:nanoid()}))]);},clear:$,remove:u=>{z(v=>v.filter(h=>h.id!==u));},sources:x}),[x,$]),oe=useCallback(async u=>{u.preventDefault();let v=u.currentTarget,h=g?k.textInput.value:new FormData(v).get("message")||"";g||v.reset();try{let y=await Promise.all(f.map(async({id:X,...D})=>{if(D.url?.startsWith("blob:")){let pe=await Ya(D.url);return {...D,url:pe??D.url}}return D})),O=p({files:y,text:h},u);if(O instanceof Promise)try{await O,ve(),g&&k.textInput.clear();}catch{}else ve(),g&&k.textInput.clear();}catch{}},[g,k,f,p,ve]),K=jsxs(Fragment,{children:[jsx("input",{accept:t,"aria-label":"Upload files",className:"fk:hidden",multiple:o,onChange:Xe,ref:T,title:"Upload files",type:"file"}),jsx("form",{className:a("fk:w-full",e),onSubmit:oe,ref:b,...m,children:jsx(Ut,{className:"fk:overflow-hidden",children:c})})]}),Ce=jsx(Go.Provider,{value:Je,children:K});return jsx(Ho.Provider,{value:L,children:Ce})},Up=({className:e,...t})=>jsx("div",{className:a("fk:contents",e),...t}),Fp=({onChange:e,onKeyDown:t,className:o,placeholder:r="What would you like to know?",...a$1})=>{let i=zo(),s=Kt(),[l,p]=useState(false),c=useCallback(b=>{if(t?.(b),!b.defaultPrevented){if(b.key==="Enter"){if(l||b.nativeEvent.isComposing||b.shiftKey)return;b.preventDefault();let{form:C}=b.currentTarget;if(C?.querySelector('button[type="submit"]')?.disabled)return;C?.requestSubmit();}if(b.key==="Backspace"&&b.currentTarget.value===""&&s.files.length>0){b.preventDefault();let C=s.files[s.files.length-1];C&&s.remove(C.id);}}},[t,l,s]),m=useCallback(b=>{let C=b.clipboardData?.items;if(!C)return;let N=[];for(let f of Array.from(C))if(f.kind==="file"){let x=f.getAsFile();x&&N.push(x);}N.length>0&&(b.preventDefault(),s.add(N));},[s]),k=useCallback(()=>p(false),[]),g=useCallback(()=>p(true),[]),T=i?{onChange:b=>{i.textInput.setInput(b.currentTarget.value),e?.(b);},value:i.textInput.value}:{onChange:e};return jsx(Ft,{className:a("fk:field-sizing-content fk:max-h-48 fk:min-h-16",o),name:"message",onCompositionEnd:k,onCompositionStart:g,onKeyDown:c,onPaste:m,placeholder:r,...a$1,...T})},_p=({className:e,...t})=>jsx(st,{align:"block-end",className:a("fk:order-first fk:flex-wrap fk:gap-1",e),...t}),Vp=({className:e,...t})=>jsx(st,{align:"block-end",className:a("fk:justify-between fk:gap-1",e),...t}),qp=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:min-w-0 fk:items-center fk:gap-1",e),...t}),es=({variant:e$1="ghost",className:t,size:o,tooltip:r,...a$1})=>{let i=o??(Children.count(a$1.children)>1?"sm":"icon-sm"),s=jsx(it,{className:a(t),size:i,type:"button",variant:e$1,...a$1});if(!r)return s;let l=typeof r=="string"?r:r.content,p=typeof r=="string"?void 0:r.shortcut,c$1=typeof r=="string"?"top":r.side??"top";return jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsxs(e,{side:c$1,children:[l,p&&jsx("span",{className:"fk:ml-2 fk:text-muted-foreground",children:p})]})]})},jp=e=>jsx(c$3,{...e}),Wp=({className:e,children:t,...o})=>jsx(e$3,{asChild:true,children:jsx(es,{className:e,...o,children:t??jsx(PlusIcon,{className:"fk:size-4"})})}),$p=({className:e,onCloseAutoFocus:t,...o})=>jsx(f,{align:"start",className:a(e),onCloseAutoFocus:r=>{t?.(r),!r.defaultPrevented&&r.preventDefault();},...o}),Kp=({className:e,...t})=>jsx(h,{className:a(e),...t}),Xp=({className:e,variant:t="default",size:o="icon-sm",status:r,onStop:a$1,onClick:i,children:s,...l})=>{let p=r==="submitted"||r==="streaming",c=jsx(CornerDownLeftIcon,{className:"fk:size-4"});r==="submitted"?c=jsx(Ot,{}):r==="streaming"?c=jsx(SquareIcon,{className:"fk:size-4"}):r==="error"&&(c=jsx(XIcon,{className:"fk:size-4"}));let m=useCallback(k=>{if(p&&a$1){k.preventDefault(),a$1();return}i?.(k);},[p,a$1,i]);return jsx(it,{"aria-label":p?"Stop":"Submit",className:a(e),onClick:m,size:o,type:p&&a$1?"button":"submit",variant:t,...l,children:s??c})},Jp=e=>jsx(a$4,{...e}),Yp=({className:e,...t})=>jsx(d,{className:a("fk:border-none fk:bg-transparent fk:font-medium fk:text-muted-foreground fk:shadow-none fk:transition-colors","fk:hover:bg-accent fk:hover:text-foreground fk:aria-expanded:bg-accent fk:aria-expanded:text-foreground",e),...t}),Zp=({className:e,...t})=>jsx(e$1,{className:a(e),...t}),Qp=({className:e,...t})=>jsx(g,{className:a(e),...t}),ec=({className:e,...t})=>jsx(c$1,{className:a(e),...t}),tc=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Ue,{closeDelay:t,openDelay:e,...o}),oc=e=>jsx(Fe,{...e}),rc=({align:e="start",...t})=>jsx(_e,{align:e,...t}),nc=({className:e,...t})=>jsx("div",{className:a(e),...t}),ac=({className:e,...t})=>jsx("div",{className:a(e),...t}),sc=({className:e,...t})=>jsx("h3",{className:a("fk:mb-2 fk:px-3 fk:font-medium fk:text-muted-foreground fk:text-xs",e),...t}),ic=({className:e,...t})=>jsx("div",{className:a("fk:space-y-1",e),...t}),lc=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-2 fk:px-3 fk:py-2 fk:text-xs fk:hover:bg-accent",e),...t}),pc=({className:e,...t})=>jsx(n,{className:a(e),...t}),cc=({className:e,...t})=>jsx(p$1,{className:a(e),...t}),fc=({className:e,...t})=>jsx(q$1,{className:a(e),...t}),dc=({className:e,...t})=>jsx(r,{className:a(e),...t}),uc=({className:e,...t})=>jsx(s,{className:a(e),...t}),mc=({className:e,...t})=>jsx(u,{className:a(e),...t}),kc=({className:e,...t$1})=>jsx(t,{className:a(e),...t$1});var Oo=new Map,as=e=>{let t=Oo.get(e);return t||(t=motion.create(e),Oo.set(e,t)),t},ss=({children:e,as:t="p",className:o,duration:r=2,spread:a$1=2})=>{let i=as(t),s=useMemo(()=>(e?.length??0)*a$1,[e,a$1]);return jsx(i,{animate:{backgroundPosition:"0% center"},className:a("fk:relative fk:inline-block fk:bg-[length:250%_100%,auto] fk:bg-clip-text fk:text-transparent","fk:[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] fk:[background-repeat:no-repeat,padding-box]",o),initial:{backgroundPosition:"100% center"},style:{"--spread":`${s}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{duration:r,ease:"linear",repeat:Number.POSITIVE_INFINITY},children:e})},Xt=memo(ss);var _o=createContext(null),vs=()=>{let e=useContext(_o);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Cs=1e3,Ps=1e3,ys=memo(({className:e,isStreaming:t=false,open:o$1,defaultOpen:r,onOpenChange:a$1,duration:i,children:s,...l})=>{let p=r??t,c=r===false,[m,k]=useControllableState({defaultProp:p,onChange:a$1,prop:o$1}),[g,T]=useControllableState({defaultProp:void 0,prop:i}),b=useRef(t),[C,N]=useState(false),f=useRef(null);useEffect(()=>{t?(b.current=true,f.current===null&&(f.current=Date.now())):f.current!==null&&(T(Math.ceil((Date.now()-f.current)/Ps)),f.current=null);},[t,T]),useEffect(()=>{t&&!m&&!c&&k(true);},[t,m,k,c]),useEffect(()=>{if(b.current&&!t&&m&&!C){let R=setTimeout(()=>{k(false),N(true);},Cs);return ()=>clearTimeout(R)}},[t,m,k,C]);let x=useCallback(R=>{k(R);},[k]),z=useMemo(()=>({duration:g,isOpen:m,isStreaming:t,setIsOpen:k}),[g,m,t,k]);return jsx(_o.Provider,{value:z,children:jsx(o,{className:a("fk:not-prose fk:mb-4",e),onOpenChange:x,open:m,...l,children:s})})}),Ss=(e,t)=>e||t===0?jsx(Xt,{duration:1,children:"Thinking..."}):t===void 0?jsx("p",{children:"Thought for a few seconds"}):jsxs("p",{children:["Thought for ",t," seconds"]}),Ts=memo(({className:e,children:t,getThinkingMessage:o=Ss,...r})=>{let{isStreaming:a$1,isOpen:i,duration:s}=vs();return jsx(p,{className:a("fk:flex fk:w-full fk:items-center fk:gap-2 fk:text-muted-foreground fk:text-sm fk:transition-colors fk:hover:text-foreground",e),...r,children:t??jsxs(Fragment,{children:[jsx(BrainIcon,{className:"fk:size-4"}),o(a$1,s),jsx(ChevronDownIcon,{className:a("fk:size-4 fk:transition-transform",i?"fk:rotate-180":"fk:rotate-0")})]})})}),Is={cjk:cjk,code:code,math:math,mermaid:mermaid},ws=memo(({className:e,children:t,...o})=>jsx(q,{className:a("fk:mt-4 fk:text-sm","fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:text-muted-foreground fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...o,children:jsx(Streamdown,{plugins:Is,children:t})}));ys.displayName="Reasoning";Ts.displayName="ReasoningTrigger";ws.displayName="ReasoningContent";var Oc=({className:e,...t})=>jsx(o,{className:a("fk:not-prose fk:mb-4 fk:text-primary fk:text-xs",e),...t}),Uc=({className:e,count:t,children:o,...r})=>jsx(p,{className:a("fk:flex fk:items-center fk:gap-2",e),...r,children:o??jsxs(Fragment,{children:[jsxs("p",{className:"fk:font-medium",children:["Used ",t," sources"]}),jsx(ChevronDownIcon,{className:"fk:h-4 fk:w-4"})]})}),Fc=({className:e,...t})=>jsx(q,{className:a("fk:mt-3 fk:flex fk:w-fit fk:flex-col fk:gap-2","fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...t}),_c=({href:e,title:t,children:o,...r})=>jsx("a",{className:"fk:flex fk:items-center fk:gap-2",href:e,rel:"noreferrer",target:"_blank",...r,children:o??jsxs(Fragment,{children:[jsx(BookIcon,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:block fk:font-medium",children:t})]})});var Ds=6e4;function Es(){return typeof window<"u"&&"MediaRecorder"in window&&typeof navigator<"u"&&"mediaDevices"in navigator&&typeof navigator.mediaDevices.getUserMedia=="function"}function zs(){return ["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"].find(t=>MediaRecorder.isTypeSupported(t))}function jo(e,t){return e instanceof DOMException&&(e.name==="NotAllowedError"||e.name==="PermissionDeniedError")?new Error("Microphone permission was denied. Enable the microphone to dictate."):e instanceof DOMException&&e.name==="NotFoundError"?new Error("No microphone was found."):e instanceof Error?e:new Error(t)}function Hs(e){return e instanceof Error&&e.name==="AbortError"}function Gs(e,t,o){return e?o?"Cancel transcription":t?"Stop recording":"Dictate":"Dictation is not available in this browser."}var Jc=({className:e$1,disabled:t,onAudioRecorded:o,onError:r,onTranscriptionChange:a$1,size:i="icon-sm",variant:s="ghost",...l})=>{let[p,c$1]=useState(false),[m,k]=useState(false),[g,T]=useState(false),b$2=useRef(null),C=useRef(null),N=useRef([]),f=useRef(null),x=useRef(null),z=useRef(false),R=useRef(!!t),he=useRef(o),_=useRef(r),$e=useRef(a$1);R.current=!!t,he.current=o,_.current=r,$e.current=a$1,useEffect(()=>{T(Es());},[]);let te=useCallback(()=>{if(C.current){for(let L of C.current.getTracks())L.stop();C.current=null;}},[]),j=useCallback(()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null);},[]),W=useCallback(()=>{j(),b$2.current?.state==="recording"&&b$2.current.stop(),c$1(false);},[j]),$=useCallback(()=>{x.current?.abort(),x.current=null,k(false);},[]),G=useCallback(()=>{$(),j();let L=b$2.current;L?.state==="recording"&&(z.current=true,L.stop()),c$1(false),te();},[$,j,te]),xe=useCallback(async()=>{if(!R.current){if(!he.current){_.current?.(new Error("Dictation is not configured."));return}try{let L=await navigator.mediaDevices.getUserMedia({audio:!0});if(R.current){for(let K of L.getTracks())K.stop();return}C.current=L;let Je=zs(),oe=Je?new MediaRecorder(L,{mimeType:Je}):new MediaRecorder(L);N.current=[],oe.ondataavailable=K=>{K.data.size>0&&N.current.push(K.data);},oe.onstop=async()=>{if(te(),j(),c$1(!1),z.current){z.current=!1,N.current=[];return}let K=new Blob(N.current,{type:oe.mimeType||"audio/webm"});if(K.size===0)return;let Ce=new AbortController;x.current=Ce,k(!0);try{let u=he.current;if(!u)return;let v=await u(K,Ce.signal);v&&$e.current?.(v);}catch(u){if(Hs(u))return;_.current?.(jo(u,"Transcription failed."));}finally{x.current===Ce&&(x.current=null,k(!1));}},oe.onerror=()=>{c$1(!1),te(),j(),_.current?.(new Error("Recording failed. Try again."));},b$2.current=oe,oe.start(250),c$1(!0),f.current=window.setTimeout(()=>{W();},Ds);}catch(L){c$1(false),te(),_.current?.(jo(L,"Could not start the microphone."));}}},[j,te,W]);useEffect(()=>{t&&G();},[G,t]),useEffect(()=>()=>{G();},[G]);let Ke=useCallback(()=>{if(m){$();return}if(p){W();return}xe();},[$,p,m,xe,W]),ve=t||!g||!o,Xe=Gs(g&&!!o,p,m);return jsxs(b$1,{children:[jsx(c,{asChild:true,children:jsxs("span",{className:"fk:relative fk:inline-flex fk:items-center fk:justify-center",children:[p?[0,1,2].map(L=>jsx("span",{className:"fk:absolute fk:inset-0 fk:animate-ping fk:rounded-full fk:border-2 fk:border-red-400/30 fk:corner-squircle",style:{animationDelay:`${String(L*.3)}s`,animationDuration:"2s"}},L)):null,jsxs(b,{"aria-label":Xe,"aria-pressed":p,size:i,variant:p?"destructive":s,...l,className:a("fk:relative fk:z-10 fk:rounded-full fk:dark:hover:bg-accent fk:corner-squircle",e$1),disabled:ve,onClick:Ke,type:"button",children:[m?jsx(LoaderIcon,{className:"fk:size-4 fk:animate-spin"}):null,!m&&p?jsx(SquareIcon,{className:"fk:size-4"}):null,m||p?null:jsx(MicIcon,{className:"fk:size-5"})]})]})}),jsx(e,{children:Xe})]})};var rf=({className:e,children:t,...o})=>jsxs(w,{className:"fk:w-full fk:overflow-x-auto fk:whitespace-nowrap",...o,children:[jsx("div",{className:a("fk:flex fk:w-max fk:flex-nowrap fk:items-center fk:gap-2",e),children:t}),jsx(x,{className:"fk:hidden",orientation:"horizontal"})]}),nf=({suggestion:e,onClick:t,className:o,variant:r="outline",size:a$1="sm",children:i,...s})=>{let l=useCallback(()=>{t?.(e);},[t,e]);return jsx(b,{className:a("fk:cursor-pointer fk:rounded-full fk:px-4 fk:corner-squircle",o),onClick:l,size:a$1,type:"button",variant:r,...s,children:i||e})};var mf=({className:e,...t})=>jsx(o,{className:a("fk:group fk:not-prose fk:mb-4 fk:w-full fk:rounded-md fk:border fk:corner-squircle",e),...t}),js={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},Ws={"approval-requested":jsx(ClockIcon,{className:"fk:size-4 fk:text-yellow-600"}),"approval-responded":jsx(CheckCircleIcon,{className:"fk:size-4 fk:text-blue-600"}),"input-available":jsx(ClockIcon,{className:"fk:size-4 fk:animate-pulse"}),"input-streaming":jsx(CircleIcon,{className:"fk:size-4"}),"output-available":jsx(CheckCircleIcon,{className:"fk:size-4 fk:text-green-600"}),"output-denied":jsx(XCircleIcon,{className:"fk:size-4 fk:text-orange-600"}),"output-error":jsx(XCircleIcon,{className:"fk:size-4 fk:text-red-600"})},$s=e=>jsxs(b$3,{className:"fk:gap-1.5 fk:py-px fk:rounded-full fk:text-xs fk:corner-squircle",variant:"secondary",children:[Ws[e],js[e]]}),kf=({className:e,title:t,type:o,state:r,toolName:a$1,...i})=>{let s=o==="dynamic-tool"?a$1:o.split("-").slice(1).join("-");return jsxs(p,{className:a("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-4 fk:px-3 fk:py-2",e),...i,children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(WrenchIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("span",{className:"fk:font-medium fk:text-sm",children:t??s}),$s(r)]}),jsx(ChevronDownIcon,{className:"fk:size-4 fk:text-muted-foreground fk:transition-transform fk:group-data-[state=open]:rotate-180"})]})},gf=({className:e,...t})=>jsx(q,{className:a("fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:space-y-4 fk:p-4 fk:text-popover-foreground fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...t}),bf=({className:e,input:t,...o})=>jsxs("div",{className:a("fk:space-y-2 fk:overflow-hidden",e),...o,children:[jsx("h4",{className:"fk:font-medium fk:text-muted-foreground fk:text-xs fk:uppercase fk:tracking-wide",children:"Parameters"}),jsx("div",{className:"fk:rounded-md fk:bg-muted/50 fk:corner-squircle",children:jsx(lt,{code:JSON.stringify(t,null,2),language:"json"})})]}),hf=({className:e,output:t,errorText:o,...r})=>{if(!(t||o))return null;let a$1=jsx("div",{children:t});return typeof t=="object"&&!isValidElement(t)?a$1=jsx(lt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(a$1=jsx(lt,{code:t,language:"json"})),jsxs("div",{className:a("fk:space-y-2",e),...r,children:[jsx("h4",{className:"fk:font-medium fk:text-muted-foreground fk:text-xs fk:uppercase fk:tracking-wide",children:o?"Error":"Result"}),jsxs("div",{className:a("fk:overflow-x-auto fk:rounded-md fk:text-xs fk:[&_table]:w-full fk:corner-squircle",o?"fk:bg-destructive/10 fk:text-destructive":"fk:bg-muted/50 fk:text-foreground"),children:[o&&jsx("div",{children:o}),a$1]})]})};
6
- export{$i as Attachment,el as AttachmentEmpty,Yi as AttachmentHoverCard,Qi as AttachmentHoverCardContent,Zi as AttachmentHoverCardTrigger,Xi as AttachmentInfo,Ki as AttachmentPreview,Ji as AttachmentRemove,Wi as Attachments,lt as CodeBlock,dl as CodeBlockActions,Ca as CodeBlockContainer,Pa as CodeBlockContent,ul as CodeBlockCopyButton,fl as CodeBlockFilename,pl as CodeBlockHeader,ml as CodeBlockLanguageSelector,bl as CodeBlockLanguageSelectorContent,hl as CodeBlockLanguageSelectorItem,kl as CodeBlockLanguageSelectorTrigger,gl as CodeBlockLanguageSelectorValue,cl as CodeBlockTitle,Il as Conversation,wl as ConversationContent,Rl as ConversationDownload,Ml as ConversationEmptyState,Nl as ConversationScrollButton,fn as ExternalLink,Ue as HoverCard,_e as HoverCardContent,Fe as HoverCardTrigger,Ut as InputGroup,st as InputGroupAddon,it as InputGroupButton,jn as InputGroupInput,qn as InputGroupText,Ft as InputGroupTextarea,Go as LocalReferencedSourcesContext,ql as Message,$l as MessageAction,Wl as MessageActions,Kl as MessageBranch,Xl as MessageBranchContent,Zl as MessageBranchNext,Ql as MessageBranchPage,Yl as MessageBranchPrevious,Jl as MessageBranchSelector,jl as MessageContent,_a as MessageResponse,ep as MessageToolbar,sp as ModelSelector,lp as ModelSelectorContent,pp as ModelSelectorDialog,dp as ModelSelectorEmpty,up as ModelSelectorGroup,cp as ModelSelectorInput,mp as ModelSelectorItem,fp as ModelSelectorList,bp as ModelSelectorLogo,hp as ModelSelectorLogoGroup,xp as ModelSelectorName,gp as ModelSelectorSeparator,kp as ModelSelectorShortcut,ip as ModelSelectorTrigger,Op as PromptInput,Hp as PromptInputActionAddAttachments,Gp as PromptInputActionAddScreenshot,jp as PromptInputActionMenu,$p as PromptInputActionMenuContent,Kp as PromptInputActionMenuItem,Wp as PromptInputActionMenuTrigger,Up as PromptInputBody,es as PromptInputButton,pc as PromptInputCommand,dc as PromptInputCommandEmpty,uc as PromptInputCommandGroup,cc as PromptInputCommandInput,mc as PromptInputCommandItem,fc as PromptInputCommandList,kc as PromptInputCommandSeparator,Vp as PromptInputFooter,_p as PromptInputHeader,tc as PromptInputHoverCard,rc as PromptInputHoverCardContent,oc as PromptInputHoverCardTrigger,Ep as PromptInputProvider,Jp as PromptInputSelect,Zp as PromptInputSelectContent,Qp as PromptInputSelectItem,Yp as PromptInputSelectTrigger,ec as PromptInputSelectValue,Xp as PromptInputSubmit,ac as PromptInputTab,ic as PromptInputTabBody,lc as PromptInputTabItem,sc as PromptInputTabLabel,nc as PromptInputTabsList,Fp as PromptInputTextarea,qp as PromptInputTools,ys as Reasoning,ws as ReasoningContent,Ts as ReasoningTrigger,gn as ResizableHandle,kn as ResizablePanel,mn as ResizablePanelGroup,Nt as Sheet,xn as SheetClose,Rt as SheetContent,Lt as SheetDescription,vn as SheetFooter,At as SheetHeader,ao as SheetOverlay,no as SheetPortal,Bt as SheetTitle,hn as SheetTrigger,Xt as Shimmer,On as Sidebar,Ht as SidebarContent,Ze as SidebarGroup,Bn as SidebarGroupContent,Gt as SidebarGroupLabel,An as SidebarInset,Qe as SidebarMenu,tt as SidebarMenuButton,et as SidebarMenuItem,Et as SidebarPanel,Nn as SidebarProvider,zt as SidebarRail,Rn as SidebarTrigger,_c as Source,Oc as Sources,Fc as SourcesContent,Uc as SourcesTrigger,Jc as SpeechInput,Ot as Spinner,nf as Suggestion,rf as Suggestions,mf as Tool,gf as ToolContent,kf as ToolHeader,bf as ToolInput,hf as ToolOutput,ta as getAttachmentLabel,bo as getMediaCategory,$s as getStatusBadge,yo as highlightCode,Ma as messagesToMarkdown,_t as useAttachmentContext,ra as useAttachmentsContext,Kt as usePromptInputAttachments,Lp as usePromptInputController,zp as usePromptInputReferencedSources,Dp as useProviderAttachments,vs as useReasoning,Ge as useSidebar};//# sourceMappingURL=ui.js.map
5
+ `),Dl=({messages:e,filename:t="conversation.md",formatMessage:o=Bo,className:r,children:a$1,...i})=>{let s=useCallback(()=>{let l=Ba(e,o),p=new Blob([l],{type:"text/markdown"}),c=URL.createObjectURL(p),m=document.createElement("a");m.href=c,m.download=t,document.body.append(m),m.click(),m.remove(),URL.revokeObjectURL(c);},[e,t,o]);return jsx(b,{className:a("fk:absolute fk:top-4 fk:right-4 fk:rounded-full fk:dark:bg-background fk:dark:hover:bg-muted fk:corner-squircle",r),onClick:s,size:"icon",type:"button",variant:"outline",...i,children:a$1??jsx(DownloadIcon,{className:"fk:size-4"})})};var Kl=({className:e,from:t,...o})=>jsx("div",{className:a("fk:group fk:flex fk:w-full fk:max-w-[95%] fk:flex-col fk:gap-2",t==="user"?"fk:is-user fk:ml-auto fk:justify-end":"fk:is-assistant",e),...o}),Xl=({children:e,className:t,...o})=>jsx("div",{className:a("fk:is-user:dark fk:flex fk:w-fit fk:min-w-0 fk:max-w-full fk:flex-col fk:gap-2 fk:overflow-hidden fk:text-sm","fk:group-[.is-user]:ml-auto fk:group-[.is-user]:rounded-lg fk:group-[.is-user]:bg-secondary fk:group-[.is-user]:px-4 fk:group-[.is-user]:py-3 fk:group-[.is-user]:text-foreground","fk:group-[.is-assistant]:text-foreground",t),...o,children:e}),Jl=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-1",e),...o,children:t}),Yl=({tooltip:e$1,children:t,label:o,variant:r="ghost",size:a="icon-sm",...i})=>{let s=jsxs(b,{size:a,type:"button",variant:r,...i,children:[t,jsx("span",{className:"fk:sr-only",children:o||e$1})]});return e$1?jsx(a$1,{children:jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsx(e,{children:jsx("p",{children:e$1})})]})}):s},Eo=createContext(null),qe=()=>{let e=useContext(Eo);if(!e)throw new Error("MessageBranch components must be used within MessageBranch");return e},Zl=({defaultBranch:e=0,onBranchChange:t,className:o,...r})=>{let[a$1,i]=useState(e),[s,l]=useState([]),p=useCallback(g=>{i(g),t?.(g);},[t]),c=useCallback(()=>{let g=a$1>0?a$1-1:s.length-1;p(g);},[a$1,s.length,p]),m=useCallback(()=>{let g=a$1<s.length-1?a$1+1:0;p(g);},[a$1,s.length,p]),k=useMemo(()=>({branches:s,currentBranch:a$1,goToNext:m,goToPrevious:c,setBranches:l,totalBranches:s.length}),[s,a$1,m,c]);return jsx(Eo.Provider,{value:k,children:jsx("div",{className:a("fk:grid fk:w-full fk:gap-2 fk:[&>div]:pb-0",o),...r})})},Ql=({children:e,...t})=>{let{currentBranch:o,setBranches:r,branches:a$1}=qe(),i=useMemo(()=>Array.isArray(e)?e:[e],[e]);return useEffect(()=>{a$1.length!==i.length&&r(i);},[i,a$1,r]),i.map((s,l)=>jsx("div",{className:a("fk:grid fk:gap-2 fk:overflow-hidden fk:[&>div]:pb-0",l===o?"fk:block":"fk:hidden"),...t,children:s},s.key))},ep=({className:e,...t})=>{let{totalBranches:o}=qe();return o<=1?null:jsx(b$2,{className:a("fk:[&>*:not(:first-child)]:rounded-l-md fk:[&>*:not(:last-child)]:rounded-r-md",e),orientation:"horizontal",...t})},tp=({children:e,...t})=>{let{goToPrevious:o,totalBranches:r}=qe();return jsx(b,{"aria-label":"Previous branch",disabled:r<=1,onClick:o,size:"icon-sm",type:"button",variant:"ghost",...t,children:e??jsx(ChevronLeftIcon,{size:14})})},op=({children:e,...t})=>{let{goToNext:o,totalBranches:r}=qe();return jsx(b,{"aria-label":"Next branch",disabled:r<=1,onClick:o,size:"icon-sm",type:"button",variant:"ghost",...t,children:e??jsx(ChevronRightIcon,{size:14})})},rp=({className:e,...t})=>{let{currentBranch:o,totalBranches:r}=qe();return jsxs(c$2,{className:a("fk:border-none fk:bg-transparent fk:text-muted-foreground fk:shadow-none",e),...t,children:[o+1," of ",r]})},ja={cjk:cjk,code:code,math:math,mermaid:mermaid},Wa=memo(({className:e,...t})=>jsx(Streamdown,{className:a("fk:size-full fk:[&>*:first-child]:mt-0 fk:[&>*:last-child]:mb-0",e),plugins:ja,prefix:"fk",...t}),(e,t)=>e.children===t.children&&t.isAnimating===e.isAnimating);Wa.displayName="MessageResponse";var np=({className:e,children:t,...o})=>jsx("div",{className:a("fk:mt-4 fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-4",e),...o,children:t});var cp=e=>jsx(d$1,{...e}),fp=e=>jsx(e$2,{...e}),dp=({className:e,children:t,title:o="Model Selector",...r})=>jsxs(i,{"aria-describedby":void 0,className:a("fk:outline! fk:border-none! fk:p-0 fk:outline-border! fk:outline-solid!",e),...r,children:[jsx(l,{className:"fk:sr-only",children:o}),jsx(n,{className:"fk:**:data-[slot=command-input-wrapper]:h-auto",children:t})]}),up=e=>jsx(o$1,{...e}),mp=({className:e,...t})=>jsx(p$1,{className:a("fk:h-auto fk:py-3.5",e),...t}),kp=e=>jsx(q$1,{...e}),gp=e=>jsx(r,{...e}),bp=e=>jsx(s,{...e}),hp=e=>jsx(u,{...e}),xp=e=>jsx(v,{...e}),vp=e=>jsx(t,{...e}),Cp=({provider:e,className:t,...o})=>jsx("img",{...o,alt:`${e} logo`,className:a("fk:size-3 fk:dark:invert",t),height:12,src:`https://models.dev/logos/${e}.svg`,width:12}),Pp=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:shrink-0 fk:items-center fk:-space-x-1 fk:[&>img]:rounded-full fk:[&>img]:bg-background fk:[&>img]:p-px fk:[&>img]:ring-1 fk:dark:[&>img]:bg-foreground",e),...t}),yp=({className:e,...t})=>jsx("span",{className:a("fk:flex-1 fk:truncate fk:text-left",e),...t});var ts=async e=>{try{let o=await(await fetch(e)).blob();return new Promise(r=>{let a=new FileReader;a.onloadend=()=>r(a.result),a.onerror=()=>r(null),a.readAsDataURL(o);})}catch{return null}},os=async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getDisplayMedia)return null;let e=null,t=document.createElement("video");t.muted=true,t.playsInline=true;try{e=await navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}),t.srcObject=e,await new Promise((p,c)=>{t.onloadedmetadata=()=>p(),t.onerror=()=>c(new Error("Failed to load screen stream"));}),await t.play();let o=t.videoWidth,r=t.videoHeight;if(!o||!r)return null;let a=document.createElement("canvas");a.width=o,a.height=r;let i=a.getContext("2d");if(!i)return null;i.drawImage(t,0,0,o,r);let s=await new Promise(p=>{a.toBlob(p,"image/png");});if(!s)return null;let l=new Date().toISOString().replaceAll(/[:.]/g,"-").replace("T","_").replace("Z","");return new File([s],`screenshot-${l}.png`,{lastModified:Date.now(),type:"image/png"})}finally{if(e)for(let o of e.getTracks())o.stop();t.pause(),t.srcObject=null;}},Wt=createContext(null),$t=createContext(null),Hp=()=>{let e=useContext(Wt);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return e},zo=()=>useContext(Wt),Gp=()=>{let e=useContext($t);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return e},rs=()=>useContext($t),Op=({initialInput:e="",children:t})=>{let[o,r]=useState(e),a=useCallback(()=>r(""),[]),[i,s]=useState([]),l=useRef(null),p=useRef(()=>{}),c=useCallback(f=>{let x=Array.from(f);x.length!==0&&s(z=>[...z,...x.map(R=>({filename:R.name,id:nanoid(),mediaType:R.type,type:"file",url:URL.createObjectURL(R)}))]);},[]),m=useCallback(f=>{s(x=>{let z=x.find(R=>R.id===f);return z?.url&&URL.revokeObjectURL(z.url),x.filter(R=>R.id!==f)});},[]),k=useCallback(()=>{s(f=>{for(let x of f)x.url&&URL.revokeObjectURL(x.url);return []});},[]),g=useRef(i);useEffect(()=>{g.current=i;},[i]),useEffect(()=>()=>{for(let f of g.current)f.url&&URL.revokeObjectURL(f.url);},[]);let T=useCallback(()=>{p.current?.();},[]),b=useMemo(()=>({add:c,clear:k,fileInputRef:l,files:i,openFileDialog:T,remove:m}),[i,c,m,k,T]),C=useCallback((f,x)=>{l.current=f.current,p.current=x;},[]),N=useMemo(()=>({__registerFileInput:C,attachments:b,textInput:{clear:a,setInput:r,value:o}}),[o,a,b,C]);return jsx(Wt.Provider,{value:N,children:jsx($t.Provider,{value:b,children:t})})},Ho=createContext(null),Kt=()=>{let e=rs(),o=useContext(Ho)??e;if(!o)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return o},Go=createContext(null),Up=()=>{let e=useContext(Go);if(!e)throw new Error("usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider");return e},Fp=({label:e="Add photos or files",onSelect:t,...o})=>{let r=Kt(),a=useCallback(i=>{t?.(i),!i.defaultPrevented&&r.openFileDialog();},[r,t]);return jsxs(h,{...o,onSelect:a,children:[jsx(ImageIcon,{className:"fk:mr-2 fk:size-4"})," ",e]})},_p=({label:e="Take screenshot",onSelect:t,...o})=>{let r=Kt(),a=useCallback(async i=>{if(t?.(i),!i.defaultPrevented)try{let s=await os();s&&r.add([s]);}catch(s){if(s instanceof DOMException&&(s.name==="NotAllowedError"||s.name==="AbortError"))return;throw s}},[t,r]);return jsxs(h,{...o,onSelect:a,children:[jsx(Monitor,{className:"fk:mr-2 fk:size-4"}),e]})},Vp=({className:e,accept:t,multiple:o,globalDrop:r,syncHiddenInput:a$1,maxFiles:i,maxFileSize:s,onError:l,onSubmit:p,children:c,...m})=>{let k=zo(),g=!!k,T=useRef(null),b=useRef(null),[C,N]=useState([]),f=g?k.attachments.files:C,[x,z]=useState([]),R=useRef(f);useEffect(()=>{R.current=f;},[f]);let he=useCallback(()=>{T.current?.click();},[]),_=useCallback(u=>!t||t.trim()===""?true:t.split(",").map(h=>h.trim()).filter(Boolean).some(h=>{if(h.startsWith("."))return u.name.toLowerCase().endsWith(h.toLowerCase());if(h.endsWith("/*")){let y=h.slice(0,-1);return u.type.startsWith(y)}return u.type===h}),[t]),$e=useCallback(u=>{let v=Array.from(u),h=v.filter(X=>_(X));if(v.length&&h.length===0){l?.({code:"accept",message:"No files match the accepted types."});return}let y=X=>s?X.size<=s:true,O=h.filter(y);if(h.length>0&&O.length===0){l?.({code:"max_file_size",message:"All files exceed the maximum size."});return}N(X=>{let D=typeof i=="number"?Math.max(0,i-X.length):void 0,pe=typeof D=="number"?O.slice(0,D):O;typeof D=="number"&&O.length>D&&l?.({code:"max_files",message:"Too many files. Some were not added."});let ce=[];for(let ft of pe)ce.push({filename:ft.name,id:nanoid(),mediaType:ft.type,type:"file",url:URL.createObjectURL(ft)});return [...X,...ce]});},[_,i,s,l]),te=useCallback(u=>N(v=>{let h=v.find(y=>y.id===u);return h?.url&&URL.revokeObjectURL(h.url),v.filter(y=>y.id!==u)}),[]),j=useCallback(u=>{let v=Array.from(u),h=v.filter(ce=>_(ce));if(v.length&&h.length===0){l?.({code:"accept",message:"No files match the accepted types."});return}let y=ce=>s?ce.size<=s:true,O=h.filter(y);if(h.length>0&&O.length===0){l?.({code:"max_file_size",message:"All files exceed the maximum size."});return}let X=f.length,D=typeof i=="number"?Math.max(0,i-X):void 0,pe=typeof D=="number"?O.slice(0,D):O;typeof D=="number"&&O.length>D&&l?.({code:"max_files",message:"Too many files. Some were not added."}),pe.length>0&&k?.attachments.add(pe);},[_,s,i,l,f.length,k]),W=useCallback(()=>g?k?.attachments.clear():N(u=>{for(let v of u)v.url&&URL.revokeObjectURL(v.url);return []}),[g,k]),$=useCallback(()=>z([]),[]),G=g?j:$e,xe=g?k.attachments.remove:te,Ke=g?k.attachments.openFileDialog:he,ve=useCallback(()=>{W(),$();},[W,$]);useEffect(()=>{g&&k.__registerFileInput(T,()=>T.current?.click());},[g,k]),useEffect(()=>{a$1&&T.current&&f.length===0&&(T.current.value="");},[f,a$1]),useEffect(()=>{let u=b.current;if(!u||r)return;let v=y=>{y.dataTransfer?.types?.includes("Files")&&y.preventDefault();},h=y=>{y.dataTransfer?.types?.includes("Files")&&y.preventDefault(),y.dataTransfer?.files&&y.dataTransfer.files.length>0&&G(y.dataTransfer.files);};return u.addEventListener("dragover",v),u.addEventListener("drop",h),()=>{u.removeEventListener("dragover",v),u.removeEventListener("drop",h);}},[G,r]),useEffect(()=>{if(!r)return;let u=h=>{h.dataTransfer?.types?.includes("Files")&&h.preventDefault();},v=h=>{h.dataTransfer?.types?.includes("Files")&&h.preventDefault(),h.dataTransfer?.files&&h.dataTransfer.files.length>0&&G(h.dataTransfer.files);};return document.addEventListener("dragover",u),document.addEventListener("drop",v),()=>{document.removeEventListener("dragover",u),document.removeEventListener("drop",v);}},[G,r]),useEffect(()=>()=>{if(!g)for(let u of R.current)u.url&&URL.revokeObjectURL(u.url);},[g]);let Xe=useCallback(u=>{u.currentTarget.files&&G(u.currentTarget.files),u.currentTarget.value="";},[G]),L=useMemo(()=>({add:G,clear:W,fileInputRef:T,files:f.map(u=>({...u,id:u.id})),openFileDialog:Ke,remove:xe}),[f,G,xe,W,Ke]),Je=useMemo(()=>({add:u=>{let v=Array.isArray(u)?u:[u];z(h=>[...h,...v.map(y=>({...y,id:nanoid()}))]);},clear:$,remove:u=>{z(v=>v.filter(h=>h.id!==u));},sources:x}),[x,$]),oe=useCallback(async u=>{u.preventDefault();let v=u.currentTarget,h=g?k.textInput.value:new FormData(v).get("message")||"";g||v.reset();try{let y=await Promise.all(f.map(async({id:X,...D})=>{if(D.url?.startsWith("blob:")){let pe=await ts(D.url);return {...D,url:pe??D.url}}return D})),O=p({files:y,text:h},u);if(O instanceof Promise)try{await O,ve(),g&&k.textInput.clear();}catch{}else ve(),g&&k.textInput.clear();}catch{}},[g,k,f,p,ve]),K=jsxs(Fragment,{children:[jsx("input",{accept:t,"aria-label":"Upload files",className:"fk:hidden",multiple:o,onChange:Xe,ref:T,title:"Upload files",type:"file"}),jsx("form",{className:a("fk:w-full",e),onSubmit:oe,ref:b,...m,children:jsx(Ut,{className:"fk:overflow-hidden",children:c})})]}),Ce=jsx(Go.Provider,{value:Je,children:K});return jsx(Ho.Provider,{value:L,children:Ce})},qp=({className:e,...t})=>jsx("div",{className:a("fk:contents",e),...t}),jp=({onChange:e,onKeyDown:t,className:o,placeholder:r="What would you like to know?",...a$1})=>{let i=zo(),s=Kt(),[l,p]=useState(false),c=useCallback(b=>{if(t?.(b),!b.defaultPrevented){if(b.key==="Enter"){if(l||b.nativeEvent.isComposing||b.shiftKey)return;b.preventDefault();let{form:C}=b.currentTarget;if(C?.querySelector('button[type="submit"]')?.disabled)return;C?.requestSubmit();}if(b.key==="Backspace"&&b.currentTarget.value===""&&s.files.length>0){b.preventDefault();let C=s.files[s.files.length-1];C&&s.remove(C.id);}}},[t,l,s]),m=useCallback(b=>{let C=b.clipboardData?.items;if(!C)return;let N=[];for(let f of Array.from(C))if(f.kind==="file"){let x=f.getAsFile();x&&N.push(x);}N.length>0&&(b.preventDefault(),s.add(N));},[s]),k=useCallback(()=>p(false),[]),g=useCallback(()=>p(true),[]),T=i?{onChange:b=>{i.textInput.setInput(b.currentTarget.value),e?.(b);},value:i.textInput.value}:{onChange:e};return jsx(Ft,{className:a("fk:field-sizing-content fk:max-h-48 fk:min-h-16",o),name:"message",onCompositionEnd:k,onCompositionStart:g,onKeyDown:c,onPaste:m,placeholder:r,...a$1,...T})},Wp=({className:e,...t})=>jsx(st,{align:"block-end",className:a("fk:order-first fk:flex-wrap fk:gap-1",e),...t}),$p=({className:e,...t})=>jsx(st,{align:"block-end",className:a("fk:justify-between fk:gap-1",e),...t}),Kp=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:min-w-0 fk:items-center fk:gap-1",e),...t}),ns=({variant:e$1="ghost",className:t,size:o,tooltip:r,...a$1})=>{let i=o??(Children.count(a$1.children)>1?"sm":"icon-sm"),s=jsx(it,{className:a(t),size:i,type:"button",variant:e$1,...a$1});if(!r)return s;let l=typeof r=="string"?r:r.content,p=typeof r=="string"?void 0:r.shortcut,c$1=typeof r=="string"?"top":r.side??"top";return jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsxs(e,{side:c$1,children:[l,p&&jsx("span",{className:"fk:ml-2 fk:text-muted-foreground",children:p})]})]})},Xp=e=>jsx(c$3,{...e}),Jp=({className:e,children:t,...o})=>jsx(e$3,{asChild:true,children:jsx(ns,{className:e,...o,children:t??jsx(PlusIcon,{className:"fk:size-4"})})}),Yp=({className:e,onCloseAutoFocus:t,...o})=>jsx(f,{align:"start",className:a(e),onCloseAutoFocus:r=>{t?.(r),!r.defaultPrevented&&r.preventDefault();},...o}),Zp=({className:e,...t})=>jsx(h,{className:a(e),...t}),Qp=({className:e,variant:t="default",size:o="icon-sm",status:r,onStop:a$1,onClick:i,children:s,...l})=>{let p=r==="submitted"||r==="streaming",c=jsx(CornerDownLeftIcon,{className:"fk:size-4"});r==="submitted"?c=jsx(Ot,{}):r==="streaming"?c=jsx(SquareIcon,{className:"fk:size-4"}):r==="error"&&(c=jsx(XIcon,{className:"fk:size-4"}));let m=useCallback(k=>{if(p&&a$1){k.preventDefault(),a$1();return}i?.(k);},[p,a$1,i]);return jsx(it,{"aria-label":p?"Stop":"Submit",className:a(e),onClick:m,size:o,type:p&&a$1?"button":"submit",variant:t,...l,children:s??c})},ec=e=>jsx(a$4,{...e}),tc=({className:e,...t})=>jsx(d,{className:a("fk:border-none fk:bg-transparent fk:font-medium fk:text-muted-foreground fk:shadow-none fk:transition-colors","fk:hover:bg-accent fk:hover:text-foreground fk:aria-expanded:bg-accent fk:aria-expanded:text-foreground",e),...t}),oc=({className:e,...t})=>jsx(e$1,{className:a(e),...t}),rc=({className:e,...t})=>jsx(g,{className:a(e),...t}),nc=({className:e,...t})=>jsx(c$1,{className:a(e),...t}),ac=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Ue,{closeDelay:t,openDelay:e,...o}),sc=e=>jsx(Fe,{...e}),ic=({align:e="start",...t})=>jsx(_e,{align:e,...t}),lc=({className:e,...t})=>jsx("div",{className:a(e),...t}),pc=({className:e,...t})=>jsx("div",{className:a(e),...t}),cc=({className:e,...t})=>jsx("h3",{className:a("fk:mb-2 fk:px-3 fk:font-medium fk:text-muted-foreground fk:text-xs",e),...t}),fc=({className:e,...t})=>jsx("div",{className:a("fk:space-y-1",e),...t}),dc=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-2 fk:px-3 fk:py-2 fk:text-xs fk:hover:bg-accent",e),...t}),uc=({className:e,...t})=>jsx(n,{className:a(e),...t}),mc=({className:e,...t})=>jsx(p$1,{className:a(e),...t}),kc=({className:e,...t})=>jsx(q$1,{className:a(e),...t}),gc=({className:e,...t})=>jsx(r,{className:a(e),...t}),bc=({className:e,...t})=>jsx(s,{className:a(e),...t}),hc=({className:e,...t})=>jsx(u,{className:a(e),...t}),xc=({className:e,...t$1})=>jsx(t,{className:a(e),...t$1});var Oo=new Map,ps=e=>{let t=Oo.get(e);return t||(t=motion.create(e),Oo.set(e,t)),t},cs=({children:e,as:t="p",className:o,duration:r=2,spread:a$1=2})=>{let i=ps(t),s=useMemo(()=>(e?.length??0)*a$1,[e,a$1]);return jsx(i,{animate:{backgroundPosition:"0% center"},className:a("fk:relative fk:inline-block fk:bg-[length:250%_100%,auto] fk:bg-clip-text fk:text-transparent","fk:[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] fk:[background-repeat:no-repeat,padding-box]",o),initial:{backgroundPosition:"100% center"},style:{"--spread":`${s}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{duration:r,ease:"linear",repeat:Number.POSITIVE_INFINITY},children:e})},Xt=memo(cs);var _o=createContext(null),Ss=()=>{let e=useContext(_o);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Ts=1e3,Is=1e3,ws=memo(({className:e,isStreaming:t=false,open:o$1,defaultOpen:r,onOpenChange:a$1,duration:i,children:s,...l})=>{let p=r??t,c=r===false,[m,k]=useControllableState({defaultProp:p,onChange:a$1,prop:o$1}),[g,T]=useControllableState({defaultProp:void 0,prop:i}),b=useRef(t),[C,N]=useState(false),f=useRef(null);useEffect(()=>{t?(b.current=true,f.current===null&&(f.current=Date.now())):f.current!==null&&(T(Math.ceil((Date.now()-f.current)/Is)),f.current=null);},[t,T]),useEffect(()=>{t&&!m&&!c&&k(true);},[t,m,k,c]),useEffect(()=>{if(b.current&&!t&&m&&!C){let R=setTimeout(()=>{k(false),N(true);},Ts);return ()=>clearTimeout(R)}},[t,m,k,C]);let x=useCallback(R=>{k(R);},[k]),z=useMemo(()=>({duration:g,isOpen:m,isStreaming:t,setIsOpen:k}),[g,m,t,k]);return jsx(_o.Provider,{value:z,children:jsx(o,{className:a("fk:not-prose fk:mb-4",e),onOpenChange:x,open:m,...l,children:s})})}),Ms=(e,t)=>e||t===0?jsx(Xt,{duration:1,children:"Thinking..."}):t===void 0?jsx("p",{children:"Thought for a few seconds"}):jsxs("p",{children:["Thought for ",t," seconds"]}),Ns=memo(({className:e,children:t,getThinkingMessage:o=Ms,...r})=>{let{isStreaming:a$1,isOpen:i,duration:s}=Ss();return jsx(p,{className:a("fk:flex fk:w-full fk:items-center fk:gap-2 fk:text-muted-foreground fk:text-sm fk:transition-colors fk:hover:text-foreground",e),...r,children:t??jsxs(Fragment,{children:[jsx(BrainIcon,{className:"fk:size-4"}),o(a$1,s),jsx(ChevronDownIcon,{className:a("fk:size-4 fk:transition-transform",i?"fk:rotate-180":"fk:rotate-0")})]})})}),Rs={cjk:cjk,code:code,math:math,mermaid:mermaid},As=memo(({className:e,children:t,...o})=>jsx(q,{className:a("fk:mt-4 fk:text-sm","fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:text-muted-foreground fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...o,children:jsx(Streamdown,{plugins:Rs,children:t})}));ws.displayName="Reasoning";Ns.displayName="ReasoningTrigger";As.displayName="ReasoningContent";var Vc=({className:e,...t})=>jsx(o,{className:a("fk:not-prose fk:mb-4 fk:text-primary fk:text-xs",e),...t}),qc=({className:e,count:t,children:o,...r})=>jsx(p,{className:a("fk:flex fk:items-center fk:gap-2",e),...r,children:o??jsxs(Fragment,{children:[jsxs("p",{className:"fk:font-medium",children:["Used ",t," sources"]}),jsx(ChevronDownIcon,{className:"fk:h-4 fk:w-4"})]})}),jc=({className:e,...t})=>jsx(q,{className:a("fk:mt-3 fk:flex fk:w-fit fk:flex-col fk:gap-2","fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...t}),Wc=({href:e,title:t,children:o,...r})=>jsx("a",{className:"fk:flex fk:items-center fk:gap-2",href:e,rel:"noreferrer",target:"_blank",...r,children:o??jsxs(Fragment,{children:[jsx(BookIcon,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:block fk:font-medium",children:t})]})});var Gs=6e4;function Os(){return typeof window<"u"&&"MediaRecorder"in window&&typeof navigator<"u"&&"mediaDevices"in navigator&&typeof navigator.mediaDevices.getUserMedia=="function"}function Us(){return ["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"].find(t=>MediaRecorder.isTypeSupported(t))}function jo(e,t){return e instanceof DOMException&&(e.name==="NotAllowedError"||e.name==="PermissionDeniedError")?new Error("Microphone permission was denied. Enable the microphone to dictate."):e instanceof DOMException&&e.name==="NotFoundError"?new Error("No microphone was found."):e instanceof Error?e:new Error(t)}function Fs(e){return e instanceof Error&&e.name==="AbortError"}function _s(e,t,o){return e?o?"Cancel transcription":t?"Stop recording":"Dictate":"Dictation is not available in this browser."}var ef=({className:e$1,disabled:t,onAudioRecorded:o,onError:r,onTranscriptionChange:a$1,size:i="icon-sm",variant:s="ghost",...l})=>{let[p,c$1]=useState(false),[m,k]=useState(false),[g,T]=useState(false),b$2=useRef(null),C=useRef(null),N=useRef([]),f=useRef(null),x=useRef(null),z=useRef(false),R=useRef(!!t),he=useRef(o),_=useRef(r),$e=useRef(a$1);R.current=!!t,he.current=o,_.current=r,$e.current=a$1,useEffect(()=>{T(Os());},[]);let te=useCallback(()=>{if(C.current){for(let L of C.current.getTracks())L.stop();C.current=null;}},[]),j=useCallback(()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null);},[]),W=useCallback(()=>{j(),b$2.current?.state==="recording"&&b$2.current.stop(),c$1(false);},[j]),$=useCallback(()=>{x.current?.abort(),x.current=null,k(false);},[]),G=useCallback(()=>{$(),j();let L=b$2.current;L?.state==="recording"&&(z.current=true,L.stop()),c$1(false),te();},[$,j,te]),xe=useCallback(async()=>{if(!R.current){if(!he.current){_.current?.(new Error("Dictation is not configured."));return}try{let L=await navigator.mediaDevices.getUserMedia({audio:!0});if(R.current){for(let K of L.getTracks())K.stop();return}C.current=L;let Je=Us(),oe=Je?new MediaRecorder(L,{mimeType:Je}):new MediaRecorder(L);N.current=[],oe.ondataavailable=K=>{K.data.size>0&&N.current.push(K.data);},oe.onstop=async()=>{if(te(),j(),c$1(!1),z.current){z.current=!1,N.current=[];return}let K=new Blob(N.current,{type:oe.mimeType||"audio/webm"});if(K.size===0)return;let Ce=new AbortController;x.current=Ce,k(!0);try{let u=he.current;if(!u)return;let v=await u(K,Ce.signal);v&&$e.current?.(v);}catch(u){if(Fs(u))return;_.current?.(jo(u,"Transcription failed."));}finally{x.current===Ce&&(x.current=null,k(!1));}},oe.onerror=()=>{c$1(!1),te(),j(),_.current?.(new Error("Recording failed. Try again."));},b$2.current=oe,oe.start(250),c$1(!0),f.current=window.setTimeout(()=>{W();},Gs);}catch(L){c$1(false),te(),_.current?.(jo(L,"Could not start the microphone."));}}},[j,te,W]);useEffect(()=>{t&&G();},[G,t]),useEffect(()=>()=>{G();},[G]);let Ke=useCallback(()=>{if(m){$();return}if(p){W();return}xe();},[$,p,m,xe,W]),ve=t||!g||!o,Xe=_s(g&&!!o,p,m);return jsxs(b$1,{children:[jsx(c,{asChild:true,children:jsxs("span",{className:"fk:relative fk:inline-flex fk:items-center fk:justify-center",children:[p?[0,1,2].map(L=>jsx("span",{className:"fk:absolute fk:inset-0 fk:animate-ping fk:rounded-full fk:border-2 fk:border-red-400/30 fk:corner-squircle",style:{animationDelay:`${String(L*.3)}s`,animationDuration:"2s"}},L)):null,jsxs(b,{"aria-label":Xe,"aria-pressed":p,size:i,variant:p?"destructive":s,...l,className:a("fk:relative fk:z-10 fk:rounded-full fk:dark:hover:bg-accent fk:corner-squircle",e$1),disabled:ve,onClick:Ke,type:"button",children:[m?jsx(LoaderIcon,{className:"fk:size-4 fk:animate-spin"}):null,!m&&p?jsx(SquareIcon,{className:"fk:size-4"}):null,m||p?null:jsx(MicIcon,{className:"fk:size-5"})]})]})}),jsx(e,{children:Xe})]})};var lf=({className:e,children:t,...o})=>jsxs(w,{className:"fk:w-full fk:overflow-x-auto fk:whitespace-nowrap",...o,children:[jsx("div",{className:a("fk:flex fk:w-max fk:flex-nowrap fk:items-center fk:gap-2",e),children:t}),jsx(x,{className:"fk:hidden",orientation:"horizontal"})]}),pf=({suggestion:e,onClick:t,className:o,variant:r="outline",size:a$1="sm",children:i,...s})=>{let l=useCallback(()=>{t?.(e);},[t,e]);return jsx(b,{className:a("fk:cursor-pointer fk:rounded-full fk:px-4 fk:corner-squircle",o),onClick:l,size:a$1,type:"button",variant:r,...s,children:i||e})};var hf=({className:e,...t})=>jsx(o,{className:a("fk:group fk:not-prose fk:mb-4 fk:w-full fk:rounded-md fk:border fk:corner-squircle",e),...t}),Xs={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},Js={"approval-requested":jsx(ClockIcon,{className:"fk:size-4 fk:text-yellow-600"}),"approval-responded":jsx(CheckCircleIcon,{className:"fk:size-4 fk:text-blue-600"}),"input-available":jsx(ClockIcon,{className:"fk:size-4 fk:animate-pulse"}),"input-streaming":jsx(CircleIcon,{className:"fk:size-4"}),"output-available":jsx(CheckCircleIcon,{className:"fk:size-4 fk:text-green-600"}),"output-denied":jsx(XCircleIcon,{className:"fk:size-4 fk:text-orange-600"}),"output-error":jsx(XCircleIcon,{className:"fk:size-4 fk:text-red-600"})},Ys=e=>jsxs(b$3,{className:"fk:gap-1.5 fk:py-px fk:rounded-full fk:text-xs fk:corner-squircle",variant:"secondary",children:[Js[e],Xs[e]]}),xf=({className:e,title:t,type:o,state:r,toolName:a$1,...i})=>{let s=o==="dynamic-tool"?a$1:o.split("-").slice(1).join("-");return jsxs(p,{className:a("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-4 fk:px-3 fk:py-2",e),...i,children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(WrenchIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("span",{className:"fk:font-medium fk:text-sm",children:t??s}),Ys(r)]}),jsx(ChevronDownIcon,{className:"fk:size-4 fk:text-muted-foreground fk:transition-transform fk:group-data-[state=open]:rotate-180"})]})},vf=({className:e,...t})=>jsx(q,{className:a("fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:space-y-4 fk:p-4 fk:text-popover-foreground fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...t}),Cf=({className:e,input:t,...o})=>jsxs("div",{className:a("fk:space-y-2 fk:overflow-hidden",e),...o,children:[jsx("h4",{className:"fk:font-medium fk:text-muted-foreground fk:text-xs fk:uppercase fk:tracking-wide",children:"Parameters"}),jsx("div",{className:"fk:rounded-md fk:bg-muted/50 fk:corner-squircle",children:jsx(lt,{code:JSON.stringify(t,null,2),language:"json"})})]}),Pf=({className:e,output:t,errorText:o,...r})=>{if(!(t||o))return null;let a$1=jsx("div",{children:t});return typeof t=="object"&&!isValidElement(t)?a$1=jsx(lt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(a$1=jsx(lt,{code:t,language:"json"})),jsxs("div",{className:a("fk:space-y-2",e),...r,children:[jsx("h4",{className:"fk:font-medium fk:text-muted-foreground fk:text-xs fk:uppercase fk:tracking-wide",children:o?"Error":"Result"}),jsxs("div",{className:a("fk:overflow-x-auto fk:rounded-md fk:text-xs fk:[&_table]:w-full fk:corner-squircle",o?"fk:bg-destructive/10 fk:text-destructive":"fk:bg-muted/50 fk:text-foreground"),children:[o&&jsx("div",{children:o}),a$1]})]})};
6
+ export{Yi as Attachment,nl as AttachmentEmpty,tl as AttachmentHoverCard,rl as AttachmentHoverCardContent,ol as AttachmentHoverCardTrigger,Qi as AttachmentInfo,Zi as AttachmentPreview,el as AttachmentRemove,Ji as Attachments,lt as CodeBlock,gl as CodeBlockActions,Ta as CodeBlockContainer,Ia as CodeBlockContent,bl as CodeBlockCopyButton,kl as CodeBlockFilename,ul as CodeBlockHeader,hl as CodeBlockLanguageSelector,Cl as CodeBlockLanguageSelectorContent,Pl as CodeBlockLanguageSelectorItem,xl as CodeBlockLanguageSelectorTrigger,vl as CodeBlockLanguageSelectorValue,ml as CodeBlockTitle,Rl as Conversation,Al as ConversationContent,Dl as ConversationDownload,Bl as ConversationEmptyState,Ll as ConversationScrollButton,kn as ExternalLink,Ue as HoverCard,_e as HoverCardContent,Fe as HoverCardTrigger,Ut as InputGroup,st as InputGroupAddon,it as InputGroupButton,Xn as InputGroupInput,Kn as InputGroupText,Ft as InputGroupTextarea,Go as LocalReferencedSourcesContext,Kl as Message,Yl as MessageAction,Jl as MessageActions,Zl as MessageBranch,Ql as MessageBranchContent,op as MessageBranchNext,rp as MessageBranchPage,tp as MessageBranchPrevious,ep as MessageBranchSelector,Xl as MessageContent,Wa as MessageResponse,np as MessageToolbar,cp as ModelSelector,dp as ModelSelectorContent,up as ModelSelectorDialog,gp as ModelSelectorEmpty,bp as ModelSelectorGroup,mp as ModelSelectorInput,hp as ModelSelectorItem,kp as ModelSelectorList,Cp as ModelSelectorLogo,Pp as ModelSelectorLogoGroup,yp as ModelSelectorName,vp as ModelSelectorSeparator,xp as ModelSelectorShortcut,fp as ModelSelectorTrigger,Vp as PromptInput,Fp as PromptInputActionAddAttachments,_p as PromptInputActionAddScreenshot,Xp as PromptInputActionMenu,Yp as PromptInputActionMenuContent,Zp as PromptInputActionMenuItem,Jp as PromptInputActionMenuTrigger,qp as PromptInputBody,ns as PromptInputButton,uc as PromptInputCommand,gc as PromptInputCommandEmpty,bc as PromptInputCommandGroup,mc as PromptInputCommandInput,hc as PromptInputCommandItem,kc as PromptInputCommandList,xc as PromptInputCommandSeparator,$p as PromptInputFooter,Wp as PromptInputHeader,ac as PromptInputHoverCard,ic as PromptInputHoverCardContent,sc as PromptInputHoverCardTrigger,Op as PromptInputProvider,ec as PromptInputSelect,oc as PromptInputSelectContent,rc as PromptInputSelectItem,tc as PromptInputSelectTrigger,nc as PromptInputSelectValue,Qp as PromptInputSubmit,pc as PromptInputTab,fc as PromptInputTabBody,dc as PromptInputTabItem,cc as PromptInputTabLabel,lc as PromptInputTabsList,jp as PromptInputTextarea,Kp as PromptInputTools,ws as Reasoning,As as ReasoningContent,Ns as ReasoningTrigger,vn as ResizableHandle,xn as ResizablePanel,hn as ResizablePanelGroup,Nt as Sheet,yn as SheetClose,Rt as SheetContent,Lt as SheetDescription,Sn as SheetFooter,At as SheetHeader,ao as SheetOverlay,no as SheetPortal,Bt as SheetTitle,Pn as SheetTrigger,Xt as Shimmer,Vn as Sidebar,Ht as SidebarContent,Ze as SidebarGroup,zn as SidebarGroupContent,Gt as SidebarGroupLabel,En as SidebarInset,Qe as SidebarMenu,tt as SidebarMenuButton,et as SidebarMenuItem,Et as SidebarPanel,Ln as SidebarProvider,zt as SidebarRail,Dn as SidebarTrigger,Wc as Source,Vc as Sources,jc as SourcesContent,qc as SourcesTrigger,ef as SpeechInput,Ot as Spinner,pf as Suggestion,lf as Suggestions,hf as Tool,vf as ToolContent,xf as ToolHeader,Cf as ToolInput,Pf as ToolOutput,aa as getAttachmentLabel,bo as getMediaCategory,Ys as getStatusBadge,yo as highlightCode,Ba as messagesToMarkdown,_t as useAttachmentContext,ia as useAttachmentsContext,Kt as usePromptInputAttachments,Hp as usePromptInputController,Up as usePromptInputReferencedSources,Gp as useProviderAttachments,Ss as useReasoning,Ge as useSidebar};//# sourceMappingURL=ui.js.map
7
7
  //# sourceMappingURL=ui.js.map