@flexkit/studio 0.0.34 → 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.
Files changed (111) hide show
  1. package/dist/asset-3XMRPTA5.js +2 -0
  2. package/dist/{asset-ZVPFS73O.js.map → asset-3XMRPTA5.js.map} +1 -1
  3. package/dist/astro.js +2 -2
  4. package/dist/{chunk-JAARDXQZ.js → chunk-3VOTTOJT.js} +2 -2
  5. package/dist/{chunk-JAARDXQZ.js.map → chunk-3VOTTOJT.js.map} +1 -1
  6. package/dist/chunk-5I7Q5ODB.js +2 -0
  7. package/dist/chunk-5I7Q5ODB.js.map +1 -0
  8. package/dist/chunk-6NRQMG26.js +2 -0
  9. package/dist/chunk-6NRQMG26.js.map +1 -0
  10. package/dist/{chunk-VHNQDP7Q.js → chunk-6V73336R.js} +10 -3
  11. package/dist/{chunk-OEWYLKO7.js → chunk-7BOX7HHO.js} +2 -2
  12. package/dist/{chunk-OEWYLKO7.js.map → chunk-7BOX7HHO.js.map} +1 -1
  13. package/dist/chunk-7JFLGBWE.js +2 -0
  14. package/dist/{chunk-F2ILIHAU.js.map → chunk-7JFLGBWE.js.map} +1 -1
  15. package/dist/chunk-7ZJN4MWQ.js +2 -0
  16. package/dist/chunk-7ZJN4MWQ.js.map +1 -0
  17. package/dist/{chunk-XFY7MZJN.js → chunk-AICNS7KW.js} +2 -2
  18. package/dist/{chunk-XFY7MZJN.js.map → chunk-AICNS7KW.js.map} +1 -1
  19. package/dist/chunk-FLT6RWXH.js +2 -0
  20. package/dist/{chunk-GFDWGYUR.js.map → chunk-FLT6RWXH.js.map} +1 -1
  21. package/dist/{chunk-FVFRTCEB.js → chunk-GBM7VKFS.js} +2 -2
  22. package/dist/{chunk-FVFRTCEB.js.map → chunk-GBM7VKFS.js.map} +1 -1
  23. package/dist/chunk-HDOIOXMP.js +2 -0
  24. package/dist/chunk-HDOIOXMP.js.map +1 -0
  25. package/dist/chunk-HMMBYXYA.js +2 -0
  26. package/dist/{chunk-JCHD4EGB.js.map → chunk-HMMBYXYA.js.map} +1 -1
  27. package/dist/chunk-IRY4KWB5.js +2 -0
  28. package/dist/chunk-IRY4KWB5.js.map +1 -0
  29. package/dist/{chunk-AEBTHXEP.js → chunk-JKHUO27E.js} +2 -2
  30. package/dist/{chunk-AEBTHXEP.js.map → chunk-JKHUO27E.js.map} +1 -1
  31. package/dist/{chunk-CCI3FGPF.js → chunk-PENRGDNC.js} +2 -2
  32. package/dist/{chunk-CCI3FGPF.js.map → chunk-PENRGDNC.js.map} +1 -1
  33. package/dist/{chunk-E7G46743.js → chunk-POQX5GIA.js} +2 -2
  34. package/dist/{chunk-VUAFNQK7.js → chunk-QOX3QNMM.js} +2 -2
  35. package/dist/{chunk-VUAFNQK7.js.map → chunk-QOX3QNMM.js.map} +1 -1
  36. package/dist/{chunk-KGYH74NA.js → chunk-QVBNGGOE.js} +2 -2
  37. package/dist/{chunk-KGYH74NA.js.map → chunk-QVBNGGOE.js.map} +1 -1
  38. package/dist/{chunk-D62TAYLI.js → chunk-S6MOM5G3.js} +2 -2
  39. package/dist/chunk-S6MOM5G3.js.map +1 -0
  40. package/dist/{chunk-MGXHZDFZ.js → chunk-UGRS4FEI.js} +2 -2
  41. package/dist/{chunk-MGXHZDFZ.js.map → chunk-UGRS4FEI.js.map} +1 -1
  42. package/dist/{chunk-YW2EEXMV.js → chunk-USNXQOMJ.js} +2 -2
  43. package/dist/{chunk-YW2EEXMV.js.map → chunk-USNXQOMJ.js.map} +1 -1
  44. package/dist/{chunk-N2T6MKPV.js → chunk-UWMJBBTY.js} +2 -2
  45. package/dist/{chunk-N2T6MKPV.js.map → chunk-UWMJBBTY.js.map} +1 -1
  46. package/dist/chunk-W3Z33ETA.js +2 -0
  47. package/dist/chunk-W3Z33ETA.js.map +1 -0
  48. package/dist/{chunk-7GBAYC7G.js → chunk-YSLN4XT6.js} +2 -2
  49. package/dist/{chunk-7GBAYC7G.js.map → chunk-YSLN4XT6.js.map} +1 -1
  50. package/dist/datetime-C55QQQJK.js +2 -0
  51. package/dist/{datetime-DDEWTNLB.js.map → datetime-C55QQQJK.js.map} +1 -1
  52. package/dist/editor-NZLXIOE7.js +2 -0
  53. package/dist/{editor-HAYTKNMY.js.map → editor-NZLXIOE7.js.map} +1 -1
  54. package/dist/index.css +36 -33
  55. package/dist/index.d.ts +4 -4
  56. package/dist/index.js +126 -130
  57. package/dist/index.js.map +1 -1
  58. package/dist/logo-MU7MGYDH.js +3 -0
  59. package/dist/logo-MU7MGYDH.js.map +1 -0
  60. package/dist/nextjs.js +2 -2
  61. package/dist/{project-selector-X6YVZYKL.js → project-selector-GQ24PVO6.js} +2 -2
  62. package/dist/{project-selector-X6YVZYKL.js.map → project-selector-GQ24PVO6.js.map} +1 -1
  63. package/dist/search-XKG5A7XM.js +2 -0
  64. package/dist/{search-KIII5N7I.js.map → search-XKG5A7XM.js.map} +1 -1
  65. package/dist/select-SO3DICYX.js +2 -0
  66. package/dist/{select-H3JHOCWR.js.map → select-SO3DICYX.js.map} +1 -1
  67. package/dist/switch-SU3OIXL6.js +2 -0
  68. package/dist/{switch-TACKLQJH.js.map → switch-SU3OIXL6.js.map} +1 -1
  69. package/dist/tanstack-start.js +2 -2
  70. package/dist/text-FZSI6W5I.js +2 -0
  71. package/dist/{text-M3DRK7LU.js.map → text-FZSI6W5I.js.map} +1 -1
  72. package/dist/text-QXGOD2KW.js +2 -0
  73. package/dist/{text-SQXG7XJT.js.map → text-QXGOD2KW.js.map} +1 -1
  74. package/dist/textarea-INLURFNU.js +2 -0
  75. package/dist/{textarea-YF4K2VBM.js.map → textarea-INLURFNU.js.map} +1 -1
  76. package/dist/tools.js +1 -1
  77. package/dist/{types.d-9Gbw_A9L.d.ts → types.d-CPIuPrvL.d.ts} +5 -2
  78. package/dist/ui.d.ts +20 -7
  79. package/dist/ui.js +5 -5
  80. package/dist/ui.js.map +1 -1
  81. package/dist/user-nav-LSEOOH4E.js +2 -0
  82. package/dist/{user-nav-6UKDSUF3.js.map → user-nav-LSEOOH4E.js.map} +1 -1
  83. package/package.json +2 -1
  84. package/dist/asset-ZVPFS73O.js +0 -2
  85. package/dist/chunk-2FFSI7IK.js +0 -2
  86. package/dist/chunk-2FFSI7IK.js.map +0 -1
  87. package/dist/chunk-D62TAYLI.js.map +0 -1
  88. package/dist/chunk-EYGOJ2ZN.js +0 -2
  89. package/dist/chunk-EYGOJ2ZN.js.map +0 -1
  90. package/dist/chunk-F2ILIHAU.js +0 -2
  91. package/dist/chunk-FPH4YETF.js +0 -2
  92. package/dist/chunk-FPH4YETF.js.map +0 -1
  93. package/dist/chunk-GFDWGYUR.js +0 -2
  94. package/dist/chunk-JCHD4EGB.js +0 -2
  95. package/dist/chunk-KHPTVIYT.js +0 -2
  96. package/dist/chunk-KHPTVIYT.js.map +0 -1
  97. package/dist/chunk-PXB5QSHN.js +0 -2
  98. package/dist/chunk-PXB5QSHN.js.map +0 -1
  99. package/dist/chunk-XU2JGXYC.js +0 -2
  100. package/dist/chunk-XU2JGXYC.js.map +0 -1
  101. package/dist/datetime-DDEWTNLB.js +0 -2
  102. package/dist/editor-HAYTKNMY.js +0 -2
  103. package/dist/logo-B6ZKLGM7.js +0 -3
  104. package/dist/logo-B6ZKLGM7.js.map +0 -1
  105. package/dist/search-KIII5N7I.js +0 -2
  106. package/dist/select-H3JHOCWR.js +0 -2
  107. package/dist/switch-TACKLQJH.js +0 -2
  108. package/dist/text-M3DRK7LU.js +0 -2
  109. package/dist/text-SQXG7XJT.js +0 -2
  110. package/dist/textarea-YF4K2VBM.js +0 -2
  111. package/dist/user-nav-6UKDSUF3.js +0 -2
package/dist/ui.js CHANGED
@@ -1,7 +1,7 @@
1
- import'./index.css';import {l,m,n}from'./chunk-PXB5QSHN.js';export{g as DrawerModal,w as InsufficientPermissionsTooltipContent,x as PermissionTooltip,o as Table,q as TableBody,v as TableCaption,u as TableCell,r as TableFooter,t as TableHead,p as TableHeader,s as TableRow,h as Tabs,k as TabsContent,i as TabsList,j as TabsTrigger,f as Toaster,b as Toggle,c as ToggleGroup,d as ToggleGroupItem,e as toast,a as toggleVariants}from'./chunk-PXB5QSHN.js';import {a as a$2}from'./chunk-7GBAYC7G.js';export{a as Input}from'./chunk-7GBAYC7G.js';import {a as a$3}from'./chunk-OEWYLKO7.js';export{a as Textarea}from'./chunk-OEWYLKO7.js';import {a as a$1,b as b$1,c,e}from'./chunk-YW2EEXMV.js';export{b as Tooltip,e as TooltipContent,d as TooltipPortal,a as TooltipProvider,c as TooltipTrigger}from'./chunk-YW2EEXMV.js';import {b as b$2,c as c$2}from'./chunk-XFY7MZJN.js';export{b as ButtonGroup,d as ButtonGroupSeparator,c as ButtonGroupText,a as buttonGroupVariants}from'./chunk-XFY7MZJN.js';import {d as d$1,e as e$2,i,l as l$1,n as n$1,o,p,q,r,s,u,v,t,w,x,b as b$3}from'./chunk-KHPTVIYT.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-KHPTVIYT.js';import {a as a$4,d,c as c$1,e as e$1,g}from'./chunk-XU2JGXYC.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-XU2JGXYC.js';export{a as Avatar,c as AvatarFallback,b as AvatarImage}from'./chunk-2FFSI7IK.js';import {h,c as c$3,e as e$3,f}from'./chunk-JCHD4EGB.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-JCHD4EGB.js';import {b}from'./chunk-EYGOJ2ZN.js';export{b as Button,a as buttonVariants}from'./chunk-EYGOJ2ZN.js';export{a as Switch}from'./chunk-KGYH74NA.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-FVFRTCEB.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 ce 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 Rn 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 sn({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 fn({className:e,...t}){return jsx(ce.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 cn({...e}){return jsx(ce.Panel,{"data-slot":"resizable-panel",...e})}function dn({withHandle:e,className:t,...o}){return jsx(ce.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",children:jsx(GripVerticalIcon,{className:"fk:size-2.5"})})})}function Nt({...e}){return jsx(Dialog.Root,{"data-slot":"sheet",...e})}function mn({...e}){return jsx(Dialog.Trigger,{"data-slot":"sheet-trigger",...e})}function kn({...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",children:[jsx(XIcon,{className:"fk:size-4"}),jsx("span",{className:"fk:sr-only",children:"Close"})]})]})]})}function Bt({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 gn({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 Lt({className:e,...t}){return jsx(Dialog.Title,{"data-slot":"sheet-title",className:a("fk:font-semibold fk:text-foreground",e),...t})}function At({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 xn="flexkit:sidebar:state",vn=3600*24*7,Cn="16rem",Pn="18rem",yn="2rem",Sn="b",po=H.createContext(null);function Ge(){let e=H.useContext(po);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Tn({defaultOpen:e=true,open:t,onOpenChange:o,className:r,style:a$2,children:i,...s}){let p=so(),[l,f]=H.useState(false),[m,k]=H.useState(e),g=t??m,T=H.useCallback(c=>{let x=typeof c=="function"?c(g):c;o?o(x):k(x),document.cookie=`${xn}=${x}; path=/; max-age=${vn}`;},[o,g]),b=H.useCallback(()=>p?f(c=>!c):T(c=>!c),[p,T,f]);H.useEffect(()=>{let c=x=>{x.key===Sn&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),b());};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[b]);let C=g?"expanded":"collapsed",N=H.useMemo(()=>({state:C,open:g,setOpen:T,isMobile:p,openMobile:l,setOpenMobile:f,toggleSidebar:b}),[C,g,T,p,l,f,b]);return jsx(po.Provider,{value:N,children:jsx(a$1,{delayDuration:0,children:jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Cn,"--sidebar-width-icon":yn,...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:p,openMobile:l,setOpenMobile:f}=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:l,onOpenChange:f,...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":Pn},side:e,children:[jsxs(Bt,{className:"fk:sr-only",children:[jsx(Lt,{children:"Sidebar"}),jsx(At,{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":p,"data-collapsible":p==="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 In({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 wn({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:group-data-[collapsible=icon]:-mt-8 fk:group-data-[collapsible=icon]:opacity-0",e),...o})}function Mn({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 Nn=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",{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 p=e$1?Slot.Root:"button",{isMobile:l,state:f}=Ge(),m=jsx(p,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":t,className:a(Nn({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:f!=="collapsed"||l,...a$1})]})):m}var fo=NavLink,An=Object.keys(rt).map(e=>({name:e,icon:rt[e]})),Dn=new Rn(An,{keys:["name"],threshold:.5});function En({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(p=>p.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(p=>jsx(et,{children:jsx(tt,{asChild:true,isActive:location.pathname.includes(`/list/${p.plural}`),tooltip:ot(p.menu?.label??p.plural),children:jsxs(fo,{to:`list/${p.plural}`,children:[p.menu?.icon??createElement(rt[co(p.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:ot(p.menu?.label??p.plural)})]})})},p.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(fo,{to:`list/${s.plural}`,children:[createElement(rt[co(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 co(e){let t=Dn.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",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: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 Gn=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(Gn({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus();},...o})}var On=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",sm:"fk:h-8 fk:gap-1.5 fk:rounded-md fk:px-2.5 fk:has-[>svg]:px-2.5","icon-xs":"fk:size-6 fk:rounded-[calc(var(--radius)-5px)] fk:p-0 fk:has-[>svg]:p-0","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(On({size:r}),e),...a$1})}function Un({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 Fn({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",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",e),...t})}var Jn={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"},Yn=e=>{if(e.type==="source-document")return e.title||e.filename||"Source";let t=bo(e);return e.filename||(t==="image"?"Image":"Attachment")},Zn=(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",height:20,src:e,width:20}),ho=createContext(null),xo=createContext(null),Qn=()=>useContext(ho)??{variant:"grid"},_t=()=>{let e=useContext(xo);if(!e)throw new Error("Attachment components must be used within <Attachment>");return e},_i=({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})})},Vi=({data:e,onRemove:t,className:o,children:r,...a$1})=>{let{variant:i}=Qn(),s=bo(e),p=useMemo(()=>({data:e,mediaCategory:s,onRemove:t,variant:i}),[e,s,t,i]);return jsx(xo.Provider,{value:p,children:jsx("div",{className:a("fk:group fk:relative",i==="grid"&&"fk:size-24 fk:overflow-hidden fk:rounded-lg",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: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:hover:bg-accent/50"],o),...a$1,children:r})})},ji=({fallbackIcon:e,className:t,...o})=>{let{data:r,mediaCategory:a$1,variant:i}=_t(),s=i==="inline"?"fk:size-3":"fk:size-4",p=f=>jsx(f,{className:a(s,"fk:text-muted-foreground")}),l=()=>{if(a$1==="image"&&r.type==="file"&&r.url)return Zn(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 f=Jn[a$1];return e??p(f)};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",i==="list"&&"fk:size-12 fk:rounded fk:bg-muted",t),...o,children:l()})},Wi=({showMediaType:e=false,className:t,...o})=>{let{data:r,variant:a$1}=_t(),i=Yn(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})]})},$i=({label:e="Remove",className:t,children:o,...r})=>{let{onRemove:a$1,variant:i}=_t(),s=useCallback(p=>{p.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: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: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:[&>svg]:size-4"],t),onClick:s,type:"button",variant:"ghost",...r,children:[o??jsx(XIcon,{}),jsx("span",{className:"fk:sr-only",children:e})]}):null},Ki=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Ue,{closeDelay:t,openDelay:e,...o}),qi=e=>jsx(Fe,{...e}),Xi=({align:e="start",className:t,...o})=>jsx(_e,{align:e,className:a("fk:w-auto fk:p-2",t),...o}),Ji=({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 ia=e=>e&&e&1,pa=e=>e&&e&2,la=e=>e&&e&4,fa=e=>e.map((t,o)=>({key:`line-${o}`,tokens:t.map((r,a)=>({key:`line-${o}-${a}`,token:r}))})),ca=({token:e})=>jsx("span",{className:"fk:dark:bg-(--shiki-dark-bg)! fk:dark:text-(--shiki-dark)!",style:{backgroundColor:e.bgColor,color:e.color,fontStyle:ia(e.fontStyle)?"italic":void 0,fontWeight:pa(e.fontStyle)?"bold":void 0,textDecoration:la(e.fontStyle)?"underline":void 0,...e.htmlStyle},children:e.content}),da=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"),ua=({keyedLine:e,showLineNumbers:t})=>jsx("span",{className:t?da:"fk:block",children:e.tokens.length===0?`
2
- `:e.tokens.map(({token:o,key:r})=>jsx(ca,{token:o},r))}),wo=createContext({code:""}),Co=new Map,Po=new Map,ue=new Map,ma=(e,t)=>{let o=e.slice(0,100),r=e.length>100?e.slice(-100):"";return `${t}:${e.length}:${o}:${r}`},ka=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},ga=e=>({bg:"transparent",fg:"inherit",tokens:e.split(`
3
- `).map(t=>t===""?[]:[{color:"inherit",content:t}])}),yo=(e,t,o)=>{let r=ma(e,t),a=Po.get(r);return a||(o&&(ue.has(r)||ue.set(r,new Set),ue.get(r)?.add(o)),ka(t).then(i=>{let p=i.getLoadedLanguages().includes(t)?t:"text",l=i.codeToTokens(e,{lang:p,themes:{dark:"github-dark",light:"github-light"}}),f={bg:l.bg??"transparent",fg:l.fg??"inherit",tokens:l.tokens};Po.set(r,f);let m=ue.get(r);if(m){for(let k of m)k(f);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(()=>fa(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(ua,{keyedLine:i,showLineNumbers:t},i.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className);Mo.displayName="CodeBlockBody";var ba=({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",e),"data-language":t,style:{containIntrinsicSize:"auto 200px",contentVisibility:"auto",...o},...r}),ap=({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}),sp=({children:e,className:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-2",t),...o,children:e}),ip=({children:e,className:t,...o})=>jsx("span",{className:a("fk:font-mono",t),...o,children:e}),pp=({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}),ha=({code:e,language:t,showLineNumbers:o=false})=>{let r=useMemo(()=>ga(e),[e]),a=useMemo(()=>yo(e,t)??r,[e,t,r]),[i,s]=useState(null),p=useRef({code:e,language:t});return (p.current.code!==e||p.current.language!==t)&&(p.current={code:e,language:t},s(null)),useEffect(()=>{let f=false;return yo(e,t,m=>{f||s(m);}),()=>{f=true;}},[e,t]),jsx("div",{className:"fk:relative fk:overflow-auto",children:jsx(Mo,{showLineNumbers:o,tokenized:i??a})})},pt=({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(ba,{className:r,language:t,...i,children:[a,jsx(ha,{code:e,language:t,showLineNumbers:o})]})})},lp=({onCopy:e,onError:t,timeout:o=2e3,children:r,className:a$1,...i})=>{let[s,p]=useState(false),l=useRef(0),{code:f}=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(f),p(!0),e?.(),l.current=window.setTimeout(()=>p(!1),o));}catch(g){t?.(g);}},[f,e,t,o,s]);useEffect(()=>()=>{window.clearTimeout(l.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})})},fp=e=>jsx(a$4,{...e}),cp=({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}),dp=e=>jsx(c$1,{...e}),up=({align:e="end",...t})=>jsx(e$1,{align:e,...t}),mp=e=>jsx(g,{...e});var Pp=({className:e,...t})=>jsx(StickToBottom,{className:a("fk:relative fk:flex-1 fk:overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),yp=({className:e,...t})=>jsx(StickToBottom.Content,{className:a("fk:flex fk:flex-col fk:gap-8 fk:p-4",e),...t}),Sp=({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})]})]})}),Tp=({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",e),onClick:a$1,size:"icon",type:"button",variant:"outline",...t,children:jsx(ArrowDownIcon,{className:"fk:size-4"})})},ya=e=>e.parts.filter(t=>t.type==="text").map(t=>t.text).join(""),Lo=e=>`**${e.role.charAt(0).toUpperCase()+e.role.slice(1)}:** ${ya(e)}`,Sa=(e,t=Lo)=>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
- `),Ip=({messages:e,filename:t="conversation.md",formatMessage:o=Lo,className:r,children:a$1,...i})=>{let s=useCallback(()=>{let p=Sa(e,o),l=new Blob([p],{type:"text/markdown"}),f=URL.createObjectURL(l),m=document.createElement("a");m.href=f,m.download=t,document.body.append(m),m.click(),m.remove(),URL.revokeObjectURL(f);},[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",r),onClick:s,size:"icon",type:"button",variant:"outline",...i,children:a$1??jsx(DownloadIcon,{className:"fk:size-4"})})};var Up=({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}),Fp=({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}),_p=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-1",e),...o,children:t}),Vp=({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),je=()=>{let e=useContext(Eo);if(!e)throw new Error("MessageBranch components must be used within MessageBranch");return e},jp=({defaultBranch:e=0,onBranchChange:t,className:o,...r})=>{let[a$1,i]=useState(e),[s,p]=useState([]),l=useCallback(g=>{i(g),t?.(g);},[t]),f=useCallback(()=>{let g=a$1>0?a$1-1:s.length-1;l(g);},[a$1,s.length,l]),m=useCallback(()=>{let g=a$1<s.length-1?a$1+1:0;l(g);},[a$1,s.length,l]),k=useMemo(()=>({branches:s,currentBranch:a$1,goToNext:m,goToPrevious:f,setBranches:p,totalBranches:s.length}),[s,a$1,m,f]);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})})},Wp=({children:e,...t})=>{let{currentBranch:o,setBranches:r,branches:a$1}=je(),i=useMemo(()=>Array.isArray(e)?e:[e],[e]);return useEffect(()=>{a$1.length!==i.length&&r(i);},[i,a$1,r]),i.map((s,p)=>jsx("div",{className:a("fk:grid fk:gap-2 fk:overflow-hidden fk:[&>div]:pb-0",p===o?"fk:block":"fk:hidden"),...t,children:s},s.key))},$p=({className:e,...t})=>{let{totalBranches:o}=je();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})},Kp=({children:e,...t})=>{let{goToPrevious:o,totalBranches:r}=je();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})})},qp=({children:e,...t})=>{let{goToNext:o,totalBranches:r}=je();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})})},Xp=({className:e,...t})=>{let{currentBranch:o,totalBranches:r}=je();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]})},Ha={cjk:cjk,code:code,math:math,mermaid:mermaid},Ga=memo(({className:e,...t})=>jsx(Streamdown,{className:a("fk:size-full fk:[&>*:first-child]:mt-0 fk:[&>*:last-child]:mb-0",e),plugins:Ha,prefix:"fk",...t}),(e,t)=>e.children===t.children&&t.isAnimating===e.isAnimating);Ga.displayName="MessageResponse";var Jp=({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 ol=e=>jsx(d$1,{...e}),rl=e=>jsx(e$2,{...e}),nl=({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$1,{className:"fk:sr-only",children:o}),jsx(n$1,{className:"fk:**:data-[slot=command-input-wrapper]:h-auto",children:t})]}),al=e=>jsx(o,{...e}),sl=({className:e,...t})=>jsx(p,{className:a("fk:h-auto fk:py-3.5",e),...t}),il=e=>jsx(q,{...e}),pl=e=>jsx(r,{...e}),ll=e=>jsx(s,{...e}),fl=e=>jsx(u,{...e}),cl=e=>jsx(v,{...e}),dl=e=>jsx(t,{...e}),ul=({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}),ml=({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}),kl=({className:e,...t})=>jsx("span",{className:a("fk:flex-1 fk:truncate fk:text-left",e),...t});var Ka=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}},qa=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((l,f)=>{t.onloadedmetadata=()=>l(),t.onerror=()=>f(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(l=>{a.toBlob(l,"image/png");});if(!s)return null;let p=new Date().toISOString().replaceAll(/[:.]/g,"-").replace("T","_").replace("Z","");return new File([s],`screenshot-${p}.png`,{lastModified:Date.now(),type:"image/png"})}finally{if(e)for(let o of e.getTracks())o.stop();t.pause(),t.srcObject=null;}},$t=createContext(null),Kt=createContext(null),Nl=()=>{let e=useContext($t);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return e},zo=()=>useContext($t),Rl=()=>{let e=useContext(Kt);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return e},Xa=()=>useContext(Kt),Bl=({initialInput:e="",children:t})=>{let[o,r]=useState(e),a=useCallback(()=>r(""),[]),[i,s]=useState([]),p=useRef(null),l=useRef(()=>{}),f=useCallback(c=>{let x=Array.from(c);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(c=>{s(x=>{let z=x.find(R=>R.id===c);return z?.url&&URL.revokeObjectURL(z.url),x.filter(R=>R.id!==c)});},[]),k=useCallback(()=>{s(c=>{for(let x of c)x.url&&URL.revokeObjectURL(x.url);return []});},[]),g=useRef(i);useEffect(()=>{g.current=i;},[i]),useEffect(()=>()=>{for(let c of g.current)c.url&&URL.revokeObjectURL(c.url);},[]);let T=useCallback(()=>{l.current?.();},[]),b=useMemo(()=>({add:f,clear:k,fileInputRef:p,files:i,openFileDialog:T,remove:m}),[i,f,m,k,T]),C=useCallback((c,x)=>{p.current=c.current,l.current=x;},[]),N=useMemo(()=>({__registerFileInput:C,attachments:b,textInput:{clear:a,setInput:r,value:o}}),[o,a,b,C]);return jsx($t.Provider,{value:N,children:jsx(Kt.Provider,{value:b,children:t})})},Ho=createContext(null),qt=()=>{let e=Xa(),o=useContext(Ho)??e;if(!o)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return o},Go=createContext(null),Ll=()=>{let e=useContext(Go);if(!e)throw new Error("usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider");return e},Al=({label:e="Add photos or files",onSelect:t,...o})=>{let r=qt(),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]})},Dl=({label:e="Take screenshot",onSelect:t,...o})=>{let r=qt(),a=useCallback(async i=>{if(t?.(i),!i.defaultPrevented)try{let s=await qa();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]})},El=({className:e,accept:t,multiple:o,globalDrop:r,syncHiddenInput:a$1,maxFiles:i,maxFileSize:s,onError:p,onSubmit:l,children:f,...m})=>{let k=zo(),g=!!k,T=useRef(null),b=useRef(null),[C,N]=useState([]),c=g?k.attachments.files:C,[x,z]=useState([]),R=useRef(c);useEffect(()=>{R.current=c;},[c]);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]),Ke=useCallback(u=>{let v=Array.from(u),h=v.filter(X=>_(X));if(v.length&&h.length===0){p?.({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){p?.({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,se=typeof D=="number"?O.slice(0,D):O;typeof D=="number"&&O.length>D&&p?.({code:"max_files",message:"Too many files. Some were not added."});let ie=[];for(let ct of se)ie.push({filename:ct.name,id:nanoid(),mediaType:ct.type,type:"file",url:URL.createObjectURL(ct)});return [...X,...ie]});},[_,i,s,p]),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)}),[]),W=useCallback(u=>{let v=Array.from(u),h=v.filter(ie=>_(ie));if(v.length&&h.length===0){p?.({code:"accept",message:"No files match the accepted types."});return}let y=ie=>s?ie.size<=s:true,O=h.filter(y);if(h.length>0&&O.length===0){p?.({code:"max_file_size",message:"All files exceed the maximum size."});return}let X=c.length,D=typeof i=="number"?Math.max(0,i-X):void 0,se=typeof D=="number"?O.slice(0,D):O;typeof D=="number"&&O.length>D&&p?.({code:"max_files",message:"Too many files. Some were not added."}),se.length>0&&k?.attachments.add(se);},[_,s,i,p,c.length,k]),$=useCallback(()=>g?k?.attachments.clear():N(u=>{for(let v of u)v.url&&URL.revokeObjectURL(v.url);return []}),[g,k]),K=useCallback(()=>z([]),[]),G=g?W:Ke,xe=g?k.attachments.remove:te,qe=g?k.attachments.openFileDialog:he,ve=useCallback(()=>{$(),K();},[$,K]);useEffect(()=>{g&&k.__registerFileInput(T,()=>T.current?.click());},[g,k]),useEffect(()=>{a$1&&T.current&&c.length===0&&(T.current.value="");},[c,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]),A=useMemo(()=>({add:G,clear:$,fileInputRef:T,files:c.map(u=>({...u,id:u.id})),openFileDialog:qe,remove:xe}),[c,G,xe,$,qe]),Je=useMemo(()=>({add:u=>{let v=Array.isArray(u)?u:[u];z(h=>[...h,...v.map(y=>({...y,id:nanoid()}))]);},clear:K,remove:u=>{z(v=>v.filter(h=>h.id!==u));},sources:x}),[x,K]),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(c.map(async({id:X,...D})=>{if(D.url?.startsWith("blob:")){let se=await Ka(D.url);return {...D,url:se??D.url}}return D})),O=l({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,c,l,ve]),q=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:f})})]}),Ce=jsx(Go.Provider,{value:Je,children:q});return jsx(Ho.Provider,{value:A,children:Ce})},zl=({className:e,...t})=>jsx("div",{className:a("fk:contents",e),...t}),Hl=({onChange:e,onKeyDown:t,className:o,placeholder:r="What would you like to know?",...a$1})=>{let i=zo(),s=qt(),[p,l]=useState(false),f=useCallback(b=>{if(t?.(b),!b.defaultPrevented){if(b.key==="Enter"){if(p||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,p,s]),m=useCallback(b=>{let C=b.clipboardData?.items;if(!C)return;let N=[];for(let c of Array.from(C))if(c.kind==="file"){let x=c.getAsFile();x&&N.push(x);}N.length>0&&(b.preventDefault(),s.add(N));},[s]),k=useCallback(()=>l(false),[]),g=useCallback(()=>l(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:f,onPaste:m,placeholder:r,...a$1,...T})},Gl=({className:e,...t})=>jsx(st,{align:"block-end",className:a("fk:order-first fk:flex-wrap fk:gap-1",e),...t}),Ol=({className:e,...t})=>jsx(st,{align:"block-end",className:a("fk:justify-between fk:gap-1",e),...t}),Ul=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:min-w-0 fk:items-center fk:gap-1",e),...t}),Ja=({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 p=typeof r=="string"?r:r.content,l=typeof r=="string"?void 0:r.shortcut,f=typeof r=="string"?"top":r.side??"top";return jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsxs(e,{side:f,children:[p,l&&jsx("span",{className:"fk:ml-2 fk:text-muted-foreground",children:l})]})]})},Fl=e=>jsx(c$3,{...e}),_l=({className:e,children:t,...o})=>jsx(e$3,{asChild:true,children:jsx(Ja,{className:e,...o,children:t??jsx(PlusIcon,{className:"fk:size-4"})})}),Vl=({className:e,onCloseAutoFocus:t,...o})=>jsx(f,{align:"start",className:a(e),onCloseAutoFocus:r=>{t?.(r),!r.defaultPrevented&&r.preventDefault();},...o}),jl=({className:e,...t})=>jsx(h,{className:a(e),...t}),Wl=({className:e,variant:t="default",size:o="icon-sm",status:r,onStop:a$1,onClick:i,children:s,...p})=>{let l=r==="submitted"||r==="streaming",f=jsx(CornerDownLeftIcon,{className:"fk:size-4"});r==="submitted"?f=jsx(Ot,{}):r==="streaming"?f=jsx(SquareIcon,{className:"fk:size-4"}):r==="error"&&(f=jsx(XIcon,{className:"fk:size-4"}));let m=useCallback(k=>{if(l&&a$1){k.preventDefault(),a$1();return}i?.(k);},[l,a$1,i]);return jsx(it,{"aria-label":l?"Stop":"Submit",className:a(e),onClick:m,size:o,type:l&&a$1?"button":"submit",variant:t,...p,children:s??f})},$l=e=>jsx(a$4,{...e}),Kl=({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}),ql=({className:e,...t})=>jsx(e$1,{className:a(e),...t}),Xl=({className:e,...t})=>jsx(g,{className:a(e),...t}),Jl=({className:e,...t})=>jsx(c$1,{className:a(e),...t}),Yl=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Ue,{closeDelay:t,openDelay:e,...o}),Zl=e=>jsx(Fe,{...e}),Ql=({align:e="start",...t})=>jsx(_e,{align:e,...t}),ef=({className:e,...t})=>jsx("div",{className:a(e),...t}),tf=({className:e,...t})=>jsx("div",{className:a(e),...t}),of=({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}),rf=({className:e,...t})=>jsx("div",{className:a("fk:space-y-1",e),...t}),nf=({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}),af=({className:e,...t})=>jsx(n$1,{className:a(e),...t}),sf=({className:e,...t})=>jsx(p,{className:a(e),...t}),pf=({className:e,...t})=>jsx(q,{className:a(e),...t}),lf=({className:e,...t})=>jsx(r,{className:a(e),...t}),ff=({className:e,...t})=>jsx(s,{className:a(e),...t}),cf=({className:e,...t})=>jsx(u,{className:a(e),...t}),df=({className:e,...t$1})=>jsx(t,{className:a(e),...t$1});var Oo=new Map,ts=e=>{let t=Oo.get(e);return t||(t=motion.create(e),Oo.set(e,t)),t},os=({children:e,as:t="p",className:o,duration:r=2,spread:a$1=2})=>{let i=ts(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(os);var _o=createContext(null),gs=()=>{let e=useContext(_o);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},bs=1e3,hs=1e3,xs=memo(({className:e,isStreaming:t=false,open:o,defaultOpen:r,onOpenChange:a$1,duration:i,children:s,...p})=>{let l$1=r??t,f=r===false,[m,k]=useControllableState({defaultProp:l$1,onChange:a$1,prop:o}),[g,T]=useControllableState({defaultProp:void 0,prop:i}),b=useRef(t),[C,N]=useState(false),c=useRef(null);useEffect(()=>{t?(b.current=true,c.current===null&&(c.current=Date.now())):c.current!==null&&(T(Math.ceil((Date.now()-c.current)/hs)),c.current=null);},[t,T]),useEffect(()=>{t&&!m&&!f&&k(true);},[t,m,k,f]),useEffect(()=>{if(b.current&&!t&&m&&!C){let R=setTimeout(()=>{k(false),N(true);},bs);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(l,{className:a("fk:not-prose fk:mb-4",e),onOpenChange:x,open:m,...p,children:s})})}),vs=(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"]}),Cs=memo(({className:e,children:t,getThinkingMessage:o=vs,...r})=>{let{isStreaming:a$1,isOpen:i,duration:s}=gs();return jsx(m,{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")})]})})}),Ps={cjk:cjk,code:code,math:math,mermaid:mermaid},ys=memo(({className:e,children:t,...o})=>jsx(n,{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:Ps,children:t})}));xs.displayName="Reasoning";Cs.displayName="ReasoningTrigger";ys.displayName="ReasoningContent";var zf=({className:e,...t})=>jsx(l,{className:a("fk:not-prose fk:mb-4 fk:text-primary fk:text-xs",e),...t}),Hf=({className:e,count:t,children:o,...r})=>jsx(m,{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"})]})}),Gf=({className:e,...t})=>jsx(n,{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}),Of=({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 Rs=6e4;function Bs(){return typeof window<"u"&&"MediaRecorder"in window&&typeof navigator<"u"&&"mediaDevices"in navigator&&typeof navigator.mediaDevices.getUserMedia=="function"}function Ls(){return ["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"].find(t=>MediaRecorder.isTypeSupported(t))}function Wo(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 As(e){return e instanceof Error&&e.name==="AbortError"}function Ds(e,t,o){return e?o?"Cancel transcription":t?"Stop recording":"Dictate":"Dictation is not available in this browser."}var Kf=({className:e$1,disabled:t,onAudioRecorded:o,onError:r,onTranscriptionChange:a$1,size:i="icon-sm",variant:s="ghost",...p})=>{let[l,f]=useState(false),[m,k]=useState(false),[g,T]=useState(false),b$2=useRef(null),C=useRef(null),N=useRef([]),c$1=useRef(null),x=useRef(null),z=useRef(false),R=useRef(!!t),he=useRef(o),_=useRef(r),Ke=useRef(a$1);R.current=!!t,he.current=o,_.current=r,Ke.current=a$1,useEffect(()=>{T(Bs());},[]);let te=useCallback(()=>{if(C.current){for(let A of C.current.getTracks())A.stop();C.current=null;}},[]),W=useCallback(()=>{c$1.current!==null&&(window.clearTimeout(c$1.current),c$1.current=null);},[]),$=useCallback(()=>{W(),b$2.current?.state==="recording"&&b$2.current.stop(),f(false);},[W]),K=useCallback(()=>{x.current?.abort(),x.current=null,k(false);},[]),G=useCallback(()=>{K(),W();let A=b$2.current;A?.state==="recording"&&(z.current=true,A.stop()),f(false),te();},[K,W,te]),xe=useCallback(async()=>{if(!R.current){if(!he.current){_.current?.(new Error("Dictation is not configured."));return}try{let A=await navigator.mediaDevices.getUserMedia({audio:!0});if(R.current){for(let q of A.getTracks())q.stop();return}C.current=A;let Je=Ls(),oe=Je?new MediaRecorder(A,{mimeType:Je}):new MediaRecorder(A);N.current=[],oe.ondataavailable=q=>{q.data.size>0&&N.current.push(q.data);},oe.onstop=async()=>{if(te(),W(),f(!1),z.current){z.current=!1,N.current=[];return}let q=new Blob(N.current,{type:oe.mimeType||"audio/webm"});if(q.size===0)return;let Ce=new AbortController;x.current=Ce,k(!0);try{let u=he.current;if(!u)return;let v=await u(q,Ce.signal);v&&Ke.current?.(v);}catch(u){if(As(u))return;_.current?.(Wo(u,"Transcription failed."));}finally{x.current===Ce&&(x.current=null,k(!1));}},oe.onerror=()=>{f(!1),te(),W(),_.current?.(new Error("Recording failed. Try again."));},b$2.current=oe,oe.start(250),f(!0),c$1.current=window.setTimeout(()=>{$();},Rs);}catch(A){f(false),te(),_.current?.(Wo(A,"Could not start the microphone."));}}},[W,te,$]);useEffect(()=>{t&&G();},[G,t]),useEffect(()=>()=>{G();},[G]);let qe=useCallback(()=>{if(m){K();return}if(l){$();return}xe();},[K,l,m,xe,$]),ve=t||!g||!o,Xe=Ds(g&&!!o,l,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:[l?[0,1,2].map(A=>jsx("span",{className:"fk:absolute fk:inset-0 fk:animate-ping fk:rounded-full fk:border-2 fk:border-red-400/30",style:{animationDelay:`${String(A*.3)}s`,animationDuration:"2s"}},A)):null,jsxs(b,{"aria-label":Xe,"aria-pressed":l,size:i,variant:l?"destructive":s,...p,className:a("fk:relative fk:z-10 fk:rounded-full fk:dark:hover:bg-accent",e$1),disabled:ve,onClick:qe,type:"button",children:[m?jsx(LoaderIcon,{className:"fk:size-4 fk:animate-spin"}):null,!m&&l?jsx(SquareIcon,{className:"fk:size-4"}):null,m||l?null:jsx(MicIcon,{className:"fk:size-5"})]})]})}),jsx(e,{children:Xe})]})};var ec=({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"})]}),tc=({suggestion:e,onClick:t,className:o,variant:r="outline",size:a$1="sm",children:i,...s})=>{let p=useCallback(()=>{t?.(e);},[t,e]);return jsx(b,{className:a("fk:cursor-pointer fk:rounded-full fk:px-4",o),onClick:p,size:a$1,type:"button",variant:r,...s,children:i||e})};var fc=({className:e,...t})=>jsx(l,{className:a("fk:group fk:not-prose fk:mb-4 fk:w-full fk:rounded-md fk:border",e),...t}),Fs={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},_s={"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"})},Vs=e=>jsxs(b$3,{className:"fk:gap-1.5 fk:py-px fk:rounded-full fk:text-xs",variant:"secondary",children:[_s[e],Fs[e]]}),cc=({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(m,{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}),Vs(r)]}),jsx(ChevronDownIcon,{className:"fk:size-4 fk:text-muted-foreground fk:transition-transform fk:group-data-[state=open]:rotate-180"})]})},dc=({className:e,...t})=>jsx(n,{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}),uc=({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",children:jsx(pt,{code:JSON.stringify(t,null,2),language:"json"})})]}),mc=({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(pt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(a$1=jsx(pt,{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",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{Vi as Attachment,Ji as AttachmentEmpty,Ki as AttachmentHoverCard,Xi as AttachmentHoverCardContent,qi as AttachmentHoverCardTrigger,Wi as AttachmentInfo,ji as AttachmentPreview,$i as AttachmentRemove,_i as Attachments,pt as CodeBlock,pp as CodeBlockActions,ba as CodeBlockContainer,ha as CodeBlockContent,lp as CodeBlockCopyButton,ip as CodeBlockFilename,ap as CodeBlockHeader,fp as CodeBlockLanguageSelector,up as CodeBlockLanguageSelectorContent,mp as CodeBlockLanguageSelectorItem,cp as CodeBlockLanguageSelectorTrigger,dp as CodeBlockLanguageSelectorValue,sp as CodeBlockTitle,Pp as Conversation,yp as ConversationContent,Ip as ConversationDownload,Sp as ConversationEmptyState,Tp as ConversationScrollButton,sn as ExternalLink,Ue as HoverCard,_e as HoverCardContent,Fe as HoverCardTrigger,Ut as InputGroup,st as InputGroupAddon,it as InputGroupButton,Fn as InputGroupInput,Un as InputGroupText,Ft as InputGroupTextarea,Go as LocalReferencedSourcesContext,Up as Message,Vp as MessageAction,_p as MessageActions,jp as MessageBranch,Wp as MessageBranchContent,qp as MessageBranchNext,Xp as MessageBranchPage,Kp as MessageBranchPrevious,$p as MessageBranchSelector,Fp as MessageContent,Ga as MessageResponse,Jp as MessageToolbar,ol as ModelSelector,nl as ModelSelectorContent,al as ModelSelectorDialog,pl as ModelSelectorEmpty,ll as ModelSelectorGroup,sl as ModelSelectorInput,fl as ModelSelectorItem,il as ModelSelectorList,ul as ModelSelectorLogo,ml as ModelSelectorLogoGroup,kl as ModelSelectorName,dl as ModelSelectorSeparator,cl as ModelSelectorShortcut,rl as ModelSelectorTrigger,El as PromptInput,Al as PromptInputActionAddAttachments,Dl as PromptInputActionAddScreenshot,Fl as PromptInputActionMenu,Vl as PromptInputActionMenuContent,jl as PromptInputActionMenuItem,_l as PromptInputActionMenuTrigger,zl as PromptInputBody,Ja as PromptInputButton,af as PromptInputCommand,lf as PromptInputCommandEmpty,ff as PromptInputCommandGroup,sf as PromptInputCommandInput,cf as PromptInputCommandItem,pf as PromptInputCommandList,df as PromptInputCommandSeparator,Ol as PromptInputFooter,Gl as PromptInputHeader,Yl as PromptInputHoverCard,Ql as PromptInputHoverCardContent,Zl as PromptInputHoverCardTrigger,Bl as PromptInputProvider,$l as PromptInputSelect,ql as PromptInputSelectContent,Xl as PromptInputSelectItem,Kl as PromptInputSelectTrigger,Jl as PromptInputSelectValue,Wl as PromptInputSubmit,tf as PromptInputTab,rf as PromptInputTabBody,nf as PromptInputTabItem,of as PromptInputTabLabel,ef as PromptInputTabsList,Hl as PromptInputTextarea,Ul as PromptInputTools,xs as Reasoning,ys as ReasoningContent,Cs as ReasoningTrigger,dn as ResizableHandle,cn as ResizablePanel,fn as ResizablePanelGroup,Nt as Sheet,kn as SheetClose,Rt as SheetContent,At as SheetDescription,gn as SheetFooter,Bt as SheetHeader,ao as SheetOverlay,no as SheetPortal,Lt as SheetTitle,mn as SheetTrigger,Xt as Shimmer,En as Sidebar,Ht as SidebarContent,Ze as SidebarGroup,Mn as SidebarGroupContent,Gt as SidebarGroupLabel,wn as SidebarInset,Qe as SidebarMenu,tt as SidebarMenuButton,et as SidebarMenuItem,Et as SidebarPanel,Tn as SidebarProvider,zt as SidebarRail,In as SidebarTrigger,Of as Source,zf as Sources,Gf as SourcesContent,Hf as SourcesTrigger,Kf as SpeechInput,Ot as Spinner,tc as Suggestion,ec as Suggestions,fc as Tool,dc as ToolContent,cc as ToolHeader,uc as ToolInput,mc as ToolOutput,Yn as getAttachmentLabel,bo as getMediaCategory,Vs as getStatusBadge,yo as highlightCode,Sa as messagesToMarkdown,_t as useAttachmentContext,Qn as useAttachmentsContext,qt as usePromptInputAttachments,Nl as usePromptInputController,Ll as usePromptInputReferencedSources,Rl as useProviderAttachments,gs 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