@jacshuo/onyx 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +358 -361
- package/dist/Chart/BarChart.cjs +1 -1
- package/dist/Chart/BarChart.js +1 -1
- package/dist/Chart/LineChart.cjs +1 -1
- package/dist/Chart/LineChart.js +1 -1
- package/dist/Chart/PieChart.cjs +1 -1
- package/dist/Chart/PieChart.js +1 -1
- package/dist/Chart/ScatterChart.cjs +1 -1
- package/dist/Chart/ScatterChart.js +1 -1
- package/dist/Chart/index.cjs +1 -1
- package/dist/Chart/index.js +1 -1
- package/dist/DataDisplay/CodeBlock.cjs +2 -2
- package/dist/DataDisplay/CodeBlock.js +2 -2
- package/dist/DataDisplay/List.cjs +1 -1
- package/dist/DataDisplay/List.js +1 -1
- package/dist/DataDisplay/MetricCard.cjs +1 -0
- package/dist/DataDisplay/MetricCard.d.cts +3 -0
- package/dist/DataDisplay/MetricCard.d.ts +3 -0
- package/dist/DataDisplay/MetricCard.js +1 -0
- package/dist/DataDisplay/Stat.cjs +1 -0
- package/dist/DataDisplay/Stat.d.cts +3 -0
- package/dist/DataDisplay/Stat.d.ts +3 -0
- package/dist/DataDisplay/Stat.js +1 -0
- package/dist/DataDisplay/Table.cjs +1 -1
- package/dist/DataDisplay/Table.js +1 -1
- package/dist/DataDisplay/Tree.cjs +1 -1
- package/dist/DataDisplay/Tree.js +1 -1
- package/dist/DataDisplay/index.cjs +2 -2
- package/dist/DataDisplay/index.d.cts +6 -0
- package/dist/DataDisplay/index.d.ts +6 -0
- package/dist/DataDisplay/index.js +2 -2
- package/dist/Extras/CommandPalette.cjs +1 -0
- package/dist/Extras/CommandPalette.css +1 -0
- package/dist/Extras/CommandPalette.d.cts +4 -0
- package/dist/Extras/CommandPalette.d.ts +4 -0
- package/dist/Extras/CommandPalette.js +1 -0
- package/dist/Extras/DateTimePicker.cjs +1 -0
- package/dist/Extras/DateTimePicker.css +1 -0
- package/dist/Extras/DateTimePicker.d.cts +5 -0
- package/dist/Extras/DateTimePicker.d.ts +5 -0
- package/dist/Extras/DateTimePicker.js +1 -0
- package/dist/Extras/FileExplorer.cjs +2 -2
- package/dist/Extras/FileExplorer.js +2 -2
- package/dist/Extras/Timeline.cjs +1 -0
- package/dist/Extras/Timeline.css +1 -0
- package/dist/Extras/Timeline.d.cts +6 -0
- package/dist/Extras/Timeline.d.ts +6 -0
- package/dist/Extras/Timeline.js +1 -0
- package/dist/Extras/index.cjs +4 -4
- package/dist/Extras/index.css +1 -1
- package/dist/Extras/index.d.cts +14 -0
- package/dist/Extras/index.d.ts +14 -0
- package/dist/Extras/index.js +4 -4
- package/dist/Feedback/Alert.cjs +1 -1
- package/dist/Feedback/Alert.js +1 -1
- package/dist/Feedback/ProgressBar.cjs +1 -1
- package/dist/Feedback/ProgressBar.js +1 -1
- package/dist/Feedback/Skeleton.cjs +1 -0
- package/dist/Feedback/Skeleton.d.cts +2 -0
- package/dist/Feedback/Skeleton.d.ts +2 -0
- package/dist/Feedback/Skeleton.js +1 -0
- package/dist/Feedback/Spin.cjs +2 -2
- package/dist/Feedback/Spin.js +2 -2
- package/dist/Feedback/Toast.cjs +1 -0
- package/dist/Feedback/Toast.d.cts +11 -0
- package/dist/Feedback/Toast.d.ts +11 -0
- package/dist/Feedback/Toast.js +1 -0
- package/dist/Feedback/index.cjs +2 -2
- package/dist/Feedback/index.d.cts +11 -0
- package/dist/Feedback/index.d.ts +11 -0
- package/dist/Feedback/index.js +2 -2
- package/dist/Forms/Select.cjs +1 -0
- package/dist/Forms/Select.css +1 -0
- package/dist/Forms/Select.d.cts +3 -0
- package/dist/Forms/Select.d.ts +3 -0
- package/dist/Forms/Select.js +1 -0
- package/dist/Navigation/Breadcrumb.cjs +1 -0
- package/dist/Navigation/Breadcrumb.d.cts +3 -0
- package/dist/Navigation/Breadcrumb.d.ts +3 -0
- package/dist/Navigation/Breadcrumb.js +1 -0
- package/dist/Navigation/Header.cjs +1 -1
- package/dist/Navigation/Header.js +1 -1
- package/dist/Navigation/Pagination.cjs +1 -0
- package/dist/Navigation/Pagination.d.cts +2 -0
- package/dist/Navigation/Pagination.d.ts +2 -0
- package/dist/Navigation/Pagination.js +1 -0
- package/dist/Navigation/RibbonBar.cjs +1 -0
- package/dist/Navigation/RibbonBar.d.cts +6 -0
- package/dist/Navigation/RibbonBar.d.ts +6 -0
- package/dist/Navigation/RibbonBar.js +1 -0
- package/dist/Navigation/SideNav.cjs +1 -1
- package/dist/Navigation/SideNav.js +1 -1
- package/dist/Navigation/index.cjs +2 -2
- package/dist/Navigation/index.d.cts +8 -0
- package/dist/Navigation/index.d.ts +8 -0
- package/dist/Navigation/index.js +2 -2
- package/dist/Overlay/ContextMenu.cjs +1 -0
- package/dist/Overlay/ContextMenu.d.cts +3 -0
- package/dist/Overlay/ContextMenu.d.ts +3 -0
- package/dist/Overlay/ContextMenu.js +1 -0
- package/dist/Overlay/Drawer.cjs +1 -0
- package/dist/Overlay/Drawer.css +1 -0
- package/dist/Overlay/Drawer.d.cts +10 -0
- package/dist/Overlay/Drawer.d.ts +10 -0
- package/dist/Overlay/Drawer.js +1 -0
- package/dist/Overlay/index.cjs +1 -1
- package/dist/Overlay/index.css +1 -0
- package/dist/Overlay/index.d.cts +8 -0
- package/dist/Overlay/index.d.ts +8 -0
- package/dist/Overlay/index.js +1 -1
- package/dist/Primitives/Avatar.cjs +1 -0
- package/dist/Primitives/Avatar.d.cts +4 -0
- package/dist/Primitives/Avatar.d.ts +4 -0
- package/dist/Primitives/Avatar.js +1 -0
- package/dist/Primitives/Badge.cjs +1 -1
- package/dist/Primitives/Badge.js +1 -1
- package/dist/Primitives/Button.cjs +1 -1
- package/dist/Primitives/Button.js +1 -1
- package/dist/Primitives/Checkbox.cjs +1 -1
- package/dist/Primitives/Checkbox.js +1 -1
- package/dist/Primitives/Dropdown.cjs +1 -1
- package/dist/Primitives/Dropdown.js +1 -1
- package/dist/Primitives/DropdownButton.cjs +1 -1
- package/dist/Primitives/DropdownButton.js +1 -1
- package/dist/Primitives/Indicator.cjs +1 -1
- package/dist/Primitives/Indicator.js +1 -1
- package/dist/Primitives/Input.cjs +1 -1
- package/dist/Primitives/Input.js +1 -1
- package/dist/Primitives/Label.cjs +1 -1
- package/dist/Primitives/Label.js +1 -1
- package/dist/Primitives/Radio.cjs +1 -1
- package/dist/Primitives/Radio.js +1 -1
- package/dist/Primitives/Slider.cjs +1 -0
- package/dist/Primitives/Slider.css +1 -0
- package/dist/Primitives/Slider.d.cts +4 -0
- package/dist/Primitives/Slider.d.ts +4 -0
- package/dist/Primitives/Slider.js +1 -0
- package/dist/Primitives/Switch.cjs +1 -1
- package/dist/Primitives/Switch.js +1 -1
- package/dist/Primitives/Tag.cjs +1 -0
- package/dist/Primitives/Tag.d.cts +2 -0
- package/dist/Primitives/Tag.d.ts +2 -0
- package/dist/Primitives/Tag.js +1 -0
- package/dist/Primitives/index.cjs +1 -1
- package/dist/Primitives/index.css +1 -0
- package/dist/Primitives/index.d.cts +6 -0
- package/dist/Primitives/index.d.ts +6 -0
- package/dist/Primitives/index.js +1 -1
- package/dist/_tsup-dts-rollup.d.cts +1130 -3
- package/dist/_tsup-dts-rollup.d.ts +1130 -3
- package/dist/index.cjs +5 -5
- package/dist/index.css +1 -1
- package/dist/index.d.cts +74 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +5 -5
- package/dist/styles/DataDisplay/MetricCard.css +1 -0
- package/dist/styles/DataDisplay/Stat.css +1 -0
- package/dist/styles/Extras/CommandPalette.css +65 -0
- package/dist/styles/Extras/DateTimePicker.css +566 -0
- package/dist/styles/Extras/Timeline.css +52 -0
- package/dist/styles/Feedback/Skeleton.css +37 -0
- package/dist/styles/Feedback/Toast.css +77 -0
- package/dist/styles/Forms/Select.css +36 -0
- package/dist/styles/Navigation/RibbonBar.css +1 -0
- package/dist/styles/Overlay/ContextMenu.css +1 -0
- package/dist/styles/Overlay/Drawer.css +52 -0
- package/dist/styles/Primitives/Slider.css +4 -0
- package/dist/styles/Primitives/Tag.css +1 -0
- package/dist/styles/base.css +1059 -20
- package/dist/styles.css +1726 -18
- package/dist/theme.cjs +1 -1
- package/dist/theme.d.cts +7 -0
- package/dist/theme.d.ts +7 -0
- package/dist/theme.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import Nr,{createContext,useSyncExternalStore,useEffect,useState,useRef,useCallback,useMemo,useId,useContext,useLayoutEffect}from'react';import {Heart,ThumbsDown,Bookmark,Share2,Download,Info,CheckCircle,AlertTriangle,AlertCircle,ChevronDown,Check,Inbox,Plus,Trash2,Pencil,ArrowUpDown,ArrowUp,ArrowDown,ChevronRight,Menu,ChevronsLeft,X,PanelLeft,MoreHorizontal,ZoomIn,ZoomOut,ChevronLeft,Camera,Aperture,Calendar,MapPin,ListMusic,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3,ListVideo,Theater,Minimize,Maximize,HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,FolderUp,Search,CornerRightDown,Folder,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File,CircleX,TriangleAlert,CircleCheck}from'lucide-react';import {createPortal}from'react-dom';import {createRoot}from'react-dom/client';function i(...e){return twMerge(clsx(e))}var Xt=cva("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-500 text-white hover:bg-primary-600 active:bg-primary-700",secondary:"bg-secondary-500 text-white hover:bg-secondary-600 active:bg-secondary-700",danger:"bg-danger-500 text-white hover:bg-danger-600 active:bg-danger-700",warning:"bg-warning-500 text-white hover:bg-warning-600 active:bg-warning-700",ghost:"bg-transparent text-primary-700 hover:bg-primary-100 active:bg-primary-200 dark:text-primary-300 dark:hover:bg-primary-800",outline:"border border-primary-300 bg-transparent text-primary-700 hover:bg-primary-50 dark:border-primary-600 dark:text-primary-300 dark:hover:bg-primary-800"},size:{sm:"h-7 px-3 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"h-9 px-4 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"h-11 px-6 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{intent:"primary",size:"md"}}),Ir=cva("inline-flex items-center gap-1 rounded border font-semibold [&_svg]:shrink-0",{variants:{intent:{success:"border-success-200 bg-success-100 text-success-800 dark:border-success-800 dark:bg-success-900/30 dark:text-success-400",warning:"border-warning-200 bg-warning-100 text-warning-800 dark:border-warning-800 dark:bg-warning-900/30 dark:text-warning-400",error:"border-danger-200 bg-danger-100 text-danger-800 dark:border-danger-800 dark:bg-danger-900/30 dark:text-danger-400",info:"border-primary-200 bg-primary-100 text-primary-800 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-400",primary:"border-secondary-200 bg-secondary-100 text-secondary-700 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-300"},size:{sm:"px-1.5 py-0 text-[0.625rem] [&_svg]:h-2.5 [&_svg]:w-2.5",md:"px-2.5 py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",lg:"px-3 py-1 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5"}},defaultVariants:{intent:"primary",size:"md"}}),Hr=cva("absolute flex items-center justify-center rounded-full font-bold leading-none ring-2 ring-white select-none pointer-events-none z-10 dark:ring-primary-900",{variants:{intent:{danger:"bg-danger-500 text-white",success:"bg-success-500 text-white",warning:"bg-warning-500 text-white",info:"bg-primary-500 text-white",primary:"bg-secondary-500 text-white"},size:{sm:"text-[0.5rem]",md:"text-[0.625rem]",lg:"text-xs"},dot:{true:"",false:""},placement:{"top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2"}},compoundVariants:[{dot:true,size:"sm",class:"h-1.5 w-1.5 min-w-0 ring-1"},{dot:true,size:"md",class:"h-2 w-2 min-w-0"},{dot:true,size:"lg",class:"h-2.5 w-2.5 min-w-0"},{dot:false,size:"sm",class:"h-4 min-w-4 px-1"},{dot:false,size:"md",class:"h-5 min-w-5 px-1.5"},{dot:false,size:"lg",class:"h-6 min-w-6 px-2"}],defaultVariants:{intent:"danger",size:"md",dot:false,placement:"top-right"}}),jt=cva("w-full rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none focus:ring-2 dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",{variants:{state:{default:"border-secondary-300 focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 py-2 text-sm",lg:"h-11 px-4 py-2.5 text-base"}},defaultVariants:{state:"default",size:"md"}}),Fr=cva("inline-flex items-center gap-1 font-medium [&_svg]:shrink-0",{variants:{size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},intent:{default:"text-primary-700 dark:text-primary-300",muted:"text-primary-400 dark:text-primary-500",required:"text-primary-700 dark:text-primary-300 after:ml-0.5 after:text-danger-500 after:content-['*']"}},defaultVariants:{size:"md",intent:"default"}}),Ar=cva("relative inline-flex shrink-0 items-center justify-center rounded border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4 rounded-[3px]",md:"h-5 w-5 rounded",lg:"h-6 w-6 rounded-[5px]"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),zr=cva("relative inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Br=cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});function Yt({intent:e,size:t,className:r,...n}){return jsx("button",{className:i(Xt({intent:e,size:t}),r),...n})}function Bn(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let n=Bn(r.children,t);if(n)return n}}}function _n(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(..._n(r.children));return t}var Kr=40,Vs=200,$n=150,Oa=120;function Or(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Kr;return {animation:`dropdown-item-out ${$n}ms ease-in both ${a}ms`}}let o=e*Kr;return {animation:`dropdown-item-in ${Vs}ms ease-out both ${o}ms`}}function Ka(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Kr+$n;return {animation:`dropdown-container-out ${Oa}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function Wa({options:e,onSelect:t,animated:r=true,closing:n=false,depth:o=0}){let[a,s]=useState(null),p=useRef(void 0),b=c=>{p.current&&clearTimeout(p.current),s(c);},u=()=>{p.current=setTimeout(()=>s(null),150);};return useEffect(()=>()=>{p.current&&clearTimeout(p.current);},[]),jsx("div",{className:i("absolute z-50 min-w-44 rounded-md border py-1 shadow-lg overflow-hidden","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",o===0?"mt-1 w-full":"top-0 ml-0.5"),style:{...o>0?{left:"100%"}:{},...Ka(e.length,n,r)},role:"listbox",children:e.map((c,T)=>{let x=!!c.children?.length,m=a===c.value;return jsxs("div",{className:"relative",style:Or(T,e.length,n,r),onMouseEnter:()=>b(c.value),onMouseLeave:u,children:[jsxs("div",{role:"option","aria-selected":false,"aria-disabled":c.disabled,className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",c.disabled&&"pointer-events-none opacity-50"),onClick:()=>{c.disabled||x||t(c.value,c);},children:[c.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:c.icon}),jsx("span",{className:"flex-1 truncate",children:c.label??c.value}),x&&jsx(ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),x&&m&&jsx(Wa,{options:c.children,onSelect:t,animated:r,depth:o+1})]},c.value)})})}function Ds({options:e,filter:t,multiple:r,selected:n,canAdd:o,animated:a=true,closing:s=false,onSelect:p,onToggle:b,onAdd:u}){let c=useMemo(()=>_n(e),[e]),T=t.toLowerCase(),x=t?c.filter(d=>(d.label??d.value).toLowerCase().includes(T)||d.value.toLowerCase().includes(T)):c,m=x.length===0&&!o||o?1:0,g=x.length+m;return jsxs("div",{className:i("absolute z-50 mt-1 w-full max-h-60 min-w-44 overflow-y-auto rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white"),role:"listbox","aria-multiselectable":r||void 0,style:Ka(g,s,a),children:[x.map((d,f)=>{let w=r&&n.includes(d.value);return jsxs("div",{role:"option","aria-selected":r?w:false,"aria-disabled":d.disabled,className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",d.disabled&&"pointer-events-none opacity-50"),style:Or(f,g,s,a),onClick:()=>{d.disabled||(r?b(d.value):p(d.value,d));},children:[r&&jsx("span",{className:i("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",w?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:w&&jsx(Check,{className:"h-3 w-3"})}),d.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:d.icon}),jsx("span",{className:"truncate",children:d.label??d.value})]},d.value)}),x.length===0&&!o&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:Or(0,1,s,a),children:"No matches"}),o&&jsxs("div",{className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:Or(x.length,g,s,a),onClick:u,children:[jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxs("span",{className:"truncate",children:["Add \u201C",t.trim(),"\u201D"]})]})]})}function On(e){let{options:t,placeholder:r="Select\u2026",editable:n=false,onAddItem:o,disabled:a=false,align:s="left",className:p,size:b="md",animated:u=true}=e,c=e.multiple===true,[T,x]=useState(c?void 0:e.defaultValue),[m,g]=useState(c?e.defaultSelected??[]:[]),d=c?e.selected??m:[],[f,w]=useState(false),[h,P]=useState(false),[k,N]=useState(""),F=useRef(null),R=useRef(null),E=useRef(void 0),A=useCallback(()=>{if(!u||!f){w(false),N("");return}P(true);let V=(Math.max(t.length,1)-1)*Kr+$n+Oa+20;E.current=setTimeout(()=>{w(false),P(false),N("");},V);},[u,f,t.length]);useEffect(()=>()=>{E.current&&clearTimeout(E.current);},[]);let H=c?void 0:e.value??T,y=useMemo(()=>H?Bn(t,H):void 0,[t,H]);useEffect(()=>{if(!f)return;let Y=V=>{F.current&&!F.current.contains(V.target)&&A();};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[f,A]),useEffect(()=>{if(!f)return;let Y=V=>{V.key==="Escape"&&A();};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[f,A]);let O=useCallback((Y,V)=>{c||(e.value===void 0&&x(Y),e.onChange?.(Y,V)),E.current&&clearTimeout(E.current),w(false),P(false),N("");},[c,e]),v=useCallback(Y=>{if(!c)return;let V=e.selected??m,G=V.includes(Y)?V.filter(me=>me!==Y):[...V,Y];e.selected===void 0&&g(G),e.onSelectionChange?.(G);},[c,m,e]),ne=k.toLowerCase(),C=useMemo(()=>!n||!k.trim()?false:!_n(t).some(V=>V.value.toLowerCase()===ne||(V.label??V.value).toLowerCase()===ne),[n,ne,t]),re=useCallback(()=>{let Y=k.trim();Y&&(o?.(Y),N(""));},[k,o]),_=useCallback(Y=>{Y.key==="Enter"&&C&&(Y.preventDefault(),re());},[C,re]),de=useCallback(()=>{a||(f?A():(E.current&&clearTimeout(E.current),P(false),w(true),N(""),n&&requestAnimationFrame(()=>R.current?.focus())));},[a,f,A,n]),j;if(c){let Y=d.length;Y===0?j="":Y<=2?j=d.map(V=>Bn(t,V)).map(V=>V?V.label??V.value:"").filter(Boolean).join(", "):j=`${Y} selected`;}else j=y?y.label??y.value:"";let pe=c||n;return jsxs("div",{ref:F,className:i("relative inline-block min-w-44",p),children:[jsxs("div",{className:i(jt({state:"default",size:b}),"flex cursor-pointer items-center gap-1",a&&"pointer-events-none opacity-50"),onClick:de,role:"combobox","aria-expanded":f,"aria-haspopup":"listbox",children:[n?jsx("input",{ref:R,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:f?k:j,placeholder:r,disabled:a,onChange:Y=>{N(Y.target.value),f||w(true);},onKeyDown:_,onClick:Y=>{Y.stopPropagation(),f||w(true);}}):jsx("span",{className:i("flex-1 truncate",!j&&"text-secondary-400 dark:text-secondary-600"),children:j||r}),y?.icon&&!n&&!c&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:y.icon}),c&&d.length>0&&jsx("span",{className:"rounded-full bg-primary-100 px-1.5 text-xs font-semibold text-primary-700 dark:bg-primary-900 dark:text-primary-300",children:d.length}),jsx(ChevronDown,{className:i("text-primary-400 h-4 w-4 shrink-0 transition-transform",f&&"rotate-180")})]}),f&&jsx("div",{className:i(s==="right"?"right-0":"left-0","absolute w-full"),children:pe?jsx(Ds,{options:t,filter:k,multiple:c,selected:d,canAdd:C,animated:u,closing:h,onSelect:O,onToggle:v,onAdd:re}):jsx(Wa,{options:t,onSelect:O,animated:u,closing:h})})]})}function As(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var Wr=40,zs=200,Yn=150,ja=120;function jn(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Wr;return {animation:`dropdown-item-out ${Yn}ms ease-in both ${a}ms`}}let o=e*Wr;return {animation:`dropdown-item-in ${zs}ms ease-out both ${o}ms`}}function Bs(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Wr+Yn;return {animation:`dropdown-container-out ${ja}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function qt({label:e,items:t,intent:r,size:n,align:o="left",className:a,disabled:s,editable:p=false,onAddItem:b,multiple:u=false,selected:c=[],onSelectionChange:T,animated:x=true,chevron:m=true,...g}){let[d,f]=useState(false),[w,h]=useState(false),[P,k]=useState(""),N=useRef(null),F=useRef(null),R=useRef(void 0);useEffect(()=>()=>{R.current&&clearTimeout(R.current);},[]);let E=useCallback(()=>{if(!x||!d){f(false),k("");return}h(true);let pe=(Math.max(t.length,1)-1)*Wr+Yn+ja+20;R.current=setTimeout(()=>{f(false),h(false),k("");},pe);},[x,d,t.length]),A=useCallback(()=>{s||(d?E():(R.current&&clearTimeout(R.current),h(false),f(true),k(""),p&&requestAnimationFrame(()=>F.current?.focus())));},[s,d,E,p]);useEffect(()=>{if(!d)return;let j=pe=>{N.current&&!N.current.contains(pe.target)&&E();};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[d,E]),useEffect(()=>{if(!d)return;let j=pe=>{pe.key==="Escape"&&E();};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[d,E]);let H=P.toLowerCase(),y=useMemo(()=>P?t.filter(j=>(typeof j.label=="string"?j.label:j.key??"").toLowerCase().includes(H)):t,[t,H]),O=useMemo(()=>!p||!P.trim()?false:!t.some(j=>(typeof j.label=="string"?j.label:j.key??"").toLowerCase()===H),[p,H,t]),v=useCallback(()=>{let j=P.trim();j&&(b?.(j),k(""));},[P,b]),ne=useCallback(j=>{j.key==="Enter"&&O&&(j.preventDefault(),v());},[O,v]),C=useCallback(j=>{let pe=c.includes(j)?c.filter(Y=>Y!==j):[...c,j];T?.(pe);},[c,T]),re=u&&c.length>0?jsxs(Fragment,{children:[e," ",jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:c.length})]}):e,_=y.length===0&&!O||O?1:0,de=y.length+_;return jsxs("div",{ref:N,className:"relative inline-block",children:[jsxs("button",{type:"button",onClick:A,disabled:s,className:i(Xt({intent:r,size:n}),"inline-flex items-center gap-1",a),"aria-haspopup":u?"listbox":"true","aria-expanded":d?"true":"false",...g,children:[re,m&&jsx(ChevronDown,{className:i("h-3.5 w-3.5 transition-transform",d&&"rotate-180")})]}),d&&jsxs("div",{className:i("absolute z-50 mt-1 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",o==="right"?"right-0":"left-0"),style:Bs(de,w,x),role:u?"listbox":"menu","aria-multiselectable":u||void 0,children:[p&&jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsx("input",{ref:F,type:"text",value:P,onChange:j=>k(j.target.value),onKeyDown:ne,placeholder:"Type to filter or add\u2026",className:"w-full bg-transparent text-sm text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600"})}),jsxs("div",{className:"max-h-60 overflow-y-auto",children:[y.map((j,pe)=>{let Y=As(j,pe),V=u&&c.includes(Y);return jsxs(Nr.Fragment,{children:[j.divider&&jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxs("button",{type:"button",role:u?"option":"menuitem","aria-selected":u?V:void 0,disabled:j.disabled,className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",j.disabled&&"pointer-events-none opacity-50"),style:jn(pe,de,w,x),onClick:()=>{u?C(Y):(j.onClick?.(),R.current&&clearTimeout(R.current),f(false),h(false),k(""));},children:[u&&jsx("span",{className:i("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",V?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:V&&jsx(Check,{className:"h-3 w-3"})}),jsx("span",{className:"flex-1 truncate",children:j.label})]})]},Y)}),y.length===0&&!O&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:jn(0,1,w,x),children:"No matches"}),O&&jsxs("button",{type:"button",className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:jn(y.length,de,w,x),onClick:v,children:[jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxs("span",{className:"truncate",children:["Add \u201C",P.trim(),"\u201D"]})]})]})]})]})}function Gn({intent:e,size:t,className:r,...n}){return jsx("span",{className:i(Ir({intent:e,size:t}),r),...n})}var Os={danger:"bg-danger-500",success:"bg-success-500",warning:"bg-warning-500",info:"bg-primary-500",primary:"bg-secondary-500"};function Un({children:e,show:t=true,content:r,dot:n,intent:o="danger",size:a="md",placement:s="top-right",pulse:p=false,className:b}){let u=n??r==null,c=u?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxs("span",{className:i(Hr({intent:o,size:a,dot:u,placement:s}),b),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[p&&jsx("span",{className:i("absolute inset-0 rounded-full animate-ping opacity-60",Os[o??"danger"]),"aria-hidden":"true"}),c]})]})}function qn({intent:e,size:t,className:r,...n}){return jsx("label",{className:i(Fr({intent:e,size:t}),r),...n})}var Xs={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},js={default:"border-secondary-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus-within:border-danger-500 focus-within:ring-2 focus-within:ring-danger-500/20"};function Zn({state:e="default",inputSize:t="md",className:r,prefix:n,suffix:o,action:a,...s}){if(!n&&!o&&!a)return jsx("input",{className:i(jt({state:e,size:t}),r),...s});let p=Xs[t??"md"],b=js[e??"default"];return jsxs("div",{className:i("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",p.wrapper,b,r),children:[n&&jsx("span",{className:i("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",p.prefix),children:n}),jsx("input",{className:i("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",p.input,n&&"pl-2"),...s}),o&&jsx("span",{className:i("pointer-events-none flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",p.icon),children:o}),a&&jsx("button",{type:"button",onClick:a.onClick,"aria-label":a["aria-label"]??"Action",className:i("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",p.icon),children:a.icon})]})}var Zs={sm:"px-2 py-1.5 text-xs min-h-[60px]",md:"px-3 py-2 text-sm min-h-[80px]",lg:"px-4 py-2.5 text-base min-h-[100px]"},Js={default:"border-secondary-400 focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-2 focus:ring-danger-500/20"};function Qs(e){if(!e)return 0;let t="\u2E80-\u2EFF\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF",r=new RegExp(`[${t}]`),n=0,o="",a=()=>{let s=o.trim();s&&(n+=s.split(/\s+/).length),o="";};for(let s of e)r.test(s)?(a(),n+=1):o+=s;return a(),n}function Jn({state:e="default",size:t="md",showWordCount:r=false,maxWords:n,className:o,value:a,defaultValue:s,onChange:p,disabled:b,...u}){let[c,T]=useState(()=>s??""),x=a!==void 0?String(a):c,m=useCallback(f=>{a===void 0&&T(f.target.value),p?.(f);},[a,p]),g=useMemo(()=>Qs(x),[x]),d=n!=null&&g>n;return jsxs("div",{className:i("inline-flex w-full flex-col",o),children:[jsx("textarea",{value:x,onChange:m,disabled:b,className:i("w-full resize-y rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",Zs[t],Js[d?"error":e],b&&"pointer-events-none opacity-50"),...u}),(r||n!=null)&&jsx("span",{className:i("mt-1 self-end text-xs",d?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:n!=null?`${g} / ${n} words`:`${g} words`})]})}var ol={sm:{trackFixed:"h-5 w-9",trackH:"h-5 min-w-9",thumb:"h-3.5 w-3.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-16px)]",pad:"pl-[6px] pr-[18px]",contentLeft:"left-[6px]",contentRight:"right-[6px]",icon:"text-[10px] [&_svg]:h-3 [&_svg]:w-3"},md:{trackFixed:"h-6 w-11",trackH:"h-6 min-w-11",thumb:"h-4.5 w-4.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-20px)]",pad:"pl-[7px] pr-[23px]",contentLeft:"left-[7px]",contentRight:"right-[7px]",icon:"text-xs [&_svg]:h-3.5 [&_svg]:w-3.5"},lg:{trackFixed:"h-7 w-14",trackH:"h-7 min-w-14",thumb:"h-5.5 w-5.5",thumbTop:"top-[3px]",thumbOff:"left-[3px]",thumbOn:"left-[calc(100%-25px)]",pad:"pl-[8px] pr-[28px]",contentLeft:"left-[8px]",contentRight:"right-[8px]",icon:"text-sm [&_svg]:h-4 [&_svg]:w-4"}},al={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function Qn({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:n,uncheckedContent:o,intent:a,size:s,label:p,id:b,className:u,disabled:c,...T}){let x=useId(),m=b??x,g=s??"md",d=a??"primary",f=ol[g],w=n!=null||o!=null,[h,P]=useState(t),k=e??h,N=useCallback(F=>{let R=F.target.checked;e===void 0&&P(R),r?.(R);},[e,r]);return jsxs("label",{htmlFor:m,className:i("inline-flex cursor-pointer items-center gap-2",c&&"pointer-events-none opacity-50",u),children:[jsx("input",{...T,id:m,type:"checkbox",role:"switch",className:"sr-only",checked:k,disabled:c,onChange:N,"aria-checked":k}),jsxs("span",{className:i("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",w?f.trackH:f.trackFixed,Br({intent:a,size:s,checked:k?"on":"off"})),children:[w?jsxs(Fragment,{children:[jsxs("span",{className:i("pointer-events-none invisible inline-grid",f.icon),children:[jsx("span",{className:i("[grid-area:1/1] whitespace-nowrap",f.pad),children:n}),jsx("span",{className:i("[grid-area:1/1] whitespace-nowrap",f.pad),children:o})]}),jsx("span",{className:i("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",f.contentLeft,f.icon,al[d],k?"opacity-100":"opacity-0"),children:n}),jsx("span",{className:i("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",f.contentRight,f.icon,"text-primary-400 dark:text-primary-500",k?"opacity-0":"opacity-100"),children:o})]}):null,jsx("span",{className:i("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",f.thumb,f.thumbTop,k?f.thumbOn:f.thumbOff)})]}),p&&jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:p})]})}var dl={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function eo({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:n,intent:o,size:a,label:s,id:p,className:b,disabled:u,...c}){let T=useId(),x=p??T,m=a??"md",[g,d]=useState(t),f=e??g,w=useCallback(P=>{let k=P.target.checked;e===void 0&&d(k),n?.(k);},[e,n]),h=f||r;return jsxs("label",{htmlFor:x,className:i("inline-flex cursor-pointer items-center gap-2 select-none",u&&"pointer-events-none opacity-50",b),children:[jsx("input",{...c,id:x,type:"checkbox",className:"sr-only",checked:f,disabled:u,onChange:w}),jsx("span",{className:i(Ar({intent:o,size:a,checked:h?"on":"off"})),children:jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:i("text-white transition-all duration-200",dl[m],h?"scale-100 opacity-100":"scale-0 opacity-0"),children:r?jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),s&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:s})]})}var Za=createContext(null);function to({name:e,value:t,defaultValue:r,onValueChange:n,intent:o,size:a,disabled:s,orientation:p="vertical",className:b,children:u}){let c=useId(),T=e??c,[x,m]=useState(r),g=t??x,d=useCallback(f=>{t===void 0&&m(f),n?.(f);},[t,n]);return jsx(Za.Provider,{value:{name:T,value:g,onChange:d,intent:o,size:a,disabled:s},children:jsx("div",{role:"radiogroup",className:i("flex gap-2",p==="vertical"?"flex-col":"flex-row flex-wrap",b),children:u})})}var gl={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function ro({value:e,intent:t,size:r,label:n,id:o,className:a,disabled:s,...p}){let b=useId(),u=o??b,c=useContext(Za),T=t??c?.intent,x=r??c?.size,m=x??"md",g=s??c?.disabled,d=p.name??c?.name,f=c?c.value===e:void 0,w=useCallback(h=>{h.target.checked&&c?.onChange(e);},[c,e]);return jsxs("label",{htmlFor:u,className:i("inline-flex cursor-pointer items-center gap-2 select-none",g&&"pointer-events-none opacity-50",a),children:[jsx("input",{...p,id:u,type:"radio",name:d,value:e,className:"sr-only",checked:f,disabled:g,onChange:w}),jsx("span",{className:i(zr({intent:T,size:x,checked:f?"on":"off"})),children:jsx("span",{className:i("rounded-full bg-white transition-all duration-200",gl[m],f?"scale-100 opacity-100":"scale-0 opacity-0")})}),n&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:n})]})}var bl={Button:Yt,Dropdown:On,DropdownButton:qt,Badge:Gn,Indicator:Un,Label:qn,Input:Zn,TextBox:Jn,Switch:Qn,Checkbox:eo,Radio:ro,RadioGroup:to},no=bl;var br=cva("rounded-lg transition-shadow",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",elevated:"bg-white shadow-md hover:shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25 dark:hover:shadow-primary-200/30",outlined:"border-2 border-primary-300 bg-transparent dark:border-primary-600",ghost:"bg-primary-50 dark:bg-primary-800/50"},size:{sm:"p-3",md:"p-5",lg:"p-7"}},defaultVariants:{intent:"default",size:"md"}}),jr=cva("rounded-md",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",inset:"bg-primary-50 dark:bg-primary-800/50",elevated:"bg-white shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25"},size:{sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{intent:"default",size:"md"}});function oo({intent:e,size:t,className:r,...n}){return jsx("div",{className:i(br({intent:e,size:t}),r),...n})}function xl({className:e,...t}){return jsx("div",{className:i("mb-4 space-y-1",e),...t})}function yl({className:e,...t}){return jsx("h3",{className:i("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function vl({className:e,...t}){return jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function wl({className:e,...t}){return jsx("div",{className:i("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function kl({className:e,...t}){return jsx("div",{className:i("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function Nl({intent:e,media:t,mediaPosition:r="left",stackOnMobile:n=false,className:o,children:a,...s}){let p=jsx("div",{className:i("relative shrink-0 overflow-hidden",n?"h-48 w-full rounded-t-lg sm:h-auto sm:w-auto":"",!n&&(r==="left"?"rounded-l-lg":"rounded-r-lg")),style:n?void 0:{width:t.width??"10rem"},children:t.src?jsx("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:false}):t.icon?jsx("div",{className:"bg-primary-100 text-primary-500 dark:bg-primary-800 dark:text-primary-400 flex h-full w-full items-center justify-center",children:t.icon}):null});return jsxs("div",{className:i(br({intent:e}),"flex overflow-hidden p-0",n?"flex-col sm:flex-row":"",!n&&r==="right"&&"flex-row-reverse",!n&&r==="left"&&"flex-row",o),...s,children:[p,jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:a})]})}function ao({src:e,alt:t="",aspectRatio:r="16/9",className:n,children:o,...a}){return jsxs("div",{className:i("group overflow-hidden rounded-xl border transition-shadow duration-300","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white","dark:hover:shadow-primary-900/60 hover:shadow-lg",n),...a,children:[jsxs("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[jsx("img",{src:e,alt:t,className:"h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-110",draggable:false}),jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":true,children:jsx("div",{className:"animate-light-sweep absolute inset-0"})})]}),o]})}function Tl({className:e,...t}){return jsx("div",{className:i("space-y-2 p-4",e),...t})}function Rl({className:e,...t}){return jsx("h3",{className:i("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function Ml({className:e,...t}){return jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Sl({className:e,...t}){return jsx("div",{className:i("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function io({intent:e,size:t,className:r,...n}){return jsx("div",{className:i(jr({intent:e,size:t}),r),...n})}function Ll({className:e,...t}){return jsx("div",{className:i("border-primary-200 text-primary-900 dark:border-primary-700 dark:text-primary-100 mb-3 flex items-center gap-1.5 border-b pb-3 text-sm font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function El({className:e,...t}){return jsx("div",{className:i("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var Pl={Card:oo,ImageCard:ao,Panel:io},lo=Pl;var Yr=cva("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"},density:{compact:"[&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1",default:"",relaxed:"[&_th]:px-6 [&_th]:py-5 [&_td]:px-6 [&_td]:py-5"}},defaultVariants:{intent:"default",density:"default"}}),Gr=cva("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}}),Ur=cva("group flex w-full items-center gap-1.5 text-left [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",md:"py-1.5 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"py-2 text-base [&_svg]:h-4 [&_svg]:w-4"}},defaultVariants:{size:"md"}}),qr=cva("flex cursor-pointer items-center gap-1 rounded transition-colors [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-1 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-1.5 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),yr=cva("overflow-x-auto rounded-lg font-mono [background:var(--color-syntax-bg)] [&_pre]:m-0 [&_pre]:p-4 [&_code]:bg-transparent",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}});function kr({intent:e,density:t,className:r,...n}){return jsx("div",{className:"w-full overflow-auto",children:jsx("table",{className:i(Yr({intent:e,density:t}),r),...n})})}function mo({className:e,...t}){return jsx("thead",{className:i("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function po({className:e,...t}){return jsx("tbody",{className:i("[&_tr:last-child]:border-0",e),...t})}function wr({className:e,...t}){return jsx("tr",{className:i("border-primary-200 hover:bg-primary-50/50 dark:border-primary-700 dark:hover:bg-primary-800/30 border-b transition-colors",e),...t})}function It({className:e,...t}){return jsx("th",{className:i("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function Ht({className:e,...t}){return jsx("td",{className:i("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function uo({icon:e,text:t="No data",className:r}){return jsxs("div",{className:i("flex flex-col items-center justify-center gap-3 py-16 text-primary-400 dark:text-primary-500",r),children:[e??jsx(Inbox,{className:"h-12 w-12 stroke-[1.2]"}),jsx("span",{className:"text-sm",children:t})]})}var ei={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function Kl({columns:e,data:t,sort:r,onSortChange:n,defaultSort:o=null,rowKey:a,rowActions:s,intent:p,density:b,className:u,empty:c}){let[T,x]=useState(o),m=r??T,g=useCallback(f=>{let w=m?.column===f?m.direction==="asc"?{column:f,direction:"desc"}:null:{column:f,direction:"asc"};n?n(w):x(w);},[m,n]),d=useMemo(()=>{if(!m)return t;let f=e.find(P=>P.key===m.column);if(!f)return t;let w=f.compareFn??((P,k)=>{let N=f.cell(P),F=f.cell(k);return N==null&&F==null?0:N==null?-1:F==null?1:typeof N=="number"&&typeof F=="number"?N-F:String(N).localeCompare(String(F))}),h=[...t].sort(w);return m.direction==="desc"?h.reverse():h},[t,m,e]);return jsxs(kr,{intent:p,density:b,className:u,children:[jsx(mo,{children:jsxs(wr,{children:[e.map(f=>{let w=f.sortable!==false,h=m?.column===f.key;return jsx(It,{className:i(w&&"cursor-pointer select-none",f.headerClassName,f.hideBelow&&ei[f.hideBelow]),onClick:w?()=>g(f.key):void 0,"aria-sort":h?m.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[f.header,w&&jsx(ti,{active:h,direction:h?m.direction:null})]})},f.key)}),s&&jsx(It,{className:"w-20 text-right",children:"Actions"})]})}),jsx(po,{children:d.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(s?1:0),children:jsx(uo,{...c})})}):d.map((f,w)=>jsxs(wr,{children:[e.map(h=>jsx(Ht,{className:i(h.cellClassName,h.hideBelow&&ei[h.hideBelow]),children:h.cell(f)},h.key)),s&&jsx(Ht,{className:"text-right",children:jsx("span",{className:"inline-flex items-center gap-1",children:s(f)})})]},a?a(f,w):w))})]})}function Wl({value:e,onCommit:t,onCancel:r}){let[n,o]=useState(e),a=useRef(null);useEffect(()=>{a.current?.focus(),a.current?.select();},[]);let s=()=>t(n);return jsxs("span",{className:"flex items-center gap-1",children:[jsx("input",{ref:a,type:"text",value:n,onChange:p=>o(p.target.value),onKeyDown:p=>{p.key==="Enter"&&s(),p.key==="Escape"&&r();},"aria-label":"Edit cell",className:"min-w-0 flex-1 rounded border border-primary-400 bg-white px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-primary-400 dark:border-primary-600 dark:bg-secondary-800"}),jsx("button",{type:"button",onClick:s,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:jsx(Check,{className:"h-3.5 w-3.5"})}),jsx("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:jsx(X,{className:"h-3.5 w-3.5"})})]})}function Xl({columns:e,data:t,rowKey:r,sort:n,onSortChange:o,defaultSort:a=null,selectionMode:s="none",selected:p,onSelectionChange:b,editable:u=false,onCellEdit:c,toolbar:T=false,onAdd:x,onDelete:m,rowActions:g,intent:d,density:f,className:w,empty:h}){let[P,k]=useState(a),N=n??P,F=useCallback(V=>{let G=N?.column===V?N.direction==="asc"?{column:V,direction:"desc"}:null:{column:V,direction:"asc"};o?o(G):k(G);},[N,o]),R=useMemo(()=>{if(!N)return t;let V=e.find(W=>W.key===N.column);if(!V)return t;let G=V.compareFn??((W,l)=>{let D=V.cell(W),X=V.cell(l);return D==null&&X==null?0:D==null?-1:X==null?1:typeof D=="number"&&typeof X=="number"?D-X:String(D).localeCompare(String(X))}),me=[...t].sort(G);return N.direction==="desc"?me.reverse():me},[t,N,e]),[E,A]=useState([]),H=p??E,y=b??A,O=useMemo(()=>R.map((V,G)=>r(V,G)),[R,r]),v=s==="multiple"&&O.length>0&&O.every(V=>H.includes(V)),ne=s==="multiple"&&H.length>0&&!v,C=useCallback(V=>{s==="single"?y(H.includes(V)?[]:[V]):s==="multiple"&&y(H.includes(V)?H.filter(G=>G!==V):[...H,V]);},[s,H,y]),re=useCallback(()=>{y(v?[]:O);},[v,O,y]),[_,de]=useState(null),j=useCallback((V,G,me)=>{u&&me!==false&&de({rowKey:V,colKey:G});},[u]),pe=useCallback((V,G,me)=>{c?.(V,G,me),de(null);},[c]);return jsxs("div",{className:"space-y-2",children:[T&&jsxs("div",{className:"flex items-center gap-2",children:[x&&jsxs("button",{type:"button",onClick:x,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsx(Plus,{className:"h-3.5 w-3.5"})," Add"]}),m&&jsxs("button",{type:"button",onClick:()=>m(H),disabled:H.length===0,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-danger-600 transition-colors hover:bg-danger-50 disabled:opacity-40 disabled:pointer-events-none dark:border-secondary-600 dark:bg-secondary-800 dark:text-danger-400 dark:hover:bg-danger-900/20",children:[jsx(Trash2,{className:"h-3.5 w-3.5"})," Delete",H.length>0&&` (${H.length})`]}),u&&H.length===1&&jsxs("button",{type:"button",onClick:()=>{let V=e.find(G=>G.editable!==false);V&&de({rowKey:H[0],colKey:V.key});},className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsx(Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),H.length>0&&jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[H.length," row",H.length>1?"s":""," selected"]})]}),jsxs(kr,{intent:d,density:f,className:w,children:[jsx(mo,{children:jsxs(wr,{children:[s==="multiple"&&jsx(It,{className:"w-10",children:jsx("input",{type:"checkbox",checked:v,ref:V=>{V&&(V.indeterminate=ne);},onChange:re,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),s==="single"&&jsx(It,{className:"w-10"}),e.map(V=>{let G=V.sortable!==false,me=N?.column===V.key;return jsx(It,{className:i(G&&"cursor-pointer select-none",V.headerClassName),onClick:G?()=>F(V.key):void 0,"aria-sort":me?N.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[V.header,G&&jsx(ti,{active:me,direction:me?N.direction:null})]})},V.key)}),g&&jsx(It,{className:"w-20 text-right",children:"Actions"})]})}),jsx(po,{children:R.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(s!=="none"?1:0)+(g?1:0),children:jsx(uo,{...h})})}):R.map((V,G)=>{let me=r(V,G),W=H.includes(me);return jsxs(wr,{className:i(W&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{s!=="none"&&C(me);},children:[s==="multiple"&&jsx(Ht,{className:"w-10",children:jsx("input",{type:"checkbox",checked:W,onChange:()=>C(me),onClick:l=>l.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),s==="single"&&jsx(Ht,{className:"w-10",children:jsx("input",{type:"radio",checked:W,onChange:()=>C(me),onClick:l=>l.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(l=>{let D=_?.rowKey===me&&_?.colKey===l.key,X=l.editValue?.(V)??(()=>{let $=l.cell(V);return typeof $=="string"||typeof $=="number"?String($):""})();return jsx(Ht,{className:i(l.cellClassName,u&&l.editable!==false&&"cursor-text"),onDoubleClick:$=>{$.stopPropagation(),j(me,l.key,l.editable);},children:D?jsx(Wl,{value:X,onCommit:$=>pe(me,l.key,$),onCancel:()=>de(null)}):l.cell(V)},l.key)}),g&&jsx(Ht,{className:"text-right",onClick:l=>l.stopPropagation(),children:jsx("span",{className:"inline-flex items-center gap-1",children:g(V)})})]},me)})})]})]})}function ti({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsx(ArrowUpDown,{className:i(r,"opacity-30")}):t==="asc"?jsx(ArrowUp,{className:i(r,"opacity-70")}):jsx(ArrowDown,{className:i(r,"opacity-70")})}var ri=createContext({size:"md"});function fo({intent:e,size:t="md",className:r,...n}){return jsx(ri.Provider,{value:{size:t},children:jsx("ul",{className:i(Gr({intent:e}),r),...n})})}function Gl({actions:e,className:t,children:r,...n}){let{size:o}=useContext(ri);return jsxs("li",{className:i(Ur({size:o}),t),...n,children:[jsx("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:r}),e&&jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",children:e})]})}var ai=createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function go({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:n="all",onExpandedKeysChange:o,size:a="md",className:s,children:p,...b}){let [u,c]=useState(()=>n),x=useCallback(g=>{if(r){let d=new Set(r);d.has(g)?d.delete(g):d.add(g),o?.(d);}else c(d=>{if(d==="all")return new Set(["__ALL_MINUS__",g]);let f=new Set(d);return f.has(g)?f.delete(g):f.add(g),f});},[r,o]),m=r??(u==="all"?null:u);return jsx(ai.Provider,{value:{showLines:e,expandedKeys:m,onToggleKey:x,size:a},children:t?jsx("ul",{className:i("text-sm",s),role:"tree",...b,children:p}):jsx("ul",{className:i("text-sm",s),role:"tree",...b,children:jsx(ec,{children:p})})})}function ec({children:e}){let t=ii(e);return jsx(Fragment,{children:t.map(r=>Nr.isValidElement(r)&&r.props.children?r.props.children:null)})}function ii(e){let t=[];return Nr.Children.forEach(e,r=>{Nr.isValidElement(r)&&r.type===Nr.Fragment?t.push(...ii(r.props.children)):t.push(r);}),t}function tc({nodeKey:e,label:t,icon:r,actions:n,defaultExpanded:o=false,expanded:a,onToggle:s,children:p,className:b}){let{showLines:u,expandedKeys:c,onToggleKey:T,size:x}=useContext(ai),[m,g]=useState(o),d=Nr.Children.count(p)>0,f=e??(typeof t=="string"?t:""),w;a!=null?w=a:c!=null&&f?c.has("__ALL_MINUS__")?w=!c.has(f):w=c.has(f):w=m;let h=()=>{let P=!w;s?s(P):c!=null&&f?T(f):g(P);};return jsxs("li",{className:i("select-none",b),role:"treeitem","aria-expanded":d?w:void 0,children:[jsxs("div",{className:i("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",qr({size:x}),d?"cursor-pointer":"cursor-default"),onClick:d?h:void 0,children:[d?jsx(ChevronRight,{className:i("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",w&&"rotate-90")}):jsx("span",{className:"w-4 shrink-0"}),r&&jsx("span",{className:"shrink-0",children:r}),jsx("span",{className:"text-primary-700 dark:text-primary-300 min-w-0 flex-1 truncate",children:t}),n&&jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",onClick:P=>P.stopPropagation(),children:n})]}),d&&jsx("div",{className:i("grid transition-[grid-template-rows] duration-200 ease-out",w?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("ul",{className:i("ml-4 pl-2",u&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:p})})})]})}function ac({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function ic({msg:e,alignRight:t}){return jsxs("div",{className:i("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsx(ac,{avatar:e.avatar,sender:e.sender}),jsxs("div",{className:i("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsx("div",{className:i("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function bo({messages:e,mode:t="split",autoScroll:r=true,className:n,...o}){let a=useRef(null);return useEffect(()=>{r&&a.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxs("div",{className:i("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",n),...o,children:[e.map(s=>{let p=t==="split"&&!!s.self;return jsx(ic,{msg:s,alignRight:p},s.id)}),jsx("div",{ref:a})]})}var cc={name:"onyx-css-vars",type:"dark",settings:[{settings:{foreground:"var(--color-syntax-plain)",background:"var(--color-syntax-bg)"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"var(--color-syntax-comment)",fontStyle:"italic"}},{scope:["keyword","keyword.control","keyword.operator.new","keyword.operator.expression","storage.type","storage.modifier"],settings:{foreground:"var(--color-syntax-keyword)"}},{scope:["string","string.quoted","string.template"],settings:{foreground:"var(--color-syntax-string)"}},{scope:["entity.name.function","support.function","meta.function-call"],settings:{foreground:"var(--color-syntax-function)"}},{scope:["variable","variable.other","variable.parameter","meta.definition.variable"],settings:{foreground:"var(--color-syntax-variable)"}},{scope:["constant.numeric","constant.language"],settings:{foreground:"var(--color-syntax-number)"}},{scope:["keyword.operator","keyword.operator.assignment","keyword.operator.comparison","keyword.operator.arithmetic"],settings:{foreground:"var(--color-syntax-operator)"}},{scope:["entity.name.tag","punctuation.definition.tag","support.class.component"],settings:{foreground:"var(--color-syntax-tag)"}},{scope:["entity.other.attribute-name","meta.tag.attributes"],settings:{foreground:"var(--color-syntax-attr)"}},{scope:["punctuation","meta.brace","punctuation.definition.block","punctuation.separator","punctuation.terminator"],settings:{foreground:"var(--color-syntax-punctuation)"}},{scope:["entity.name.type","support.type","support.class","entity.other.inherited-class"],settings:{foreground:"var(--color-syntax-type)"}}]},dc={typescript:()=>import('@shikijs/langs/typescript'),javascript:()=>import('@shikijs/langs/javascript'),tsx:()=>import('@shikijs/langs/tsx'),jsx:()=>import('@shikijs/langs/jsx'),html:()=>import('@shikijs/langs/html'),css:()=>import('@shikijs/langs/css'),json:()=>import('@shikijs/langs/json'),markdown:()=>import('@shikijs/langs/markdown'),python:()=>import('@shikijs/langs/python'),rust:()=>import('@shikijs/langs/rust'),go:()=>import('@shikijs/langs/go'),java:()=>import('@shikijs/langs/java'),c:()=>import('@shikijs/langs/c'),cpp:()=>import('@shikijs/langs/cpp'),csharp:()=>import('@shikijs/langs/csharp'),vue:()=>import('@shikijs/langs/vue'),xml:()=>import('@shikijs/langs/xml'),yaml:()=>import('@shikijs/langs/yaml'),sql:()=>import('@shikijs/langs/sql'),bash:()=>import('@shikijs/langs/bash'),shell:()=>import('@shikijs/langs/shell')},vo=null,si=new Set;function mc(){return vo||(vo=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[cc],langs:[],engine:t()}))),vo}async function pc(e,t,r){let n=await mc();if(t&&!si.has(t)){let a=dc[t];if(a)try{let s=await a();await n.loadLanguage(s.default??s),si.add(t);}catch{t="text";}else t="text";}let o=n.codeToHtml(e,{lang:t||"text",theme:"onyx-css-vars"});if(o=o.replace(/(<pre [^>]*style=")/,"$1line-height:1.7;tab-size:2;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;"),r){let a=0;o=o.replace(/<span class="line">/g,()=>(a++,`<span class="line"><span class="line-number" data-line="${a}"></span>`));}return o}function wo({code:e,language:t="text",lineNumbers:r=false,editable:n=false,onCodeChange:o,size:a,className:s,...p}){let[b,u]=useState(""),c=useRef(null),T=useRef(null),x=useRef(null);useEffect(()=>{let k=false;return pc(e,t,n?false:r).then(N=>{k||u(N);}),()=>{k=true;}},[e,t,r,n]);let m=useCallback(()=>{let k=T.current,N=x.current?.querySelector("pre"),F=c.current?.querySelector("[data-gutter]");k&&N&&(N.scrollTop=k.scrollTop,N.scrollLeft=k.scrollLeft),k&&F&&(F.scrollTop=k.scrollTop);},[]),g=useCallback(k=>{o?.(k.target.value);},[o]),d=useCallback(k=>{if(k.key==="Tab"){k.preventDefault();let N=k.currentTarget,F=N.selectionStart,R=N.selectionEnd,E=N.value.substring(0,F)+" "+N.value.substring(R);o?.(E),requestAnimationFrame(()=>{N.selectionStart=N.selectionEnd=F+2;});}},[o]),f=r&&"[&_.line-number]:inline-block [&_.line-number]:w-8 [&_.line-number]:mr-4 [&_.line-number]:text-right [&_.line-number]:text-secondary-400 [&_.line-number]:select-none [&_.line-number]:before:content-[attr(data-line)]",w="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",h=1.7,P=e.split(`
|
|
2
|
-
`).length;return n?jsxs("div",{ref:c,className:i(yr({size:a}),"flex border border-primary-200 dark:border-primary-700",s),style:{background:"var(--color-syntax-bg)"},...p,children:[r&&jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:w,lineHeight:h,width:"3rem"},children:Array.from({length:P},(k,N)=>jsx("div",{children:N+1},N))}),jsxs("div",{className:"relative min-w-0 flex-1",children:[jsx("textarea",{ref:T,value:e,onChange:g,onScroll:m,onKeyDown:d,spellCheck:false,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",className:"relative z-2 m-0 block h-full w-full resize-none overflow-auto whitespace-pre border-none bg-transparent p-4 text-transparent caret-primary-600 outline-none dark:caret-primary-400",style:{fontFamily:w,lineHeight:h,tabSize:2,minHeight:"6rem"}}),jsx("div",{ref:x,"aria-hidden":true,className:"pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre]:h-full [&_pre]:overflow-hidden [&_pre]:p-4 [&_code]:bg-transparent",dangerouslySetInnerHTML:b?{__html:b}:void 0})]})]}):jsx("div",{ref:c,className:i(yr({size:a}),"border border-primary-200 dark:border-primary-700",f,s),style:{background:"var(--color-syntax-bg)"},...p,children:jsx("div",{ref:x,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:b?{__html:b}:void 0,children:b?void 0:jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsx("code",{children:e})})})})}var uc={Table:kr,List:fo,Tree:go,Chat:bo,CodeBlock:wo},ko=uc;var zt="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",di="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",er="text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200",tr="flex items-center justify-center rounded-md p-2 transition-colors cursor-pointer text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200";function wc({to:e,className:t,style:r,children:n}){let o=typeof t=="function"?t({isActive:false}):t;return jsx("a",{href:e,className:o,style:r,children:n})}var No=["expanded","icons","mini"];function kc(e){let t=No.indexOf(e);return No[(t+1)%No.length]}function mi(e){let t=new Set;for(let r of e)if(r.children&&r.children.length>0){t.add(r.key??r.label);for(let n of mi(r.children))t.add(n);}return t}function pi({item:e,basePath:t,depth:r,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:s,onToggle:p}){let b=e.key??e.label,u=e.children&&e.children.length>0,[c,T]=useState(e.defaultOpen??true),x=s?s.has(b):c,m=useCallback(()=>{s?p(b):T(d=>!d);},[s,p,b]),g=r>0?`${r*1.25}rem`:void 0;if(u)return jsxs("div",{children:[jsxs("button",{type:"button",onClick:m,className:i(zt,er,"justify-between"),style:{paddingLeft:g},children:[jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsx(ChevronRight,{className:i("h-3.5 w-3.5 transition-transform",x&&"rotate-90")})]}),x&&jsx("div",{className:i("flex flex-col gap-0.5 pt-0.5",a?"ml-2.5 border-l border-primary-200 dark:border-primary-700":"ml-2"),children:e.children.map(d=>jsx(pi,{item:d,basePath:t,depth:r+1,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:s,onToggle:p},d.key??d.path??d.label))})]});if(e.path!=null){let d=t+e.path;return n?jsxs("button",{type:"button",onClick:()=>n(e,d),className:i(zt,er),style:{paddingLeft:g},children:[e.icon,e.label]}):jsxs(o,{to:d,className:({isActive:f})=>i(zt,f?di:er),style:{paddingLeft:g},children:[e.icon,e.label]})}return jsxs("span",{className:i(zt,er,"cursor-default"),style:{paddingLeft:g},children:[e.icon,e.label]})}function Nc({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let[o,a]=useState(false),s=useRef(null),p=useRef(void 0),[b,u]=useState({top:0,left:0}),c=()=>{clearTimeout(p.current),a(true);},T=()=>{p.current=setTimeout(()=>a(false),200);};useLayoutEffect(()=>{if(o&&s.current){let m=s.current.getBoundingClientRect();u({top:m.top,left:m.right+4});}},[o]);let x=e.icon||jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxs("div",{onMouseEnter:c,onMouseLeave:T,children:[jsx("button",{ref:s,type:"button",className:i(tr,"w-full"),title:e.label,onClick:()=>a(m=>!m),children:x}),o&&createPortal(jsxs("div",{className:"fixed z-50 min-w-44 rounded-md border border-primary-200 bg-white p-1 shadow-lg dark:border-primary-700 dark:bg-primary-900",style:{top:b.top,left:b.left},onMouseEnter:c,onMouseLeave:T,children:[jsx("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),jsx("div",{className:"flex flex-col gap-0.5",children:e.children?.map(m=>{let g=m.key??m.path??m.label;if(m.path!=null){let d=t+m.path;return r?jsxs("button",{type:"button",onClick:()=>{r(m,d),a(false);},className:i(zt,er),children:[m.icon,m.label]},g):jsxs(n,{to:d,className:({isActive:f})=>i(zt,f?di:er),children:[m.icon,m.label]},g)}return jsxs("span",{className:i(zt,"cursor-default text-primary-400"),children:[m.icon,m.label]},g)})})]}),document.body)]})}function Cc({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let o=e.icon||jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});if(e.path!=null){let a=t+e.path;return r?jsx("button",{type:"button",onClick:()=>r(e,a),className:i(tr,"w-full"),title:e.label,children:o}):jsx(n,{to:a,className:({isActive:s})=>i(tr,"w-full",s&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:jsx("span",{title:e.label,children:o})})}return jsx("span",{className:i(tr,"w-full cursor-default"),title:e.label,children:o})}function To({items:e,title:t,basePath:r="/",onItemClick:n,LinkComponent:o=wc,collapsible:a,collapseMode:s,defaultCollapseMode:p="expanded",onCollapseModeChange:b,showLines:u=true,expandedKeys:c,defaultExpandedKeys:T="all",onExpandedKeysChange:x,className:m,responsive:g=true,mobileBreakpoint:d=768,mobileTopOffset:f=48,...w}){let[h,P]=useState(p),k=s??h,N=Nr.useMemo(()=>mi(e),[e]),[F,R]=useState(()=>T==="all"?new Set(N):new Set(T)),E=c??null,A=E??F,H=useCallback(W=>{let l=new Set(A);l.has(W)?l.delete(W):l.add(W),R(l),x?.(l);},[A,x]),y=useCallback(()=>{let W=kc(k);P(W),b?.(W);},[k,b]),[O,v]=useState(()=>g&&typeof window<"u"&&window.innerWidth<d),[ne,C]=useState(false);useEffect(()=>{if(!g||typeof window>"u"||!window.matchMedia)return;let W=window.matchMedia(`(max-width: ${d-1}px)`),l=D=>{v(D.matches),D.matches||C(false);};return W.addEventListener("change",l),()=>W.removeEventListener("change",l)},[g,d]);let re=useCallback(W=>{W.target.closest("a")&&C(false);},[]),_=useRef(null),de=useRef({startX:0,startY:0,dragging:false}),pe=useCallback(W=>{let l=W.touches[0];de.current={startX:l.clientX,startY:l.clientY,dragging:true};},[]),Y=useCallback(W=>{if(!de.current.dragging||!_.current)return;let l=W.touches[0],D=l.clientX-de.current.startX,X=l.clientY-de.current.startY;D>=0||Math.abs(X)>Math.abs(D)||(_.current.style.transform=`translateX(${Math.max(D,-224)}px)`,_.current.style.transition="none");},[]),V=useCallback(W=>{if(!de.current.dragging||!_.current)return;de.current.dragging=false;let l=W.changedTouches[0],D=l.clientX-de.current.startX,X=l.clientY-de.current.startY;_.current.style.transition="",_.current.style.transform="",D<-60&&Math.abs(D)>Math.abs(X)&&C(false);},[]),G=useMemo(()=>!O||!n?n:(W,l)=>{C(false),n(W,l);},[O,n]),me=jsxs(Fragment,{children:[a&&!O&&jsx("div",{className:i("flex shrink-0 mb-1",k==="expanded"?"justify-end":"justify-center"),children:jsx("button",{type:"button",onClick:y,className:tr,"aria-label":k==="mini"?"Expand sidebar":"Collapse sidebar",title:k==="mini"?"Expand sidebar":"Collapse sidebar",children:k==="mini"?jsx(Menu,{className:"h-5 w-5"}):jsx(ChevronsLeft,{className:"h-4 w-4"})})}),(O||k==="expanded")&&jsxs(Fragment,{children:[t&&jsx("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(W=>jsx(pi,{item:W,basePath:r,depth:0,onItemClick:G,LinkComponent:o,showLines:u,expandedKeys:E,onToggle:H},W.key??W.path??W.label))]}),!O&&k==="icons"&&e.map(W=>{let l=W.key??W.path??W.label;return W.children&&W.children.length>0?jsx(Nc,{item:W,basePath:r,onItemClick:G,LinkComponent:o},l):jsx(Cc,{item:W,basePath:r,onItemClick:G,LinkComponent:o},l)})]});return g&&O?jsxs(Fragment,{children:[ne&&createPortal(jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:f},onClick:()=>C(false)}),document.body),createPortal(jsxs("aside",{ref:_,className:i("fixed bottom-0 left-0 z-50 flex flex-col w-56 border-r border-primary-200 dark:border-primary-700 bg-white dark:bg-primary-900 shadow-xl transition-transform duration-200",ne?"translate-x-0":"-translate-x-full"),style:{top:f},onClick:re,onTouchStart:pe,onTouchMove:Y,onTouchEnd:V,children:[jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-500 dark:text-primary-400",children:"Navigation"}),jsx("button",{type:"button",onClick:W=>{W.stopPropagation(),C(false);},className:i(tr,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsx(X,{className:"h-4 w-4"})})]}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsx("nav",{className:"flex flex-col gap-0.5",children:me})})]}),document.body),!ne&&createPortal(jsx("button",{type:"button",className:"fixed left-0 z-50 flex h-14 w-5 items-center justify-center rounded-r-xl bg-primary-800/80 text-white shadow-md backdrop-blur-sm transition-colors hover:bg-primary-700/90 dark:bg-primary-200/80 dark:text-primary-900 dark:hover:bg-primary-300/90",style:{top:`calc(50% + ${f/2}px)`,transform:"translateY(-50%)"},onClick:()=>C(true),"aria-label":"Open navigation",children:jsx(ChevronRight,{className:"h-3.5 w-3.5"})}),document.body)]}):jsx("nav",{className:i("flex flex-col gap-0.5",k==="mini"&&"items-center",m),...w,children:me})}function Mc({href:e,className:t,onClick:r,children:n}){return jsx("a",{href:e,className:t,onClick:r,children:n})}function Ro({brand:e,onBrandClick:t,navItems:r=[],actions:n=[],linkComponent:o=Mc,height:a="h-12",mobileMenu:s=false,navMenuIcon:p,actionsMenuIcon:b,className:u,children:c}){let T=s&&r.length>0,x=s&&n.length>0,m="md:hidden rounded-md px-1.5 py-1.5 text-primary-500 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-200 [&_svg]:h-5 [&_svg]:w-5",g=h=>h?"text-primary-900 font-medium dark:text-primary-100":"text-primary-500 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-200 transition-colors",d="rounded-md p-1.5 text-primary-500 hover:bg-primary-100 hover:text-primary-700 dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200 transition-colors [&_svg]:h-5 [&_svg]:w-5",f=r.map((h,P)=>({key:typeof h.label=="string"?h.label:String(P),label:h.active?jsx("span",{className:"font-semibold text-primary-900 dark:text-primary-100",children:h.label}):h.label,onClick:()=>{h.onClick?h.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):h.href&&(window.location.href=h.href);}})),w=n.map((h,P)=>({key:h.key??String(P),label:jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[h.icon,jsx("span",{children:h.ariaLabel})]}),onClick:()=>{h.onClick?h.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):h.href&&(h.external?window.open(h.href,"_blank","noopener,noreferrer"):window.location.href=h.href);}}));return jsxs("header",{className:i("flex shrink-0 items-center justify-between border-b px-5","border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",a,u),children:[jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&jsx("div",{className:i("text-lg font-bold text-primary-800 dark:text-primary-100",t&&"cursor-pointer"),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),t(h));}:void 0,children:e}),T&&jsx(qt,{intent:"ghost",size:"sm",className:m,label:p??jsx(PanelLeft,{className:"h-5 w-5"}),items:f,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsx("nav",{className:i("flex items-center gap-4 text-sm",s?"hidden md:flex":"flex"),children:r.map((h,P)=>{let k=typeof h.label=="string"?h.label:P,N=g(h.active);return h.href?jsx(o,{href:h.href,className:N,onClick:h.onClick,children:h.label},k):jsx("button",{type:"button",className:i(N,"cursor-pointer"),onClick:h.onClick,children:h.label},k)})})]}),c&&jsx("div",{className:"flex items-center",children:c}),jsxs("div",{className:"flex items-center gap-1",children:[n.length>0&&jsx("div",{className:i("flex items-center gap-1",s?"hidden md:flex":"flex"),children:n.map((h,P)=>h.href?jsx("a",{href:h.href,target:h.external?"_blank":void 0,rel:h.external?"noopener noreferrer":void 0,className:d,"aria-label":h.ariaLabel,onClick:h.onClick,children:h.icon},h.key??P):jsx("button",{type:"button",className:d,"aria-label":h.ariaLabel,onClick:h.onClick,children:h.icon},h.key??P))}),x&&jsx(qt,{intent:"ghost",size:"sm",className:m,label:b??jsx(MoreHorizontal,{className:"h-5 w-5"}),items:w,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var tn=cva("inline-flex items-center gap-1 underline-offset-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/20 [&_svg]:shrink-0",{variants:{intent:{default:"text-primary-600 hover:text-primary-800 active:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:active:text-primary-100",secondary:"text-secondary-500 hover:text-secondary-700 active:text-secondary-800 dark:text-secondary-400 dark:hover:text-secondary-200 dark:active:text-secondary-100",muted:"text-primary-400 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-300"},size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},underline:{always:"underline",hover:"hover:underline",none:"no-underline"}},defaultVariants:{intent:"default",size:"md",underline:"none"}});function Lc(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var Ec=e=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,...e,children:[jsx("path",{d:"M15 3h6v6"}),jsx("path",{d:"M10 14 21 3"}),jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]});function Mo({intent:e,size:t,underline:r,external:n,className:o,children:a,href:s,target:p,rel:b,...u}){let c=n??Lc(s,p);return jsxs("a",{href:s,target:c&&!p?"_blank":p,rel:c&&!b?"noopener noreferrer":b,className:i(tn({intent:e,size:t,underline:r}),o),...u,children:[a,c&&jsx(Ec,{})]})}var Pc={SideNav:To,Header:Ro,NavLink:Mo},So=Pc;var nn=cva("flex w-full items-center justify-between font-medium transition-all [&_svg]:shrink-0",{variants:{size:{sm:"py-2 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-3 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-4 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),on=cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),an=cva("divide-y",{variants:{intent:{default:"divide-primary-300 dark:divide-primary-700",bordered:"divide-primary-300 rounded-lg border border-primary-300 bg-white px-3 shadow-sm dark:divide-primary-700 dark:border-primary-700 dark:bg-primary-800/50",ghost:"divide-transparent"}},defaultVariants:{intent:"default"}}),sn=cva("flex",{variants:{intent:{line:"border-b border-primary-200 dark:border-primary-700",pills:"gap-1 rounded-lg bg-primary-100 p-1 dark:bg-primary-800",underline:"gap-4"}},defaultVariants:{intent:"line"}}),ln=cva("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{intent:{line:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:data-[active=true]:text-primary-100",pills:"rounded-md text-primary-600 hover:text-primary-900 data-[active=true]:bg-white data-[active=true]:text-primary-900 data-[active=true]:shadow-sm dark:text-primary-400 dark:hover:text-primary-100 dark:data-[active=true]:bg-primary-700 dark:data-[active=true]:text-primary-100",underline:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:data-[active=true]:text-primary-100"}},defaultVariants:{intent:"line"}});var cn=createContext(null),Lo=createContext(null);function Eo({type:e="single",defaultValue:t=[],value:r,onValueChange:n,intent:o,size:a,className:s,children:p,...b}){let[u,c]=useState(t),T=r??u,x=useCallback(m=>{let g=d=>d.includes(m)?d.filter(f=>f!==m):e==="single"?[m]:[...d,m];n?n(g(T)):c(g);},[e,T,n]);return jsx(cn.Provider,{value:{expandedItems:T,toggleItem:x,size:a},children:jsx("div",{className:i(an({intent:o}),s),...b,children:p})})}function Hc({value:e,className:t,children:r,...n}){let a=useContext(cn)?.expandedItems.includes(e)??false;return jsx(Lo.Provider,{value:{value:e,isExpanded:a},children:jsx("div",{className:i("",t),...n,children:r})})}function Fc({className:e,children:t,...r}){let n=useContext(cn),o=useContext(Lo);return jsxs("button",{className:i("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 cursor-pointer gap-2 font-medium transition-colors",nn({size:n?.size}),e),onClick:()=>o&&n?.toggleItem(o.value),"aria-expanded":o?.isExpanded?"true":"false",...r,children:[jsx("span",{className:"flex items-center gap-1.5 [&_svg]:shrink-0",children:t}),jsx(ChevronDown,{className:i("shrink-0 transition-transform duration-200",o?.isExpanded&&"rotate-180")})]})}function Ac({className:e,children:t,...r}){let n=useContext(cn),o=useContext(Lo);return jsx("div",{className:i("grid transition-[grid-template-rows] duration-200 ease-out",o?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("div",{className:i("text-primary-500 dark:text-primary-400",on({size:n?.size}),e),...r,children:t})})})}var Mr=createContext(null),yi=createContext(false);function Po({defaultValue:e="",value:t,onValueChange:r,intent:n,children:o,className:a}){let[s,p]=useState(e),b=t??s,u=useRef(new Map),c=useCallback(x=>{r?r(x):p(x);},[r]),T=useCallback((x,m)=>{m?u.current.set(x,m):u.current.delete(x);},[]);return jsx(Mr.Provider,{value:{activeValue:b,setActiveValue:c,intent:n,registerTrigger:T},children:jsx("div",{className:a,children:o})})}function $c({className:e,scrollable:t,...r}){let n=useContext(Mr),o=useRef(null),[a,s]=useState(null),p=useCallback(()=>{if(!n||!o.current)return;let T=o.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!T){s(null);return}let x=o.current.getBoundingClientRect(),m=T.getBoundingClientRect();s({left:m.left-x.left,width:m.width});},[n]);useLayoutEffect(p,[n?.activeValue,p]),useEffect(()=>{let c=new ResizeObserver(p);return o.current&&c.observe(o.current),()=>c.disconnect()},[p]);let b=n?.intent??"line",u=a&&(b==="line"||b==="underline");return jsxs("div",{ref:o,className:i(sn({intent:n?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,u&&jsx("span",{className:"absolute bottom-0 h-0.5 rounded-full bg-primary-600 dark:bg-primary-400 transition-all duration-300 ease-in-out",style:{left:a.left,width:a.width},"aria-hidden":true})]})}function Oc({value:e,className:t,children:r,...n}){let o=useContext(Mr),a=o?.activeValue===e,s=useCallback(p=>o?.registerTrigger(e,p),[o,e]);return jsx("button",{ref:s,className:i(ln({intent:o?.intent}),t),role:"tab","data-active":a,"aria-selected":a,onClick:()=>o?.setActiveValue(e),...n,children:r})}function Kc({className:e,children:t,...r}){let n=useContext(Mr);if(!n)return null;let o=Nr.Children.toArray(t).filter(s=>Nr.isValidElement(s)),a=Math.max(0,o.findIndex(s=>s.props.value===n.activeValue));return jsx("div",{className:i("overflow-hidden",e),...r,children:jsx(yi.Provider,{value:true,children:jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${a*100}%)`},children:o.map((s,p)=>jsx("div",{className:"w-full shrink-0","aria-hidden":p!==a,children:s},s.props.value??p))})})})}function Wc({value:e,className:t,children:r,...n}){let o=useContext(Mr);return useContext(yi)?jsx("div",{className:i("pt-4",t),role:"tabpanel",...n,children:r}):o?.activeValue!==e?null:jsx("div",{className:i("pt-4",t),role:"tabpanel",...n,children:r})}var jc={Accordion:Eo,Tabs:Po},Vo=jc;var Sr=cva("rounded-lg bg-white p-6 shadow-xl dark:bg-primary-900",{variants:{size:{sm:"w-full max-w-sm",md:"w-full max-w-lg",lg:"w-full max-w-2xl",xl:"w-full max-w-4xl",full:"h-[calc(100vh-4rem)] w-[calc(100vw-4rem)]"}},defaultVariants:{size:"md"}}),mn=cva("absolute z-50 rounded px-2 py-1 text-xs shadow-md animate-fade-in",{variants:{intent:{default:"bg-primary-900 text-white dark:bg-primary-100 dark:text-primary-900",light:"border border-primary-200 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200"}},defaultVariants:{intent:"default"}});var wt=[];function Zc(e){wt.push(e);}function Jc(e){let t=wt.indexOf(e);t!==-1&&wt.splice(t,1);}function Io(e){return wt.length>0&&wt[wt.length-1]===e}function Qc(e){let t=wt.indexOf(e);return t!==-1?t:wt.length}var Ho=createContext(null);function Lr({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:o}){let a=useId();return useEffect(()=>{if(e)return Zc(a),()=>Jc(a)},[e,a]),useEffect(()=>{if(!e||!r)return;let s=p=>{p.key==="Escape"&&Io(a)&&t(false);};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,r,t,a]),useEffect(()=>{if(!e||!r)return;let s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s;}},[e,r]),e?jsx(Ho.Provider,{value:{id:a,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:createPortal(o,document.body)}):null}function Fo({size:e,position:t="center",className:r,children:n,...o}){let a=useContext(Ho);if(!a)return null;let p=200+Qc(a.id)*10,b=()=>{a.closeOnOutsideClick&&Io(a.id)&&a.onOpenChange(false);},u=t==="bottom";return a.modal?jsx("div",{className:i("animate-fade-in fixed inset-0 bg-black/50",u?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:p},onClick:b,children:jsx("div",{className:i(Sr({size:e}),u?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",r),role:"dialog","aria-modal":"true",onClick:c=>c.stopPropagation(),...o,children:n})}):jsx("div",{className:i("fixed inset-0 flex items-center justify-center p-4",a.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:p},onClick:a.closeOnOutsideClick&&Io(a.id)?()=>a.onOpenChange(false):void 0,children:jsx("div",{className:i(Sr({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:a.closeOnOutsideClick?c=>c.stopPropagation():void 0,...o,children:n})})}function Ao({className:e,...t}){return jsx("div",{className:i("mb-4 space-y-1",e),...t})}function zo({className:e,...t}){return jsx("h2",{className:i("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function Bo({className:e,...t}){return jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function _o({className:e,...t}){return jsx("div",{className:i("mt-6 flex justify-end gap-2",e),...t})}function ed({className:e,...t}){let r=useContext(Ho);return jsx("button",{className:i("text-primary-400 hover:text-primary-600 dark:hover:text-primary-200 absolute top-4 right-4 rounded-md p-1 transition-colors",e),onClick:()=>r?.onOpenChange(false),"aria-label":"Close",...t,children:jsx(X,{className:"h-4 w-4"})})}var td={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};function $o({content:e,position:t="top",intent:r,delay:n=200,maxWidth:o,children:a,className:s}){let[p,b]=useState(false),[u,c]=useState();return jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let m=setTimeout(()=>b(true),n);c(m);},onMouseLeave:()=>{clearTimeout(u),b(false);},children:[a,p&&jsx("span",{className:i(mn({intent:r}),td[t],"pointer-events-none",o?"whitespace-normal":"whitespace-nowrap",s),style:o!==void 0?{maxWidth:o}:void 0,role:"tooltip",children:e})]})}var od={Dialog:Lr,Tooltip:$o},Oo=od;var pn=cva("relative w-full overflow-hidden rounded-full bg-primary-200 dark:bg-primary-700",{variants:{size:{xs:"h-1",sm:"h-2",md:"h-3",lg:"h-4"},intent:{primary:"[&_.progress-fill]:bg-primary-500",success:"[&_.progress-fill]:bg-success-500",warning:"[&_.progress-fill]:bg-warning-500",danger:"[&_.progress-fill]:bg-danger-500"},edge:{none:"rounded-full",top:"fixed top-0 left-0 right-0 z-50 rounded-none",bottom:"fixed bottom-0 left-0 right-0 z-50 rounded-none"}},defaultVariants:{size:"md",intent:"primary",edge:"none"}}),rr=cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Er=cva("pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg transition-all",{variants:{intent:{success:"border-success-200 bg-success-50 text-success-800 dark:border-success-800 dark:bg-success-900/80 dark:text-success-200",warning:"border-warning-200 bg-warning-50 text-warning-800 dark:border-warning-800 dark:bg-warning-900/80 dark:text-warning-200",error:"border-danger-200 bg-danger-50 text-danger-800 dark:border-danger-800 dark:bg-danger-900/80 dark:text-danger-200",info:"border-primary-200 bg-primary-50 text-primary-800 dark:border-primary-800 dark:bg-primary-900/80 dark:text-primary-200"}},defaultVariants:{intent:"info"}});function Yo({intent:e,className:t,children:r,...n}){return jsx("div",{className:i(Er({intent:e}),t),role:"alert",...n,children:r})}function fd({className:e,...t}){return jsx("h5",{className:i("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function gd({className:e,...t}){return jsx("span",{className:i("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function hd({className:e,...t}){return jsx("div",{className:i("flex-1 min-w-0 space-y-1",e),...t})}function bd({className:e,...t}){return jsx("p",{className:i("text-sm opacity-90",e),...t})}var xd=0,Bt=[],un=new Map,Wo=new Set;function yd(){return Bt}function Xo(){Wo.forEach(e=>e());}function Go(e){let t=un.get(e);t&&(clearTimeout(t),un.delete(e)),Bt=Bt.map(r=>r.id===e?{...r,exiting:true}:r),Xo(),setTimeout(()=>{Bt=Bt.filter(r=>r.id!==e),Xo();},200);}function vd(e){let t=`alert-${++xd}`;Bt=[...Bt,{...e,id:t}],Xo();let r=e.duration??5e3;if(r>0){let n=setTimeout(()=>{un.delete(t),Go(t);},r);un.set(t,n);}return t}var jo=16;function wd(e){jo=e;}var kd={"top-right":"right-4 items-end","top-left":"left-4 items-start","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","top-center":"left-1/2 -translate-x-1/2 items-center","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},Nd={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-center":"animate-slide-in-bottom"},Cd={success:CircleCheck,warning:TriangleAlert,error:CircleX,info:Info};function Td({alert:e,onClose:t}){let r=e.intent??"info",n=Cd[r],o=e.position??"top-right";return jsxs("div",{className:i(Er({intent:r}),Nd[o],e.exiting&&"opacity-0 transition-opacity duration-200","w-80 max-w-[calc(100vw-2rem)]"),role:"alert",children:[jsx(n,{className:"mt-0.5 h-5 w-5 shrink-0"}),jsxs("div",{className:"flex-1",children:[e.title&&jsx("p",{className:"font-semibold",children:e.title}),jsx("p",{className:i(e.title&&"text-sm opacity-90"),children:e.message})]}),jsx("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:jsx(X,{className:"h-4 w-4"})})]})}var Rd=e=>e.startsWith("top");function Md(){let e=useSyncExternalStore(n=>(Wo.add(n),()=>Wo.delete(n)),yd),t=useRef(jo);if(useEffect(()=>{t.current=jo;},[]),e.length===0)return null;let r=e.reduce((n,o)=>{let a=o.position??"top-right";return (n[a]??(n[a]=[])).push(o),n},{});return createPortal(jsx(Fragment,{children:Object.entries(r).map(([n,o])=>jsx("div",{style:Rd(n)?{top:`${t.current}px`}:void 0,className:i("pointer-events-none fixed z-100 flex flex-col gap-2",kd[n]),children:o.map(a=>jsx(Td,{alert:a,onClose:()=>Go(a.id)},a.id))},n))}),document.body)}var Ni=false;function Sd(){if(Ni)return;Ni=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),createRoot(e).render(jsx(Md,{}));}function Ld(){return useEffect(()=>{Sd();},[]),{addAlert:vd,removeAlert:Go}}function qo({value:e=0,size:t,intent:r,edge:n,showLabel:o=false,indeterminate:a=false,animated:s=false,duration:p=500,className:b,...u}){let c=Math.max(0,Math.min(100,e)),[T,x]=useState(0),m=useRef(0);useEffect(()=>{if(!a)return m.current=requestAnimationFrame(()=>{x(c);}),()=>{m.current&&cancelAnimationFrame(m.current);}},[c,a]);let g=o&&!a&&t!=="xs"&&t!=="sm",d=jsx("div",{role:"progressbar","aria-valuenow":a?void 0:c,"aria-valuemin":0,"aria-valuemax":100,className:i(pn({size:t,intent:r,edge:n}),b),...u,children:a?jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsx("div",{className:i("progress-fill h-full rounded-full transition-[width] ease-out",s&&"animate-progress-shine"),style:{width:`${T}%`,transitionDuration:`${p}ms`},children:g&&jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(c),"%"]})})});return n==="top"||n==="bottom"?createPortal(d,document.body):d}function fn({size:e}){let t=e==="sm"?20:e==="lg"?40:28;return jsx("svg",{className:"animate-spin-rotate",width:t,height:t,viewBox:"0 0 50 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{className:"animate-spin-dash stroke-current",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"4",strokeLinecap:"round",strokeDasharray:"90 150",strokeDashoffset:"0"})})}function Jo({spinning:e=true,tip:t,size:r,className:n,children:o,...a}){return o?jsxs("div",{className:i("relative w-fit",n),...a,children:[jsx("div",{className:i("transition-all duration-200",e&&"pointer-events-none select-none blur-[1px]"),children:o}),e&&jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsx(fn,{size:r}),t&&jsx("span",{className:i(rr({size:r}),"select-none"),children:t})]})]}):e?jsxs("div",{className:i("inline-flex flex-col items-center gap-2",n),...a,children:[jsx(fn,{size:r}),t&&jsx("span",{className:i(rr({size:r}),"select-none"),children:t})]}):null}var zd=0,Vr=[],Zo=new Set;function Bd(){return Vr}function Li(){Zo.forEach(e=>e());}function _d(e,t){let r=++zd;return Vr=[...Vr,{id:r,target:e,tip:t}],Li(),()=>$d(r)}function $d(e){Vr=Vr.filter(t=>t.id!==e),Li();}function Od(){return _d}var Mi=false;function Kd(){if(Mi||typeof document>"u")return;Mi=true;let e=document.createElement("div");e.id="jac-spin-portal",document.body.appendChild(e),import('react-dom/client').then(({createRoot:t})=>{t(e).render(jsx(Yd,{}));});}var gn=new Map;function Wd(e){let t=gn.get(e);if(t){t.count++;return}let r=getComputedStyle(e),n=e.style.position;r.position==="static"&&(e.style.position="relative"),gn.set(e,{count:1,original:n});}function Xd(e){let t=gn.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,gn.delete(e)));}function jd({entry:e}){return useEffect(()=>{let t=e.target;if(!Si(t))return Wd(t),()=>Xd(t)},[e.target]),Si(e.target)?createPortal(jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-primary-900/40 dark:bg-primary-900/60",children:[jsx(fn,{size:"lg"}),e.tip&&jsx("span",{className:"select-none text-sm text-primary-100",children:e.tip})]}),document.body):createPortal(jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsx(fn,{size:"md"}),e.tip&&jsx("span",{className:i(rr({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function Yd(){let e=useSyncExternalStore(t=>(Zo.add(t),()=>Zo.delete(t)),()=>Bd());return e.length===0?null:jsx(Fragment,{children:e.map(t=>jsx(jd,{entry:t},t.id))})}function Si(e){return e===document.documentElement||e===document.body}typeof document<"u"&&Kd();var Ud={Alert:Yo,ProgressBar:qo,Spin:Jo},Qo=Ud;var Di="#1c1914",Ii="#130f0b",mm="#2e261e",ta="#504638",nr="#6b5d4d",bn=`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,pm=[{key:"like",icon:jsx(Heart,{className:"h-5 w-5"}),activeIcon:jsx(Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsx(ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsx(Bookmark,{className:"h-5 w-5"}),activeIcon:jsx(Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsx(Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsx(Download,{className:"h-5 w-5"}),label:"Download"}];function ra({photos:e,layout:t="strip",actions:r=pm,onAction:n,className:o,showGrain:a=true,sheetTitle:s,sheetLabel:p}){let[b,u]=useState(null),[c,T]=useState(new Set),x=useCallback(f=>u(f),[]),m=useCallback(()=>u(null),[]),g=useCallback((f,w)=>{if(r.find(P=>P.key===f)?.toggle){let P=`${w}-${f}`;T(k=>{let N=new Set(k);return N.has(P)?N.delete(P):N.add(P),N});}n?.(f,e[w],w);},[r,n,e]);return jsxs(Fragment,{children:[jsx(t==="strip"?um:t==="sheet"?fm:gm,{photos:e,onPhotoClick:x,showGrain:a,className:o,sheetTitle:s,sheetLabel:p}),b!==null&&createPortal(jsx(hm,{photos:e,currentIndex:b,onIndexChange:u,onClose:m,actions:r,activeActions:c,onAction:g,showGrain:a}),document.body)]})}function Vi({count:e=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Di},children:Array.from({length:e}).map((t,r)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:mm}},r))})}function um({photos:e,onPhotoClick:t,showGrain:r,className:n}){let o=useRef(null);return jsxs("div",{className:i("select-none rounded-lg overflow-hidden",n),style:{background:Ii},children:[jsx(Vi,{count:Math.max(30,e.length*6)}),jsx("div",{ref:o,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Di,scrollSnapType:"x mandatory"},children:e.map((a,s)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(s),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:ta,width:280,height:187},children:[jsx("img",{src:a.src,alt:a.alt??a.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),jsx("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:bn,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:nr},children:[String(s+1).padStart(2,"0"),s%2===0?"":"A"]})]},s))}),jsx(Vi,{count:Math.max(30,e.length*6)})]})}function fm({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:o,sheetLabel:a}){return jsxs("div",{className:i("rounded-lg p-5",n),style:{background:Ii},children:[jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:nr},children:o??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:nr},children:a??"Contact Sheet"})]}),jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((s,p)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${p*50}ms both`},onClick:()=>t(p),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:nr},children:String(p+1).padStart(2,"0")}),jsxs("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:ta,aspectRatio:"3/2"},children:[jsx("img",{src:s.src,alt:s.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:bn}}),jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:jsx("span",{className:"text-xs font-medium text-white/90",children:s.title})})]})]},p))})]})}function gm({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[o,a]=useState(false),[s,p]=useState(null),b=Math.min(e.length,8),u=e.slice(0,b),c=x=>{let m=Math.sin(x*137.508+1)*1e4,g=(m%12-6).toFixed(1),d=(m/7%8-4).toFixed(1),f=(m/13%6-3).toFixed(1);return `rotate(${g}deg) translate(${d}px, ${f}px)`},T=(x,m)=>{let g=(m-1)/2,d=((x-g)*7).toFixed(1),f=((x-g)*110).toFixed(0),w=(-Math.abs(x-g)*10+(s===x?-18:0)).toFixed(0);return `translateX(${f}px) translateY(${w}px) rotate(${d}deg)`};return jsxs("div",{className:i("flex flex-col items-center gap-4",n),children:[jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>a(true),onMouseLeave:()=>{a(false),p(null);},children:u.map((x,m)=>jsx("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:o?`${m*35}ms`:`${(b-m)*25}ms`,transform:o?T(m,u.length):c(m),zIndex:o?m+1:u.length-m,width:220,height:147},onClick:()=>t(m),onMouseEnter:()=>o&&p(m),onMouseLeave:()=>p(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:o&&s===m?"rgba(217,171,89,0.5)":ta,boxShadow:o&&s===m?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[jsx("img",{src:x.src,alt:x.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:bn}}),jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),o&&s===m&&jsx("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:jsx("span",{className:"text-sm font-medium text-white/90",children:x.title})})]})},m))}),e.length>b&&jsxs("span",{className:"font-mono text-xs",style:{color:nr},children:["+ ",e.length-b," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:nr,opacity:o?0:.7},children:"Hover to explore"})]})}function hm({photos:e,currentIndex:t,onIndexChange:r,onClose:n,actions:o,activeActions:a,onAction:s,showGrain:p}){let b=e[t],[u,c]=useState(1),[T,x]=useState({x:0,y:0}),[m,g]=useState(false),[d,f]=useState(false),w=useRef(false),h=useRef({x:0,y:0}),P=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>f(true));},[]),useEffect(()=>{let y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y;}},[]),useEffect(()=>{let y=O=>{switch(O.key){case "Escape":n();break;case "ArrowLeft":k(-1);break;case "ArrowRight":k(1);break;case "i":case "I":g(v=>!v);break}};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)}),useEffect(()=>{let y=P.current;if(!y)return;let O=v=>{v.preventDefault();let ne=v.deltaY<0?1.12:.89;c(C=>{let re=Math.min(8,Math.max(1,C*ne));return re<=1&&x({x:0,y:0}),re});};return y.addEventListener("wheel",O,{passive:false}),()=>y.removeEventListener("wheel",O)},[]);let k=useCallback(y=>{let O=t+y;O>=0&&O<e.length&&(r(O),c(1),x({x:0,y:0}));},[t,e.length,r]),N=useCallback(y=>{u<=1||(w.current=true,h.current={x:y.clientX,y:y.clientY},y.target.setPointerCapture(y.pointerId));},[u]),F=useCallback(y=>{if(!w.current)return;let O=y.clientX-h.current.x,v=y.clientY-h.current.y;h.current={x:y.clientX,y:y.clientY},x(ne=>({x:ne.x+O/u,y:ne.y+v/u}));},[u]),R=useCallback(()=>{w.current=false;},[]),E=useCallback(()=>{u>1?(c(1),x({x:0,y:0})):c(2.5);},[u]),A=y=>a.has(`${t}-${y}`),H=b.metadata;return jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsx("div",{className:"absolute inset-0 bg-black/95",onClick:n}),p&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:bn,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[u.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>c(y=>Math.min(8,y*1.3)),title:"Zoom in",children:jsx(ZoomIn,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{c(y=>{let O=Math.max(1,y*.7);return O<=1&&x({x:0,y:0}),O});},title:"Zoom out",children:jsx(ZoomOut,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:n,title:"Close",children:jsx(X,{className:"h-5 w-5"})})]})]}),jsxs("div",{ref:P,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:u>1?"grab":"default"},onPointerDown:N,onPointerMove:F,onPointerUp:R,onDoubleClick:E,children:[jsx("img",{src:b.src,alt:b.alt??b.title??"",className:"max-h-full max-w-full select-none object-contain",style:{animation:"lightbox-photo-in 0.35s cubic-bezier(0.16, 1, 0.3, 1)",transform:`scale(${u}) translate(${T.x}px, ${T.y}px)`,transition:w.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),k(-1);},children:jsx(ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),k(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:i("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",m?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[b.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:b.title}),b.description&&jsx("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:b.description}),H&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[H.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.camera,H.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),H.lens&&H.lens]}),(H.aperture||H.shutter||H.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[H.aperture,H.shutter,H.iso&&`ISO ${H.iso}`].filter(Boolean).join(" \xB7 ")]}),H.date&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.date]}),H.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.location]})]})]})}),jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[o.map(y=>{let O=y.toggle&&A(y.key);return jsx("button",{className:i("rounded-full p-2.5 transition-all duration-200",O?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>s(y.key,t),title:y.label,children:O&&y.activeIcon?y.activeIcon:y.icon},y.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:i("rounded-full p-2.5 transition-all duration-200",m?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>g(y=>!y),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var na="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
|
|
1
|
+
import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import qr,{createContext,useSyncExternalStore,useEffect,useState,useRef,useCallback,useMemo,useId,useContext,useLayoutEffect}from'react';import {Heart,ThumbsDown,Bookmark,Share2,Download,Info,CheckCircle,AlertTriangle,AlertCircle,X,ChevronDown,Check,Inbox,Plus,Trash2,Pencil,ArrowUpDown,ArrowUp,ArrowDown,ChevronRight,Minus,TrendingDown,TrendingUp,Menu,ChevronsLeft,ChevronLeft,PanelLeft,MoreHorizontal,Home,ChevronsRight,ChevronUp,ZoomIn,ZoomOut,Camera,Aperture,Calendar,MapPin,ListMusic,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3,ListVideo,Theater,Minimize,Maximize,HardDrive,LayoutGrid,LayoutList,Minimize2,Maximize2,FolderUp,Search,CornerRightDown,Folder,Command,Clock,XCircle,CheckCircle2,Bell,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File,Dot,CircleX,TriangleAlert,CircleCheck}from'lucide-react';import {createPortal}from'react-dom';import {createRoot}from'react-dom/client';function s(...e){return twMerge(clsx(e))}var ur=cva("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-500 text-white hover:bg-primary-600 active:bg-primary-700",secondary:"bg-secondary-500 text-white hover:bg-secondary-600 active:bg-secondary-700",danger:"bg-danger-500 text-white hover:bg-danger-600 active:bg-danger-700",warning:"bg-warning-500 text-white hover:bg-warning-600 active:bg-warning-700",ghost:"bg-transparent text-primary-700 hover:bg-primary-100 active:bg-primary-200 dark:text-primary-300 dark:hover:bg-primary-800",outline:"border border-primary-300 bg-transparent text-primary-700 hover:bg-primary-50 dark:border-primary-600 dark:text-primary-300 dark:hover:bg-primary-800"},size:{sm:"h-7 px-3 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"h-9 px-4 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"h-11 px-6 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{intent:"primary",size:"md"}}),Nn=cva("inline-flex items-center gap-1 rounded border font-semibold [&_svg]:shrink-0",{variants:{intent:{success:"border-success-200 bg-success-100 text-success-800 dark:border-success-800 dark:bg-success-900/30 dark:text-success-400",warning:"border-warning-200 bg-warning-100 text-warning-800 dark:border-warning-800 dark:bg-warning-900/30 dark:text-warning-400",error:"border-danger-200 bg-danger-100 text-danger-800 dark:border-danger-800 dark:bg-danger-900/30 dark:text-danger-400",info:"border-primary-200 bg-primary-100 text-primary-800 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-400",primary:"border-secondary-200 bg-secondary-100 text-secondary-700 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-300"},size:{sm:"px-1.5 py-0 text-[0.625rem] [&_svg]:h-2.5 [&_svg]:w-2.5",md:"px-2.5 py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",lg:"px-3 py-1 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5"}},defaultVariants:{intent:"primary",size:"md"}}),Cn=cva("absolute flex items-center justify-center rounded-full font-bold leading-none ring-2 ring-white select-none pointer-events-none z-10 dark:ring-primary-900",{variants:{intent:{danger:"bg-danger-500 text-white",success:"bg-success-500 text-white",warning:"bg-warning-500 text-white",info:"bg-primary-500 text-white",primary:"bg-secondary-500 text-white"},size:{sm:"text-[0.5rem]",md:"text-[0.625rem]",lg:"text-xs"},dot:{true:"",false:""},placement:{"top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2"}},compoundVariants:[{dot:true,size:"sm",class:"h-1.5 w-1.5 min-w-0 ring-1"},{dot:true,size:"md",class:"h-2 w-2 min-w-0"},{dot:true,size:"lg",class:"h-2.5 w-2.5 min-w-0"},{dot:false,size:"sm",class:"h-4 min-w-4 px-1"},{dot:false,size:"md",class:"h-5 min-w-5 px-1.5"},{dot:false,size:"lg",class:"h-6 min-w-6 px-2"}],defaultVariants:{intent:"danger",size:"md",dot:false,placement:"top-right"}}),fr=cva("w-full rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none focus:ring-2 dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",{variants:{state:{default:"border-secondary-300 focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 py-2 text-sm",lg:"h-11 px-4 py-2.5 text-base"}},defaultVariants:{state:"default",size:"md"}}),Tn=cva("inline-flex items-center gap-1 font-medium [&_svg]:shrink-0",{variants:{size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},intent:{default:"text-primary-700 dark:text-primary-300",muted:"text-primary-400 dark:text-primary-500",required:"text-primary-700 dark:text-primary-300 after:ml-0.5 after:text-danger-500 after:content-['*']"}},defaultVariants:{size:"md",intent:"default"}}),Mn=cva("relative inline-flex shrink-0 items-center justify-center rounded border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4 rounded-[3px]",md:"h-5 w-5 rounded",lg:"h-6 w-6 rounded-[5px]"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Rn=cva("relative inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Sn=cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Br=cva("bg-primary-200 text-primary-700 dark:bg-primary-700 dark:text-primary-200",{variants:{size:{xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base",xl:"h-16 w-16 text-lg"},shape:{circular:"rounded-full",rounded:"rounded-lg",square:"rounded-none"}},defaultVariants:{size:"md",shape:"circular"}}),Or=cva("relative flex w-full touch-none select-none items-center",{variants:{intent:{primary:"[&_.slider-fill]:bg-primary-500 [&_.slider-thumb]:border-primary-500",secondary:"[&_.slider-fill]:bg-secondary-500 [&_.slider-thumb]:border-secondary-500",success:"[&_.slider-fill]:bg-success-500 [&_.slider-thumb]:border-success-500",danger:"[&_.slider-fill]:bg-danger-500 [&_.slider-thumb]:border-danger-500",warning:"[&_.slider-fill]:bg-warning-500 [&_.slider-thumb]:border-warning-500"},size:{sm:"h-4",md:"h-5",lg:"h-6"}},defaultVariants:{intent:"primary",size:"md"}}),Pn=cva("inline-flex items-center gap-1 rounded-full font-medium select-none transition-colors [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-100 text-primary-700 dark:bg-primary-800 dark:text-primary-200",secondary:"bg-secondary-100 text-secondary-700 dark:bg-secondary-800 dark:text-secondary-200",success:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",danger:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",warning:"bg-warning-100 text-warning-700 dark:bg-warning-900/40 dark:text-warning-300",info:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"},size:{sm:"h-5 px-2 text-[0.6875rem] gap-0.5",md:"h-6 px-2.5 text-xs gap-1",lg:"h-7 px-3 text-sm gap-1"},variant:{solid:"",outline:"bg-transparent border",soft:""}},compoundVariants:[{intent:"primary",variant:"outline",class:"border-primary-300 text-primary-700 dark:border-primary-600 dark:text-primary-300"},{intent:"secondary",variant:"outline",class:"border-secondary-300 text-secondary-700 dark:border-secondary-600 dark:text-secondary-300"},{intent:"success",variant:"outline",class:"border-success-400 text-success-700 dark:border-success-600 dark:text-success-300"},{intent:"danger",variant:"outline",class:"border-danger-400 text-danger-700 dark:border-danger-600 dark:text-danger-300"},{intent:"warning",variant:"outline",class:"border-warning-400 text-warning-700 dark:border-warning-600 dark:text-warning-300"},{intent:"info",variant:"outline",class:"border-blue-400 text-blue-700 dark:border-blue-600 dark:text-blue-300"}],defaultVariants:{intent:"primary",size:"md",variant:"solid"}});cva("relative w-full cursor-pointer rounded-md border bg-white text-sm transition-colors dark:bg-primary-900",{variants:{intent:{default:"border-primary-300 text-primary-900 hover:border-primary-400 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-primary-600 dark:text-primary-100 dark:hover:border-primary-500 dark:focus-within:border-primary-400",danger:"border-danger-500 text-primary-900 focus-within:ring-2 focus-within:ring-danger-500/20 dark:border-danger-500 dark:text-primary-100"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 text-sm",lg:"h-11 px-4 text-base"}},defaultVariants:{intent:"default",size:"md"}});function gr({intent:e,size:t,className:r,...n}){return jsx("button",{className:s(ur({intent:e,size:t}),r),...n})}function Ua(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let n=Ua(r.children,t);if(n)return n}}}function qa(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(...qa(r.children));return t}var Vn=40,Qc=200,Qa=150,ps=120;function En(e,t,r,n){if(!n)return {};if(r){let i=(t-1-e)*Vn;return {animation:`dropdown-item-out ${Qa}ms ease-in both ${i}ms`}}let a=e*Vn;return {animation:`dropdown-item-in ${Qc}ms ease-out both ${a}ms`}}function us(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Vn+Qa;return {animation:`dropdown-container-out ${ps}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function fs({options:e,onSelect:t,animated:r=true,closing:n=false,depth:a=0}){let[i,o]=useState(null),l=useRef(void 0),c=d=>{l.current&&clearTimeout(l.current),o(d);},m=()=>{l.current=setTimeout(()=>o(null),150);};return useEffect(()=>()=>{l.current&&clearTimeout(l.current);},[]),jsx("div",{className:s("absolute z-50 min-w-44 rounded-md border py-1 shadow-lg overflow-hidden","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",a===0?"mt-1 w-full":"top-0 ml-0.5"),style:{...a>0?{left:"100%"}:{},...us(e.length,n,r)},role:"listbox",children:e.map((d,f)=>{let p=!!d.children?.length,u=i===d.value;return jsxs("div",{className:"relative",style:En(f,e.length,n,r),onMouseEnter:()=>c(d.value),onMouseLeave:m,children:[jsxs("div",{role:"option","aria-selected":false,"aria-disabled":d.disabled,className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",d.disabled&&"pointer-events-none opacity-50"),onClick:()=>{d.disabled||p||t(d.value,d);},children:[d.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:d.icon}),jsx("span",{className:"flex-1 truncate",children:d.label??d.value}),p&&jsx(ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),p&&u&&jsx(fs,{options:d.children,onSelect:t,animated:r,depth:a+1})]},d.value)})})}function Zc({options:e,filter:t,multiple:r,selected:n,canAdd:a,animated:i=true,closing:o=false,onSelect:l,onToggle:c,onAdd:m}){let d=useMemo(()=>qa(e),[e]),f=t.toLowerCase(),p=t?d.filter(g=>(g.label??g.value).toLowerCase().includes(f)||g.value.toLowerCase().includes(f)):d,u=p.length===0&&!a||a?1:0,h=p.length+u;return jsxs("div",{className:s("absolute z-50 mt-1 w-full max-h-60 min-w-44 overflow-y-auto rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white"),role:"listbox","aria-multiselectable":r||void 0,style:us(h,o,i),children:[p.map((g,b)=>{let N=r&&n.includes(g.value);return jsxs("div",{role:"option","aria-selected":r?N:false,"aria-disabled":g.disabled,className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",g.disabled&&"pointer-events-none opacity-50"),style:En(b,h,o,i),onClick:()=>{g.disabled||(r?c(g.value):l(g.value,g));},children:[r&&jsx("span",{className:s("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",N?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:N&&jsx(Check,{className:"h-3 w-3"})}),g.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:g.icon}),jsx("span",{className:"truncate",children:g.label??g.value})]},g.value)}),p.length===0&&!a&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:En(0,1,o,i),children:"No matches"}),a&&jsxs("div",{className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:En(p.length,h,o,i),onClick:m,children:[jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxs("span",{className:"truncate",children:["Add \u201C",t.trim(),"\u201D"]})]})]})}function Za(e){let{options:t,placeholder:r="Select\u2026",editable:n=false,onAddItem:a,disabled:i=false,align:o="left",className:l,size:c="md",animated:m=true,name:d,intent:f="default",clearable:p=false,id:u,"aria-describedby":h,"aria-invalid":g}=e,b=e.multiple===true,[N,x]=useState(b?void 0:e.defaultValue),[T,w]=useState(b?e.defaultSelected??[]:[]),C=b?e.selected??T:[],[S,R]=useState(false),[V,I]=useState(false),[E,v]=useState(""),U=useRef(null),k=useRef(null),q=useRef(void 0),M=useCallback(()=>{if(!m||!S){R(false),v("");return}I(true);let ee=(Math.max(t.length,1)-1)*Vn+Qa+ps+20;q.current=setTimeout(()=>{R(false),I(false),v("");},ee);},[m,S,t.length]);useEffect(()=>()=>{q.current&&clearTimeout(q.current);},[]);let W=b?void 0:e.value??N,$=useMemo(()=>W?Ua(t,W):void 0,[t,W]);useEffect(()=>{if(!S)return;let _=ee=>{U.current&&!U.current.contains(ee.target)&&M();};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[S,M]),useEffect(()=>{if(!S)return;let _=ee=>{ee.key==="Escape"&&M();};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[S,M]);let ue=useCallback((_,ee)=>{b||(e.value===void 0&&x(_),e.onChange?.(_,ee)),q.current&&clearTimeout(q.current),R(false),I(false),v("");},[b,e]),J=useCallback(_=>{if(!b)return;let ee=e.selected??T,xe=ee.includes(_)?ee.filter(P=>P!==_):[...ee,_];e.selected===void 0&&w(xe),e.onSelectionChange?.(xe),e.onChange?.(xe);},[b,T,e]),de=E.toLowerCase(),re=useMemo(()=>!n||!E.trim()?false:!qa(t).some(ee=>ee.value.toLowerCase()===de||(ee.label??ee.value).toLowerCase()===de),[n,de,t]),B=useCallback(()=>{let _=E.trim();_&&(a?.(_),v(""));},[E,a]),j=useCallback(_=>{_.stopPropagation(),b?(w([]),e.onSelectionChange?.([]),e.onChange?.([])):(x(void 0),e.onChange?.("",void 0));},[b,e]),pe=useCallback(_=>{_.key==="Enter"&&re&&(_.preventDefault(),B());},[re,B]),ye=useCallback(()=>{i||(S?M():(q.current&&clearTimeout(q.current),I(false),R(true),v(""),n&&requestAnimationFrame(()=>k.current?.focus())));},[i,S,M,n]),y;if(b){let _=C.length;_===0?y="":_<=2?y=C.map(ee=>Ua(t,ee)).map(ee=>ee?ee.label??ee.value:"").filter(Boolean).join(", "):y=`${_} selected`;}else y=$?$.label??$.value:"";let L=b||n,G=f==="danger"||g===true,O=p&&(b?C.length>0:!!y);return jsxs("div",{ref:U,className:s("relative inline-block min-w-44",l),children:[d&&!b&&jsx("input",{type:"hidden",name:d,value:W??""}),d&&b&&C.map(_=>jsx("input",{type:"hidden",name:`${d}[]`,value:_},_)),u&&!n&&jsx("input",{type:"text",id:u,className:"sr-only",readOnly:true,tabIndex:-1,value:y??"",onChange:()=>{}}),jsxs("div",{className:s(fr({state:G?"error":"default",size:c}),"flex cursor-pointer items-center gap-1",i&&"pointer-events-none opacity-50"),onClick:ye,role:"combobox","aria-expanded":S,"aria-haspopup":"listbox","aria-invalid":G||void 0,"aria-describedby":h,children:[n?jsx("input",{ref:k,id:u,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:S?E:y,placeholder:r,disabled:i,onChange:_=>{v(_.target.value),S||R(true);},onKeyDown:pe,onClick:_=>{_.stopPropagation(),S||R(true);}}):jsx("span",{className:s("flex-1 truncate",!y&&"text-secondary-400 dark:text-secondary-600"),children:y||r}),$?.icon&&!n&&!b&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:$.icon}),b&&C.length>0&&jsx("span",{className:"rounded-full bg-primary-100 px-1.5 text-xs font-semibold text-primary-700 dark:bg-primary-900 dark:text-primary-300",children:C.length}),O&&jsx("button",{type:"button","aria-label":"Clear selection",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-secondary-400 transition-colors hover:bg-secondary-200 hover:text-secondary-600 dark:hover:bg-secondary-700 dark:hover:text-secondary-300",onClick:j,children:jsx(X,{className:"h-3 w-3"})}),jsx(ChevronDown,{className:s("text-primary-400 h-4 w-4 shrink-0 transition-transform",S&&"rotate-180")})]}),S&&jsx("div",{className:s(o==="right"?"right-0":"left-0","absolute w-full"),children:L?jsx(Zc,{options:t,filter:E,multiple:b,selected:C,canAdd:re,animated:m,closing:V,onSelect:ue,onToggle:J,onAdd:B}):jsx(fs,{options:t,onSelect:ue,animated:m,closing:V})})]})}function rd(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var In=40,nd=200,no=150,bs=120;function ro(e,t,r,n){if(!n)return {};if(r){let i=(t-1-e)*In;return {animation:`dropdown-item-out ${no}ms ease-in both ${i}ms`}}let a=e*In;return {animation:`dropdown-item-in ${nd}ms ease-out both ${a}ms`}}function ad(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*In+no;return {animation:`dropdown-container-out ${bs}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function hr({label:e,items:t,intent:r,size:n,align:a="left",className:i,disabled:o,editable:l=false,onAddItem:c,multiple:m=false,selected:d=[],onSelectionChange:f,animated:p=true,chevron:u=true,...h}){let[g,b]=useState(false),[N,x]=useState(false),[T,w]=useState(""),C=useRef(null),S=useRef(null),R=useRef(void 0);useEffect(()=>()=>{R.current&&clearTimeout(R.current);},[]);let V=useCallback(()=>{if(!p||!g){b(false),w("");return}x(true);let de=(Math.max(t.length,1)-1)*In+no+bs+20;R.current=setTimeout(()=>{b(false),x(false),w("");},de);},[p,g,t.length]),I=useCallback(()=>{o||(g?V():(R.current&&clearTimeout(R.current),x(false),b(true),w(""),l&&requestAnimationFrame(()=>S.current?.focus())));},[o,g,V,l]);useEffect(()=>{if(!g)return;let J=de=>{C.current&&!C.current.contains(de.target)&&V();};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[g,V]),useEffect(()=>{if(!g)return;let J=de=>{de.key==="Escape"&&V();};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[g,V]);let E=T.toLowerCase(),v=useMemo(()=>T?t.filter(J=>(typeof J.label=="string"?J.label:J.key??"").toLowerCase().includes(E)):t,[t,E]),U=useMemo(()=>!l||!T.trim()?false:!t.some(J=>(typeof J.label=="string"?J.label:J.key??"").toLowerCase()===E),[l,E,t]),k=useCallback(()=>{let J=T.trim();J&&(c?.(J),w(""));},[T,c]),q=useCallback(J=>{J.key==="Enter"&&U&&(J.preventDefault(),k());},[U,k]),M=useCallback(J=>{let de=d.includes(J)?d.filter(re=>re!==J):[...d,J];f?.(de);},[d,f]),W=m&&d.length>0?jsxs(Fragment,{children:[e," ",jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:d.length})]}):e,$=v.length===0&&!U||U?1:0,ue=v.length+$;return jsxs("div",{ref:C,className:"relative inline-block",children:[jsxs("button",{type:"button",onClick:I,disabled:o,className:s(ur({intent:r,size:n}),"inline-flex items-center gap-1",i),"aria-haspopup":m?"listbox":"true","aria-expanded":g?"true":"false",...h,children:[W,u&&jsx(ChevronDown,{className:s("h-3.5 w-3.5 transition-transform",g&&"rotate-180")})]}),g&&jsxs("div",{className:s("absolute z-50 mt-1 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",a==="right"?"right-0":"left-0"),style:ad(ue,N,p),role:m?"listbox":"menu","aria-multiselectable":m||void 0,children:[l&&jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsx("input",{ref:S,type:"text",value:T,onChange:J=>w(J.target.value),onKeyDown:q,placeholder:"Type to filter or add\u2026",className:"w-full bg-transparent text-sm text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600"})}),jsxs("div",{className:"max-h-60 overflow-y-auto",children:[v.map((J,de)=>{let re=rd(J,de),B=m&&d.includes(re);return jsxs(qr.Fragment,{children:[J.divider&&jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxs("button",{type:"button",role:m?"option":"menuitem","aria-selected":m?B:void 0,disabled:J.disabled,className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",J.disabled&&"pointer-events-none opacity-50"),style:ro(de,ue,N,p),onClick:()=>{m?M(re):(J.onClick?.(),R.current&&clearTimeout(R.current),b(false),x(false),w(""));},children:[m&&jsx("span",{className:s("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",B?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:B&&jsx(Check,{className:"h-3 w-3"})}),jsx("span",{className:"flex-1 truncate",children:J.label})]})]},re)}),v.length===0&&!U&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:ro(0,1,N,p),children:"No matches"}),U&&jsxs("button",{type:"button",className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:ro(v.length,ue,N,p),onClick:k,children:[jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxs("span",{className:"truncate",children:["Add \u201C",T.trim(),"\u201D"]})]})]})]})]})}function ao({intent:e,size:t,className:r,...n}){return jsx("span",{className:s(Nn({intent:e,size:t}),r),...n})}function oo({intent:e,size:t,variant:r,icon:n,removable:a,onRemove:i,disabled:o,dot:l,className:c,children:m,...d}){return jsxs("span",{className:s(Pn({intent:e,size:t,variant:r}),o&&"pointer-events-none opacity-50",c),"aria-disabled":o,...d,children:[l&&jsx("span",{className:s("inline-block h-1.5 w-1.5 shrink-0 rounded-full",e==="success"&&"bg-success-500",e==="danger"&&"bg-danger-500",e==="warning"&&"bg-warning-500",(!e||e==="primary")&&"bg-primary-500",e==="secondary"&&"bg-secondary-500",e==="info"&&"bg-blue-500")}),n&&jsx("span",{className:"shrink-0 [&_svg]:h-[1em] [&_svg]:w-[1em]",children:n}),m&&jsx("span",{children:m}),a&&jsx("button",{type:"button","aria-label":"Remove tag",onClick:f=>{f.stopPropagation(),i?.();},disabled:o,className:s("ml-0.5 -mr-0.5 inline-flex items-center justify-center rounded-full p-0.5 transition-colors hover:bg-black/10 dark:hover:bg-white/20 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current"),children:jsx(X,{className:"h-[0.75em] w-[0.75em]"})})]})}var cd={danger:"bg-danger-500",success:"bg-success-500",warning:"bg-warning-500",info:"bg-primary-500",primary:"bg-secondary-500"};function io({children:e,show:t=true,content:r,dot:n,intent:a="danger",size:i="md",placement:o="top-right",pulse:l=false,className:c}){let m=n??r==null,d=m?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxs("span",{className:s(Cn({intent:a,size:i,dot:m,placement:o}),c),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[l&&jsx("span",{className:s("absolute inset-0 rounded-full animate-ping opacity-60",cd[a??"danger"]),"aria-hidden":"true"}),d]})]})}function so({intent:e,size:t,className:r,...n}){return jsx("label",{className:s(Tn({intent:e,size:t}),r),...n})}var pd={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},ud={default:"border-secondary-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus-within:border-danger-500 focus-within:ring-2 focus-within:ring-danger-500/20"};function lo({state:e="default",inputSize:t="md",className:r,prefix:n,suffix:a,action:i,...o}){if(!n&&!a&&!i)return jsx("input",{className:s(fr({state:e,size:t}),r),...o});let l=pd[t??"md"],c=ud[e??"default"];return jsxs("div",{className:s("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",l.wrapper,c,r),children:[n&&jsx("span",{className:s("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",l.prefix),children:n}),jsx("input",{className:s("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",l.input,n&&"pl-2"),...o}),a&&jsx("span",{className:s("flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",l.icon),children:a}),i&&jsx("button",{type:"button",onClick:i.onClick,"aria-label":i["aria-label"]??"Action",className:s("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",l.icon),children:i.icon})]})}var yd={sm:"px-2 py-1.5 text-xs min-h-[60px]",md:"px-3 py-2 text-sm min-h-[80px]",lg:"px-4 py-2.5 text-base min-h-[100px]"},xd={default:"border-secondary-400 focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-2 focus:ring-danger-500/20"};function vd(e){if(!e)return 0;let t="\u2E80-\u2EFF\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF",r=new RegExp(`[${t}]`),n=0,a="",i=()=>{let o=a.trim();o&&(n+=o.split(/\s+/).length),a="";};for(let o of e)r.test(o)?(i(),n+=1):a+=o;return i(),n}function co({state:e="default",size:t="md",showWordCount:r=false,maxWords:n,className:a,value:i,defaultValue:o,onChange:l,disabled:c,...m}){let[d,f]=useState(()=>o??""),p=i!==void 0?String(i):d,u=useCallback(b=>{i===void 0&&f(b.target.value),l?.(b);},[i,l]),h=useMemo(()=>vd(p),[p]),g=n!=null&&h>n;return jsxs("div",{className:s("inline-flex w-full flex-col",a),children:[jsx("textarea",{value:p,onChange:u,disabled:c,className:s("w-full resize-y rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",yd[t],xd[g?"error":e],c&&"pointer-events-none opacity-50"),...m}),(r||n!=null)&&jsx("span",{className:s("mt-1 self-end text-xs",g?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:n!=null?`${h} / ${n} words`:`${h} words`})]})}var Td={sm:{trackFixed:"h-5 w-9",trackH:"h-5 min-w-9",thumb:"h-3.5 w-3.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-16px)]",pad:"pl-[6px] pr-[18px]",contentLeft:"left-[6px]",contentRight:"right-[6px]",icon:"text-[10px] [&_svg]:h-3 [&_svg]:w-3"},md:{trackFixed:"h-6 w-11",trackH:"h-6 min-w-11",thumb:"h-4.5 w-4.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-20px)]",pad:"pl-[7px] pr-[23px]",contentLeft:"left-[7px]",contentRight:"right-[7px]",icon:"text-xs [&_svg]:h-3.5 [&_svg]:w-3.5"},lg:{trackFixed:"h-7 w-14",trackH:"h-7 min-w-14",thumb:"h-5.5 w-5.5",thumbTop:"top-[3px]",thumbOff:"left-[3px]",thumbOn:"left-[calc(100%-25px)]",pad:"pl-[8px] pr-[28px]",contentLeft:"left-[8px]",contentRight:"right-[8px]",icon:"text-sm [&_svg]:h-4 [&_svg]:w-4"}},Md={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function mo({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:n,uncheckedContent:a,intent:i,size:o,label:l,id:c,className:m,disabled:d,...f}){let p=useId(),u=c??p,h=o??"md",g=i??"primary",b=Td[h],N=n!=null||a!=null,[x,T]=useState(t),w=e??x,C=useCallback(S=>{let R=S.target.checked;e===void 0&&T(R),r?.(R);},[e,r]);return jsxs("label",{htmlFor:u,className:s("inline-flex cursor-pointer items-center gap-2",d&&"pointer-events-none opacity-50",m),children:[jsx("input",{...f,id:u,type:"checkbox",role:"switch",className:"sr-only",checked:w,disabled:d,onChange:C,"aria-checked":w}),jsxs("span",{className:s("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",N?b.trackH:b.trackFixed,Sn({intent:i,size:o,checked:w?"on":"off"})),children:[N?jsxs(Fragment,{children:[jsxs("span",{className:s("pointer-events-none invisible inline-grid",b.icon),children:[jsx("span",{className:s("[grid-area:1/1] whitespace-nowrap",b.pad),children:n}),jsx("span",{className:s("[grid-area:1/1] whitespace-nowrap",b.pad),children:a})]}),jsx("span",{className:s("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",b.contentLeft,b.icon,Md[g],w?"opacity-100":"opacity-0"),children:n}),jsx("span",{className:s("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",b.contentRight,b.icon,"text-primary-400 dark:text-primary-500",w?"opacity-0":"opacity-100"),children:a})]}):null,jsx("span",{className:s("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",b.thumb,b.thumbTop,w?b.thumbOn:b.thumbOff)})]}),l&&jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:l})]})}var Ld={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function po({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:n,intent:a,size:i,label:o,id:l,className:c,disabled:m,...d}){let f=useId(),p=l??f,u=i??"md",[h,g]=useState(t),b=e??h,N=useCallback(T=>{let w=T.target.checked;e===void 0&&g(w),n?.(w);},[e,n]),x=b||r;return jsxs("label",{htmlFor:p,className:s("inline-flex cursor-pointer items-center gap-2 select-none",m&&"pointer-events-none opacity-50",c),children:[jsx("input",{...d,id:p,type:"checkbox",className:"sr-only",checked:b,disabled:m,onChange:N}),jsx("span",{className:s(Mn({intent:a,size:i,checked:x?"on":"off"})),children:jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:s("text-white transition-all duration-200",Ld[u],x?"scale-100 opacity-100":"scale-0 opacity-0"),children:r?jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),o&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:o})]})}var ws=createContext(null);function uo({name:e,value:t,defaultValue:r,onValueChange:n,intent:a,size:i,disabled:o,orientation:l="vertical",className:c,children:m}){let d=useId(),f=e??d,[p,u]=useState(r),h=t??p,g=useCallback(b=>{t===void 0&&u(b),n?.(b);},[t,n]);return jsx(ws.Provider,{value:{name:f,value:h,onChange:g,intent:a,size:i,disabled:o},children:jsx("div",{role:"radiogroup",className:s("flex gap-2",l==="vertical"?"flex-col":"flex-row flex-wrap",c),children:m})})}var Hd={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function fo({value:e,intent:t,size:r,label:n,id:a,className:i,disabled:o,...l}){let c=useId(),m=a??c,d=useContext(ws),f=t??d?.intent,p=r??d?.size,u=p??"md",h=o??d?.disabled,g=l.name??d?.name,b=d?d.value===e:void 0,N=useCallback(x=>{x.target.checked&&d?.onChange(e);},[d,e]);return jsxs("label",{htmlFor:m,className:s("inline-flex cursor-pointer items-center gap-2 select-none",h&&"pointer-events-none opacity-50",i),children:[jsx("input",{...l,id:m,type:"radio",name:g,value:e,className:"sr-only",checked:b,disabled:h,onChange:N}),jsx("span",{className:s(Rn({intent:f,size:p,checked:b?"on":"off"})),children:jsx("span",{className:s("rounded-full bg-white transition-all duration-200",Hd[u],b?"scale-100 opacity-100":"scale-0 opacity-0")})}),n&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:n})]})}function Bd(e,t){if(t)return t.slice(0,2).toUpperCase();if(!e)return "?";let r=e.trim().split(/\s+/);return r.length>=2?(r[0][0]+r[r.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var Od={online:"ring-2 ring-success-500",offline:"ring-2 ring-secondary-400",busy:"ring-2 ring-danger-500",away:"ring-2 ring-warning-500"};function Fn({src:e,alt:t,initials:r,size:n,shape:a,status:i,className:o,...l}){let[c,m]=useState(false),d=e&&!c,f=Bd(t,r);return jsx("span",{role:"img","aria-label":t??f,className:s(Br({size:n,shape:a}),i&&Od[i],"relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden",o),...l,children:d?jsx("img",{src:e,alt:t,className:"h-full w-full object-cover",onError:()=>m(true),draggable:false}):jsx("span",{className:"font-semibold leading-none tracking-wide",children:f})})}function _n({children:e,max:t=4,overlap:r="left",className:n}){let a=qr.Children.toArray(e),i=a.slice(0,t),o=a.length-t;return jsxs("span",{className:s("inline-flex items-center",r==="left"?"-space-x-3":"flex-row-reverse -space-x-3",n),children:[i.map((c,m)=>jsx("span",{className:"ring-2 ring-white dark:ring-primary-900 rounded-full",children:c},m)),o>0&&jsxs("span",{"aria-label":`${o} more`,className:s(Br({size:"md",shape:"circular"}),"relative inline-flex shrink-0 select-none items-center justify-center","ring-2 ring-white dark:ring-primary-900","bg-secondary-200 text-secondary-700 dark:bg-secondary-700 dark:text-secondary-200 font-semibold text-xs"),children:["+",o]})]})}function Vt(e,t,r){return Math.min(Math.max(e,t),r)}function Yd(e,t,r){return Math.round((e-t)/r)*r+t}function go(e,t,r){return (e-t)/(r-t)*100}function Ns(e,t,r,n){let a=t+e/100*(r-t);return Yd(a,t,n)}function Ts(e,t,r,n,a,i){let o=useRef(false),l=useCallback(f=>{let p=e.current;if(!p)return 0;let u=p.getBoundingClientRect(),g=(("touches"in f?f.touches[0].clientX:f.clientX)-u.left)/u.width*100;return Vt(g,0,100)},[e]),c=useCallback(f=>{if(a)return;f.currentTarget.setPointerCapture(f.pointerId),o.current=true;let p=e.current;if(!p)return;let u=p.getBoundingClientRect(),h=(f.clientX-u.left)/u.width*100;i?.(Ns(Vt(h,0,100),t,r,n));},[a,l,t,r,n,i,e]),m=useCallback(f=>{if(!o.current||a)return;let p=e.current;if(!p)return;let u=p.getBoundingClientRect(),h=(f.clientX-u.left)/u.width*100;i?.(Ns(Vt(h,0,100),t,r,n));},[a,t,r,n,i,e]),d=useCallback(()=>{o.current=false;},[]);return {startDrag:c,onPointerMove:m,stopDrag:d}}function Bn({mode:e,value:t,defaultValue:r=0,onChange:n,min:a=0,max:i=100,step:o=1,intent:l,size:c,disabled:m,showValue:d=false,formatValue:f=String,label:p,className:u,id:h,...g}){let[b,N]=useState(r),x=t!==void 0,T=x?t:b,w=useId(),C=h??w,S=useRef(null),R=useCallback(k=>{let q=Vt(k,a,i);x||N(q),n?.(q);},[x,a,i,n]),{startDrag:V,onPointerMove:I,stopDrag:E}=Ts(S,a,i,o,m,R),v=go(T,a,i),U=k=>{let q=k.key==="ArrowRight"||k.key==="ArrowUp"?o:k.key==="ArrowLeft"||k.key==="ArrowDown"?-o:k.key==="Home"?-(T-a):k.key==="End"?i-T:0;q!==0&&(k.preventDefault(),R(T+q));};return jsxs("div",{className:s("slider-root flex flex-col gap-1",u),children:[jsx("input",{type:"range",id:C,className:"sr-only",tabIndex:-1,min:a,max:i,step:o,value:T,disabled:m,readOnly:true,onChange:()=>{}}),(p||d)&&jsxs("div",{className:"flex items-center justify-between",children:[p&&jsx("label",{htmlFor:C,className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:p}),d&&jsx("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:f(T)})]}),jsx("div",{...g,ref:S,className:s(Or({intent:l,size:c}),m&&"opacity-40 cursor-not-allowed"),onPointerDown:V,onPointerMove:I,onPointerUp:E,onPointerCancel:E,style:{touchAction:"none"},children:jsxs("div",{className:"relative h-1.5 w-full grow rounded-full bg-primary-200 dark:bg-primary-700",children:[jsx("div",{className:"slider-fill absolute left-0 top-0 h-full rounded-full transition-none",style:{width:`${v}%`}}),jsx("div",{role:"slider",tabIndex:m?-1:0,"aria-valuemin":a,"aria-valuemax":i,"aria-valuenow":T,"aria-disabled":m,onKeyDown:U,className:s("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!m&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${v}%`}})]})})]})}function On({value:e,defaultValue:t=[20,80],onChange:r,min:n=0,max:a=100,step:i=1,intent:o,size:l,disabled:c,showValue:m=false,formatValue:d=String,label:f,className:p,id:u,...h}){let[g,b]=useState(t),N=e!==void 0,[x,T]=N?e:g,w=useRef(null),C=useRef("lo"),S=useCallback(M=>{N||b(M),r?.(M);},[N,r]),R=useCallback(M=>{C.current==="lo"?S([Vt(M,n,T),T]):S([x,Vt(M,x,a)]);},[x,T,n,a,S]),{startDrag:V,onPointerMove:I,stopDrag:E}=Ts(w,n,a,i,c,R),v=go(x,n,a),U=go(T,n,a),k=M=>W=>{C.current=M,V(W);},q=M=>W=>{let ue=W.key==="ArrowRight"||W.key==="ArrowUp"?i:W.key==="ArrowLeft"||W.key==="ArrowDown"?-i:0;ue!==0&&(W.preventDefault(),S(M==="lo"?[Vt(x+ue,n,T),T]:[x,Vt(T+ue,x,a)]));};return jsxs("div",{className:s("slider-root flex flex-col gap-1",p),children:[u&&jsx("input",{type:"range",id:u,className:"sr-only",tabIndex:-1,min:n,max:a,step:i,value:x,disabled:c,readOnly:true,onChange:()=>{}}),(f||m)&&jsxs("div",{className:"flex items-center justify-between",children:[f&&jsx("span",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:f}),m&&jsxs("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:[d(x)," \u2013 ",d(T)]})]}),jsx("div",{...h,ref:w,className:s(Or({intent:o,size:l}),c&&"opacity-40 cursor-not-allowed"),onPointerMove:I,onPointerUp:E,onPointerCancel:E,style:{touchAction:"none"},children:jsxs("div",{className:"relative h-1.5 w-full rounded-full bg-primary-200 dark:bg-primary-700",children:[jsx("div",{className:"slider-fill absolute top-0 h-full rounded-full",style:{left:`${v}%`,width:`${U-v}%`}}),jsx("div",{role:"slider",tabIndex:c?-1:0,"aria-valuemin":n,"aria-valuemax":T,"aria-valuenow":x,"aria-label":"Range start","aria-disabled":c,onPointerDown:k("lo"),onKeyDown:q("lo"),className:s("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!c&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${v}%`,zIndex:x>T-i?3:2}}),jsx("div",{role:"slider",tabIndex:c?-1:0,"aria-valuemin":x,"aria-valuemax":a,"aria-valuenow":T,"aria-label":"Range end","aria-disabled":c,onPointerDown:k("hi"),onKeyDown:q("hi"),className:s("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!c&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${U}%`,zIndex:2}})]})})]})}var Kd={Button:gr,Dropdown:Za,DropdownButton:hr,Badge:ao,Tag:oo,Indicator:io,Label:so,Input:lo,TextBox:co,Switch:mo,Checkbox:po,Radio:fo,RadioGroup:uo,Avatar:Fn,AvatarGroup:_n,Slider:Bn,SliderRange:On},bo=Kd;var Xr=cva("rounded-lg transition-shadow",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",elevated:"bg-white shadow-md hover:shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25 dark:hover:shadow-primary-200/30",outlined:"border-2 border-primary-300 bg-transparent dark:border-primary-600",ghost:"bg-primary-50 dark:bg-primary-800/50"},size:{sm:"p-3",md:"p-5",lg:"p-7"}},defaultVariants:{intent:"default",size:"md"}}),$n=cva("rounded-md",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",inset:"bg-primary-50 dark:bg-primary-800/50",elevated:"bg-white shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25"},size:{sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{intent:"default",size:"md"}});function ho({intent:e,size:t,className:r,...n}){return jsx("div",{className:s(Xr({intent:e,size:t}),r),...n})}function Xd({className:e,...t}){return jsx("div",{className:s("mb-4 space-y-1",e),...t})}function Wd({className:e,...t}){return jsx("h3",{className:s("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function jd({className:e,...t}){return jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Gd({className:e,...t}){return jsx("div",{className:s("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function Ud({className:e,...t}){return jsx("div",{className:s("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function qd({intent:e,media:t,mediaPosition:r="left",stackOnMobile:n=false,className:a,children:i,...o}){let l=jsx("div",{className:s("relative shrink-0 overflow-hidden",n?"h-48 w-full rounded-t-lg sm:h-auto sm:w-auto":"",!n&&(r==="left"?"rounded-l-lg":"rounded-r-lg")),style:n?void 0:{width:t.width??"10rem"},children:t.src?jsx("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:false}):t.icon?jsx("div",{className:"bg-primary-100 text-primary-500 dark:bg-primary-800 dark:text-primary-400 flex h-full w-full items-center justify-center",children:t.icon}):null});return jsxs("div",{className:s(Xr({intent:e}),"flex overflow-hidden p-0",n?"flex-col sm:flex-row":"",!n&&r==="right"&&"flex-row-reverse",!n&&r==="left"&&"flex-row",a),...o,children:[l,jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:i})]})}function yo({src:e,alt:t="",aspectRatio:r="16/9",className:n,children:a,...i}){return jsxs("div",{className:s("group overflow-hidden rounded-xl border transition-shadow duration-300","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white","dark:hover:shadow-primary-900/60 hover:shadow-lg",n),...i,children:[jsxs("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[jsx("img",{src:e,alt:t,className:"h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-110",draggable:false}),jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":true,children:jsx("div",{className:"animate-light-sweep absolute inset-0"})})]}),a]})}function Zd({className:e,...t}){return jsx("div",{className:s("space-y-2 p-4",e),...t})}function Jd({className:e,...t}){return jsx("h3",{className:s("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function em({className:e,...t}){return jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function tm({className:e,...t}){return jsx("div",{className:s("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function xo({intent:e,size:t,className:r,...n}){return jsx("div",{className:s($n({intent:e,size:t}),r),...n})}function rm({className:e,...t}){return jsx("div",{className:s("border-primary-200 text-primary-900 dark:border-primary-700 dark:text-primary-100 mb-3 flex items-center gap-1.5 border-b pb-3 text-sm font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function nm({className:e,...t}){return jsx("div",{className:s("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var am={Card:ho,ImageCard:yo,Panel:xo},wo=am;var Yn=cva("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"},density:{compact:"[&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1",default:"",relaxed:"[&_th]:px-6 [&_th]:py-5 [&_td]:px-6 [&_td]:py-5"}},defaultVariants:{intent:"default",density:"default"}}),Kn=cva("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}}),Xn=cva("group flex w-full items-center gap-1.5 text-left [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",md:"py-1.5 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"py-2 text-base [&_svg]:h-4 [&_svg]:w-4"}},defaultVariants:{size:"md"}}),Wn=cva("flex cursor-pointer items-center gap-1 rounded transition-colors [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-1 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-1.5 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),jn=cva("relative rounded-xl border bg-white p-5 shadow-sm transition-shadow hover:shadow-md dark:bg-primary-900",{variants:{intent:{primary:"border-primary-200 dark:border-primary-700",success:"border-success-200 dark:border-success-800",danger:"border-danger-200 dark:border-danger-800",warning:"border-warning-200 dark:border-warning-800"},size:{sm:"p-4",md:"p-5",lg:"p-6"}},defaultVariants:{intent:"primary",size:"md"}}),Gn=cva("relative overflow-hidden rounded-xl border bg-white p-5 shadow-sm transition-all duration-300 hover:shadow-lg dark:bg-primary-900",{variants:{intent:{primary:"border-primary-200 dark:border-primary-700",success:"border-success-200 dark:border-success-800",danger:"border-danger-200 dark:border-danger-800",warning:"border-warning-200 dark:border-warning-800"},size:{sm:"p-4",md:"p-5",lg:"p-6"}},defaultVariants:{intent:"primary",size:"md"}}),Wr=cva("overflow-x-auto rounded-lg font-mono [background:var(--color-syntax-bg)] [&_pre]:m-0 [&_pre]:p-4 [&_code]:bg-transparent",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}});function Ur({intent:e,density:t,className:r,...n}){return jsx("div",{className:"w-full overflow-auto",children:jsx("table",{className:s(Yn({intent:e,density:t}),r),...n})})}function No({className:e,...t}){return jsx("thead",{className:s("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function Co({className:e,...t}){return jsx("tbody",{className:s("[&_tr:last-child]:border-0",e),...t})}function Gr({className:e,...t}){return jsx("tr",{className:s("border-primary-200 hover:bg-primary-50/50 dark:border-primary-700 dark:hover:bg-primary-800/30 border-b transition-colors",e),...t})}function rr({className:e,...t}){return jsx("th",{className:s("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function nr({className:e,...t}){return jsx("td",{className:s("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function To({icon:e,text:t="No data",className:r}){return jsxs("div",{className:s("flex flex-col items-center justify-center gap-3 py-16 text-primary-400 dark:text-primary-500",r),children:[e??jsx(Inbox,{className:"h-12 w-12 stroke-[1.2]"}),jsx("span",{className:"text-sm",children:t})]})}var Ss={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function bm({columns:e,data:t,sort:r,onSortChange:n,defaultSort:a=null,rowKey:i,rowActions:o,intent:l,density:c,className:m,empty:d}){let[f,p]=useState(a),u=r??f,h=useCallback(b=>{let N=u?.column===b?u.direction==="asc"?{column:b,direction:"desc"}:null:{column:b,direction:"asc"};n?n(N):p(N);},[u,n]),g=useMemo(()=>{if(!u)return t;let b=e.find(T=>T.key===u.column);if(!b)return t;let N=b.compareFn??((T,w)=>{let C=b.cell(T),S=b.cell(w);return C==null&&S==null?0:C==null?-1:S==null?1:typeof C=="number"&&typeof S=="number"?C-S:String(C).localeCompare(String(S))}),x=[...t].sort(N);return u.direction==="desc"?x.reverse():x},[t,u,e]);return jsxs(Ur,{intent:l,density:c,className:m,children:[jsx(No,{children:jsxs(Gr,{children:[e.map(b=>{let N=b.sortable!==false,x=u?.column===b.key;return jsx(rr,{className:s(N&&"cursor-pointer select-none",b.headerClassName,b.hideBelow&&Ss[b.hideBelow]),onClick:N?()=>h(b.key):void 0,"aria-sort":x?u.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[b.header,N&&jsx(Ps,{active:x,direction:x?u.direction:null})]})},b.key)}),o&&jsx(rr,{className:"w-20 text-right",children:"Actions"})]})}),jsx(Co,{children:g.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(o?1:0),children:jsx(To,{...d})})}):g.map((b,N)=>jsxs(Gr,{children:[e.map(x=>jsx(nr,{className:s(x.cellClassName,x.hideBelow&&Ss[x.hideBelow]),children:x.cell(b)},x.key)),o&&jsx(nr,{className:"text-right",children:jsx("span",{className:"inline-flex items-center gap-1",children:o(b)})})]},i?i(b,N):N))})]})}function hm({value:e,onCommit:t,onCancel:r}){let[n,a]=useState(e),i=useRef(null);useEffect(()=>{i.current?.focus(),i.current?.select();},[]);let o=()=>t(n);return jsxs("span",{className:"flex items-center gap-1",children:[jsx("input",{ref:i,type:"text",value:n,onChange:l=>a(l.target.value),onKeyDown:l=>{l.key==="Enter"&&o(),l.key==="Escape"&&r();},"aria-label":"Edit cell",className:"min-w-0 flex-1 rounded border border-primary-400 bg-white px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-primary-400 dark:border-primary-600 dark:bg-secondary-800"}),jsx("button",{type:"button",onClick:o,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:jsx(Check,{className:"h-3.5 w-3.5"})}),jsx("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:jsx(X,{className:"h-3.5 w-3.5"})})]})}function ym({columns:e,data:t,rowKey:r,sort:n,onSortChange:a,defaultSort:i=null,selectionMode:o="none",selected:l,onSelectionChange:c,editable:m=false,onCellEdit:d,toolbar:f=false,onAdd:p,onDelete:u,rowActions:h,intent:g,density:b,className:N,empty:x}){let[T,w]=useState(i),C=n??T,S=useCallback(B=>{let j=C?.column===B?C.direction==="asc"?{column:B,direction:"desc"}:null:{column:B,direction:"asc"};a?a(j):w(j);},[C,a]),R=useMemo(()=>{if(!C)return t;let B=e.find(ye=>ye.key===C.column);if(!B)return t;let j=B.compareFn??((ye,y)=>{let L=B.cell(ye),G=B.cell(y);return L==null&&G==null?0:L==null?-1:G==null?1:typeof L=="number"&&typeof G=="number"?L-G:String(L).localeCompare(String(G))}),pe=[...t].sort(j);return C.direction==="desc"?pe.reverse():pe},[t,C,e]),[V,I]=useState([]),E=l??V,v=c??I,U=useMemo(()=>R.map((B,j)=>r(B,j)),[R,r]),k=o==="multiple"&&U.length>0&&U.every(B=>E.includes(B)),q=o==="multiple"&&E.length>0&&!k,M=useCallback(B=>{o==="single"?v(E.includes(B)?[]:[B]):o==="multiple"&&v(E.includes(B)?E.filter(j=>j!==B):[...E,B]);},[o,E,v]),W=useCallback(()=>{v(k?[]:U);},[k,U,v]),[$,ue]=useState(null),J=useCallback((B,j,pe)=>{m&&pe!==false&&ue({rowKey:B,colKey:j});},[m]),de=useCallback((B,j,pe)=>{d?.(B,j,pe),ue(null);},[d]);return jsxs("div",{className:"space-y-2",children:[f&&jsxs("div",{className:"flex items-center gap-2",children:[p&&jsxs("button",{type:"button",onClick:p,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsx(Plus,{className:"h-3.5 w-3.5"})," Add"]}),u&&jsxs("button",{type:"button",onClick:()=>u(E),disabled:E.length===0,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-danger-600 transition-colors hover:bg-danger-50 disabled:opacity-40 disabled:pointer-events-none dark:border-secondary-600 dark:bg-secondary-800 dark:text-danger-400 dark:hover:bg-danger-900/20",children:[jsx(Trash2,{className:"h-3.5 w-3.5"})," Delete",E.length>0&&` (${E.length})`]}),m&&E.length===1&&jsxs("button",{type:"button",onClick:()=>{let B=e.find(j=>j.editable!==false);B&&ue({rowKey:E[0],colKey:B.key});},className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsx(Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),E.length>0&&jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[E.length," row",E.length>1?"s":""," selected"]})]}),jsxs(Ur,{intent:g,density:b,className:N,children:[jsx(No,{children:jsxs(Gr,{children:[o==="multiple"&&jsx(rr,{className:"w-10",children:jsx("input",{type:"checkbox",checked:k,ref:B=>{B&&(B.indeterminate=q);},onChange:W,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),o==="single"&&jsx(rr,{className:"w-10"}),e.map(B=>{let j=B.sortable!==false,pe=C?.column===B.key;return jsx(rr,{className:s(j&&"cursor-pointer select-none",B.headerClassName),onClick:j?()=>S(B.key):void 0,"aria-sort":pe?C.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[B.header,j&&jsx(Ps,{active:pe,direction:pe?C.direction:null})]})},B.key)}),h&&jsx(rr,{className:"w-20 text-right",children:"Actions"})]})}),jsx(Co,{children:R.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(o!=="none"?1:0)+(h?1:0),children:jsx(To,{...x})})}):R.map((B,j)=>{let pe=r(B,j),ye=E.includes(pe);return jsxs(Gr,{className:s(ye&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{o!=="none"&&M(pe);},children:[o==="multiple"&&jsx(nr,{className:"w-10",children:jsx("input",{type:"checkbox",checked:ye,onChange:()=>M(pe),onClick:y=>y.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),o==="single"&&jsx(nr,{className:"w-10",children:jsx("input",{type:"radio",checked:ye,onChange:()=>M(pe),onClick:y=>y.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(y=>{let L=$?.rowKey===pe&&$?.colKey===y.key,G=y.editValue?.(B)??(()=>{let O=y.cell(B);return typeof O=="string"||typeof O=="number"?String(O):""})();return jsx(nr,{className:s(y.cellClassName,m&&y.editable!==false&&"cursor-text"),onDoubleClick:O=>{O.stopPropagation(),J(pe,y.key,y.editable);},children:L?jsx(hm,{value:G,onCommit:O=>de(pe,y.key,O),onCancel:()=>ue(null)}):y.cell(B)},y.key)}),h&&jsx(nr,{className:"text-right",onClick:y=>y.stopPropagation(),children:jsx("span",{className:"inline-flex items-center gap-1",children:h(B)})})]},pe)})})]})]})}function Ps({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsx(ArrowUpDown,{className:s(r,"opacity-30")}):t==="asc"?jsx(ArrowUp,{className:s(r,"opacity-70")}):jsx(ArrowDown,{className:s(r,"opacity-70")})}var Ds=createContext({size:"md"});function Mo({intent:e,size:t="md",className:r,...n}){return jsx(Ds.Provider,{value:{size:t},children:jsx("ul",{className:s(Kn({intent:e}),r),...n})})}function wm({actions:e,className:t,children:r,...n}){let{size:a}=useContext(Ds);return jsxs("li",{className:s(Xn({size:a}),t),...n,children:[jsx("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:r}),e&&jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",children:e})]})}var Vs=createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function Ro({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:n="all",onExpandedKeysChange:a,size:i="md",className:o,children:l,...c}){let [m,d]=useState(()=>n),p=useCallback(h=>{if(r){let g=new Set(r);g.has(h)?g.delete(h):g.add(h),a?.(g);}else d(g=>{if(g==="all")return new Set(["__ALL_MINUS__",h]);let b=new Set(g);return b.has(h)?b.delete(h):b.add(h),b});},[r,a]),u=r??(m==="all"?null:m);return jsx(Vs.Provider,{value:{showLines:e,expandedKeys:u,onToggleKey:p,size:i},children:t?jsx("ul",{className:s("text-sm",o),role:"tree",...c,children:l}):jsx("ul",{className:s("text-sm",o),role:"tree",...c,children:jsx(Rm,{children:l})})})}function Rm({children:e}){let t=Is(e);return jsx(Fragment,{children:t.map(r=>qr.isValidElement(r)&&r.props.children?r.props.children:null)})}function Is(e){let t=[];return qr.Children.forEach(e,r=>{qr.isValidElement(r)&&r.type===qr.Fragment?t.push(...Is(r.props.children)):t.push(r);}),t}function Sm({nodeKey:e,label:t,icon:r,actions:n,defaultExpanded:a=false,expanded:i,onToggle:o,children:l,className:c}){let{showLines:m,expandedKeys:d,onToggleKey:f,size:p}=useContext(Vs),[u,h]=useState(a),g=qr.Children.count(l)>0,b=e??(typeof t=="string"?t:""),N;i!=null?N=i:d!=null&&b?d.has("__ALL_MINUS__")?N=!d.has(b):N=d.has(b):N=u;let x=()=>{let T=!N;o?o(T):d!=null&&b?f(b):h(T);};return jsxs("li",{className:s("select-none",c),role:"treeitem","aria-expanded":g?N:void 0,children:[jsxs("div",{className:s("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",Wn({size:p}),g?"cursor-pointer":"cursor-default"),onClick:g?x:void 0,children:[g?jsx(ChevronRight,{className:s("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",N&&"rotate-90")}):jsx("span",{className:"w-4 shrink-0"}),r&&jsx("span",{className:"shrink-0",children:r}),jsx("span",{className:"text-primary-700 dark:text-primary-300 min-w-0 flex-1 truncate",children:t}),n&&jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",onClick:T=>T.stopPropagation(),children:n})]}),g&&jsx("div",{className:s("grid transition-[grid-template-rows] duration-200 ease-out",N?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("ul",{className:s("ml-4 pl-2",m&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:l})})})]})}function Em({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function Vm({msg:e,alignRight:t}){return jsxs("div",{className:s("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsx(Em,{avatar:e.avatar,sender:e.sender}),jsxs("div",{className:s("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsx("div",{className:s("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function Po({messages:e,mode:t="split",autoScroll:r=true,className:n,...a}){let i=useRef(null);return useEffect(()=>{r&&i.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxs("div",{className:s("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",n),...a,children:[e.map(o=>{let l=t==="split"&&!!o.self;return jsx(Vm,{msg:o,alignRight:l},o.id)}),jsx("div",{ref:i})]})}var Hm={name:"onyx-css-vars",type:"dark",settings:[{settings:{foreground:"var(--color-syntax-plain)",background:"var(--color-syntax-bg)"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"var(--color-syntax-comment)",fontStyle:"italic"}},{scope:["keyword","keyword.control","keyword.operator.new","keyword.operator.expression","storage.type","storage.modifier"],settings:{foreground:"var(--color-syntax-keyword)"}},{scope:["string","string.quoted","string.template"],settings:{foreground:"var(--color-syntax-string)"}},{scope:["entity.name.function","support.function","meta.function-call"],settings:{foreground:"var(--color-syntax-function)"}},{scope:["variable","variable.other","variable.parameter","meta.definition.variable"],settings:{foreground:"var(--color-syntax-variable)"}},{scope:["constant.numeric","constant.language"],settings:{foreground:"var(--color-syntax-number)"}},{scope:["keyword.operator","keyword.operator.assignment","keyword.operator.comparison","keyword.operator.arithmetic"],settings:{foreground:"var(--color-syntax-operator)"}},{scope:["entity.name.tag","punctuation.definition.tag","support.class.component"],settings:{foreground:"var(--color-syntax-tag)"}},{scope:["entity.other.attribute-name","meta.tag.attributes"],settings:{foreground:"var(--color-syntax-attr)"}},{scope:["punctuation","meta.brace","punctuation.definition.block","punctuation.separator","punctuation.terminator"],settings:{foreground:"var(--color-syntax-punctuation)"}},{scope:["entity.name.type","support.type","support.class","entity.other.inherited-class"],settings:{foreground:"var(--color-syntax-type)"}}]},Fm={typescript:()=>import('@shikijs/langs/typescript'),javascript:()=>import('@shikijs/langs/javascript'),tsx:()=>import('@shikijs/langs/tsx'),jsx:()=>import('@shikijs/langs/jsx'),html:()=>import('@shikijs/langs/html'),css:()=>import('@shikijs/langs/css'),json:()=>import('@shikijs/langs/json'),markdown:()=>import('@shikijs/langs/markdown'),python:()=>import('@shikijs/langs/python'),rust:()=>import('@shikijs/langs/rust'),go:()=>import('@shikijs/langs/go'),java:()=>import('@shikijs/langs/java'),c:()=>import('@shikijs/langs/c'),cpp:()=>import('@shikijs/langs/cpp'),csharp:()=>import('@shikijs/langs/csharp'),vue:()=>import('@shikijs/langs/vue'),xml:()=>import('@shikijs/langs/xml'),yaml:()=>import('@shikijs/langs/yaml'),sql:()=>import('@shikijs/langs/sql'),bash:()=>import('@shikijs/langs/bash'),shell:()=>import('@shikijs/langs/shell')},Eo=null,As=new Set;function _m(){return Eo||(Eo=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[Hm],langs:[],engine:t()}))),Eo}async function zm(e,t,r){let n=await _m();if(t&&!As.has(t)){let i=Fm[t];if(i)try{let o=await i();await n.loadLanguage(o.default??o),As.add(t);}catch{t="text";}else t="text";}let a=n.codeToHtml(e,{lang:t||"text",theme:"onyx-css-vars"});if(a=a.replace(/(<pre [^>]*style=")/,"$1line-height:1.7;tab-size:2;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;"),r){let i=0;a=a.replace(/<span class="line">/g,()=>(i++,`<span class="line"><span class="line-number" data-line="${i}"></span>`));}return a}function Vo({code:e,language:t="text",lineNumbers:r=false,editable:n=false,onCodeChange:a,size:i,className:o,...l}){let[c,m]=useState(""),d=useRef(null),f=useRef(null),p=useRef(null);useEffect(()=>{let w=false;return zm(e,t,n?false:r).then(C=>{w||m(C);}),()=>{w=true;}},[e,t,r,n]);let u=useCallback(()=>{let w=f.current,C=p.current?.querySelector("pre"),S=d.current?.querySelector("[data-gutter]");w&&C&&(C.scrollTop=w.scrollTop,C.scrollLeft=w.scrollLeft),w&&S&&(S.scrollTop=w.scrollTop);},[]),h=useCallback(w=>{a?.(w.target.value);},[a]),g=useCallback(w=>{if(w.key==="Tab"){w.preventDefault();let C=w.currentTarget,S=C.selectionStart,R=C.selectionEnd,V=C.value.substring(0,S)+" "+C.value.substring(R);a?.(V),requestAnimationFrame(()=>{C.selectionStart=C.selectionEnd=S+2;});}},[a]),b=r&&"[&_.line-number]:inline-block [&_.line-number]:w-8 [&_.line-number]:mr-4 [&_.line-number]:text-right [&_.line-number]:text-secondary-400 [&_.line-number]:select-none [&_.line-number]:before:content-[attr(data-line)]",N="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",x=1.7,T=e.split(`
|
|
2
|
+
`).length;return n?jsxs("div",{ref:d,className:s(Wr({size:i}),"flex border border-primary-200 dark:border-primary-700",o),style:{background:"var(--color-syntax-bg)"},...l,children:[r&&jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:N,lineHeight:x,width:"3rem"},children:Array.from({length:T},(w,C)=>jsx("div",{children:C+1},C))}),jsxs("div",{className:"relative min-w-0 flex-1",children:[jsx("textarea",{ref:f,value:e,onChange:h,onScroll:u,onKeyDown:g,spellCheck:false,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",className:"relative z-2 m-0 block h-full w-full resize-none overflow-auto whitespace-pre border-none bg-transparent p-4 text-transparent caret-primary-600 outline-none dark:caret-primary-400",style:{fontFamily:N,lineHeight:x,tabSize:2,minHeight:"6rem"}}),jsx("div",{ref:p,"aria-hidden":true,className:"pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre]:h-full [&_pre]:overflow-hidden [&_pre]:p-4 [&_code]:bg-transparent",dangerouslySetInnerHTML:c?{__html:c}:void 0})]})]}):jsx("div",{ref:d,className:s(Wr({size:i}),"border border-primary-200 dark:border-primary-700",b,o),style:{background:"var(--color-syntax-bg)"},...l,children:jsx("div",{ref:p,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:c?{__html:c}:void 0,children:c?void 0:jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsx("code",{children:e})})})})}var Ym={up:TrendingUp,down:TrendingDown,neutral:Minus},Km={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"};function Io({title:e,value:t,prefix:r,suffix:n,icon:a,trend:i,trendValue:o,description:l,intent:c,size:m,className:d}){let f=i?Ym[i]:null,p=i?Km[i]:"";return jsx("div",{className:s(jn({intent:c,size:m}),d),children:jsxs("div",{className:"flex items-start justify-between gap-3",children:[jsxs("div",{className:"min-w-0 flex-1",children:[jsx("p",{className:"truncate text-xs font-medium tracking-wider uppercase text-secondary-500 dark:text-secondary-400",children:e}),jsxs("p",{className:"mt-1 flex items-baseline gap-1 text-2xl font-bold text-primary-900 dark:text-primary-50",children:[r&&jsx("span",{className:"text-base font-semibold text-secondary-500 dark:text-secondary-400",children:r}),jsx("span",{children:t}),n&&jsx("span",{className:"text-base font-semibold text-secondary-500 dark:text-secondary-400",children:n})]}),(i||l)&&jsxs("div",{className:"mt-2 flex items-center gap-2",children:[i&&f&&jsxs("span",{className:s("flex items-center gap-0.5 text-xs font-semibold",p),children:[jsx(f,{className:"h-3.5 w-3.5"}),o]}),l&&jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:l})]})]}),a&&jsx("div",{className:s("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl [&_svg]:h-5 [&_svg]:w-5",c==="success"&&"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",c==="danger"&&"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",c==="warning"&&"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400",(!c||c==="primary")&&"bg-primary-100 text-primary-600 dark:bg-primary-800 dark:text-primary-400"),children:a})]})})}function qm(e){return 1-Math.pow(1-e,4)}function Qm(e,t,r,n,a){let[i,o]=useState(()=>a?a(t):t.toFixed(n)),l=useRef(null),c=useRef(null);return useEffect(()=>{l.current!==null&&cancelAnimationFrame(l.current),c.current=null;let m=d=>{c.current===null&&(c.current=d);let f=d-c.current,p=Math.min(f/r,1),u=qm(p),h=t+(e-t)*u;o(a?a(h):h.toFixed(n)),p<1&&(l.current=requestAnimationFrame(m));};return l.current=requestAnimationFrame(m),()=>{l.current!==null&&cancelAnimationFrame(l.current);}},[e,t,r,n,a]),i}var Zm={up:TrendingUp,down:TrendingDown,neutral:Minus},Jm={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"},_s={primary:"bg-primary-100 text-primary-600 dark:bg-primary-800/60 dark:text-primary-300",success:"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",danger:"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",warning:"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400"};function Ao({title:e,value:t,decimals:r=0,prefix:n,suffix:a,icon:i,trend:o,trendValue:l,description:c,animateDuration:m=1200,formatter:d,from:f=0,intent:p,size:u,className:h}){let g=Qm(t,f,m,r,d),b=o?Zm[o]:null,N=o?Jm[o]:"";return jsxs("div",{className:s(Gn({intent:p,size:u}),h),children:[jsx("div",{className:s("pointer-events-none absolute inset-x-0 top-0 h-0.5 rounded-t-xl",p==="success"&&"bg-gradient-to-r from-success-400 to-success-600",p==="danger"&&"bg-gradient-to-r from-danger-400 to-danger-600",p==="warning"&&"bg-gradient-to-r from-warning-400 to-warning-600",(!p||p==="primary")&&"bg-gradient-to-r from-primary-400 to-primary-600")}),jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[jsx("p",{className:"text-xs font-semibold tracking-widest uppercase text-secondary-500 dark:text-secondary-400",children:e}),jsxs("p",{className:"mt-2 flex items-baseline gap-1",children:[n&&jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:n}),jsx("span",{className:"font-mono text-3xl font-bold tabular-nums text-primary-900 dark:text-primary-50",children:g}),a&&jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:a})]})]}),i&&jsx("div",{className:s("flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl [&_svg]:h-6 [&_svg]:w-6",_s[p??"primary"]??_s.primary),children:i})]}),(o||c)&&jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-primary-100 pt-3 dark:border-primary-700/50",children:[o&&b&&jsxs("span",{className:s("flex items-center gap-0.5 text-xs font-bold",N),children:[jsx(b,{className:"h-3.5 w-3.5"}),l]}),c&&jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:c})]})]})}var ep={Table:Ur,List:Mo,Tree:Ro,Chat:Po,CodeBlock:Vo,Stat:Io,MetricCard:Ao},Ho=ep;var ar="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",Bs="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",kr="text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200",Nr="flex items-center justify-center rounded-md p-2 transition-colors cursor-pointer text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200";function cp({to:e,className:t,style:r,children:n}){let a=typeof t=="function"?t({isActive:false}):t;return jsx("a",{href:e,className:a,style:r,children:n})}var Fo=["expanded","icons","mini"];function dp(e){let t=Fo.indexOf(e);return Fo[(t+1)%Fo.length]}function Os(e){let t=new Set;for(let r of e)if(r.children&&r.children.length>0){t.add(r.key??r.label);for(let n of Os(r.children))t.add(n);}return t}function $s({item:e,basePath:t,depth:r,onItemClick:n,LinkComponent:a,showLines:i,expandedKeys:o,onToggle:l}){let c=e.key??e.label,m=e.children&&e.children.length>0,[d,f]=useState(e.defaultOpen??true),p=o?o.has(c):d,u=useCallback(()=>{o?l(c):f(g=>!g);},[o,l,c]),h=r>0?`${r*1.25}rem`:void 0;if(m)return jsxs("div",{children:[jsxs("button",{type:"button",onClick:u,className:s(ar,kr,"justify-between"),style:{paddingLeft:h},children:[jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsx(ChevronRight,{className:s("h-3.5 w-3.5 transition-transform",p&&"rotate-90")})]}),p&&jsx("div",{className:s("flex flex-col gap-0.5 pt-0.5",i?"ml-2.5 border-l border-primary-200 dark:border-primary-700":"ml-2"),children:e.children.map(g=>jsx($s,{item:g,basePath:t,depth:r+1,onItemClick:n,LinkComponent:a,showLines:i,expandedKeys:o,onToggle:l},g.key??g.path??g.label))})]});if(e.path!=null){let g=t+e.path;return n?jsxs("button",{type:"button",onClick:()=>n(e,g),className:s(ar,kr),style:{paddingLeft:h},children:[e.icon,e.label]}):jsxs(a,{to:g,className:({isActive:b})=>s(ar,b?Bs:kr),style:{paddingLeft:h},children:[e.icon,e.label]})}return jsxs("span",{className:s(ar,kr,"cursor-default"),style:{paddingLeft:h},children:[e.icon,e.label]})}function mp({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let[a,i]=useState(false),o=useRef(null),l=useRef(void 0),[c,m]=useState({top:0,left:0}),d=()=>{clearTimeout(l.current),i(true);},f=()=>{l.current=setTimeout(()=>i(false),200);};useLayoutEffect(()=>{if(a&&o.current){let u=o.current.getBoundingClientRect();m({top:u.top,left:u.right+4});}},[a]);let p=e.icon||jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxs("div",{onMouseEnter:d,onMouseLeave:f,children:[jsx("button",{ref:o,type:"button",className:s(Nr,"w-full"),title:e.label,onClick:()=>i(u=>!u),children:p}),a&&createPortal(jsxs("div",{className:"fixed z-50 min-w-44 rounded-md border border-primary-200 bg-white p-1 shadow-lg dark:border-primary-700 dark:bg-primary-900",style:{top:c.top,left:c.left},onMouseEnter:d,onMouseLeave:f,children:[jsx("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),jsx("div",{className:"flex flex-col gap-0.5",children:e.children?.map(u=>{let h=u.key??u.path??u.label;if(u.path!=null){let g=t+u.path;return r?jsxs("button",{type:"button",onClick:()=>{r(u,g),i(false);},className:s(ar,kr),children:[u.icon,u.label]},h):jsxs(n,{to:g,className:({isActive:b})=>s(ar,b?Bs:kr),children:[u.icon,u.label]},h)}return jsxs("span",{className:s(ar,"cursor-default text-primary-400"),children:[u.icon,u.label]},h)})})]}),document.body)]})}function pp({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let a=e.icon||jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});if(e.path!=null){let i=t+e.path;return r?jsx("button",{type:"button",onClick:()=>r(e,i),className:s(Nr,"w-full"),title:e.label,children:a}):jsx(n,{to:i,className:({isActive:o})=>s(Nr,"w-full",o&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:jsx("span",{title:e.label,children:a})})}return jsx("span",{className:s(Nr,"w-full cursor-default"),title:e.label,children:a})}function zo({items:e,title:t,basePath:r="/",onItemClick:n,LinkComponent:a=cp,collapsible:i,collapseMode:o,defaultCollapseMode:l="expanded",onCollapseModeChange:c,showLines:m=true,expandedKeys:d,defaultExpandedKeys:f="all",onExpandedKeysChange:p,className:u,responsive:h=true,mobileBreakpoint:g=768,mobileTopOffset:b=48,mobileDrawerSlot:N,...x}){let[T,w]=useState(l),C=o??T,S=qr.useMemo(()=>Os(e),[e]),[R,V]=useState(()=>f==="all"?new Set(S):new Set(f)),I=d??null,E=I??R,v=useCallback(F=>{let K=new Set(E);K.has(F)?K.delete(F):K.add(F),V(K),p?.(K);},[E,p]),U=useCallback(()=>{let F=dp(C);w(F),c?.(F);},[C,c]),[k,q]=useState(()=>h&&typeof window<"u"&&window.innerWidth<g),[M,W]=useState(false),[$,ue]=useState(()=>{if(typeof window>"u")return "left";try{return localStorage.getItem("onyx-sidenav-side")||"left"}catch{return "left"}}),[J,de]=useState(()=>{if(typeof window>"u")return 50;try{return Number(localStorage.getItem("onyx-sidenav-top"))||50}catch{return 50}}),[re,B]=useState(null),j=useRef({dragging:false,startX:0,startY:0,moved:false}),pe=useCallback(F=>{if(F.pointerType==="mouse"&&F.button!==0)return;F.preventDefault(),j.current={dragging:true,startX:F.clientX,startY:F.clientY,moved:false};let K=X=>{if(!j.current.dragging)return;let fe=Math.abs(X.clientX-j.current.startX),we=Math.abs(X.clientY-j.current.startY);if((fe>6||we>6)&&(j.current.moved=true),!j.current.moved)return;let H=X.clientX<window.innerWidth/2?"left":"right",ne=b+28,Y=window.innerHeight-28,Q=Math.max(ne,Math.min(Y,X.clientY));B({side:H,y:Q});},oe=X=>{if(window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",oe),window.removeEventListener("pointercancel",oe),!j.current.dragging)return;if(j.current.dragging=false,!j.current.moved){let Q=ke=>{ke.stopPropagation(),ke.preventDefault(),window.removeEventListener("click",Q,true);};window.addEventListener("click",Q,true),B(null),W(true);return}let fe=X.clientX<window.innerWidth/2?"left":"right",we=b+28,H=window.innerHeight-28,Y=Math.max(we,Math.min(H,X.clientY))/window.innerHeight*100;ue(fe),de(Y),B(null);try{localStorage.setItem("onyx-sidenav-side",fe),localStorage.setItem("onyx-sidenav-top",String(Y));}catch{}};window.addEventListener("pointermove",K),window.addEventListener("pointerup",oe),window.addEventListener("pointercancel",oe);},[b]);useEffect(()=>{if(!h||typeof window>"u"||!window.matchMedia)return;let F=window.matchMedia(`(max-width: ${g-1}px)`),K=oe=>{q(oe.matches),oe.matches||W(false);};return F.addEventListener("change",K),()=>F.removeEventListener("change",K)},[h,g]);let ye=useCallback(F=>{F.target.closest("a")&&W(false);},[]),y=useRef(null),L=useRef({startX:0,startY:0,dragging:false}),G=60,O=useCallback(F=>{let K=F.touches[0];L.current={startX:K.clientX,startY:K.clientY,dragging:true};},[]),_=useCallback(F=>{if(!L.current.dragging||!y.current)return;let K=F.touches[0],oe=K.clientX-L.current.startX,X=K.clientY-L.current.startY;if($==="left"){if(oe>=0||Math.abs(X)>Math.abs(oe))return;y.current.style.transform=`translateX(${Math.max(oe,-224)}px)`;}else {if(oe<=0||Math.abs(X)>Math.abs(oe))return;y.current.style.transform=`translateX(${Math.min(oe,224)}px)`;}y.current.style.transition="none";},[$]),ee=useCallback(F=>{if(!L.current.dragging||!y.current)return;L.current.dragging=false;let K=F.changedTouches[0],oe=K.clientX-L.current.startX,X=K.clientY-L.current.startY;y.current.style.transition="",y.current.style.transform="",Math.abs(oe)>Math.abs(X)&&($==="left"&&oe<-G&&W(false),$==="right"&&oe>G&&W(false));},[$]),xe=useMemo(()=>!k||!n?n:(F,K)=>{W(false),n(F,K);},[k,n]),P=jsxs(Fragment,{children:[i&&!k&&jsx("div",{className:s("flex shrink-0 mb-1",C==="expanded"?"justify-end":"justify-center"),children:jsx("button",{type:"button",onClick:U,className:Nr,"aria-label":C==="mini"?"Expand sidebar":"Collapse sidebar",title:C==="mini"?"Expand sidebar":"Collapse sidebar",children:C==="mini"?jsx(Menu,{className:"h-5 w-5"}):jsx(ChevronsLeft,{className:"h-4 w-4"})})}),(k||C==="expanded")&&jsxs(Fragment,{children:[t&&jsx("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(F=>jsx($s,{item:F,basePath:r,depth:0,onItemClick:xe,LinkComponent:a,showLines:m,expandedKeys:I,onToggle:v},F.key??F.path??F.label))]}),!k&&C==="icons"&&e.map(F=>{let K=F.key??F.path??F.label;return F.children&&F.children.length>0?jsx(mp,{item:F,basePath:r,onItemClick:xe,LinkComponent:a},K):jsx(pp,{item:F,basePath:r,onItemClick:xe,LinkComponent:a},K)})]});if(h&&k){let F=re?re.side:$,K=re?re.y:J/100*(typeof window<"u"?window.innerHeight:600),oe=re?{top:K,transform:"translateY(-50%)",transition:"none",...F==="left"?{left:0}:{right:0}}:{top:`${J}%`,transform:"translateY(-50%)",transition:"top 0.15s ease",...$==="left"?{left:0}:{right:0}},X$1=$==="left"?{left:0,right:"auto"}:{right:0,left:"auto"},fe=M?"translate-x-0":$==="left"?"-translate-x-full":"translate-x-full",we=$==="left"?"border-r":"border-l";return jsxs(Fragment,{children:[M&&createPortal(jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:b},onClick:()=>W(false)}),document.body),createPortal(jsxs("aside",{ref:y,className:s("fixed bottom-0 z-50 flex flex-col w-56 bg-white dark:bg-primary-900 shadow-xl transition-transform duration-200",we,"border-primary-200 dark:border-primary-700",fe),style:{top:b,...X$1},onClick:ye,onTouchStart:O,onTouchMove:_,onTouchEnd:ee,children:[jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-500 dark:text-primary-400",children:"Navigation"}),jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),W(false);},className:s(Nr,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsx(X,{className:"h-4 w-4"})})]}),N&&jsx("div",{className:"shrink-0 border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:N}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsx("nav",{className:"flex flex-col gap-0.5",children:P})})]}),document.body),!M&&createPortal(jsx("div",{className:s("fixed z-50 flex items-center",F==="left"?"justify-start":"justify-end",re?"cursor-grabbing":"cursor-grab"),style:{...oe,width:44,height:80,marginTop:-12,touchAction:"none",userSelect:"none"},onPointerDown:pe,onDragStart:H=>H.preventDefault(),role:"button","aria-label":"Open navigation",tabIndex:0,children:jsx("div",{className:s("flex h-16 w-6 items-center justify-center","bg-primary-800/80 text-white shadow-md backdrop-blur-sm","hover:bg-primary-700/90 dark:bg-primary-200/80 dark:text-primary-900 dark:hover:bg-primary-300/90",F==="left"?"rounded-r-xl":"rounded-l-xl"),children:F==="left"?jsx(ChevronRight,{className:"h-4 w-4"}):jsx(ChevronLeft,{className:"h-4 w-4"})})}),document.body)]})}return jsx("nav",{className:s("flex flex-col gap-0.5",C==="mini"&&"items-center",u),...x,children:P})}function gp({href:e,className:t,onClick:r,children:n}){return jsx("a",{href:e,className:t,onClick:r,children:n})}function Bo({brand:e,onBrandClick:t,navItems:r=[],actions:n=[],linkComponent:a=gp,height:i="h-12",mobileMenu:o=false,navMenuIcon:l,actionsMenuIcon:c,className:m,children:d}){let f=o&&r.length>0,p=o&&n.length>0,u="md:hidden rounded-md px-1.5 py-1.5 text-primary-500 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-200 [&_svg]:h-5 [&_svg]:w-5",h=x=>x?"text-primary-900 font-medium dark:text-primary-100":"text-primary-500 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-200 transition-colors",g="rounded-md p-1.5 text-primary-500 hover:bg-primary-100 hover:text-primary-700 dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200 transition-colors [&_svg]:h-5 [&_svg]:w-5",b=r.map((x,T)=>({key:typeof x.label=="string"?x.label:String(T),label:x.active?jsx("span",{className:"font-semibold text-primary-900 dark:text-primary-100",children:x.label}):x.label,onClick:()=>{x.onClick?x.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):x.href&&(window.location.href=x.href);}})),N=n.map((x,T)=>({key:x.key??String(T),label:jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[x.icon,jsx("span",{children:x.ariaLabel})]}),onClick:()=>{x.onClick?x.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):x.href&&(x.external?window.open(x.href,"_blank","noopener,noreferrer"):window.location.href=x.href);}}));return jsxs("header",{className:s("flex shrink-0 items-center justify-between border-b px-5","border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",i,m),children:[jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&jsx("div",{className:s("text-lg font-bold text-primary-800 dark:text-primary-100",t&&"cursor-pointer"),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),t(x));}:void 0,children:e}),f&&jsx(hr,{intent:"ghost",size:"sm",className:u,label:l??jsx(PanelLeft,{className:"h-5 w-5"}),items:b,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsx("nav",{className:s("flex items-center gap-4 text-sm",o?"hidden md:flex":"flex"),children:r.map((x,T)=>{let w=typeof x.label=="string"?x.label:T,C=h(x.active);return x.href?jsx(a,{href:x.href,className:C,onClick:x.onClick,children:x.label},w):jsx("button",{type:"button",className:s(C,"cursor-pointer"),onClick:x.onClick,children:x.label},w)})})]}),d&&jsx("div",{className:"flex items-center",children:d}),jsxs("div",{className:"flex items-center gap-1",children:[n.length>0&&jsx("div",{className:s("flex items-center gap-1",o?"hidden md:flex":"flex"),children:n.map((x,T)=>x.href?jsx("a",{href:x.href,target:x.external?"_blank":void 0,rel:x.external?"noopener noreferrer":void 0,className:g,"aria-label":x.ariaLabel,onClick:x.onClick,children:x.icon},x.key??T):jsx("button",{type:"button",className:g,"aria-label":x.ariaLabel,onClick:x.onClick,children:x.icon},x.key??T))}),p&&jsx(hr,{intent:"ghost",size:"sm",className:u,label:c??jsx(MoreHorizontal,{className:"h-5 w-5"}),items:N,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var Zn=cva("inline-flex items-center gap-1 underline-offset-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/20 [&_svg]:shrink-0",{variants:{intent:{default:"text-primary-600 hover:text-primary-800 active:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:active:text-primary-100",secondary:"text-secondary-500 hover:text-secondary-700 active:text-secondary-800 dark:text-secondary-400 dark:hover:text-secondary-200 dark:active:text-secondary-100",muted:"text-primary-400 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-300"},size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},underline:{always:"underline",hover:"hover:underline",none:"no-underline"}},defaultVariants:{intent:"default",size:"md",underline:"none"}});function hp(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var yp=e=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,...e,children:[jsx("path",{d:"M15 3h6v6"}),jsx("path",{d:"M10 14 21 3"}),jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]});function Oo({intent:e,size:t,underline:r,external:n,className:a,children:i,href:o,target:l,rel:c,...m}){let d=n??hp(o,l);return jsxs("a",{href:o,target:d&&!l?"_blank":l,rel:d&&!c?"noopener noreferrer":c,className:s(Zn({intent:e,size:t,underline:r}),a),...m,children:[i,d&&jsx(yp,{})]})}function ta({items:e,separator:t=jsx(ChevronRight,{className:"h-3.5 w-3.5","aria-hidden":"true"}),homeIcon:r=false,LinkComponent:n="a",className:a}){return jsx("nav",{"aria-label":"Breadcrumb",className:s("flex",a),children:jsx("ol",{className:"flex flex-wrap items-center gap-1 text-sm",children:e.map((i,o)=>{let l=o===e.length-1,c=r===true?jsx(Home,{className:"h-3.5 w-3.5"}):r!==false&&r!==void 0?r:null,m=o===0&&c?c:i.icon;return jsxs("li",{className:"flex items-center gap-1",children:[o>0&&jsx("span",{className:"text-secondary-400 dark:text-secondary-500",children:t}),l?jsxs("span",{"aria-current":"page",className:s("flex items-center gap-1 font-medium text-primary-800 dark:text-primary-100",m&&"gap-1.5"),children:[m,i.label]}):i.href?jsxs(n,{href:i.href,className:s("flex items-center gap-1 text-secondary-500 transition-colors","hover:text-primary-700 dark:text-secondary-400 dark:hover:text-primary-200","rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",m&&"gap-1.5"),children:[m,i.label]}):jsxs("span",{className:"flex items-center gap-1 text-secondary-500 dark:text-secondary-400",children:[m,i.label]})]},o)})})})}function ra(e,t){let r=[];for(let n=e;n<=t;n++)r.push(n);return r}function Mp(e,t,r){let n=r*2+5;if(t<=n)return ra(1,t);let a=Math.max(e-r,1),i=Math.min(e+r,t),o=a>2,l=i<t-1;return !o&&l?[...ra(1,3+r*2),"\u2026",t]:o&&!l?[1,"\u2026",...ra(t-(3+r*2)+1,t)]:[1,"\u2026",...ra(a,i),"\u2026",t]}var Xs={sm:"h-7 min-w-7 px-1.5 text-xs",md:"h-9 min-w-9 px-2 text-sm",lg:"h-11 min-w-11 px-2.5 text-base"},en={sm:"h-3.5 w-3.5",md:"h-4 w-4",lg:"h-5 w-5"};function tn({onClick:e,disabled:t,active:r,size:n,"aria-label":a,children:i}){return jsx("button",{type:"button",onClick:e,disabled:t,"aria-label":a,"aria-current":r?"page":void 0,className:s("inline-flex items-center justify-center rounded font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",Xs[n],r?"bg-primary-600 text-white dark:bg-primary-500":"border border-primary-200 bg-white text-primary-700 hover:bg-primary-50 dark:border-primary-700 dark:bg-primary-900 dark:text-primary-300 dark:hover:bg-primary-800",t&&"pointer-events-none opacity-40"),children:i})}function na({totalPages:e,currentPage:t,onPageChange:r,siblingCount:n=2,showFirstLast:a=true,showPageCount:i=false,size:o="md",className:l}){if(e<=1)return null;let c=Mp(t,e,n);return jsxs("nav",{"aria-label":"Pagination",className:s("flex items-center gap-1",l),children:[a&&jsx(tn,{size:o,onClick:()=>r(1),disabled:t===1,"aria-label":"First page",children:jsx(ChevronsLeft,{className:en[o]})}),jsx(tn,{size:o,onClick:()=>r(t-1),disabled:t===1,"aria-label":"Previous page",children:jsx(ChevronLeft,{className:en[o]})}),c.map((m,d)=>m==="\u2026"?jsx("span",{className:s("inline-flex items-center justify-center text-secondary-400",Xs[o]),"aria-hidden":"true",children:jsx(MoreHorizontal,{className:en[o]})},`ellipsis-${d}`):jsx(tn,{size:o,active:m===t,onClick:()=>r(m),"aria-label":`Page ${m}`,children:m},m)),jsx(tn,{size:o,onClick:()=>r(t+1),disabled:t===e,"aria-label":"Next page",children:jsx(ChevronRight,{className:en[o]})}),a&&jsx(tn,{size:o,onClick:()=>r(e),disabled:t===e,"aria-label":"Last page",children:jsx(ChevronsRight,{className:en[o]})}),i&&jsxs("span",{className:"ml-2 text-sm text-secondary-500 dark:text-secondary-400",children:["Page ",t," of ",e]})]})}function Ws({item:e,mode:t}){return e.separator?jsx("div",{className:"mx-1 h-10 w-px self-center bg-primary-200 dark:bg-primary-700","aria-hidden":true}):jsxs("button",{type:"button",title:e.title??e.label,disabled:e.disabled,onClick:e.onClick,"aria-pressed":e.active,className:s("relative flex shrink-0 items-center justify-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400","disabled:cursor-not-allowed disabled:opacity-40",e.active?"bg-primary-100 text-primary-700 shadow-inner dark:bg-primary-800 dark:text-primary-200":"text-primary-700 hover:bg-primary-50 active:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",t==="full"?"min-w-[3.5rem] flex-col gap-0.5 py-2":"","[&_svg]:shrink-0",t==="full"?"[&_svg]:h-5 [&_svg]:w-5":"[&_svg]:h-4 [&_svg]:w-4"),children:[e.icon&&jsx("span",{children:e.icon}),t!=="icons"&&jsx("span",{className:s(t==="full"?"text-[0.6rem] leading-tight":""),children:e.label})]})}function Dp({group:e,mode:t,disabled:r=false}){return jsxs("div",{className:s("flex shrink-0 flex-col items-stretch",r&&"opacity-50"),children:[jsx("div",{className:"flex items-center gap-0.5 px-1",children:e.items.map(n=>jsx(Ws,{item:r?{...n,disabled:true}:n,mode:t},n.key))}),t==="full"&&jsx("div",{className:"mt-1 border-t border-primary-100 px-2 pt-0.5 text-center dark:border-primary-800",children:jsx("span",{className:"text-[0.55rem] text-secondary-400 dark:text-secondary-500",children:e.label})})]})}function Yo({tabs:e,defaultTab:t,activeTab:r,onTabChange:n,mode:a,onModeChange:i,sticky:o=false,className:l}){let c=e.filter(w=>!w.hidden),[m,d]=useState(t??c[0]?.key??""),[f,p]=useState(a??"full"),[u,h]=useState(true),g=r??m,b=a??f,N=w=>{if(!c.find(S=>S.key===w)?.disabled){if(w===g&&b!=="icons"){h(S=>!S);return}d(w),n?.(w),h(true);}},T=c.find(w=>w.key===g)??c[0];return jsxs("div",{className:s("select-none border-b border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",o&&"sticky top-0 z-30",l),children:[jsxs("div",{className:"flex items-center border-b border-primary-100 dark:border-primary-800",children:[jsx("div",{className:"flex flex-1 items-end overflow-x-auto",children:c.map(w=>jsxs("button",{type:"button",disabled:w.disabled,onClick:()=>N(w.key),className:s("flex shrink-0 items-center gap-1.5 border-b-2 px-4 py-2 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400 [&_svg]:h-4 [&_svg]:w-4",w.disabled?"cursor-not-allowed border-transparent text-secondary-300 opacity-50 dark:text-secondary-600":w.key===g&&u?"border-primary-500 text-primary-700 dark:border-primary-400 dark:text-primary-200":"border-transparent text-secondary-500 hover:border-primary-300 hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-300"),children:[w.icon,w.label]},w.key))}),jsx("button",{type:"button",title:u?"Collapse ribbon":"Expand ribbon",onClick:()=>h(w=>!w),className:"ml-auto mr-2 rounded-md p-1.5 text-secondary-400 transition-colors hover:bg-primary-50 hover:text-primary-600 dark:hover:bg-primary-800 dark:hover:text-primary-300",children:u?jsx(ChevronUp,{className:"h-4 w-4"}):jsx(ChevronDown,{className:"h-4 w-4"})})]}),u&&T&&b!=="icons"&&jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto px-2 py-1.5",children:T.groups.map((w,C)=>jsxs(qr.Fragment,{children:[C>0&&jsx("div",{className:"mx-1 h-auto w-px self-stretch bg-primary-100 dark:bg-primary-800"}),jsx(Dp,{group:w,mode:b,disabled:w.disabled||T.disabled})]},w.key))}),b==="icons"&&u&&T&&jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto px-2 py-1",children:T.groups.flatMap(w=>w.items.map(C=>jsx(Ws,{item:w.disabled||T.disabled?{...C,disabled:true}:C,mode:"icons"},C.key)))})]})}var Lp={SideNav:zo,Header:Bo,NavLink:Oo,Breadcrumb:ta,Pagination:na,RibbonBar:Yo},Ko=Lp;var aa=cva("flex w-full items-center justify-between font-medium transition-all [&_svg]:shrink-0",{variants:{size:{sm:"py-2 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-3 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-4 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),oa=cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),ia=cva("divide-y",{variants:{intent:{default:"divide-primary-300 dark:divide-primary-700",bordered:"divide-primary-300 rounded-lg border border-primary-300 bg-white px-3 shadow-sm dark:divide-primary-700 dark:border-primary-700 dark:bg-primary-800/50",ghost:"divide-transparent"}},defaultVariants:{intent:"default"}}),sa=cva("flex",{variants:{intent:{line:"border-b border-primary-200 dark:border-primary-700",pills:"gap-1 rounded-lg bg-primary-100 p-1 dark:bg-primary-800",underline:"gap-4"}},defaultVariants:{intent:"line"}}),la=cva("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{intent:{line:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:data-[active=true]:text-primary-100",pills:"rounded-md text-primary-600 hover:text-primary-900 data-[active=true]:bg-white data-[active=true]:text-primary-900 data-[active=true]:shadow-sm dark:text-primary-400 dark:hover:text-primary-100 dark:data-[active=true]:bg-primary-700 dark:data-[active=true]:text-primary-100",underline:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:data-[active=true]:text-primary-100"}},defaultVariants:{intent:"line"}});var ca=createContext(null),Xo=createContext(null);function Wo({type:e="single",defaultValue:t=[],value:r,onValueChange:n,intent:a,size:i,className:o,children:l,...c}){let[m,d]=useState(t),f=r??m,p=useCallback(u=>{let h=g=>g.includes(u)?g.filter(b=>b!==u):e==="single"?[u]:[...g,u];n?n(h(f)):d(h);},[e,f,n]);return jsx(ca.Provider,{value:{expandedItems:f,toggleItem:p,size:i},children:jsx("div",{className:s(ia({intent:a}),o),...c,children:l})})}function Ap({value:e,className:t,children:r,...n}){let i=useContext(ca)?.expandedItems.includes(e)??false;return jsx(Xo.Provider,{value:{value:e,isExpanded:i},children:jsx("div",{className:s("",t),...n,children:r})})}function Hp({className:e,children:t,...r}){let n=useContext(ca),a=useContext(Xo);return jsxs("button",{className:s("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 cursor-pointer gap-2 font-medium transition-colors",aa({size:n?.size}),e),onClick:()=>a&&n?.toggleItem(a.value),"aria-expanded":a?.isExpanded?"true":"false",...r,children:[jsx("span",{className:"flex items-center gap-1.5 [&_svg]:shrink-0",children:t}),jsx(ChevronDown,{className:s("shrink-0 transition-transform duration-200",a?.isExpanded&&"rotate-180")})]})}function Fp({className:e,children:t,...r}){let n=useContext(ca),a=useContext(Xo);return jsx("div",{className:s("grid transition-[grid-template-rows] duration-200 ease-out",a?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("div",{className:s("text-primary-500 dark:text-primary-400",oa({size:n?.size}),e),...r,children:t})})})}var on=createContext(null),Zs=createContext(false);function jo({defaultValue:e="",value:t,onValueChange:r,intent:n,children:a,className:i}){let[o,l]=useState(e),c=t??o,m=useRef(new Map),d=useCallback(p=>{r?r(p):l(p);},[r]),f=useCallback((p,u)=>{u?m.current.set(p,u):m.current.delete(p);},[]);return jsx(on.Provider,{value:{activeValue:c,setActiveValue:d,intent:n,registerTrigger:f},children:jsx("div",{className:i,children:a})})}function Op({className:e,scrollable:t,...r}){let n=useContext(on),a=useRef(null),[i,o]=useState(null),l=useCallback(()=>{if(!n||!a.current)return;let f=a.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!f){o(null);return}let p=a.current.getBoundingClientRect(),u=f.getBoundingClientRect();o({left:u.left-p.left,width:u.width});},[n]);useLayoutEffect(l,[n?.activeValue,l]),useEffect(()=>{let d=new ResizeObserver(l);return a.current&&d.observe(a.current),()=>d.disconnect()},[l]);let c=n?.intent??"line",m=i&&(c==="line"||c==="underline");return jsxs("div",{ref:a,className:s(sa({intent:n?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,m&&jsx("span",{className:"absolute bottom-0 h-0.5 rounded-full bg-primary-600 dark:bg-primary-400 transition-all duration-300 ease-in-out",style:{left:i.left,width:i.width},"aria-hidden":true})]})}function $p({value:e,className:t,children:r,...n}){let a=useContext(on),i=a?.activeValue===e,o=useCallback(l=>a?.registerTrigger(e,l),[a,e]);return jsx("button",{ref:o,className:s(la({intent:a?.intent}),t),role:"tab","data-active":i,"aria-selected":i,onClick:()=>a?.setActiveValue(e),...n,children:r})}function Yp({className:e,children:t,...r}){let n=useContext(on);if(!n)return null;let a=qr.Children.toArray(t).filter(o=>qr.isValidElement(o)),i=Math.max(0,a.findIndex(o=>o.props.value===n.activeValue));return jsx("div",{className:s("overflow-hidden",e),...r,children:jsx(Zs.Provider,{value:true,children:jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${i*100}%)`},children:a.map((o,l)=>jsx("div",{className:"w-full shrink-0","aria-hidden":l!==i,children:o},o.props.value??l))})})})}function Kp({value:e,className:t,children:r,...n}){let a=useContext(on);return useContext(Zs)?jsx("div",{className:s("pt-4",t),role:"tabpanel",...n,children:r}):a?.activeValue!==e?null:jsx("div",{className:s("pt-4",t),role:"tabpanel",...n,children:r})}var Wp={Accordion:Wo,Tabs:jo},Go=Wp;var sn=cva("rounded-lg bg-white p-6 shadow-xl dark:bg-primary-900",{variants:{size:{sm:"w-full max-w-sm",md:"w-full max-w-lg",lg:"w-full max-w-2xl",xl:"w-full max-w-4xl",full:"h-[calc(100vh-4rem)] w-[calc(100vw-4rem)]"}},defaultVariants:{size:"md"}}),ma=cva("absolute z-50 rounded px-2 py-1 text-xs shadow-md animate-fade-in",{variants:{intent:{default:"bg-primary-900 text-white dark:bg-primary-100 dark:text-primary-900",light:"border border-primary-200 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200"}},defaultVariants:{intent:"default"}});var _t=[];function Qp(e){_t.push(e);}function Zp(e){let t=_t.indexOf(e);t!==-1&&_t.splice(t,1);}function qo(e){return _t.length>0&&_t[_t.length-1]===e}function Jp(e){let t=_t.indexOf(e);return t!==-1?t:_t.length}var Qo=createContext(null);function ln({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:a}){let i=useId();return useEffect(()=>{if(e)return Qp(i),()=>Zp(i)},[e,i]),useEffect(()=>{if(!e||!r)return;let o=l=>{l.key==="Escape"&&qo(i)&&t(false);};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,r,t,i]),useEffect(()=>{if(!e||!r)return;let o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o;}},[e,r]),e?jsx(Qo.Provider,{value:{id:i,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:createPortal(a,document.body)}):null}function Zo({size:e,position:t="center",className:r,children:n,...a}){let i=useContext(Qo);if(!i)return null;let l=200+Jp(i.id)*10,c=()=>{i.closeOnOutsideClick&&qo(i.id)&&i.onOpenChange(false);},m=t==="bottom";return i.modal?jsx("div",{className:s("animate-fade-in fixed inset-0 bg-black/50",m?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:l},onClick:c,children:jsx("div",{className:s(sn({size:e}),m?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",r),role:"dialog","aria-modal":"true",onClick:d=>d.stopPropagation(),...a,children:n})}):jsx("div",{className:s("fixed inset-0 flex items-center justify-center p-4",i.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:l},onClick:i.closeOnOutsideClick&&qo(i.id)?()=>i.onOpenChange(false):void 0,children:jsx("div",{className:s(sn({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:i.closeOnOutsideClick?d=>d.stopPropagation():void 0,...a,children:n})})}function Jo({className:e,...t}){return jsx("div",{className:s("mb-4 space-y-1",e),...t})}function ei({className:e,...t}){return jsx("h2",{className:s("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function ti({className:e,...t}){return jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function ri({className:e,...t}){return jsx("div",{className:s("mt-6 flex justify-end gap-2",e),...t})}function eu({className:e,...t}){let r=useContext(Qo);return jsx("button",{className:s("text-primary-400 hover:text-primary-600 dark:hover:text-primary-200 absolute top-4 right-4 rounded-md p-1 transition-colors",e),onClick:()=>r?.onOpenChange(false),"aria-label":"Close",...t,children:jsx(X,{className:"h-4 w-4"})})}var tu={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};function ni({content:e,position:t="top",intent:r,delay:n=200,maxWidth:a,children:i,className:o}){let[l,c]=useState(false),[m,d]=useState();return jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let u=setTimeout(()=>c(true),n);d(u);},onMouseLeave:()=>{clearTimeout(m),c(false);},children:[i,l&&jsx("span",{className:s(ma({intent:r}),tu[t],"pointer-events-none",a?"whitespace-normal":"whitespace-nowrap",o),style:a!==void 0?{maxWidth:a}:void 0,role:"tooltip",children:e})]})}var su={right:"drawer-enter-right",left:"drawer-enter-left",top:"drawer-enter-top",bottom:"drawer-enter-bottom"},lu={right:e=>({width:e}),left:e=>({width:e}),top:e=>({height:e}),bottom:e=>({height:e})},cu={right:"right-0 top-0 bottom-0",left:"left-0 top-0 bottom-0",top:"top-0 left-0 right-0",bottom:"bottom-0 left-0 right-0"};function pa({open:e,onOpenChange:t,side:r="right",size:n=r==="top"||r==="bottom"?"50vh":"24rem",backdrop:a=true,closeOnBackdropClick:i=true,children:o,className:l}){let c=useRef(null);return useEffect(()=>{if(!e)return;let m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=m;}},[e]),useEffect(()=>{if(!e)return;function m(d){d.key==="Escape"&&t(false);}return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),useEffect(()=>{if(!e)return;let m=c.current;if(!m)return;let d=m.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');d[0]?.focus();function f(p){p.key!=="Tab"||d.length===0||(p.shiftKey?document.activeElement===d[0]&&(p.preventDefault(),d[d.length-1].focus()):document.activeElement===d[d.length-1]&&(p.preventDefault(),d[0].focus()));}return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e]),e?createPortal(jsxs("div",{className:"fixed inset-0 z-50",role:"presentation",children:[a&&jsx("div",{className:"drawer-backdrop absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:()=>i&&t(false),"aria-hidden":"true"}),jsx("div",{ref:c,role:"dialog","aria-modal":"true",className:s("drawer-panel absolute flex flex-col","bg-white shadow-2xl dark:bg-primary-900",cu[r],su[r],l),style:lu[r](n),children:o})]}),document.body):null}function rl({children:e,className:t}){return jsx("div",{className:s("flex shrink-0 items-center justify-between border-b border-primary-100 px-5 py-4 dark:border-primary-800",t),children:e})}function nl({children:e,className:t}){return jsx("div",{className:s("flex-1 overflow-y-auto px-5 py-4",t),children:e})}function al({children:e,className:t}){return jsx("div",{className:s("flex shrink-0 items-center justify-end gap-3 border-t border-primary-100 px-5 py-4 dark:border-primary-800",t),children:e})}function ol({onClose:e,className:t}){return jsx("button",{type:"button",onClick:e,"aria-label":"Close drawer",className:s("rounded-md p-1.5 text-secondary-400 transition-colors","hover:bg-primary-100 hover:text-primary-700 dark:hover:bg-primary-800 dark:hover:text-primary-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",t),children:jsx(X,{className:"h-4 w-4"})})}function il({item:e,depth:t=0,onClose:r}){let[n,a]=useState(false),i=useRef(null),o=useRef(null),l=e.children&&e.children.length>0,c=useRef(null),m=()=>{c.current=setTimeout(()=>a(false),150);},d=()=>{c.current&&clearTimeout(c.current);};return e.separator?jsx("li",{role:"separator",className:"my-1 h-px bg-primary-100 dark:bg-primary-700","aria-hidden":true}):jsxs("li",{ref:i,role:"menuitem","aria-disabled":e.disabled,"aria-haspopup":l,"aria-expanded":l?n:void 0,className:s("relative flex cursor-pointer select-none items-center gap-2 rounded-md px-3 py-1.5 text-sm outline-none transition-colors",e.disabled?"cursor-not-allowed opacity-40":e.danger?"text-danger-600 hover:bg-danger-50 focus-visible:bg-danger-50 dark:text-danger-400 dark:hover:bg-danger-900/30":"text-primary-700 hover:bg-primary-50 focus-visible:bg-primary-50 dark:text-primary-200 dark:hover:bg-primary-800"),tabIndex:e.disabled?-1:0,onMouseEnter:()=>{d(),l&&a(true);},onMouseLeave:()=>{l&&m();},onClick:f=>{e.disabled||l||(e.onClick?.(f),r());},onKeyDown:f=>{e.disabled||((f.key==="Enter"||f.key===" ")&&(f.preventDefault(),l?a(p=>!p):(e.onClick?.(f),r())),f.key==="Escape"&&r());},children:[e.icon?jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center [&_svg]:h-4 [&_svg]:w-4",children:e.icon}):jsx("span",{className:"h-4 w-4 shrink-0"}),jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&!l&&jsx("kbd",{className:"ml-auto rounded bg-primary-100 px-1.5 py-0.5 font-mono text-[0.6rem] text-secondary-500 dark:bg-primary-700 dark:text-secondary-400",children:e.shortcut}),l&&jsx(ChevronRight,{className:"ml-auto h-3.5 w-3.5 text-secondary-400"}),l&&n&&jsx("ul",{ref:o,role:"menu",onMouseEnter:d,onMouseLeave:m,className:s("absolute top-0 z-50 min-w-[11rem] animate-[fade-in_120ms_ease-out,scale-in_120ms_ease-out] rounded-xl border border-primary-200 bg-white p-1.5 shadow-xl dark:border-primary-700 dark:bg-primary-900",t%2===0?"left-full ml-1":"right-full mr-1"),children:e.children.map(f=>jsx(il,{item:f,depth:t+1,onClose:r},f.key))})]})}function pu({items:e,position:t,onClose:r}){let n=useRef(null),[a,i]=useState(t);return useEffect(()=>{let o=n.current;if(!o)return;let l=o.getBoundingClientRect(),c=window.innerWidth,m=window.innerHeight,{x:d,y:f}=t;d+l.width>c-8&&(d=Math.max(8,c-l.width-8)),f+l.height>m-8&&(f=Math.max(8,m-l.height-8)),i({x:d,y:f});},[t]),useEffect(()=>{let o=l=>{n.current&&!n.current.contains(l.target)&&r();};return document.addEventListener("mousedown",o,true),document.addEventListener("touchstart",o,true),document.addEventListener("scroll",r,{passive:true,capture:true}),()=>{document.removeEventListener("mousedown",o,true),document.removeEventListener("touchstart",o,true),document.removeEventListener("scroll",r,true);}},[r]),useEffect(()=>{let o=l=>{l.key==="Escape"&&r(),l.key==="Tab"&&l.preventDefault();};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[r]),jsx("ul",{ref:n,role:"menu",style:{position:"fixed",left:a.x,top:a.y},className:"z-[9999] min-w-[12rem] animate-[fade-in_120ms_ease-out,scale-in_120ms_ease-out] rounded-xl border border-primary-200 bg-white p-1.5 shadow-2xl dark:border-primary-700 dark:bg-primary-900",children:e.map(o=>jsx(il,{item:o,onClose:r},o.key))})}function ii({items:e,children:t,disabled:r,onOpenChange:n,className:a}){let[i,o]=useState(false),[l,c]=useState({x:0,y:0}),m=useRef(null),d=useCallback((g,b)=>{r||(c({x:g,y:b}),o(true),n?.(true));},[r,n]),f=useCallback(()=>{o(false),n?.(false);},[n]),p=useCallback(g=>{g.preventDefault(),g.stopPropagation(),d(g.clientX,g.clientY);},[d]),u=useCallback(g=>{let b=g.touches[0];m.current=setTimeout(()=>{document.addEventListener("contextmenu",N=>N.preventDefault(),{capture:true,once:true}),d(b.clientX,b.clientY);},500);},[d]),h=useCallback(()=>{m.current&&clearTimeout(m.current);},[]);return jsxs(Fragment,{children:[jsx("div",{className:s("contents",a),style:{WebkitTouchCallout:"none",userSelect:"none"},onContextMenu:p,onTouchStart:u,onTouchEnd:h,onTouchMove:h,onTouchCancel:h,children:t}),i&&jsx(pu,{items:e,position:l,onClose:f})]})}var fu={Dialog:ln,Tooltip:ni,Drawer:pa,ContextMenu:ii},si=fu;var fa=cva("relative w-full overflow-hidden rounded-full bg-primary-200 dark:bg-primary-700",{variants:{size:{xs:"h-1",sm:"h-2",md:"h-3",lg:"h-4"},intent:{primary:"[&_.progress-fill]:bg-primary-500",success:"[&_.progress-fill]:bg-success-500",warning:"[&_.progress-fill]:bg-warning-500",danger:"[&_.progress-fill]:bg-danger-500"},edge:{none:"rounded-full",top:"fixed top-0 left-0 right-0 z-50 rounded-none",bottom:"fixed bottom-0 left-0 right-0 z-50 rounded-none"}},defaultVariants:{size:"md",intent:"primary",edge:"none"}}),Tr=cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),pn=cva("pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg transition-all",{variants:{intent:{success:"border-success-200 bg-success-50 text-success-800 dark:border-success-800 dark:bg-success-900/80 dark:text-success-200",warning:"border-warning-200 bg-warning-50 text-warning-800 dark:border-warning-800 dark:bg-warning-900/80 dark:text-warning-200",error:"border-danger-200 bg-danger-50 text-danger-800 dark:border-danger-800 dark:bg-danger-900/80 dark:text-danger-200",info:"border-primary-200 bg-primary-50 text-primary-800 dark:border-primary-800 dark:bg-primary-900/80 dark:text-primary-200"}},defaultVariants:{intent:"info"}}),un=cva("skeleton-base bg-secondary-200 dark:bg-secondary-700",{variants:{variant:{text:"skeleton-text w-full rounded-sm",circular:"rounded-full",rectangular:"rounded-none",rounded:"rounded-md"},animation:{pulse:"animate-pulse",wave:"skeleton-wave",none:""}},defaultVariants:{variant:"text",animation:"pulse"}}),ga=cva("border",{variants:{variant:{default:"bg-primary-800 text-primary-50 border-primary-700 dark:bg-primary-100 dark:text-primary-900 dark:border-primary-200",success:"bg-success-500 text-white border-success-600 dark:bg-success-600 dark:border-success-700",danger:"bg-danger-500 text-white border-danger-600 dark:bg-danger-600 dark:border-danger-700",warning:"bg-warning-500 text-warning-900 border-warning-600 dark:bg-warning-600 dark:text-white dark:border-warning-700",info:"bg-primary-500 text-white border-primary-600 dark:bg-primary-600 dark:border-primary-700"}},defaultVariants:{variant:"default"}});function mi({intent:e,className:t,children:r,...n}){return jsx("div",{className:s(pn({intent:e}),t),role:"alert",...n,children:r})}function Cu({className:e,...t}){return jsx("h5",{className:s("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function Tu({className:e,...t}){return jsx("span",{className:s("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function Mu({className:e,...t}){return jsx("div",{className:s("flex-1 min-w-0 space-y-1",e),...t})}function Ru({className:e,...t}){return jsx("p",{className:s("text-sm opacity-90",e),...t})}var Su=0,ir=[],ba=new Map,li=new Set;function Pu(){return ir}function ci(){li.forEach(e=>e());}function pi(e){let t=ba.get(e);t&&(clearTimeout(t),ba.delete(e)),ir=ir.map(r=>r.id===e?{...r,exiting:true}:r),ci(),setTimeout(()=>{ir=ir.filter(r=>r.id!==e),ci();},200);}function Du(e){let t=`alert-${++Su}`;ir=[...ir,{...e,id:t}],ci();let r=e.duration??5e3;if(r>0){let n=setTimeout(()=>{ba.delete(t),pi(t);},r);ba.set(t,n);}return t}var di=16;function Lu(e){di=e;}var Eu={"top-right":"right-4 items-end","top-left":"left-4 items-start","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","top-center":"left-1/2 -translate-x-1/2 items-center","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},Vu={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-center":"animate-slide-in-bottom"},Iu={success:CircleCheck,warning:TriangleAlert,error:CircleX,info:Info};function Au({alert:e,onClose:t}){let r=e.intent??"info",n=Iu[r],a=e.position??"top-right";return jsxs("div",{className:s(pn({intent:r}),Vu[a],e.exiting&&"opacity-0 transition-opacity duration-200","w-80 max-w-[calc(100vw-2rem)]"),role:"alert",children:[jsx(n,{className:"mt-0.5 h-5 w-5 shrink-0"}),jsxs("div",{className:"flex-1",children:[e.title&&jsx("p",{className:"font-semibold",children:e.title}),jsx("p",{className:s(e.title&&"text-sm opacity-90"),children:e.message})]}),jsx("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:jsx(X,{className:"h-4 w-4"})})]})}var Hu=e=>e.startsWith("top");function Fu(){let e=useSyncExternalStore(n=>(li.add(n),()=>li.delete(n)),Pu),t=useRef(di);if(useEffect(()=>{t.current=di;},[]),e.length===0)return null;let r=e.reduce((n,a)=>{let i=a.position??"top-right";return (n[i]??(n[i]=[])).push(a),n},{});return createPortal(jsx(Fragment,{children:Object.entries(r).map(([n,a])=>jsx("div",{style:Hu(n)?{top:`${t.current}px`}:void 0,className:s("pointer-events-none fixed z-100 flex flex-col gap-2",Eu[n]),children:a.map(i=>jsx(Au,{alert:i,onClose:()=>pi(i.id)},i.id))},n))}),document.body)}var ll=false;function _u(){if(ll)return;ll=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),createRoot(e).render(jsx(Fu,{}));}function zu(){return useEffect(()=>{_u();},[]),{addAlert:Du,removeAlert:pi}}function fi({value:e=0,size:t,intent:r,edge:n,showLabel:a=false,indeterminate:i=false,animated:o=false,duration:l=500,className:c,...m}){let d=Math.max(0,Math.min(100,e)),[f,p]=useState(0),u=useRef(0);useEffect(()=>{if(!i)return u.current=requestAnimationFrame(()=>{p(d);}),()=>{u.current&&cancelAnimationFrame(u.current);}},[d,i]);let h=a&&!i&&t!=="xs"&&t!=="sm",g=jsx("div",{role:"progressbar","aria-valuenow":i?void 0:d,"aria-valuemin":0,"aria-valuemax":100,className:s(fa({size:t,intent:r,edge:n}),c),...m,children:i?jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsx("div",{className:s("progress-fill h-full rounded-full transition-[width] ease-out",o&&"animate-progress-shine"),style:{width:`${f}%`,transitionDuration:`${l}ms`},children:h&&jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(d),"%"]})})});return n==="top"||n==="bottom"?createPortal(g,document.body):g}function ha({size:e}){let t=e==="sm"?20:e==="lg"?40:28;return jsx("svg",{className:"animate-spin-rotate",width:t,height:t,viewBox:"0 0 50 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{className:"animate-spin-dash stroke-current",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"4",strokeLinecap:"round",strokeDasharray:"90 150",strokeDashoffset:"0"})})}function bi({spinning:e=true,tip:t,size:r,className:n,children:a,...i}){return a?jsxs("div",{className:s("relative w-fit",n),...i,children:[jsx("div",{className:s("transition-all duration-200",e&&"pointer-events-none select-none blur-[1px]"),children:a}),e&&jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsx(ha,{size:r}),t&&jsx("span",{className:s(Tr({size:r}),"select-none"),children:t})]})]}):e?jsxs("div",{className:s("inline-flex flex-col items-center gap-2",n),...i,children:[jsx(ha,{size:r}),t&&jsx("span",{className:s(Tr({size:r}),"select-none"),children:t})]}):null}var Gu=0,gn=[],gi=new Set;function Uu(){return gn}function fl(){gi.forEach(e=>e());}function qu(e,t){let r=++Gu;return gn=[...gn,{id:r,target:e,tip:t}],fl(),()=>Qu(r)}function Qu(e){gn=gn.filter(t=>t.id!==e),fl();}function Zu(){return qu}var pl=false;function Ju(){if(pl||typeof document>"u")return;pl=true;let e=document.createElement("div");e.id="jac-spin-portal",document.body.appendChild(e),import('react-dom/client').then(({createRoot:t})=>{t(e).render(jsx(n0,{}));});}var ya=new Map;function e0(e){let t=ya.get(e);if(t){t.count++;return}let r=getComputedStyle(e),n=e.style.position;r.position==="static"&&(e.style.position="relative"),ya.set(e,{count:1,original:n});}function t0(e){let t=ya.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,ya.delete(e)));}function r0({entry:e}){return useEffect(()=>{let t=e.target;if(!ul(t))return e0(t),()=>t0(t)},[e.target]),ul(e.target)?createPortal(jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-primary-900/40 dark:bg-primary-900/60",children:[jsx(ha,{size:"lg"}),e.tip&&jsx("span",{className:"select-none text-sm text-primary-100",children:e.tip})]}),document.body):createPortal(jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsx(ha,{size:"md"}),e.tip&&jsx("span",{className:s(Tr({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function n0(){let e=useSyncExternalStore(t=>(gi.add(t),()=>gi.delete(t)),()=>Uu());return e.length===0?null:jsx(Fragment,{children:e.map(t=>jsx(r0,{entry:t},t.id))})}function ul(e){return e===document.documentElement||e===document.body}typeof document<"u"&&Ju();function gl(e){if(e!==void 0)return typeof e=="number"?`${e}px`:e}function xa({variant:e="text",animation:t="pulse",width:r,height:n,lines:a,className:i,style:o,...l}){let c=gl(r),m=gl(n);return e==="text"&&a!==void 0&&a>1?jsx("span",{className:s("flex flex-col gap-2",i),"aria-hidden":"true",role:"presentation",style:o,...l,children:Array.from({length:a},(d,f)=>jsx("span",{className:un({variant:"text",animation:t}),style:{width:f===a-1?"60%":c??"100%",height:m}},f))}):jsx("span",{className:s(un({variant:e,animation:t}),i),"aria-hidden":"true",role:"presentation",style:{width:c,height:m,...o},...l})}var l0=0,bl=320;function hl(e,t){let[r,n]=useState([]),a=useRef(new Map),i=useCallback(d=>{let f=a.current.get(d);f!==void 0&&(clearTimeout(f),a.current.delete(d));},[]),o=useCallback(d=>{i(d),n(f=>f.map(p=>p.id===d?{...p,_exiting:true}:p)),setTimeout(()=>n(f=>f.filter(p=>p.id!==d)),bl);},[i]),l=useCallback(d=>o(d),[o]),c=useCallback(()=>{a.current.forEach(clearTimeout),a.current.clear(),n(d=>d.map(f=>({...f,_exiting:true}))),setTimeout(()=>n([]),bl);},[]),m=useCallback(d=>{let f=`toast-${++l0}`,p=d.position??e,u=d.duration!==void 0?d.duration:t;if(n(h=>[...h,{...d,id:f,position:p,duration:u,_exiting:false}]),u>0){let h=setTimeout(()=>{a.current.delete(f),o(f);},u);a.current.set(f,h);}return f},[e,t,o]);return useEffect(()=>{let d=a.current;return ()=>{d.forEach(clearTimeout),d.clear();}},[]),{items:r,toast:m,dismiss:l,dismissAll:c}}var hn=createContext(null),h0={"top-right":"top-4 right-4 items-end","top-left":"top-4 left-4 items-start","top-center":"top-4 left-1/2 -translate-x-1/2 items-center","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},y0={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","bottom-center":"animate-slide-in-bottom"},x0={"top-right":"toast-exit-right","top-left":"toast-exit-left","top-center":"toast-exit-up","bottom-right":"toast-exit-right","bottom-left":"toast-exit-left","bottom-center":"toast-exit-down"},v0={default:Bell,success:CheckCircle2,danger:XCircle,warning:AlertTriangle,info:Info};function w0({item:e,onDismiss:t}){let r=e.variant??"default",n=e.position??"top-right",a=e.dismissible!==false,i=v0[r],o=()=>{e.onDismiss?.(e.id),t(e.id);};return jsx("div",{className:s("toast-wrapper",e._exiting&&`toast-wrapper-exiting ${x0[n]}`),children:jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:s(ga({variant:r}),"toast-item pointer-events-auto",!e._exiting&&y0[n]),children:[jsx(i,{className:"mt-0.5 h-5 w-5 shrink-0","aria-hidden":"true"}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.title&&jsx("p",{className:"text-sm font-semibold leading-snug",children:e.title}),e.description&&jsx("p",{className:s("text-sm leading-snug",e.title&&"opacity-80"),children:e.description}),e.action&&jsx("button",{type:"button",onClick:e.action.onClick,className:"toast-action-btn mt-1 self-start text-xs font-semibold underline underline-offset-2 transition-opacity hover:opacity-80",children:e.action.label})]}),a&&jsx("button",{type:"button",onClick:o,"aria-label":"Dismiss notification",className:"shrink-0 cursor-pointer opacity-60 transition-opacity hover:opacity-100",children:jsx(X,{className:"h-4 w-4"})})]})})}function va({children:e,defaultPosition:t="top-right",defaultDuration:r=4e3}){let{items:n,toast:a,dismiss:i,dismissAll:o}=hl(t,r),l=n.reduce((c,m)=>{let d=m.position??t;return (c[d]??(c[d]=[])).push(m),c},{});return jsxs(hn.Provider,{value:{toast:a,dismiss:i,dismissAll:o},children:[e,typeof document<"u"&&createPortal(jsx(Fragment,{children:Object.entries(l).map(([c,m])=>jsx("div",{className:s("pointer-events-none fixed z-[100] flex flex-col gap-2",h0[c]),children:m.map(d=>jsx(w0,{item:d,onDismiss:i},d.id))},c))}),document.body)]})}function wa(){let e=useContext(hn);if(!e)throw new Error("useToast must be used within a <ToastProvider>");return e}var C0={Alert:mi,ProgressBar:fi,Spin:bi,Skeleton:xa,ToastProvider:va,useToast:wa},xi=C0;var wl="#1c1914",kl="#130f0b",B0="#2e261e",wi="#504638",Mr="#6b5d4d",Na=`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,O0=[{key:"like",icon:jsx(Heart,{className:"h-5 w-5"}),activeIcon:jsx(Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsx(ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsx(Bookmark,{className:"h-5 w-5"}),activeIcon:jsx(Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsx(Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsx(Download,{className:"h-5 w-5"}),label:"Download"}];function ki({photos:e,layout:t="strip",actions:r=O0,onAction:n,className:a,showGrain:i=true,sheetTitle:o,sheetLabel:l}){let[c,m]=useState(null),[d,f]=useState(new Set),p=useCallback(b=>m(b),[]),u=useCallback(()=>m(null),[]),h=useCallback((b,N)=>{if(r.find(T=>T.key===b)?.toggle){let T=`${N}-${b}`;f(w=>{let C=new Set(w);return C.has(T)?C.delete(T):C.add(T),C});}n?.(b,e[N],N);},[r,n,e]);return jsxs(Fragment,{children:[jsx(t==="strip"?$0:t==="sheet"?Y0:K0,{photos:e,onPhotoClick:p,showGrain:i,className:a,sheetTitle:o,sheetLabel:l}),c!==null&&createPortal(jsx(X0,{photos:e,currentIndex:c,onIndexChange:m,onClose:u,actions:r,activeActions:d,onAction:h,showGrain:i}),document.body)]})}function vl({count:e=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:wl},children:Array.from({length:e}).map((t,r)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:B0}},r))})}function $0({photos:e,onPhotoClick:t,showGrain:r,className:n}){let a=useRef(null);return jsxs("div",{className:s("select-none rounded-lg overflow-hidden",n),style:{background:kl},children:[jsx(vl,{count:Math.max(30,e.length*6)}),jsx("div",{ref:a,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:wl,scrollSnapType:"x mandatory"},children:e.map((i,o)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(o),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:wi,width:280,height:187},children:[jsx("img",{src:i.src,alt:i.alt??i.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),jsx("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:Na,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:Mr},children:[String(o+1).padStart(2,"0"),o%2===0?"":"A"]})]},o))}),jsx(vl,{count:Math.max(30,e.length*6)})]})}function Y0({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:a,sheetLabel:i}){return jsxs("div",{className:s("rounded-lg p-5",n),style:{background:kl},children:[jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Mr},children:a??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Mr},children:i??"Contact Sheet"})]}),jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((o,l)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${l*50}ms both`},onClick:()=>t(l),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:Mr},children:String(l+1).padStart(2,"0")}),jsxs("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:wi,aspectRatio:"3/2"},children:[jsx("img",{src:o.src,alt:o.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Na}}),jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:jsx("span",{className:"text-xs font-medium text-white/90",children:o.title})})]})]},l))})]})}function K0({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[a,i]=useState(false),[o,l]=useState(null),c=Math.min(e.length,8),m=e.slice(0,c),d=p=>{let u=Math.sin(p*137.508+1)*1e4,h=(u%12-6).toFixed(1),g=(u/7%8-4).toFixed(1),b=(u/13%6-3).toFixed(1);return `rotate(${h}deg) translate(${g}px, ${b}px)`},f=(p,u)=>{let h=(u-1)/2,g=((p-h)*7).toFixed(1),b=((p-h)*110).toFixed(0),N=(-Math.abs(p-h)*10+(o===p?-18:0)).toFixed(0);return `translateX(${b}px) translateY(${N}px) rotate(${g}deg)`};return jsxs("div",{className:s("flex flex-col items-center gap-4",n),children:[jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>i(true),onMouseLeave:()=>{i(false),l(null);},children:m.map((p,u)=>jsx("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:a?`${u*35}ms`:`${(c-u)*25}ms`,transform:a?f(u,m.length):d(u),zIndex:a?u+1:m.length-u,width:220,height:147},onClick:()=>t(u),onMouseEnter:()=>a&&l(u),onMouseLeave:()=>l(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:a&&o===u?"rgba(217,171,89,0.5)":wi,boxShadow:a&&o===u?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[jsx("img",{src:p.src,alt:p.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Na}}),jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),a&&o===u&&jsx("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:jsx("span",{className:"text-sm font-medium text-white/90",children:p.title})})]})},u))}),e.length>c&&jsxs("span",{className:"font-mono text-xs",style:{color:Mr},children:["+ ",e.length-c," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:Mr,opacity:a?0:.7},children:"Hover to explore"})]})}function X0({photos:e,currentIndex:t,onIndexChange:r,onClose:n,actions:a,activeActions:i,onAction:o,showGrain:l}){let c=e[t],[m,d]=useState(1),[f,p]=useState({x:0,y:0}),[u,h]=useState(false),[g,b]=useState(false),N=useRef(false),x=useRef({x:0,y:0}),T=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>b(true));},[]),useEffect(()=>{let v=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=v;}},[]),useEffect(()=>{let v=U=>{switch(U.key){case "Escape":n();break;case "ArrowLeft":w(-1);break;case "ArrowRight":w(1);break;case "i":case "I":h(k=>!k);break}};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),useEffect(()=>{let v=T.current;if(!v)return;let U=k=>{k.preventDefault();let q=k.deltaY<0?1.12:.89;d(M=>{let W=Math.min(8,Math.max(1,M*q));return W<=1&&p({x:0,y:0}),W});};return v.addEventListener("wheel",U,{passive:false}),()=>v.removeEventListener("wheel",U)},[]);let w=useCallback(v=>{let U=t+v;U>=0&&U<e.length&&(r(U),d(1),p({x:0,y:0}));},[t,e.length,r]),C=useCallback(v=>{m<=1||(N.current=true,x.current={x:v.clientX,y:v.clientY},v.target.setPointerCapture(v.pointerId));},[m]),S=useCallback(v=>{if(!N.current)return;let U=v.clientX-x.current.x,k=v.clientY-x.current.y;x.current={x:v.clientX,y:v.clientY},p(q=>({x:q.x+U/m,y:q.y+k/m}));},[m]),R=useCallback(()=>{N.current=false;},[]),V=useCallback(()=>{m>1?(d(1),p({x:0,y:0})):d(2.5);},[m]),I=v=>i.has(`${t}-${v}`),E=c.metadata;return jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsx("div",{className:"absolute inset-0 bg-black/95",onClick:n}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Na,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[m.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>d(v=>Math.min(8,v*1.3)),title:"Zoom in",children:jsx(ZoomIn,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{d(v=>{let U=Math.max(1,v*.7);return U<=1&&p({x:0,y:0}),U});},title:"Zoom out",children:jsx(ZoomOut,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:n,title:"Close",children:jsx(X,{className:"h-5 w-5"})})]})]}),jsxs("div",{ref:T,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:m>1?"grab":"default"},onPointerDown:C,onPointerMove:S,onPointerUp:R,onDoubleClick:V,children:[jsx("img",{src:c.src,alt:c.alt??c.title??"",className:"max-h-full max-w-full select-none object-contain",style:{animation:"lightbox-photo-in 0.35s cubic-bezier(0.16, 1, 0.3, 1)",transform:`scale(${m}) translate(${f.x}px, ${f.y}px)`,transition:N.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:v=>{v.stopPropagation(),w(-1);},children:jsx(ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:v=>{v.stopPropagation(),w(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:s("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",u?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[c.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:c.title}),c.description&&jsx("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:c.description}),E&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[E.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",E.camera,E.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),E.lens&&E.lens]}),(E.aperture||E.shutter||E.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[E.aperture,E.shutter,E.iso&&`ISO ${E.iso}`].filter(Boolean).join(" \xB7 ")]}),E.date&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",E.date]}),E.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",E.location]})]})]})}),jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[a.map(v=>{let U=v.toggle&&I(v.key);return jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",U?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>o(v.key,t),title:v.label,children:U&&v.activeIcon?v.activeIcon:v.icon},v.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",u?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>h(v=>!v),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var Ni="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
|
|
3
3
|
<rect width="200" height="200" fill="#1e1b2e"/>
|
|
4
4
|
<circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>
|
|
5
5
|
<circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>
|
|
6
6
|
<text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">\u266A</text>
|
|
7
|
-
</svg>`);function Fi(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return `${t}:${r.toString().padStart(2,"0")}`}function Lm(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var Em={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Pm={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Vm={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function oa({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:n,theme:o,docked:a=false,visible:s,onVisibleChange:p,onTrackChange:b,onLike:u,autoPlay:c=true,shuffle:T=false,loop:x=false,accent:m="#8b5cf6",className:g}){let [d,f]=useState(t),[w,h]=useState(false),[P,k]=useState(0),[N,F]=useState(0),[R,E]=useState(.8),[A,H]=useState(false),[y,O]=useState(new Set),[v,ne]=useState(false),[C,re]=useState(s??!a),[_,de]=useState(false),[j,pe]=useState(false),[Y,V]=useState(T),[G,me]=useState(x),W=useRef(false),l=useRef(null),D=useRef(null),X$1=useRef(void 0),$=useRef(null),se=useRef(null),ue=s??C,Te=n??Lm(r),S=e[d],oe=a,he=o==="dark"?"dark":o==="light"?"light":"",fe="bg-(--mp-bg)",Re="text-(--mp-text)",ye="text-(--mp-text-muted)",z="text-(--accent)",J="border-(--mp-border)";useEffect(()=>{let I=l.current;I&&(I.src=S.src,I.load(),w&&I.play().catch(()=>{}));},[d,S.src]),useEffect(()=>{if(!c||W.current)return;let I=l.current;if(!I)return;let ge=()=>{W.current=true,h(true),I.play().catch(()=>{});};return I.addEventListener("canplaythrough",ge,{once:true}),()=>I.removeEventListener("canplaythrough",ge)},[c]),useEffect(()=>{let I=l.current;I&&(w?I.play().catch(()=>{}):I.pause());},[w]),useEffect(()=>{let I=l.current;I&&(I.muted=A,se.current?se.current.gain.value=A?0:R:I.volume=R);},[R,A]),useEffect(()=>{let I=l.current;if(!I)return;let ge=()=>k(I.currentTime),Fe=()=>F(I.duration),tt=()=>{G?(I.currentTime=0,I.play().catch(()=>{})):q();};return I.addEventListener("timeupdate",ge),I.addEventListener("loadedmetadata",Fe),I.addEventListener("ended",tt),()=>{I.removeEventListener("timeupdate",ge),I.removeEventListener("loadedmetadata",Fe),I.removeEventListener("ended",tt);}},[d,e.length]);let B=useCallback(I=>{let ge=(I%e.length+e.length)%e.length;f(ge),k(0),b?.(ge,e[ge]),ue||(re(true),p?.(true));},[e,ue,b,p]),q=useCallback(()=>{if(Y){let I;do I=Math.floor(Math.random()*e.length);while(I===d&&e.length>1);B(I);}else B(d+1);},[B,d,Y,e.length]),be=useCallback(()=>{if(Y){let I;do I=Math.floor(Math.random()*e.length);while(I===d&&e.length>1);B(I);}else B(d-1);},[B,d,Y,e.length]),De=useCallback(()=>{let I=y.has(d);O(ge=>{let Fe=new Set(ge);return I?Fe.delete(d):Fe.add(d),Fe}),u?.(d,S,!I);},[d,y,u,S]),He=useCallback(I=>{let ge=I.currentTarget.getBoundingClientRect(),tt=Math.max(0,Math.min(1,(I.clientX-ge.left)/ge.width))*N;l.current&&(l.current.currentTime=tt),k(tt);},[N]),K=useCallback(()=>{de(true);let I=oe?200:400;X$1.current=setTimeout(()=>{de(false),re(false),p?.(false);},I);},[oe,p]);useEffect(()=>()=>{X$1.current&&clearTimeout(X$1.current);},[]),useEffect(()=>()=>{$.current?.close();},[]);function xe(){if($.current||!l.current){$.current?.resume();return}try{let I=window.AudioContext??window.webkitAudioContext;if(!I)return;let ge=new I,Fe=ge.createGain();Fe.gain.value=A?0:R,ge.createMediaElementSource(l.current).connect(Fe).connect(ge.destination),$.current=ge,se.current=Fe,ge.resume();}catch{}}let L=j?"fade-in 0.2s ease-out both":`mp-enter-${Te} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,Z=j?"fade-in 0.2s ease-in reverse both":`mp-exit-${Te} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,ee=N>0?P/N*100:0;return oe&&!ue&&!_?jsxs(Fragment,{children:[jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:i("fixed z-100 cursor-pointer transition-all duration-300",Vm[r]),style:{"--accent":m},onMouseEnter:()=>{pe(true),re(true),p?.(true);},children:[jsx("div",{className:i("h-full w-full rounded-full",w?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:w?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),w&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!ue&&!_?jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:i("fixed z-100",oe?Pm[r]:Em[r],he),style:{"--accent":m,..._?{animation:Z}:{animation:L}},onMouseEnter:()=>{oe&&(X$1.current&&(clearTimeout(X$1.current),X$1.current=void 0),_&&de(false),pe(true));},onMouseLeave:()=>{oe&&(pe(false),K());},children:jsxs("div",{className:i("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",fe,J,oe&&"rounded-none",r.endsWith("right")&&oe&&"rounded-l-2xl",r.endsWith("left")&&oe&&"rounded-r-2xl",g),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:S.cover||na,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:w?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:S.cover||na,alt:S.album??S.title,className:"h-full w-full object-cover",draggable:false}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),w&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:i("truncate text-sm font-semibold",Re),children:S.title}),S.artist&&jsx("div",{className:i("truncate text-xs",ye),children:S.artist}),S.album&&jsx("div",{className:i("mt-0.5 truncate text-[10px] tracking-wide",ye,"opacity-60"),children:S.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:i("rounded-full p-1.5 transition-all duration-200",y.has(d)?"text-rose-500 hover:text-rose-400":i(ye,"hover:text-rose-500")),onClick:De,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:y.has(d)?"currentColor":"none"})}),jsx("button",{className:i("rounded-full p-1.5 transition-colors",ye,"hover:"+Re.split(" ")[0]),onClick:()=>ne(I=>!I),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!oe&&jsx("button",{className:i("rounded-full p-1.5 transition-colors",ye,"hover:"+Re.split(" ")[0]),onClick:K,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:D,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:He,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${ee}%`}}),jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${ee}% - 6px)`}})]}),jsxs("div",{className:i("mt-1 flex justify-between text-[10px] font-mono",ye),children:[jsx("span",{children:Fi(P)}),jsx("span",{children:Fi(N)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:i("rounded-full p-1.5 transition-colors",Y?z:ye,"hover:text-(--mp-text)"),onClick:()=>V(I=>!I),title:Y?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:i("rounded-full p-1.5 transition-colors",G?z:ye,"hover:text-(--mp-text)"),onClick:()=>me(I=>!I),title:G?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:i("rounded-full p-2 transition-colors",ye,"hover:text-(--mp-text)"),onClick:be,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:i("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>{xe(),h(I=>!I);},title:w?"Pause":"Play",children:w?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:i("rounded-full p-2 transition-colors",ye,"hover:text-(--mp-text)"),onClick:q,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:i("rounded-full p-1 transition-colors",ye,"hover:text-(--mp-text)"),onClick:()=>{xe();let I=!A;H(I),se.current&&(se.current.gain.value=I?0:R);},title:A?"Unmute":"Mute",children:A||R===0?jsx(VolumeX,{className:"h-3.5 w-3.5"}):jsx(Volume2,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:0,max:1,step:.01,value:A?0:R,onChange:I=>{xe();let ge=Number(I.target.value);E(ge),A&&H(false),se.current&&(se.current.gain.value=ge);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:i("overflow-hidden transition-all duration-300 ease-in-out",v?"max-h-60":"max-h-0"),children:jsx("div",{className:i("border-t px-2 py-2",J),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((I,ge)=>{let Fe=ge===d;return jsxs("button",{className:i("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",Fe?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{B(ge),h(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:Fe&&w?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(tt=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+tt*4}px`,animation:`mp-eq-bar ${.4+tt*.15}s ease-in-out infinite alternate`}},tt))}):Fe?jsx(Disc3,{className:i("h-4 w-4",z)}):jsx("span",{className:i("text-xs font-mono",ye),children:ge+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:I.cover||na,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:i("truncate text-xs font-medium",Fe?z:Re),children:I.title}),I.artist&&jsx("div",{className:i("truncate text-[10px]",ye),children:I.artist})]}),y.has(ge)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},ge)})})})})]})})]})}function yn(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${r}:${n.toString().padStart(2,"0")}`}var Gm={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function ia({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:n=false,loop:o=false,onTrackChange:a,onPlayChange:s,accent:p="#8b5cf6",className:b}){let[u,c]=useState(t),[T,x]=useState(false),[m,g]=useState(0),[d,f]=useState(0),[w,h]=useState(0),[P,k]=useState(.8),[N,F]=useState(false),[R,E]=useState(n),[A,H]=useState(o),[y,O]=useState(false),[v,ne]=useState("title"),[C,re]=useState(true),[_,de]=useState(false),[j,pe]=useState(false),[Y,V]=useState(false),[G,me]=useState(true),[W,l]=useState(false),[D,X$1]=useState(null),$=useRef(null),se=useRef(null),ue=useRef(void 0),Te=useRef(false),S=e[u],ce=Nr.useMemo(()=>{let L=e.map((Z,ee)=>({media:Z,originalIndex:ee}));return L.sort((Z,ee)=>{let I=Gm[v](Z.media,ee.media);return C?I:-I}),L},[e,v,C]);useEffect(()=>{let L=$.current;if(!L)return;l(true),L.src=S.src,S.poster&&(L.poster=S.poster),L.load();let Z=()=>{l(false),T&&L.play().catch(()=>{});};return L.addEventListener("loadeddata",Z,{once:true}),()=>L.removeEventListener("loadeddata",Z)},[u,S.src]),useEffect(()=>{if(!r||Te.current)return;let L=$.current;if(!L)return;let Z=()=>{Te.current=true,x(true),L.play().catch(()=>{});};return L.addEventListener("canplaythrough",Z,{once:true}),()=>L.removeEventListener("canplaythrough",Z)},[r]),useEffect(()=>{let L=$.current;L&&(T?L.play().catch(()=>{}):L.pause(),s?.(T));},[T]),useEffect(()=>{let L=$.current;L&&(L.volume=N?0:P);},[P,N]),useEffect(()=>{let L=$.current;if(!L)return;let Z=()=>g(L.currentTime),ee=()=>f(L.duration),I=()=>{L.buffered.length>0&&h(L.buffered.end(L.buffered.length-1));},ge=()=>{A?(L.currentTime=0,L.play().catch(()=>{})):fe();};return L.addEventListener("timeupdate",Z),L.addEventListener("loadedmetadata",ee),L.addEventListener("progress",I),L.addEventListener("ended",ge),()=>{L.removeEventListener("timeupdate",Z),L.removeEventListener("loadedmetadata",ee),L.removeEventListener("progress",I),L.removeEventListener("ended",ge);}},[u,e.length,A]);let oe=useCallback(()=>{me(true),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>{T&&me(false);},3e3);},[T]);useEffect(()=>{T?oe():(me(true),ue.current&&clearTimeout(ue.current));},[T,oe]),useEffect(()=>()=>{ue.current&&clearTimeout(ue.current);},[]);let he=useCallback(L=>{let Z=(L%e.length+e.length)%e.length;c(Z),g(0),x(true),a?.(Z,e[Z]);},[e,a]),fe=useCallback(()=>{if(R){let L;do L=Math.floor(Math.random()*e.length);while(L===u&&e.length>1);he(L);}else he(u+1);},[he,u,R,e.length]),Re=useCallback(()=>{if(R){let L;do L=Math.floor(Math.random()*e.length);while(L===u&&e.length>1);he(L);}else he(u-1);},[he,u,R,e.length]),ye=useCallback(L=>{let Z=L.currentTarget.getBoundingClientRect(),I=Math.max(0,Math.min(1,(L.clientX-Z.left)/Z.width))*d;$.current&&($.current.currentTime=I),g(I);},[d]),z=useCallback(L=>{let Z=L.currentTarget.getBoundingClientRect(),ee=Math.max(0,Math.min(1,(L.clientX-Z.left)/Z.width));X$1(ee*d);},[d]),J=useCallback(()=>{se.current&&(document.fullscreenElement?document.exitFullscreen():se.current.requestFullscreen());},[]);useEffect(()=>{let L=()=>V(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",L),()=>document.removeEventListener("fullscreenchange",L)},[]);let B=useCallback(()=>{_?(pe(true),setTimeout(()=>{de(false),pe(false);},500)):de(true);},[_]),q=useCallback(()=>{O(L=>!L);},[]),be=useCallback(()=>{let L=["title","type","duration"],Z=L.indexOf(v);C?re(false):(re(true),ne(L[(Z+1)%L.length]));},[v,C]);useEffect(()=>{let L=Z=>{if(!(Z.target instanceof HTMLInputElement||Z.target instanceof HTMLTextAreaElement))switch(Z.key){case " ":case "k":Z.preventDefault(),x(ee=>!ee);break;case "f":Z.preventDefault(),J();break;case "t":Z.preventDefault(),B();break;case "ArrowLeft":Z.preventDefault(),$.current&&($.current.currentTime=Math.max(0,m-5));break;case "ArrowRight":Z.preventDefault(),$.current&&($.current.currentTime=Math.min(d,m+5));break;case "ArrowUp":Z.preventDefault(),k(ee=>Math.min(1,ee+.05));break;case "ArrowDown":Z.preventDefault(),k(ee=>Math.max(0,ee-.05));break;case "Escape":_&&B();break;case "n":Z.preventDefault(),fe();break;case "p":Z.preventDefault(),Re();break;case "l":Z.preventDefault(),q();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[J,B,q,fe,Re,m,d,_]);let De=d>0?m/d*100:0,He=d>0?w/d*100:0,K="text-(--accent)",xe=jsxs("div",{ref:se,className:i("group flex overflow-hidden",Y?"h-full w-full":"aspect-video w-full",!Y&&"rounded-xl",!Y&&T&&"shadow-2xl",!Y&&!T&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",b),style:{"--accent":p,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:i("relative flex-1 min-w-0 h-full overflow-hidden",W&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:oe,onMouseLeave:()=>{T&&me(false);},children:[jsx("video",{ref:$,className:"h-full w-full object-contain",poster:S.poster,playsInline:true,preload:"metadata",onClick:()=>x(L=>!L)}),!T&&!W&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>x(true),children:jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:jsx(Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),W&&!G&&jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:S.title}),S.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:S.subtitle})]})}),jsx("div",{className:i("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",G?"opacity-100":"pointer-events-none opacity-0"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:S.title}),S.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:S.subtitle})]}),S.type&&jsx("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:S.type})]})}),jsxs("div",{className:i("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",G?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxs("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:ye,onMouseMove:z,onMouseLeave:()=>X$1(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${He}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${De}%`}}),D!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${D/d*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:yn(D)}),jsx("div",{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 rounded-full border-2 border-(--accent) bg-white opacity-0 shadow-lg transition-opacity group-hover/seek:opacity-100",style:{left:`calc(${De}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>x(L=>!L),title:T?"Pause (k)":"Play (k)",children:T?jsx(Pause,{className:"h-5 w-5",fill:"currentColor"}):jsx(Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:Re,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:fe,title:"Next (n)",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsx("button",{className:"cp-btn",onClick:()=>F(L=>!L),title:N?"Unmute":"Mute",children:N||P===0?jsx(VolumeX,{className:"h-4 w-4"}):jsx(Volume2,{className:"h-4 w-4"})}),jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsx("input",{type:"range",min:0,max:1,step:.01,value:N?0:P,onChange:L=>{k(Number(L.target.value)),N&&F(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[yn(m)," / ",yn(d)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:i("cp-btn",R&&K),onClick:()=>E(L=>!L),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:i("cp-btn",A&&K),onClick:()=>H(L=>!L),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:i("cp-btn",y&&K),onClick:q,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:i("cp-btn",_&&K),onClick:B,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:J,title:"Fullscreen (f)",children:Y?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:i("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",y?"w-72":"w-0"),children:jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:be,title:`Sort: ${v} ${C?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),v,C?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:q,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:ce.map(({media:L,originalIndex:Z})=>{let ee=Z===u;return jsxs("button",{className:i("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",ee?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:ee?void 0:{color:"var(--cp-text)"},onClick:()=>{he(Z);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[L.poster?jsx("img",{src:L.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsx(Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),ee&&T&&jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(I=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+I*3}px`,animation:`mp-eq-bar ${.3+I*.12}s ease-in-out infinite alternate`}},I))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:L.title}),jsxs("div",{className:"flex items-center gap-2",children:[L.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:L.type}),L.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:yn(L.duration)})]})]}),ee&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},Z)})})]})}),jsx("style",{children:`
|
|
7
|
+
</svg>`);function Cl(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return `${t}:${r.toString().padStart(2,"0")}`}function af(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var of={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},sf={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},lf={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function Ci({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:n,theme:a,docked:i=false,visible:o,onVisibleChange:l,onTrackChange:c,onLike:m,autoPlay:d=true,shuffle:f=false,loop:p=false,accent:u="#8b5cf6",className:h}){let [g,b]=useState(t),[N,x]=useState(false),[T,w]=useState(0),[C,S]=useState(0),[R,V]=useState(.8),[I,E]=useState(false),[v,U]=useState(new Set),[k,q]=useState(false),[M,W]=useState(o??!i),[$,ue]=useState(false),[J,de]=useState(false),[re,B]=useState(f),[j,pe]=useState(p),ye=useRef(false),y=useRef(null),L=useRef(null),G=useRef(void 0),O=useRef(null),_=useRef(null),ee=o??M,xe=n??af(r),P=e[g],K=i,oe=a==="dark"?"dark":a==="light"?"light":"",X$1="bg-(--mp-bg)",fe="text-(--mp-text)",we="text-(--mp-text-muted)",H="text-(--accent)",ne="border-(--mp-border)";useEffect(()=>{let z=y.current;z&&(z.src=P.src,z.load(),N&&z.play().catch(()=>{}));},[g,P.src]),useEffect(()=>{if(!d||ye.current)return;let z=y.current;if(!z)return;let ve=()=>{ye.current=true,x(true),z.play().catch(()=>{});};return z.addEventListener("canplaythrough",ve,{once:true}),()=>z.removeEventListener("canplaythrough",ve)},[d]),useEffect(()=>{let z=y.current;z&&(N?z.play().catch(()=>{}):z.pause());},[N]),useEffect(()=>{let z=y.current;z&&(z.muted=I,_.current?_.current.gain.value=I?0:R:z.volume=R);},[R,I]),useEffect(()=>{let z=y.current;if(!z)return;let ve=()=>w(z.currentTime),_e=()=>S(z.duration),mt=()=>{j?(z.currentTime=0,z.play().catch(()=>{})):Q();};return z.addEventListener("timeupdate",ve),z.addEventListener("loadedmetadata",_e),z.addEventListener("ended",mt),()=>{z.removeEventListener("timeupdate",ve),z.removeEventListener("loadedmetadata",_e),z.removeEventListener("ended",mt);}},[g,e.length]);let Y=useCallback(z=>{let ve=(z%e.length+e.length)%e.length;b(ve),w(0),c?.(ve,e[ve]),ee||(W(true),l?.(true));},[e,ee,c,l]),Q=useCallback(()=>{if(re){let z;do z=Math.floor(Math.random()*e.length);while(z===g&&e.length>1);Y(z);}else Y(g+1);},[Y,g,re,e.length]),ke=useCallback(()=>{if(re){let z;do z=Math.floor(Math.random()*e.length);while(z===g&&e.length>1);Y(z);}else Y(g-1);},[Y,g,re,e.length]),He=useCallback(()=>{let z=v.has(g);U(ve=>{let _e=new Set(ve);return z?_e.delete(g):_e.add(g),_e}),m?.(g,P,!z);},[g,v,m,P]),Fe=useCallback(z=>{let ve=z.currentTarget.getBoundingClientRect(),mt=Math.max(0,Math.min(1,(z.clientX-ve.left)/ve.width))*C;y.current&&(y.current.currentTime=mt),w(mt);},[C]),Z=useCallback(()=>{ue(true);let z=K?200:400;G.current=setTimeout(()=>{ue(false),W(false),l?.(false);},z);},[K,l]);useEffect(()=>()=>{G.current&&clearTimeout(G.current);},[]),useEffect(()=>()=>{O.current?.close();},[]);function Ne(){if(O.current||!y.current){O.current?.resume();return}try{let z=window.AudioContext??window.webkitAudioContext;if(!z)return;let ve=new z,_e=ve.createGain();_e.gain.value=I?0:R,ve.createMediaElementSource(y.current).connect(_e).connect(ve.destination),O.current=ve,_.current=_e,ve.resume();}catch{}}let A=J?"fade-in 0.2s ease-out both":`mp-enter-${xe} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,ae=J?"fade-in 0.2s ease-in reverse both":`mp-exit-${xe} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,se=C>0?T/C*100:0;return K&&!ee&&!$?jsxs(Fragment,{children:[jsx("audio",{ref:y,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",lf[r]),style:{"--accent":u},onMouseEnter:()=>{de(true),W(true),l?.(true);},children:[jsx("div",{className:s("h-full w-full rounded-full",N?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:N?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),N&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!ee&&!$?jsx("audio",{ref:y,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:y,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:s("fixed z-100",K?sf[r]:of[r],oe),style:{"--accent":u,...$?{animation:ae}:{animation:A}},onMouseEnter:()=>{K&&(G.current&&(clearTimeout(G.current),G.current=void 0),$&&ue(false),de(true));},onMouseLeave:()=>{K&&(de(false),Z());},children:jsxs("div",{className:s("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",X$1,ne,K&&"rounded-none",r.endsWith("right")&&K&&"rounded-l-2xl",r.endsWith("left")&&K&&"rounded-r-2xl",h),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:P.cover||Ni,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:N?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:P.cover||Ni,alt:P.album??P.title,className:"h-full w-full object-cover",draggable:false}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),N&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-sm font-semibold",fe),children:P.title}),P.artist&&jsx("div",{className:s("truncate text-xs",we),children:P.artist}),P.album&&jsx("div",{className:s("mt-0.5 truncate text-[10px] tracking-wide",we,"opacity-60"),children:P.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:s("rounded-full p-1.5 transition-all duration-200",v.has(g)?"text-rose-500 hover:text-rose-400":s(we,"hover:text-rose-500")),onClick:He,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:v.has(g)?"currentColor":"none"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",we,"hover:"+fe.split(" ")[0]),onClick:()=>q(z=>!z),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!K&&jsx("button",{className:s("rounded-full p-1.5 transition-colors",we,"hover:"+fe.split(" ")[0]),onClick:Z,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:L,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Fe,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${se}%`}}),jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${se}% - 6px)`}})]}),jsxs("div",{className:s("mt-1 flex justify-between text-[10px] font-mono",we),children:[jsx("span",{children:Cl(T)}),jsx("span",{children:Cl(C)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:s("rounded-full p-1.5 transition-colors",re?H:we,"hover:text-(--mp-text)"),onClick:()=>B(z=>!z),title:re?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",j?H:we,"hover:text-(--mp-text)"),onClick:()=>pe(z=>!z),title:j?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",we,"hover:text-(--mp-text)"),onClick:ke,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:s("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>{Ne(),x(z=>!z);},title:N?"Pause":"Play",children:N?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",we,"hover:text-(--mp-text)"),onClick:Q,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:s("rounded-full p-1 transition-colors",we,"hover:text-(--mp-text)"),onClick:()=>{Ne();let z=!I;E(z),_.current&&(_.current.gain.value=z?0:R);},title:I?"Unmute":"Mute",children:I||R===0?jsx(VolumeX,{className:"h-3.5 w-3.5"}):jsx(Volume2,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:0,max:1,step:.01,value:I?0:R,onChange:z=>{Ne();let ve=Number(z.target.value);V(ve),I&&E(false),_.current&&(_.current.gain.value=ve);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:s("overflow-hidden transition-all duration-300 ease-in-out",k?"max-h-60":"max-h-0"),children:jsx("div",{className:s("border-t px-2 py-2",ne),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((z,ve)=>{let _e=ve===g;return jsxs("button",{className:s("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",_e?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{Y(ve),x(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:_e&&N?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(mt=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+mt*4}px`,animation:`mp-eq-bar ${.4+mt*.15}s ease-in-out infinite alternate`}},mt))}):_e?jsx(Disc3,{className:s("h-4 w-4",H)}):jsx("span",{className:s("text-xs font-mono",we),children:ve+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:z.cover||Ni,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-xs font-medium",_e?H:fe),children:z.title}),z.artist&&jsx("div",{className:s("truncate text-[10px]",we),children:z.artist})]}),v.has(ve)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},ve)})})})})]})})]})}function Ta(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${r}:${n.toString().padStart(2,"0")}`}var Cf={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function Mi({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:n=false,loop:a=false,onTrackChange:i,onPlayChange:o,accent:l="#8b5cf6",className:c}){let[m,d]=useState(t),[f,p]=useState(false),[u,h]=useState(0),[g,b]=useState(0),[N,x]=useState(0),[T,w]=useState(.8),[C,S]=useState(false),[R,V]=useState(n),[I,E]=useState(a),[v,U]=useState(false),[k,q]=useState("title"),[M,W]=useState(true),[$,ue]=useState(false),[J,de]=useState(false),[re,B]=useState(false),[j,pe]=useState(true),[ye,y]=useState(false),[L,G]=useState(null),O=useRef(null),_=useRef(null),ee=useRef(void 0),xe=useRef(false),P=e[m],F=qr.useMemo(()=>{let A=e.map((ae,se)=>({media:ae,originalIndex:se}));return A.sort((ae,se)=>{let z=Cf[k](ae.media,se.media);return M?z:-z}),A},[e,k,M]);useEffect(()=>{let A=O.current;if(!A)return;y(true),A.src=P.src,P.poster&&(A.poster=P.poster),A.load();let ae=()=>{y(false),f&&A.play().catch(()=>{});};return A.addEventListener("loadeddata",ae,{once:true}),()=>A.removeEventListener("loadeddata",ae)},[m,P.src]),useEffect(()=>{if(!r||xe.current)return;let A=O.current;if(!A)return;let ae=()=>{xe.current=true,p(true),A.play().catch(()=>{});};return A.addEventListener("canplaythrough",ae,{once:true}),()=>A.removeEventListener("canplaythrough",ae)},[r]),useEffect(()=>{let A=O.current;A&&(f?A.play().catch(()=>{}):A.pause(),o?.(f));},[f]),useEffect(()=>{let A=O.current;A&&(A.volume=C?0:T);},[T,C]),useEffect(()=>{let A=O.current;if(!A)return;let ae=()=>h(A.currentTime),se=()=>b(A.duration),z=()=>{A.buffered.length>0&&x(A.buffered.end(A.buffered.length-1));},ve=()=>{I?(A.currentTime=0,A.play().catch(()=>{})):X$1();};return A.addEventListener("timeupdate",ae),A.addEventListener("loadedmetadata",se),A.addEventListener("progress",z),A.addEventListener("ended",ve),()=>{A.removeEventListener("timeupdate",ae),A.removeEventListener("loadedmetadata",se),A.removeEventListener("progress",z),A.removeEventListener("ended",ve);}},[m,e.length,I]);let K=useCallback(()=>{pe(true),ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{f&&pe(false);},3e3);},[f]);useEffect(()=>{f?K():(pe(true),ee.current&&clearTimeout(ee.current));},[f,K]),useEffect(()=>()=>{ee.current&&clearTimeout(ee.current);},[]);let oe=useCallback(A=>{let ae=(A%e.length+e.length)%e.length;d(ae),h(0),p(true),i?.(ae,e[ae]);},[e,i]),X$1=useCallback(()=>{if(R){let A;do A=Math.floor(Math.random()*e.length);while(A===m&&e.length>1);oe(A);}else oe(m+1);},[oe,m,R,e.length]),fe=useCallback(()=>{if(R){let A;do A=Math.floor(Math.random()*e.length);while(A===m&&e.length>1);oe(A);}else oe(m-1);},[oe,m,R,e.length]),we=useCallback(A=>{let ae=A.currentTarget.getBoundingClientRect(),z=Math.max(0,Math.min(1,(A.clientX-ae.left)/ae.width))*g;O.current&&(O.current.currentTime=z),h(z);},[g]),H=useCallback(A=>{let ae=A.currentTarget.getBoundingClientRect(),se=Math.max(0,Math.min(1,(A.clientX-ae.left)/ae.width));G(se*g);},[g]),ne=useCallback(()=>{_.current&&(document.fullscreenElement?document.exitFullscreen():_.current.requestFullscreen());},[]);useEffect(()=>{let A=()=>B(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",A),()=>document.removeEventListener("fullscreenchange",A)},[]);let Y=useCallback(()=>{$?(de(true),setTimeout(()=>{ue(false),de(false);},500)):ue(true);},[$]),Q=useCallback(()=>{U(A=>!A);},[]),ke=useCallback(()=>{let A=["title","type","duration"],ae=A.indexOf(k);M?W(false):(W(true),q(A[(ae+1)%A.length]));},[k,M]);useEffect(()=>{let A=ae=>{if(!(ae.target instanceof HTMLInputElement||ae.target instanceof HTMLTextAreaElement))switch(ae.key){case " ":case "k":ae.preventDefault(),p(se=>!se);break;case "f":ae.preventDefault(),ne();break;case "t":ae.preventDefault(),Y();break;case "ArrowLeft":ae.preventDefault(),O.current&&(O.current.currentTime=Math.max(0,u-5));break;case "ArrowRight":ae.preventDefault(),O.current&&(O.current.currentTime=Math.min(g,u+5));break;case "ArrowUp":ae.preventDefault(),w(se=>Math.min(1,se+.05));break;case "ArrowDown":ae.preventDefault(),w(se=>Math.max(0,se-.05));break;case "Escape":$&&Y();break;case "n":ae.preventDefault(),X$1();break;case "p":ae.preventDefault(),fe();break;case "l":ae.preventDefault(),Q();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[ne,Y,Q,X$1,fe,u,g,$]);let He=g>0?u/g*100:0,Fe=g>0?N/g*100:0,Z="text-(--accent)",Ne=jsxs("div",{ref:_,className:s("group flex overflow-hidden",re?"h-full w-full":"aspect-video w-full",!re&&"rounded-xl",!re&&f&&"shadow-2xl",!re&&!f&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",c),style:{"--accent":l,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:s("relative flex-1 min-w-0 h-full overflow-hidden",ye&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:K,onMouseLeave:()=>{f&&pe(false);},children:[jsx("video",{ref:O,className:"h-full w-full object-contain",poster:P.poster,playsInline:true,preload:"metadata",onClick:()=>p(A=>!A)}),!f&&!ye&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>p(true),children:jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:jsx(Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),ye&&!j&&jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:P.title}),P.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:P.subtitle})]})}),jsx("div",{className:s("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",j?"opacity-100":"pointer-events-none opacity-0"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:P.title}),P.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:P.subtitle})]}),P.type&&jsx("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:P.type})]})}),jsxs("div",{className:s("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",j?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxs("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:we,onMouseMove:H,onMouseLeave:()=>G(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${Fe}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${He}%`}}),L!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${L/g*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:Ta(L)}),jsx("div",{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 rounded-full border-2 border-(--accent) bg-white opacity-0 shadow-lg transition-opacity group-hover/seek:opacity-100",style:{left:`calc(${He}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>p(A=>!A),title:f?"Pause (k)":"Play (k)",children:f?jsx(Pause,{className:"h-5 w-5",fill:"currentColor"}):jsx(Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:fe,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:X$1,title:"Next (n)",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsx("button",{className:"cp-btn",onClick:()=>S(A=>!A),title:C?"Unmute":"Mute",children:C||T===0?jsx(VolumeX,{className:"h-4 w-4"}):jsx(Volume2,{className:"h-4 w-4"})}),jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsx("input",{type:"range",min:0,max:1,step:.01,value:C?0:T,onChange:A=>{w(Number(A.target.value)),C&&S(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[Ta(u)," / ",Ta(g)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:s("cp-btn",R&&Z),onClick:()=>V(A=>!A),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",I&&Z),onClick:()=>E(A=>!A),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",v&&Z),onClick:Q,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",$&&Z),onClick:Y,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:ne,title:"Fullscreen (f)",children:re?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:s("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",v?"w-72":"w-0"),children:jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:ke,title:`Sort: ${k} ${M?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),k,M?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:Q,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:F.map(({media:A,originalIndex:ae})=>{let se=ae===m;return jsxs("button",{className:s("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",se?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:se?void 0:{color:"var(--cp-text)"},onClick:()=>{oe(ae);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[A.poster?jsx("img",{src:A.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsx(Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),se&&f&&jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(z=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+z*3}px`,animation:`mp-eq-bar ${.3+z*.12}s ease-in-out infinite alternate`}},z))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:A.title}),jsxs("div",{className:"flex items-center gap-2",children:[A.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:A.type}),A.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:Ta(A.duration)})]})]}),se&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},ae)})})]})}),jsx("style",{children:`
|
|
8
8
|
.cp-btn {
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
@@ -20,7 +20,7 @@ import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'cl
|
|
|
20
20
|
0%, 100% { box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 25%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }
|
|
21
21
|
50% { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 55%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }
|
|
22
22
|
}
|
|
23
|
-
`})]});return jsx("div",{className:i(_&&"fixed inset-0 z-100 flex items-center justify-center p-8",_&&(j?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:_?L=>{L.target===L.currentTarget&&B();}:void 0,children:jsx("div",{className:i(_&&"w-full",_&&!Y&&"max-w-5xl"),children:xe})})}function vn(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Oi(e){return e==null?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function da(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var sp={".png":Image,".jpg":Image,".jpeg":Image,".gif":Image,".svg":Image,".webp":Image,".ico":Image,".bmp":Image,".mp3":Music,".wav":Music,".flac":Music,".ogg":Music,".aac":Music,".m4a":Music,".mp4":Video,".mkv":Video,".avi":Video,".mov":Video,".wmv":Video,".webm":Video,".ts":FileCode,".tsx":FileCode,".js":FileCode,".jsx":FileCode,".json":FileCode,".html":FileCode,".css":FileCode,".scss":FileCode,".py":FileCode,".rs":FileCode,".go":FileCode,".java":FileCode,".c":FileCode,".cpp":FileCode,".h":FileCode,".sh":Terminal,".bat":Terminal,".ps1":Terminal,".md":FileText,".txt":FileText,".pdf":FileText,".doc":FileText,".docx":FileText,".rtf":FileText,".csv":FileSpreadsheet,".xls":FileSpreadsheet,".xlsx":FileSpreadsheet,".db":Database,".sqlite":Database,".sql":Database,".zip":FileArchive,".tar":FileArchive,".gz":FileArchive,".rar":FileArchive,".7z":FileArchive};function ma(e){if(e.type==="directory")return Folder;let t=e.extension||vn(e.name);return sp[t]||File}function dr(e,t,r){return Math.max(t,Math.min(r,e))}function Ki(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function Wi(e,t){if(e<480)return {size:{width:e-16,height:t-48},pos:{x:8,y:24}};if(e<640){let o=e-24,a=Math.min(t-64,540);return {size:{width:o,height:a},pos:{x:12,y:32}}}if(e<1024){let o=Math.min(640,e-32),a=Math.min(480,t-64);return {size:{width:o,height:a},pos:{x:Math.max(0,Math.round((e-o)/2)),y:Math.max(0,Math.round((t-a)/2))}}}let r=720,n=520;return {size:{width:r,height:n},pos:{x:Math.max(0,Math.round((e-r)/2)),y:Math.max(0,Math.round((t-n)/2))}}}function pa({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:n="list",initialPosition:o,initialSize:a,dockable:s=false,dockSide:p="right",visible:b=true,onFileOpen:u,onSelectionChange:c,onNavigate:T,onDelete:x,onClose:m,onMinimize:g,onPathSubmit:d,defaultInputMode:f="search",actions:w,resizable:h=true,minSize:P={width:400,height:300},className:k}){let[N,F]=useState(n),[R,E]=useState(new Set),[A,H]=useState(null),[y,O]=useState(false),[v,ne]=useState(false),[C,re]=useState(""),[_,de]=useState(f),[j,pe]=useState(b),[Y,V]=useState(false),[G,me]=useState({w:window.innerWidth,h:window.innerHeight}),W=Wi(window.innerWidth,window.innerHeight),[l,D]=useState(o??W.pos),[X$1,$]=useState(a??W.size),[se,ue]=useState(null),Te=useRef(false),S=useRef({x:0,y:0}),ce=useRef(null),oe=useRef(false),he=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),fe=useRef(false),Re=useRef(y);useEffect(()=>{Re.current=y;},[y]);let ye=b!==void 0?b:j,z=useMemo(()=>{let M=e.filter(we=>we.type==="directory"),ae=e.filter(we=>we.type==="file");return M.sort((we,ke)=>we.name.localeCompare(ke.name)),ae.sort((we,ke)=>we.name.localeCompare(ke.name)),[...M,...ae]},[e]),J=useMemo(()=>{if(_!=="search"||!C.trim())return z;let M=C.toLowerCase();return z.filter(ae=>ae.name.toLowerCase().includes(M))},[z,C,_]),B=A!=null?J[A]:null;useEffect(()=>{let M=Ki(window.innerWidth),ae=()=>{let we=window.innerWidth,ke=window.innerHeight;if(me({w:we,h:ke}),Re.current)return;let Ee=Ki(we);if(Ee!==M&&!fe.current&&!a){let Je=Wi(we,ke);$(Je.size),D(Je.pos);}M=Ee;};return window.addEventListener("resize",ae),()=>window.removeEventListener("resize",ae)},[a]);let q=useCallback((M,ae)=>{E(we=>{let ke=new Set(we);return ae.ctrlKey||ae.metaKey?ke.has(M)?ke.delete(M):ke.add(M):(ke.clear(),ke.add(M)),ke}),H(M);},[]);useEffect(()=>{if(!c)return;let M=Array.from(R).map(ae=>J[ae]).filter(Boolean);c(M);},[R]);let be=useCallback(M=>{let ae=J[M];ae&&(ae.type==="directory"?T?.(ae.path):u?.(ae));},[J,u,T]),De=useCallback(M=>{y||M.target.closest("button")||(fe.current=true,Te.current=true,S.current={x:M.clientX-l.x,y:M.clientY-l.y},M.preventDefault());},[l,y]),He=useCallback(M=>{if(y||M.target.closest("button"))return;fe.current=true;let ae=M.touches[0];Te.current=true,S.current={x:ae.clientX-l.x,y:ae.clientY-l.y};},[l,y]);useEffect(()=>{let M=ke=>{if(!Te.current)return;let Ee=window.innerWidth-100,Je=window.innerHeight-40;D({x:dr(ke.clientX-S.current.x,0,Ee),y:dr(ke.clientY-S.current.y,0,Je)});},ae=ke=>{if(!Te.current)return;ke.preventDefault();let Ee=ke.touches[0],Je=window.innerWidth-100,Pt=window.innerHeight-40;D({x:dr(Ee.clientX-S.current.x,0,Je),y:dr(Ee.clientY-S.current.y,0,Pt)});},we=()=>{Te.current=false,oe.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",M),window.addEventListener("mouseup",we),window.addEventListener("touchmove",ae,{passive:false}),window.addEventListener("touchend",we),()=>{window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",we),window.removeEventListener("touchmove",ae),window.removeEventListener("touchend",we);}},[]);let K=useCallback((M,ae)=>{y||(ae.preventDefault(),ae.stopPropagation(),fe.current=true,oe.current=M,he.current={x:ae.clientX,y:ae.clientY,w:X$1.width,h:X$1.height,px:l.x,py:l.y},document.body.style.cursor=M==="e"||M==="w"?"ew-resize":M==="n"||M==="s"?"ns-resize":M==="nw"||M==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[y,X$1,l]),xe=useCallback((M,ae)=>{if(y)return;ae.preventDefault(),ae.stopPropagation(),fe.current=true;let we=ae.touches[0];oe.current=M,he.current={x:we.clientX,y:we.clientY,w:X$1.width,h:X$1.height,px:l.x,py:l.y},document.body.style.userSelect="none";},[y,X$1,l]);useEffect(()=>{let M=(Ee,Je)=>{let Pt=oe.current;if(!Pt)return;let _a=Ee-he.current.x,$a=Je-he.current.y,{w:Kt,h:Wt,px:Fn,py:An}=he.current;if(Pt.includes("e")&&(Kt=Math.max(P.width,Kt+_a)),Pt.includes("w")){let fr=Math.max(P.width,Kt-_a);Fn=Fn+(Kt-fr),Kt=fr;}if(Pt.includes("s")&&(Wt=Math.max(P.height,Wt+$a)),Pt.includes("n")){let fr=Math.max(P.height,Wt-$a);An=An+(Wt-fr),Wt=fr;}$({width:Kt,height:Wt}),D({x:Fn,y:An});},ae=Ee=>{oe.current&&M(Ee.clientX,Ee.clientY);},we=Ee=>{oe.current&&(Ee.preventDefault(),M(Ee.touches[0].clientX,Ee.touches[0].clientY));},ke=()=>{oe.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",ae),window.addEventListener("mouseup",ke),window.addEventListener("touchmove",we,{passive:false}),window.addEventListener("touchend",ke),()=>{window.removeEventListener("mousemove",ae),window.removeEventListener("mouseup",ke),window.removeEventListener("touchmove",we),window.removeEventListener("touchend",ke);}},[P]);let L=useCallback(()=>{y?(se&&(D(se.pos),$(se.size)),O(false)):(ue({pos:l,size:X$1}),O(true));},[y,l,X$1,se]),Z=useCallback(()=>{v?ne(false):(y&&(O(false),se&&(D(se.pos),$(se.size))),ne(true),g?.());},[v,y,se,g]);useEffect(()=>{if(!ye||v)return;let M=ae=>{if(!(!ce.current?.contains(document.activeElement)&&document.activeElement!==ce.current)){if(ae.key==="Escape"&&(H(null),E(new Set)),ae.ctrlKey&&ae.key==="a"){ae.preventDefault();let we=new Set(J.map((ke,Ee)=>Ee));E(we);}ae.key==="Delete"&&R.size>0&&x&&(ae.preventDefault(),V(true));}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[ye,v,J,R,x]);let ee={"--fe-accent":r};if(v)return jsx("div",{className:i("fixed z-100 cursor-pointer transition-all duration-300",p==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:ee,onClick:()=>ne(false),title:`Restore ${t}`,children:jsxs("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[jsx(HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!ye)return null;let I=y?G.w:Math.min(X$1.width,G.w-8),ge=y?G.h:Math.min(X$1.height,G.h-8),Fe=y?0:dr(l.x,0,Math.max(0,G.w-I)),tt=y?0:dr(l.y,0,Math.max(0,G.h-40)),Hn=I<500;return jsxs("div",{ref:ce,className:i("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",y&&"rounded-none",k),style:{...ee,left:Fe,top:tt,width:I,height:ge,transition:y?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxs("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:De,onTouchStart:He,onDoubleClick:L,children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:jsx(HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:"fe-btn mr-1",onClick:()=>F(M=>M==="list"?"grid":"list"),title:N==="list"?"Grid view":"List view",children:N==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),s&&jsx("button",{className:"fe-btn",onClick:Z,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:L,title:y?"Restore":"Maximize",children:y?jsx(Minimize2,{className:"h-3.5 w-3.5"}):jsx(Maximize2,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{m?.(),pe(false);},title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsx("button",{className:"fe-btn p-1",onClick:()=>T?.(".."),title:"Go up",children:jsx(FolderUp,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:_==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>de(M=>M==="search"?"navigate":"search"),title:_==="search"?"Switch to path navigation":"Switch to file search",children:_==="search"?jsx(Search,{className:"h-3 w-3"}):jsx(CornerRightDown,{className:"h-3 w-3"})}),jsx("div",{className:"relative flex-1",children:jsx("input",{type:"text",value:C,onChange:M=>re(M.target.value),onKeyDown:M=>{M.key==="Enter"&&C.trim()&&_==="navigate"&&(d?d(C.trim()):T?.(C.trim()));},placeholder:_==="search"?"Search files\u2026":"Enter path and press Enter\u2026",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[J.length," item",J.length!==1?"s":"",R.size>0&&` \xB7 ${R.size} selected`]})]}),jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:M=>{M.target===M.currentTarget&&(E(new Set),H(null));},children:J.length===0?jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsx(Folder,{className:"mb-2 h-10 w-10"}),jsx("span",{className:"text-xs",children:"No files found"})]}):N==="list"?jsx("div",{className:"space-y-px",children:J.map((M,ae)=>{let we=ma(M),ke=R.has(ae),Ee=M.extension||vn(M.name);return jsxs("div",{className:i("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",ke?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:ke?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:Je=>q(ae,Je),onDoubleClick:()=>be(ae),children:[jsx(we,{className:i("h-4 w-4 shrink-0",M.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:M.name}),Ee&&M.type==="file"&&jsx("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:Ee}),M.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Oi(M.size)}),M.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:da(M.modifiedAt)})]},M.path+ae)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:J.map((M,ae)=>{let we=ma(M),ke=R.has(ae),Ee=M.extension||vn(M.name);return jsxs("div",{className:i("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",ke?"bg-(--fe-accent)/15 text-(--fe-text-strong) ring-1 ring-(--fe-accent)/30":"text-(--fe-text) hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),onClick:Je=>q(ae,Je),onDoubleClick:()=>be(ae),children:[jsx(we,{className:i("h-7 w-7",M.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:M.name}),Ee&&M.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:Ee})]},M.path+ae)})})}),jsx("div",{className:i("overflow-hidden transition-[width,opacity] duration-300 ease-out",Hn?i("absolute right-0 top-0 bottom-0 z-10",B?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):i("shrink-0",B?"w-56":"w-0")),children:B&&jsxs("div",{className:i("flex h-full flex-col p-4",Hn?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Hn&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{H(null),E(new Set);},title:"Close panel",children:jsx(X,{className:"h-3.5 w-3.5"})}),jsxs("div",{className:"mb-3 flex flex-col items-center",children:[Nr.createElement(ma(B),{className:i("h-10 w-10 mb-2",B.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:B.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(mr,{label:"Type",value:B.type==="directory"?"Directory":B.mimeType||B.extension||vn(B.name)||"File"}),B.size!=null&&jsx(mr,{label:"Size",value:Oi(B.size)}),jsx(mr,{label:"Path",value:B.path,mono:true}),B.extension&&jsx(mr,{label:"Extension",value:B.extension}),B.modifiedAt&&jsx(mr,{label:"Modified",value:da(B.modifiedAt)}),B.createdAt&&jsx(mr,{label:"Created",value:da(B.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[B.type==="file"&&u&&jsxs("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>u(B),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),w?.map(M=>jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>M.onClick(B),children:[M.icon&&Nr.createElement(M.icon,{className:"h-3 w-3"}),M.label]},M.key))]})]})})]}),jsxs("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[jsxs("span",{children:[J.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[R.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[R.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),h&&!y&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:M=>K("n",M),onTouchStart:M=>xe("n",M)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:M=>K("s",M),onTouchStart:M=>xe("s",M)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:M=>K("w",M),onTouchStart:M=>xe("w",M)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:M=>K("e",M),onTouchStart:M=>xe("e",M)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:M=>K("nw",M),onTouchStart:M=>xe("nw",M)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:M=>K("ne",M),onTouchStart:M=>xe("ne",M)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:M=>K("sw",M),onTouchStart:M=>xe("sw",M)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:M=>K("se",M),onTouchStart:M=>xe("se",M)})]}),jsx("style",{children:`
|
|
23
|
+
`})]});return jsx("div",{className:s($&&"fixed inset-0 z-100 flex items-center justify-center p-8",$&&(J?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:$?A=>{A.target===A.currentTarget&&Y();}:void 0,children:jsx("div",{className:s($&&"w-full",$&&!re&&"max-w-5xl"),children:Ne})})}function Ma(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Dl(e){return e==null?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Di(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var Ff={".png":Image,".jpg":Image,".jpeg":Image,".gif":Image,".svg":Image,".webp":Image,".ico":Image,".bmp":Image,".mp3":Music,".wav":Music,".flac":Music,".ogg":Music,".aac":Music,".m4a":Music,".mp4":Video,".mkv":Video,".avi":Video,".mov":Video,".wmv":Video,".webm":Video,".ts":FileCode,".tsx":FileCode,".js":FileCode,".jsx":FileCode,".json":FileCode,".html":FileCode,".css":FileCode,".scss":FileCode,".py":FileCode,".rs":FileCode,".go":FileCode,".java":FileCode,".c":FileCode,".cpp":FileCode,".h":FileCode,".sh":Terminal,".bat":Terminal,".ps1":Terminal,".md":FileText,".txt":FileText,".pdf":FileText,".doc":FileText,".docx":FileText,".rtf":FileText,".csv":FileSpreadsheet,".xls":FileSpreadsheet,".xlsx":FileSpreadsheet,".db":Database,".sqlite":Database,".sql":Database,".zip":FileArchive,".tar":FileArchive,".gz":FileArchive,".rar":FileArchive,".7z":FileArchive};function Li(e){if(e.type==="directory")return Folder;let t=e.extension||Ma(e.name);return Ff[t]||File}function Vr(e,t,r){return Math.max(t,Math.min(r,e))}function Ll(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function El(e,t){if(e<480)return {size:{width:e-16,height:t-48},pos:{x:8,y:24}};if(e<640){let a=e-24,i=Math.min(t-64,540);return {size:{width:a,height:i},pos:{x:12,y:32}}}if(e<1024){let a=Math.min(640,e-32),i=Math.min(480,t-64);return {size:{width:a,height:i},pos:{x:Math.max(0,Math.round((e-a)/2)),y:Math.max(0,Math.round((t-i)/2))}}}let r=720,n=520;return {size:{width:r,height:n},pos:{x:Math.max(0,Math.round((e-r)/2)),y:Math.max(0,Math.round((t-n)/2))}}}function Ei({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:n="list",initialPosition:a,initialSize:i,dockable:o=false,dockSide:l="right",visible:c=true,onFileOpen:m,onSelectionChange:d,onNavigate:f,onDelete:p,onClose:u,onMinimize:h,onPathSubmit:g,defaultInputMode:b="search",actions:N,resizable:x=true,minSize:T={width:400,height:300},className:w}){let[C,S]=useState(n),[R,V]=useState(new Set),[I,E]=useState(null),[v,U]=useState(false),[k,q]=useState(false),[M,W]=useState(""),[$,ue]=useState(b),[J,de]=useState(c),[re,B]=useState(false),[j,pe]=useState({w:window.innerWidth,h:window.innerHeight}),ye=El(window.innerWidth,window.innerHeight),[y,L]=useState(a??ye.pos),[G,O]=useState(i??ye.size),[_,ee]=useState(null),xe=useRef(false),P=useRef({x:0,y:0}),F=useRef(null),K=useRef(false),oe=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),X$1=useRef(false),fe=useRef(v);useEffect(()=>{fe.current=v;},[v]);let we=c!==void 0?c:J,H=useMemo(()=>{let D=e.filter(Me=>Me.type==="directory"),ce=e.filter(Me=>Me.type==="file");return D.sort((Me,Re)=>Me.name.localeCompare(Re.name)),ce.sort((Me,Re)=>Me.name.localeCompare(Re.name)),[...D,...ce]},[e]),ne=useMemo(()=>{if($!=="search"||!M.trim())return H;let D=M.toLowerCase();return H.filter(ce=>ce.name.toLowerCase().includes(D))},[H,M,$]),Y=I!=null?ne[I]:null;useEffect(()=>{let D=Ll(window.innerWidth),ce=()=>{let Me=window.innerWidth,Re=window.innerHeight;if(pe({w:Me,h:Re}),fe.current)return;let Ee=Ll(Me);if(Ee!==D&&!X$1.current&&!i){let at=El(Me,Re);O(at.size),L(at.pos);}D=Ee;};return window.addEventListener("resize",ce),()=>window.removeEventListener("resize",ce)},[i]);let Q=useCallback((D,ce)=>{V(Me=>{let Re=new Set(Me);return ce.ctrlKey||ce.metaKey?Re.has(D)?Re.delete(D):Re.add(D):(Re.clear(),Re.add(D)),Re}),E(D);},[]);useEffect(()=>{if(!d)return;let D=Array.from(R).map(ce=>ne[ce]).filter(Boolean);d(D);},[R]);let ke=useCallback(D=>{let ce=ne[D];ce&&(ce.type==="directory"?f?.(ce.path):m?.(ce));},[ne,m,f]),He=useCallback(D=>{v||D.target.closest("button")||(X$1.current=true,xe.current=true,P.current={x:D.clientX-y.x,y:D.clientY-y.y},D.preventDefault());},[y,v]),Fe=useCallback(D=>{if(v||D.target.closest("button"))return;X$1.current=true;let ce=D.touches[0];xe.current=true,P.current={x:ce.clientX-y.x,y:ce.clientY-y.y};},[y,v]);useEffect(()=>{let D=Re=>{if(!xe.current)return;let Ee=window.innerWidth-100,at=window.innerHeight-40;L({x:Vr(Re.clientX-P.current.x,0,Ee),y:Vr(Re.clientY-P.current.y,0,at)});},ce=Re=>{if(!xe.current)return;Re.preventDefault();let Ee=Re.touches[0],at=window.innerWidth-100,Ut=window.innerHeight-40;L({x:Vr(Ee.clientX-P.current.x,0,at),y:Vr(Ee.clientY-P.current.y,0,Ut)});},Me=()=>{xe.current=false,K.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",D),window.addEventListener("mouseup",Me),window.addEventListener("touchmove",ce,{passive:false}),window.addEventListener("touchend",Me),()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",Me),window.removeEventListener("touchmove",ce),window.removeEventListener("touchend",Me);}},[]);let Z=useCallback((D,ce)=>{v||(ce.preventDefault(),ce.stopPropagation(),X$1.current=true,K.current=D,oe.current={x:ce.clientX,y:ce.clientY,w:G.width,h:G.height,px:y.x,py:y.y},document.body.style.cursor=D==="e"||D==="w"?"ew-resize":D==="n"||D==="s"?"ns-resize":D==="nw"||D==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[v,G,y]),Ne=useCallback((D,ce)=>{if(v)return;ce.preventDefault(),ce.stopPropagation(),X$1.current=true;let Me=ce.touches[0];K.current=D,oe.current={x:Me.clientX,y:Me.clientY,w:G.width,h:G.height,px:y.x,py:y.y},document.body.style.userSelect="none";},[v,G,y]);useEffect(()=>{let D=(Ee,at)=>{let Ut=K.current;if(!Ut)return;let ds=Ee-oe.current.x,ms=at-oe.current.y,{w:mr,h:pr,px:Wa,py:ja}=oe.current;if(Ut.includes("e")&&(mr=Math.max(T.width,mr+ds)),Ut.includes("w")){let zr=Math.max(T.width,mr-ds);Wa=Wa+(mr-zr),mr=zr;}if(Ut.includes("s")&&(pr=Math.max(T.height,pr+ms)),Ut.includes("n")){let zr=Math.max(T.height,pr-ms);ja=ja+(pr-zr),pr=zr;}O({width:mr,height:pr}),L({x:Wa,y:ja});},ce=Ee=>{K.current&&D(Ee.clientX,Ee.clientY);},Me=Ee=>{K.current&&(Ee.preventDefault(),D(Ee.touches[0].clientX,Ee.touches[0].clientY));},Re=()=>{K.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",ce),window.addEventListener("mouseup",Re),window.addEventListener("touchmove",Me,{passive:false}),window.addEventListener("touchend",Re),()=>{window.removeEventListener("mousemove",ce),window.removeEventListener("mouseup",Re),window.removeEventListener("touchmove",Me),window.removeEventListener("touchend",Re);}},[T]);let A=useCallback(()=>{v?(_&&(L(_.pos),O(_.size)),U(false)):(ee({pos:y,size:G}),U(true));},[v,y,G,_]),ae=useCallback(()=>{k?q(false):(v&&(U(false),_&&(L(_.pos),O(_.size))),q(true),h?.());},[k,v,_,h]);useEffect(()=>{if(!we||k)return;let D=ce=>{if(!(!F.current?.contains(document.activeElement)&&document.activeElement!==F.current)){if(ce.key==="Escape"&&(E(null),V(new Set)),ce.ctrlKey&&ce.key==="a"){ce.preventDefault();let Me=new Set(ne.map((Re,Ee)=>Ee));V(Me);}ce.key==="Delete"&&R.size>0&&p&&(ce.preventDefault(),B(true));}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[we,k,ne,R,p]);let se={"--fe-accent":r};if(k)return jsx("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",l==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:se,onClick:()=>q(false),title:`Restore ${t}`,children:jsxs("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[jsx(HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!we)return null;let z=v?j.w:Math.min(G.width,j.w-8),ve=v?j.h:Math.min(G.height,j.h-8),_e=v?0:Vr(y.x,0,Math.max(0,j.w-z)),mt=v?0:Vr(y.y,0,Math.max(0,j.h-40)),Xa=z<500;return jsxs("div",{ref:F,className:s("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",v&&"rounded-none",w),style:{...se,left:_e,top:mt,width:z,height:ve,transition:v?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxs("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:He,onTouchStart:Fe,onDoubleClick:A,children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:jsx(HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:"fe-btn mr-1",onClick:()=>S(D=>D==="list"?"grid":"list"),title:C==="list"?"Grid view":"List view",children:C==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),o&&jsx("button",{className:"fe-btn",onClick:ae,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:A,title:v?"Restore":"Maximize",children:v?jsx(Minimize2,{className:"h-3.5 w-3.5"}):jsx(Maximize2,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{u?.(),de(false);},title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsx("button",{className:"fe-btn p-1",onClick:()=>f?.(".."),title:"Go up",children:jsx(FolderUp,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:$==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>ue(D=>D==="search"?"navigate":"search"),title:$==="search"?"Switch to path navigation":"Switch to file search",children:$==="search"?jsx(Search,{className:"h-3 w-3"}):jsx(CornerRightDown,{className:"h-3 w-3"})}),jsx("div",{className:"relative flex-1",children:jsx("input",{type:"text",value:M,onChange:D=>W(D.target.value),onKeyDown:D=>{D.key==="Enter"&&M.trim()&&$==="navigate"&&(g?g(M.trim()):f?.(M.trim()));},placeholder:$==="search"?"Search files\u2026":"Enter path and press Enter\u2026",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[ne.length," item",ne.length!==1?"s":"",R.size>0&&` \xB7 ${R.size} selected`]})]}),jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:D=>{D.target===D.currentTarget&&(V(new Set),E(null));},children:ne.length===0?jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsx(Folder,{className:"mb-2 h-10 w-10"}),jsx("span",{className:"text-xs",children:"No files found"})]}):C==="list"?jsx("div",{className:"space-y-px",children:ne.map((D,ce)=>{let Me=Li(D),Re=R.has(ce),Ee=D.extension||Ma(D.name);return jsxs("div",{className:s("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",Re?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:Re?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:at=>Q(ce,at),onDoubleClick:()=>ke(ce),children:[jsx(Me,{className:s("h-4 w-4 shrink-0",D.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:D.name}),Ee&&D.type==="file"&&jsx("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:Ee}),D.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Dl(D.size)}),D.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Di(D.modifiedAt)})]},D.path+ce)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:ne.map((D,ce)=>{let Me=Li(D),Re=R.has(ce),Ee=D.extension||Ma(D.name);return jsxs("div",{className:s("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",Re?"bg-(--fe-accent)/15 text-(--fe-text-strong) ring-1 ring-(--fe-accent)/30":"text-(--fe-text) hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),onClick:at=>Q(ce,at),onDoubleClick:()=>ke(ce),children:[jsx(Me,{className:s("h-7 w-7",D.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:D.name}),Ee&&D.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:Ee})]},D.path+ce)})})}),jsx("div",{className:s("overflow-hidden transition-[width,opacity] duration-300 ease-out",Xa?s("absolute right-0 top-0 bottom-0 z-10",Y?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):s("shrink-0",Y?"w-56":"w-0")),children:Y&&jsxs("div",{className:s("flex h-full flex-col p-4",Xa?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Xa&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{E(null),V(new Set);},title:"Close panel",children:jsx(X,{className:"h-3.5 w-3.5"})}),jsxs("div",{className:"mb-3 flex flex-col items-center",children:[qr.createElement(Li(Y),{className:s("h-10 w-10 mb-2",Y.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:Y.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(Ir,{label:"Type",value:Y.type==="directory"?"Directory":Y.mimeType||Y.extension||Ma(Y.name)||"File"}),Y.size!=null&&jsx(Ir,{label:"Size",value:Dl(Y.size)}),jsx(Ir,{label:"Path",value:Y.path,mono:true}),Y.extension&&jsx(Ir,{label:"Extension",value:Y.extension}),Y.modifiedAt&&jsx(Ir,{label:"Modified",value:Di(Y.modifiedAt)}),Y.createdAt&&jsx(Ir,{label:"Created",value:Di(Y.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[Y.type==="file"&&m&&jsxs("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>m(Y),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),N?.map(D=>jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>D.onClick(Y),children:[D.icon&&qr.createElement(D.icon,{className:"h-3 w-3"}),D.label]},D.key))]})]})})]}),jsxs("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[jsxs("span",{children:[ne.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[R.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[R.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),x&&!v&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:D=>Z("n",D),onTouchStart:D=>Ne("n",D)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:D=>Z("s",D),onTouchStart:D=>Ne("s",D)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:D=>Z("w",D),onTouchStart:D=>Ne("w",D)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:D=>Z("e",D),onTouchStart:D=>Ne("e",D)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:D=>Z("nw",D),onTouchStart:D=>Ne("nw",D)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:D=>Z("ne",D),onTouchStart:D=>Ne("ne",D)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:D=>Z("sw",D),onTouchStart:D=>Ne("sw",D)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:D=>Z("se",D),onTouchStart:D=>Ne("se",D)})]}),jsx("style",{children:`
|
|
24
24
|
.fe-window {
|
|
25
25
|
background: var(--fe-bg);
|
|
26
26
|
box-shadow: var(--fe-shadow);
|
|
@@ -81,4 +81,4 @@ import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'cl
|
|
|
81
81
|
from { opacity: 0; transform: translateX(-4px); }
|
|
82
82
|
to { opacity: 1; transform: translateX(0); }
|
|
83
83
|
}
|
|
84
|
-
`}),jsx(Lr,{open:Y,onOpenChange:V,children:jsxs(Fo,{size:"sm",children:[jsxs(Ao,{children:[jsxs(zo,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(Bo,{children:[R.size===1?`Are you sure you want to delete "${J[Array.from(R)[0]]?.name}"?`:`Are you sure you want to delete ${R.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(_o,{children:[jsx(Yt,{intent:"ghost",onClick:()=>V(false),children:"Cancel"}),jsxs(Yt,{intent:"danger",onClick:()=>{let M=Array.from(R).map(ae=>J[ae]).filter(Boolean);x?.(M),E(new Set),H(null),V(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function mr({label:e,value:t,mono:r}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsx("div",{className:i("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function dp(e,t){let r=t.getBoundingClientRect(),n=Math.max(r.width,r.height)*1.2,o=e.clientX-r.left,a=e.clientY-r.top,s=document.createElement("span");s.className="masonry-ripple",s.style.width=`${n}px`,s.style.height=`${n}px`,s.style.left=`${o}px`,s.style.top=`${a}px`,t.appendChild(s),s.addEventListener("animationend",()=>s.remove());}function ha({columns:e,columnWidth:t=240,gap:r=16,items:n,onItemClick:o,className:a,style:s,children:p,...b}){let u=useRef(null),c=useRef([]),[T,x]=useState(()=>e??1),[m,g]=useState([]),[d,f]=useState(0),w=n?n.map((R,E)=>({key:R.key??E,node:R.content})):Nr.Children.toArray(p).map((R,E)=>({key:R.key??E,node:R})),h=w.length,P=useCallback(R=>e??Math.max(1,Math.floor((R+r)/(t+r))),[e,t,r]),k=useCallback(()=>{let R=u.current;if(!R)return;let E=R.clientWidth,A=P(E);x(A);let H=(E-(A-1)*r)/A,y=new Array(A).fill(0),O=[];for(let ne=0;ne<h;ne++){let C=c.current[ne],re=C?C.offsetHeight:0,_=0;for(let de=1;de<A;de++)y[de]<y[_]&&(_=de);O.push({top:y[_],left:_*(H+r),width:H}),y[_]+=re+r;}let v=Math.max(0,...y)-(h?r:0);g(O),f(v);},[h,P,r]);useEffect(()=>{let R=u.current;if(!R)return;let E=new ResizeObserver(()=>k());return E.observe(R),()=>E.disconnect()},[k]),useEffect(()=>{let R=requestAnimationFrame(k);return ()=>cancelAnimationFrame(R)},[k]),useEffect(()=>{let R=new ResizeObserver(()=>k());return c.current.forEach(E=>{E&&R.observe(E);}),()=>R.disconnect()},[h,T,k]);let N=useCallback((R,E)=>{let A=R.currentTarget;dp(R,A),o?.(n?.[E],E);},[o,n]),F=R=>{if(!n)return false;let E=n[R];return !!(E.title||E.description||E.actions)};return jsx("div",{ref:u,className:i("relative",a),style:{...s,height:d},...b,children:w.map((R,E)=>jsxs("div",{ref:A=>{c.current[E]=A;},className:"masonry-item",role:"button",tabIndex:0,onClick:A=>N(A,E),onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),o?.(n?.[E],E));},style:{position:"absolute",top:m[E]?.top??0,left:m[E]?.left??0,width:m[E]?.width??"100%"},children:[R.node,F(E)&&jsxs("div",{className:"masonry-item-overlay",children:[n[E].title&&jsx("p",{className:"masonry-item-overlay-title",children:n[E].title}),n[E].description&&jsx("p",{className:"masonry-item-overlay-desc",children:n[E].description}),n[E].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:n[E].actions})]})]},R.key))})}function Tn({text:e="",mode:t="typewriter",speed:r=40,cursor:n=true,cursorChar:o="\u258B",thinking:a=false,streaming:s=false,delay:p=0,onComplete:b,as:u="span",className:c}){let[T,x]=useState(t==="instant"?e:""),[m,g]=useState(false),[d,f]=useState(t==="instant"),[w,h]=useState(false),P=useRef(0),k=useRef(b);k.current=b;let N=useRef(e);N.current=e,useEffect(()=>{if(t!=="typewriter")return;if(x(""),f(false),h(false),g(false),!e){f(true);return}let H=Math.max(10,1e3/r),y=0,O,v=()=>{g(true),O=setInterval(()=>{let C=N.current;y++,x(C.slice(0,y)),y>=C.length&&(clearInterval(O),g(false),f(true),k.current?.());},H);},ne;return p>0?ne=setTimeout(v,p):v(),()=>{clearTimeout(ne),clearInterval(O);}},[e,t]),useEffect(()=>{if(t!=="stream")return;if(e.length===0){P.current=0,x(""),g(false),f(false),h(false);return}if(e.length<=P.current)return;let H=Math.max(10,1e3/r),y=P.current;g(true),f(false),h(false);let O=setInterval(()=>{y++,P.current=y,x(N.current.slice(0,y)),y>=N.current.length&&(clearInterval(O),g(false),k.current?.());},H);return ()=>clearInterval(O)},[e,t]),useEffect(()=>{t==="instant"&&(x(e),g(false),f(true));},[e,t]);let F=useRef(s);useEffect(()=>{let H=F.current;if(F.current=s,H&&!s&&!m&&t==="stream"){h(true);let y=setTimeout(()=>{h(false),f(true);},650);return ()=>clearTimeout(y)}},[s,m,t]);let R=n&&(a||m||w||t==="stream"&&s&&!d||t==="typewriter"&&!d),E=a?"tw-cursor--blink":m?"tw-cursor--solid":w?"tw-cursor--out":"tw-cursor--blink";return jsxs(u,{className:i(c),children:[a&&!T&&jsx("span",{"aria-hidden":"true",children:"\u200B"}),T,R&&jsx("span",{className:i("tw-cursor",E),"aria-hidden":"true",children:o})]})}var pp={FilmReel:ra,MiniPlayer:oa,CinePlayer:ia,FileExplorer:pa,Masonry:ha,TypewriterText:Tn},ba=pp;var Ui=cva("w-full",{variants:{intent:{default:"",card:"rounded-(--form-radius) border border-primary-200 bg-white p-6 shadow-sm dark:border-primary-700 dark:bg-primary-900",inset:"rounded-(--form-radius) bg-primary-50 p-6 dark:bg-primary-800/50"},size:{sm:"",md:"",lg:""}},defaultVariants:{intent:"default",size:"md"}});cva("flex w-full",{variants:{layout:{stacked:"flex-col gap-1.5",inline:"flex-row items-start gap-(--form-item-gap-md)"},size:{sm:"",md:"",lg:""}},defaultVariants:{layout:"stacked",size:"md"}});var qi=cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var va=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),yp={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},es={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function wa({children:e,className:t,intent:r,size:n="md",layout:o="stacked",title:a,description:s,footer:p,onValues:b,onSubmit:u,...c}){let T=yp[n??"md"],[x,m]=useState({}),g=useCallback(d=>{if(d.preventDefault(),u?.(d),b){let f=Object.fromEntries(new FormData(d.currentTarget).entries()),w=b(f,d),h=P=>{if(!P)return;let k={};for(let[N,{result:F,reason:R}]of Object.entries(P))R&&(k[N]={status:F?"success":"error",message:R});m(k);};w instanceof Promise?w.then(h).catch(()=>{}):h(w);}},[u,b]);return jsx(va.Provider,{value:{layout:o??"stacked",size:n??"md",labelWidth:T,bulkErrors:x},children:jsxs("form",{className:i(Ui({intent:r,size:n}),"flex flex-col",t),onSubmit:g,...c,children:[(a||s)&&jsxs("div",{className:"mb-(--form-header-mb)",children:[a&&jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:a}),s&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:s})]}),jsx("div",{className:i("flex flex-col",es[n??"md"]),children:e}),p&&jsx("div",{className:"mt-(--form-footer-pt) flex flex-wrap items-center justify-end gap-(--form-footer-gap) border-t border-primary-200 pt-(--form-footer-pt) dark:border-primary-700",children:p})]})})}var vp={error:jsx(AlertCircle,{}),warning:jsx(AlertTriangle,{}),success:jsx(CheckCircle,{}),hint:jsx(Info,{})};function wp({label:e,layout:t,required:r,hint:n,validation:o,name:a,onValidate:s,className:p,children:b}){let u=useContext(va),c=useId(),[T,x]=useState(void 0),m=a?u.bulkErrors[a]:void 0,g=o??T??m,f=(t??u.layout)==="inline",w=useCallback(F=>{let R=F!=null&&typeof F=="object"&&"target"in F?F.target.value:F;if(a&&u.bulkErrors[a]&&(u.bulkErrors[a]=void 0),!s){x(void 0);return}let{result:E,reason:A}=s(R);x(A?{status:E?"success":"error",message:A}:void 0);},[s,a,u.bulkErrors]),h=g?`${c}-validation`:n?`${c}-hint`:void 0,P=Nr.Children.map(b,(F,R)=>{if(R!==0||!Nr.isValidElement(F))return F;let E=F,A={};if(E.props.id||(A.id=c),h&&!E.props["aria-describedby"]&&(A["aria-describedby"]=h),g?.status==="error"&&!E.props["aria-invalid"]&&(A["aria-invalid"]=true),a&&!E.props.name&&(A.name=a),s){let H=E.props.onChange;A.onChange=y=>{H?.(y),w(y);};}return Object.keys(A).length?Nr.cloneElement(E,A):F}),k=e!=null&&jsx("label",{htmlFor:c,className:i("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",r&&"after:ml-0.5 after:text-danger-500 after:content-['*']",f&&"pt-1.75"),style:f?{width:u.labelWidth,minWidth:u.labelWidth}:void 0,children:e}),N=o?`${c}-validation`:n?`${c}-hint`:void 0;return jsxs("div",{className:i("flex w-full flex-col gap-1.5",f&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",p),children:[k,jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[P,g&&jsxs("p",{id:`${c}-validation`,className:i(qi({status:g.status})),role:g.status==="error"?"alert":void 0,children:[vp[g.status],jsx("span",{children:g.message})]}),n&&jsx("p",{id:N===`${c}-hint`?N:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:n})]})]})}function kp({title:e,description:t,className:r,children:n}){let{size:o}=useContext(va);return jsxs("fieldset",{className:i("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",es[o],r),children:[(e||t)&&jsxs("legend",{className:"px-1.5 pb-1",children:[e&&jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:e}),t&&jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:t})]}),n]})}var Np={Form:wa},ka=Np;var dt=cva("relative w-full font-sans select-none",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),mt=cva("flex flex-wrap gap-3 items-center justify-center",{variants:{position:{top:"mb-3",bottom:"mt-3",left:"flex-col mr-4",right:"flex-col ml-4"}},defaultVariants:{position:"bottom"}}),pt=cva("absolute z-50 pointer-events-none px-3 py-2 rounded-lg text-xs shadow-lg border transition-opacity duration-150 bg-primary-900 text-primary-50 border-primary-700 dark:bg-primary-950 dark:border-primary-800");function Rt(e){let[t,r]=useState(()=>new Set(e)),n=useCallback(s=>{r(p=>{let b=new Set(p);return b.has(s)?b.delete(s):b.add(s),b});},[]),o=useCallback(s=>t.has(s),[t]),a=useCallback(()=>{r(new Set(e));},[e]);return {visible:t,toggle:n,isVisible:o,showAll:a}}function Mt(e){let t=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"];return Array.from({length:e},(r,n)=>t[n%t.length])}function St(e,t,r=.1){if(e===t)return [e-1,t+1];let o=(t-e)*r;return [Math.floor(e-o),Math.ceil(t+o)]}function pr(e,t,r){if(r<=1)return [e];let n=(t-e)/(r-1);return Array.from({length:r},(o,a)=>+(e+a*n).toFixed(10))}function Pe(e,t){return t?t(e):typeof e=="number"?Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}K`:Number.isInteger(e)?e.toString():e.toFixed(2):String(e)}function Qe(e,t,r,n){let o=(n-90)*Math.PI/180;return {x:e+r*Math.cos(o),y:t+r*Math.sin(o)}}function Lt(e,t,r){return {top:20,right:r?65:20,bottom:e?52:36,left:t?65:52}}function Et(e,t,r){let n=Math.max(e,120);return {width:n,height:t,margins:r,plotLeft:r.left,plotTop:r.top,plotRight:n-r.right,plotBottom:t-r.bottom,plotWidth:Math.max(n-r.left-r.right,10),plotHeight:Math.max(t-r.top-r.bottom,10)}}function ts(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let s=String(a.x);r.has(s)||(r.add(s),n.push(s));}return n}function Ta(e,t,r){let n=1/0,o=-1/0;for(let p of e)if(t.has(p.id))for(let b of p.data)b.y<n&&(n=b.y),b.y>o&&(o=b.y);if(!isFinite(n))return [0,1];let[a,s]=St(n,o);return [r?.min??a,r?.max??s]}function Rn(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:s=>o+(s-r)/(n-r)*(a-o)}function Mn(e,t){let r=e.length;if(r===0)return ()=>(t[0]+t[1])/2;let n=(t[1]-t[0])/r;return o=>{let a=e.indexOf(o);return a<0?(t[0]+t[1])/2:t[0]+a*n+n/2}}function rs(e,t,r){return e.map(n=>`${t(n.x).toFixed(2)},${r(n.y).toFixed(2)}`).join(" ")}function Ra(e,t,r){if(e.length===0)return "";let n=e.map(s=>({x:t(s.x),y:r(s.y)}));if(n.length===1)return `M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;let o=.5,a=`M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;for(let s=0;s<n.length-1;s++){let p=s===0?{x:2*n[0].x-n[1].x,y:2*n[0].y-n[1].y}:n[s-1],b=n[s],u=n[s+1],c=s+2<n.length?n[s+2]:{x:2*n[n.length-1].x-n[n.length-2].x,y:2*n[n.length-1].y-n[n.length-2].y},T=b.x+(u.x-p.x)*o/3,x=b.y+(u.y-p.y)*o/3,m=u.x-(c.x-b.x)*o/3,g=u.y-(c.y-b.y)*o/3;a+=` C ${T.toFixed(2)} ${x.toFixed(2)}, ${m.toFixed(2)} ${g.toFixed(2)}, ${u.x.toFixed(2)} ${u.y.toFixed(2)}`;}return a}function ns(e,t,r,n,o){if(e.length===0)return "";let a=n?Ra(e,t,r):`M ${e.map(b=>`${t(b.x).toFixed(2)},${r(b.y).toFixed(2)}`).join(" L ")}`,s=t(e[e.length-1].x).toFixed(2),p=t(e[0].x).toFixed(2);return `${a} L ${s},${o.toFixed(2)} L ${p},${o.toFixed(2)} Z`}function Sn(e,t=5){return pr(e[0],e[1],t)}function Ma(e,t,r){if(t.length===0)return -1;let n=1/0,o=0;for(let a=0;a<t.length;a++){let s=Math.abs(r(t[a])-e);s<n&&(n=s,o=a);}return o}function Sa(e,t){return e.data.find(r=>String(r.x)===t)?.y}function os(e){for(let t of e)for(let r of t.data)if(typeof r.x=="string")return true;return false}function Ln({items:e,position:t,onToggle:r}){return jsx("div",{className:mt({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:i("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function Pa({series:e,xAxis:t,yAxis:r,y2Axis:n,y2Series:o=[],smooth:a=false,showDots:s=true,area:p=false,strokeWidth:b=2,title:u,height:c=300,className:T,legend:x=true,legendPosition:m="bottom",animateOnMount:g=true,emptyText:d="No data to display"}){let f=useRef(null),w=useRef(null),[h,P]=useState(600),[k,N]=useState(null),[F,R]=useState(null);useEffect(()=>{let S=w.current;if(!S)return;let ce=S.getBoundingClientRect().width;ce>0&&P(ce);let oe=new ResizeObserver(he=>{let fe=he[0]?.contentRect.width;fe&&fe>0&&P(fe);});return oe.observe(S),()=>oe.disconnect()},[]);let E=useMemo(()=>e.map(S=>S.id),[e]),{visible:A,toggle:H,isVisible:y}=Rt(E),O=useMemo(()=>Mt(e.length),[e.length]),v=useMemo(()=>new Map(e.map((S,ce)=>[S.id,S.color??O[ce]])),[e,O]),ne=useMemo(()=>Lt(!!t?.label,!!r?.label,!!n),[t?.label,r?.label,n]),C=useMemo(()=>Et(h,c,ne),[h,c,ne]),re=useMemo(()=>os(e),[e]),_=useMemo(()=>re?ts(e,A):[],[e,A,re]),de=useMemo(()=>{if(re){let fe=Mn(_,[C.plotLeft,C.plotRight]);return Re=>fe(Re)}let S=e.flatMap(fe=>fe.data.map(Re=>Re.x));if(S.length===0)return ()=>C.plotLeft;let ce=Math.min(...S),oe=Math.max(...S),he=Rn([ce,oe],[C.plotLeft,C.plotRight]);return fe=>he(fe)},[e,re,_,C]),j=useMemo(()=>Ta(e,A,r),[e,A,r]),pe=useMemo(()=>Rn(j,[C.plotBottom,C.plotTop]),[j,C]),Y=useMemo(()=>Sn(j,r?.tickCount??5),[j,r?.tickCount]),V=useMemo(()=>{if(!n)return null;let S=e.filter(ce=>o.includes(ce.id));return Ta(S,A,n)},[n,e,o,A]),G=useMemo(()=>V?Rn(V,[C.plotBottom,C.plotTop]):null,[V,C]),me=useMemo(()=>V?Sn(V,n?.tickCount??5):[],[V,n?.tickCount]),W=useMemo(()=>{if(re)return _;let S=e.flatMap(he=>he.data.map(fe=>Number(fe.x)));if(S.length===0)return [];let ce=Math.min(...S),oe=Math.max(...S);return Sn([ce,oe],t?.tickCount??6)},[re,_,e,t?.tickCount]),l=useCallback(S=>{let ce=S.currentTarget.closest("svg");if(!ce)return;let oe=ce.getBoundingClientRect(),he=S.clientX-oe.left,fe=f.current?.getBoundingClientRect();if(!fe)return;let Re="",ye=he;if(re&&_.length>0){let q=Mn(_,[C.plotLeft,C.plotRight]),be=Ma(he,_,q);Re=_[be]??"",ye=q(Re);}else if(!re){let q=W;Re=Pe((he-C.plotLeft)/C.plotWidth*(q[q.length-1]-q[0])+q[0],t?.format),ye=he;}let z=e.filter(q=>y(q.id)).map(q=>{o.includes(q.id)&&G!=null?G:pe;let He;if(re)He=Sa(q,Re);else {let K=he,xe=1/0,L;for(let Z of q.data){let ee=de(Z.x),I=Math.abs(ee-K);I<xe&&(xe=I,L=Z.y);}He=L;}return {name:q.name,value:He!==void 0?Pe(He,r?.format):"\u2014",color:v.get(q.id)??"var(--color-chart-1)"}});ye>=C.plotLeft&&ye<=C.plotRight&&R(ye);let J=S.clientX-fe.left+12,B=S.clientY-fe.top-10;N({x:J,y:B,label:Re,items:z});},[re,_,C,e,y,o,G,pe,de,W,t?.format,r?.format,v]),D=useCallback(()=>{N(null),R(null);},[]),X=useCallback(S=>{S.preventDefault();let ce=S.touches[0];if(!ce)return;let oe=S.currentTarget.closest("svg");if(!oe)return;let he=oe.getBoundingClientRect(),fe=f.current?.getBoundingClientRect();if(!fe)return;let Re=ce.clientX-he.left,ye=Re,z="";if(re&&_.length>0){let B=Mn(_,[C.plotLeft,C.plotRight]),q=Ma(Re,_,B);z=_[q]??"",ye=B(z);}ye>=C.plotLeft&&ye<=C.plotRight&&R(ye);let J=e.filter(B=>y(B.id)).map(B=>({name:B.name,value:re&&z?Pe(Sa(B,z)??0,r?.format):"\u2014",color:v.get(B.id)??"var(--color-chart-1)"}));N({x:ce.clientX-fe.left+12,y:ce.clientY-fe.top-10,label:z,items:J});},[re,_,C,e,y,r?.format,v]),$=useMemo(()=>e.map((S,ce)=>({id:S.id,label:S.name,color:S.color??O[ce],visible:y(S.id)})),[e,O,y]),se=e.some(S=>S.data.length>0),ue=jsxs("svg",{role:"img","aria-label":u??"Line chart",width:C.width,height:C.height,viewBox:`0 0 ${C.width} ${C.height}`,shapeRendering:"geometricPrecision",children:[r?.gridLines!==false&&Y.map(S=>{let ce=pe(S);return jsx("line",{x1:C.plotLeft,x2:C.plotRight,y1:ce,y2:ce,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},S)}),p&&e.map(S=>{if(!y(S.id)||S.data.length===0)return null;let oe=o.includes(S.id)&&G!=null?G:pe,he=v.get(S.id)??"var(--color-chart-1)",fe=ns(S.data,de,oe,a,C.plotBottom);return jsx("path",{d:fe,fill:he,fillOpacity:.15,stroke:"none",className:g?"chart-area-animate":""},`area-${S.id}`)}),e.map(S=>{if(!y(S.id)||S.data.length===0)return null;let oe=o.includes(S.id)&&G!=null?G:pe,he=v.get(S.id)??"var(--color-chart-1)";return a?jsx("path",{d:Ra(S.data,de,oe),fill:"none",stroke:he,strokeWidth:b,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},S.id):jsx("polyline",{points:rs(S.data,de,oe),fill:"none",stroke:he,strokeWidth:b,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},S.id)}),s&&e.map(S=>{if(!y(S.id))return null;let oe=o.includes(S.id)&&G!=null?G:pe,he=v.get(S.id)??"var(--color-chart-1)";return S.data.map((fe,Re)=>jsx("circle",{cx:de(fe.x),cy:oe(fe.y),r:3,fill:he,stroke:"white",strokeWidth:1.5,className:i("chart-dot",g?"chart-dot-animate":"")},`${S.id}-${Re}`))}),F!=null&&jsx("line",{className:"chart-crosshair",x1:F,x2:F,y1:C.plotTop,y2:C.plotBottom,stroke:"currentColor",strokeWidth:1,strokeDasharray:"4 4",opacity:.5,style:{color:"var(--color-secondary-400)"}}),jsx("line",{x1:C.plotLeft,x2:C.plotLeft,y1:C.plotTop,y2:C.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),Y.map(S=>{let ce=pe(S);return jsxs("g",{children:[jsx("line",{x1:C.plotLeft-4,x2:C.plotLeft,y1:ce,y2:ce,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:C.plotLeft-6,y:ce,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(S,r?.format)})]},S)}),r?.label&&jsx("text",{x:-(C.plotTop+C.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),n&&G&&jsxs(Fragment,{children:[jsx("line",{x1:C.plotRight,x2:C.plotRight,y1:C.plotTop,y2:C.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),me.map(S=>{let ce=G(S);return jsxs("g",{children:[jsx("line",{x1:C.plotRight,x2:C.plotRight+4,y1:ce,y2:ce,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:C.plotRight+6,y:ce,textAnchor:"start",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(S,n?.format)})]},S)}),n?.label&&jsx("text",{x:C.plotTop+C.plotHeight/2,y:-(C.width-14),textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(90)",children:n.label})]}),jsx("line",{x1:C.plotLeft,x2:C.plotRight,y1:C.plotBottom,y2:C.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),(re?_:W).map((S,ce)=>{let oe=de(S);return jsxs("g",{children:[jsx("line",{x1:oe,x2:oe,y1:C.plotBottom,y2:C.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:oe,y:C.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(S,t?.format)})]},ce)}),t?.label&&jsx("text",{x:C.plotLeft+C.plotWidth/2,y:C.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label}),jsx("rect",{x:C.plotLeft,y:C.plotTop,width:C.plotWidth,height:C.plotHeight,fill:"transparent",onMouseMove:l,onMouseLeave:D,onTouchStart:X,onTouchMove:X,onTouchEnd:D,style:{cursor:"crosshair"}})]}),Te=m==="left"||m==="right";return jsxs("div",{ref:f,className:i(dt(),T),children:[u&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),x&&m==="top"&&jsx(Ln,{items:$,position:"top",onToggle:H}),jsxs("div",{className:i("flex items-start",Te&&"gap-0"),children:[x&&m==="left"&&jsx(Ln,{items:$,position:"left",onToggle:H}),jsx("div",{ref:w,className:"flex-1 min-w-0 overflow-hidden",children:se?ue:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:d})}),x&&m==="right"&&jsx(Ln,{items:$,position:"right",onToggle:H})]}),x&&m==="bottom"&&jsx(Ln,{items:$,position:"bottom",onToggle:H}),k&&jsxs("div",{className:pt(),style:{left:k.x,top:k.y},role:"tooltip",children:[k.label&&jsx("div",{className:"mb-1 font-medium text-primary-200",children:k.label}),k.items.map((S,ce)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:S.color}}),jsxs("span",{className:"text-primary-300",children:[S.name,":"]}),jsx("span",{className:"font-medium",children:S.value})]},ce))]})]})}function is(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let s=String(a.x);r.has(s)||(r.add(s),n.push(s));}return n}function ss(e,t,r,n){if(r){let o=0;for(let s of e)if(t.has(s.id))for(let p of s.data)p.y>o&&(o=p.y);o===0&&(o=1);let[,a]=St(0,o,.05);return [n?.min??0,n?.max??a]}else {let o=new Map;for(let p of e)if(t.has(p.id))for(let b of p.data){let u=String(b.x);o.set(u,(o.get(u)??0)+b.y);}let a=Math.max(0,...o.values()),[,s]=St(0,a===0?1:a,.05);return [n?.min??0,n?.max??s]}}function ls(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:s=>o+(s-r)/(n-r)*(a-o)}function cs(e,t=5){return pr(e[0],e[1],t)}function ds(e,t,r,n,o,a,s,p,b,u,c){let T=e.filter(h=>t.has(h.id)),x=r.length,m=T.length;if(x===0||m===0)return [];let g=a/x,d=g*(1-u),f=m>0?d*(1-c)/m:0,w=[];for(let h=0;h<r.length;h++){let P=r[h],k=o+h*g+(g-d)/2;for(let N=0;N<T.length;N++){let F=T[N],R=F.data.find(H=>String(H.x)===P);if(!R)continue;let E=k+N*(f+d*c/m),A=b(R.y);w.push({seriesId:F.id,category:P,x:E,y:A,width:Math.max(f,1),height:Math.max(s-A,0),stackBase:s,value:R.y,color:n.get(F.id)??"var(--color-chart-1)"});}}return w}function ms(e,t,r,n,o,a,s,p,b,u){let c=e.filter(w=>t.has(w.id)),T=r.length,x=c.length;if(T===0||x===0)return [];let m=s/T,g=m*(1-b),d=x>0?g*(1-u)/x:0,f=[];for(let w=0;w<r.length;w++){let h=r[w],P=a+w*m+(m-g)/2;for(let k=0;k<c.length;k++){let N=c[k],F=N.data.find(A=>String(A.x)===h);if(!F)continue;let R=P+k*(d+g*u/Math.max(x,1)),E=p(F.y);f.push({seriesId:N.id,category:h,x:o,y:R,width:Math.max(E-o,0),height:Math.max(d,1),stackBase:o,value:F.y,color:n.get(N.id)??"var(--color-chart-1)"});}}return f}function ps(e,t,r,n,o,a,s,p,b){let u=e.filter(g=>t.has(g.id)),c=r.length;if(c===0)return [];let T=s/c*(1-b),x=[],m=new Map;r.forEach(g=>m.set(g,o));for(let g of u)for(let d of r){let f=g.data.find(N=>String(N.x)===d);if(!f)continue;let w=m.get(d)??o,h=Math.max(p(f.y)-o,0),P=r.indexOf(d),k=a+(P+.5)*(s/c);x.push({seriesId:g.id,category:d,x:w,y:k-T/2,width:h,height:Math.max(T,1),stackBase:w,value:f.y,color:n.get(g.id)??"var(--color-chart-1)"}),m.set(d,w+h);}return x}function us(e,t,r,n,o,a,s,p,b){let u=e.filter(g=>t.has(g.id)),c=r.length;if(c===0)return [];let T=a/c*(1-b),x=[],m=new Map;r.forEach(g=>m.set(g,s));for(let g of u)for(let d of r){let f=g.data.find(F=>String(F.x)===d);if(!f)continue;let w=m.get(d)??s,h=Math.max(s-p(f.y),0),P=w-h,k=r.indexOf(d),N=o+(k+.5)*(a/c);x.push({seriesId:g.id,category:d,x:N-T/2,y:P,width:Math.max(T,1),height:h,stackBase:w,value:f.y,color:n.get(g.id)??"var(--color-chart-1)"}),m.set(d,P);}return x}function En({items:e,position:t,onToggle:r}){return jsx("div",{className:mt({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:i("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function Va({series:e,xAxis:t,yAxis:r,orientation:n="vertical",grouped:o=true,barRadius:a=4,barPadding:s=.2,groupPadding:p=.3,title:b,height:u=300,className:c,legend:T=true,legendPosition:x="bottom",animateOnMount:m=true,emptyText:g="No data to display"}){let d=useRef(null),f=useRef(null),[w,h]=useState(600),[P,k]=useState(null);useEffect(()=>{let l=f.current;if(!l)return;let D=l.getBoundingClientRect().width;D>0&&h(D);let X=new ResizeObserver($=>{let se=$[0]?.contentRect.width;se&&se>0&&h(se);});return X.observe(l),()=>X.disconnect()},[]);let N=useMemo(()=>e.map(l=>l.id),[e]),{visible:F,toggle:R,isVisible:E}=Rt(N),A=useMemo(()=>Mt(e.length),[e.length]),H=useMemo(()=>new Map(e.map((l,D)=>[l.id,l.color??A[D]])),[e,A]),y=n==="horizontal",O=useMemo(()=>Lt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),v=useMemo(()=>Et(w,u,O),[w,u,O]),ne=useMemo(()=>is(e,F),[e,F]),C=useMemo(()=>ss(e,F,o,y?t:r),[e,F,o,y,t,r]),re=useMemo(()=>ls(C,y?[v.plotLeft,v.plotRight]:[v.plotBottom,v.plotTop]),[C,v,y]),_=useMemo(()=>cs(C,(y?t:r)?.tickCount??5),[C,y,t,r]),de=useMemo(()=>y?o?ms(e,F,ne,H,v.plotLeft,v.plotTop,v.plotHeight,re,p,s):ps(e,F,ne,H,v.plotLeft,v.plotTop,v.plotHeight,re,p):o?ds(e,F,ne,H,v.plotLeft,v.plotWidth,v.plotBottom,v.plotTop,re,p,s):us(e,F,ne,H,v.plotLeft,v.plotWidth,v.plotBottom,re,p),[e,F,ne,H,v,re,o,y,p,s]),j=ne.length>0?v.plotWidth/ne.length:1,pe=ne.length>0?v.plotHeight/ne.length:1,Y=useCallback((l,D)=>{let X=d.current?.getBoundingClientRect();if(!X)return;let $=e.filter(se=>E(se.id)).map(se=>{let ue=se.data.find(Te=>String(Te.x)===D);return {name:se.name,value:ue?Pe(ue.y,r?.format):"\u2014",color:H.get(se.id)??"var(--color-chart-1)"}});k({x:l.clientX-X.left+12,y:l.clientY-X.top-10,category:D,items:$});},[e,E,H,r?.format]),V=useMemo(()=>e.map((l,D)=>({id:l.id,label:l.name,color:l.color??A[D],visible:E(l.id)})),[e,A,E]),G=e.some(l=>l.data.length>0),me=x==="left"||x==="right",W=jsxs("svg",{role:"img","aria-label":b??"Bar chart",width:v.width,height:v.height,viewBox:`0 0 ${v.width} ${v.height}`,shapeRendering:"geometricPrecision",children:[_.map(l=>{let D=re(l);return y?jsx("line",{x1:D,x2:D,y1:v.plotTop,y2:v.plotBottom,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},l):jsx("line",{x1:v.plotLeft,x2:v.plotRight,y1:D,y2:D,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},l)}),de.map(l=>{let D=Math.min(a,l.width/2,l.height/2),X=`${l.seriesId}-${l.category}`;return y?jsx("rect",{x:l.x,y:l.y,width:l.width,height:l.height,rx:D,fill:l.color,className:i("chart-bar-h",m&&"chart-bar-animate"),onMouseMove:$=>Y($,l.category),onMouseLeave:()=>k(null)},X):jsx("rect",{x:l.x,y:l.y,width:l.width,height:l.height,rx:D,fill:l.color,className:i("chart-bar-v",m&&"chart-bar-animate"),onMouseMove:$=>Y($,l.category),onMouseLeave:()=>k(null)},X)}),jsx("line",{x1:v.plotLeft,x2:v.plotLeft,y1:v.plotTop,y2:v.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("line",{x1:v.plotLeft,x2:v.plotRight,y1:v.plotBottom,y2:v.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),!y&&_.map(l=>{let D=re(l);return jsxs("g",{children:[jsx("line",{x1:v.plotLeft-4,x2:v.plotLeft,y1:D,y2:D,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:v.plotLeft-6,y:D,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(l,r?.format)})]},l)}),y&&_.map(l=>{let D=re(l);return jsxs("g",{children:[jsx("line",{x1:D,x2:D,y1:v.plotBottom,y2:v.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:D,y:v.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(l,t?.format)})]},l)}),ne.map((l,D)=>{if(y){let $=v.plotTop+(D+.5)*pe;return jsx("text",{x:v.plotLeft-6,y:$,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:l},l)}let X=v.plotLeft+(D+.5)*j;return jsx("text",{x:X,y:v.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:l},l)}),r?.label&&!y&&jsx("text",{x:-(v.plotTop+v.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsx("text",{x:v.plotLeft+v.plotWidth/2,y:v.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxs("div",{ref:d,className:i(dt(),c),children:[b&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:b}),T&&x==="top"&&jsx(En,{items:V,position:"top",onToggle:R}),jsxs("div",{className:i("flex items-start",me&&"gap-0"),children:[T&&x==="left"&&jsx(En,{items:V,position:"left",onToggle:R}),jsx("div",{ref:f,className:"flex-1 min-w-0 overflow-hidden",children:G?W:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:g})}),T&&x==="right"&&jsx(En,{items:V,position:"right",onToggle:R})]}),T&&x==="bottom"&&jsx(En,{items:V,position:"bottom",onToggle:R}),P&&jsxs("div",{className:pt(),style:{left:P.x,top:P.y},role:"tooltip",children:[jsx("div",{className:"mb-1 font-medium text-primary-200",children:P.category}),P.items.map((l,D)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:l.color}}),jsxs("span",{className:"text-primary-300",children:[l.name,":"]}),jsx("span",{className:"font-medium",children:l.value})]},D))]})]})}function hs(e,t,r,n,o,a,s,p,b){let u=e.filter(g=>t.has(g.id)),c=u.reduce((g,d)=>g+d.value,0);if(c===0)return [];let T=new Map(e.map((g,d)=>[g.id,g.color??r[d%r.length]])),x=[],m=p;for(let g of u){let d=g.value/c*360,f=b/2,w=m+f,h=m+d-f,P=(w+h)/2,k;if(Math.abs(h-w)>=359.9){let N=Qe(a,s,n,w),F=Qe(a,s,n,w+180);k=`M ${N.x.toFixed(3)} ${N.y.toFixed(3)} A ${n} ${n} 0 1 1 ${F.x.toFixed(3)} ${F.y.toFixed(3)} A ${n} ${n} 0 1 1 ${N.x.toFixed(3)} ${N.y.toFixed(3)} Z`;}else if(o>0){let N=Qe(a,s,n,w),F=Qe(a,s,n,h),R=Qe(a,s,o,h),E=Qe(a,s,o,w),A=h-w>180?1:0;k=`M ${N.x.toFixed(3)} ${N.y.toFixed(3)} A ${n} ${n} 0 ${A} 1 ${F.x.toFixed(3)} ${F.y.toFixed(3)} L ${R.x.toFixed(3)} ${R.y.toFixed(3)} A ${o} ${o} 0 ${A} 0 ${E.x.toFixed(3)} ${E.y.toFixed(3)} Z`;}else {let N=Qe(a,s,n,w),F=Qe(a,s,n,h),R=h-w>180?1:0;k=`M ${a.toFixed(3)} ${s.toFixed(3)} L ${N.x.toFixed(3)} ${N.y.toFixed(3)} A ${n} ${n} 0 ${R} 1 ${F.x.toFixed(3)} ${F.y.toFixed(3)} Z`;}x.push({id:g.id,label:g.label,value:g.value,percent:Math.round(g.value/c*1e3)/10,color:T.get(g.id)??"var(--color-chart-1)",startAngle:w,endAngle:h,midAngle:P,path:k,outerR:n,innerR:o,cx:a,cy:s}),m+=d;}return x}function bs(e,t){let r=(e-90)*Math.PI/180;return {dx:Math.cos(r)*t,dy:Math.sin(r)*t}}function Dn({items:e,position:t,onToggle:r}){return jsx("div",{className:mt({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:i("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),jsx("span",{children:n.label}),jsxs("span",{className:"text-secondary-400",children:["(",n.percent,"%)"]})]},n.id))})}function Ha({data:e,donut:t=false,donutThickness:r=.5,startAngle:n=-90,padAngle:o=0,labelType:a="percent",centerLabel:s,centerSubLabel:p,explodeOnHover:b=true,explodeOffset:u=8,title:c,height:T=300,className:x,legend:m=true,legendPosition:g="bottom",animateOnMount:d=true,emptyText:f="No data to display"}){let w=useRef(null),h=useRef(null),[P,k]=useState(400),[N,F]=useState(null),[R,E]=useState(null),[A,H]=useState({}),y=useRef(null);useEffect(()=>{let z=h.current;if(!z)return;let J=z.getBoundingClientRect().width;J>0&&k(J);let B=new ResizeObserver(q=>{let be=q[0]?.contentRect.width;be&&be>0&&k(be);});return B.observe(z),()=>B.disconnect()},[]),useEffect(()=>{function z(B){let q=y.current;if(!q)return;"touches"in B&&B.cancelable&&B.preventDefault();let be="touches"in B?B.touches[0]?.clientX??q.startX:B.clientX,De="touches"in B?B.touches[0]?.clientY??q.startY:B.clientY;H(He=>({...He,[q.id]:{dx:q.origDx+be-q.startX,dy:q.origDy+De-q.startY}}));}function J(){y.current=null;}return window.addEventListener("mousemove",z),window.addEventListener("mouseup",J),window.addEventListener("touchmove",z,{passive:false}),window.addEventListener("touchend",J),()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",J),window.removeEventListener("touchmove",z),window.removeEventListener("touchend",J);}},[]);let O=useMemo(()=>e.map(z=>z.id),[e]),{visible:v,toggle:ne,isVisible:C}=Rt(O),re=useMemo(()=>Mt(e.length),[e.length]),_=10,de=6.4,j=18,pe=14,Y=6,V=P,G=T,me=V/2,W=G/2,l=a!=="none"?j+Y+4:Y+4,D=Math.max(Math.min(me,W)-l,20),X=t?D*r:0,$=useMemo(()=>hs(e,v,re,D,X,me,W,n,o),[e,v,re,D,X,me,W,n,o]),se=useMemo(()=>$.map(z=>z.id).join(","),[$]);useEffect(()=>{H({});},[se]);let ue=useCallback((z,J)=>{if(y.current)return;let B=w.current?.getBoundingClientRect();if(!B)return;F(J);let q=$.find(be=>be.id===J);q&&E({x:z.clientX-B.left+12,y:z.clientY-B.top-10,items:[{label:q.label,value:Pe(q.value),percent:`${q.percent}%`,color:q.color}]});},[$]),Te=useCallback(()=>{F(null),E(null);},[]),S=useCallback((z,J,B)=>{let q=A[z]??{dx:0,dy:0};y.current={id:z,startX:J,startY:B,origDx:q.dx,origDy:q.dy};},[A]),ce=useCallback((z,J)=>{z.preventDefault(),F(J);let B=w.current?.getBoundingClientRect();if(!B)return;let q=z.touches[0];if(!q)return;let be=$.find(De=>De.id===J);be&&E({x:q.clientX-B.left+12,y:q.clientY-B.top-10,items:[{label:be.label,value:Pe(be.value),percent:`${be.percent}%`,color:be.color}]});},[$]),oe=useMemo(()=>{let z=e.reduce((J,B)=>J+B.value,0);return e.map((J,B)=>({id:J.id,label:J.label,color:J.color??re[B],visible:C(J.id),percent:z>0?Math.round(J.value/z*1e3)/10:0}))},[e,re,C]),he=e.length>0&&e.some(z=>z.value>0),fe=g==="left"||g==="right",Re=useMemo(()=>{if(a==="none")return [];let z=_+3,J=Y+_*.5,B=G-Y-_*.5,q=$.filter(K=>K.percent>=3).map(K=>{let xe="";switch(a){case "percent":xe=`${K.percent}%`;break;case "value":xe=Pe(K.value);break;case "label":xe=K.label;break;case "label+percent":xe=`${K.label} ${K.percent}%`;break}let L=Qe(K.cx,K.cy,K.outerR+2,K.midAngle),Z=Qe(K.cx,K.cy,K.outerR+j,K.midAngle),ee=(K.midAngle-90)*Math.PI/180,I=Math.cos(ee)>=0,ge=Math.ceil(xe.length*de);return {id:K.id,color:K.color,text:xe,textW:ge,p1:L,elbowX:Z.x,y:Z.y,isRight:I}}),be=q.filter(K=>K.isRight).sort((K,xe)=>K.y-xe.y),De=q.filter(K=>!K.isRight).sort((K,xe)=>K.y-xe.y);function He(K){if(K.length!==0)for(let xe=0;xe<20;xe++){let L=false;for(let ee=1;ee<K.length;ee++){let I=K[ee].y-K[ee-1].y;if(I<z){let ge=(z-I)/2;K[ee-1].y-=ge,K[ee].y+=ge,L=true;}}K[0].y<J&&(K[0].y=J);for(let ee=1;ee<K.length;ee++)K[ee].y<K[ee-1].y+z&&(K[ee].y=K[ee-1].y+z);let Z=K.length-1;K[Z].y>B&&(K[Z].y=B);for(let ee=Z-1;ee>=0;ee--)K[ee].y>K[ee+1].y-z&&(K[ee].y=K[ee+1].y-z);for(let ee of K)ee.y=Math.max(J,Math.min(B,ee.y));if(!L)break}}return He(be),He(De),[...De,...be]},[$,a,G]),ye=jsxs("svg",{role:"img","aria-label":c??"Pie chart",width:V,height:G,viewBox:`0 0 ${V} ${G}`,shapeRendering:"geometricPrecision",children:[jsxs("g",{className:d?"chart-pie-animate":"",children:[$.map((z,J)=>{let B=N===z.id,q=b&&B,be=bs(z.midAngle,q?u:0);return jsx("path",{d:z.path,fill:z.color,transform:q?`translate(${be.dx}, ${be.dy})`:void 0,className:i("chart-slice",d&&`chart-slice-animate-${Math.min(J,7)}`,B&&"chart-slice--exploded"),stroke:z.color,strokeWidth:.6,onMouseMove:De=>ue(De,z.id),onMouseLeave:Te,onTouchStart:De=>ce(De,z.id),onTouchEnd:Te,"aria-label":`${z.label}: ${z.percent}%`},z.id)}),Re.map(z=>{let J=A[z.id]??{dx:0,dy:0},B=z.elbowX+J.dx,q=z.y+J.dy,be=B+(z.isRight?pe:-pe),De=z.isRight?be+3:be-3,He=pe+3+z.textW+6,K=z.isRight?B:B-He,xe=q-_-2,L=_*2+4;return jsxs("g",{style:{userSelect:"none"},children:[jsx("polyline",{points:[`${z.p1.x.toFixed(2)},${z.p1.y.toFixed(2)}`,`${B.toFixed(2)},${q.toFixed(2)}`,`${be.toFixed(2)},${q.toFixed(2)}`].join(" "),fill:"none",stroke:z.color,strokeWidth:1.2,opacity:.85,strokeLinejoin:"round",strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("text",{x:De.toFixed(2),y:q.toFixed(2),textAnchor:z.isRight?"start":"end",dominantBaseline:"middle",fontSize:_,fill:"currentColor",className:"text-primary-700 dark:text-primary-300",style:{pointerEvents:"none"},children:z.text}),jsx("rect",{x:K,y:xe,width:He,height:L,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseDown:Z=>{Z.stopPropagation(),S(z.id,Z.clientX,Z.clientY);},onTouchStart:Z=>{Z.stopPropagation();let ee=Z.touches[0];ee&&S(z.id,ee.clientX,ee.clientY);}})]},`label-${z.id}`)})]}),t&&jsx("g",{style:{pointerEvents:"none"},children:N&&$.find(z=>z.id===N)?jsxs(Fragment,{children:[jsxs("text",{x:me,y:W-8,textAnchor:"middle",dominantBaseline:"middle",fontSize:18,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:[$.find(z=>z.id===N)?.percent,"%"]}),jsx("text",{x:me,y:W+12,textAnchor:"middle",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:$.find(z=>z.id===N)?.label})]}):jsxs(Fragment,{children:[s&&jsx("text",{x:me,y:W-(p?8:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:16,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:s}),p&&jsx("text",{x:me,y:W+14,textAnchor:"middle",dominantBaseline:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:p})]})})]});return jsxs("div",{ref:w,className:i(dt(),x),children:[c&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&g==="top"&&jsx(Dn,{items:oe,position:"top",onToggle:ne}),jsxs("div",{className:i("flex items-start justify-center",fe&&"gap-0"),children:[m&&g==="left"&&jsx(Dn,{items:oe,position:"left",onToggle:ne}),jsx("div",{ref:h,className:"flex-1 min-w-0 overflow-hidden",children:he?ye:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:T},children:f})}),m&&g==="right"&&jsx(Dn,{items:oe,position:"right",onToggle:ne})]}),m&&g==="bottom"&&jsx(Dn,{items:oe,position:"bottom",onToggle:ne}),R&&jsx("div",{className:pt(),style:{left:R.x,top:R.y},role:"tooltip",children:R.items.map((z,J)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:z.color}}),jsxs("span",{className:"font-medium",children:[z.label,":"]}),jsx("span",{children:z.value}),jsxs("span",{className:"text-primary-300",children:["(",z.percent,")"]})]},J))})]})}function ys(e,t,r){let n=1/0,o=-1/0;for(let p of e)if(t.has(p.id))for(let b of p.data){let u=Number(b.x);u<n&&(n=u),u>o&&(o=u);}if(!isFinite(n))return [0,1];let[a,s]=St(n,o);return [r?.min??a,r?.max??s]}function vs(e,t,r){let n=1/0,o=-1/0;for(let p of e)if(t.has(p.id))for(let b of p.data)b.y<n&&(n=b.y),b.y>o&&(o=b.y);if(!isFinite(n))return [0,1];let[a,s]=St(n,o);return [r?.min??a,r?.max??s]}function Fa(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:s=>o+(s-r)/(n-r)*(a-o)}function Aa(e,t=5){return pr(e[0],e[1],t)}function ws(e,t,r){let n=1.618033988749895,o=e*137+t,a=o*n%1*2-1,s=o*n*n%1*2-1;return [a*r,s*r]}function ks(e,t,r=12){if(e.length<2)return null;let n=Math.min(...e),o=Math.max(...e),a=Math.min(...t),s=Math.max(...t);return {cx:(n+o)/2,cy:(a+s)/2,rx:(o-n)/2+r,ry:(s-a)/2+r}}function In({items:e,position:t,onToggle:r}){return jsx("div",{className:mt({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:i("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),n.label]},n.id))})}function za({series:e,xAxis:t,yAxis:r,dotRadius:n=5,dotOpacity:o=.75,clusters:a=false,jitter:s=false,jitterAmount:p=12,linkedLines:b=false,title:u,height:c=300,className:T,legend:x=true,legendPosition:m="bottom",animateOnMount:g=true,emptyText:d="No data to display"}){let f=useRef(null),w=useRef(null),[h,P]=useState(600),[k,N]=useState(null);useEffect(()=>{let l=w.current;if(!l)return;let D=l.getBoundingClientRect().width;D>0&&P(D);let X=new ResizeObserver($=>{let se=$[0]?.contentRect.width;se&&se>0&&P(se);});return X.observe(l),()=>X.disconnect()},[]);let F=useMemo(()=>e.map(l=>l.id),[e]),{visible:R,toggle:E,isVisible:A}=Rt(F),H=useMemo(()=>Mt(e.length),[e.length]),y=useMemo(()=>new Map(e.map((l,D)=>[l.id,l.color??H[D]])),[e,H]),O=useMemo(()=>Lt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),v=useMemo(()=>Et(h,c,O),[h,c,O]),ne=useMemo(()=>ys(e,R,t),[e,R,t]),C=useMemo(()=>vs(e,R,r),[e,R,r]),re=useMemo(()=>Fa(ne,[v.plotLeft,v.plotRight]),[ne,v]),_=useMemo(()=>Fa(C,[v.plotBottom,v.plotTop]),[C,v]),de=useMemo(()=>Aa(ne,t?.tickCount??6),[ne,t?.tickCount]),j=useMemo(()=>Aa(C,r?.tickCount??5),[C,r?.tickCount]),pe=useCallback((l,D,X,$,se)=>{let ue=f.current?.getBoundingClientRect();ue&&N({x:l.clientX-ue.left+12,y:l.clientY-ue.top-10,seriesName:D,xVal:Pe(X,t?.format),yVal:Pe($,r?.format),color:se});},[t?.format,r?.format]),Y=useCallback((l,D,X,$,se)=>{l.preventDefault();let ue=f.current?.getBoundingClientRect();if(!ue)return;let Te=l.touches[0];Te&&N({x:Te.clientX-ue.left+12,y:Te.clientY-ue.top-10,seriesName:D,xVal:Pe(X,t?.format),yVal:Pe($,r?.format),color:se});},[t?.format,r?.format]),V=useMemo(()=>e.map((l,D)=>({id:l.id,label:l.name,color:l.color??H[D],visible:A(l.id)})),[e,H,A]),G=e.some(l=>l.data.length>0),me=m==="left"||m==="right",W=jsxs("svg",{role:"img","aria-label":u??"Scatter chart",width:v.width,height:v.height,viewBox:`0 0 ${v.width} ${v.height}`,shapeRendering:"geometricPrecision",children:[j.map(l=>jsx("line",{x1:v.plotLeft,x2:v.plotRight,y1:_(l),y2:_(l),stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},l)),a&&e.map((l,D)=>{if(!A(l.id)||l.data.length<2)return null;let X=y.get(l.id)??"var(--color-chart-1)",$=l.data.map(Te=>re(Number(Te.x))),se=l.data.map(Te=>_(Te.y)),ue=ks($,se,16);return ue?jsx("ellipse",{cx:ue.cx,cy:ue.cy,rx:ue.rx,ry:ue.ry,fill:X,fillOpacity:.06,stroke:X,strokeOpacity:.3,strokeWidth:1.5,strokeDasharray:"5 3",className:g?"chart-cluster-ellipse":"",style:{animationDelay:`${D*.1}s`}},`cluster-${l.id}`):null}),b&&e.map(l=>{if(!A(l.id)||l.data.length<2)return null;let D=y.get(l.id)??"var(--color-chart-1)",$=[...l.data].sort((se,ue)=>Number(se.x)-Number(ue.x)).map(se=>`${re(Number(se.x)).toFixed(2)},${_(se.y).toFixed(2)}`).join(" ");return jsx("polyline",{points:$,fill:"none",stroke:D,strokeWidth:1.5,className:"chart-scatter-link"},`link-${l.id}`)}),e.map((l,D)=>{if(!A(l.id))return null;let X=y.get(l.id)??"var(--color-chart-1)";return jsx("g",{className:"chart-scatter-group",children:l.data.map(($,se)=>{let[ue,Te]=s?ws(D,se,p):[0,0],S=re(Number($.x))+ue,ce=_($.y)+Te;return jsx("circle",{cx:S,cy:ce,r:n,fill:X,fillOpacity:o,stroke:X,strokeWidth:1,strokeOpacity:.5,className:i("chart-scatter-dot",g&&"chart-scatter-dot--animate"),style:{color:X},onMouseMove:oe=>pe(oe,l.name,$.x,$.y,X),onMouseLeave:()=>N(null),onTouchStart:oe=>Y(oe,l.name,$.x,$.y,X),onTouchEnd:()=>N(null)},se)})},l.id)}),jsx("line",{x1:v.plotLeft,x2:v.plotLeft,y1:v.plotTop,y2:v.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("line",{x1:v.plotLeft,x2:v.plotRight,y1:v.plotBottom,y2:v.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),j.map(l=>{let D=_(l);return jsxs("g",{children:[jsx("line",{x1:v.plotLeft-4,x2:v.plotLeft,y1:D,y2:D,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:v.plotLeft-6,y:D,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(l,r?.format)})]},l)}),de.map(l=>{let D=re(l);return jsxs("g",{children:[jsx("line",{x1:D,x2:D,y1:v.plotBottom,y2:v.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:D,y:v.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(l,t?.format)})]},l)}),r?.label&&jsx("text",{x:-(v.plotTop+v.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsx("text",{x:v.plotLeft+v.plotWidth/2,y:v.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxs("div",{ref:f,className:i(dt(),T),children:[u&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),x&&m==="top"&&jsx(In,{items:V,position:"top",onToggle:E}),jsxs("div",{className:i("flex items-start",me&&"gap-0"),children:[x&&m==="left"&&jsx(In,{items:V,position:"left",onToggle:E}),jsx("div",{ref:w,className:"flex-1 min-w-0 overflow-hidden",children:G?W:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:d})}),x&&m==="right"&&jsx(In,{items:V,position:"right",onToggle:E})]}),x&&m==="bottom"&&jsx(In,{items:V,position:"bottom",onToggle:E}),k&&jsxs("div",{className:pt(),style:{left:k.x,top:k.y},role:"tooltip",children:[jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[jsx("span",{className:"h-2 w-2 rounded-full",style:{background:k.color}}),jsx("span",{className:"font-medium",children:k.seriesName})]}),jsxs("div",{className:"text-primary-300",children:["X: ",jsx("span",{className:"font-medium text-primary-50",children:k.xVal})," ","Y: ",jsx("span",{className:"font-medium text-primary-50",children:k.yVal})]})]})]})}var Ep={LineChart:Pa,BarChart:Va,PieChart:Ha,ScatterChart:za},Ba=Ep;var Pp={Primitives:no,Layout:lo,DataDisplay:ko,Navigation:So,Disclosure:Vo,Overlay:Oo,Feedback:Qo,Extras:ba,Forms:ka,Chart:Ba},wx=Pp;export{Eo as Accordion,Ac as AccordionContent,Hc as AccordionItem,Fc as AccordionTrigger,Yo as Alert,hd as AlertContent,bd as AlertDescription,gd as AlertIcon,fd as AlertTitle,Gn as Badge,Va as BarChart,Yt as Button,oo as Card,wl as CardContent,vl as CardDescription,kl as CardFooter,xl as CardHeader,yl as CardTitle,Ba as Chart,bo as Chat,eo as Checkbox,ia as CinePlayer,wo as CodeBlock,ko as DataDisplay,Xl as DataTable,Lr as Dialog,ed as DialogClose,Fo as DialogContent,Bo as DialogDescription,_o as DialogFooter,Ao as DialogHeader,zo as DialogTitle,Vo as Disclosure,On as Dropdown,qt as DropdownButton,ba as Extras,Qo as Feedback,pa as FileExplorer,ra as FilmReel,wa as Form,wp as FormItem,kp as FormSection,ka as Forms,Ro as Header,Nl as HorizontalCard,ao as ImageCard,Sl as ImageCardActions,Tl as ImageCardBody,Ml as ImageCardDescription,Rl as ImageCardTitle,Un as Indicator,Zn as Input,qn as Label,lo as Layout,Pa as LineChart,fo as List,Gl as ListItem,ha as Masonry,oa as MiniPlayer,Mo as NavLink,So as Navigation,Oo as Overlay,io as Panel,El as PanelContent,Ll as PanelHeader,Ha as PieChart,no as Primitives,qo as ProgressBar,ro as Radio,to as RadioGroup,za as ScatterChart,To as SideNav,Kl as SortableTable,Jo as Spin,Qn as Switch,Wc as TabContent,$c as TabList,Kc as TabPanels,Oc as TabTrigger,kr as Table,po as TableBody,Ht as TableCell,uo as TableEmpty,It as TableHead,mo as TableHeader,wr as TableRow,Po as Tabs,Jn as TextBox,$o as Tooltip,go as Tree,tc as TreeItem,Tn as TypewriterText,on as accordionContentVariants,nn as accordionTriggerVariants,an as accordionVariants,Er as alertVariants,Ir as badgeVariants,Xt as buttonVariants,br as cardVariants,dt as chartContainerVariants,mt as chartLegendVariants,pt as chartTooltipVariants,Ar as checkboxVariants,i as cn,yr as codeBlockVariants,wd as configureAlertTopOffset,wx as default,Sr as dialogContentVariants,Hr as indicatorVariants,jt as inputVariants,Fr as labelVariants,Ur as listItemVariants,Gr as listVariants,tn as navLinkVariants,jr as panelVariants,pn as progressBarVariants,zr as radioVariants,rr as spinVariants,Br as switchTrackVariants,sn as tabListVariants,ln as tabTriggerVariants,Yr as tableVariants,mn as tooltipVariants,qr as treeItemVariants,Ld as useAlert,Od as useSpin};
|
|
84
|
+
`}),jsx(ln,{open:re,onOpenChange:B,children:jsxs(Zo,{size:"sm",children:[jsxs(Jo,{children:[jsxs(ei,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(ti,{children:[R.size===1?`Are you sure you want to delete "${ne[Array.from(R)[0]]?.name}"?`:`Are you sure you want to delete ${R.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(ri,{children:[jsx(gr,{intent:"ghost",onClick:()=>B(false),children:"Cancel"}),jsxs(gr,{intent:"danger",onClick:()=>{let D=Array.from(R).map(ce=>ne[ce]).filter(Boolean);p?.(D),V(new Set),E(null),B(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function Ir({label:e,value:t,mono:r}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsx("div",{className:s("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function Bf(e,t){let r=t.getBoundingClientRect(),n=Math.max(r.width,r.height)*1.2,a=e.clientX-r.left,i=e.clientY-r.top,o=document.createElement("span");o.className="masonry-ripple",o.style.width=`${n}px`,o.style.height=`${n}px`,o.style.left=`${a}px`,o.style.top=`${i}px`,t.appendChild(o),o.addEventListener("animationend",()=>o.remove());}function Hi({columns:e,columnWidth:t=240,gap:r=16,items:n,onItemClick:a,className:i,style:o,children:l,...c}){let m=useRef(null),d=useRef([]),[f,p]=useState(()=>e??1),[u,h]=useState([]),[g,b]=useState(0),N=n?n.map((R,V)=>({key:R.key??V,node:R.content})):qr.Children.toArray(l).map((R,V)=>({key:R.key??V,node:R})),x=N.length,T=useCallback(R=>e??Math.max(1,Math.floor((R+r)/(t+r))),[e,t,r]),w=useCallback(()=>{let R=m.current;if(!R)return;let V=R.clientWidth,I=T(V);p(I);let E=(V-(I-1)*r)/I,v=new Array(I).fill(0),U=[];for(let q=0;q<x;q++){let M=d.current[q],W=M?M.offsetHeight:0,$=0;for(let ue=1;ue<I;ue++)v[ue]<v[$]&&($=ue);U.push({top:v[$],left:$*(E+r),width:E}),v[$]+=W+r;}let k=Math.max(0,...v)-(x?r:0);h(U),b(k);},[x,T,r]);useEffect(()=>{let R=m.current;if(!R)return;let V=new ResizeObserver(()=>w());return V.observe(R),()=>V.disconnect()},[w]),useEffect(()=>{let R=requestAnimationFrame(w);return ()=>cancelAnimationFrame(R)},[w]),useEffect(()=>{let R=new ResizeObserver(()=>w());return d.current.forEach(V=>{V&&R.observe(V);}),()=>R.disconnect()},[x,f,w]);let C=useCallback((R,V)=>{let I=R.currentTarget;Bf(R,I),a?.(n?.[V],V);},[a,n]),S=R=>{if(!n)return false;let V=n[R];return !!(V.title||V.description||V.actions)};return jsx("div",{ref:m,className:s("relative",i),style:{...o,height:g},...c,children:N.map((R,V)=>jsxs("div",{ref:I=>{d.current[V]=I;},className:"masonry-item",role:"button",tabIndex:0,onClick:I=>C(I,V),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),a?.(n?.[V],V));},style:{position:"absolute",top:u[V]?.top??0,left:u[V]?.left??0,width:u[V]?.width??"100%"},children:[R.node,S(V)&&jsxs("div",{className:"masonry-item-overlay",children:[n[V].title&&jsx("p",{className:"masonry-item-overlay-title",children:n[V].title}),n[V].description&&jsx("p",{className:"masonry-item-overlay-desc",children:n[V].description}),n[V].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:n[V].actions})]})]},R.key))})}function La({text:e="",mode:t="typewriter",speed:r=40,cursor:n=true,cursorChar:a="\u258B",thinking:i=false,streaming:o=false,delay:l=0,onComplete:c,as:m="span",className:d}){let[f,p]=useState(t==="instant"?e:""),[u,h]=useState(false),[g,b]=useState(t==="instant"),[N,x]=useState(false),T=useRef(0),w=useRef(c);w.current=c;let C=useRef(e);C.current=e,useEffect(()=>{if(t!=="typewriter")return;if(p(""),b(false),x(false),h(false),!e){b(true);return}let E=Math.max(10,1e3/r),v=0,U,k=()=>{h(true),U=setInterval(()=>{let M=C.current;v++,p(M.slice(0,v)),v>=M.length&&(clearInterval(U),h(false),b(true),w.current?.());},E);},q;return l>0?q=setTimeout(k,l):k(),()=>{clearTimeout(q),clearInterval(U);}},[e,t]),useEffect(()=>{if(t!=="stream")return;if(e.length===0){T.current=0,p(""),h(false),b(false),x(false);return}if(e.length<=T.current)return;let E=Math.max(10,1e3/r),v=T.current;h(true),b(false),x(false);let U=setInterval(()=>{v++,T.current=v,p(C.current.slice(0,v)),v>=C.current.length&&(clearInterval(U),h(false),w.current?.());},E);return ()=>clearInterval(U)},[e,t]),useEffect(()=>{t==="instant"&&(p(e),h(false),b(true));},[e,t]);let S=useRef(o);useEffect(()=>{let E=S.current;if(S.current=o,E&&!o&&!u&&t==="stream"){x(true);let v=setTimeout(()=>{x(false),b(true);},650);return ()=>clearTimeout(v)}},[o,u,t]);let R=n&&(i||u||N||t==="stream"&&o&&!g||t==="typewriter"&&!g),V=i?"tw-cursor--blink":u?"tw-cursor--solid":N?"tw-cursor--out":"tw-cursor--blink";return jsxs(m,{className:s(d),children:[i&&!f&&jsx("span",{"aria-hidden":"true",children:"\u200B"}),f,R&&jsx("span",{className:s("tw-cursor",V),"aria-hidden":"true",children:a})]})}function Ea(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function $f(e,t){if(!t)return true;let r=Ea(t);return Ea(e.label).includes(r)||(e.description?Ea(e.description).includes(r):false)||(e.keywords?e.keywords.some(n=>Ea(n).includes(r)):false)}function Yf(e){let t=new Map;for(let r of e){let n=r.group??"";t.has(n)||t.set(n,[]),t.get(n).push(r);}return Array.from(t.entries()).map(([r,n])=>({label:r,items:n}))}function Bl(e,t,r,n){let[a,i]=useState(""),[o,l]=useState(0);useEffect(()=>{t&&(i(""),l(0));},[t]);let c=useMemo(()=>e.filter(p=>!p.disabled&&$f(p,a)),[e,a]),m=useMemo(()=>Yf(c),[c]);useEffect(()=>{l(p=>Math.min(p,Math.max(0,c.length-1)));},[c.length]);let d=useCallback(()=>{let p=c[o];p&&(p.onSelect(),r(false));},[c,o,r]),f=useCallback(p=>{switch(p.key){case "ArrowDown":p.preventDefault(),l(u=>(u+1)%Math.max(1,c.length));break;case "ArrowUp":p.preventDefault(),l(u=>(u-1+Math.max(1,c.length))%Math.max(1,c.length));break;case "Enter":p.preventDefault(),d();break;case "Escape":p.preventDefault(),r(false);break}},[c.length,d,r]);return useEffect(()=>{if(!n)return;function p(u){(u.metaKey||u.ctrlKey)&&u.key==="k"&&(u.preventDefault(),r(!t));}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[n,t,r]),{query:a,setQuery:i,groups:m,filtered:c,activeIndex:o,setActiveIndex:l,handleKeyDown:f}}function Va({open:e,onOpenChange:t,commands:r,placeholder:n="Type a command or search\u2026",hotkey:a=true,maxItems:i=8,className:o}){let l=useRef(null),c=useRef(null),{query:m,setQuery:d,groups:f,filtered:p,activeIndex:u,setActiveIndex:h,handleKeyDown:g}=Bl(r,e,t,a);if(useEffect(()=>{if(e){let N=setTimeout(()=>l.current?.focus(),40);return ()=>clearTimeout(N)}},[e]),useEffect(()=>{c.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[u]),!e)return null;let b=0;return createPortal(jsx("div",{className:"cmd-backdrop fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:()=>t(false),role:"presentation",children:jsxs("div",{className:s("cmd-panel relative flex w-full max-w-lg flex-col overflow-hidden rounded-xl","border border-primary-200 bg-white shadow-2xl","dark:border-primary-700 dark:bg-primary-900",o),onClick:N=>N.stopPropagation(),onKeyDown:g,role:"dialog","aria-label":"Command palette","aria-modal":"true",children:[jsxs("div",{className:"flex items-center gap-3 border-b border-primary-100 px-4 dark:border-primary-700",children:[jsx(Search,{className:"h-4 w-4 shrink-0 text-secondary-400","aria-hidden":"true"}),jsx("input",{ref:l,value:m,onChange:N=>d(N.target.value),placeholder:n,className:"flex-1 bg-transparent py-3.5 text-sm text-primary-900 outline-none placeholder:text-secondary-400 dark:text-primary-50","aria-label":"Search commands","aria-controls":"cmd-results","aria-autocomplete":"list","aria-activedescendant":p[u]?`cmd-item-${p[u].id}`:void 0,spellCheck:false,autoComplete:"off"}),jsx("kbd",{className:"hidden shrink-0 rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-400 dark:border-primary-600 sm:block",children:"esc"})]}),jsx("div",{id:"cmd-results",ref:c,className:"overflow-y-auto py-2",style:{maxHeight:`${i*2.75}rem`},role:"listbox","aria-label":"Commands",children:p.length===0?jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-sm text-secondary-400",children:[jsx(Command,{className:"h-8 w-8 opacity-30"}),jsx("span",{children:"No commands found"})]}):f.map(N=>jsxs("div",{className:"mb-1 last:mb-0",children:[N.label&&jsx("p",{className:"px-4 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-secondary-400 dark:text-secondary-500",children:N.label}),N.items.map(x=>{let T=b++,w=T===u;return jsxs("button",{id:`cmd-item-${x.id}`,"data-active":w,role:"option","aria-selected":w,className:s("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",w?"bg-primary-100 text-primary-900 dark:bg-primary-800 dark:text-primary-50":"text-primary-700 hover:bg-primary-50 dark:text-primary-300 dark:hover:bg-primary-800/50"),onMouseEnter:()=>h(T),onClick:()=>{x.onSelect(),t(false);},children:[x.icon&&jsx("span",{className:s("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",w?"border-primary-300 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-700 dark:text-primary-200":"border-primary-200 bg-primary-50 text-primary-500 dark:border-primary-700 dark:bg-primary-800 dark:text-primary-400"),children:x.icon}),jsxs("span",{className:"min-w-0 flex-1",children:[jsx("span",{className:"block truncate font-medium",children:x.label}),x.description&&jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:x.description})]}),x.shortcut&&jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:x.shortcut.map((C,S)=>jsx("kbd",{className:"rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-500 dark:border-primary-700 dark:text-secondary-400",children:C},S))})]},x.id)})]},N.label||"_default"))}),p.length>0&&jsxs("div",{className:"flex items-center justify-between border-t border-primary-100 px-4 py-2 dark:border-primary-700",children:[jsxs("span",{className:"text-xs text-secondary-400",children:[p.length," result",p.length!==1?"s":""]}),jsxs("span",{className:"flex items-center gap-3 text-xs text-secondary-400",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2191"}),jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2193"}),"Navigate"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u21B5"}),"Select"]})]})]})]})}),document.body)}var Xl={complete:"bg-success-500 border-success-500 text-white dark:bg-success-600 dark:border-success-600",active:"bg-primary-500 border-primary-500 text-white dark:bg-primary-400 dark:border-primary-400",error:"bg-danger-500 border-danger-500 text-white dark:bg-danger-600 dark:border-danger-600",pending:"bg-white border-primary-300 text-secondary-400 dark:bg-primary-800 dark:border-primary-600"},Wl={complete:"shadow-[0_0_0_4px_theme(colors.success.100)] dark:shadow-[0_0_0_4px_theme(colors.success.900/30)]",active:"shadow-[0_0_0_4px_theme(colors.primary.100)] dark:shadow-[0_0_0_4px_theme(colors.primary.800/50)] animate-pulse",error:"shadow-[0_0_0_4px_theme(colors.danger.100)] dark:shadow-[0_0_0_4px_theme(colors.danger.900/30)]",pending:""};function jl({status:e,icon:t}){return t?jsx(Fragment,{children:t}):e==="complete"?jsx(Check,{className:"h-3 w-3"}):e==="error"?jsx(AlertCircle,{className:"h-3 w-3"}):e==="active"?jsx(Dot,{className:"h-4 w-4"}):jsx(Clock,{className:"h-3 w-3"})}function Gl({images:e,title:t}){let r=e.slice(0,4),n=e.length>4?e.length-4:0,a=(i,o,l)=>jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:s("relative block overflow-hidden",l),onClick:c=>c.stopPropagation(),children:[jsx("img",{src:i,alt:`${t} ${o+1}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105"}),o===r.length-1&&n>0&&jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60",children:jsxs("span",{className:"text-sm font-semibold text-white",children:["+",n]})})]},o);return r.length===0?null:r.length===1?jsx("div",{className:"mt-2.5 h-36 overflow-hidden rounded-xl",children:a(r[0],0,"h-full")}):r.length===2?jsx("div",{className:"mt-2.5 grid h-28 grid-cols-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((i,o)=>a(i,o))}):r.length===3?jsxs("div",{className:"mt-2.5 grid h-36 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:[a(r[0],0,"row-span-2"),a(r[1],1),a(r[2],2)]}):jsx("div",{className:"mt-2.5 grid h-44 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((i,o)=>a(i,o))})}function Ul({actions:e}){let t=e.filter(o=>o.variant!=="primary"),r=e.filter(o=>o.variant==="primary"),n="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium text-secondary-500 transition-colors hover:bg-secondary-100/80 hover:text-secondary-700 dark:text-secondary-400 dark:hover:bg-primary-800/60 dark:hover:text-secondary-200",a="inline-flex items-center gap-1.5 rounded-lg border border-primary-200/70 bg-primary-50/80 px-3 py-1 text-xs font-semibold text-primary-700 transition-colors hover:bg-primary-100 dark:border-primary-600/60 dark:bg-primary-800/60 dark:text-primary-300 dark:hover:bg-primary-700/60",i=(o,l,c)=>o.href?jsxs("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:c,onClick:m=>m.stopPropagation(),children:[o.icon,o.label]},l):jsxs("button",{type:"button",onClick:o.onClick,className:c,children:[o.icon,o.label]},l);return jsxs("div",{className:"mt-3 flex items-center gap-1 border-t border-primary-100/50 pt-2.5 dark:border-primary-700/40",children:[t.map((o,l)=>i(o,l,n)),r.length>0&&jsx("span",{className:"flex-1"}),r.map((o,l)=>i(o,l,a))]})}function ql({item:e,isActive:t,animated:r,visible:n,orientation:a}){let i=e.status??"pending",o={complete:"bg-gradient-to-br from-white to-success-50/40 dark:from-primary-900 dark:to-success-900/10",active:"bg-gradient-to-br from-white to-primary-50/60 dark:from-primary-900 dark:to-primary-800/40",error:"bg-gradient-to-br from-white to-danger-50/40 dark:from-primary-900 dark:to-danger-900/10",pending:"bg-white dark:bg-primary-900"}[i],l={complete:"border-success-200/70 dark:border-success-800/50",active:"border-primary-300/80 dark:border-primary-600/70",error:"border-danger-200/70 dark:border-danger-800/50",pending:"border-primary-200/60 dark:border-primary-700/50"}[i],c=t?"shadow-lg shadow-primary-300/30 dark:shadow-primary-500/20":i==="complete"?"shadow-md shadow-success-300/20 dark:shadow-success-400/10":i==="error"?"shadow-md shadow-danger-300/20 dark:shadow-danger-400/10":"shadow-sm shadow-primary-100/50 dark:shadow-black/20",m=i==="complete"?"conic-gradient(from 30deg, transparent 0%, var(--tl-glow-complete-1) 18%, var(--tl-glow-complete-2) 30%, var(--tl-holo-cyan) 44%, transparent 60%)":i==="error"?"conic-gradient(from 150deg, transparent 0%, var(--tl-glow-error-1) 18%, var(--tl-glow-error-2) 32%, var(--tl-glow-error-3) 44%, transparent 58%)":null,d={complete:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",active:"bg-primary-100 text-primary-700 dark:bg-primary-800/60 dark:text-primary-300",error:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",pending:"bg-secondary-100 text-secondary-600 dark:bg-primary-800/50 dark:text-secondary-400"}[i];return jsxs("div",{className:s("relative isolate",r&&"transition-all duration-700",r?n?"opacity-100 translate-y-0":a==="vertical"?"opacity-0 translate-y-6":"opacity-0 translate-x-6":"",a==="horizontal"?"w-56 shrink-0":"flex-1",e.className),children:[!t&&m&&jsx("div",{className:"pointer-events-none absolute animate-[tl-glow-pulse_5s_ease-in-out_infinite]",style:{inset:"-6px",borderRadius:"1.5rem",zIndex:-1,background:m,filter:"blur(14px)",opacity:.22},"aria-hidden":true}),t&&jsxs(Fragment,{children:[jsx("div",{className:"pointer-events-none absolute",style:{inset:"-7px",borderRadius:"1.5rem",zIndex:-1,background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, var(--tl-holo-base) 0%, var(--tl-holo-indigo) 18%, var(--tl-holo-violet) 30%, var(--tl-holo-cyan) 45%, var(--tl-holo-mid) 62%, var(--tl-holo-base) 100%)",filter:"blur(10px)",animation:"tl-breathe 2.8s ease-in-out infinite, tl-holo-spin 9s linear infinite"},"aria-hidden":true}),jsx("div",{className:"pointer-events-none absolute",style:{inset:"-1.5px",borderRadius:"1.0625rem",zIndex:-1,padding:"1.5px",background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, transparent 0deg, var(--tl-holo-indigo) 55deg, var(--tl-holo-violet) 85deg, var(--tl-holo-cyan) 115deg, transparent 175deg, transparent 360deg)",WebkitMask:"linear-gradient(white 0 0) content-box, linear-gradient(white 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude",animation:"tl-holo-spin 5s linear infinite"},"aria-hidden":true})]}),jsx("div",{className:s("relative overflow-hidden rounded-2xl border backdrop-blur-[2px]",t?"border-transparent":s("border",l),o,c),children:e.imagePosition==="left"&&e.image?jsxs("div",{className:"flex min-h-[8rem]",children:[jsx("a",{href:e.image,target:"_blank",rel:"noopener noreferrer",className:"w-28 shrink-0 overflow-hidden",onClick:p=>p.stopPropagation(),"aria-label":e.title,children:jsx("img",{src:e.image,alt:e.title,className:"h-full w-full object-cover transition-transform duration-500 hover:scale-105"})}),jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.date&&jsx("span",{className:s("mb-2 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",d),children:e.date}),jsx("h3",{className:s("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsx(Gl,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsx(Ul,{actions:e.actions})]})]}):jsxs(Fragment,{children:[e.image&&jsx("div",{className:"overflow-hidden",children:jsx("img",{src:e.image,alt:e.title,className:"h-32 w-full object-cover transition-transform duration-500 hover:scale-105"})}),e.svg&&!e.image&&jsx("div",{className:"flex items-center justify-center bg-primary-50/60 p-4 dark:bg-primary-800/40",children:e.svg}),jsxs("div",{className:s("p-4",(e.image||e.svg)&&"pt-3"),children:[e.date&&jsx("span",{className:s("mb-2.5 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",d),children:e.date}),jsx("h3",{className:s("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsx(Gl,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsx(Ul,{actions:e.actions})]})]})})]})}function zi({items:e,orientation:t="vertical",activeIndex:r,animated:n=true,lineStyle:a="solid",className:i}){let o=useRef(null),l=useRef([]),[c,m]=useState(new Set);useEffect(()=>{if(!n){m(new Set(e.map((p,u)=>u)));return}let f=new IntersectionObserver(p=>{m(u=>{let h=new Set(u);return p.forEach(g=>{let b=Number(g.target.dataset.idx);g.isIntersecting&&h.add(b);}),h});},{threshold:.15});return l.current.forEach(p=>p&&f.observe(p)),()=>f.disconnect()},[e,n]),useEffect(()=>{if(r==null)return;let f=l.current[r];f&&f.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[r]);let d=a==="dashed"?"border-dashed":"";return t==="vertical"?jsxs("div",{ref:o,className:s("relative",i),children:[jsx("div",{className:"absolute left-5 top-0 h-full w-px bg-primary-200 dark:bg-primary-700"}),jsx("div",{className:"space-y-6",children:e.map((f,p)=>{let u=f.status??"pending",h=p===r;return jsxs("div",{ref:g=>{l.current[p]=g;},"data-idx":p,className:"relative flex gap-4",children:[jsx("div",{className:"relative z-10 flex shrink-0 flex-col items-center",children:jsx("div",{className:s("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 [&_svg]:shrink-0",Xl[u],h&&Wl[u]),children:jsx(jl,{status:u,icon:f.icon})})}),jsx(ql,{item:f,isActive:h,animated:n,visible:c.has(p),orientation:"vertical"})]},f.id??p)})})]}):jsx("div",{ref:o,className:s("relative overflow-x-auto pb-4",i),children:jsx("div",{className:"flex min-w-max gap-6 px-4",children:e.map((f,p)=>{let u=f.status??"pending",h=p===r,g=p===e.length-1;return jsxs("div",{ref:b=>{l.current[p]=b;},"data-idx":p,className:"relative flex flex-col items-center gap-3",children:[jsxs("div",{className:"flex items-center",children:[jsx("div",{className:s("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 z-10 [&_svg]:shrink-0",Xl[u],h&&Wl[u]),children:jsx(jl,{status:u,icon:f.icon})}),!g&&jsx("div",{className:s("h-px w-28 border-t-2",d,u==="complete"?"border-success-400":"border-primary-200 dark:border-primary-700")})]}),jsx(ql,{item:f,isActive:h,animated:n,visible:c.has(p),orientation:"horizontal"})]},f.id??p)})})})}function xn(e="en-US",t="long"){return Array.from({length:12},(r,n)=>new Intl.DateTimeFormat(e,{month:t}).format(new Date(2e3,n,1)))}function Ql(e="en-US",t="narrow"){let r=new Date(2e3,0,2);return Array.from({length:7},(n,a)=>{let i=new Date(r);return i.setDate(r.getDate()+a),new Intl.DateTimeFormat(e,{weekday:t}).format(i)})}function Zl(e,t=true,r=true){return e==="date"?"YYYY-MM-DD":e==="time"?t?r?"HH:mm:ss":"HH:mm":r?"hh:mm:ss A":"hh:mm A":t?r?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm":r?"YYYY-MM-DD hh:mm:ss A":"YYYY-MM-DD hh:mm A"}function Zf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jl(e,t,r="en-US"){let n=e.getHours(),a=xn(r,"long"),i=xn(r,"short"),o={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MMMM:a[e.getMonth()],MMM:i[e.getMonth()],MM:String(e.getMonth()+1).padStart(2,"0"),M:String(e.getMonth()+1),DD:String(e.getDate()).padStart(2,"0"),D:String(e.getDate()),HH:String(n).padStart(2,"0"),H:String(n),hh:String(n%12||12).padStart(2,"0"),h:String(n%12||12),mm:String(e.getMinutes()).padStart(2,"0"),ss:String(e.getSeconds()).padStart(2,"0"),A:n<12?"AM":"PM",a:n<12?"am":"pm"},l=Object.keys(o).sort((m,d)=>d.length-m.length),c=new RegExp(l.map(Zf).join("|"),"g");return t.replace(c,m=>o[m]??m)}function Ar(e,t){return new Date(e,t+1,0).getDate()}function ec(e,t){let r=new Date(e,t,1).getDay(),n=Ar(e,t),a=Ar(e,t-1),i=[];for(let l=r-1;l>=0;l--)i.push({date:new Date(e,t-1,a-l),thisMonth:false});for(let l=1;l<=n;l++)i.push({date:new Date(e,t,l),thisMonth:true});let o=42-i.length;for(let l=1;l<=o;l++)i.push({date:new Date(e,t+1,l),thisMonth:false});return i}function Hr(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function Bi(e,t){return Hr(e).getTime()===Hr(t).getTime()}function tc(e,t){return Hr(e)<Hr(t)}function rc(e,t){return Hr(e)>Hr(t)}function Ia(e,t,r){return t&&e<t?new Date(t):r&&e>r?new Date(r):e}function nc(e,t,r,n){let a=new Date(e),o=t*(n==="future"?1:-1);switch(r){case "day":a.setDate(a.getDate()+o);break;case "week":a.setDate(a.getDate()+o*7);break;case "month":a.setMonth(a.getMonth()+o);break;case "year":a.setFullYear(a.getFullYear()+o);break}return a}function ac(e,t=200){let r=e-Math.floor(t/2);return Array.from({length:t},(n,a)=>r+a)}function oc(e){let{value:t,defaultValue:r,onChange:n,mode:a="datetime",minDate:i,maxDate:o,use24Hour:l=true,showSeconds:c=true,locale:m="en-US",format:d,onOpen:f,onClose:p}=e,u=t!==void 0,[h,g]=useState(r??null),b=u?t??null:h,[N,x]=useState(false),[T,w]=useState(()=>b??new Date),[C,S]=useState("drum"),[R,V]=useState(()=>(b??new Date).getFullYear()),[I,E]=useState(()=>(b??new Date).getMonth()),[v,U]=useState(1),[k,q]=useState("day"),[M,W]=useState("future"),$=d??Zl(a,l,c),ue=b?Jl(b,$,m):"",J=useCallback(()=>{let y=b??new Date;w(new Date(y)),V(y.getFullYear()),E(y.getMonth()),S("drum"),x(true),f?.();},[b,f]),de=useCallback(()=>{x(false),p?.();},[p]),re=useCallback(()=>{let y=Ia(T,i,o);u||g(y),n?.(y),de();},[T,i,o,u,n,de]),B=useCallback(()=>{u||g(null),n?.(null),de();},[u,n,de]),j=useCallback((y,L)=>{w(G=>{let O=new Date(G);switch(y){case "year":O.setFullYear(L);break;case "month":{O.setMonth(L);let _=Ar(O.getFullYear(),L);O.getDate()>_&&O.setDate(_);break}case "day":O.setDate(L);break;case "hour":O.setHours(L);break;case "minute":O.setMinutes(L);break;case "second":O.setSeconds(L);break}return Ia(O,i,o)});},[i,o]),pe=useCallback(()=>{let y=Ia(nc(new Date,v,k,M),i,o);w(y),V(y.getFullYear()),E(y.getMonth());},[v,k,M,i,o]),ye=useCallback(y=>{let L=I+y,G=R;L<0&&(L=11,G--),L>11&&(L=0,G++),E(L),V(G);},[I,R]);return {isOpen:N,displayValue:ue,workingDate:T,view:C,calYear:R,calMonth:I,offsetAmount:v,offsetUnit:k,offsetDirection:M,mode:a,use24Hour:l,showSeconds:c,locale:m,minDate:i,maxDate:o,openPicker:J,closePicker:de,confirm:re,clear:B,updateField:j,setView:S,setCalYear:V,setCalMonth:E,setOffsetAmount:U,setOffsetUnit:q,setOffsetDirection:W,applyQuickOffset:pe,navigateCalendar:ye}}var wn=40;function lc(e,t,r=true){let n=useRef(t);n.current=t,useEffect(()=>{if(!r)return;function a(i){let o=i.target;e.some(c=>c.current?.contains(o))||n.current();}return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,r]);}function cc(e,t,r){let n=useRef(false),a=useRef(void 0),i=useRef(r);i.current=r;let o=useRef(t);o.current=t;let l=useCallback((m,d="smooth")=>{let f=e.current;if(!f)return;let p=m*wn;Math.abs(f.scrollTop-p)<2&&d!=="instant"||(d==="instant"?f.scrollTop=p:f.scrollTo({top:p,behavior:d}));},[e]),c=useCallback(()=>{e.current&&(n.current=true,clearTimeout(a.current),a.current=setTimeout(()=>{n.current=false;let d=e.current;if(!d)return;let f=Math.round(d.scrollTop/wn),p=Math.max(0,Math.min(o.current-1,f)),u=p*wn;Math.abs(d.scrollTop-u)>1&&d.scrollTo({top:u,behavior:"smooth"}),i.current(p);},120));},[e]);return {scrollToIndex:l,handleScroll:c,isScrollingRef:n}}function dc(e,t,r){useEffect(()=>{if(!r)return;function n(){let i=e.current,o=t.current;if(!i||!o)return;if(window.innerWidth<=640){o.style.top="",o.style.left="";return}let l=i.getBoundingClientRect(),c=window.innerHeight,m=window.innerWidth,d=o.offsetHeight||460,f=o.offsetWidth||340,p=l.bottom+8,u=l.left;p+d>c-16&&(p=Math.max(16,l.top-d-8)),u+f>m-16&&(u=Math.max(16,m-f-16)),u<16&&(u=16),o.style.top=`${Math.round(p)}px`,o.style.left=`${Math.round(u)}px`;}let a=setTimeout(n,0);return window.addEventListener("resize",n),window.addEventListener("scroll",n,true),()=>{clearTimeout(a),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,true);}},[r,e,t]);}function Yt({items:e,selectedValue:t,onSelect:r,label:n}){let a=useRef(null),i=useRef(t),o=useRef(false),{scrollToIndex:l,handleScroll:c}=cc(a,e.length,m=>{let d=e[m];d&&(o.current=true,r(d.value),setTimeout(()=>{o.current=false;},200));});return useEffect(()=>{let m=a.current;if(!m)return;let d=e.findIndex(f=>f.value===t);d>=0&&(m.scrollTop=d*wn);},[]),useEffect(()=>{if(i.current!==t&&(i.current=t,!o.current)){let m=e.findIndex(d=>d.value===t);m>=0&&l(m,"smooth");}},[t,e,l]),jsxs("div",{className:"dtp-column",role:"group","aria-label":n,children:[jsx("div",{className:"dtp-column-highlight","aria-hidden":"true"}),jsx("div",{ref:a,className:"dtp-column-list",onScroll:c,role:"listbox","aria-label":n,children:e.map(m=>jsx("div",{className:s("dtp-item",m.value===t&&"dtp-item--selected"),onClick:()=>{let d=e.findIndex(f=>f.value===m.value);d>=0&&l(d,"smooth"),r(m.value);},role:"option","aria-selected":m.value===t,children:m.label},m.value))}),jsx("div",{className:"dtp-fade-top","aria-hidden":"true"}),jsx("div",{className:"dtp-fade-bottom","aria-hidden":"true"})]})}function ag({year:e,month:t,selectedDate:r,today:n,minDate:a,maxDate:i,locale:o,onSelectDay:l,onPrev:c,onNext:m}){let d=Ql(o,"narrow"),f=xn(o,"long"),p=ec(e,t);return jsxs("div",{className:"dtp-calendar",children:[jsxs("div",{className:"dtp-cal-nav",children:[jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:c,"aria-label":"Previous month",children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsxs("span",{className:"dtp-cal-title",children:[f[t]," ",e]}),jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:m,"aria-label":"Next month",children:jsx(ChevronRight,{className:"h-4 w-4"})})]}),jsx("div",{className:"dtp-cal-weekdays",role:"row",children:d.map((u,h)=>jsx("div",{className:"dtp-cal-weekday",role:"columnheader","aria-label":u,children:u},h))}),jsx("div",{className:"dtp-cal-days",role:"grid",children:p.map(({date:u,thisMonth:h},g)=>{let b=Bi(u,r),N=Bi(u,n),x=a!=null&&tc(u,a)||i!=null&&rc(u,i);return jsx("button",{type:"button",role:"gridcell",className:s("dtp-cal-day",!h&&"dtp-cal-day--other",b&&"dtp-cal-day--selected",N&&!b&&"dtp-cal-day--today",x&&"dtp-cal-day--disabled"),onClick:()=>!x&&l(u),disabled:x,"aria-current":N?"date":void 0,"aria-selected":b,"aria-disabled":x,children:u.getDate()},g)})})]})}function og({amount:e,unit:t,direction:r,onAmountChange:n,onUnitChange:a,onDirectionChange:i,onApply:o,locale:l}){let c=l.startsWith("zh"),m=[{value:"day",label:c?"\u5929":"Day"},{value:"week",label:c?"\u5468":"Week"},{value:"month",label:c?"\u6708":"Month"},{value:"year",label:c?"\u5E74":"Year"}],d=[{value:"future",label:c?"\u4EE5\u540E":"from now"},{value:"past",label:c?"\u4EE5\u524D":"before now"}];return jsxs("div",{className:"dtp-quick-offset","aria-label":c?"\u5FEB\u901F\u504F\u79FB":"Quick offset",children:[jsx("input",{type:"number",className:"dtp-offset-input",value:e,min:1,max:9999,"aria-label":c?"\u504F\u79FB\u6570\u91CF":"Offset amount",onChange:f=>{let p=parseInt(f.target.value,10);!isNaN(p)&&p>=1&&n(p);}}),jsx("select",{className:"dtp-offset-select",value:t,"aria-label":c?"\u504F\u79FB\u5355\u4F4D":"Offset unit",onChange:f=>a(f.target.value),children:m.map(f=>jsx("option",{value:f.value,children:f.label},f.value))}),jsx("select",{className:"dtp-offset-select",value:r,"aria-label":c?"\u504F\u79FB\u65B9\u5411":"Offset direction",onChange:f=>i(f.target.value),children:d.map(f=>jsx("option",{value:f.value,children:f.label},f.value))}),jsx("button",{type:"button",className:"dtp-offset-apply",onClick:o,children:c?"\u5E94\u7528":"Apply"})]})}function Aa({className:e,popupClassName:t,triggerClassName:r,disabled:n=false,placeholder:a,...i}){let{isOpen:o,displayValue:l,workingDate:c,view:m,calYear:d,calMonth:f,offsetAmount:p,offsetUnit:u,offsetDirection:h,mode:g,use24Hour:b,showSeconds:N,locale:x,minDate:T,maxDate:w,openPicker:C,closePicker:S,confirm:R,clear:V,updateField:I,setView:E,setCalYear:v,setCalMonth:U,setOffsetAmount:k,setOffsetUnit:q,setOffsetDirection:M,applyQuickOffset:W,navigateCalendar:$}=oc({...i}),ue=useRef(null),J=useRef(null),de=new Date;lc([ue,J],S,o),dc(ue,J,o);let re=x.startsWith("zh"),B={cancel:re?"\u53D6\u6D88":"Cancel",confirm:re?"\u786E\u5B9A":"Confirm",calendarView:re?"\u65E5\u5386":"Calendar",scrollView:re?"\u6EDA\u8F6E":"Scroll",placeholder:a??(re?"\u9009\u62E9\u65E5\u671F\u65F6\u95F4":"Select date / time")},j=g==="date"||g==="datetime",pe=g==="time"||g==="datetime",ye=ac(c.getFullYear(),200).map(X=>({label:String(X),value:X})),y=xn(x,"short").map((X,fe)=>({label:X,value:fe})),L=Ar(c.getFullYear(),c.getMonth()),G=Array.from({length:L},(X,fe)=>({label:String(fe+1).padStart(2,"0"),value:fe+1})),O=Array.from({length:24},(X,fe)=>({label:String(fe).padStart(2,"0"),value:fe})),_=Array.from({length:12},(X,fe)=>({label:String(fe===0?12:fe).padStart(2,"0"),value:fe})),ee=[{label:"AM",value:0},{label:"PM",value:1}],xe=Array.from({length:60},(X,fe)=>({label:String(fe).padStart(2,"0"),value:fe})),P=c.getHours(),F=P%12,K=P<12?0:1,oe=pe&&!j?Clock:Calendar;return jsxs("div",{className:s("dtp-root",e),children:[jsxs("div",{className:"dtp-trigger-wrap",children:[jsxs("button",{ref:ue,type:"button",className:s("dtp-trigger",l&&"dtp-trigger--has-clear",n&&"dtp-trigger--disabled",r),onClick:()=>!n&&(o?S():C()),disabled:n,"aria-haspopup":"dialog","aria-expanded":o,children:[jsx(oe,{className:"dtp-trigger-icon","aria-hidden":"true"}),jsx("span",{className:s("dtp-trigger-text",!l&&"dtp-trigger-placeholder"),children:l||B.placeholder})]}),l&&jsx("button",{type:"button",className:"dtp-trigger-clear","aria-label":re?"\u6E05\u9664":"Clear value",onClick:()=>!n&&V(),children:jsx(X,{className:"h-3.5 w-3.5"})})]}),o&&createPortal(jsxs("div",{ref:J,className:s("dtp-panel",t),role:"dialog","aria-modal":"true","aria-label":re?"\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668":"Date time picker",children:[jsxs("div",{className:"dtp-panel-header",children:[jsx("span",{className:"dtp-panel-preview",children:l||B.placeholder}),jsx("div",{className:"dtp-panel-actions",children:j&&jsx("button",{type:"button",className:s("dtp-view-btn",m==="calendar"&&"dtp-view-btn--active"),"aria-pressed":m==="calendar",title:m==="calendar"?B.scrollView:B.calendarView,onClick:()=>{m!=="calendar"&&(v(c.getFullYear()),U(c.getMonth())),E(m==="calendar"?"drum":"calendar");},children:jsx(Calendar,{className:"h-4 w-4"})})})]}),jsx("div",{className:"dtp-panel-body",children:m==="drum"?jsxs("div",{className:"dtp-drum",children:[j&&jsxs("div",{className:"dtp-drum-date",children:[jsx(Yt,{label:re?"\u5E74":"Year",items:ye,selectedValue:c.getFullYear(),onSelect:X=>I("year",X)}),jsx(Yt,{label:re?"\u6708":"Month",items:y,selectedValue:c.getMonth(),onSelect:X=>I("month",X)}),jsx(Yt,{label:re?"\u65E5":"Day",items:G,selectedValue:c.getDate(),onSelect:X=>I("day",X)})]}),j&&pe&&jsx("div",{className:"dtp-drum-sep","aria-hidden":"true"}),pe&&jsxs("div",{className:"dtp-drum-time",children:[b?jsx(Yt,{label:re?"\u65F6":"Hour",items:O,selectedValue:P,onSelect:X=>I("hour",X)}):jsxs(Fragment,{children:[jsx(Yt,{label:re?"\u65F6":"Hour",items:_,selectedValue:F,onSelect:X=>{I("hour",K===1?X+12:X);}}),jsx(Yt,{label:"AM/PM",items:ee,selectedValue:K,onSelect:X=>{I("hour",F+(X===1?12:0));}})]}),jsx(Yt,{label:re?"\u5206":"Min",items:xe,selectedValue:c.getMinutes(),onSelect:X=>I("minute",X)}),N&&jsx(Yt,{label:re?"\u79D2":"Sec",items:xe,selectedValue:c.getSeconds(),onSelect:X=>I("second",X)})]})]}):jsx(ag,{year:d,month:f,selectedDate:c,today:de,minDate:T,maxDate:w,locale:x,onSelectDay:X=>{I("year",X.getFullYear()),I("month",X.getMonth()),I("day",X.getDate()),E("drum");},onPrev:()=>$(-1),onNext:()=>$(1)})}),j&&jsx("div",{className:"dtp-panel-offset",children:jsx(og,{amount:p,unit:u,direction:h,onAmountChange:k,onUnitChange:q,onDirectionChange:M,onApply:W,locale:x})}),jsxs("div",{className:"dtp-panel-footer",children:[jsx("button",{type:"button",className:"dtp-btn-cancel",onClick:S,children:B.cancel}),jsx("button",{type:"button",className:"dtp-btn-confirm",onClick:R,children:B.confirm})]})]}),document.body)]})}var sg={FilmReel:ki,MiniPlayer:Ci,CinePlayer:Mi,FileExplorer:Ei,Masonry:Hi,TypewriterText:La,CommandPalette:Va,Timeline:zi,DateTimePicker:Aa},Oi=sg;var uc=cva("w-full",{variants:{intent:{default:"",card:"rounded-(--form-radius) border border-primary-200 bg-white p-6 shadow-sm dark:border-primary-700 dark:bg-primary-900",inset:"rounded-(--form-radius) bg-primary-50 p-6 dark:bg-primary-800/50"},size:{sm:"",md:"",lg:""}},defaultVariants:{intent:"default",size:"md"}});cva("flex w-full",{variants:{layout:{stacked:"flex-col gap-1.5",inline:"flex-row items-start gap-(--form-item-gap-md)"},size:{sm:"",md:"",lg:""}},defaultVariants:{layout:"stacked",size:"md"}});var fc=cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var Ki=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),fg={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},yc={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function Xi({children:e,className:t,intent:r,size:n="md",layout:a="stacked",title:i,description:o,footer:l,onValues:c,onSubmit:m,...d}){let f=fg[n??"md"],[p,u]=useState({}),h=useCallback(g=>{if(g.preventDefault(),m?.(g),c){let b=Object.fromEntries(new FormData(g.currentTarget).entries()),N=c(b,g),x=T=>{if(!T)return;let w={};for(let[C,{result:S,reason:R}]of Object.entries(T))R&&(w[C]={status:S?"success":"error",message:R});u(w);};N instanceof Promise?N.then(x).catch(()=>{}):x(N);}},[m,c]);return jsx(Ki.Provider,{value:{layout:a??"stacked",size:n??"md",labelWidth:f,bulkErrors:p},children:jsxs("form",{className:s(uc({intent:r,size:n}),"flex flex-col",t),onSubmit:h,...d,children:[(i||o)&&jsxs("div",{className:"mb-(--form-header-mb)",children:[i&&jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:i}),o&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:o})]}),jsx("div",{className:s("flex flex-col",yc[n??"md"]),children:e}),l&&jsx("div",{className:"mt-(--form-footer-pt) flex flex-wrap items-center justify-end gap-(--form-footer-gap) border-t border-primary-200 pt-(--form-footer-pt) dark:border-primary-700",children:l})]})})}var gg={error:jsx(AlertCircle,{}),warning:jsx(AlertTriangle,{}),success:jsx(CheckCircle,{}),hint:jsx(Info,{})};function bg({label:e,layout:t,required:r,hint:n,validation:a,name:i,onValidate:o,className:l,children:c}){let m=useContext(Ki),d=useId(),[f,p]=useState(void 0),u=i?m.bulkErrors[i]:void 0,h=a??f??u,b=(t??m.layout)==="inline",N=useCallback(S=>{let R=S!=null&&typeof S=="object"&&"target"in S?S.target.value:S;if(i&&m.bulkErrors[i]&&(m.bulkErrors[i]=void 0),!o){p(void 0);return}let{result:V,reason:I}=o(R);p(I?{status:V?"success":"error",message:I}:void 0);},[o,i,m.bulkErrors]),x=h?`${d}-validation`:n?`${d}-hint`:void 0,T=qr.Children.map(c,(S,R)=>{if(R!==0||!qr.isValidElement(S))return S;let V=S,I={};if(V.props.id||(I.id=d),x&&!V.props["aria-describedby"]&&(I["aria-describedby"]=x),h?.status==="error"&&!V.props["aria-invalid"]&&(I["aria-invalid"]=true),i&&!V.props.name&&(I.name=i),o){let E=V.props.onChange;I.onChange=v=>{E?.(v),N(v);};}return Object.keys(I).length?qr.cloneElement(V,I):S}),w=e!=null&&jsx("label",{htmlFor:d,className:s("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",r&&"after:ml-0.5 after:text-danger-500 after:content-['*']",b&&"pt-1.75"),style:b?{width:m.labelWidth,minWidth:m.labelWidth}:void 0,children:e}),C=a?`${d}-validation`:n?`${d}-hint`:void 0;return jsxs("div",{className:s("flex w-full flex-col gap-1.5",b&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",l),children:[w,jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[T,h&&jsxs("p",{id:`${d}-validation`,className:s(fc({status:h.status})),role:h.status==="error"?"alert":void 0,children:[gg[h.status],jsx("span",{children:h.message})]}),n&&jsx("p",{id:C===`${d}-hint`?C:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:n})]})]})}function hg({title:e,description:t,className:r,children:n}){let{size:a}=useContext(Ki);return jsxs("fieldset",{className:s("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",yc[a],r),children:[(e||t)&&jsxs("legend",{className:"px-1.5 pb-1",children:[e&&jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:e}),t&&jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:t})]}),n]})}var yg={Form:Xi},Wi=yg;var Nt=cva("relative w-full font-sans select-none",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Ct=cva("flex flex-wrap gap-3 items-center justify-center",{variants:{position:{top:"mb-3",bottom:"mt-3",left:"flex-col mr-4",right:"flex-col ml-4"}},defaultVariants:{position:"bottom"}}),Tt=cva("absolute z-50 pointer-events-none px-3 py-2 rounded-lg text-xs shadow-lg border transition-opacity duration-150 bg-primary-900 text-primary-50 border-primary-700 dark:bg-primary-950 dark:border-primary-800");function Kt(e){let[t,r]=useState(()=>new Set(e)),n=useCallback(o=>{r(l=>{let c=new Set(l);return c.has(o)?c.delete(o):c.add(o),c});},[]),a=useCallback(o=>t.has(o),[t]),i=useCallback(()=>{r(new Set(e));},[e]);return {visible:t,toggle:n,isVisible:a,showAll:i}}function Xt(e){let t=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"];return Array.from({length:e},(r,n)=>t[n%t.length])}function Wt(e,t,r=.1){if(e===t)return [e-1,t+1];let a=(t-e)*r;return [Math.floor(e-a),Math.ceil(t+a)]}function Fr(e,t,r){if(r<=1)return [e];let n=(t-e)/(r-1);return Array.from({length:r},(a,i)=>+(e+i*n).toFixed(10))}function Ie(e,t){return t?t(e):typeof e=="number"?Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}K`:Number.isInteger(e)?e.toString():e.toFixed(2):String(e)}function ct(e,t,r,n){let a=(n-90)*Math.PI/180;return {x:e+r*Math.cos(a),y:t+r*Math.sin(a)}}function jt(e,t,r){return {top:20,right:r?65:20,bottom:e?52:36,left:t?65:52}}function Gt(e,t,r){let n=Math.max(e,120);return {width:n,height:t,margins:r,plotLeft:r.left,plotTop:r.top,plotRight:n-r.right,plotBottom:t-r.bottom,plotWidth:Math.max(n-r.left-r.right,10),plotHeight:Math.max(t-r.top-r.bottom,10)}}function xc(e,t){let r=new Set,n=[];for(let a of e)if(t.has(a.id))for(let i of a.data){let o=String(i.x);r.has(o)||(r.add(o),n.push(o));}return n}function Ui(e,t,r){let n=1/0,a=-1/0;for(let l of e)if(t.has(l.id))for(let c of l.data)c.y<n&&(n=c.y),c.y>a&&(a=c.y);if(!isFinite(n))return [0,1];let[i,o]=Wt(n,a);return [r?.min??i,r?.max??o]}function Ha(e,t){let[r,n]=e,[a,i]=t;return n===r?()=>(a+i)/2:o=>a+(o-r)/(n-r)*(i-a)}function Fa(e,t){let r=e.length;if(r===0)return ()=>(t[0]+t[1])/2;let n=(t[1]-t[0])/r;return a=>{let i=e.indexOf(a);return i<0?(t[0]+t[1])/2:t[0]+i*n+n/2}}function vc(e,t,r){return e.map(n=>`${t(n.x).toFixed(2)},${r(n.y).toFixed(2)}`).join(" ")}function qi(e,t,r){if(e.length===0)return "";let n=e.map(o=>({x:t(o.x),y:r(o.y)}));if(n.length===1)return `M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;let a=.5,i=`M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;for(let o=0;o<n.length-1;o++){let l=o===0?{x:2*n[0].x-n[1].x,y:2*n[0].y-n[1].y}:n[o-1],c=n[o],m=n[o+1],d=o+2<n.length?n[o+2]:{x:2*n[n.length-1].x-n[n.length-2].x,y:2*n[n.length-1].y-n[n.length-2].y},f=c.x+(m.x-l.x)*a/3,p=c.y+(m.y-l.y)*a/3,u=m.x-(d.x-c.x)*a/3,h=m.y-(d.y-c.y)*a/3;i+=` C ${f.toFixed(2)} ${p.toFixed(2)}, ${u.toFixed(2)} ${h.toFixed(2)}, ${m.x.toFixed(2)} ${m.y.toFixed(2)}`;}return i}function wc(e,t,r,n,a){if(e.length===0)return "";let i=n?qi(e,t,r):`M ${e.map(c=>`${t(c.x).toFixed(2)},${r(c.y).toFixed(2)}`).join(" L ")}`,o=t(e[e.length-1].x).toFixed(2),l=t(e[0].x).toFixed(2);return `${i} L ${o},${a.toFixed(2)} L ${l},${a.toFixed(2)} Z`}function _a(e,t=5){return Fr(e[0],e[1],t)}function Qi(e,t,r){if(t.length===0)return -1;let n=1/0,a=0;for(let i=0;i<t.length;i++){let o=Math.abs(r(t[i])-e);o<n&&(n=o,a=i);}return a}function Zi(e,t){return e.data.find(r=>String(r.x)===t)?.y}function kc(e){for(let t of e)for(let r of t.data)if(typeof r.x=="string")return true;return false}function za({items:e,position:t,onToggle:r}){return jsx("div",{className:Ct({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:s("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function ts({series:e,xAxis:t,yAxis:r,y2Axis:n,y2Series:a=[],smooth:i=false,showDots:o=true,area:l=false,strokeWidth:c=2,title:m,height:d=300,className:f,legend:p=true,legendPosition:u="bottom",animateOnMount:h=true,emptyText:g="No data to display"}){let b=useRef(null),N=useRef(null),[x,T]=useState(600),[w,C]=useState(null),[S,R]=useState(null);useEffect(()=>{let P=N.current;if(!P)return;let F=P.getBoundingClientRect().width;F>0&&T(F);let K=new ResizeObserver(oe=>{let X=oe[0]?.contentRect.width;X&&X>0&&T(X);});return K.observe(P),()=>K.disconnect()},[]);let V=useMemo(()=>e.map(P=>P.id),[e]),{visible:I,toggle:E,isVisible:v}=Kt(V),U=useMemo(()=>Xt(e.length),[e.length]),k=useMemo(()=>new Map(e.map((P,F)=>[P.id,P.color??U[F]])),[e,U]),q=useMemo(()=>jt(!!t?.label,!!r?.label,!!n),[t?.label,r?.label,n]),M=useMemo(()=>Gt(x,d,q),[x,d,q]),W=useMemo(()=>kc(e),[e]),$=useMemo(()=>W?xc(e,I):[],[e,I,W]),ue=useMemo(()=>{if(W){let X=Fa($,[M.plotLeft,M.plotRight]);return fe=>X(fe)}let P=e.flatMap(X=>X.data.map(fe=>fe.x));if(P.length===0)return ()=>M.plotLeft;let F=Math.min(...P),K=Math.max(...P),oe=Ha([F,K],[M.plotLeft,M.plotRight]);return X=>oe(X)},[e,W,$,M]),J=useMemo(()=>Ui(e,I,r),[e,I,r]),de=useMemo(()=>Ha(J,[M.plotBottom,M.plotTop]),[J,M]),re=useMemo(()=>_a(J,r?.tickCount??5),[J,r?.tickCount]),B=useMemo(()=>{if(!n)return null;let P=e.filter(F=>a.includes(F.id));return Ui(P,I,n)},[n,e,a,I]),j=useMemo(()=>B?Ha(B,[M.plotBottom,M.plotTop]):null,[B,M]),pe=useMemo(()=>B?_a(B,n?.tickCount??5):[],[B,n?.tickCount]),ye=useMemo(()=>{if(W)return $;let P=e.flatMap(oe=>oe.data.map(X=>Number(X.x)));if(P.length===0)return [];let F=Math.min(...P),K=Math.max(...P);return _a([F,K],t?.tickCount??6)},[W,$,e,t?.tickCount]),y=useCallback(P=>{let F=P.currentTarget.closest("svg");if(!F)return;let K=F.getBoundingClientRect(),oe=P.clientX-K.left,X=b.current?.getBoundingClientRect();if(!X)return;let fe="",we=oe;if(W&&$.length>0){let Q=Fa($,[M.plotLeft,M.plotRight]),ke=Qi(oe,$,Q);fe=$[ke]??"",we=Q(fe);}else if(!W){let Q=ye;fe=Ie((oe-M.plotLeft)/M.plotWidth*(Q[Q.length-1]-Q[0])+Q[0],t?.format),we=oe;}let H=e.filter(Q=>v(Q.id)).map(Q=>{a.includes(Q.id)&&j!=null?j:de;let Fe;if(W)Fe=Zi(Q,fe);else {let Z=oe,Ne=1/0,A;for(let ae of Q.data){let se=ue(ae.x),z=Math.abs(se-Z);z<Ne&&(Ne=z,A=ae.y);}Fe=A;}return {name:Q.name,value:Fe!==void 0?Ie(Fe,r?.format):"\u2014",color:k.get(Q.id)??"var(--color-chart-1)"}});we>=M.plotLeft&&we<=M.plotRight&&R(we);let ne=P.clientX-X.left+12,Y=P.clientY-X.top-10;C({x:ne,y:Y,label:fe,items:H});},[W,$,M,e,v,a,j,de,ue,ye,t?.format,r?.format,k]),L=useCallback(()=>{C(null),R(null);},[]),G=useCallback(P=>{P.preventDefault();let F=P.touches[0];if(!F)return;let K=P.currentTarget.closest("svg");if(!K)return;let oe=K.getBoundingClientRect(),X=b.current?.getBoundingClientRect();if(!X)return;let fe=F.clientX-oe.left,we=fe,H="";if(W&&$.length>0){let Y=Fa($,[M.plotLeft,M.plotRight]),Q=Qi(fe,$,Y);H=$[Q]??"",we=Y(H);}we>=M.plotLeft&&we<=M.plotRight&&R(we);let ne=e.filter(Y=>v(Y.id)).map(Y=>({name:Y.name,value:W&&H?Ie(Zi(Y,H)??0,r?.format):"\u2014",color:k.get(Y.id)??"var(--color-chart-1)"}));C({x:F.clientX-X.left+12,y:F.clientY-X.top-10,label:H,items:ne});},[W,$,M,e,v,r?.format,k]),O=useMemo(()=>e.map((P,F)=>({id:P.id,label:P.name,color:P.color??U[F],visible:v(P.id)})),[e,U,v]),_=e.some(P=>P.data.length>0),ee=jsxs("svg",{role:"img","aria-label":m??"Line chart",width:M.width,height:M.height,viewBox:`0 0 ${M.width} ${M.height}`,shapeRendering:"geometricPrecision",children:[r?.gridLines!==false&&re.map(P=>{let F=de(P);return jsx("line",{x1:M.plotLeft,x2:M.plotRight,y1:F,y2:F,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},P)}),l&&e.map(P=>{if(!v(P.id)||P.data.length===0)return null;let K=a.includes(P.id)&&j!=null?j:de,oe=k.get(P.id)??"var(--color-chart-1)",X=wc(P.data,ue,K,i,M.plotBottom);return jsx("path",{d:X,fill:oe,fillOpacity:.15,stroke:"none",className:h?"chart-area-animate":""},`area-${P.id}`)}),e.map(P=>{if(!v(P.id)||P.data.length===0)return null;let K=a.includes(P.id)&&j!=null?j:de,oe=k.get(P.id)??"var(--color-chart-1)";return i?jsx("path",{d:qi(P.data,ue,K),fill:"none",stroke:oe,strokeWidth:c,strokeLinecap:"round",strokeLinejoin:"round",className:h?"chart-line-animate":""},P.id):jsx("polyline",{points:vc(P.data,ue,K),fill:"none",stroke:oe,strokeWidth:c,strokeLinecap:"round",strokeLinejoin:"round",className:h?"chart-line-animate":""},P.id)}),o&&e.map(P=>{if(!v(P.id))return null;let K=a.includes(P.id)&&j!=null?j:de,oe=k.get(P.id)??"var(--color-chart-1)";return P.data.map((X,fe)=>jsx("circle",{cx:ue(X.x),cy:K(X.y),r:3,fill:oe,stroke:"white",strokeWidth:1.5,className:s("chart-dot",h?"chart-dot-animate":"")},`${P.id}-${fe}`))}),S!=null&&jsx("line",{className:"chart-crosshair",x1:S,x2:S,y1:M.plotTop,y2:M.plotBottom,stroke:"currentColor",strokeWidth:1,strokeDasharray:"4 4",opacity:.5,style:{color:"var(--color-secondary-400)"}}),jsx("line",{x1:M.plotLeft,x2:M.plotLeft,y1:M.plotTop,y2:M.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),re.map(P=>{let F=de(P);return jsxs("g",{children:[jsx("line",{x1:M.plotLeft-4,x2:M.plotLeft,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:M.plotLeft-6,y:F,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(P,r?.format)})]},P)}),r?.label&&jsx("text",{x:-(M.plotTop+M.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),n&&j&&jsxs(Fragment,{children:[jsx("line",{x1:M.plotRight,x2:M.plotRight,y1:M.plotTop,y2:M.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),pe.map(P=>{let F=j(P);return jsxs("g",{children:[jsx("line",{x1:M.plotRight,x2:M.plotRight+4,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:M.plotRight+6,y:F,textAnchor:"start",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(P,n?.format)})]},P)}),n?.label&&jsx("text",{x:M.plotTop+M.plotHeight/2,y:-(M.width-14),textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(90)",children:n.label})]}),jsx("line",{x1:M.plotLeft,x2:M.plotRight,y1:M.plotBottom,y2:M.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),(W?$:ye).map((P,F)=>{let K=ue(P);return jsxs("g",{children:[jsx("line",{x1:K,x2:K,y1:M.plotBottom,y2:M.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:K,y:M.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(P,t?.format)})]},F)}),t?.label&&jsx("text",{x:M.plotLeft+M.plotWidth/2,y:M.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label}),jsx("rect",{x:M.plotLeft,y:M.plotTop,width:M.plotWidth,height:M.plotHeight,fill:"transparent",onMouseMove:y,onMouseLeave:L,onTouchStart:G,onTouchMove:G,onTouchEnd:L,style:{cursor:"crosshair"}})]}),xe=u==="left"||u==="right";return jsxs("div",{ref:b,className:s(Nt(),f),children:[m&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:m}),p&&u==="top"&&jsx(za,{items:O,position:"top",onToggle:E}),jsxs("div",{className:s("flex items-start",xe&&"gap-0"),children:[p&&u==="left"&&jsx(za,{items:O,position:"left",onToggle:E}),jsx("div",{ref:N,className:"flex-1 min-w-0 overflow-hidden",children:_?ee:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:d},children:g})}),p&&u==="right"&&jsx(za,{items:O,position:"right",onToggle:E})]}),p&&u==="bottom"&&jsx(za,{items:O,position:"bottom",onToggle:E}),w&&jsxs("div",{className:Tt(),style:{left:w.x,top:w.y},role:"tooltip",children:[w.label&&jsx("div",{className:"mb-1 font-medium text-primary-200",children:w.label}),w.items.map((P,F)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:P.color}}),jsxs("span",{className:"text-primary-300",children:[P.name,":"]}),jsx("span",{className:"font-medium",children:P.value})]},F))]})]})}function Cc(e,t){let r=new Set,n=[];for(let a of e)if(t.has(a.id))for(let i of a.data){let o=String(i.x);r.has(o)||(r.add(o),n.push(o));}return n}function Tc(e,t,r,n){if(r){let a=0;for(let o of e)if(t.has(o.id))for(let l of o.data)l.y>a&&(a=l.y);a===0&&(a=1);let[,i]=Wt(0,a,.05);return [n?.min??0,n?.max??i]}else {let a=new Map;for(let l of e)if(t.has(l.id))for(let c of l.data){let m=String(c.x);a.set(m,(a.get(m)??0)+c.y);}let i=Math.max(0,...a.values()),[,o]=Wt(0,i===0?1:i,.05);return [n?.min??0,n?.max??o]}}function Mc(e,t){let[r,n]=e,[a,i]=t;return n===r?()=>(a+i)/2:o=>a+(o-r)/(n-r)*(i-a)}function Rc(e,t=5){return Fr(e[0],e[1],t)}function Sc(e,t,r,n,a,i,o,l,c,m,d){let f=e.filter(x=>t.has(x.id)),p=r.length,u=f.length;if(p===0||u===0)return [];let h=i/p,g=h*(1-m),b=u>0?g*(1-d)/u:0,N=[];for(let x=0;x<r.length;x++){let T=r[x],w=a+x*h+(h-g)/2;for(let C=0;C<f.length;C++){let S=f[C],R=S.data.find(E=>String(E.x)===T);if(!R)continue;let V=w+C*(b+g*d/u),I=c(R.y);N.push({seriesId:S.id,category:T,x:V,y:I,width:Math.max(b,1),height:Math.max(o-I,0),stackBase:o,value:R.y,color:n.get(S.id)??"var(--color-chart-1)"});}}return N}function Pc(e,t,r,n,a,i,o,l,c,m){let d=e.filter(N=>t.has(N.id)),f=r.length,p=d.length;if(f===0||p===0)return [];let u=o/f,h=u*(1-c),g=p>0?h*(1-m)/p:0,b=[];for(let N=0;N<r.length;N++){let x=r[N],T=i+N*u+(u-h)/2;for(let w=0;w<d.length;w++){let C=d[w],S=C.data.find(I=>String(I.x)===x);if(!S)continue;let R=T+w*(g+h*m/Math.max(p,1)),V=l(S.y);b.push({seriesId:C.id,category:x,x:a,y:R,width:Math.max(V-a,0),height:Math.max(g,1),stackBase:a,value:S.y,color:n.get(C.id)??"var(--color-chart-1)"});}}return b}function Dc(e,t,r,n,a,i,o,l,c){let m=e.filter(h=>t.has(h.id)),d=r.length;if(d===0)return [];let f=o/d*(1-c),p=[],u=new Map;r.forEach(h=>u.set(h,a));for(let h of m)for(let g of r){let b=h.data.find(C=>String(C.x)===g);if(!b)continue;let N=u.get(g)??a,x=Math.max(l(b.y)-a,0),T=r.indexOf(g),w=i+(T+.5)*(o/d);p.push({seriesId:h.id,category:g,x:N,y:w-f/2,width:x,height:Math.max(f,1),stackBase:N,value:b.y,color:n.get(h.id)??"var(--color-chart-1)"}),u.set(g,N+x);}return p}function Lc(e,t,r,n,a,i,o,l,c){let m=e.filter(h=>t.has(h.id)),d=r.length;if(d===0)return [];let f=i/d*(1-c),p=[],u=new Map;r.forEach(h=>u.set(h,o));for(let h of m)for(let g of r){let b=h.data.find(S=>String(S.x)===g);if(!b)continue;let N=u.get(g)??o,x=Math.max(o-l(b.y),0),T=N-x,w=r.indexOf(g),C=a+(w+.5)*(i/d);p.push({seriesId:h.id,category:g,x:C-f/2,y:T,width:Math.max(f,1),height:x,stackBase:N,value:b.y,color:n.get(h.id)??"var(--color-chart-1)"}),u.set(g,T);}return p}function Ba({items:e,position:t,onToggle:r}){return jsx("div",{className:Ct({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:s("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function rs({series:e,xAxis:t,yAxis:r,orientation:n="vertical",grouped:a=true,barRadius:i=4,barPadding:o=.2,groupPadding:l=.3,title:c,height:m=300,className:d,legend:f=true,legendPosition:p="bottom",animateOnMount:u=true,emptyText:h="No data to display"}){let g=useRef(null),b=useRef(null),[N,x]=useState(600),[T,w]=useState(null);useEffect(()=>{let y=b.current;if(!y)return;let L=y.getBoundingClientRect().width;L>0&&x(L);let G=new ResizeObserver(O=>{let _=O[0]?.contentRect.width;_&&_>0&&x(_);});return G.observe(y),()=>G.disconnect()},[]);let C=useMemo(()=>e.map(y=>y.id),[e]),{visible:S,toggle:R,isVisible:V}=Kt(C),I=useMemo(()=>Xt(e.length),[e.length]),E=useMemo(()=>new Map(e.map((y,L)=>[y.id,y.color??I[L]])),[e,I]),v=n==="horizontal",U=useMemo(()=>jt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=useMemo(()=>Gt(N,m,U),[N,m,U]),q=useMemo(()=>Cc(e,S),[e,S]),M=useMemo(()=>Tc(e,S,a,v?t:r),[e,S,a,v,t,r]),W=useMemo(()=>Mc(M,v?[k.plotLeft,k.plotRight]:[k.plotBottom,k.plotTop]),[M,k,v]),$=useMemo(()=>Rc(M,(v?t:r)?.tickCount??5),[M,v,t,r]),ue=useMemo(()=>v?a?Pc(e,S,q,E,k.plotLeft,k.plotTop,k.plotHeight,W,l,o):Dc(e,S,q,E,k.plotLeft,k.plotTop,k.plotHeight,W,l):a?Sc(e,S,q,E,k.plotLeft,k.plotWidth,k.plotBottom,k.plotTop,W,l,o):Lc(e,S,q,E,k.plotLeft,k.plotWidth,k.plotBottom,W,l),[e,S,q,E,k,W,a,v,l,o]),J=q.length>0?k.plotWidth/q.length:1,de=q.length>0?k.plotHeight/q.length:1,re=useCallback((y,L)=>{let G=g.current?.getBoundingClientRect();if(!G)return;let O=e.filter(_=>V(_.id)).map(_=>{let ee=_.data.find(xe=>String(xe.x)===L);return {name:_.name,value:ee?Ie(ee.y,r?.format):"\u2014",color:E.get(_.id)??"var(--color-chart-1)"}});w({x:y.clientX-G.left+12,y:y.clientY-G.top-10,category:L,items:O});},[e,V,E,r?.format]),B=useMemo(()=>e.map((y,L)=>({id:y.id,label:y.name,color:y.color??I[L],visible:V(y.id)})),[e,I,V]),j=e.some(y=>y.data.length>0),pe=p==="left"||p==="right",ye=jsxs("svg",{role:"img","aria-label":c??"Bar chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[$.map(y=>{let L=W(y);return v?jsx("line",{x1:L,x2:L,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},y):jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:L,y2:L,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},y)}),ue.map(y=>{let L=Math.min(i,y.width/2,y.height/2),G=`${y.seriesId}-${y.category}`;return v?jsx("rect",{x:y.x,y:y.y,width:y.width,height:y.height,rx:L,fill:y.color,className:s("chart-bar-h",u&&"chart-bar-animate"),onMouseMove:O=>re(O,y.category),onMouseLeave:()=>w(null)},G):jsx("rect",{x:y.x,y:y.y,width:y.width,height:y.height,rx:L,fill:y.color,className:s("chart-bar-v",u&&"chart-bar-animate"),onMouseMove:O=>re(O,y.category),onMouseLeave:()=>w(null)},G)}),jsx("line",{x1:k.plotLeft,x2:k.plotLeft,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:k.plotBottom,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),!v&&$.map(y=>{let L=W(y);return jsxs("g",{children:[jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:L,y2:L,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:k.plotLeft-6,y:L,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(y,r?.format)})]},y)}),v&&$.map(y=>{let L=W(y);return jsxs("g",{children:[jsx("line",{x1:L,x2:L,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:L,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(y,t?.format)})]},y)}),q.map((y,L)=>{if(v){let O=k.plotTop+(L+.5)*de;return jsx("text",{x:k.plotLeft-6,y:O,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:y},y)}let G=k.plotLeft+(L+.5)*J;return jsx("text",{x:G,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:y},y)}),r?.label&&!v&&jsx("text",{x:-(k.plotTop+k.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsx("text",{x:k.plotLeft+k.plotWidth/2,y:k.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxs("div",{ref:g,className:s(Nt(),d),children:[c&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),f&&p==="top"&&jsx(Ba,{items:B,position:"top",onToggle:R}),jsxs("div",{className:s("flex items-start",pe&&"gap-0"),children:[f&&p==="left"&&jsx(Ba,{items:B,position:"left",onToggle:R}),jsx("div",{ref:b,className:"flex-1 min-w-0 overflow-hidden",children:j?ye:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:m},children:h})}),f&&p==="right"&&jsx(Ba,{items:B,position:"right",onToggle:R})]}),f&&p==="bottom"&&jsx(Ba,{items:B,position:"bottom",onToggle:R}),T&&jsxs("div",{className:Tt(),style:{left:T.x,top:T.y},role:"tooltip",children:[jsx("div",{className:"mb-1 font-medium text-primary-200",children:T.category}),T.items.map((y,L)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:y.color}}),jsxs("span",{className:"text-primary-300",children:[y.name,":"]}),jsx("span",{className:"font-medium",children:y.value})]},L))]})]})}function Ic(e,t,r,n,a,i,o,l,c){let m=e.filter(h=>t.has(h.id)),d=m.reduce((h,g)=>h+g.value,0);if(d===0)return [];let f=new Map(e.map((h,g)=>[h.id,h.color??r[g%r.length]])),p=[],u=l;for(let h of m){let g=h.value/d*360,b=c/2,N=u+b,x=u+g-b,T=(N+x)/2,w;if(Math.abs(x-N)>=359.9){let C=ct(i,o,n,N),S=ct(i,o,n,N+180);w=`M ${C.x.toFixed(3)} ${C.y.toFixed(3)} A ${n} ${n} 0 1 1 ${S.x.toFixed(3)} ${S.y.toFixed(3)} A ${n} ${n} 0 1 1 ${C.x.toFixed(3)} ${C.y.toFixed(3)} Z`;}else if(a>0){let C=ct(i,o,n,N),S=ct(i,o,n,x),R=ct(i,o,a,x),V=ct(i,o,a,N),I=x-N>180?1:0;w=`M ${C.x.toFixed(3)} ${C.y.toFixed(3)} A ${n} ${n} 0 ${I} 1 ${S.x.toFixed(3)} ${S.y.toFixed(3)} L ${R.x.toFixed(3)} ${R.y.toFixed(3)} A ${a} ${a} 0 ${I} 0 ${V.x.toFixed(3)} ${V.y.toFixed(3)} Z`;}else {let C=ct(i,o,n,N),S=ct(i,o,n,x),R=x-N>180?1:0;w=`M ${i.toFixed(3)} ${o.toFixed(3)} L ${C.x.toFixed(3)} ${C.y.toFixed(3)} A ${n} ${n} 0 ${R} 1 ${S.x.toFixed(3)} ${S.y.toFixed(3)} Z`;}p.push({id:h.id,label:h.label,value:h.value,percent:Math.round(h.value/d*1e3)/10,color:f.get(h.id)??"var(--color-chart-1)",startAngle:N,endAngle:x,midAngle:T,path:w,outerR:n,innerR:a,cx:i,cy:o}),u+=g;}return p}function Ac(e,t){let r=(e-90)*Math.PI/180;return {dx:Math.cos(r)*t,dy:Math.sin(r)*t}}function Ya({items:e,position:t,onToggle:r}){return jsx("div",{className:Ct({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:s("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),jsx("span",{children:n.label}),jsxs("span",{className:"text-secondary-400",children:["(",n.percent,"%)"]})]},n.id))})}function os({data:e,donut:t=false,donutThickness:r=.5,startAngle:n=-90,padAngle:a=0,labelType:i="percent",centerLabel:o,centerSubLabel:l,explodeOnHover:c=true,explodeOffset:m=8,title:d,height:f=300,className:p,legend:u=true,legendPosition:h="bottom",animateOnMount:g=true,emptyText:b="No data to display"}){let N=useRef(null),x=useRef(null),[T,w]=useState(400),[C,S]=useState(null),[R,V]=useState(null),[I,E]=useState({}),v=useRef(null);useEffect(()=>{let H=x.current;if(!H)return;let ne=H.getBoundingClientRect().width;ne>0&&w(ne);let Y=new ResizeObserver(Q=>{let ke=Q[0]?.contentRect.width;ke&&ke>0&&w(ke);});return Y.observe(H),()=>Y.disconnect()},[]),useEffect(()=>{function H(Y){let Q=v.current;if(!Q)return;"touches"in Y&&Y.cancelable&&Y.preventDefault();let ke="touches"in Y?Y.touches[0]?.clientX??Q.startX:Y.clientX,He="touches"in Y?Y.touches[0]?.clientY??Q.startY:Y.clientY;E(Fe=>({...Fe,[Q.id]:{dx:Q.origDx+ke-Q.startX,dy:Q.origDy+He-Q.startY}}));}function ne(){v.current=null;}return window.addEventListener("mousemove",H),window.addEventListener("mouseup",ne),window.addEventListener("touchmove",H,{passive:false}),window.addEventListener("touchend",ne),()=>{window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",ne),window.removeEventListener("touchmove",H),window.removeEventListener("touchend",ne);}},[]);let U=useMemo(()=>e.map(H=>H.id),[e]),{visible:k,toggle:q,isVisible:M}=Kt(U),W=useMemo(()=>Xt(e.length),[e.length]),$=10,ue=6.4,J=18,de=14,re=6,B=T,j=f,pe=B/2,ye=j/2,y=i!=="none"?J+re+4:re+4,L=Math.max(Math.min(pe,ye)-y,20),G=t?L*r:0,O=useMemo(()=>Ic(e,k,W,L,G,pe,ye,n,a),[e,k,W,L,G,pe,ye,n,a]),_=useMemo(()=>O.map(H=>H.id).join(","),[O]);useEffect(()=>{E({});},[_]);let ee=useCallback((H,ne)=>{if(v.current)return;let Y=N.current?.getBoundingClientRect();if(!Y)return;S(ne);let Q=O.find(ke=>ke.id===ne);Q&&V({x:H.clientX-Y.left+12,y:H.clientY-Y.top-10,items:[{label:Q.label,value:Ie(Q.value),percent:`${Q.percent}%`,color:Q.color}]});},[O]),xe=useCallback(()=>{S(null),V(null);},[]),P=useCallback((H,ne,Y)=>{let Q=I[H]??{dx:0,dy:0};v.current={id:H,startX:ne,startY:Y,origDx:Q.dx,origDy:Q.dy};},[I]),F=useCallback((H,ne)=>{H.preventDefault(),S(ne);let Y=N.current?.getBoundingClientRect();if(!Y)return;let Q=H.touches[0];if(!Q)return;let ke=O.find(He=>He.id===ne);ke&&V({x:Q.clientX-Y.left+12,y:Q.clientY-Y.top-10,items:[{label:ke.label,value:Ie(ke.value),percent:`${ke.percent}%`,color:ke.color}]});},[O]),K=useMemo(()=>{let H=e.reduce((ne,Y)=>ne+Y.value,0);return e.map((ne,Y)=>({id:ne.id,label:ne.label,color:ne.color??W[Y],visible:M(ne.id),percent:H>0?Math.round(ne.value/H*1e3)/10:0}))},[e,W,M]),oe=e.length>0&&e.some(H=>H.value>0),X=h==="left"||h==="right",fe=useMemo(()=>{if(i==="none")return [];let H=$+3,ne=re+$*.5,Y=j-re-$*.5,Q=O.filter(Z=>Z.percent>=3).map(Z=>{let Ne="";switch(i){case "percent":Ne=`${Z.percent}%`;break;case "value":Ne=Ie(Z.value);break;case "label":Ne=Z.label;break;case "label+percent":Ne=`${Z.label} ${Z.percent}%`;break}let A=ct(Z.cx,Z.cy,Z.outerR+2,Z.midAngle),ae=ct(Z.cx,Z.cy,Z.outerR+J,Z.midAngle),se=(Z.midAngle-90)*Math.PI/180,z=Math.cos(se)>=0,ve=Math.ceil(Ne.length*ue);return {id:Z.id,color:Z.color,text:Ne,textW:ve,p1:A,elbowX:ae.x,y:ae.y,isRight:z}}),ke=Q.filter(Z=>Z.isRight).sort((Z,Ne)=>Z.y-Ne.y),He=Q.filter(Z=>!Z.isRight).sort((Z,Ne)=>Z.y-Ne.y);function Fe(Z){if(Z.length!==0)for(let Ne=0;Ne<20;Ne++){let A=false;for(let se=1;se<Z.length;se++){let z=Z[se].y-Z[se-1].y;if(z<H){let ve=(H-z)/2;Z[se-1].y-=ve,Z[se].y+=ve,A=true;}}Z[0].y<ne&&(Z[0].y=ne);for(let se=1;se<Z.length;se++)Z[se].y<Z[se-1].y+H&&(Z[se].y=Z[se-1].y+H);let ae=Z.length-1;Z[ae].y>Y&&(Z[ae].y=Y);for(let se=ae-1;se>=0;se--)Z[se].y>Z[se+1].y-H&&(Z[se].y=Z[se+1].y-H);for(let se of Z)se.y=Math.max(ne,Math.min(Y,se.y));if(!A)break}}return Fe(ke),Fe(He),[...He,...ke]},[O,i,j]),we=jsxs("svg",{role:"img","aria-label":d??"Pie chart",width:B,height:j,viewBox:`0 0 ${B} ${j}`,shapeRendering:"geometricPrecision",children:[jsxs("g",{className:g?"chart-pie-animate":"",children:[O.map((H,ne)=>{let Y=C===H.id,Q=c&&Y,ke=Ac(H.midAngle,Q?m:0);return jsx("path",{d:H.path,fill:H.color,transform:Q?`translate(${ke.dx}, ${ke.dy})`:void 0,className:s("chart-slice",g&&`chart-slice-animate-${Math.min(ne,7)}`,Y&&"chart-slice--exploded"),stroke:H.color,strokeWidth:.6,onMouseMove:He=>ee(He,H.id),onMouseLeave:xe,onTouchStart:He=>F(He,H.id),onTouchEnd:xe,"aria-label":`${H.label}: ${H.percent}%`},H.id)}),fe.map(H=>{let ne=I[H.id]??{dx:0,dy:0},Y=H.elbowX+ne.dx,Q=H.y+ne.dy,ke=Y+(H.isRight?de:-de),He=H.isRight?ke+3:ke-3,Fe=de+3+H.textW+6,Z=H.isRight?Y:Y-Fe,Ne=Q-$-2,A=$*2+4;return jsxs("g",{style:{userSelect:"none"},children:[jsx("polyline",{points:[`${H.p1.x.toFixed(2)},${H.p1.y.toFixed(2)}`,`${Y.toFixed(2)},${Q.toFixed(2)}`,`${ke.toFixed(2)},${Q.toFixed(2)}`].join(" "),fill:"none",stroke:H.color,strokeWidth:1.2,opacity:.85,strokeLinejoin:"round",strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("text",{x:He.toFixed(2),y:Q.toFixed(2),textAnchor:H.isRight?"start":"end",dominantBaseline:"middle",fontSize:$,fill:"currentColor",className:"text-primary-700 dark:text-primary-300",style:{pointerEvents:"none"},children:H.text}),jsx("rect",{x:Z,y:Ne,width:Fe,height:A,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseDown:ae=>{ae.stopPropagation(),P(H.id,ae.clientX,ae.clientY);},onTouchStart:ae=>{ae.stopPropagation();let se=ae.touches[0];se&&P(H.id,se.clientX,se.clientY);}})]},`label-${H.id}`)})]}),t&&jsx("g",{style:{pointerEvents:"none"},children:C&&O.find(H=>H.id===C)?jsxs(Fragment,{children:[jsxs("text",{x:pe,y:ye-8,textAnchor:"middle",dominantBaseline:"middle",fontSize:18,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:[O.find(H=>H.id===C)?.percent,"%"]}),jsx("text",{x:pe,y:ye+12,textAnchor:"middle",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:O.find(H=>H.id===C)?.label})]}):jsxs(Fragment,{children:[o&&jsx("text",{x:pe,y:ye-(l?8:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:16,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:o}),l&&jsx("text",{x:pe,y:ye+14,textAnchor:"middle",dominantBaseline:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:l})]})})]});return jsxs("div",{ref:N,className:s(Nt(),p),children:[d&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:d}),u&&h==="top"&&jsx(Ya,{items:K,position:"top",onToggle:q}),jsxs("div",{className:s("flex items-start justify-center",X&&"gap-0"),children:[u&&h==="left"&&jsx(Ya,{items:K,position:"left",onToggle:q}),jsx("div",{ref:x,className:"flex-1 min-w-0 overflow-hidden",children:oe?we:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:f},children:b})}),u&&h==="right"&&jsx(Ya,{items:K,position:"right",onToggle:q})]}),u&&h==="bottom"&&jsx(Ya,{items:K,position:"bottom",onToggle:q}),R&&jsx("div",{className:Tt(),style:{left:R.x,top:R.y},role:"tooltip",children:R.items.map((H,ne)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:H.color}}),jsxs("span",{className:"font-medium",children:[H.label,":"]}),jsx("span",{children:H.value}),jsxs("span",{className:"text-primary-300",children:["(",H.percent,")"]})]},ne))})]})}function Fc(e,t,r){let n=1/0,a=-1/0;for(let l of e)if(t.has(l.id))for(let c of l.data){let m=Number(c.x);m<n&&(n=m),m>a&&(a=m);}if(!isFinite(n))return [0,1];let[i,o]=Wt(n,a);return [r?.min??i,r?.max??o]}function _c(e,t,r){let n=1/0,a=-1/0;for(let l of e)if(t.has(l.id))for(let c of l.data)c.y<n&&(n=c.y),c.y>a&&(a=c.y);if(!isFinite(n))return [0,1];let[i,o]=Wt(n,a);return [r?.min??i,r?.max??o]}function is(e,t){let[r,n]=e,[a,i]=t;return n===r?()=>(a+i)/2:o=>a+(o-r)/(n-r)*(i-a)}function ss(e,t=5){return Fr(e[0],e[1],t)}function zc(e,t,r){let n=1.618033988749895,a=e*137+t,i=a*n%1*2-1,o=a*n*n%1*2-1;return [i*r,o*r]}function Bc(e,t,r=12){if(e.length<2)return null;let n=Math.min(...e),a=Math.max(...e),i=Math.min(...t),o=Math.max(...t);return {cx:(n+a)/2,cy:(i+o)/2,rx:(a-n)/2+r,ry:(o-i)/2+r}}function Ka({items:e,position:t,onToggle:r}){return jsx("div",{className:Ct({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:s("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),n.label]},n.id))})}function ls({series:e,xAxis:t,yAxis:r,dotRadius:n=5,dotOpacity:a=.75,clusters:i=false,jitter:o=false,jitterAmount:l=12,linkedLines:c=false,title:m,height:d=300,className:f,legend:p=true,legendPosition:u="bottom",animateOnMount:h=true,emptyText:g="No data to display"}){let b=useRef(null),N=useRef(null),[x,T]=useState(600),[w,C]=useState(null);useEffect(()=>{let y=N.current;if(!y)return;let L=y.getBoundingClientRect().width;L>0&&T(L);let G=new ResizeObserver(O=>{let _=O[0]?.contentRect.width;_&&_>0&&T(_);});return G.observe(y),()=>G.disconnect()},[]);let S=useMemo(()=>e.map(y=>y.id),[e]),{visible:R,toggle:V,isVisible:I}=Kt(S),E=useMemo(()=>Xt(e.length),[e.length]),v=useMemo(()=>new Map(e.map((y,L)=>[y.id,y.color??E[L]])),[e,E]),U=useMemo(()=>jt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=useMemo(()=>Gt(x,d,U),[x,d,U]),q=useMemo(()=>Fc(e,R,t),[e,R,t]),M=useMemo(()=>_c(e,R,r),[e,R,r]),W=useMemo(()=>is(q,[k.plotLeft,k.plotRight]),[q,k]),$=useMemo(()=>is(M,[k.plotBottom,k.plotTop]),[M,k]),ue=useMemo(()=>ss(q,t?.tickCount??6),[q,t?.tickCount]),J=useMemo(()=>ss(M,r?.tickCount??5),[M,r?.tickCount]),de=useCallback((y,L,G,O,_)=>{let ee=b.current?.getBoundingClientRect();ee&&C({x:y.clientX-ee.left+12,y:y.clientY-ee.top-10,seriesName:L,xVal:Ie(G,t?.format),yVal:Ie(O,r?.format),color:_});},[t?.format,r?.format]),re=useCallback((y,L,G,O,_)=>{y.preventDefault();let ee=b.current?.getBoundingClientRect();if(!ee)return;let xe=y.touches[0];xe&&C({x:xe.clientX-ee.left+12,y:xe.clientY-ee.top-10,seriesName:L,xVal:Ie(G,t?.format),yVal:Ie(O,r?.format),color:_});},[t?.format,r?.format]),B=useMemo(()=>e.map((y,L)=>({id:y.id,label:y.name,color:y.color??E[L],visible:I(y.id)})),[e,E,I]),j=e.some(y=>y.data.length>0),pe=u==="left"||u==="right",ye=jsxs("svg",{role:"img","aria-label":m??"Scatter chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[J.map(y=>jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:$(y),y2:$(y),stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},y)),i&&e.map((y,L)=>{if(!I(y.id)||y.data.length<2)return null;let G=v.get(y.id)??"var(--color-chart-1)",O=y.data.map(xe=>W(Number(xe.x))),_=y.data.map(xe=>$(xe.y)),ee=Bc(O,_,16);return ee?jsx("ellipse",{cx:ee.cx,cy:ee.cy,rx:ee.rx,ry:ee.ry,fill:G,fillOpacity:.06,stroke:G,strokeOpacity:.3,strokeWidth:1.5,strokeDasharray:"5 3",className:h?"chart-cluster-ellipse":"",style:{animationDelay:`${L*.1}s`}},`cluster-${y.id}`):null}),c&&e.map(y=>{if(!I(y.id)||y.data.length<2)return null;let L=v.get(y.id)??"var(--color-chart-1)",O=[...y.data].sort((_,ee)=>Number(_.x)-Number(ee.x)).map(_=>`${W(Number(_.x)).toFixed(2)},${$(_.y).toFixed(2)}`).join(" ");return jsx("polyline",{points:O,fill:"none",stroke:L,strokeWidth:1.5,className:"chart-scatter-link"},`link-${y.id}`)}),e.map((y,L)=>{if(!I(y.id))return null;let G=v.get(y.id)??"var(--color-chart-1)";return jsx("g",{className:"chart-scatter-group",children:y.data.map((O,_)=>{let[ee,xe]=o?zc(L,_,l):[0,0],P=W(Number(O.x))+ee,F=$(O.y)+xe;return jsx("circle",{cx:P,cy:F,r:n,fill:G,fillOpacity:a,stroke:G,strokeWidth:1,strokeOpacity:.5,className:s("chart-scatter-dot",h&&"chart-scatter-dot--animate"),style:{color:G},onMouseMove:K=>de(K,y.name,O.x,O.y,G),onMouseLeave:()=>C(null),onTouchStart:K=>re(K,y.name,O.x,O.y,G),onTouchEnd:()=>C(null)},_)})},y.id)}),jsx("line",{x1:k.plotLeft,x2:k.plotLeft,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:k.plotBottom,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),J.map(y=>{let L=$(y);return jsxs("g",{children:[jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:L,y2:L,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:k.plotLeft-6,y:L,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(y,r?.format)})]},y)}),ue.map(y=>{let L=W(y);return jsxs("g",{children:[jsx("line",{x1:L,x2:L,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:L,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(y,t?.format)})]},y)}),r?.label&&jsx("text",{x:-(k.plotTop+k.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsx("text",{x:k.plotLeft+k.plotWidth/2,y:k.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxs("div",{ref:b,className:s(Nt(),f),children:[m&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:m}),p&&u==="top"&&jsx(Ka,{items:B,position:"top",onToggle:V}),jsxs("div",{className:s("flex items-start",pe&&"gap-0"),children:[p&&u==="left"&&jsx(Ka,{items:B,position:"left",onToggle:V}),jsx("div",{ref:N,className:"flex-1 min-w-0 overflow-hidden",children:j?ye:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:d},children:g})}),p&&u==="right"&&jsx(Ka,{items:B,position:"right",onToggle:V})]}),p&&u==="bottom"&&jsx(Ka,{items:B,position:"bottom",onToggle:V}),w&&jsxs("div",{className:Tt(),style:{left:w.x,top:w.y},role:"tooltip",children:[jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[jsx("span",{className:"h-2 w-2 rounded-full",style:{background:w.color}}),jsx("span",{className:"font-medium",children:w.seriesName})]}),jsxs("div",{className:"text-primary-300",children:["X: ",jsx("span",{className:"font-medium text-primary-50",children:w.xVal})," ","Y: ",jsx("span",{className:"font-medium text-primary-50",children:w.yVal})]})]})]})}var Tg={LineChart:ts,BarChart:rs,PieChart:os,ScatterChart:ls},cs=Tg;var Mg={Primitives:bo,Layout:wo,DataDisplay:Ho,Navigation:Ko,Disclosure:Go,Overlay:si,Feedback:xi,Extras:Oi,Forms:Wi,Chart:cs},cC=Mg;export{Wo as Accordion,Fp as AccordionContent,Ap as AccordionItem,Hp as AccordionTrigger,mi as Alert,Mu as AlertContent,Ru as AlertDescription,Tu as AlertIcon,Cu as AlertTitle,Fn as Avatar,_n as AvatarGroup,ao as Badge,rs as BarChart,ta as Breadcrumb,gr as Button,ho as Card,Gd as CardContent,jd as CardDescription,Ud as CardFooter,Xd as CardHeader,Wd as CardTitle,cs as Chart,Po as Chat,po as Checkbox,Mi as CinePlayer,Vo as CodeBlock,Va as CommandPalette,ii as ContextMenu,Ho as DataDisplay,ym as DataTable,Aa as DateTimePicker,ln as Dialog,eu as DialogClose,Zo as DialogContent,ti as DialogDescription,ri as DialogFooter,Jo as DialogHeader,ei as DialogTitle,Go as Disclosure,pa as Drawer,nl as DrawerBody,ol as DrawerClose,al as DrawerFooter,rl as DrawerHeader,Za as Dropdown,hr as DropdownButton,Oi as Extras,xi as Feedback,Ei as FileExplorer,ki as FilmReel,Xi as Form,bg as FormItem,hg as FormSection,Wi as Forms,Bo as Header,qd as HorizontalCard,yo as ImageCard,tm as ImageCardActions,Zd as ImageCardBody,em as ImageCardDescription,Jd as ImageCardTitle,io as Indicator,lo as Input,so as Label,wo as Layout,ts as LineChart,Mo as List,wm as ListItem,Hi as Masonry,Ao as MetricCard,Ci as MiniPlayer,Oo as NavLink,Ko as Navigation,si as Overlay,na as Pagination,xo as Panel,nm as PanelContent,rm as PanelHeader,os as PieChart,bo as Primitives,fi as ProgressBar,fo as Radio,uo as RadioGroup,Yo as RibbonBar,ls as ScatterChart,zo as SideNav,xa as Skeleton,Bn as Slider,On as SliderRange,bm as SortableTable,bi as Spin,Io as Stat,mo as Switch,Kp as TabContent,Op as TabList,Yp as TabPanels,$p as TabTrigger,Ur as Table,Co as TableBody,nr as TableCell,To as TableEmpty,rr as TableHead,No as TableHeader,Gr as TableRow,jo as Tabs,oo as Tag,co as TextBox,zi as Timeline,hn as ToastContext,va as ToastProvider,ni as Tooltip,Ro as Tree,Sm as TreeItem,La as TypewriterText,oa as accordionContentVariants,aa as accordionTriggerVariants,ia as accordionVariants,pn as alertVariants,Br as avatarVariants,Nn as badgeVariants,ur as buttonVariants,Xr as cardVariants,Nt as chartContainerVariants,Ct as chartLegendVariants,Tt as chartTooltipVariants,Mn as checkboxVariants,s as cn,Wr as codeBlockVariants,Lu as configureAlertTopOffset,cC as default,sn as dialogContentVariants,Cn as indicatorVariants,fr as inputVariants,Tn as labelVariants,Xn as listItemVariants,Kn as listVariants,Gn as metricCardVariants,Zn as navLinkVariants,$n as panelVariants,fa as progressBarVariants,Rn as radioVariants,un as skeletonVariants,Or as sliderVariants,Tr as spinVariants,jn as statVariants,Sn as switchTrackVariants,sa as tabListVariants,la as tabTriggerVariants,Yn as tableVariants,Pn as tagVariants,ga as toastVariants,ma as tooltipVariants,Wn as treeItemVariants,zu as useAlert,Zu as useSpin,wa as useToast};
|