@jacshuo/onyx 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Extras/TypewriterText.cjs +2 -2
- package/dist/Extras/TypewriterText.css +1 -1
- package/dist/Extras/TypewriterText.js +2 -2
- package/dist/Extras/index.cjs +10 -10
- package/dist/Extras/index.css +1 -1
- package/dist/Extras/index.js +10 -10
- package/dist/_tsup-dts-rollup.d.cts +6 -0
- package/dist/_tsup-dts-rollup.d.ts +6 -0
- package/dist/index.cjs +11 -11
- package/dist/index.css +1 -1
- package/dist/index.js +11 -11
- package/dist/styles/Extras/TypewriterText.css +78 -2
- package/dist/styles/base.css +0 -3
- package/dist/styles.css +291 -3
- package/package.json +3 -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,jsxs,Fragment}from'react/jsx-runtime';import On,{createContext,forwardRef,useState,useEffect,useRef,useCallback,useImperativeHandle,useId,useMemo,useSyncExternalStore,useContext,useLayoutEffect}from'react';import {Heart,ThumbsDown,Bookmark,Share2,Download,Undo2,Redo2,Save,Bold,Italic,Underline,Strikethrough,Heading1,Heading2,Heading3,Type,AlignLeft,AlignCenter,AlignRight,AlignJustify,List,ListOrdered,Image,Video,Link,Table,Code,Quote,Minus,Palette,Highlighter,Subscript,Superscript,Eraser,Sun,Moon,FileText,EyeOff,Eye,Info,CheckCircle,AlertTriangle,AlertCircle,ChevronUp,ChevronDown,BetweenHorizontalStart,BetweenHorizontalEnd,Trash2,BetweenVerticalStart,BetweenVerticalEnd,TableCellsMerge,TableCellsSplit,Search,X,Replace,Check,Inbox,Plus,Pencil,ArrowUpDown,ArrowUp,ArrowDown,ChevronRight,TrendingDown,TrendingUp,Menu,ChevronsLeft,ChevronLeft,PanelLeft,MoreHorizontal,Home,ChevronsRight,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,CornerRightDown,Folder,Command,Clock,XCircle,CheckCircle2,Bell,FileArchive,Database,FileSpreadsheet,Terminal,FileCode,Music,File,Dot,CircleX,TriangleAlert,CircleCheck}from'lucide-react';import {createPortal}from'react-dom';import {createRoot}from'react-dom/client';import {Marked,marked}from'marked';import {ReactNodeViewRenderer,EditorContent,NodeViewWrapper,useEditor}from'@tiptap/react';import {RemoveMarkStep,Transform,liftTarget,joinPoint,canSplit,ReplaceStep,ReplaceAroundStep,canJoin}from'@tiptap/pm/transform';import {createParagraphNear,deleteSelection,exitCode,joinUp,joinDown,joinBackward,joinForward,joinTextblockBackward,joinTextblockForward,lift,liftEmptyBlock,newlineInCode,selectNodeBackward,selectNodeForward,selectParentNode,selectTextblockEnd,selectTextblockStart,setBlockType,wrapIn}from'@tiptap/pm/commands';import {Plugin,PluginKey,Selection,TextSelection,AllSelection,NodeSelection}from'@tiptap/pm/state';import {Fragment as Fragment$1,Slice,Node,Schema,DOMParser}from'@tiptap/pm/model';import {liftListItem,sinkListItem,wrapInList}from'@tiptap/pm/schema-list';import {DecorationSet,Decoration}from'@tiptap/pm/view';import'@tiptap/pm/keymap';import gk from'@tiptap/starter-kit';import bk from'@tiptap/extension-underline';import yk from'@tiptap/extension-text-align';import {Color}from'@tiptap/extension-color';import xk from'@tiptap/extension-highlight';import wk from'@tiptap/extension-link';import kk from'@tiptap/extension-youtube';import Nk from'@tiptap/extension-placeholder';import Ck from'@tiptap/extension-character-count';import Mk from'@tiptap/extension-typography';import Tk from'@tiptap/extension-subscript';import Sk from'@tiptap/extension-superscript';import {Table as Table$1}from'@tiptap/extension-table';import Rk from'@tiptap/extension-table-row';import Ek from'@tiptap/extension-table-header';import Lk from'@tiptap/extension-table-cell';import ik from'@tiptap/extension-image';function f(...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"}}),So=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"}}),Po=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"}}),Xr=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"}}),Ro=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"}}),Eo=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"}}),Lo=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"}}),Do=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"}}),Pn=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"}}),Ao=cva("inline-flex items-center",{variants:{size:{sm:"gap-0.5 [&_.rating-icon]:h-4 [&_.rating-icon]:w-4",md:"gap-1 [&_.rating-icon]:h-6 [&_.rating-icon]:w-6",lg:"gap-1.5 [&_.rating-icon]:h-8 [&_.rating-icon]:w-8"}},defaultVariants:{size:"md"}}),Io=cva("inline-flex items-center justify-center rounded font-mono font-medium select-none",{variants:{size:{xs:"h-4 min-w-4 px-1 text-[0.6rem]",sm:"h-5 min-w-5 px-1.5 text-xs",md:"h-6 min-w-6 px-2 text-sm",lg:"h-8 min-w-8 px-2.5 text-base"},variant:{default:"border border-secondary-300 bg-secondary-100 text-secondary-700 shadow-[0_2px_0_0_var(--color-secondary-300)] dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:shadow-[0_2px_0_0_var(--color-secondary-600)]",outline:"border border-secondary-400 bg-transparent text-secondary-700 dark:border-secondary-500 dark:text-secondary-300",ghost:"text-secondary-600 dark:text-secondary-400"}},defaultVariants:{size:"sm",variant:"default"}}),Rn=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"}}),zo=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 Vt({intent:e,size:t,className:r,...n}){return jsx("button",{className:f(Ur({intent:e,size:t}),r),...n})}function yi(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let n=yi(r.children,t);if(n)return n}}}function vi(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(...vi(r.children));return t}var Fo=40,om=200,xi=150,ic=120;function _o(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Fo;return {animation:`dropdown-item-out ${xi}ms ease-in both ${a}ms`}}let o=e*Fo;return {animation:`dropdown-item-in ${om}ms ease-out both ${o}ms`}}function sc(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Fo+xi;return {animation:`dropdown-container-out ${ic}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function lc({options:e,onSelect:t,animated:r=true,closing:n=false,depth:o=0}){let[a,i]=useState(null),s=useRef(void 0),l=u=>{s.current&&clearTimeout(s.current),i(u);},c=()=>{s.current=setTimeout(()=>i(null),150);};return useEffect(()=>()=>{s.current&&clearTimeout(s.current);},[]),jsx("div",{className:f("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%"}:{},...sc(e.length,n,r)},role:"listbox",children:e.map((u,p)=>{let m=!!u.children?.length,d=a===u.value;return jsxs("div",{className:"relative",style:_o(p,e.length,n,r),onMouseEnter:()=>l(u.value),onMouseLeave:c,children:[jsxs("div",{role:"option","aria-selected":false,"aria-disabled":u.disabled,className:f("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",u.disabled&&"pointer-events-none opacity-50"),onClick:()=>{u.disabled||m||t(u.value,u);},children:[u.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:u.icon}),jsx("span",{className:"flex-1 truncate",children:u.label??u.value}),m&&jsx(ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),m&&d&&jsx(lc,{options:u.children,onSelect:t,animated:r,depth:o+1})]},u.value)})})}function am({options:e,filter:t,multiple:r,selected:n,canAdd:o,animated:a=true,closing:i=false,onSelect:s,onToggle:l,onAdd:c}){let u=useMemo(()=>vi(e),[e]),p=t.toLowerCase(),m=t?u.filter(h=>(h.label??h.value).toLowerCase().includes(p)||h.value.toLowerCase().includes(p)):u,d=m.length===0&&!o||o?1:0,g=m.length+d;return jsxs("div",{className:f("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:sc(g,i,a),children:[m.map((h,b)=>{let y=r&&n.includes(h.value);return jsxs("div",{role:"option","aria-selected":r?y:false,"aria-disabled":h.disabled,className:f("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",h.disabled&&"pointer-events-none opacity-50"),style:_o(b,g,i,a),onClick:()=>{h.disabled||(r?l(h.value):s(h.value,h));},children:[r&&jsx("span",{className:f("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",y?"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:y&&jsx(Check,{className:"h-3 w-3"})}),h.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:h.icon}),jsx("span",{className:"truncate",children:h.label??h.value})]},h.value)}),m.length===0&&!o&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:_o(0,1,i,a),children:"No matches"}),o&&jsxs("div",{className:f("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:_o(m.length,g,i,a),onClick:c,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 wi(e){let{options:t,placeholder:r="Select\u2026",editable:n=false,onAddItem:o,disabled:a=false,align:i="left",className:s,size:l="md",animated:c=true,name:u,intent:p="default",clearable:m=false,id:d,"aria-describedby":g,"aria-invalid":h}=e,b=e.multiple===true,[y,v]=useState(b?void 0:e.defaultValue),[N,x]=useState(b?e.defaultSelected??[]:[]),w=b?e.selected??N:[],[L,P]=useState(false),[A,D]=useState(false),[S,C]=useState(""),I=useRef(null),k=useRef(null),T=useRef(void 0),R=useCallback(()=>{if(!c||!L){P(false),C("");return}D(true);let le=(Math.max(t.length,1)-1)*Fo+xi+ic+20;T.current=setTimeout(()=>{P(false),D(false),C("");},le);},[c,L,t.length]);useEffect(()=>()=>{T.current&&clearTimeout(T.current);},[]);let O=b?void 0:e.value??y,E=useMemo(()=>O?yi(t,O):void 0,[t,O]);useEffect(()=>{if(!L)return;let G=le=>{I.current&&!I.current.contains(le.target)&&R();};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[L,R]),useEffect(()=>{if(!L)return;let G=le=>{le.key==="Escape"&&R();};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[L,R]);let ne=useCallback((G,le)=>{b||(e.value===void 0&&v(G),e.onChange?.(G,le)),T.current&&clearTimeout(T.current),P(false),D(false),C("");},[b,e]),U=useCallback(G=>{if(!b)return;let le=e.selected??N,ke=le.includes(G)?le.filter(B=>B!==G):[...le,G];e.selected===void 0&&x(ke),e.onSelectionChange?.(ke),e.onChange?.(ke);},[b,N,e]),z=S.toLowerCase(),H=useMemo(()=>!n||!S.trim()?false:!vi(t).some(le=>le.value.toLowerCase()===z||(le.label??le.value).toLowerCase()===z),[n,z,t]),_=useCallback(()=>{let G=S.trim();G&&(o?.(G),C(""));},[S,o]),V=useCallback(G=>{G.stopPropagation(),b?(x([]),e.onSelectionChange?.([]),e.onChange?.([])):(v(void 0),e.onChange?.("",void 0));},[b,e]),oe=useCallback(G=>{G.key==="Enter"&&H&&(G.preventDefault(),_());},[H,_]),be=useCallback(()=>{a||(L?R():(T.current&&clearTimeout(T.current),D(false),P(true),C(""),n&&requestAnimationFrame(()=>k.current?.focus())));},[a,L,R,n]),M;if(b){let G=w.length;G===0?M="":G<=2?M=w.map(le=>yi(t,le)).map(le=>le?le.label??le.value:"").filter(Boolean).join(", "):M=`${G} selected`;}else M=E?E.label??E.value:"";let F=b||n,re=p==="danger"||h===true,W=m&&(b?w.length>0:!!M);return jsxs("div",{ref:I,className:f("relative inline-block min-w-44",s),children:[u&&!b&&jsx("input",{type:"hidden",name:u,value:O??""}),u&&b&&w.map(G=>jsx("input",{type:"hidden",name:`${u}[]`,value:G},G)),d&&!n&&jsx("input",{type:"text",id:d,className:"sr-only",readOnly:true,tabIndex:-1,value:M??"",onChange:()=>{}}),jsxs("div",{className:f(Xr({state:re?"error":"default",size:l}),"flex cursor-pointer items-center gap-1",a&&"pointer-events-none opacity-50"),onClick:be,role:"combobox","aria-expanded":L,"aria-haspopup":"listbox","aria-invalid":re||void 0,"aria-describedby":g,children:[n?jsx("input",{ref:k,id:d,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:L?S:M,placeholder:r,disabled:a,onChange:G=>{C(G.target.value),L||P(true);},onKeyDown:oe,onClick:G=>{G.stopPropagation(),L||P(true);}}):jsx("span",{className:f("flex-1 truncate",!M&&"text-secondary-400 dark:text-secondary-600"),children:M||r}),E?.icon&&!n&&!b&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:E.icon}),b&&w.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:w.length}),W&&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:V,children:jsx(X,{className:"h-3 w-3"})}),jsx(ChevronDown,{className:f("text-primary-400 h-4 w-4 shrink-0 transition-transform",L&&"rotate-180")})]}),L&&jsx("div",{className:f(i==="right"?"right-0":"left-0","absolute w-full"),children:F?jsx(am,{options:t,filter:S,multiple:b,selected:w,canAdd:H,animated:c,closing:A,onSelect:ne,onToggle:U,onAdd:_}):jsx(lc,{options:t,onSelect:ne,animated:c,closing:A})})]})}function cm(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var Bo=40,dm=200,Ti=150,dc=120;function Mi(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Bo;return {animation:`dropdown-item-out ${Ti}ms ease-in both ${a}ms`}}let o=e*Bo;return {animation:`dropdown-item-in ${dm}ms ease-out both ${o}ms`}}function um(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Bo+Ti;return {animation:`dropdown-container-out ${dc}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function qr({label:e,items:t,intent:r,size:n,align:o="left",className:a,disabled:i,editable:s=false,onAddItem:l,multiple:c=false,selected:u=[],onSelectionChange:p,animated:m=true,chevron:d=true,...g}){let[h,b]=useState(false),[y,v]=useState(false),[N,x]=useState(""),w=useRef(null),L=useRef(null),P=useRef(void 0);useEffect(()=>()=>{P.current&&clearTimeout(P.current);},[]);let A=useCallback(()=>{if(!m||!h){b(false),x("");return}v(true);let z=(Math.max(t.length,1)-1)*Bo+Ti+dc+20;P.current=setTimeout(()=>{b(false),v(false),x("");},z);},[m,h,t.length]),D=useCallback(()=>{i||(h?A():(P.current&&clearTimeout(P.current),v(false),b(true),x(""),s&&requestAnimationFrame(()=>L.current?.focus())));},[i,h,A,s]);useEffect(()=>{if(!h)return;let U=z=>{w.current&&!w.current.contains(z.target)&&A();};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[h,A]),useEffect(()=>{if(!h)return;let U=z=>{z.key==="Escape"&&A();};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[h,A]);let S=N.toLowerCase(),C=useMemo(()=>N?t.filter(U=>(typeof U.label=="string"?U.label:U.key??"").toLowerCase().includes(S)):t,[t,S]),I=useMemo(()=>!s||!N.trim()?false:!t.some(U=>(typeof U.label=="string"?U.label:U.key??"").toLowerCase()===S),[s,S,t]),k=useCallback(()=>{let U=N.trim();U&&(l?.(U),x(""));},[N,l]),T=useCallback(U=>{U.key==="Enter"&&I&&(U.preventDefault(),k());},[I,k]),R=useCallback(U=>{let z=u.includes(U)?u.filter(H=>H!==U):[...u,U];p?.(z);},[u,p]),O=c&&u.length>0?jsxs(Fragment,{children:[e," ",jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:u.length})]}):e,E=C.length===0&&!I||I?1:0,ne=C.length+E;return jsxs("div",{ref:w,className:"relative inline-block",children:[jsxs("button",{type:"button",onClick:D,disabled:i,className:f(Ur({intent:r,size:n}),"inline-flex items-center gap-1",a),"aria-haspopup":c?"listbox":"true","aria-expanded":h?"true":"false",...g,children:[O,d&&jsx(ChevronDown,{className:f("h-3.5 w-3.5 transition-transform",h&&"rotate-180")})]}),h&&jsxs("div",{className:f("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:um(ne,y,m),role:c?"listbox":"menu","aria-multiselectable":c||void 0,children:[s&&jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsx("input",{ref:L,type:"text",value:N,onChange:U=>x(U.target.value),onKeyDown:T,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:[C.map((U,z)=>{let H=cm(U,z),_=c&&u.includes(H);return jsxs(On.Fragment,{children:[U.divider&&jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxs("button",{type:"button",role:c?"option":"menuitem","aria-selected":c?_:void 0,disabled:U.disabled,className:f("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",U.disabled&&"pointer-events-none opacity-50"),style:Mi(z,ne,y,m),onClick:()=>{c?R(H):(U.onClick?.(),P.current&&clearTimeout(P.current),b(false),v(false),x(""));},children:[c&&jsx("span",{className:f("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",_?"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:_&&jsx(Check,{className:"h-3 w-3"})}),jsx("span",{className:"flex-1 truncate",children:U.label})]})]},H)}),C.length===0&&!I&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:Mi(0,1,y,m),children:"No matches"}),I&&jsxs("button",{type:"button",className:f("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:Mi(C.length,ne,y,m),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",N.trim(),"\u201D"]})]})]})]})]})}function Si({intent:e,size:t,className:r,...n}){return jsx("span",{className:f(So({intent:e,size:t}),r),...n})}function Pi({intent:e,size:t,variant:r,icon:n,removable:o,onRemove:a,disabled:i,dot:s,className:l,children:c,...u}){return jsxs("span",{className:f(zo({intent:e,size:t,variant:r}),i&&"pointer-events-none opacity-50",l),"aria-disabled":i,...u,children:[s&&jsx("span",{className:f("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}),c&&jsx("span",{children:c}),o&&jsx("button",{type:"button","aria-label":"Remove tag",onClick:p=>{p.stopPropagation(),a?.();},disabled:i,className:f("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 gm={danger:"bg-danger-500",success:"bg-success-500",warning:"bg-warning-500",info:"bg-primary-500",primary:"bg-secondary-500"};function Ri({children:e,show:t=true,content:r,dot:n,intent:o="danger",size:a="md",placement:i="top-right",pulse:s=false,className:l}){let c=n??r==null,u=c?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxs("span",{className:f(Po({intent:o,size:a,dot:c,placement:i}),l),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[s&&jsx("span",{className:f("absolute inset-0 rounded-full animate-ping opacity-60",gm[o??"danger"]),"aria-hidden":"true"}),u]})]})}function _t({intent:e,size:t,className:r,...n}){return jsx("label",{className:f(Ro({intent:e,size:t}),r),...n})}var vm={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"}},xm={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 Ft({state:e="default",inputSize:t="md",className:r,prefix:n,suffix:o,action:a,...i}){if(!n&&!o&&!a)return jsx("input",{className:f(Xr({state:e,size:t}),r),...i});let s=vm[t??"md"],l=xm[e??"default"];return jsxs("div",{className:f("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",s.wrapper,l,r),children:[n&&jsx("span",{className:f("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",s.prefix),children:n}),jsx("input",{className:f("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",s.input,n&&"pl-2"),...i}),o&&jsx("span",{className:f("flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",s.icon),children:o}),a&&jsx("button",{type:"button",onClick:a.onClick,"aria-label":a["aria-label"]??"Action",className:f("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",s.icon),children:a.icon})]})}var Mm={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]"},Tm={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 Sm(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 i=o.trim();i&&(n+=i.split(/\s+/).length),o="";};for(let i of e)r.test(i)?(a(),n+=1):o+=i;return a(),n}function Ei({state:e="default",size:t="md",showWordCount:r=false,maxWords:n,className:o,value:a,defaultValue:i,onChange:s,disabled:l,...c}){let[u,p]=useState(()=>i??""),m=a!==void 0?String(a):u,d=useCallback(b=>{a===void 0&&p(b.target.value),s?.(b);},[a,s]),g=useMemo(()=>Sm(m),[m]),h=n!=null&&g>n;return jsxs("div",{className:f("inline-flex w-full flex-col",o),children:[jsx("textarea",{value:m,onChange:d,disabled:l,className:f("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",Mm[t],Tm[h?"error":e],l&&"pointer-events-none opacity-50"),...c}),(r||n!=null)&&jsx("span",{className:f("mt-1 self-end text-xs",h?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:n!=null?`${g} / ${n} words`:`${g} words`})]})}var Dm={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"}},Am={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function Rr({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:n,uncheckedContent:o,intent:a,size:i,label:s,id:l,className:c,disabled:u,...p}){let m=useId(),d=l??m,g=i??"md",h=a??"primary",b=Dm[g],y=n!=null||o!=null,[v,N]=useState(t),x=e??v,w=useCallback(L=>{let P=L.target.checked;e===void 0&&N(P),r?.(P);},[e,r]);return jsxs("label",{htmlFor:d,className:f("inline-flex cursor-pointer items-center gap-2",u&&"pointer-events-none opacity-50",c),children:[jsx("input",{...p,id:d,type:"checkbox",role:"switch",className:"sr-only",checked:x,disabled:u,onChange:w,"aria-checked":x}),jsxs("span",{className:f("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",y?b.trackH:b.trackFixed,Do({intent:a,size:i,checked:x?"on":"off"})),children:[y?jsxs(Fragment,{children:[jsxs("span",{className:f("pointer-events-none invisible inline-grid",b.icon),children:[jsx("span",{className:f("[grid-area:1/1] whitespace-nowrap",b.pad),children:n}),jsx("span",{className:f("[grid-area:1/1] whitespace-nowrap",b.pad),children:o})]}),jsx("span",{className:f("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",b.contentLeft,b.icon,Am[h],x?"opacity-100":"opacity-0"),children:n}),jsx("span",{className:f("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",x?"opacity-0":"opacity-100"),children:o})]}):null,jsx("span",{className:f("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",b.thumb,b.thumbTop,x?b.thumbOn:b.thumbOff)})]}),s&&jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:s})]})}var _m={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function An({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:n,intent:o,size:a,label:i,id:s,className:l,disabled:c,...u}){let p=useId(),m=s??p,d=a??"md",[g,h]=useState(t),b=e??g,y=useCallback(N=>{let x=N.target.checked;e===void 0&&h(x),n?.(x);},[e,n]),v=b||r;return jsxs("label",{htmlFor:m,className:f("inline-flex cursor-pointer items-center gap-2 select-none",c&&"pointer-events-none opacity-50",l),children:[jsx("input",{...u,id:m,type:"checkbox",className:"sr-only",checked:b,disabled:c,onChange:y}),jsx("span",{className:f(Eo({intent:o,size:a,checked:v?"on":"off"})),children:jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:f("text-white transition-all duration-200",_m[d],v?"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"})})}),i&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:i})]})}var hc=createContext(null);function Li({name:e,value:t,defaultValue:r,onValueChange:n,intent:o,size:a,disabled:i,orientation:s="vertical",className:l,children:c}){let u=useId(),p=e??u,[m,d]=useState(r),g=t??m,h=useCallback(b=>{t===void 0&&d(b),n?.(b);},[t,n]);return jsx(hc.Provider,{value:{name:p,value:g,onChange:h,intent:o,size:a,disabled:i},children:jsx("div",{role:"radiogroup",className:f("flex gap-2",s==="vertical"?"flex-col":"flex-row flex-wrap",l),children:c})})}var Km={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function Di({value:e,intent:t,size:r,label:n,id:o,className:a,disabled:i,...s}){let l=useId(),c=o??l,u=useContext(hc),p=t??u?.intent,m=r??u?.size,d=m??"md",g=i??u?.disabled,h=s.name??u?.name,b=u?u.value===e:void 0,y=useCallback(v=>{v.target.checked&&u?.onChange(e);},[u,e]);return jsxs("label",{htmlFor:c,className:f("inline-flex cursor-pointer items-center gap-2 select-none",g&&"pointer-events-none opacity-50",a),children:[jsx("input",{...s,id:c,type:"radio",name:h,value:e,className:"sr-only",checked:b,disabled:g,onChange:y}),jsx("span",{className:f(Lo({intent:p,size:m,checked:b?"on":"off"})),children:jsx("span",{className:f("rounded-full bg-white transition-all duration-200",Km[d],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 Um(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 Xm={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 Ko({src:e,alt:t,initials:r,size:n,shape:o,status:a,className:i,...s}){let[l,c]=useState(false),u=e&&!l,p=Um(t,r);return jsx("span",{role:"img","aria-label":t??p,className:f(Pn({size:n,shape:o}),a&&Xm[a],"relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden",i),...s,children:u?jsx("img",{src:e,alt:t,className:"h-full w-full object-cover",onError:()=>c(true),draggable:false}):jsx("span",{className:"font-semibold leading-none tracking-wide",children:p})})}function jo({children:e,max:t=4,overlap:r="left",className:n}){let o=On.Children.toArray(e),a=o.slice(0,t),i=o.length-t;return jsxs("span",{className:f("inline-flex items-center",r==="left"?"-space-x-3":"flex-row-reverse -space-x-3",n),children:[a.map((l,c)=>jsx("span",{className:"ring-2 ring-white dark:ring-primary-900 rounded-full",children:l},c)),i>0&&jsxs("span",{"aria-label":`${i} more`,className:f(Pn({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:["+",i]})]})}function lr(e,t,r){return Math.min(Math.max(e,t),r)}function qm(e,t,r){return Math.round((e-t)/r)*r+t}function Ai(e,t,r){return (e-t)/(r-t)*100}function bc(e,t,r,n){let o=t+e/100*(r-t);return qm(o,t,n)}function vc(e,t,r,n,o,a){let i=useRef(false),s=useCallback(p=>{let m=e.current;if(!m)return 0;let d=m.getBoundingClientRect(),h=(("touches"in p?p.touches[0].clientX:p.clientX)-d.left)/d.width*100;return lr(h,0,100)},[e]),l=useCallback(p=>{if(o)return;p.currentTarget.setPointerCapture(p.pointerId),i.current=true;let m=e.current;if(!m)return;let d=m.getBoundingClientRect(),g=(p.clientX-d.left)/d.width*100;a?.(bc(lr(g,0,100),t,r,n));},[o,s,t,r,n,a,e]),c=useCallback(p=>{if(!i.current||o)return;let m=e.current;if(!m)return;let d=m.getBoundingClientRect(),g=(p.clientX-d.left)/d.width*100;a?.(bc(lr(g,0,100),t,r,n));},[o,t,r,n,a,e]),u=useCallback(()=>{i.current=false;},[]);return {startDrag:l,onPointerMove:c,stopDrag:u}}function Yo({mode:e,value:t,defaultValue:r=0,onChange:n,min:o=0,max:a=100,step:i=1,intent:s,size:l,disabled:c,showValue:u=false,formatValue:p=String,label:m,className:d,id:g,...h}){let[b,y]=useState(r),v=t!==void 0,N=v?t:b,x=useId(),w=g??x,L=useRef(null),P=useCallback(k=>{let T=lr(k,o,a);v||y(T),n?.(T);},[v,o,a,n]),{startDrag:A,onPointerMove:D,stopDrag:S}=vc(L,o,a,i,c,P),C=Ai(N,o,a),I=k=>{let T=k.key==="ArrowRight"||k.key==="ArrowUp"?i:k.key==="ArrowLeft"||k.key==="ArrowDown"?-i:k.key==="Home"?-(N-o):k.key==="End"?a-N:0;T!==0&&(k.preventDefault(),P(N+T));};return jsxs("div",{className:f("slider-root flex flex-col gap-1",d),children:[jsx("input",{type:"range",id:w,className:"sr-only",tabIndex:-1,min:o,max:a,step:i,value:N,disabled:c,readOnly:true,onChange:()=>{}}),(m||u)&&jsxs("div",{className:"flex items-center justify-between",children:[m&&jsx("label",{htmlFor:w,className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:m}),u&&jsx("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:p(N)})]}),jsx("div",{...h,ref:L,className:f(Rn({intent:s,size:l}),c&&"opacity-40 cursor-not-allowed"),onPointerDown:A,onPointerMove:D,onPointerUp:S,onPointerCancel:S,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:`${C}%`}}),jsx("div",{role:"slider",tabIndex:c?-1:0,"aria-valuemin":o,"aria-valuemax":a,"aria-valuenow":N,"aria-disabled":c,onKeyDown:I,className:f("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:`${C}%`}})]})})]})}function Uo({value:e,defaultValue:t=[20,80],onChange:r,min:n=0,max:o=100,step:a=1,intent:i,size:s,disabled:l,showValue:c=false,formatValue:u=String,label:p,className:m,id:d,...g}){let[h,b]=useState(t),y=e!==void 0,[v,N]=y?e:h,x=useRef(null),w=useRef("lo"),L=useCallback(R=>{y||b(R),r?.(R);},[y,r]),P=useCallback(R=>{w.current==="lo"?L([lr(R,n,N),N]):L([v,lr(R,v,o)]);},[v,N,n,o,L]),{startDrag:A,onPointerMove:D,stopDrag:S}=vc(x,n,o,a,l,P),C=Ai(v,n,o),I=Ai(N,n,o),k=R=>O=>{w.current=R,A(O);},T=R=>O=>{let ne=O.key==="ArrowRight"||O.key==="ArrowUp"?a:O.key==="ArrowLeft"||O.key==="ArrowDown"?-a:0;ne!==0&&(O.preventDefault(),L(R==="lo"?[lr(v+ne,n,N),N]:[v,lr(N+ne,v,o)]));};return jsxs("div",{className:f("slider-root flex flex-col gap-1",m),children:[d&&jsx("input",{type:"range",id:d,className:"sr-only",tabIndex:-1,min:n,max:o,step:a,value:v,disabled:l,readOnly:true,onChange:()=>{}}),(p||c)&&jsxs("div",{className:"flex items-center justify-between",children:[p&&jsx("span",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:p}),c&&jsxs("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:[u(v)," \u2013 ",u(N)]})]}),jsx("div",{...g,ref:x,className:f(Rn({intent:i,size:s}),l&&"opacity-40 cursor-not-allowed"),onPointerMove:D,onPointerUp:S,onPointerCancel:S,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:`${C}%`,width:`${I-C}%`}}),jsx("div",{role:"slider",tabIndex:l?-1:0,"aria-valuemin":n,"aria-valuemax":N,"aria-valuenow":v,"aria-label":"Range start","aria-disabled":l,onPointerDown:k("lo"),onKeyDown:T("lo"),className:f("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",!l&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${C}%`,zIndex:v>N-a?3:2}}),jsx("div",{role:"slider",tabIndex:l?-1:0,"aria-valuemin":v,"aria-valuemax":o,"aria-valuenow":N,"aria-label":"Range end","aria-disabled":l,onPointerDown:k("hi"),onKeyDown:T("hi"),className:f("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",!l&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${I}%`,zIndex:2}})]})})]})}var Jm={warning:"text-warning-400",danger:"text-danger-400",success:"text-success-500",primary:"text-primary-500"},wc="text-secondary-200 dark:text-secondary-700";function kc({className:e}){return jsx("svg",{className:f("rating-icon transition-colors duration-150",e),viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26Z"})})}function Qm({fill:e,filledClass:t,icon:r,emptyIcon:n}){return jsxs("span",{className:"relative inline-flex",children:[n?jsx("span",{className:f("rating-icon",wc),children:n}):jsx(kc,{className:wc}),e>0&&jsx("span",{"aria-hidden":true,className:"absolute inset-0 overflow-hidden",style:{width:e===.5?"50%":"100%"},children:r?jsx("span",{className:f("rating-icon",t),children:r}):jsx(kc,{className:t})})]})}function Xo({value:e,defaultValue:t=0,max:r=5,size:n="md",intent:o="warning",precision:a=1,readOnly:i=false,disabled:s=false,onChange:l,icon:c,emptyIcon:u,label:p="Rating",className:m}){let[d,g]=useState(t),[h,b]=useState(null),y=e!==void 0,v=y?e:d,N=h??v,x=useCallback(S=>{s||i||(y||g(S),l?.(S));},[s,i,y,l]),w=useCallback(()=>{!s&&!i&&b(null);},[s,i]),L=useCallback(S=>{s||i||(S.key==="ArrowRight"||S.key==="ArrowUp"?(S.preventDefault(),x(Math.min(v+a,r))):S.key==="ArrowLeft"||S.key==="ArrowDown"?(S.preventDefault(),x(Math.max(v-a,0))):S.key==="Home"?(S.preventDefault(),x(0)):S.key==="End"&&(S.preventDefault(),x(r)));},[s,i,v,a,r,x]),P=S=>N>=S?1:a===.5&&N>=S-.5?.5:0,A=Jm[o],D=!i&&!s;return jsx("div",{role:"radiogroup","aria-label":p,className:f(Ao({size:n}),s&&"opacity-50 cursor-not-allowed",D&&"cursor-pointer",m),onMouseLeave:D?w:void 0,onKeyDown:D?L:void 0,children:Array.from({length:r},(S,C)=>{let I=C+1,k=P(I),T=jsx(Qm,{fill:k,filledClass:A,icon:c,emptyIcon:u});if(!D)return jsx("span",{role:"radio","aria-label":`${I} star${I!==1?"s":""}`,"aria-checked":Math.round(v)===I,children:T},I);let R=z=>{if(a===.5){let H=z.currentTarget.getBoundingClientRect(),_=z.clientX-H.left<H.width/2;b(_?I-.5:I);}else b(I);},O=z=>{if(a===.5){let H=z.currentTarget.getBoundingClientRect(),_=z.clientX-H.left<H.width/2;x(_?I-.5:I);}else x(I);},E=Math.round(v/a)*a,U=E===I||a===.5&&E===I-.5||v===0&&I===1?0:-1;return jsx("button",{type:"button",role:"radio","aria-label":`${I} star${I!==1?"s":""}`,"aria-checked":Math.round(v)===I,tabIndex:U,className:"border-0 bg-transparent p-0 cursor-pointer rounded transition-transform duration-100 hover:scale-110 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",onMouseMove:R,onMouseEnter:R,onClick:O,children:T},I)})})}function Zr({size:e="sm",variant:t="default",className:r,children:n,...o}){return jsx("kbd",{className:f(Io({size:e,variant:t}),r),...o,children:n})}function en({separator:e="+",className:t,children:r}){let n=On.Children.toArray(r);return jsx("span",{className:f("inline-flex items-center gap-1",t),children:n.map((o,a)=>jsxs(On.Fragment,{children:[o,a<n.length-1&&jsx("span",{className:"select-none text-xs text-secondary-400 dark:text-secondary-500","aria-hidden":true,children:e})]},a))})}var tf={Button:Vt,Dropdown:wi,DropdownButton:qr,Badge:Si,Tag:Pi,Indicator:Ri,Label:_t,Input:Ft,TextBox:Ei,Switch:Rr,Checkbox:An,Radio:Di,RadioGroup:Li,Avatar:Ko,AvatarGroup:jo,Slider:Yo,SliderRange:Uo,Rating:Xo,Kbd:Zr,KbdGroup:en},Vi=tf;var In=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"}}),Go=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 Hi({intent:e,size:t,className:r,...n}){return jsx("div",{className:f(In({intent:e,size:t}),r),...n})}function rf({className:e,...t}){return jsx("div",{className:f("mb-4 space-y-1",e),...t})}function nf({className:e,...t}){return jsx("h3",{className:f("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function of({className:e,...t}){return jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function af({className:e,...t}){return jsx("div",{className:f("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function sf({className:e,...t}){return jsx("div",{className:f("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function lf({intent:e,media:t,mediaPosition:r="left",stackOnMobile:n=false,className:o,children:a,...i}){let s=jsx("div",{className:f("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:f(In({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),...i,children:[s,jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:a})]})}function _i({src:e,alt:t="",aspectRatio:r="16/9",className:n,children:o,...a}){return jsxs("div",{className:f("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 df({className:e,...t}){return jsx("div",{className:f("space-y-2 p-4",e),...t})}function uf({className:e,...t}){return jsx("h3",{className:f("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function pf({className:e,...t}){return jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function mf({className:e,...t}){return jsx("div",{className:f("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function Fi({intent:e,size:t,className:r,...n}){return jsx("div",{className:f(Go({intent:e,size:t}),r),...n})}function ff({className:e,...t}){return jsx("div",{className:f("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 hf({className:e,...t}){return jsx("div",{className:f("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var Lc="onyx-split:",Pc=10;function Rc(e){if(!e)return {};try{let t=localStorage.getItem(Lc+e);if(t)return JSON.parse(t)}catch{}return {}}function Ec(e,t){if(e)try{localStorage.setItem(Lc+e,JSON.stringify(t));}catch{}}function Dc(e,t){return e.filter(r=>t[r.id]!==false).map(r=>r.id)}function Vn(e,t,r){return Math.max(t,Math.min(r,e))}function Ac({panes:e,direction:t,containerRef:r,visibility:n,autoSaveId:o,onResizeEnd:a}){let i=t==="horizontal",[s,l]=useState(()=>Rc(o)),c=useRef(false);useEffect(()=>{if(c.current)return;let y=r.current;if(!y)return;let v=i?y.clientWidth:y.clientHeight,N=Rc(o),x={},w=[],L=0;for(let P of e){if(!(n[P.id]!==false)){x[P.id]=N[P.id]??P.defaultSize??200;continue}N[P.id]!==void 0?(x[P.id]=N[P.id],L+=N[P.id]):P.defaultSize!==void 0?(x[P.id]=P.defaultSize,L+=P.defaultSize):w.push(P);}if(w.length>0){let A=Math.max(0,v-L)/w.length;for(let D of w)x[D.id]=Math.max(A,D.minSize??48);}c.current=true,l(x);},[]);let u=useRef(n),p=useRef(e.map(y=>y.id));useEffect(()=>{let y=u.current,v=p.current,N=e.map(A=>A.id);u.current=n,p.current=N;let x=N.filter(A=>!v.includes(A)),w=v.filter(A=>!N.includes(A)),L=[],P=[];for(let A of e){if(x.includes(A.id))continue;let D=y[A.id]!==false,S=n[A.id]!==false;D&&!S&&L.push(A.id),!D&&S&&P.push(A.id);}x.length===0&&w.length===0&&L.length===0&&P.length===0||l(A=>{let D={...A};for(let S of w){let C=D[S]??0;if(delete D[S],C>0){let I=v.indexOf(S),k=N.filter(R=>n[R]!==false),T=k.find((R,O)=>v.indexOf(N[N.indexOf(k[O])])>I);T||(T=k[k.length-1]),T&&(D[T]=(D[T]??0)+C);}}for(let S of x){let C=e.find(R=>R.id===S);if(n[S]===false){D[S]=C.defaultSize??200;continue}let I=C.defaultSize??200,k=Math.max(I,C.minSize??48),T=N.filter(R=>R!==S&&!x.includes(R)&&n[R]!==false).map(R=>({id:R,size:D[R]??0})).sort((R,O)=>O.size-R.size);if(T.length>0){let O=e.find(U=>U.id===T[0].id)?.minSize??48,E=Math.max(0,T[0].size-O),ne=Math.min(k,E);D[T[0].id]=T[0].size-ne,D[S]=ne;}else D[S]=k;}for(let S of L){let C=D[S]??0;if(C===0)continue;let I=e.findIndex(T=>T.id===S),k;for(let T=I+1;T<e.length;T++)if(n[e[T].id]!==false&&!L.includes(e[T].id)){k=e[T].id;break}if(!k){for(let T=I-1;T>=0;T--)if(n[e[T].id]!==false&&!L.includes(e[T].id)){k=e[T].id;break}}k&&(D[k]=(D[k]??0)+C),D[S]=C;}for(let S of P){let C=D[S]??e.find(T=>T.id===S)?.defaultSize??200,I=e.findIndex(T=>T.id===S),k;for(let T=I+1;T<e.length;T++)if(n[e[T].id]!==false&&!P.includes(e[T].id)){k=e[T].id;break}if(!k){for(let T=I-1;T>=0;T--)if(n[e[T].id]!==false&&!P.includes(e[T].id)){k=e[T].id;break}}if(k){let T=D[k]??0,R=e.find(ne=>ne.id===k)?.minSize??48,O=Math.max(0,T-R),E=Math.min(C,O);D[k]=T-E,D[S]=E;}else D[S]=C;}return D});},[n,e]);let m=useRef(null),[d,g]=useState(null),h=useRef(null),b=useCallback((y,v,N)=>{let x=v.minSize??48,w=v.maxSize??1/0,L=N.minSize??48,P=N.maxSize??1/0;return {onPointerDown:I=>{I.preventDefault();try{I.currentTarget.setPointerCapture(I.pointerId);}catch{}m.current={idA:v.id,idB:N.id,startPos:i?I.clientX:I.clientY,startA:s[v.id]??0,startB:s[N.id]??0,minA:x,maxA:w,minB:L,maxB:P},h.current=y,g(y);},onPointerMove:I=>{if(!m.current||h.current!==y)return;let{idA:k,idB:T,startPos:R,startA:O,startB:E,minA:ne,maxA:U,minB:z,maxB:H}=m.current,_=(i?I.clientX:I.clientY)-R,V=O+_,oe=E-_;V<ne&&(V=ne,oe=O+E-ne),V>U&&(V=U,oe=O+E-U),oe<z&&(oe=z,V=O+E-z),oe>H&&(oe=H,V=O+E-H),V=Vn(V,ne,U),oe=Vn(oe,z,H),l(be=>({...be,[k]:V,[T]:oe}));},onPointerUp:I=>{!m.current||h.current!==y||(m.current=null,h.current=null,g(null),l(k=>(Ec(o,k),a?.(k),k)));},onKeyDown:I=>{if(!(i?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"]).includes(I.key))return;I.preventDefault();let T=I.key==="ArrowLeft"||I.key==="ArrowUp"?-Pc:Pc;l(R=>{let O=R[v.id]??0,E=R[N.id]??0,ne=Vn(O+T,x,w),U=O+E-ne;U=Vn(U,L,P),ne=O+E-U,ne=Vn(ne,x,w);let z={...R,[v.id]:ne,[N.id]:U};return Ec(o,z),a?.(z),z});}}},[i,s,o,a]);return {sizes:s,activeHandleIndex:d,buildHandlers:b}}var vf=8;function xf({isDragging:e,handleSize:t,isHorizontal:r,paneA:n,paneB:o,onPointerDown:a,onPointerMove:i,onPointerUp:s,onKeyDown:l}){let c=Math.max(1,t),u=Math.max(c,vf);return jsxs("div",{role:"separator","aria-orientation":r?"vertical":"horizontal","aria-label":`Resize handle between ${n.id} and ${o.id}`,tabIndex:0,className:f("group relative z-10 shrink-0 select-none outline-none",r?"cursor-col-resize":"cursor-row-resize"),style:r?{width:u,minWidth:u}:{height:u,minHeight:u},onPointerDown:a,onPointerMove:i,onPointerUp:s,onPointerCancel:s,onKeyDown:l,children:[jsx("div",{"aria-hidden":"true",className:f("pointer-events-none absolute rounded-sm transition-colors duration-150","bg-primary-200 dark:bg-primary-700","group-hover:bg-primary-400 dark:group-hover:bg-primary-500","group-focus-visible:bg-primary-400 dark:group-focus-visible:bg-primary-500",e?"bg-primary-500 dark:bg-primary-400":void 0,r?"top-0 bottom-0 left-1/2 -translate-x-1/2":"left-0 right-0 top-1/2 -translate-y-1/2"),style:r?{width:c}:{height:c}}),jsx("div",{"aria-hidden":"true",className:f("pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2","flex gap-0.5 opacity-0 transition-opacity duration-150","group-hover:opacity-100",e?"opacity-100":void 0,r?"flex-col":"flex-row"),children:[0,1,2].map(p=>jsx("span",{className:f("rounded-full bg-primary-400 dark:bg-primary-500","h-0.5 w-0.5")},p))})]})}function wf({pane:e,sizeInPx:t,isHorizontal:r,defaultBackground:n}){let o=e.background??n;return jsx("div",{"data-split-pane-id":e.id,className:f("relative overflow-auto",e.className),style:{...r?{width:t,minWidth:0,flexShrink:0}:{height:t,minHeight:0,flexShrink:0},...o?{background:o}:{},...e.style},children:e.children})}function qo({direction:e="horizontal",panes:t,visibility:r={},onVisibilityChange:n,width:o="100%",height:a="100%",handleSize:i=4,defaultBackground:s,autoSaveId:l,onResizeEnd:c,className:u,style:p}){let m=useRef(null),d=e==="horizontal",{sizes:g,activeHandleIndex:h,buildHandlers:b}=Ac({panes:t,direction:e,containerRef:m,visibility:r,autoSaveId:l,onResizeEnd:c}),y=Dc(t,r),v=t.filter(x=>y.includes(x.id)),N=(x,w)=>x===void 0?w:typeof x=="number"?`${x}px`:x;return jsx("div",{ref:m,"data-split-panel":true,"data-direction":e,className:f("flex overflow-hidden",d?"flex-row":"flex-col",u),style:{width:N(o,"100%"),height:N(a,"100%"),...p},children:v.map((x,w)=>{let L=g[x.id]??x.defaultSize??200,P=w===v.length-1,A=v[w+1],D=w,S=h===D,C=!P&&A?b(D,x,A):null;return jsxs(On.Fragment,{children:[jsx(wf,{pane:x,sizeInPx:L,isHorizontal:d,defaultBackground:s}),!P&&A&&C&&jsx(xf,{index:D,paneA:x,paneB:A,isDragging:S,handleSize:i,isHorizontal:d,onPointerDown:C.onPointerDown,onPointerMove:C.onPointerMove,onPointerUp:C.onPointerUp,onKeyDown:C.onKeyDown})]},x.id)})})}var kf={Card:Hi,ImageCard:_i,Panel:Fi,SplitPanel:qo},Oi=kf;var Jo=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"}}),Qo=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"}}),Zo=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"}}),ea=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"}}),ta=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"}}),ra=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"}}),Hn=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 Bn({intent:e,density:t,className:r,...n}){return jsx("div",{className:"w-full overflow-auto",children:jsx("table",{className:f(Jo({intent:e,density:t}),r),...n})})}function Ki({className:e,...t}){return jsx("thead",{className:f("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function ji({className:e,...t}){return jsx("tbody",{className:f("[&_tr:last-child]:border-0",e),...t})}function Fn({className:e,...t}){return jsx("tr",{className:f("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 zr({className:e,...t}){return jsx("th",{className:f("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function Vr({className:e,...t}){return jsx("td",{className:f("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function Wi({icon:e,text:t="No data",className:r}){return jsxs("div",{className:f("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 zc={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function If({columns:e,data:t,sort:r,onSortChange:n,defaultSort:o=null,rowKey:a,rowActions:i,intent:s,density:l,className:c,empty:u}){let[p,m]=useState(o),d=r??p,g=useCallback(b=>{let y=d?.column===b?d.direction==="asc"?{column:b,direction:"desc"}:null:{column:b,direction:"asc"};n?n(y):m(y);},[d,n]),h=useMemo(()=>{if(!d)return t;let b=e.find(N=>N.key===d.column);if(!b)return t;let y=b.compareFn??((N,x)=>{let w=b.cell(N),L=b.cell(x);return w==null&&L==null?0:w==null?-1:L==null?1:typeof w=="number"&&typeof L=="number"?w-L:String(w).localeCompare(String(L))}),v=[...t].sort(y);return d.direction==="desc"?v.reverse():v},[t,d,e]);return jsxs(Bn,{intent:s,density:l,className:c,children:[jsx(Ki,{children:jsxs(Fn,{children:[e.map(b=>{let y=b.sortable!==false,v=d?.column===b.key;return jsx(zr,{className:f(y&&"cursor-pointer select-none",b.headerClassName,b.hideBelow&&zc[b.hideBelow]),onClick:y?()=>g(b.key):void 0,"aria-sort":v?d.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[b.header,y&&jsx(Vc,{active:v,direction:v?d.direction:null})]})},b.key)}),i&&jsx(zr,{className:"w-20 text-right",children:"Actions"})]})}),jsx(ji,{children:h.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(i?1:0),children:jsx(Wi,{...u})})}):h.map((b,y)=>jsxs(Fn,{children:[e.map(v=>jsx(Vr,{className:f(v.cellClassName,v.hideBelow&&zc[v.hideBelow]),children:v.cell(b)},v.key)),i&&jsx(Vr,{className:"text-right",children:jsx("span",{className:"inline-flex items-center gap-1",children:i(b)})})]},a?a(b,y):y))})]})}function zf({value:e,onCommit:t,onCancel:r}){let[n,o]=useState(e),a=useRef(null);useEffect(()=>{a.current?.focus(),a.current?.select();},[]);let i=()=>t(n);return jsxs("span",{className:"flex items-center gap-1",children:[jsx("input",{ref:a,type:"text",value:n,onChange:s=>o(s.target.value),onKeyDown:s=>{s.key==="Enter"&&i(),s.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:i,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 Vf({columns:e,data:t,rowKey:r,sort:n,onSortChange:o,defaultSort:a=null,selectionMode:i="none",selected:s,onSelectionChange:l,editable:c=false,onCellEdit:u,toolbar:p=false,onAdd:m,onDelete:d,rowActions:g,intent:h,density:b,className:y,empty:v}){let[N,x]=useState(a),w=n??N,L=useCallback(_=>{let V=w?.column===_?w.direction==="asc"?{column:_,direction:"desc"}:null:{column:_,direction:"asc"};o?o(V):x(V);},[w,o]),P=useMemo(()=>{if(!w)return t;let _=e.find(be=>be.key===w.column);if(!_)return t;let V=_.compareFn??((be,M)=>{let F=_.cell(be),re=_.cell(M);return F==null&&re==null?0:F==null?-1:re==null?1:typeof F=="number"&&typeof re=="number"?F-re:String(F).localeCompare(String(re))}),oe=[...t].sort(V);return w.direction==="desc"?oe.reverse():oe},[t,w,e]),[A,D]=useState([]),S=s??A,C=l??D,I=useMemo(()=>P.map((_,V)=>r(_,V)),[P,r]),k=i==="multiple"&&I.length>0&&I.every(_=>S.includes(_)),T=i==="multiple"&&S.length>0&&!k,R=useCallback(_=>{i==="single"?C(S.includes(_)?[]:[_]):i==="multiple"&&C(S.includes(_)?S.filter(V=>V!==_):[...S,_]);},[i,S,C]),O=useCallback(()=>{C(k?[]:I);},[k,I,C]),[E,ne]=useState(null),U=useCallback((_,V,oe)=>{c&&oe!==false&&ne({rowKey:_,colKey:V});},[c]),z=useCallback((_,V,oe)=>{u?.(_,V,oe),ne(null);},[u]);return jsxs("div",{className:"space-y-2",children:[p&&jsxs("div",{className:"flex items-center gap-2",children:[m&&jsxs("button",{type:"button",onClick:m,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"]}),d&&jsxs("button",{type:"button",onClick:()=>d(S),disabled:S.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",S.length>0&&` (${S.length})`]}),c&&S.length===1&&jsxs("button",{type:"button",onClick:()=>{let _=e.find(V=>V.editable!==false);_&&ne({rowKey:S[0],colKey:_.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"]}),S.length>0&&jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[S.length," row",S.length>1?"s":""," selected"]})]}),jsxs(Bn,{intent:h,density:b,className:y,children:[jsx(Ki,{children:jsxs(Fn,{children:[i==="multiple"&&jsx(zr,{className:"w-10",children:jsx("input",{type:"checkbox",checked:k,ref:_=>{_&&(_.indeterminate=T);},onChange:O,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),i==="single"&&jsx(zr,{className:"w-10"}),e.map(_=>{let V=_.sortable!==false,oe=w?.column===_.key;return jsx(zr,{className:f(V&&"cursor-pointer select-none",_.headerClassName),onClick:V?()=>L(_.key):void 0,"aria-sort":oe?w.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[_.header,V&&jsx(Vc,{active:oe,direction:oe?w.direction:null})]})},_.key)}),g&&jsx(zr,{className:"w-20 text-right",children:"Actions"})]})}),jsx(ji,{children:P.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(i!=="none"?1:0)+(g?1:0),children:jsx(Wi,{...v})})}):P.map((_,V)=>{let oe=r(_,V),be=S.includes(oe);return jsxs(Fn,{className:f(be&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{i!=="none"&&R(oe);},children:[i==="multiple"&&jsx(Vr,{className:"w-10",children:jsx("input",{type:"checkbox",checked:be,onChange:()=>R(oe),onClick:M=>M.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),i==="single"&&jsx(Vr,{className:"w-10",children:jsx("input",{type:"radio",checked:be,onChange:()=>R(oe),onClick:M=>M.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(M=>{let F=E?.rowKey===oe&&E?.colKey===M.key,re=M.editValue?.(_)??(()=>{let W=M.cell(_);return typeof W=="string"||typeof W=="number"?String(W):""})();return jsx(Vr,{className:f(M.cellClassName,c&&M.editable!==false&&"cursor-text"),onDoubleClick:W=>{W.stopPropagation(),U(oe,M.key,M.editable);},children:F?jsx(zf,{value:re,onCommit:W=>z(oe,M.key,W),onCancel:()=>ne(null)}):M.cell(_)},M.key)}),g&&jsx(Vr,{className:"text-right",onClick:M=>M.stopPropagation(),children:jsx("span",{className:"inline-flex items-center gap-1",children:g(_)})})]},oe)})})]})]})}function Vc({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsx(ArrowUpDown,{className:f(r,"opacity-30")}):t==="asc"?jsx(ArrowUp,{className:f(r,"opacity-70")}):jsx(ArrowDown,{className:f(r,"opacity-70")})}var Hc=createContext({size:"md"});function Yi({intent:e,size:t="md",className:r,...n}){return jsx(Hc.Provider,{value:{size:t},children:jsx("ul",{className:f(Qo({intent:e}),r),...n})})}function Ff({actions:e,className:t,children:r,...n}){let{size:o}=useContext(Hc);return jsxs("li",{className:f(Zo({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 Bc=createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function Ui({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:n="all",onExpandedKeysChange:o,size:a="md",className:i,children:s,...l}){let [c,u]=useState(()=>n),m=useCallback(g=>{if(r){let h=new Set(r);h.has(g)?h.delete(g):h.add(g),o?.(h);}else u(h=>{if(h==="all")return new Set(["__ALL_MINUS__",g]);let b=new Set(h);return b.has(g)?b.delete(g):b.add(g),b});},[r,o]),d=r??(c==="all"?null:c);return jsx(Bc.Provider,{value:{showLines:e,expandedKeys:d,onToggleKey:m,size:a},children:t?jsx("ul",{className:f("text-sm",i),role:"tree",...l,children:s}):jsx("ul",{className:f("text-sm",i),role:"tree",...l,children:jsx(Wf,{children:s})})})}function Wf({children:e}){let t=Oc(e);return jsx(Fragment,{children:t.map(r=>On.isValidElement(r)&&r.props.children?r.props.children:null)})}function Oc(e){let t=[];return On.Children.forEach(e,r=>{On.isValidElement(r)&&r.type===On.Fragment?t.push(...Oc(r.props.children)):t.push(r);}),t}function Yf({nodeKey:e,label:t,icon:r,actions:n,defaultExpanded:o=false,expanded:a,onToggle:i,children:s,className:l}){let{showLines:c,expandedKeys:u,onToggleKey:p,size:m}=useContext(Bc),[d,g]=useState(o),h=On.Children.count(s)>0,b=e??(typeof t=="string"?t:""),y;a!=null?y=a:u!=null&&b?u.has("__ALL_MINUS__")?y=!u.has(b):y=u.has(b):y=d;let v=()=>{let N=!y;i?i(N):u!=null&&b?p(b):g(N);};return jsxs("li",{className:f("select-none",l),role:"treeitem","aria-expanded":h?y:void 0,children:[jsxs("div",{className:f("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",ea({size:m}),h?"cursor-pointer":"cursor-default"),onClick:h?v:void 0,children:[h?jsx(ChevronRight,{className:f("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",y&&"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:N=>N.stopPropagation(),children:n})]}),h&&jsx("div",{className:f("grid transition-[grid-template-rows] duration-200 ease-out",y?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("ul",{className:f("ml-4 pl-2",c&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:s})})})]})}function qf({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 Jf({msg:e,alignRight:t}){return jsxs("div",{className:f("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsx(qf,{avatar:e.avatar,sender:e.sender}),jsxs("div",{className:f("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:f("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 Gi({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:f("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(i=>{let s=t==="split"&&!!i.self;return jsx(Jf,{msg:i,alignRight:s},i.id)}),jsx("div",{ref:a})]})}var e0={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)"}}]},t0={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')},Qi=null,$c=new Set;function r0(){return Qi||(Qi=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[e0],langs:[],engine:t()}))),Qi}async function n0(e,t,r){let n=await r0();if(t&&!$c.has(t)){let a=t0[t];if(a)try{let i=await a();await n.loadLanguage(i.default??i),$c.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 Zi({code:e,language:t="text",lineNumbers:r=false,editable:n=false,onCodeChange:o,size:a,className:i,...s}){let[l,c]=useState(""),u=useRef(null),p=useRef(null),m=useRef(null);useEffect(()=>{let x=false;return n0(e,t,n?false:r).then(w=>{x||c(w);}),()=>{x=true;}},[e,t,r,n]);let d=useCallback(()=>{let x=p.current,w=m.current?.querySelector("pre"),L=u.current?.querySelector("[data-gutter]");x&&w&&(w.scrollTop=x.scrollTop,w.scrollLeft=x.scrollLeft),x&&L&&(L.scrollTop=x.scrollTop);},[]),g=useCallback(x=>{o?.(x.target.value);},[o]),h=useCallback(x=>{if(x.key==="Tab"){x.preventDefault();let w=x.currentTarget,L=w.selectionStart,P=w.selectionEnd,A=w.value.substring(0,L)+" "+w.value.substring(P);o?.(A),requestAnimationFrame(()=>{w.selectionStart=w.selectionEnd=L+2;});}},[o]),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)]",y="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",v=1.7,N=e.split(`
|
|
2
|
-
`).length;return n?jsxs("div",{ref:u,className:f(Hn({size:a}),"flex border border-primary-200 dark:border-primary-700",i),style:{background:"var(--color-syntax-bg)"},...s,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:y,lineHeight:v,width:"3rem"},children:Array.from({length:N},(x,w)=>jsx("div",{children:w+1},w))}),jsxs("div",{className:"relative min-w-0 flex-1",children:[jsx("textarea",{ref:p,value:e,onChange:g,onScroll:d,onKeyDown:h,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:y,lineHeight:v,tabSize:2,minHeight:"6rem"}}),jsx("div",{ref:m,"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:l?{__html:l}:void 0})]})]}):jsx("div",{ref:u,className:f(Hn({size:a}),"border border-primary-200 dark:border-primary-700",b,i),style:{background:"var(--color-syntax-bg)"},...s,children:jsx("div",{ref:m,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:l?{__html:l}:void 0,children:l?void 0:jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsx("code",{children:e})})})})}var s0={up:TrendingUp,down:TrendingDown,neutral:Minus},l0={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 es({title:e,value:t,prefix:r,suffix:n,icon:o,trend:a,trendValue:i,description:s,intent:l,size:c,className:u}){let p=a?s0[a]:null,m=a?l0[a]:"";return jsx("div",{className:f(ta({intent:l,size:c}),u),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})]}),(a||s)&&jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a&&p&&jsxs("span",{className:f("flex items-center gap-0.5 text-xs font-semibold",m),children:[jsx(p,{className:"h-3.5 w-3.5"}),i]}),s&&jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:s})]})]}),o&&jsx("div",{className:f("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl [&_svg]:h-5 [&_svg]:w-5",l==="success"&&"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",l==="danger"&&"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",l==="warning"&&"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400",(!l||l==="primary")&&"bg-primary-100 text-primary-600 dark:bg-primary-800 dark:text-primary-400"),children:o})]})})}function f0(e){return 1-Math.pow(1-e,4)}function h0(e,t,r,n,o){let[a,i]=useState(()=>o?o(t):t.toFixed(n)),s=useRef(null),l=useRef(null);return useEffect(()=>{s.current!==null&&cancelAnimationFrame(s.current),l.current=null;let c=u=>{l.current===null&&(l.current=u);let p=u-l.current,m=Math.min(p/r,1),d=f0(m),g=t+(e-t)*d;i(o?o(g):g.toFixed(n)),m<1&&(s.current=requestAnimationFrame(c));};return s.current=requestAnimationFrame(c),()=>{s.current!==null&&cancelAnimationFrame(s.current);}},[e,t,r,n,o]),a}var g0={up:TrendingUp,down:TrendingDown,neutral:Minus},b0={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"},Wc={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 ts({title:e,value:t,decimals:r=0,prefix:n,suffix:o,icon:a,trend:i,trendValue:s,description:l,animateDuration:c=1200,formatter:u,from:p=0,intent:m,size:d,className:g}){let h=h0(t,p,c,r,u),b=i?g0[i]:null,y=i?b0[i]:"";return jsxs("div",{className:f(ra({intent:m,size:d}),g),children:[jsx("div",{className:f("pointer-events-none absolute inset-x-0 top-0 h-0.5 rounded-t-xl",m==="success"&&"bg-gradient-to-r from-success-400 to-success-600",m==="danger"&&"bg-gradient-to-r from-danger-400 to-danger-600",m==="warning"&&"bg-gradient-to-r from-warning-400 to-warning-600",(!m||m==="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:h}),o&&jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:o})]})]}),a&&jsx("div",{className:f("flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl [&_svg]:h-6 [&_svg]:w-6",Wc[m??"primary"]??Wc.primary),children:a})]}),(i||l)&&jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-primary-100 pt-3 dark:border-primary-700/50",children:[i&&b&&jsxs("span",{className:f("flex items-center gap-0.5 text-xs font-bold",y),children:[jsx(b,{className:"h-3.5 w-3.5"}),s]}),l&&jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:l})]})]})}var Yc="onyx-vlist:";function Uc(e,t){let r=0,n=e.length-2;for(;r<=n;){let o=r+n>>1;if(e[o+1]<=t)r=o+1;else if(e[o]>t)n=o-1;else return o}return Math.max(0,r)}function Xc(e,t){let{items:r,itemHeight:n,estimatedItemHeight:o=48,direction:a="vertical",overscan:i=3,onReachEnd:s,reachEndThreshold:l=120,isLoading:c,onScroll:u,onVisibleRangeChange:p,scrollRestorationId:m}=e,d=a==="vertical",g=typeof n=="number",h=g?n:0,b=useRef(null),[y,v]=useState(300);useEffect(()=>{let z=b.current;if(!z)return;let H=new ResizeObserver(([oe])=>{let be=d?oe.contentRect.height:oe.contentRect.width;be>0&&v(be);});H.observe(z);let _=z.getBoundingClientRect(),V=d?_.height:_.width;return V>0&&v(V),()=>H.disconnect()},[d]);let[N,x]=useState(0);useEffect(()=>{if(!m)return;let z=b.current;if(z)try{let H=localStorage.getItem(Yc+m);if(H!==null){let _=parseFloat(H);!Number.isNaN(_)&&_>0&&requestAnimationFrame(()=>{d?z.scrollTop=_:z.scrollLeft=_;});}}catch{}},[]);let w=useRef(false),L=useRef(r.length);r.length!==L.current&&(L.current=r.length,w.current=false);let P=useCallback(()=>{let z=b.current;if(!z)return;let H=d?z.scrollTop:z.scrollLeft;if(x(H),u?.(H),m)try{localStorage.setItem(Yc+m,String(H));}catch{}s&&!c&&(d?z.scrollHeight-z.clientHeight:z.scrollWidth-z.clientWidth)-H<=l&&(w.current||(w.current=true,s()));},[d,u,m,s,c,l]);useEffect(()=>{let z=b.current;if(z)return z.addEventListener("scroll",P,{passive:true}),()=>z.removeEventListener("scroll",P)},[P]),useEffect(()=>{if(d)return;let z=b.current;if(!z)return;let H=_=>{Math.abs(_.deltaX)>=Math.abs(_.deltaY)||(_.preventDefault(),z.scrollLeft+=_.deltaY);};return z.addEventListener("wheel",H,{passive:false}),()=>z.removeEventListener("wheel",H)},[d]),useEffect(()=>{if(d)return;let z=b.current;if(!z)return;let H=5,_=false,V=false,oe=0,be=0,M=W=>{W.target.closest("button,a,input,select,textarea,[role=button],[role=checkbox],[role=radio],[role=option]")||W.button===0&&(_=true,V=false,oe=W.clientX,be=z.scrollLeft,z.setPointerCapture(W.pointerId));},F=W=>{if(!_)return;let G=oe-W.clientX;if(!V){if(Math.abs(G)<H)return;V=true,z.style.cursor="grabbing",z.style.userSelect="none";}z.scrollLeft=be+G;},re=W=>{if(_){_=false,z.style.cursor="",z.style.userSelect="";try{z.releasePointerCapture(W.pointerId);}catch{}}};return z.addEventListener("pointerdown",M),z.addEventListener("pointermove",F),z.addEventListener("pointerup",re),z.addEventListener("pointercancel",re),()=>{z.removeEventListener("pointerdown",M),z.removeEventListener("pointermove",F),z.removeEventListener("pointerup",re),z.removeEventListener("pointercancel",re);}},[d]);let A=useRef(new Map),[D,S]=useState(0),C=useCallback((z,H)=>{if(g||!H)return;let _=d?H.offsetHeight:H.offsetWidth;_>0&&A.current.get(z)!==_&&(A.current.set(z,_),S(V=>V+1));},[g,d]),I=useRef(r);I.current!==r&&(I.current=r,g||(A.current=new Map));let k=useMemo(()=>{if(g)return [];let z=new Array(r.length+1);z[0]=0;for(let H=0;H<r.length;H++){let _=A.current.get(H),V;_!==void 0?V=_:typeof n=="function"?V=r[H]!==void 0?n(r[H],H):o:V=o,z[H+1]=z[H]+V;}return z},[g,r,n,o,D]),T=useCallback(z=>g?z*h:k[z]??0,[g,h,k]),R=useCallback(z=>{if(g)return h;let H=A.current.get(z);return H!==void 0?H:typeof n=="function"&&r[z]!==void 0?n(r[z],z):o},[g,h,n,r,o,D]),O,E,ne;if(g){O=h*r.length;let z=Math.floor(N/h),H=Math.ceil((N+y)/h);E=Math.max(0,z-i),ne=Math.min(r.length-1,H+i-1);}else if(O=k[r.length]??0,k.length>1){let z=Uc(k,N);E=Math.max(0,z-i);let H=z;for(;H<r.length&&k[H]<N+y;)H++;ne=Math.min(r.length-1,H+i-1);}else E=0,ne=Math.min(r.length-1,i*2);E=Math.max(0,E),ne=Math.max(E,Math.min(r.length-1,ne));let U=useRef({start:-1,end:-1});return useEffect(()=>{let z,H;if(g&&h>0)z=Math.max(0,Math.floor(N/h)),H=Math.min(r.length-1,Math.ceil((N+y)/h)-1);else {for(z=Uc(k,N),H=z;H<r.length&&k[H]<N+y;)H++;H=Math.max(0,H-1);}(U.current.start!==z||U.current.end!==H)&&(U.current={start:z,end:H},p?.(z,H));}),useImperativeHandle(t,()=>({scrollToIndex(z,H="auto"){let _=b.current;if(!_)return;let V=T(z),oe=R(z),be=d?_.clientHeight:_.clientWidth,M=d?_.scrollTop:_.scrollLeft,F;if(H==="start")F=V;else if(H==="end")F=V-be+oe;else if(H==="center")F=V-(be-oe)/2;else if(V<M)F=V;else if(V+oe>M+be)F=V-be+oe;else return;_.scrollTo({[d?"top":"left"]:Math.max(0,F),behavior:"smooth"});},scrollToOffset(z){let H=b.current;H&&H.scrollTo({[d?"top":"left"]:z,behavior:"smooth"});},getScrollOffset(){let z=b.current;return z?d?z.scrollTop:z.scrollLeft:0}}),[T,R,d]),{scrollerRef:b,startIndex:E,endIndex:ne,totalSize:O,getItemOffset:T,getItemSize:R,measureItem:C}}function w0({text:e="Loading\u2026"}){return jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-primary-400",children:[jsx("span",{"aria-hidden":true,className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-200 border-t-primary-500"}),jsx("span",{children:e})]})}function k0({text:e="No items"}){return jsxs("div",{className:"flex h-full min-h-[120px] flex-col items-center justify-center gap-2 text-sm text-primary-400",children:[jsx("svg",{"aria-hidden":true,xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),jsx("span",{children:e})]})}function N0(e,t){let{items:r,renderItem:n,getItemKey:o,itemHeight:a,direction:i="vertical",height:s="100%",width:l="100%",isLoading:c=false,loadingRenderer:u,loadingText:p,emptyRenderer:m,emptyText:d,itemClassName:g,className:h,style:b}=e,y=i==="vertical",v=typeof a!="number",{scrollerRef:N,startIndex:x,endIndex:w,totalSize:L,getItemOffset:P,getItemSize:A,measureItem:D}=Xc(e,t),S={position:"relative",overflowX:y?"hidden":"auto",overflowY:y?"auto":"hidden",height:s,width:l,cursor:y?void 0:"grab"},C={position:"relative",[y?"height":"width"]:L,[y?"width":"height"]:"100%",overflow:"hidden"},I=[];for(let T=x;T<=w;T++){let R=r[T];if(R===void 0)continue;let O=P(T),E=A(T),ne=o?o(R,T):T,U={position:"absolute",[y?"top":"left"]:O,[y?"height":"width"]:v?void 0:E,[y?"width":"height"]:"100%",boxSizing:"border-box"};I.push(jsx("div",{role:"row","aria-rowindex":T+1,style:U,className:f("onyx-vlist-item",g),ref:v?z=>D(T,z):void 0,children:n(R,T)},ne));}let k=r.length===0;return jsxs("div",{ref:N,role:"grid","aria-rowcount":r.length,"data-virtual-list":true,"data-direction":i,className:f("onyx-virtual-list",h),style:{...S,...b},children:[k?m?m():jsx(k0,{text:d}):jsx("div",{style:C,children:I}),c&&(u?u():jsx(w0,{text:p}))]})}var aa=forwardRef(N0);var C0={Table:Bn,List:Yi,Tree:Ui,Chat:Gi,CodeBlock:Zi,Stat:es,MetricCard:ts,VirtualList:aa},os=C0;var Hr="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",qc="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",an="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",sn="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 A0({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 as=["expanded","icons","mini"];function I0(e){let t=as.indexOf(e);return as[(t+1)%as.length]}function Jc(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 Jc(r.children))t.add(n);}return t}function Qc({item:e,basePath:t,depth:r,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:i,onToggle:s}){let l=e.key??e.label,c=e.children&&e.children.length>0,[u,p]=useState(e.defaultOpen??true),m=i?i.has(l):u,d=useCallback(()=>{i?s(l):p(h=>!h);},[i,s,l]),g=r>0?`${r*1.25}rem`:void 0;if(c)return jsxs("div",{children:[jsxs("button",{type:"button",onClick:d,className:f(Hr,an,"justify-between"),style:{paddingLeft:g},children:[jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsx(ChevronRight,{className:f("h-3.5 w-3.5 transition-transform",m&&"rotate-90")})]}),m&&jsx("div",{className:f("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(h=>jsx(Qc,{item:h,basePath:t,depth:r+1,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:i,onToggle:s},h.key??h.path??h.label))})]});if(e.path!=null){let h=t+e.path;return n?jsxs("button",{type:"button",onClick:()=>n(e,h),className:f(Hr,an),style:{paddingLeft:g},children:[e.icon,e.label]}):jsxs(o,{to:h,className:({isActive:b})=>f(Hr,b?qc:an),style:{paddingLeft:g},children:[e.icon,e.label]})}return jsxs("span",{className:f(Hr,an,"cursor-default"),style:{paddingLeft:g},children:[e.icon,e.label]})}function z0({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let[o,a]=useState(false),i=useRef(null),s=useRef(void 0),[l,c]=useState({top:0,left:0}),u=()=>{clearTimeout(s.current),a(true);},p=()=>{s.current=setTimeout(()=>a(false),200);};useLayoutEffect(()=>{if(o&&i.current){let d=i.current.getBoundingClientRect();c({top:d.top,left:d.right+4});}},[o]);let m=e.icon||jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxs("div",{onMouseEnter:u,onMouseLeave:p,children:[jsx("button",{ref:i,type:"button",className:f(sn,"w-full"),title:e.label,onClick:()=>a(d=>!d),children:m}),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:l.top,left:l.left},onMouseEnter:u,onMouseLeave:p,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(d=>{let g=d.key??d.path??d.label;if(d.path!=null){let h=t+d.path;return r?jsxs("button",{type:"button",onClick:()=>{r(d,h),a(false);},className:f(Hr,an),children:[d.icon,d.label]},g):jsxs(n,{to:h,className:({isActive:b})=>f(Hr,b?qc:an),children:[d.icon,d.label]},g)}return jsxs("span",{className:f(Hr,"cursor-default text-primary-400"),children:[d.icon,d.label]},g)})})]}),document.body)]})}function V0({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:f(sn,"w-full"),title:e.label,children:o}):jsx(n,{to:a,className:({isActive:i})=>f(sn,"w-full",i&&"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:f(sn,"w-full cursor-default"),title:e.label,children:o})}function ss({items:e,title:t,basePath:r="/",onItemClick:n,LinkComponent:o=A0,collapsible:a,collapseMode:i,defaultCollapseMode:s="expanded",onCollapseModeChange:l,showLines:c=true,expandedKeys:u,defaultExpandedKeys:p="all",onExpandedKeysChange:m,className:d,responsive:g=true,mobileBreakpoint:h=768,mobileTopOffset:b=48,mobileDrawerSlot:y,...v}){let[N,x]=useState(s),w=i??N,L=On.useMemo(()=>Jc(e),[e]),[P,A]=useState(()=>p==="all"?new Set(L):new Set(p)),D=u??null,S=D??P,C=useCallback(q=>{let Z=new Set(S);Z.has(q)?Z.delete(q):Z.add(q),A(Z),m?.(Z);},[S,m]),I=useCallback(()=>{let q=I0(w);x(q),l?.(q);},[w,l]),[k,T]=useState(()=>g&&typeof window<"u"&&window.innerWidth<h),[R,O]=useState(false),[E,ne]=useState(()=>{if(typeof window>"u")return "left";try{return localStorage.getItem("onyx-sidenav-side")||"left"}catch{return "left"}}),[U,z]=useState(()=>{if(typeof window>"u")return 50;try{return Number(localStorage.getItem("onyx-sidenav-top"))||50}catch{return 50}}),[H,_]=useState(null),V=useRef({dragging:false,startX:0,startY:0,moved:false}),oe=useCallback(q=>{if(q.pointerType==="mouse"&&q.button!==0)return;q.preventDefault(),V.current={dragging:true,startX:q.clientX,startY:q.clientY,moved:false};let Z=te=>{if(!V.current.dragging)return;let ve=Math.abs(te.clientX-V.current.startX),Ne=Math.abs(te.clientY-V.current.startY);if((ve>6||Ne>6)&&(V.current.moved=true),!V.current.moved)return;let X=te.clientX<window.innerWidth/2?"left":"right",de=b+28,Q=window.innerHeight-28,ie=Math.max(de,Math.min(Q,te.clientY));_({side:X,y:ie});},ue=te=>{if(window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",ue),window.removeEventListener("pointercancel",ue),!V.current.dragging)return;if(V.current.dragging=false,!V.current.moved){let ie=Pe=>{Pe.stopPropagation(),Pe.preventDefault(),window.removeEventListener("click",ie,true);};window.addEventListener("click",ie,true),_(null),O(true);return}let ve=te.clientX<window.innerWidth/2?"left":"right",Ne=b+28,X=window.innerHeight-28,Q=Math.max(Ne,Math.min(X,te.clientY))/window.innerHeight*100;ne(ve),z(Q),_(null);try{localStorage.setItem("onyx-sidenav-side",ve),localStorage.setItem("onyx-sidenav-top",String(Q));}catch{}};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",ue),window.addEventListener("pointercancel",ue);},[b]);useEffect(()=>{if(!g||typeof window>"u"||!window.matchMedia)return;let q=window.matchMedia(`(max-width: ${h-1}px)`),Z=ue=>{T(ue.matches),ue.matches||O(false);};return q.addEventListener("change",Z),()=>q.removeEventListener("change",Z)},[g,h]);let be=useCallback(q=>{q.target.closest("a")&&O(false);},[]),M=useRef(null),F=useRef({startX:0,startY:0,dragging:false}),re=60,W=useCallback(q=>{let Z=q.touches[0];F.current={startX:Z.clientX,startY:Z.clientY,dragging:true};},[]),G=useCallback(q=>{if(!F.current.dragging||!M.current)return;let Z=q.touches[0],ue=Z.clientX-F.current.startX,te=Z.clientY-F.current.startY;if(E==="left"){if(ue>=0||Math.abs(te)>Math.abs(ue))return;M.current.style.transform=`translateX(${Math.max(ue,-224)}px)`;}else {if(ue<=0||Math.abs(te)>Math.abs(ue))return;M.current.style.transform=`translateX(${Math.min(ue,224)}px)`;}M.current.style.transition="none";},[E]),le=useCallback(q=>{if(!F.current.dragging||!M.current)return;F.current.dragging=false;let Z=q.changedTouches[0],ue=Z.clientX-F.current.startX,te=Z.clientY-F.current.startY;M.current.style.transition="",M.current.style.transform="",Math.abs(ue)>Math.abs(te)&&(E==="left"&&ue<-re&&O(false),E==="right"&&ue>re&&O(false));},[E]),ke=useMemo(()=>!k||!n?n:(q,Z)=>{O(false),n(q,Z);},[k,n]),B=jsxs(Fragment,{children:[a&&!k&&jsx("div",{className:f("flex shrink-0 mb-1",w==="expanded"?"justify-end":"justify-center"),children:jsx("button",{type:"button",onClick:I,className:sn,"aria-label":w==="mini"?"Expand sidebar":"Collapse sidebar",title:w==="mini"?"Expand sidebar":"Collapse sidebar",children:w==="mini"?jsx(Menu,{className:"h-5 w-5"}):jsx(ChevronsLeft,{className:"h-4 w-4"})})}),(k||w==="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(q=>jsx(Qc,{item:q,basePath:r,depth:0,onItemClick:ke,LinkComponent:o,showLines:c,expandedKeys:D,onToggle:C},q.key??q.path??q.label))]}),!k&&w==="icons"&&e.map(q=>{let Z=q.key??q.path??q.label;return q.children&&q.children.length>0?jsx(z0,{item:q,basePath:r,onItemClick:ke,LinkComponent:o},Z):jsx(V0,{item:q,basePath:r,onItemClick:ke,LinkComponent:o},Z)})]});if(g&&k){let q=H?H.side:E,Z=H?H.y:U/100*(typeof window<"u"?window.innerHeight:600),ue=H?{top:Z,transform:"translateY(-50%)",transition:"none",...q==="left"?{left:0}:{right:0}}:{top:`${U}%`,transform:"translateY(-50%)",transition:"top 0.15s ease",...E==="left"?{left:0}:{right:0}},te=E==="left"?{left:0,right:"auto"}:{right:0,left:"auto"},ve=R?"translate-x-0":E==="left"?"-translate-x-full":"translate-x-full",Ne=E==="left"?"border-r":"border-l";return jsxs(Fragment,{children:[R&&createPortal(jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:b},onClick:()=>O(false)}),document.body),createPortal(jsxs("aside",{ref:M,className:f("fixed bottom-0 z-50 flex flex-col w-56 bg-white dark:bg-primary-900 shadow-xl transition-transform duration-200",Ne,"border-primary-200 dark:border-primary-700",ve),style:{top:b,...te},onClick:be,onTouchStart:W,onTouchMove:G,onTouchEnd:le,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:X=>{X.stopPropagation(),O(false);},className:f(sn,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsx(X,{className:"h-4 w-4"})})]}),y&&jsx("div",{className:"shrink-0 border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:y}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsx("nav",{className:"flex flex-col gap-0.5",children:B})})]}),document.body),!R&&createPortal(jsx("div",{className:f("fixed z-50 flex items-center",q==="left"?"justify-start":"justify-end",H?"cursor-grabbing":"cursor-grab"),style:{...ue,width:44,height:80,marginTop:-12,touchAction:"none",userSelect:"none"},onPointerDown:oe,onDragStart:X=>X.preventDefault(),role:"button","aria-label":"Open navigation",tabIndex:0,children:jsx("div",{className:f("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",q==="left"?"rounded-r-xl":"rounded-l-xl"),children:q==="left"?jsx(ChevronRight,{className:"h-4 w-4"}):jsx(ChevronLeft,{className:"h-4 w-4"})})}),document.body)]})}return jsx("nav",{className:f("flex flex-col gap-0.5",w==="mini"&&"items-center",d),...v,children:B})}function F0({href:e,className:t,onClick:r,children:n}){return jsx("a",{href:e,className:t,onClick:r,children:n})}function ls({brand:e,onBrandClick:t,navItems:r=[],actions:n=[],linkComponent:o=F0,height:a="h-12",mobileMenu:i=false,navMenuIcon:s,actionsMenuIcon:l,className:c,children:u}){let p=i&&r.length>0,m=i&&n.length>0,d="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=v=>v?"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",h="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((v,N)=>({key:typeof v.label=="string"?v.label:String(N),label:v.active?jsx("span",{className:"font-semibold text-primary-900 dark:text-primary-100",children:v.label}):v.label,onClick:()=>{v.onClick?v.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):v.href&&(window.location.href=v.href);}})),y=n.map((v,N)=>({key:v.key??String(N),label:jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[v.icon,jsx("span",{children:v.ariaLabel})]}),onClick:()=>{v.onClick?v.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):v.href&&(v.external?window.open(v.href,"_blank","noopener,noreferrer"):window.location.href=v.href);}}));return jsxs("header",{className:f("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,c),children:[jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&jsx("div",{className:f("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?v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),t(v));}:void 0,children:e}),p&&jsx(qr,{intent:"ghost",size:"sm",className:d,label:s??jsx(PanelLeft,{className:"h-5 w-5"}),items:b,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsx("nav",{className:f("flex items-center gap-4 text-sm",i?"hidden md:flex":"flex"),children:r.map((v,N)=>{let x=typeof v.label=="string"?v.label:N,w=g(v.active);return v.href?jsx(o,{href:v.href,className:w,onClick:v.onClick,children:v.label},x):jsx("button",{type:"button",className:f(w,"cursor-pointer"),onClick:v.onClick,children:v.label},x)})})]}),u&&jsx("div",{className:"flex items-center",children:u}),jsxs("div",{className:"flex items-center gap-1",children:[n.length>0&&jsx("div",{className:f("flex items-center gap-1",i?"hidden md:flex":"flex"),children:n.map((v,N)=>v.href?jsx("a",{href:v.href,target:v.external?"_blank":void 0,rel:v.external?"noopener noreferrer":void 0,className:h,"aria-label":v.ariaLabel,onClick:v.onClick,children:v.icon},v.key??N):jsx("button",{type:"button",className:h,"aria-label":v.ariaLabel,onClick:v.onClick,children:v.icon},v.key??N))}),m&&jsx(qr,{intent:"ghost",size:"sm",className:d,label:l??jsx(MoreHorizontal,{className:"h-5 w-5"}),items:y,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var la=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 O0(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var $0=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 cs({intent:e,size:t,underline:r,external:n,className:o,children:a,href:i,target:s,rel:l,...c}){let u=n??O0(i,s);return jsxs("a",{href:i,target:u&&!s?"_blank":s,rel:u&&!l?"noopener noreferrer":l,className:f(la({intent:e,size:t,underline:r}),o),...c,children:[a,u&&jsx($0,{})]})}function ua({items:e,separator:t=jsx(ChevronRight,{className:"h-3.5 w-3.5","aria-hidden":"true"}),homeIcon:r=false,LinkComponent:n="a",className:o}){return jsx("nav",{"aria-label":"Breadcrumb",className:f("flex",o),children:jsx("ol",{className:"flex flex-wrap items-center gap-1 text-sm",children:e.map((a,i)=>{let s=i===e.length-1,l=r===true?jsx(Home,{className:"h-3.5 w-3.5"}):r!==false&&r!==void 0?r:null,c=i===0&&l?l:a.icon;return jsxs("li",{className:"flex items-center gap-1",children:[i>0&&jsx("span",{className:"text-secondary-400 dark:text-secondary-500",children:t}),s?jsxs("span",{"aria-current":"page",className:f("flex items-center gap-1 font-medium text-primary-800 dark:text-primary-100",c&&"gap-1.5"),children:[c,a.label]}):a.href?jsxs(n,{href:a.href,className:f("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",c&&"gap-1.5"),children:[c,a.label]}):jsxs("span",{className:"flex items-center gap-1 text-secondary-500 dark:text-secondary-400",children:[c,a.label]})]},i)})})})}function pa(e,t){let r=[];for(let n=e;n<=t;n++)r.push(n);return r}function q0(e,t,r){let n=r*2+5;if(t<=n)return pa(1,t);let o=Math.max(e-r,1),a=Math.min(e+r,t),i=o>2,s=a<t-1;return !i&&s?[...pa(1,3+r*2),"\u2026",t]:i&&!s?[1,"\u2026",...pa(t-(3+r*2)+1,t)]:[1,"\u2026",...pa(o,a),"\u2026",t]}var td={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"},Wn={sm:"h-3.5 w-3.5",md:"h-4 w-4",lg:"h-5 w-5"};function Yn({onClick:e,disabled:t,active:r,size:n,"aria-label":o,children:a}){return jsx("button",{type:"button",onClick:e,disabled:t,"aria-label":o,"aria-current":r?"page":void 0,className:f("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",td[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:a})}function ma({totalPages:e,currentPage:t,onPageChange:r,siblingCount:n=2,showFirstLast:o=true,showPageCount:a=false,size:i="md",className:s}){if(e<=1)return null;let l=q0(t,e,n);return jsxs("nav",{"aria-label":"Pagination",className:f("flex items-center gap-1",s),children:[o&&jsx(Yn,{size:i,onClick:()=>r(1),disabled:t===1,"aria-label":"First page",children:jsx(ChevronsLeft,{className:Wn[i]})}),jsx(Yn,{size:i,onClick:()=>r(t-1),disabled:t===1,"aria-label":"Previous page",children:jsx(ChevronLeft,{className:Wn[i]})}),l.map((c,u)=>c==="\u2026"?jsx("span",{className:f("inline-flex items-center justify-center text-secondary-400",td[i]),"aria-hidden":"true",children:jsx(MoreHorizontal,{className:Wn[i]})},`ellipsis-${u}`):jsx(Yn,{size:i,active:c===t,onClick:()=>r(c),"aria-label":`Page ${c}`,children:c},c)),jsx(Yn,{size:i,onClick:()=>r(t+1),disabled:t===e,"aria-label":"Next page",children:jsx(ChevronRight,{className:Wn[i]})}),o&&jsx(Yn,{size:i,onClick:()=>r(e),disabled:t===e,"aria-label":"Last page",children:jsx(ChevronsRight,{className:Wn[i]})}),a&&jsxs("span",{className:"ml-2 text-sm text-secondary-500 dark:text-secondary-400",children:["Page ",t," of ",e]})]})}function rd({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:f("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:f(t==="full"?"text-[0.6rem] leading-tight":""),children:e.label})]})}function eh({group:e,mode:t,disabled:r=false}){return jsxs("div",{className:f("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(rd,{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 Un({tabs:e,defaultTab:t,activeTab:r,onTabChange:n,mode:o,onModeChange:a,sticky:i=false,className:s}){let l=e.filter(x=>!x.hidden),[c,u]=useState(t??l[0]?.key??""),[p,m]=useState(o??"full"),[d,g]=useState(true),h=r??c,b=o??p,y=x=>{if(!l.find(L=>L.key===x)?.disabled){if(x===h&&b!=="icons"){g(L=>!L);return}u(x),n?.(x),g(true);}},N=l.find(x=>x.key===h)??l[0];return jsxs("div",{className:f("select-none border-b border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",i&&"sticky top-0 z-30",s),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:l.map(x=>jsxs("button",{type:"button",disabled:x.disabled,onClick:()=>y(x.key),className:f("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",x.disabled?"cursor-not-allowed border-transparent text-secondary-300 opacity-50 dark:text-secondary-600":x.key===h&&d?"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:[x.icon,x.label]},x.key))}),jsx("button",{type:"button",title:d?"Collapse ribbon":"Expand ribbon",onClick:()=>g(x=>!x),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:d?jsx(ChevronUp,{className:"h-4 w-4"}):jsx(ChevronDown,{className:"h-4 w-4"})})]}),d&&N&&b!=="icons"&&jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto px-2 py-1.5",children:N.groups.map((x,w)=>jsxs(On.Fragment,{children:[w>0&&jsx("div",{className:"mx-1 h-auto w-px self-stretch bg-primary-100 dark:bg-primary-800"}),jsx(eh,{group:x,mode:b,disabled:x.disabled||N.disabled})]},x.key))}),b==="icons"&&d&&N&&jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto px-2 py-1",children:N.groups.flatMap(x=>x.items.map(w=>jsx(rd,{item:x.disabled||N.disabled?{...w,disabled:true}:w,mode:"icons"},w.key)))})]})}var th={SideNav:ss,Header:ls,NavLink:cs,Breadcrumb:ua,Pagination:ma,RibbonBar:Un},us=th;var fa=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"}}),ha=cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),ga=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"}}),ba=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"}}),ya=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 va=createContext(null),ps=createContext(null);function ms({type:e="single",defaultValue:t=[],value:r,onValueChange:n,intent:o,size:a,className:i,children:s,...l}){let[c,u]=useState(t),p=r??c,m=useCallback(d=>{let g=h=>h.includes(d)?h.filter(b=>b!==d):e==="single"?[d]:[...h,d];n?n(g(p)):u(g);},[e,p,n]);return jsx(va.Provider,{value:{expandedItems:p,toggleItem:m,size:a},children:jsx("div",{className:f(ga({intent:o}),i),...l,children:s})})}function ah({value:e,className:t,children:r,...n}){let a=useContext(va)?.expandedItems.includes(e)??false;return jsx(ps.Provider,{value:{value:e,isExpanded:a},children:jsx("div",{className:f("",t),...n,children:r})})}function ih({className:e,children:t,...r}){let n=useContext(va),o=useContext(ps);return jsxs("button",{className:f("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 cursor-pointer gap-2 font-medium transition-colors",fa({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:f("shrink-0 transition-transform duration-200",o?.isExpanded&&"rotate-180")})]})}function sh({className:e,children:t,...r}){let n=useContext(va),o=useContext(ps);return jsx("div",{className:f("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:f("text-primary-500 dark:text-primary-400",ha({size:n?.size}),e),...r,children:t})})})}var Jn=createContext(null),ld=createContext(false);function fs({defaultValue:e="",value:t,onValueChange:r,intent:n,children:o,className:a}){let[i,s]=useState(e),l=t??i,c=useRef(new Map),u=useCallback(m=>{r?r(m):s(m);},[r]),p=useCallback((m,d)=>{d?c.current.set(m,d):c.current.delete(m);},[]);return jsx(Jn.Provider,{value:{activeValue:l,setActiveValue:u,intent:n,registerTrigger:p},children:jsx("div",{className:a,children:o})})}function uh({className:e,scrollable:t,...r}){let n=useContext(Jn),o=useRef(null),[a,i]=useState(null),s=useCallback(()=>{if(!n||!o.current)return;let p=o.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!p){i(null);return}let m=o.current.getBoundingClientRect(),d=p.getBoundingClientRect();i({left:d.left-m.left,width:d.width});},[n]);useLayoutEffect(s,[n?.activeValue,s]),useEffect(()=>{let u=new ResizeObserver(s);return o.current&&u.observe(o.current),()=>u.disconnect()},[s]);let l=n?.intent??"line",c=a&&(l==="line"||l==="underline");return jsxs("div",{ref:o,className:f(ba({intent:n?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,c&&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 ph({value:e,className:t,children:r,...n}){let o=useContext(Jn),a=o?.activeValue===e,i=useCallback(s=>o?.registerTrigger(e,s),[o,e]);return jsx("button",{ref:i,className:f(ya({intent:o?.intent}),t),role:"tab","data-active":a,"aria-selected":a,onClick:()=>o?.setActiveValue(e),...n,children:r})}function mh({className:e,children:t,...r}){let n=useContext(Jn);if(!n)return null;let o=On.Children.toArray(t).filter(i=>On.isValidElement(i)),a=Math.max(0,o.findIndex(i=>i.props.value===n.activeValue));return jsx("div",{className:f("overflow-hidden",e),...r,children:jsx(ld.Provider,{value:true,children:jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${a*100}%)`},children:o.map((i,s)=>jsx("div",{className:"w-full shrink-0","aria-hidden":s!==a,children:i},i.props.value??s))})})})}function fh({value:e,className:t,children:r,...n}){let o=useContext(Jn);return useContext(ld)?jsx("div",{className:f("pt-4",t),role:"tabpanel",...n,children:r}):o?.activeValue!==e?null:jsx("div",{className:f("pt-4",t),role:"tabpanel",...n,children:r})}var gh={Accordion:ms,Tabs:fs},hs=gh;var Qn=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"}}),wa=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 mr=[];function wh(e){mr.push(e);}function kh(e){let t=mr.indexOf(e);t!==-1&&mr.splice(t,1);}function bs(e){return mr.length>0&&mr[mr.length-1]===e}function Nh(e){let t=mr.indexOf(e);return t!==-1?t:mr.length}var ys=createContext(null);function Zn({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:o}){let a=useId();return useEffect(()=>{if(e)return wh(a),()=>kh(a)},[e,a]),useEffect(()=>{if(!e||!r)return;let i=s=>{s.key==="Escape"&&bs(a)&&t(false);};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e,r,t,a]),useEffect(()=>{if(!e||!r)return;let i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i;}},[e,r]),e?jsx(ys.Provider,{value:{id:a,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:createPortal(o,document.body)}):null}function vs({size:e,position:t="center",className:r,children:n,...o}){let a=useContext(ys);if(!a)return null;let s=200+Nh(a.id)*10,l=()=>{a.closeOnOutsideClick&&bs(a.id)&&a.onOpenChange(false);},c=t==="bottom";return a.modal?jsx("div",{className:f("animate-fade-in fixed inset-0 bg-black/50",c?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:s},onClick:l,children:jsx("div",{className:f(Qn({size:e}),c?"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:u=>u.stopPropagation(),...o,children:n})}):jsx("div",{className:f("fixed inset-0 flex items-center justify-center p-4",a.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:s},onClick:a.closeOnOutsideClick&&bs(a.id)?()=>a.onOpenChange(false):void 0,children:jsx("div",{className:f(Qn({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:a.closeOnOutsideClick?u=>u.stopPropagation():void 0,...o,children:n})})}function xs({className:e,...t}){return jsx("div",{className:f("mb-4 space-y-1",e),...t})}function ws({className:e,...t}){return jsx("h2",{className:f("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 ks({className:e,...t}){return jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Ns({className:e,...t}){return jsx("div",{className:f("mt-6 flex justify-end gap-2",e),...t})}function Ch({className:e,...t}){let r=useContext(ys);return jsx("button",{className:f("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 Mh={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 Cs({content:e,position:t="top",intent:r,delay:n=200,maxWidth:o,children:a,className:i}){let[s,l]=useState(false),[c,u]=useState();return jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let d=setTimeout(()=>l(true),n);u(d);},onMouseLeave:()=>{clearTimeout(c),l(false);},children:[a,s&&jsx("span",{className:f(wa({intent:r}),Mh[t],"pointer-events-none",o?"whitespace-normal":"whitespace-nowrap",i),style:o!==void 0?{maxWidth:o}:void 0,role:"tooltip",children:e})]})}var Lh={right:"drawer-enter-right",left:"drawer-enter-left",top:"drawer-enter-top",bottom:"drawer-enter-bottom"},Dh={right:e=>({width:e}),left:e=>({width:e}),top:e=>({height:e}),bottom:e=>({height:e})},Ah={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 ka({open:e,onOpenChange:t,side:r="right",size:n=r==="top"||r==="bottom"?"50vh":"24rem",backdrop:o=true,closeOnBackdropClick:a=true,children:i,className:s}){let l=useRef(null);return useEffect(()=>{if(!e)return;let c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c;}},[e]),useEffect(()=>{if(!e)return;function c(u){u.key==="Escape"&&t(false);}return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),useEffect(()=>{if(!e)return;let c=l.current;if(!c)return;let u=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');u[0]?.focus();function p(m){m.key!=="Tab"||u.length===0||(m.shiftKey?document.activeElement===u[0]&&(m.preventDefault(),u[u.length-1].focus()):document.activeElement===u[u.length-1]&&(m.preventDefault(),u[0].focus()));}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e]),e?createPortal(jsxs("div",{className:"fixed inset-0 z-50",role:"presentation",children:[o&&jsx("div",{className:"drawer-backdrop absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:()=>a&&t(false),"aria-hidden":"true"}),jsx("div",{ref:l,role:"dialog","aria-modal":"true",className:f("drawer-panel absolute flex flex-col","bg-white shadow-2xl dark:bg-primary-900",Ah[r],Lh[r],s),style:Dh[r](n),children:i})]}),document.body):null}function pd({children:e,className:t}){return jsx("div",{className:f("flex shrink-0 items-center justify-between border-b border-primary-100 px-5 py-4 dark:border-primary-800",t),children:e})}function md({children:e,className:t}){return jsx("div",{className:f("flex-1 overflow-y-auto px-5 py-4",t),children:e})}function fd({children:e,className:t}){return jsx("div",{className:f("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 hd({onClose:e,className:t}){return jsx("button",{type:"button",onClick:e,"aria-label":"Close drawer",className:f("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 gd({item:e,depth:t=0,onClose:r}){let[n,o]=useState(false),a=useRef(null),i=useRef(null),s=e.children&&e.children.length>0,l=useRef(null),c=()=>{l.current=setTimeout(()=>o(false),150);},u=()=>{l.current&&clearTimeout(l.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:a,role:"menuitem","aria-disabled":e.disabled,"aria-haspopup":s,"aria-expanded":s?n:void 0,className:f("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:()=>{u(),s&&o(true);},onMouseLeave:()=>{s&&c();},onClick:p=>{e.disabled||s||(e.onClick?.(p),r());},onKeyDown:p=>{e.disabled||((p.key==="Enter"||p.key===" ")&&(p.preventDefault(),s?o(m=>!m):(e.onClick?.(p),r())),p.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&&!s&&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}),s&&jsx(ChevronRight,{className:"ml-auto h-3.5 w-3.5 text-secondary-400"}),s&&n&&jsx("ul",{ref:i,role:"menu",onMouseEnter:u,onMouseLeave:c,className:f("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(p=>jsx(gd,{item:p,depth:t+1,onClose:r},p.key))})]})}function Vh({items:e,position:t,onClose:r}){let n=useRef(null),[o,a]=useState(t);return useEffect(()=>{let i=n.current;if(!i)return;let s=i.getBoundingClientRect(),l=window.innerWidth,c=window.innerHeight,{x:u,y:p}=t;u+s.width>l-8&&(u=Math.max(8,l-s.width-8)),p+s.height>c-8&&(p=Math.max(8,c-s.height-8)),a({x:u,y:p});},[t]),useEffect(()=>{let i=s=>{n.current&&!n.current.contains(s.target)&&r();};return document.addEventListener("mousedown",i,true),document.addEventListener("touchstart",i,true),document.addEventListener("scroll",r,{passive:true,capture:true}),()=>{document.removeEventListener("mousedown",i,true),document.removeEventListener("touchstart",i,true),document.removeEventListener("scroll",r,true);}},[r]),useEffect(()=>{let i=s=>{s.key==="Escape"&&r(),s.key==="Tab"&&s.preventDefault();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[r]),jsx("ul",{ref:n,role:"menu",style:{position:"fixed",left:o.x,top:o.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(i=>jsx(gd,{item:i,onClose:r},i.key))})}function Ss({items:e,children:t,disabled:r,onOpenChange:n,className:o}){let[a,i]=useState(false),[s,l]=useState({x:0,y:0}),c=useRef(null),u=useCallback((h,b)=>{r||(l({x:h,y:b}),i(true),n?.(true));},[r,n]),p=useCallback(()=>{i(false),n?.(false);},[n]),m=useCallback(h=>{h.preventDefault(),h.stopPropagation(),u(h.clientX,h.clientY);},[u]),d=useCallback(h=>{let b=h.touches[0];c.current=setTimeout(()=>{document.addEventListener("contextmenu",y=>y.preventDefault(),{capture:true,once:true}),u(b.clientX,b.clientY);},500);},[u]),g=useCallback(()=>{c.current&&clearTimeout(c.current);},[]);return jsxs(Fragment,{children:[jsx("div",{className:f("contents",o),style:{WebkitTouchCallout:"none",userSelect:"none"},onContextMenu:m,onTouchStart:d,onTouchEnd:g,onTouchMove:g,onTouchCancel:g,children:t}),a&&jsx(Vh,{items:e,position:s,onClose:p})]})}var _h={Dialog:Zn,Tooltip:Cs,Drawer:ka,ContextMenu:Ss},Ps=_h;var Ca=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"}}),cn=cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),no=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"}}),oo=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"}}),Ma=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 Ds({intent:e,className:t,children:r,...n}){return jsx("div",{className:f(no({intent:e}),t),role:"alert",...n,children:r})}function Xh({className:e,...t}){return jsx("h5",{className:f("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function Gh({className:e,...t}){return jsx("span",{className:f("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function qh({className:e,...t}){return jsx("div",{className:f("flex-1 min-w-0 space-y-1",e),...t})}function Jh({className:e,...t}){return jsx("p",{className:f("text-sm opacity-90",e),...t})}var Qh=0,Fr=[],Ta=new Map,Rs=new Set;function Zh(){return Fr}function Es(){Rs.forEach(e=>e());}function As(e){let t=Ta.get(e);t&&(clearTimeout(t),Ta.delete(e)),Fr=Fr.map(r=>r.id===e?{...r,exiting:true}:r),Es(),setTimeout(()=>{Fr=Fr.filter(r=>r.id!==e),Es();},200);}function eg(e){let t=`alert-${++Qh}`;Fr=[...Fr,{...e,id:t}],Es();let r=e.duration??5e3;if(r>0){let n=setTimeout(()=>{Ta.delete(t),As(t);},r);Ta.set(t,n);}return t}var Ls=16;function tg(e){Ls=e;}var rg={"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"},ng={"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"},og={success:CircleCheck,warning:TriangleAlert,error:CircleX,info:Info};function ag({alert:e,onClose:t}){let r=e.intent??"info",n=og[r],o=e.position??"top-right";return jsxs("div",{className:f(no({intent:r}),ng[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:f(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 ig=e=>e.startsWith("top");function sg(){let e=useSyncExternalStore(n=>(Rs.add(n),()=>Rs.delete(n)),Zh),t=useRef(Ls);if(useEffect(()=>{t.current=Ls;},[]),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:ig(n)?{top:`${t.current}px`}:void 0,className:f("pointer-events-none fixed z-100 flex flex-col gap-2",rg[n]),children:o.map(a=>jsx(ag,{alert:a,onClose:()=>As(a.id)},a.id))},n))}),document.body)}var yd=false;function lg(){if(yd)return;yd=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),createRoot(e).render(jsx(sg,{}));}function cg(){return useEffect(()=>{lg();},[]),{addAlert:eg,removeAlert:As}}function zs({value:e=0,size:t,intent:r,edge:n,showLabel:o=false,indeterminate:a=false,animated:i=false,duration:s=500,className:l,...c}){let u=Math.max(0,Math.min(100,e)),[p,m]=useState(0),d=useRef(0);useEffect(()=>{if(!a)return d.current=requestAnimationFrame(()=>{m(u);}),()=>{d.current&&cancelAnimationFrame(d.current);}},[u,a]);let g=o&&!a&&t!=="xs"&&t!=="sm",h=jsx("div",{role:"progressbar","aria-valuenow":a?void 0:u,"aria-valuemin":0,"aria-valuemax":100,className:f(Ca({size:t,intent:r,edge:n}),l),...c,children:a?jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsx("div",{className:f("progress-fill h-full rounded-full transition-[width] ease-out",i&&"animate-progress-shine"),style:{width:`${p}%`,transitionDuration:`${s}ms`},children:g&&jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(u),"%"]})})});return n==="top"||n==="bottom"?createPortal(h,document.body):h}function Sa({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 Hs({spinning:e=true,tip:t,size:r,className:n,children:o,...a}){return o?jsxs("div",{className:f("relative w-fit",n),...a,children:[jsx("div",{className:f("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(Sa,{size:r}),t&&jsx("span",{className:f(cn({size:r}),"select-none"),children:t})]})]}):e?jsxs("div",{className:f("inline-flex flex-col items-center gap-2",n),...a,children:[jsx(Sa,{size:r}),t&&jsx("span",{className:f(cn({size:r}),"select-none"),children:t})]}):null}var yg=0,io=[],Vs=new Set;function vg(){return io}function Cd(){Vs.forEach(e=>e());}function xg(e,t){let r=++yg;return io=[...io,{id:r,target:e,tip:t}],Cd(),()=>wg(r)}function wg(e){io=io.filter(t=>t.id!==e),Cd();}function kg(){return xg}var kd=false;function Ng(){if(kd||typeof document>"u")return;kd=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(Sg,{}));});}var Pa=new Map;function Cg(e){let t=Pa.get(e);if(t){t.count++;return}let r=getComputedStyle(e),n=e.style.position;r.position==="static"&&(e.style.position="relative"),Pa.set(e,{count:1,original:n});}function Mg(e){let t=Pa.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,Pa.delete(e)));}function Tg({entry:e}){return useEffect(()=>{let t=e.target;if(!Nd(t))return Cg(t),()=>Mg(t)},[e.target]),Nd(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(Sa,{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(Sa,{size:"md"}),e.tip&&jsx("span",{className:f(cn({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function Sg(){let e=useSyncExternalStore(t=>(Vs.add(t),()=>Vs.delete(t)),()=>vg());return e.length===0?null:jsx(Fragment,{children:e.map(t=>jsx(Tg,{entry:t},t.id))})}function Nd(e){return e===document.documentElement||e===document.body}typeof document<"u"&&Ng();function Md(e){if(e!==void 0)return typeof e=="number"?`${e}px`:e}function Ra({variant:e="text",animation:t="pulse",width:r,height:n,lines:o,className:a,style:i,...s}){let l=Md(r),c=Md(n);return e==="text"&&o!==void 0&&o>1?jsx("span",{className:f("flex flex-col gap-2",a),"aria-hidden":"true",role:"presentation",style:i,...s,children:Array.from({length:o},(u,p)=>jsx("span",{className:oo({variant:"text",animation:t}),style:{width:p===o-1?"60%":l??"100%",height:c}},p))}):jsx("span",{className:f(oo({variant:e,animation:t}),a),"aria-hidden":"true",role:"presentation",style:{width:l,height:c,...i},...s})}var Dg=0,Td=320;function Sd(e,t){let[r,n]=useState([]),o=useRef(new Map),a=useCallback(u=>{let p=o.current.get(u);p!==void 0&&(clearTimeout(p),o.current.delete(u));},[]),i=useCallback(u=>{a(u),n(p=>p.map(m=>m.id===u?{...m,_exiting:true}:m)),setTimeout(()=>n(p=>p.filter(m=>m.id!==u)),Td);},[a]),s=useCallback(u=>i(u),[i]),l=useCallback(()=>{o.current.forEach(clearTimeout),o.current.clear(),n(u=>u.map(p=>({...p,_exiting:true}))),setTimeout(()=>n([]),Td);},[]),c=useCallback(u=>{let p=`toast-${++Dg}`,m=u.position??e,d=u.duration!==void 0?u.duration:t;if(n(g=>[...g,{...u,id:p,position:m,duration:d,_exiting:false}]),d>0){let g=setTimeout(()=>{o.current.delete(p),i(p);},d);o.current.set(p,g);}return p},[e,t,i]);return useEffect(()=>{let u=o.current;return ()=>{u.forEach(clearTimeout),u.clear();}},[]),{items:r,toast:c,dismiss:s,dismissAll:l}}var lo=createContext(null),Og={"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"},$g={"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"},Kg={"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"},jg={default:Bell,success:CheckCircle2,danger:XCircle,warning:AlertTriangle,info:Info};function Wg({item:e,onDismiss:t}){let r=e.variant??"default",n=e.position??"top-right",o=e.dismissible!==false,a=jg[r],i=()=>{e.onDismiss?.(e.id),t(e.id);};return jsx("div",{className:f("toast-wrapper",e._exiting&&`toast-wrapper-exiting ${Kg[n]}`),children:jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:f(Ma({variant:r}),"toast-item pointer-events-auto",!e._exiting&&$g[n]),children:[jsx(a,{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:f("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})]}),o&&jsx("button",{type:"button",onClick:i,"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 Ea({children:e,defaultPosition:t="top-right",defaultDuration:r=4e3}){let{items:n,toast:o,dismiss:a,dismissAll:i}=Sd(t,r),s=n.reduce((l,c)=>{let u=c.position??t;return (l[u]??(l[u]=[])).push(c),l},{});return jsxs(lo.Provider,{value:{toast:o,dismiss:a,dismissAll:i},children:[e,typeof document<"u"&&createPortal(jsx(Fragment,{children:Object.entries(s).map(([l,c])=>jsx("div",{className:f("pointer-events-none fixed z-[100] flex flex-col gap-2",Og[l]),children:c.map(u=>jsx(Wg,{item:u,onDismiss:a},u.id))},l))}),document.body)]})}function La(){let e=useContext(lo);if(!e)throw new Error("useToast must be used within a <ToastProvider>");return e}var Xg={Alert:Ds,ProgressBar:zs,Spin:Hs,Skeleton:Ra,ToastProvider:Ea,useToast:La},Bs=Xg;var Ld="#1c1914",Dd="#130f0b",db="#2e261e",$s="#504638",dn="#6b5d4d",Aa=`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")`,ub=[{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 Ks({photos:e,layout:t="strip",actions:r=ub,onAction:n,className:o,showGrain:a=true,sheetTitle:i,sheetLabel:s}){let[l,c]=useState(null),[u,p]=useState(new Set),m=useCallback(b=>c(b),[]),d=useCallback(()=>c(null),[]),g=useCallback((b,y)=>{if(r.find(N=>N.key===b)?.toggle){let N=`${y}-${b}`;p(x=>{let w=new Set(x);return w.has(N)?w.delete(N):w.add(N),w});}n?.(b,e[y],y);},[r,n,e]);return jsxs(Fragment,{children:[jsx(t==="strip"?pb:t==="sheet"?mb:fb,{photos:e,onPhotoClick:m,showGrain:a,className:o,sheetTitle:i,sheetLabel:s}),l!==null&&createPortal(jsx(hb,{photos:e,currentIndex:l,onIndexChange:c,onClose:d,actions:r,activeActions:u,onAction:g,showGrain:a}),document.body)]})}function Ed({count:e=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Ld},children:Array.from({length:e}).map((t,r)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:db}},r))})}function pb({photos:e,onPhotoClick:t,showGrain:r,className:n}){let o=useRef(null);return jsxs("div",{className:f("select-none rounded-lg overflow-hidden",n),style:{background:Dd},children:[jsx(Ed,{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:Ld,scrollSnapType:"x mandatory"},children:e.map((a,i)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(i),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:$s,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:Aa,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:dn},children:[String(i+1).padStart(2,"0"),i%2===0?"":"A"]})]},i))}),jsx(Ed,{count:Math.max(30,e.length*6)})]})}function mb({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:o,sheetLabel:a}){return jsxs("div",{className:f("rounded-lg p-5",n),style:{background:Dd},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:dn},children:o??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:dn},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((i,s)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${s*50}ms both`},onClick:()=>t(s),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:dn},children:String(s+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:$s,aspectRatio:"3/2"},children:[jsx("img",{src:i.src,alt:i.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:Aa}}),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:i.title})})]})]},s))})]})}function fb({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[o,a]=useState(false),[i,s]=useState(null),l=Math.min(e.length,8),c=e.slice(0,l),u=m=>{let d=Math.sin(m*137.508+1)*1e4,g=(d%12-6).toFixed(1),h=(d/7%8-4).toFixed(1),b=(d/13%6-3).toFixed(1);return `rotate(${g}deg) translate(${h}px, ${b}px)`},p=(m,d)=>{let g=(d-1)/2,h=((m-g)*7).toFixed(1),b=((m-g)*110).toFixed(0),y=(-Math.abs(m-g)*10+(i===m?-18:0)).toFixed(0);return `translateX(${b}px) translateY(${y}px) rotate(${h}deg)`};return jsxs("div",{className:f("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),s(null);},children:c.map((m,d)=>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?`${d*35}ms`:`${(l-d)*25}ms`,transform:o?p(d,c.length):u(d),zIndex:o?d+1:c.length-d,width:220,height:147},onClick:()=>t(d),onMouseEnter:()=>o&&s(d),onMouseLeave:()=>s(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:o&&i===d?"rgba(217,171,89,0.5)":$s,boxShadow:o&&i===d?"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:m.src,alt:m.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:Aa}}),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&&i===d&&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:m.title})})]})},d))}),e.length>l&&jsxs("span",{className:"font-mono text-xs",style:{color:dn},children:["+ ",e.length-l," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:dn,opacity:o?0:.7},children:"Hover to explore"})]})}function hb({photos:e,currentIndex:t,onIndexChange:r,onClose:n,actions:o,activeActions:a,onAction:i,showGrain:s}){let l=e[t],[c,u]=useState(1),[p,m]=useState({x:0,y:0}),[d,g]=useState(false),[h,b]=useState(false),y=useRef(false),v=useRef({x:0,y:0}),N=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>b(true));},[]),useEffect(()=>{let C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C;}},[]),useEffect(()=>{let C=I=>{switch(I.key){case "Escape":n();break;case "ArrowLeft":x(-1);break;case "ArrowRight":x(1);break;case "i":case "I":g(k=>!k);break}};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)}),useEffect(()=>{let C=N.current;if(!C)return;let I=k=>{k.preventDefault();let T=k.deltaY<0?1.12:.89;u(R=>{let O=Math.min(8,Math.max(1,R*T));return O<=1&&m({x:0,y:0}),O});};return C.addEventListener("wheel",I,{passive:false}),()=>C.removeEventListener("wheel",I)},[]);let x=useCallback(C=>{let I=t+C;I>=0&&I<e.length&&(r(I),u(1),m({x:0,y:0}));},[t,e.length,r]),w=useCallback(C=>{c<=1||(y.current=true,v.current={x:C.clientX,y:C.clientY},C.target.setPointerCapture(C.pointerId));},[c]),L=useCallback(C=>{if(!y.current)return;let I=C.clientX-v.current.x,k=C.clientY-v.current.y;v.current={x:C.clientX,y:C.clientY},m(T=>({x:T.x+I/c,y:T.y+k/c}));},[c]),P=useCallback(()=>{y.current=false;},[]),A=useCallback(()=>{c>1?(u(1),m({x:0,y:0})):u(2.5);},[c]),D=C=>a.has(`${t}-${C}`),S=l.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}),s&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Aa,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:[c.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>u(C=>Math.min(8,C*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:()=>{u(C=>{let I=Math.max(1,C*.7);return I<=1&&m({x:0,y:0}),I});},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:N,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:c>1?"grab":"default"},onPointerDown:w,onPointerMove:L,onPointerUp:P,onDoubleClick:A,children:[jsx("img",{src:l.src,alt:l.alt??l.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(${c}) translate(${p.x}px, ${p.y}px)`,transition:y.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:C=>{C.stopPropagation(),x(-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:C=>{C.stopPropagation(),x(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:f("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",d?"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:[l.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:l.title}),l.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:l.description}),S&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[S.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.camera,S.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),S.lens&&S.lens]}),(S.aperture||S.shutter||S.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[S.aperture,S.shutter,S.iso&&`ISO ${S.iso}`].filter(Boolean).join(" \xB7 ")]}),S.date&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.date]}),S.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.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(C=>{let I=C.toggle&&D(C.key);return jsx("button",{className:f("rounded-full p-2.5 transition-all duration-200",I?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>i(C.key,t),title:C.label,children:I&&C.activeIcon?C.activeIcon:C.icon},C.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:f("rounded-full p-2.5 transition-all duration-200",d?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>g(C=>!C),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var js="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,jsxs,Fragment}from'react/jsx-runtime';import $n,{createContext,forwardRef,useState,useEffect,useRef,useCallback,useImperativeHandle,useId,useMemo,useSyncExternalStore,useContext,useLayoutEffect}from'react';import {Heart,ThumbsDown,Bookmark,Share2,Download,Undo2,Redo2,Save,Bold,Italic,Underline,Strikethrough,Heading1,Heading2,Heading3,Type,AlignLeft,AlignCenter,AlignRight,AlignJustify,List,ListOrdered,Image,Video,Link,Table,Code,Quote,Minus,Palette,Highlighter,Subscript,Superscript,Eraser,Sun,Moon,FileText,EyeOff,Eye,Info,CheckCircle,AlertTriangle,AlertCircle,ChevronUp,ChevronDown,BetweenHorizontalStart,BetweenHorizontalEnd,Trash2,BetweenVerticalStart,BetweenVerticalEnd,TableCellsMerge,TableCellsSplit,Search,X,Replace,Check,Inbox,Plus,Pencil,ArrowUpDown,ArrowUp,ArrowDown,ChevronRight,TrendingDown,TrendingUp,Menu,ChevronsLeft,ChevronLeft,PanelLeft,MoreHorizontal,Home,ChevronsRight,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,CornerRightDown,Folder,Command,Clock,XCircle,CheckCircle2,Bell,FileArchive,Database,FileSpreadsheet,Terminal,FileCode,Music,File,Dot,CircleX,TriangleAlert,CircleCheck}from'lucide-react';import {createPortal}from'react-dom';import {createRoot}from'react-dom/client';import {Marked,marked}from'marked';import uy from'katex';import {ReactNodeViewRenderer,EditorContent,NodeViewWrapper,useEditor}from'@tiptap/react';import {RemoveMarkStep,Transform,liftTarget,joinPoint,canSplit,ReplaceStep,ReplaceAroundStep,canJoin}from'@tiptap/pm/transform';import {createParagraphNear,deleteSelection,exitCode,joinUp,joinDown,joinBackward,joinForward,joinTextblockBackward,joinTextblockForward,lift,liftEmptyBlock,newlineInCode,selectNodeBackward,selectNodeForward,selectParentNode,selectTextblockEnd,selectTextblockStart,setBlockType,wrapIn}from'@tiptap/pm/commands';import {Plugin,PluginKey,Selection,TextSelection,AllSelection,NodeSelection}from'@tiptap/pm/state';import {Fragment as Fragment$1,Slice,Node,Schema,DOMParser}from'@tiptap/pm/model';import {liftListItem,sinkListItem,wrapInList}from'@tiptap/pm/schema-list';import {DecorationSet,Decoration}from'@tiptap/pm/view';import'@tiptap/pm/keymap';import vk from'@tiptap/starter-kit';import xk from'@tiptap/extension-underline';import wk from'@tiptap/extension-text-align';import {Color}from'@tiptap/extension-color';import Nk from'@tiptap/extension-highlight';import Ck from'@tiptap/extension-link';import Tk from'@tiptap/extension-youtube';import Mk from'@tiptap/extension-placeholder';import Sk from'@tiptap/extension-character-count';import Pk from'@tiptap/extension-typography';import Rk from'@tiptap/extension-subscript';import Ek from'@tiptap/extension-superscript';import {Table as Table$1}from'@tiptap/extension-table';import Dk from'@tiptap/extension-table-row';import Ak from'@tiptap/extension-table-header';import Ik from'@tiptap/extension-table-cell';import ck from'@tiptap/extension-image';function f(...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"}}),So=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"}}),Po=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"}}),Xr=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"}}),Ro=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"}}),Eo=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"}}),Lo=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"}}),Do=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"}}),Pn=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"}}),Ao=cva("inline-flex items-center",{variants:{size:{sm:"gap-0.5 [&_.rating-icon]:h-4 [&_.rating-icon]:w-4",md:"gap-1 [&_.rating-icon]:h-6 [&_.rating-icon]:w-6",lg:"gap-1.5 [&_.rating-icon]:h-8 [&_.rating-icon]:w-8"}},defaultVariants:{size:"md"}}),Io=cva("inline-flex items-center justify-center rounded font-mono font-medium select-none",{variants:{size:{xs:"h-4 min-w-4 px-1 text-[0.6rem]",sm:"h-5 min-w-5 px-1.5 text-xs",md:"h-6 min-w-6 px-2 text-sm",lg:"h-8 min-w-8 px-2.5 text-base"},variant:{default:"border border-secondary-300 bg-secondary-100 text-secondary-700 shadow-[0_2px_0_0_var(--color-secondary-300)] dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:shadow-[0_2px_0_0_var(--color-secondary-600)]",outline:"border border-secondary-400 bg-transparent text-secondary-700 dark:border-secondary-500 dark:text-secondary-300",ghost:"text-secondary-600 dark:text-secondary-400"}},defaultVariants:{size:"sm",variant:"default"}}),Rn=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"}}),zo=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 Vt({intent:e,size:t,className:r,...n}){return jsx("button",{className:f(Ur({intent:e,size:t}),r),...n})}function yi(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let n=yi(r.children,t);if(n)return n}}}function vi(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(...vi(r.children));return t}var Fo=40,om=200,xi=150,ic=120;function _o(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Fo;return {animation:`dropdown-item-out ${xi}ms ease-in both ${a}ms`}}let o=e*Fo;return {animation:`dropdown-item-in ${om}ms ease-out both ${o}ms`}}function sc(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Fo+xi;return {animation:`dropdown-container-out ${ic}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function lc({options:e,onSelect:t,animated:r=true,closing:n=false,depth:o=0}){let[a,i]=useState(null),s=useRef(void 0),l=u=>{s.current&&clearTimeout(s.current),i(u);},c=()=>{s.current=setTimeout(()=>i(null),150);};return useEffect(()=>()=>{s.current&&clearTimeout(s.current);},[]),jsx("div",{className:f("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%"}:{},...sc(e.length,n,r)},role:"listbox",children:e.map((u,p)=>{let m=!!u.children?.length,d=a===u.value;return jsxs("div",{className:"relative",style:_o(p,e.length,n,r),onMouseEnter:()=>l(u.value),onMouseLeave:c,children:[jsxs("div",{role:"option","aria-selected":false,"aria-disabled":u.disabled,className:f("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",u.disabled&&"pointer-events-none opacity-50"),onClick:()=>{u.disabled||m||t(u.value,u);},children:[u.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:u.icon}),jsx("span",{className:"flex-1 truncate",children:u.label??u.value}),m&&jsx(ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),m&&d&&jsx(lc,{options:u.children,onSelect:t,animated:r,depth:o+1})]},u.value)})})}function am({options:e,filter:t,multiple:r,selected:n,canAdd:o,animated:a=true,closing:i=false,onSelect:s,onToggle:l,onAdd:c}){let u=useMemo(()=>vi(e),[e]),p=t.toLowerCase(),m=t?u.filter(h=>(h.label??h.value).toLowerCase().includes(p)||h.value.toLowerCase().includes(p)):u,d=m.length===0&&!o||o?1:0,g=m.length+d;return jsxs("div",{className:f("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:sc(g,i,a),children:[m.map((h,b)=>{let y=r&&n.includes(h.value);return jsxs("div",{role:"option","aria-selected":r?y:false,"aria-disabled":h.disabled,className:f("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",h.disabled&&"pointer-events-none opacity-50"),style:_o(b,g,i,a),onClick:()=>{h.disabled||(r?l(h.value):s(h.value,h));},children:[r&&jsx("span",{className:f("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",y?"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:y&&jsx(Check,{className:"h-3 w-3"})}),h.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:h.icon}),jsx("span",{className:"truncate",children:h.label??h.value})]},h.value)}),m.length===0&&!o&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:_o(0,1,i,a),children:"No matches"}),o&&jsxs("div",{className:f("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:_o(m.length,g,i,a),onClick:c,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 wi(e){let{options:t,placeholder:r="Select\u2026",editable:n=false,onAddItem:o,disabled:a=false,align:i="left",className:s,size:l="md",animated:c=true,name:u,intent:p="default",clearable:m=false,id:d,"aria-describedby":g,"aria-invalid":h}=e,b=e.multiple===true,[y,v]=useState(b?void 0:e.defaultValue),[N,x]=useState(b?e.defaultSelected??[]:[]),w=b?e.selected??N:[],[L,P]=useState(false),[A,D]=useState(false),[S,C]=useState(""),I=useRef(null),k=useRef(null),M=useRef(void 0),R=useCallback(()=>{if(!c||!L){P(false),C("");return}D(true);let le=(Math.max(t.length,1)-1)*Fo+xi+ic+20;M.current=setTimeout(()=>{P(false),D(false),C("");},le);},[c,L,t.length]);useEffect(()=>()=>{M.current&&clearTimeout(M.current);},[]);let $=b?void 0:e.value??y,E=useMemo(()=>$?yi(t,$):void 0,[t,$]);useEffect(()=>{if(!L)return;let G=le=>{I.current&&!I.current.contains(le.target)&&R();};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[L,R]),useEffect(()=>{if(!L)return;let G=le=>{le.key==="Escape"&&R();};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[L,R]);let ne=useCallback((G,le)=>{b||(e.value===void 0&&v(G),e.onChange?.(G,le)),M.current&&clearTimeout(M.current),P(false),D(false),C("");},[b,e]),U=useCallback(G=>{if(!b)return;let le=e.selected??N,ke=le.includes(G)?le.filter(B=>B!==G):[...le,G];e.selected===void 0&&x(ke),e.onSelectionChange?.(ke),e.onChange?.(ke);},[b,N,e]),z=S.toLowerCase(),H=useMemo(()=>!n||!S.trim()?false:!vi(t).some(le=>le.value.toLowerCase()===z||(le.label??le.value).toLowerCase()===z),[n,z,t]),_=useCallback(()=>{let G=S.trim();G&&(o?.(G),C(""));},[S,o]),V=useCallback(G=>{G.stopPropagation(),b?(x([]),e.onSelectionChange?.([]),e.onChange?.([])):(v(void 0),e.onChange?.("",void 0));},[b,e]),oe=useCallback(G=>{G.key==="Enter"&&H&&(G.preventDefault(),_());},[H,_]),be=useCallback(()=>{a||(L?R():(M.current&&clearTimeout(M.current),D(false),P(true),C(""),n&&requestAnimationFrame(()=>k.current?.focus())));},[a,L,R,n]),T;if(b){let G=w.length;G===0?T="":G<=2?T=w.map(le=>yi(t,le)).map(le=>le?le.label??le.value:"").filter(Boolean).join(", "):T=`${G} selected`;}else T=E?E.label??E.value:"";let F=b||n,re=p==="danger"||h===true,W=m&&(b?w.length>0:!!T);return jsxs("div",{ref:I,className:f("relative inline-block min-w-44",s),children:[u&&!b&&jsx("input",{type:"hidden",name:u,value:$??""}),u&&b&&w.map(G=>jsx("input",{type:"hidden",name:`${u}[]`,value:G},G)),d&&!n&&jsx("input",{type:"text",id:d,className:"sr-only",readOnly:true,tabIndex:-1,value:T??"",onChange:()=>{}}),jsxs("div",{className:f(Xr({state:re?"error":"default",size:l}),"flex cursor-pointer items-center gap-1",a&&"pointer-events-none opacity-50"),onClick:be,role:"combobox","aria-expanded":L,"aria-haspopup":"listbox","aria-invalid":re||void 0,"aria-describedby":g,children:[n?jsx("input",{ref:k,id:d,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:L?S:T,placeholder:r,disabled:a,onChange:G=>{C(G.target.value),L||P(true);},onKeyDown:oe,onClick:G=>{G.stopPropagation(),L||P(true);}}):jsx("span",{className:f("flex-1 truncate",!T&&"text-secondary-400 dark:text-secondary-600"),children:T||r}),E?.icon&&!n&&!b&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:E.icon}),b&&w.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:w.length}),W&&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:V,children:jsx(X,{className:"h-3 w-3"})}),jsx(ChevronDown,{className:f("text-primary-400 h-4 w-4 shrink-0 transition-transform",L&&"rotate-180")})]}),L&&jsx("div",{className:f(i==="right"?"right-0":"left-0","absolute w-full"),children:F?jsx(am,{options:t,filter:S,multiple:b,selected:w,canAdd:H,animated:c,closing:A,onSelect:ne,onToggle:U,onAdd:_}):jsx(lc,{options:t,onSelect:ne,animated:c,closing:A})})]})}function cm(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var Bo=40,dm=200,Mi=150,dc=120;function Ti(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Bo;return {animation:`dropdown-item-out ${Mi}ms ease-in both ${a}ms`}}let o=e*Bo;return {animation:`dropdown-item-in ${dm}ms ease-out both ${o}ms`}}function um(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Bo+Mi;return {animation:`dropdown-container-out ${dc}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function qr({label:e,items:t,intent:r,size:n,align:o="left",className:a,disabled:i,editable:s=false,onAddItem:l,multiple:c=false,selected:u=[],onSelectionChange:p,animated:m=true,chevron:d=true,...g}){let[h,b]=useState(false),[y,v]=useState(false),[N,x]=useState(""),w=useRef(null),L=useRef(null),P=useRef(void 0);useEffect(()=>()=>{P.current&&clearTimeout(P.current);},[]);let A=useCallback(()=>{if(!m||!h){b(false),x("");return}v(true);let z=(Math.max(t.length,1)-1)*Bo+Mi+dc+20;P.current=setTimeout(()=>{b(false),v(false),x("");},z);},[m,h,t.length]),D=useCallback(()=>{i||(h?A():(P.current&&clearTimeout(P.current),v(false),b(true),x(""),s&&requestAnimationFrame(()=>L.current?.focus())));},[i,h,A,s]);useEffect(()=>{if(!h)return;let U=z=>{w.current&&!w.current.contains(z.target)&&A();};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[h,A]),useEffect(()=>{if(!h)return;let U=z=>{z.key==="Escape"&&A();};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[h,A]);let S=N.toLowerCase(),C=useMemo(()=>N?t.filter(U=>(typeof U.label=="string"?U.label:U.key??"").toLowerCase().includes(S)):t,[t,S]),I=useMemo(()=>!s||!N.trim()?false:!t.some(U=>(typeof U.label=="string"?U.label:U.key??"").toLowerCase()===S),[s,S,t]),k=useCallback(()=>{let U=N.trim();U&&(l?.(U),x(""));},[N,l]),M=useCallback(U=>{U.key==="Enter"&&I&&(U.preventDefault(),k());},[I,k]),R=useCallback(U=>{let z=u.includes(U)?u.filter(H=>H!==U):[...u,U];p?.(z);},[u,p]),$=c&&u.length>0?jsxs(Fragment,{children:[e," ",jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:u.length})]}):e,E=C.length===0&&!I||I?1:0,ne=C.length+E;return jsxs("div",{ref:w,className:"relative inline-block",children:[jsxs("button",{type:"button",onClick:D,disabled:i,className:f(Ur({intent:r,size:n}),"inline-flex items-center gap-1",a),"aria-haspopup":c?"listbox":"true","aria-expanded":h?"true":"false",...g,children:[$,d&&jsx(ChevronDown,{className:f("h-3.5 w-3.5 transition-transform",h&&"rotate-180")})]}),h&&jsxs("div",{className:f("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:um(ne,y,m),role:c?"listbox":"menu","aria-multiselectable":c||void 0,children:[s&&jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsx("input",{ref:L,type:"text",value:N,onChange:U=>x(U.target.value),onKeyDown:M,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:[C.map((U,z)=>{let H=cm(U,z),_=c&&u.includes(H);return jsxs($n.Fragment,{children:[U.divider&&jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxs("button",{type:"button",role:c?"option":"menuitem","aria-selected":c?_:void 0,disabled:U.disabled,className:f("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",U.disabled&&"pointer-events-none opacity-50"),style:Ti(z,ne,y,m),onClick:()=>{c?R(H):(U.onClick?.(),P.current&&clearTimeout(P.current),b(false),v(false),x(""));},children:[c&&jsx("span",{className:f("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",_?"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:_&&jsx(Check,{className:"h-3 w-3"})}),jsx("span",{className:"flex-1 truncate",children:U.label})]})]},H)}),C.length===0&&!I&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:Ti(0,1,y,m),children:"No matches"}),I&&jsxs("button",{type:"button",className:f("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:Ti(C.length,ne,y,m),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",N.trim(),"\u201D"]})]})]})]})]})}function Si({intent:e,size:t,className:r,...n}){return jsx("span",{className:f(So({intent:e,size:t}),r),...n})}function Pi({intent:e,size:t,variant:r,icon:n,removable:o,onRemove:a,disabled:i,dot:s,className:l,children:c,...u}){return jsxs("span",{className:f(zo({intent:e,size:t,variant:r}),i&&"pointer-events-none opacity-50",l),"aria-disabled":i,...u,children:[s&&jsx("span",{className:f("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}),c&&jsx("span",{children:c}),o&&jsx("button",{type:"button","aria-label":"Remove tag",onClick:p=>{p.stopPropagation(),a?.();},disabled:i,className:f("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 gm={danger:"bg-danger-500",success:"bg-success-500",warning:"bg-warning-500",info:"bg-primary-500",primary:"bg-secondary-500"};function Ri({children:e,show:t=true,content:r,dot:n,intent:o="danger",size:a="md",placement:i="top-right",pulse:s=false,className:l}){let c=n??r==null,u=c?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxs("span",{className:f(Po({intent:o,size:a,dot:c,placement:i}),l),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[s&&jsx("span",{className:f("absolute inset-0 rounded-full animate-ping opacity-60",gm[o??"danger"]),"aria-hidden":"true"}),u]})]})}function _t({intent:e,size:t,className:r,...n}){return jsx("label",{className:f(Ro({intent:e,size:t}),r),...n})}var vm={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"}},xm={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 Ft({state:e="default",inputSize:t="md",className:r,prefix:n,suffix:o,action:a,...i}){if(!n&&!o&&!a)return jsx("input",{className:f(Xr({state:e,size:t}),r),...i});let s=vm[t??"md"],l=xm[e??"default"];return jsxs("div",{className:f("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",s.wrapper,l,r),children:[n&&jsx("span",{className:f("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",s.prefix),children:n}),jsx("input",{className:f("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",s.input,n&&"pl-2"),...i}),o&&jsx("span",{className:f("flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",s.icon),children:o}),a&&jsx("button",{type:"button",onClick:a.onClick,"aria-label":a["aria-label"]??"Action",className:f("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",s.icon),children:a.icon})]})}var Tm={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]"},Mm={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 Sm(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 i=o.trim();i&&(n+=i.split(/\s+/).length),o="";};for(let i of e)r.test(i)?(a(),n+=1):o+=i;return a(),n}function Ei({state:e="default",size:t="md",showWordCount:r=false,maxWords:n,className:o,value:a,defaultValue:i,onChange:s,disabled:l,...c}){let[u,p]=useState(()=>i??""),m=a!==void 0?String(a):u,d=useCallback(b=>{a===void 0&&p(b.target.value),s?.(b);},[a,s]),g=useMemo(()=>Sm(m),[m]),h=n!=null&&g>n;return jsxs("div",{className:f("inline-flex w-full flex-col",o),children:[jsx("textarea",{value:m,onChange:d,disabled:l,className:f("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",Tm[t],Mm[h?"error":e],l&&"pointer-events-none opacity-50"),...c}),(r||n!=null)&&jsx("span",{className:f("mt-1 self-end text-xs",h?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:n!=null?`${g} / ${n} words`:`${g} words`})]})}var Dm={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"}},Am={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function Rr({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:n,uncheckedContent:o,intent:a,size:i,label:s,id:l,className:c,disabled:u,...p}){let m=useId(),d=l??m,g=i??"md",h=a??"primary",b=Dm[g],y=n!=null||o!=null,[v,N]=useState(t),x=e??v,w=useCallback(L=>{let P=L.target.checked;e===void 0&&N(P),r?.(P);},[e,r]);return jsxs("label",{htmlFor:d,className:f("inline-flex cursor-pointer items-center gap-2",u&&"pointer-events-none opacity-50",c),children:[jsx("input",{...p,id:d,type:"checkbox",role:"switch",className:"sr-only",checked:x,disabled:u,onChange:w,"aria-checked":x}),jsxs("span",{className:f("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",y?b.trackH:b.trackFixed,Do({intent:a,size:i,checked:x?"on":"off"})),children:[y?jsxs(Fragment,{children:[jsxs("span",{className:f("pointer-events-none invisible inline-grid",b.icon),children:[jsx("span",{className:f("[grid-area:1/1] whitespace-nowrap",b.pad),children:n}),jsx("span",{className:f("[grid-area:1/1] whitespace-nowrap",b.pad),children:o})]}),jsx("span",{className:f("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",b.contentLeft,b.icon,Am[h],x?"opacity-100":"opacity-0"),children:n}),jsx("span",{className:f("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",x?"opacity-0":"opacity-100"),children:o})]}):null,jsx("span",{className:f("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",b.thumb,b.thumbTop,x?b.thumbOn:b.thumbOff)})]}),s&&jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:s})]})}var _m={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function An({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:n,intent:o,size:a,label:i,id:s,className:l,disabled:c,...u}){let p=useId(),m=s??p,d=a??"md",[g,h]=useState(t),b=e??g,y=useCallback(N=>{let x=N.target.checked;e===void 0&&h(x),n?.(x);},[e,n]),v=b||r;return jsxs("label",{htmlFor:m,className:f("inline-flex cursor-pointer items-center gap-2 select-none",c&&"pointer-events-none opacity-50",l),children:[jsx("input",{...u,id:m,type:"checkbox",className:"sr-only",checked:b,disabled:c,onChange:y}),jsx("span",{className:f(Eo({intent:o,size:a,checked:v?"on":"off"})),children:jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:f("text-white transition-all duration-200",_m[d],v?"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"})})}),i&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:i})]})}var hc=createContext(null);function Li({name:e,value:t,defaultValue:r,onValueChange:n,intent:o,size:a,disabled:i,orientation:s="vertical",className:l,children:c}){let u=useId(),p=e??u,[m,d]=useState(r),g=t??m,h=useCallback(b=>{t===void 0&&d(b),n?.(b);},[t,n]);return jsx(hc.Provider,{value:{name:p,value:g,onChange:h,intent:o,size:a,disabled:i},children:jsx("div",{role:"radiogroup",className:f("flex gap-2",s==="vertical"?"flex-col":"flex-row flex-wrap",l),children:c})})}var Km={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function Di({value:e,intent:t,size:r,label:n,id:o,className:a,disabled:i,...s}){let l=useId(),c=o??l,u=useContext(hc),p=t??u?.intent,m=r??u?.size,d=m??"md",g=i??u?.disabled,h=s.name??u?.name,b=u?u.value===e:void 0,y=useCallback(v=>{v.target.checked&&u?.onChange(e);},[u,e]);return jsxs("label",{htmlFor:c,className:f("inline-flex cursor-pointer items-center gap-2 select-none",g&&"pointer-events-none opacity-50",a),children:[jsx("input",{...s,id:c,type:"radio",name:h,value:e,className:"sr-only",checked:b,disabled:g,onChange:y}),jsx("span",{className:f(Lo({intent:p,size:m,checked:b?"on":"off"})),children:jsx("span",{className:f("rounded-full bg-white transition-all duration-200",Km[d],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 Um(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 Xm={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 Ko({src:e,alt:t,initials:r,size:n,shape:o,status:a,className:i,...s}){let[l,c]=useState(false),u=e&&!l,p=Um(t,r);return jsx("span",{role:"img","aria-label":t??p,className:f(Pn({size:n,shape:o}),a&&Xm[a],"relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden",i),...s,children:u?jsx("img",{src:e,alt:t,className:"h-full w-full object-cover",onError:()=>c(true),draggable:false}):jsx("span",{className:"font-semibold leading-none tracking-wide",children:p})})}function jo({children:e,max:t=4,overlap:r="left",className:n}){let o=$n.Children.toArray(e),a=o.slice(0,t),i=o.length-t;return jsxs("span",{className:f("inline-flex items-center",r==="left"?"-space-x-3":"flex-row-reverse -space-x-3",n),children:[a.map((l,c)=>jsx("span",{className:"ring-2 ring-white dark:ring-primary-900 rounded-full",children:l},c)),i>0&&jsxs("span",{"aria-label":`${i} more`,className:f(Pn({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:["+",i]})]})}function lr(e,t,r){return Math.min(Math.max(e,t),r)}function qm(e,t,r){return Math.round((e-t)/r)*r+t}function Ai(e,t,r){return (e-t)/(r-t)*100}function bc(e,t,r,n){let o=t+e/100*(r-t);return qm(o,t,n)}function vc(e,t,r,n,o,a){let i=useRef(false),s=useCallback(p=>{let m=e.current;if(!m)return 0;let d=m.getBoundingClientRect(),h=(("touches"in p?p.touches[0].clientX:p.clientX)-d.left)/d.width*100;return lr(h,0,100)},[e]),l=useCallback(p=>{if(o)return;p.currentTarget.setPointerCapture(p.pointerId),i.current=true;let m=e.current;if(!m)return;let d=m.getBoundingClientRect(),g=(p.clientX-d.left)/d.width*100;a?.(bc(lr(g,0,100),t,r,n));},[o,s,t,r,n,a,e]),c=useCallback(p=>{if(!i.current||o)return;let m=e.current;if(!m)return;let d=m.getBoundingClientRect(),g=(p.clientX-d.left)/d.width*100;a?.(bc(lr(g,0,100),t,r,n));},[o,t,r,n,a,e]),u=useCallback(()=>{i.current=false;},[]);return {startDrag:l,onPointerMove:c,stopDrag:u}}function Yo({mode:e,value:t,defaultValue:r=0,onChange:n,min:o=0,max:a=100,step:i=1,intent:s,size:l,disabled:c,showValue:u=false,formatValue:p=String,label:m,className:d,id:g,...h}){let[b,y]=useState(r),v=t!==void 0,N=v?t:b,x=useId(),w=g??x,L=useRef(null),P=useCallback(k=>{let M=lr(k,o,a);v||y(M),n?.(M);},[v,o,a,n]),{startDrag:A,onPointerMove:D,stopDrag:S}=vc(L,o,a,i,c,P),C=Ai(N,o,a),I=k=>{let M=k.key==="ArrowRight"||k.key==="ArrowUp"?i:k.key==="ArrowLeft"||k.key==="ArrowDown"?-i:k.key==="Home"?-(N-o):k.key==="End"?a-N:0;M!==0&&(k.preventDefault(),P(N+M));};return jsxs("div",{className:f("slider-root flex flex-col gap-1",d),children:[jsx("input",{type:"range",id:w,className:"sr-only",tabIndex:-1,min:o,max:a,step:i,value:N,disabled:c,readOnly:true,onChange:()=>{}}),(m||u)&&jsxs("div",{className:"flex items-center justify-between",children:[m&&jsx("label",{htmlFor:w,className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:m}),u&&jsx("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:p(N)})]}),jsx("div",{...h,ref:L,className:f(Rn({intent:s,size:l}),c&&"opacity-40 cursor-not-allowed"),onPointerDown:A,onPointerMove:D,onPointerUp:S,onPointerCancel:S,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:`${C}%`}}),jsx("div",{role:"slider",tabIndex:c?-1:0,"aria-valuemin":o,"aria-valuemax":a,"aria-valuenow":N,"aria-disabled":c,onKeyDown:I,className:f("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:`${C}%`}})]})})]})}function Uo({value:e,defaultValue:t=[20,80],onChange:r,min:n=0,max:o=100,step:a=1,intent:i,size:s,disabled:l,showValue:c=false,formatValue:u=String,label:p,className:m,id:d,...g}){let[h,b]=useState(t),y=e!==void 0,[v,N]=y?e:h,x=useRef(null),w=useRef("lo"),L=useCallback(R=>{y||b(R),r?.(R);},[y,r]),P=useCallback(R=>{w.current==="lo"?L([lr(R,n,N),N]):L([v,lr(R,v,o)]);},[v,N,n,o,L]),{startDrag:A,onPointerMove:D,stopDrag:S}=vc(x,n,o,a,l,P),C=Ai(v,n,o),I=Ai(N,n,o),k=R=>$=>{w.current=R,A($);},M=R=>$=>{let ne=$.key==="ArrowRight"||$.key==="ArrowUp"?a:$.key==="ArrowLeft"||$.key==="ArrowDown"?-a:0;ne!==0&&($.preventDefault(),L(R==="lo"?[lr(v+ne,n,N),N]:[v,lr(N+ne,v,o)]));};return jsxs("div",{className:f("slider-root flex flex-col gap-1",m),children:[d&&jsx("input",{type:"range",id:d,className:"sr-only",tabIndex:-1,min:n,max:o,step:a,value:v,disabled:l,readOnly:true,onChange:()=>{}}),(p||c)&&jsxs("div",{className:"flex items-center justify-between",children:[p&&jsx("span",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:p}),c&&jsxs("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:[u(v)," \u2013 ",u(N)]})]}),jsx("div",{...g,ref:x,className:f(Rn({intent:i,size:s}),l&&"opacity-40 cursor-not-allowed"),onPointerMove:D,onPointerUp:S,onPointerCancel:S,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:`${C}%`,width:`${I-C}%`}}),jsx("div",{role:"slider",tabIndex:l?-1:0,"aria-valuemin":n,"aria-valuemax":N,"aria-valuenow":v,"aria-label":"Range start","aria-disabled":l,onPointerDown:k("lo"),onKeyDown:M("lo"),className:f("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",!l&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${C}%`,zIndex:v>N-a?3:2}}),jsx("div",{role:"slider",tabIndex:l?-1:0,"aria-valuemin":v,"aria-valuemax":o,"aria-valuenow":N,"aria-label":"Range end","aria-disabled":l,onPointerDown:k("hi"),onKeyDown:M("hi"),className:f("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",!l&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${I}%`,zIndex:2}})]})})]})}var Jm={warning:"text-warning-400",danger:"text-danger-400",success:"text-success-500",primary:"text-primary-500"},wc="text-secondary-200 dark:text-secondary-700";function kc({className:e}){return jsx("svg",{className:f("rating-icon transition-colors duration-150",e),viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26Z"})})}function Qm({fill:e,filledClass:t,icon:r,emptyIcon:n}){return jsxs("span",{className:"relative inline-flex",children:[n?jsx("span",{className:f("rating-icon",wc),children:n}):jsx(kc,{className:wc}),e>0&&jsx("span",{"aria-hidden":true,className:"absolute inset-0 overflow-hidden",style:{width:e===.5?"50%":"100%"},children:r?jsx("span",{className:f("rating-icon",t),children:r}):jsx(kc,{className:t})})]})}function Xo({value:e,defaultValue:t=0,max:r=5,size:n="md",intent:o="warning",precision:a=1,readOnly:i=false,disabled:s=false,onChange:l,icon:c,emptyIcon:u,label:p="Rating",className:m}){let[d,g]=useState(t),[h,b]=useState(null),y=e!==void 0,v=y?e:d,N=h??v,x=useCallback(S=>{s||i||(y||g(S),l?.(S));},[s,i,y,l]),w=useCallback(()=>{!s&&!i&&b(null);},[s,i]),L=useCallback(S=>{s||i||(S.key==="ArrowRight"||S.key==="ArrowUp"?(S.preventDefault(),x(Math.min(v+a,r))):S.key==="ArrowLeft"||S.key==="ArrowDown"?(S.preventDefault(),x(Math.max(v-a,0))):S.key==="Home"?(S.preventDefault(),x(0)):S.key==="End"&&(S.preventDefault(),x(r)));},[s,i,v,a,r,x]),P=S=>N>=S?1:a===.5&&N>=S-.5?.5:0,A=Jm[o],D=!i&&!s;return jsx("div",{role:"radiogroup","aria-label":p,className:f(Ao({size:n}),s&&"opacity-50 cursor-not-allowed",D&&"cursor-pointer",m),onMouseLeave:D?w:void 0,onKeyDown:D?L:void 0,children:Array.from({length:r},(S,C)=>{let I=C+1,k=P(I),M=jsx(Qm,{fill:k,filledClass:A,icon:c,emptyIcon:u});if(!D)return jsx("span",{role:"radio","aria-label":`${I} star${I!==1?"s":""}`,"aria-checked":Math.round(v)===I,children:M},I);let R=z=>{if(a===.5){let H=z.currentTarget.getBoundingClientRect(),_=z.clientX-H.left<H.width/2;b(_?I-.5:I);}else b(I);},$=z=>{if(a===.5){let H=z.currentTarget.getBoundingClientRect(),_=z.clientX-H.left<H.width/2;x(_?I-.5:I);}else x(I);},E=Math.round(v/a)*a,U=E===I||a===.5&&E===I-.5||v===0&&I===1?0:-1;return jsx("button",{type:"button",role:"radio","aria-label":`${I} star${I!==1?"s":""}`,"aria-checked":Math.round(v)===I,tabIndex:U,className:"border-0 bg-transparent p-0 cursor-pointer rounded transition-transform duration-100 hover:scale-110 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",onMouseMove:R,onMouseEnter:R,onClick:$,children:M},I)})})}function Zr({size:e="sm",variant:t="default",className:r,children:n,...o}){return jsx("kbd",{className:f(Io({size:e,variant:t}),r),...o,children:n})}function en({separator:e="+",className:t,children:r}){let n=$n.Children.toArray(r);return jsx("span",{className:f("inline-flex items-center gap-1",t),children:n.map((o,a)=>jsxs($n.Fragment,{children:[o,a<n.length-1&&jsx("span",{className:"select-none text-xs text-secondary-400 dark:text-secondary-500","aria-hidden":true,children:e})]},a))})}var tf={Button:Vt,Dropdown:wi,DropdownButton:qr,Badge:Si,Tag:Pi,Indicator:Ri,Label:_t,Input:Ft,TextBox:Ei,Switch:Rr,Checkbox:An,Radio:Di,RadioGroup:Li,Avatar:Ko,AvatarGroup:jo,Slider:Yo,SliderRange:Uo,Rating:Xo,Kbd:Zr,KbdGroup:en},Vi=tf;var In=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"}}),Go=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 Hi({intent:e,size:t,className:r,...n}){return jsx("div",{className:f(In({intent:e,size:t}),r),...n})}function rf({className:e,...t}){return jsx("div",{className:f("mb-4 space-y-1",e),...t})}function nf({className:e,...t}){return jsx("h3",{className:f("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function of({className:e,...t}){return jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function af({className:e,...t}){return jsx("div",{className:f("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function sf({className:e,...t}){return jsx("div",{className:f("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function lf({intent:e,media:t,mediaPosition:r="left",stackOnMobile:n=false,className:o,children:a,...i}){let s=jsx("div",{className:f("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:f(In({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),...i,children:[s,jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:a})]})}function _i({src:e,alt:t="",aspectRatio:r="16/9",className:n,children:o,...a}){return jsxs("div",{className:f("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 df({className:e,...t}){return jsx("div",{className:f("space-y-2 p-4",e),...t})}function uf({className:e,...t}){return jsx("h3",{className:f("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function pf({className:e,...t}){return jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function mf({className:e,...t}){return jsx("div",{className:f("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function Fi({intent:e,size:t,className:r,...n}){return jsx("div",{className:f(Go({intent:e,size:t}),r),...n})}function ff({className:e,...t}){return jsx("div",{className:f("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 hf({className:e,...t}){return jsx("div",{className:f("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var Lc="onyx-split:",Pc=10;function Rc(e){if(!e)return {};try{let t=localStorage.getItem(Lc+e);if(t)return JSON.parse(t)}catch{}return {}}function Ec(e,t){if(e)try{localStorage.setItem(Lc+e,JSON.stringify(t));}catch{}}function Dc(e,t){return e.filter(r=>t[r.id]!==false).map(r=>r.id)}function Vn(e,t,r){return Math.max(t,Math.min(r,e))}function Ac({panes:e,direction:t,containerRef:r,visibility:n,autoSaveId:o,onResizeEnd:a}){let i=t==="horizontal",[s,l]=useState(()=>Rc(o)),c=useRef(false);useEffect(()=>{if(c.current)return;let y=r.current;if(!y)return;let v=i?y.clientWidth:y.clientHeight,N=Rc(o),x={},w=[],L=0;for(let P of e){if(!(n[P.id]!==false)){x[P.id]=N[P.id]??P.defaultSize??200;continue}N[P.id]!==void 0?(x[P.id]=N[P.id],L+=N[P.id]):P.defaultSize!==void 0?(x[P.id]=P.defaultSize,L+=P.defaultSize):w.push(P);}if(w.length>0){let A=Math.max(0,v-L)/w.length;for(let D of w)x[D.id]=Math.max(A,D.minSize??48);}c.current=true,l(x);},[]);let u=useRef(n),p=useRef(e.map(y=>y.id));useEffect(()=>{let y=u.current,v=p.current,N=e.map(A=>A.id);u.current=n,p.current=N;let x=N.filter(A=>!v.includes(A)),w=v.filter(A=>!N.includes(A)),L=[],P=[];for(let A of e){if(x.includes(A.id))continue;let D=y[A.id]!==false,S=n[A.id]!==false;D&&!S&&L.push(A.id),!D&&S&&P.push(A.id);}x.length===0&&w.length===0&&L.length===0&&P.length===0||l(A=>{let D={...A};for(let S of w){let C=D[S]??0;if(delete D[S],C>0){let I=v.indexOf(S),k=N.filter(R=>n[R]!==false),M=k.find((R,$)=>v.indexOf(N[N.indexOf(k[$])])>I);M||(M=k[k.length-1]),M&&(D[M]=(D[M]??0)+C);}}for(let S of x){let C=e.find(R=>R.id===S);if(n[S]===false){D[S]=C.defaultSize??200;continue}let I=C.defaultSize??200,k=Math.max(I,C.minSize??48),M=N.filter(R=>R!==S&&!x.includes(R)&&n[R]!==false).map(R=>({id:R,size:D[R]??0})).sort((R,$)=>$.size-R.size);if(M.length>0){let $=e.find(U=>U.id===M[0].id)?.minSize??48,E=Math.max(0,M[0].size-$),ne=Math.min(k,E);D[M[0].id]=M[0].size-ne,D[S]=ne;}else D[S]=k;}for(let S of L){let C=D[S]??0;if(C===0)continue;let I=e.findIndex(M=>M.id===S),k;for(let M=I+1;M<e.length;M++)if(n[e[M].id]!==false&&!L.includes(e[M].id)){k=e[M].id;break}if(!k){for(let M=I-1;M>=0;M--)if(n[e[M].id]!==false&&!L.includes(e[M].id)){k=e[M].id;break}}k&&(D[k]=(D[k]??0)+C),D[S]=C;}for(let S of P){let C=D[S]??e.find(M=>M.id===S)?.defaultSize??200,I=e.findIndex(M=>M.id===S),k;for(let M=I+1;M<e.length;M++)if(n[e[M].id]!==false&&!P.includes(e[M].id)){k=e[M].id;break}if(!k){for(let M=I-1;M>=0;M--)if(n[e[M].id]!==false&&!P.includes(e[M].id)){k=e[M].id;break}}if(k){let M=D[k]??0,R=e.find(ne=>ne.id===k)?.minSize??48,$=Math.max(0,M-R),E=Math.min(C,$);D[k]=M-E,D[S]=E;}else D[S]=C;}return D});},[n,e]);let m=useRef(null),[d,g]=useState(null),h=useRef(null),b=useCallback((y,v,N)=>{let x=v.minSize??48,w=v.maxSize??1/0,L=N.minSize??48,P=N.maxSize??1/0;return {onPointerDown:I=>{I.preventDefault();try{I.currentTarget.setPointerCapture(I.pointerId);}catch{}m.current={idA:v.id,idB:N.id,startPos:i?I.clientX:I.clientY,startA:s[v.id]??0,startB:s[N.id]??0,minA:x,maxA:w,minB:L,maxB:P},h.current=y,g(y);},onPointerMove:I=>{if(!m.current||h.current!==y)return;let{idA:k,idB:M,startPos:R,startA:$,startB:E,minA:ne,maxA:U,minB:z,maxB:H}=m.current,_=(i?I.clientX:I.clientY)-R,V=$+_,oe=E-_;V<ne&&(V=ne,oe=$+E-ne),V>U&&(V=U,oe=$+E-U),oe<z&&(oe=z,V=$+E-z),oe>H&&(oe=H,V=$+E-H),V=Vn(V,ne,U),oe=Vn(oe,z,H),l(be=>({...be,[k]:V,[M]:oe}));},onPointerUp:I=>{!m.current||h.current!==y||(m.current=null,h.current=null,g(null),l(k=>(Ec(o,k),a?.(k),k)));},onKeyDown:I=>{if(!(i?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"]).includes(I.key))return;I.preventDefault();let M=I.key==="ArrowLeft"||I.key==="ArrowUp"?-Pc:Pc;l(R=>{let $=R[v.id]??0,E=R[N.id]??0,ne=Vn($+M,x,w),U=$+E-ne;U=Vn(U,L,P),ne=$+E-U,ne=Vn(ne,x,w);let z={...R,[v.id]:ne,[N.id]:U};return Ec(o,z),a?.(z),z});}}},[i,s,o,a]);return {sizes:s,activeHandleIndex:d,buildHandlers:b}}var vf=8;function xf({isDragging:e,handleSize:t,isHorizontal:r,paneA:n,paneB:o,onPointerDown:a,onPointerMove:i,onPointerUp:s,onKeyDown:l}){let c=Math.max(1,t),u=Math.max(c,vf);return jsxs("div",{role:"separator","aria-orientation":r?"vertical":"horizontal","aria-label":`Resize handle between ${n.id} and ${o.id}`,tabIndex:0,className:f("group relative z-10 shrink-0 select-none outline-none",r?"cursor-col-resize":"cursor-row-resize"),style:r?{width:u,minWidth:u}:{height:u,minHeight:u},onPointerDown:a,onPointerMove:i,onPointerUp:s,onPointerCancel:s,onKeyDown:l,children:[jsx("div",{"aria-hidden":"true",className:f("pointer-events-none absolute rounded-sm transition-colors duration-150","bg-primary-200 dark:bg-primary-700","group-hover:bg-primary-400 dark:group-hover:bg-primary-500","group-focus-visible:bg-primary-400 dark:group-focus-visible:bg-primary-500",e?"bg-primary-500 dark:bg-primary-400":void 0,r?"top-0 bottom-0 left-1/2 -translate-x-1/2":"left-0 right-0 top-1/2 -translate-y-1/2"),style:r?{width:c}:{height:c}}),jsx("div",{"aria-hidden":"true",className:f("pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2","flex gap-0.5 opacity-0 transition-opacity duration-150","group-hover:opacity-100",e?"opacity-100":void 0,r?"flex-col":"flex-row"),children:[0,1,2].map(p=>jsx("span",{className:f("rounded-full bg-primary-400 dark:bg-primary-500","h-0.5 w-0.5")},p))})]})}function wf({pane:e,sizeInPx:t,isHorizontal:r,defaultBackground:n}){let o=e.background??n;return jsx("div",{"data-split-pane-id":e.id,className:f("relative overflow-auto",e.className),style:{...r?{width:t,minWidth:0,flexShrink:0}:{height:t,minHeight:0,flexShrink:0},...o?{background:o}:{},...e.style},children:e.children})}function qo({direction:e="horizontal",panes:t,visibility:r={},onVisibilityChange:n,width:o="100%",height:a="100%",handleSize:i=4,defaultBackground:s,autoSaveId:l,onResizeEnd:c,className:u,style:p}){let m=useRef(null),d=e==="horizontal",{sizes:g,activeHandleIndex:h,buildHandlers:b}=Ac({panes:t,direction:e,containerRef:m,visibility:r,autoSaveId:l,onResizeEnd:c}),y=Dc(t,r),v=t.filter(x=>y.includes(x.id)),N=(x,w)=>x===void 0?w:typeof x=="number"?`${x}px`:x;return jsx("div",{ref:m,"data-split-panel":true,"data-direction":e,className:f("flex overflow-hidden",d?"flex-row":"flex-col",u),style:{width:N(o,"100%"),height:N(a,"100%"),...p},children:v.map((x,w)=>{let L=g[x.id]??x.defaultSize??200,P=w===v.length-1,A=v[w+1],D=w,S=h===D,C=!P&&A?b(D,x,A):null;return jsxs($n.Fragment,{children:[jsx(wf,{pane:x,sizeInPx:L,isHorizontal:d,defaultBackground:s}),!P&&A&&C&&jsx(xf,{index:D,paneA:x,paneB:A,isDragging:S,handleSize:i,isHorizontal:d,onPointerDown:C.onPointerDown,onPointerMove:C.onPointerMove,onPointerUp:C.onPointerUp,onKeyDown:C.onKeyDown})]},x.id)})})}var kf={Card:Hi,ImageCard:_i,Panel:Fi,SplitPanel:qo},$i=kf;var Jo=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"}}),Qo=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"}}),Zo=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"}}),ea=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"}}),ta=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"}}),ra=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"}}),Hn=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 Bn({intent:e,density:t,className:r,...n}){return jsx("div",{className:"w-full overflow-auto",children:jsx("table",{className:f(Jo({intent:e,density:t}),r),...n})})}function Ki({className:e,...t}){return jsx("thead",{className:f("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function ji({className:e,...t}){return jsx("tbody",{className:f("[&_tr:last-child]:border-0",e),...t})}function Fn({className:e,...t}){return jsx("tr",{className:f("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 zr({className:e,...t}){return jsx("th",{className:f("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function Vr({className:e,...t}){return jsx("td",{className:f("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function Wi({icon:e,text:t="No data",className:r}){return jsxs("div",{className:f("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 zc={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function If({columns:e,data:t,sort:r,onSortChange:n,defaultSort:o=null,rowKey:a,rowActions:i,intent:s,density:l,className:c,empty:u}){let[p,m]=useState(o),d=r??p,g=useCallback(b=>{let y=d?.column===b?d.direction==="asc"?{column:b,direction:"desc"}:null:{column:b,direction:"asc"};n?n(y):m(y);},[d,n]),h=useMemo(()=>{if(!d)return t;let b=e.find(N=>N.key===d.column);if(!b)return t;let y=b.compareFn??((N,x)=>{let w=b.cell(N),L=b.cell(x);return w==null&&L==null?0:w==null?-1:L==null?1:typeof w=="number"&&typeof L=="number"?w-L:String(w).localeCompare(String(L))}),v=[...t].sort(y);return d.direction==="desc"?v.reverse():v},[t,d,e]);return jsxs(Bn,{intent:s,density:l,className:c,children:[jsx(Ki,{children:jsxs(Fn,{children:[e.map(b=>{let y=b.sortable!==false,v=d?.column===b.key;return jsx(zr,{className:f(y&&"cursor-pointer select-none",b.headerClassName,b.hideBelow&&zc[b.hideBelow]),onClick:y?()=>g(b.key):void 0,"aria-sort":v?d.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[b.header,y&&jsx(Vc,{active:v,direction:v?d.direction:null})]})},b.key)}),i&&jsx(zr,{className:"w-20 text-right",children:"Actions"})]})}),jsx(ji,{children:h.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(i?1:0),children:jsx(Wi,{...u})})}):h.map((b,y)=>jsxs(Fn,{children:[e.map(v=>jsx(Vr,{className:f(v.cellClassName,v.hideBelow&&zc[v.hideBelow]),children:v.cell(b)},v.key)),i&&jsx(Vr,{className:"text-right",children:jsx("span",{className:"inline-flex items-center gap-1",children:i(b)})})]},a?a(b,y):y))})]})}function zf({value:e,onCommit:t,onCancel:r}){let[n,o]=useState(e),a=useRef(null);useEffect(()=>{a.current?.focus(),a.current?.select();},[]);let i=()=>t(n);return jsxs("span",{className:"flex items-center gap-1",children:[jsx("input",{ref:a,type:"text",value:n,onChange:s=>o(s.target.value),onKeyDown:s=>{s.key==="Enter"&&i(),s.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:i,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 Vf({columns:e,data:t,rowKey:r,sort:n,onSortChange:o,defaultSort:a=null,selectionMode:i="none",selected:s,onSelectionChange:l,editable:c=false,onCellEdit:u,toolbar:p=false,onAdd:m,onDelete:d,rowActions:g,intent:h,density:b,className:y,empty:v}){let[N,x]=useState(a),w=n??N,L=useCallback(_=>{let V=w?.column===_?w.direction==="asc"?{column:_,direction:"desc"}:null:{column:_,direction:"asc"};o?o(V):x(V);},[w,o]),P=useMemo(()=>{if(!w)return t;let _=e.find(be=>be.key===w.column);if(!_)return t;let V=_.compareFn??((be,T)=>{let F=_.cell(be),re=_.cell(T);return F==null&&re==null?0:F==null?-1:re==null?1:typeof F=="number"&&typeof re=="number"?F-re:String(F).localeCompare(String(re))}),oe=[...t].sort(V);return w.direction==="desc"?oe.reverse():oe},[t,w,e]),[A,D]=useState([]),S=s??A,C=l??D,I=useMemo(()=>P.map((_,V)=>r(_,V)),[P,r]),k=i==="multiple"&&I.length>0&&I.every(_=>S.includes(_)),M=i==="multiple"&&S.length>0&&!k,R=useCallback(_=>{i==="single"?C(S.includes(_)?[]:[_]):i==="multiple"&&C(S.includes(_)?S.filter(V=>V!==_):[...S,_]);},[i,S,C]),$=useCallback(()=>{C(k?[]:I);},[k,I,C]),[E,ne]=useState(null),U=useCallback((_,V,oe)=>{c&&oe!==false&&ne({rowKey:_,colKey:V});},[c]),z=useCallback((_,V,oe)=>{u?.(_,V,oe),ne(null);},[u]);return jsxs("div",{className:"space-y-2",children:[p&&jsxs("div",{className:"flex items-center gap-2",children:[m&&jsxs("button",{type:"button",onClick:m,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"]}),d&&jsxs("button",{type:"button",onClick:()=>d(S),disabled:S.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",S.length>0&&` (${S.length})`]}),c&&S.length===1&&jsxs("button",{type:"button",onClick:()=>{let _=e.find(V=>V.editable!==false);_&&ne({rowKey:S[0],colKey:_.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"]}),S.length>0&&jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[S.length," row",S.length>1?"s":""," selected"]})]}),jsxs(Bn,{intent:h,density:b,className:y,children:[jsx(Ki,{children:jsxs(Fn,{children:[i==="multiple"&&jsx(zr,{className:"w-10",children:jsx("input",{type:"checkbox",checked:k,ref:_=>{_&&(_.indeterminate=M);},onChange:$,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),i==="single"&&jsx(zr,{className:"w-10"}),e.map(_=>{let V=_.sortable!==false,oe=w?.column===_.key;return jsx(zr,{className:f(V&&"cursor-pointer select-none",_.headerClassName),onClick:V?()=>L(_.key):void 0,"aria-sort":oe?w.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[_.header,V&&jsx(Vc,{active:oe,direction:oe?w.direction:null})]})},_.key)}),g&&jsx(zr,{className:"w-20 text-right",children:"Actions"})]})}),jsx(ji,{children:P.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(i!=="none"?1:0)+(g?1:0),children:jsx(Wi,{...v})})}):P.map((_,V)=>{let oe=r(_,V),be=S.includes(oe);return jsxs(Fn,{className:f(be&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{i!=="none"&&R(oe);},children:[i==="multiple"&&jsx(Vr,{className:"w-10",children:jsx("input",{type:"checkbox",checked:be,onChange:()=>R(oe),onClick:T=>T.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),i==="single"&&jsx(Vr,{className:"w-10",children:jsx("input",{type:"radio",checked:be,onChange:()=>R(oe),onClick:T=>T.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(T=>{let F=E?.rowKey===oe&&E?.colKey===T.key,re=T.editValue?.(_)??(()=>{let W=T.cell(_);return typeof W=="string"||typeof W=="number"?String(W):""})();return jsx(Vr,{className:f(T.cellClassName,c&&T.editable!==false&&"cursor-text"),onDoubleClick:W=>{W.stopPropagation(),U(oe,T.key,T.editable);},children:F?jsx(zf,{value:re,onCommit:W=>z(oe,T.key,W),onCancel:()=>ne(null)}):T.cell(_)},T.key)}),g&&jsx(Vr,{className:"text-right",onClick:T=>T.stopPropagation(),children:jsx("span",{className:"inline-flex items-center gap-1",children:g(_)})})]},oe)})})]})]})}function Vc({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsx(ArrowUpDown,{className:f(r,"opacity-30")}):t==="asc"?jsx(ArrowUp,{className:f(r,"opacity-70")}):jsx(ArrowDown,{className:f(r,"opacity-70")})}var Hc=createContext({size:"md"});function Yi({intent:e,size:t="md",className:r,...n}){return jsx(Hc.Provider,{value:{size:t},children:jsx("ul",{className:f(Qo({intent:e}),r),...n})})}function Ff({actions:e,className:t,children:r,...n}){let{size:o}=useContext(Hc);return jsxs("li",{className:f(Zo({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 Bc=createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function Ui({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:n="all",onExpandedKeysChange:o,size:a="md",className:i,children:s,...l}){let [c,u]=useState(()=>n),m=useCallback(g=>{if(r){let h=new Set(r);h.has(g)?h.delete(g):h.add(g),o?.(h);}else u(h=>{if(h==="all")return new Set(["__ALL_MINUS__",g]);let b=new Set(h);return b.has(g)?b.delete(g):b.add(g),b});},[r,o]),d=r??(c==="all"?null:c);return jsx(Bc.Provider,{value:{showLines:e,expandedKeys:d,onToggleKey:m,size:a},children:t?jsx("ul",{className:f("text-sm",i),role:"tree",...l,children:s}):jsx("ul",{className:f("text-sm",i),role:"tree",...l,children:jsx(Wf,{children:s})})})}function Wf({children:e}){let t=$c(e);return jsx(Fragment,{children:t.map(r=>$n.isValidElement(r)&&r.props.children?r.props.children:null)})}function $c(e){let t=[];return $n.Children.forEach(e,r=>{$n.isValidElement(r)&&r.type===$n.Fragment?t.push(...$c(r.props.children)):t.push(r);}),t}function Yf({nodeKey:e,label:t,icon:r,actions:n,defaultExpanded:o=false,expanded:a,onToggle:i,children:s,className:l}){let{showLines:c,expandedKeys:u,onToggleKey:p,size:m}=useContext(Bc),[d,g]=useState(o),h=$n.Children.count(s)>0,b=e??(typeof t=="string"?t:""),y;a!=null?y=a:u!=null&&b?u.has("__ALL_MINUS__")?y=!u.has(b):y=u.has(b):y=d;let v=()=>{let N=!y;i?i(N):u!=null&&b?p(b):g(N);};return jsxs("li",{className:f("select-none",l),role:"treeitem","aria-expanded":h?y:void 0,children:[jsxs("div",{className:f("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",ea({size:m}),h?"cursor-pointer":"cursor-default"),onClick:h?v:void 0,children:[h?jsx(ChevronRight,{className:f("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",y&&"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:N=>N.stopPropagation(),children:n})]}),h&&jsx("div",{className:f("grid transition-[grid-template-rows] duration-200 ease-out",y?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("ul",{className:f("ml-4 pl-2",c&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:s})})})]})}function qf({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 Jf({msg:e,alignRight:t}){return jsxs("div",{className:f("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsx(qf,{avatar:e.avatar,sender:e.sender}),jsxs("div",{className:f("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:f("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 Gi({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:f("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(i=>{let s=t==="split"&&!!i.self;return jsx(Jf,{msg:i,alignRight:s},i.id)}),jsx("div",{ref:a})]})}var e0={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)"}}]},t0={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')},Qi=null,Oc=new Set;function r0(){return Qi||(Qi=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[e0],langs:[],engine:t()}))),Qi}async function n0(e,t,r){let n=await r0();if(t&&!Oc.has(t)){let a=t0[t];if(a)try{let i=await a();await n.loadLanguage(i.default??i),Oc.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 Zi({code:e,language:t="text",lineNumbers:r=false,editable:n=false,onCodeChange:o,size:a,className:i,...s}){let[l,c]=useState(""),u=useRef(null),p=useRef(null),m=useRef(null);useEffect(()=>{let x=false;return n0(e,t,n?false:r).then(w=>{x||c(w);}),()=>{x=true;}},[e,t,r,n]);let d=useCallback(()=>{let x=p.current,w=m.current?.querySelector("pre"),L=u.current?.querySelector("[data-gutter]");x&&w&&(w.scrollTop=x.scrollTop,w.scrollLeft=x.scrollLeft),x&&L&&(L.scrollTop=x.scrollTop);},[]),g=useCallback(x=>{o?.(x.target.value);},[o]),h=useCallback(x=>{if(x.key==="Tab"){x.preventDefault();let w=x.currentTarget,L=w.selectionStart,P=w.selectionEnd,A=w.value.substring(0,L)+" "+w.value.substring(P);o?.(A),requestAnimationFrame(()=>{w.selectionStart=w.selectionEnd=L+2;});}},[o]),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)]",y="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",v=1.7,N=e.split(`
|
|
2
|
+
`).length;return n?jsxs("div",{ref:u,className:f(Hn({size:a}),"flex border border-primary-200 dark:border-primary-700",i),style:{background:"var(--color-syntax-bg)"},...s,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:y,lineHeight:v,width:"3rem"},children:Array.from({length:N},(x,w)=>jsx("div",{children:w+1},w))}),jsxs("div",{className:"relative min-w-0 flex-1",children:[jsx("textarea",{ref:p,value:e,onChange:g,onScroll:d,onKeyDown:h,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:y,lineHeight:v,tabSize:2,minHeight:"6rem"}}),jsx("div",{ref:m,"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:l?{__html:l}:void 0})]})]}):jsx("div",{ref:u,className:f(Hn({size:a}),"border border-primary-200 dark:border-primary-700",b,i),style:{background:"var(--color-syntax-bg)"},...s,children:jsx("div",{ref:m,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:l?{__html:l}:void 0,children:l?void 0:jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsx("code",{children:e})})})})}var s0={up:TrendingUp,down:TrendingDown,neutral:Minus},l0={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 es({title:e,value:t,prefix:r,suffix:n,icon:o,trend:a,trendValue:i,description:s,intent:l,size:c,className:u}){let p=a?s0[a]:null,m=a?l0[a]:"";return jsx("div",{className:f(ta({intent:l,size:c}),u),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})]}),(a||s)&&jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a&&p&&jsxs("span",{className:f("flex items-center gap-0.5 text-xs font-semibold",m),children:[jsx(p,{className:"h-3.5 w-3.5"}),i]}),s&&jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:s})]})]}),o&&jsx("div",{className:f("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl [&_svg]:h-5 [&_svg]:w-5",l==="success"&&"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",l==="danger"&&"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",l==="warning"&&"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400",(!l||l==="primary")&&"bg-primary-100 text-primary-600 dark:bg-primary-800 dark:text-primary-400"),children:o})]})})}function f0(e){return 1-Math.pow(1-e,4)}function h0(e,t,r,n,o){let[a,i]=useState(()=>o?o(t):t.toFixed(n)),s=useRef(null),l=useRef(null);return useEffect(()=>{s.current!==null&&cancelAnimationFrame(s.current),l.current=null;let c=u=>{l.current===null&&(l.current=u);let p=u-l.current,m=Math.min(p/r,1),d=f0(m),g=t+(e-t)*d;i(o?o(g):g.toFixed(n)),m<1&&(s.current=requestAnimationFrame(c));};return s.current=requestAnimationFrame(c),()=>{s.current!==null&&cancelAnimationFrame(s.current);}},[e,t,r,n,o]),a}var g0={up:TrendingUp,down:TrendingDown,neutral:Minus},b0={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"},Wc={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 ts({title:e,value:t,decimals:r=0,prefix:n,suffix:o,icon:a,trend:i,trendValue:s,description:l,animateDuration:c=1200,formatter:u,from:p=0,intent:m,size:d,className:g}){let h=h0(t,p,c,r,u),b=i?g0[i]:null,y=i?b0[i]:"";return jsxs("div",{className:f(ra({intent:m,size:d}),g),children:[jsx("div",{className:f("pointer-events-none absolute inset-x-0 top-0 h-0.5 rounded-t-xl",m==="success"&&"bg-gradient-to-r from-success-400 to-success-600",m==="danger"&&"bg-gradient-to-r from-danger-400 to-danger-600",m==="warning"&&"bg-gradient-to-r from-warning-400 to-warning-600",(!m||m==="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:h}),o&&jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:o})]})]}),a&&jsx("div",{className:f("flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl [&_svg]:h-6 [&_svg]:w-6",Wc[m??"primary"]??Wc.primary),children:a})]}),(i||l)&&jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-primary-100 pt-3 dark:border-primary-700/50",children:[i&&b&&jsxs("span",{className:f("flex items-center gap-0.5 text-xs font-bold",y),children:[jsx(b,{className:"h-3.5 w-3.5"}),s]}),l&&jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:l})]})]})}var Yc="onyx-vlist:";function Uc(e,t){let r=0,n=e.length-2;for(;r<=n;){let o=r+n>>1;if(e[o+1]<=t)r=o+1;else if(e[o]>t)n=o-1;else return o}return Math.max(0,r)}function Xc(e,t){let{items:r,itemHeight:n,estimatedItemHeight:o=48,direction:a="vertical",overscan:i=3,onReachEnd:s,reachEndThreshold:l=120,isLoading:c,onScroll:u,onVisibleRangeChange:p,scrollRestorationId:m}=e,d=a==="vertical",g=typeof n=="number",h=g?n:0,b=useRef(null),[y,v]=useState(300);useEffect(()=>{let z=b.current;if(!z)return;let H=new ResizeObserver(([oe])=>{let be=d?oe.contentRect.height:oe.contentRect.width;be>0&&v(be);});H.observe(z);let _=z.getBoundingClientRect(),V=d?_.height:_.width;return V>0&&v(V),()=>H.disconnect()},[d]);let[N,x]=useState(0);useEffect(()=>{if(!m)return;let z=b.current;if(z)try{let H=localStorage.getItem(Yc+m);if(H!==null){let _=parseFloat(H);!Number.isNaN(_)&&_>0&&requestAnimationFrame(()=>{d?z.scrollTop=_:z.scrollLeft=_;});}}catch{}},[]);let w=useRef(false),L=useRef(r.length);r.length!==L.current&&(L.current=r.length,w.current=false);let P=useCallback(()=>{let z=b.current;if(!z)return;let H=d?z.scrollTop:z.scrollLeft;if(x(H),u?.(H),m)try{localStorage.setItem(Yc+m,String(H));}catch{}s&&!c&&(d?z.scrollHeight-z.clientHeight:z.scrollWidth-z.clientWidth)-H<=l&&(w.current||(w.current=true,s()));},[d,u,m,s,c,l]);useEffect(()=>{let z=b.current;if(z)return z.addEventListener("scroll",P,{passive:true}),()=>z.removeEventListener("scroll",P)},[P]),useEffect(()=>{if(d)return;let z=b.current;if(!z)return;let H=_=>{Math.abs(_.deltaX)>=Math.abs(_.deltaY)||(_.preventDefault(),z.scrollLeft+=_.deltaY);};return z.addEventListener("wheel",H,{passive:false}),()=>z.removeEventListener("wheel",H)},[d]),useEffect(()=>{if(d)return;let z=b.current;if(!z)return;let H=5,_=false,V=false,oe=0,be=0,T=W=>{W.target.closest("button,a,input,select,textarea,[role=button],[role=checkbox],[role=radio],[role=option]")||W.button===0&&(_=true,V=false,oe=W.clientX,be=z.scrollLeft,z.setPointerCapture(W.pointerId));},F=W=>{if(!_)return;let G=oe-W.clientX;if(!V){if(Math.abs(G)<H)return;V=true,z.style.cursor="grabbing",z.style.userSelect="none";}z.scrollLeft=be+G;},re=W=>{if(_){_=false,z.style.cursor="",z.style.userSelect="";try{z.releasePointerCapture(W.pointerId);}catch{}}};return z.addEventListener("pointerdown",T),z.addEventListener("pointermove",F),z.addEventListener("pointerup",re),z.addEventListener("pointercancel",re),()=>{z.removeEventListener("pointerdown",T),z.removeEventListener("pointermove",F),z.removeEventListener("pointerup",re),z.removeEventListener("pointercancel",re);}},[d]);let A=useRef(new Map),[D,S]=useState(0),C=useCallback((z,H)=>{if(g||!H)return;let _=d?H.offsetHeight:H.offsetWidth;_>0&&A.current.get(z)!==_&&(A.current.set(z,_),S(V=>V+1));},[g,d]),I=useRef(r);I.current!==r&&(I.current=r,g||(A.current=new Map));let k=useMemo(()=>{if(g)return [];let z=new Array(r.length+1);z[0]=0;for(let H=0;H<r.length;H++){let _=A.current.get(H),V;_!==void 0?V=_:typeof n=="function"?V=r[H]!==void 0?n(r[H],H):o:V=o,z[H+1]=z[H]+V;}return z},[g,r,n,o,D]),M=useCallback(z=>g?z*h:k[z]??0,[g,h,k]),R=useCallback(z=>{if(g)return h;let H=A.current.get(z);return H!==void 0?H:typeof n=="function"&&r[z]!==void 0?n(r[z],z):o},[g,h,n,r,o,D]),$,E,ne;if(g){$=h*r.length;let z=Math.floor(N/h),H=Math.ceil((N+y)/h);E=Math.max(0,z-i),ne=Math.min(r.length-1,H+i-1);}else if($=k[r.length]??0,k.length>1){let z=Uc(k,N);E=Math.max(0,z-i);let H=z;for(;H<r.length&&k[H]<N+y;)H++;ne=Math.min(r.length-1,H+i-1);}else E=0,ne=Math.min(r.length-1,i*2);E=Math.max(0,E),ne=Math.max(E,Math.min(r.length-1,ne));let U=useRef({start:-1,end:-1});return useEffect(()=>{let z,H;if(g&&h>0)z=Math.max(0,Math.floor(N/h)),H=Math.min(r.length-1,Math.ceil((N+y)/h)-1);else {for(z=Uc(k,N),H=z;H<r.length&&k[H]<N+y;)H++;H=Math.max(0,H-1);}(U.current.start!==z||U.current.end!==H)&&(U.current={start:z,end:H},p?.(z,H));}),useImperativeHandle(t,()=>({scrollToIndex(z,H="auto"){let _=b.current;if(!_)return;let V=M(z),oe=R(z),be=d?_.clientHeight:_.clientWidth,T=d?_.scrollTop:_.scrollLeft,F;if(H==="start")F=V;else if(H==="end")F=V-be+oe;else if(H==="center")F=V-(be-oe)/2;else if(V<T)F=V;else if(V+oe>T+be)F=V-be+oe;else return;_.scrollTo({[d?"top":"left"]:Math.max(0,F),behavior:"smooth"});},scrollToOffset(z){let H=b.current;H&&H.scrollTo({[d?"top":"left"]:z,behavior:"smooth"});},getScrollOffset(){let z=b.current;return z?d?z.scrollTop:z.scrollLeft:0}}),[M,R,d]),{scrollerRef:b,startIndex:E,endIndex:ne,totalSize:$,getItemOffset:M,getItemSize:R,measureItem:C}}function w0({text:e="Loading\u2026"}){return jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-primary-400",children:[jsx("span",{"aria-hidden":true,className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-200 border-t-primary-500"}),jsx("span",{children:e})]})}function k0({text:e="No items"}){return jsxs("div",{className:"flex h-full min-h-[120px] flex-col items-center justify-center gap-2 text-sm text-primary-400",children:[jsx("svg",{"aria-hidden":true,xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),jsx("span",{children:e})]})}function N0(e,t){let{items:r,renderItem:n,getItemKey:o,itemHeight:a,direction:i="vertical",height:s="100%",width:l="100%",isLoading:c=false,loadingRenderer:u,loadingText:p,emptyRenderer:m,emptyText:d,itemClassName:g,className:h,style:b}=e,y=i==="vertical",v=typeof a!="number",{scrollerRef:N,startIndex:x,endIndex:w,totalSize:L,getItemOffset:P,getItemSize:A,measureItem:D}=Xc(e,t),S={position:"relative",overflowX:y?"hidden":"auto",overflowY:y?"auto":"hidden",height:s,width:l,cursor:y?void 0:"grab"},C={position:"relative",[y?"height":"width"]:L,[y?"width":"height"]:"100%",overflow:"hidden"},I=[];for(let M=x;M<=w;M++){let R=r[M];if(R===void 0)continue;let $=P(M),E=A(M),ne=o?o(R,M):M,U={position:"absolute",[y?"top":"left"]:$,[y?"height":"width"]:v?void 0:E,[y?"width":"height"]:"100%",boxSizing:"border-box"};I.push(jsx("div",{role:"row","aria-rowindex":M+1,style:U,className:f("onyx-vlist-item",g),ref:v?z=>D(M,z):void 0,children:n(R,M)},ne));}let k=r.length===0;return jsxs("div",{ref:N,role:"grid","aria-rowcount":r.length,"data-virtual-list":true,"data-direction":i,className:f("onyx-virtual-list",h),style:{...S,...b},children:[k?m?m():jsx(k0,{text:d}):jsx("div",{style:C,children:I}),c&&(u?u():jsx(w0,{text:p}))]})}var aa=forwardRef(N0);var C0={Table:Bn,List:Yi,Tree:Ui,Chat:Gi,CodeBlock:Zi,Stat:es,MetricCard:ts,VirtualList:aa},os=C0;var Hr="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",qc="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",an="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",sn="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 A0({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 as=["expanded","icons","mini"];function I0(e){let t=as.indexOf(e);return as[(t+1)%as.length]}function Jc(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 Jc(r.children))t.add(n);}return t}function Qc({item:e,basePath:t,depth:r,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:i,onToggle:s}){let l=e.key??e.label,c=e.children&&e.children.length>0,[u,p]=useState(e.defaultOpen??true),m=i?i.has(l):u,d=useCallback(()=>{i?s(l):p(h=>!h);},[i,s,l]),g=r>0?`${r*1.25}rem`:void 0;if(c)return jsxs("div",{children:[jsxs("button",{type:"button",onClick:d,className:f(Hr,an,"justify-between"),style:{paddingLeft:g},children:[jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsx(ChevronRight,{className:f("h-3.5 w-3.5 transition-transform",m&&"rotate-90")})]}),m&&jsx("div",{className:f("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(h=>jsx(Qc,{item:h,basePath:t,depth:r+1,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:i,onToggle:s},h.key??h.path??h.label))})]});if(e.path!=null){let h=t+e.path;return n?jsxs("button",{type:"button",onClick:()=>n(e,h),className:f(Hr,an),style:{paddingLeft:g},children:[e.icon,e.label]}):jsxs(o,{to:h,className:({isActive:b})=>f(Hr,b?qc:an),style:{paddingLeft:g},children:[e.icon,e.label]})}return jsxs("span",{className:f(Hr,an,"cursor-default"),style:{paddingLeft:g},children:[e.icon,e.label]})}function z0({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let[o,a]=useState(false),i=useRef(null),s=useRef(void 0),[l,c]=useState({top:0,left:0}),u=()=>{clearTimeout(s.current),a(true);},p=()=>{s.current=setTimeout(()=>a(false),200);};useLayoutEffect(()=>{if(o&&i.current){let d=i.current.getBoundingClientRect();c({top:d.top,left:d.right+4});}},[o]);let m=e.icon||jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxs("div",{onMouseEnter:u,onMouseLeave:p,children:[jsx("button",{ref:i,type:"button",className:f(sn,"w-full"),title:e.label,onClick:()=>a(d=>!d),children:m}),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:l.top,left:l.left},onMouseEnter:u,onMouseLeave:p,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(d=>{let g=d.key??d.path??d.label;if(d.path!=null){let h=t+d.path;return r?jsxs("button",{type:"button",onClick:()=>{r(d,h),a(false);},className:f(Hr,an),children:[d.icon,d.label]},g):jsxs(n,{to:h,className:({isActive:b})=>f(Hr,b?qc:an),children:[d.icon,d.label]},g)}return jsxs("span",{className:f(Hr,"cursor-default text-primary-400"),children:[d.icon,d.label]},g)})})]}),document.body)]})}function V0({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:f(sn,"w-full"),title:e.label,children:o}):jsx(n,{to:a,className:({isActive:i})=>f(sn,"w-full",i&&"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:f(sn,"w-full cursor-default"),title:e.label,children:o})}function ss({items:e,title:t,basePath:r="/",onItemClick:n,LinkComponent:o=A0,collapsible:a,collapseMode:i,defaultCollapseMode:s="expanded",onCollapseModeChange:l,showLines:c=true,expandedKeys:u,defaultExpandedKeys:p="all",onExpandedKeysChange:m,className:d,responsive:g=true,mobileBreakpoint:h=768,mobileTopOffset:b=48,mobileDrawerSlot:y,...v}){let[N,x]=useState(s),w=i??N,L=$n.useMemo(()=>Jc(e),[e]),[P,A]=useState(()=>p==="all"?new Set(L):new Set(p)),D=u??null,S=D??P,C=useCallback(q=>{let Z=new Set(S);Z.has(q)?Z.delete(q):Z.add(q),A(Z),m?.(Z);},[S,m]),I=useCallback(()=>{let q=I0(w);x(q),l?.(q);},[w,l]),[k,M]=useState(()=>g&&typeof window<"u"&&window.innerWidth<h),[R,$]=useState(false),[E,ne]=useState(()=>{if(typeof window>"u")return "left";try{return localStorage.getItem("onyx-sidenav-side")||"left"}catch{return "left"}}),[U,z]=useState(()=>{if(typeof window>"u")return 50;try{return Number(localStorage.getItem("onyx-sidenav-top"))||50}catch{return 50}}),[H,_]=useState(null),V=useRef({dragging:false,startX:0,startY:0,moved:false}),oe=useCallback(q=>{if(q.pointerType==="mouse"&&q.button!==0)return;q.preventDefault(),V.current={dragging:true,startX:q.clientX,startY:q.clientY,moved:false};let Z=te=>{if(!V.current.dragging)return;let ve=Math.abs(te.clientX-V.current.startX),Ne=Math.abs(te.clientY-V.current.startY);if((ve>6||Ne>6)&&(V.current.moved=true),!V.current.moved)return;let X=te.clientX<window.innerWidth/2?"left":"right",de=b+28,Q=window.innerHeight-28,ie=Math.max(de,Math.min(Q,te.clientY));_({side:X,y:ie});},ue=te=>{if(window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",ue),window.removeEventListener("pointercancel",ue),!V.current.dragging)return;if(V.current.dragging=false,!V.current.moved){let ie=Pe=>{Pe.stopPropagation(),Pe.preventDefault(),window.removeEventListener("click",ie,true);};window.addEventListener("click",ie,true),_(null),$(true);return}let ve=te.clientX<window.innerWidth/2?"left":"right",Ne=b+28,X=window.innerHeight-28,Q=Math.max(Ne,Math.min(X,te.clientY))/window.innerHeight*100;ne(ve),z(Q),_(null);try{localStorage.setItem("onyx-sidenav-side",ve),localStorage.setItem("onyx-sidenav-top",String(Q));}catch{}};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",ue),window.addEventListener("pointercancel",ue);},[b]);useEffect(()=>{if(!g||typeof window>"u"||!window.matchMedia)return;let q=window.matchMedia(`(max-width: ${h-1}px)`),Z=ue=>{M(ue.matches),ue.matches||$(false);};return q.addEventListener("change",Z),()=>q.removeEventListener("change",Z)},[g,h]);let be=useCallback(q=>{q.target.closest("a")&&$(false);},[]),T=useRef(null),F=useRef({startX:0,startY:0,dragging:false}),re=60,W=useCallback(q=>{let Z=q.touches[0];F.current={startX:Z.clientX,startY:Z.clientY,dragging:true};},[]),G=useCallback(q=>{if(!F.current.dragging||!T.current)return;let Z=q.touches[0],ue=Z.clientX-F.current.startX,te=Z.clientY-F.current.startY;if(E==="left"){if(ue>=0||Math.abs(te)>Math.abs(ue))return;T.current.style.transform=`translateX(${Math.max(ue,-224)}px)`;}else {if(ue<=0||Math.abs(te)>Math.abs(ue))return;T.current.style.transform=`translateX(${Math.min(ue,224)}px)`;}T.current.style.transition="none";},[E]),le=useCallback(q=>{if(!F.current.dragging||!T.current)return;F.current.dragging=false;let Z=q.changedTouches[0],ue=Z.clientX-F.current.startX,te=Z.clientY-F.current.startY;T.current.style.transition="",T.current.style.transform="",Math.abs(ue)>Math.abs(te)&&(E==="left"&&ue<-re&&$(false),E==="right"&&ue>re&&$(false));},[E]),ke=useMemo(()=>!k||!n?n:(q,Z)=>{$(false),n(q,Z);},[k,n]),B=jsxs(Fragment,{children:[a&&!k&&jsx("div",{className:f("flex shrink-0 mb-1",w==="expanded"?"justify-end":"justify-center"),children:jsx("button",{type:"button",onClick:I,className:sn,"aria-label":w==="mini"?"Expand sidebar":"Collapse sidebar",title:w==="mini"?"Expand sidebar":"Collapse sidebar",children:w==="mini"?jsx(Menu,{className:"h-5 w-5"}):jsx(ChevronsLeft,{className:"h-4 w-4"})})}),(k||w==="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(q=>jsx(Qc,{item:q,basePath:r,depth:0,onItemClick:ke,LinkComponent:o,showLines:c,expandedKeys:D,onToggle:C},q.key??q.path??q.label))]}),!k&&w==="icons"&&e.map(q=>{let Z=q.key??q.path??q.label;return q.children&&q.children.length>0?jsx(z0,{item:q,basePath:r,onItemClick:ke,LinkComponent:o},Z):jsx(V0,{item:q,basePath:r,onItemClick:ke,LinkComponent:o},Z)})]});if(g&&k){let q=H?H.side:E,Z=H?H.y:U/100*(typeof window<"u"?window.innerHeight:600),ue=H?{top:Z,transform:"translateY(-50%)",transition:"none",...q==="left"?{left:0}:{right:0}}:{top:`${U}%`,transform:"translateY(-50%)",transition:"top 0.15s ease",...E==="left"?{left:0}:{right:0}},te=E==="left"?{left:0,right:"auto"}:{right:0,left:"auto"},ve=R?"translate-x-0":E==="left"?"-translate-x-full":"translate-x-full",Ne=E==="left"?"border-r":"border-l";return jsxs(Fragment,{children:[R&&createPortal(jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:b},onClick:()=>$(false)}),document.body),createPortal(jsxs("aside",{ref:T,className:f("fixed bottom-0 z-50 flex flex-col w-56 bg-white dark:bg-primary-900 shadow-xl transition-transform duration-200",Ne,"border-primary-200 dark:border-primary-700",ve),style:{top:b,...te},onClick:be,onTouchStart:W,onTouchMove:G,onTouchEnd:le,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:X=>{X.stopPropagation(),$(false);},className:f(sn,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsx(X,{className:"h-4 w-4"})})]}),y&&jsx("div",{className:"shrink-0 border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:y}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsx("nav",{className:"flex flex-col gap-0.5",children:B})})]}),document.body),!R&&createPortal(jsx("div",{className:f("fixed z-50 flex items-center",q==="left"?"justify-start":"justify-end",H?"cursor-grabbing":"cursor-grab"),style:{...ue,width:44,height:80,marginTop:-12,touchAction:"none",userSelect:"none"},onPointerDown:oe,onDragStart:X=>X.preventDefault(),role:"button","aria-label":"Open navigation",tabIndex:0,children:jsx("div",{className:f("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",q==="left"?"rounded-r-xl":"rounded-l-xl"),children:q==="left"?jsx(ChevronRight,{className:"h-4 w-4"}):jsx(ChevronLeft,{className:"h-4 w-4"})})}),document.body)]})}return jsx("nav",{className:f("flex flex-col gap-0.5",w==="mini"&&"items-center",d),...v,children:B})}function F0({href:e,className:t,onClick:r,children:n}){return jsx("a",{href:e,className:t,onClick:r,children:n})}function ls({brand:e,onBrandClick:t,navItems:r=[],actions:n=[],linkComponent:o=F0,height:a="h-12",mobileMenu:i=false,navMenuIcon:s,actionsMenuIcon:l,className:c,children:u}){let p=i&&r.length>0,m=i&&n.length>0,d="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=v=>v?"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",h="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((v,N)=>({key:typeof v.label=="string"?v.label:String(N),label:v.active?jsx("span",{className:"font-semibold text-primary-900 dark:text-primary-100",children:v.label}):v.label,onClick:()=>{v.onClick?v.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):v.href&&(window.location.href=v.href);}})),y=n.map((v,N)=>({key:v.key??String(N),label:jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[v.icon,jsx("span",{children:v.ariaLabel})]}),onClick:()=>{v.onClick?v.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):v.href&&(v.external?window.open(v.href,"_blank","noopener,noreferrer"):window.location.href=v.href);}}));return jsxs("header",{className:f("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,c),children:[jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&jsx("div",{className:f("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?v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),t(v));}:void 0,children:e}),p&&jsx(qr,{intent:"ghost",size:"sm",className:d,label:s??jsx(PanelLeft,{className:"h-5 w-5"}),items:b,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsx("nav",{className:f("flex items-center gap-4 text-sm",i?"hidden md:flex":"flex"),children:r.map((v,N)=>{let x=typeof v.label=="string"?v.label:N,w=g(v.active);return v.href?jsx(o,{href:v.href,className:w,onClick:v.onClick,children:v.label},x):jsx("button",{type:"button",className:f(w,"cursor-pointer"),onClick:v.onClick,children:v.label},x)})})]}),u&&jsx("div",{className:"flex items-center",children:u}),jsxs("div",{className:"flex items-center gap-1",children:[n.length>0&&jsx("div",{className:f("flex items-center gap-1",i?"hidden md:flex":"flex"),children:n.map((v,N)=>v.href?jsx("a",{href:v.href,target:v.external?"_blank":void 0,rel:v.external?"noopener noreferrer":void 0,className:h,"aria-label":v.ariaLabel,onClick:v.onClick,children:v.icon},v.key??N):jsx("button",{type:"button",className:h,"aria-label":v.ariaLabel,onClick:v.onClick,children:v.icon},v.key??N))}),m&&jsx(qr,{intent:"ghost",size:"sm",className:d,label:l??jsx(MoreHorizontal,{className:"h-5 w-5"}),items:y,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var la=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 $0(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var O0=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 cs({intent:e,size:t,underline:r,external:n,className:o,children:a,href:i,target:s,rel:l,...c}){let u=n??$0(i,s);return jsxs("a",{href:i,target:u&&!s?"_blank":s,rel:u&&!l?"noopener noreferrer":l,className:f(la({intent:e,size:t,underline:r}),o),...c,children:[a,u&&jsx(O0,{})]})}function ua({items:e,separator:t=jsx(ChevronRight,{className:"h-3.5 w-3.5","aria-hidden":"true"}),homeIcon:r=false,LinkComponent:n="a",className:o}){return jsx("nav",{"aria-label":"Breadcrumb",className:f("flex",o),children:jsx("ol",{className:"flex flex-wrap items-center gap-1 text-sm",children:e.map((a,i)=>{let s=i===e.length-1,l=r===true?jsx(Home,{className:"h-3.5 w-3.5"}):r!==false&&r!==void 0?r:null,c=i===0&&l?l:a.icon;return jsxs("li",{className:"flex items-center gap-1",children:[i>0&&jsx("span",{className:"text-secondary-400 dark:text-secondary-500",children:t}),s?jsxs("span",{"aria-current":"page",className:f("flex items-center gap-1 font-medium text-primary-800 dark:text-primary-100",c&&"gap-1.5"),children:[c,a.label]}):a.href?jsxs(n,{href:a.href,className:f("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",c&&"gap-1.5"),children:[c,a.label]}):jsxs("span",{className:"flex items-center gap-1 text-secondary-500 dark:text-secondary-400",children:[c,a.label]})]},i)})})})}function pa(e,t){let r=[];for(let n=e;n<=t;n++)r.push(n);return r}function q0(e,t,r){let n=r*2+5;if(t<=n)return pa(1,t);let o=Math.max(e-r,1),a=Math.min(e+r,t),i=o>2,s=a<t-1;return !i&&s?[...pa(1,3+r*2),"\u2026",t]:i&&!s?[1,"\u2026",...pa(t-(3+r*2)+1,t)]:[1,"\u2026",...pa(o,a),"\u2026",t]}var td={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"},Wn={sm:"h-3.5 w-3.5",md:"h-4 w-4",lg:"h-5 w-5"};function Yn({onClick:e,disabled:t,active:r,size:n,"aria-label":o,children:a}){return jsx("button",{type:"button",onClick:e,disabled:t,"aria-label":o,"aria-current":r?"page":void 0,className:f("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",td[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:a})}function ma({totalPages:e,currentPage:t,onPageChange:r,siblingCount:n=2,showFirstLast:o=true,showPageCount:a=false,size:i="md",className:s}){if(e<=1)return null;let l=q0(t,e,n);return jsxs("nav",{"aria-label":"Pagination",className:f("flex items-center gap-1",s),children:[o&&jsx(Yn,{size:i,onClick:()=>r(1),disabled:t===1,"aria-label":"First page",children:jsx(ChevronsLeft,{className:Wn[i]})}),jsx(Yn,{size:i,onClick:()=>r(t-1),disabled:t===1,"aria-label":"Previous page",children:jsx(ChevronLeft,{className:Wn[i]})}),l.map((c,u)=>c==="\u2026"?jsx("span",{className:f("inline-flex items-center justify-center text-secondary-400",td[i]),"aria-hidden":"true",children:jsx(MoreHorizontal,{className:Wn[i]})},`ellipsis-${u}`):jsx(Yn,{size:i,active:c===t,onClick:()=>r(c),"aria-label":`Page ${c}`,children:c},c)),jsx(Yn,{size:i,onClick:()=>r(t+1),disabled:t===e,"aria-label":"Next page",children:jsx(ChevronRight,{className:Wn[i]})}),o&&jsx(Yn,{size:i,onClick:()=>r(e),disabled:t===e,"aria-label":"Last page",children:jsx(ChevronsRight,{className:Wn[i]})}),a&&jsxs("span",{className:"ml-2 text-sm text-secondary-500 dark:text-secondary-400",children:["Page ",t," of ",e]})]})}function rd({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:f("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:f(t==="full"?"text-[0.6rem] leading-tight":""),children:e.label})]})}function eh({group:e,mode:t,disabled:r=false}){return jsxs("div",{className:f("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(rd,{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 Un({tabs:e,defaultTab:t,activeTab:r,onTabChange:n,mode:o,onModeChange:a,sticky:i=false,className:s}){let l=e.filter(x=>!x.hidden),[c,u]=useState(t??l[0]?.key??""),[p,m]=useState(o??"full"),[d,g]=useState(true),h=r??c,b=o??p,y=x=>{if(!l.find(L=>L.key===x)?.disabled){if(x===h&&b!=="icons"){g(L=>!L);return}u(x),n?.(x),g(true);}},N=l.find(x=>x.key===h)??l[0];return jsxs("div",{className:f("select-none border-b border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",i&&"sticky top-0 z-30",s),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:l.map(x=>jsxs("button",{type:"button",disabled:x.disabled,onClick:()=>y(x.key),className:f("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",x.disabled?"cursor-not-allowed border-transparent text-secondary-300 opacity-50 dark:text-secondary-600":x.key===h&&d?"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:[x.icon,x.label]},x.key))}),jsx("button",{type:"button",title:d?"Collapse ribbon":"Expand ribbon",onClick:()=>g(x=>!x),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:d?jsx(ChevronUp,{className:"h-4 w-4"}):jsx(ChevronDown,{className:"h-4 w-4"})})]}),d&&N&&b!=="icons"&&jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto px-2 py-1.5",children:N.groups.map((x,w)=>jsxs($n.Fragment,{children:[w>0&&jsx("div",{className:"mx-1 h-auto w-px self-stretch bg-primary-100 dark:bg-primary-800"}),jsx(eh,{group:x,mode:b,disabled:x.disabled||N.disabled})]},x.key))}),b==="icons"&&d&&N&&jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto px-2 py-1",children:N.groups.flatMap(x=>x.items.map(w=>jsx(rd,{item:x.disabled||N.disabled?{...w,disabled:true}:w,mode:"icons"},w.key)))})]})}var th={SideNav:ss,Header:ls,NavLink:cs,Breadcrumb:ua,Pagination:ma,RibbonBar:Un},us=th;var fa=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"}}),ha=cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),ga=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"}}),ba=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"}}),ya=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 va=createContext(null),ps=createContext(null);function ms({type:e="single",defaultValue:t=[],value:r,onValueChange:n,intent:o,size:a,className:i,children:s,...l}){let[c,u]=useState(t),p=r??c,m=useCallback(d=>{let g=h=>h.includes(d)?h.filter(b=>b!==d):e==="single"?[d]:[...h,d];n?n(g(p)):u(g);},[e,p,n]);return jsx(va.Provider,{value:{expandedItems:p,toggleItem:m,size:a},children:jsx("div",{className:f(ga({intent:o}),i),...l,children:s})})}function ah({value:e,className:t,children:r,...n}){let a=useContext(va)?.expandedItems.includes(e)??false;return jsx(ps.Provider,{value:{value:e,isExpanded:a},children:jsx("div",{className:f("",t),...n,children:r})})}function ih({className:e,children:t,...r}){let n=useContext(va),o=useContext(ps);return jsxs("button",{className:f("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 cursor-pointer gap-2 font-medium transition-colors",fa({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:f("shrink-0 transition-transform duration-200",o?.isExpanded&&"rotate-180")})]})}function sh({className:e,children:t,...r}){let n=useContext(va),o=useContext(ps);return jsx("div",{className:f("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:f("text-primary-500 dark:text-primary-400",ha({size:n?.size}),e),...r,children:t})})})}var Jn=createContext(null),ld=createContext(false);function fs({defaultValue:e="",value:t,onValueChange:r,intent:n,children:o,className:a}){let[i,s]=useState(e),l=t??i,c=useRef(new Map),u=useCallback(m=>{r?r(m):s(m);},[r]),p=useCallback((m,d)=>{d?c.current.set(m,d):c.current.delete(m);},[]);return jsx(Jn.Provider,{value:{activeValue:l,setActiveValue:u,intent:n,registerTrigger:p},children:jsx("div",{className:a,children:o})})}function uh({className:e,scrollable:t,...r}){let n=useContext(Jn),o=useRef(null),[a,i]=useState(null),s=useCallback(()=>{if(!n||!o.current)return;let p=o.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!p){i(null);return}let m=o.current.getBoundingClientRect(),d=p.getBoundingClientRect();i({left:d.left-m.left,width:d.width});},[n]);useLayoutEffect(s,[n?.activeValue,s]),useEffect(()=>{let u=new ResizeObserver(s);return o.current&&u.observe(o.current),()=>u.disconnect()},[s]);let l=n?.intent??"line",c=a&&(l==="line"||l==="underline");return jsxs("div",{ref:o,className:f(ba({intent:n?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,c&&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 ph({value:e,className:t,children:r,...n}){let o=useContext(Jn),a=o?.activeValue===e,i=useCallback(s=>o?.registerTrigger(e,s),[o,e]);return jsx("button",{ref:i,className:f(ya({intent:o?.intent}),t),role:"tab","data-active":a,"aria-selected":a,onClick:()=>o?.setActiveValue(e),...n,children:r})}function mh({className:e,children:t,...r}){let n=useContext(Jn);if(!n)return null;let o=$n.Children.toArray(t).filter(i=>$n.isValidElement(i)),a=Math.max(0,o.findIndex(i=>i.props.value===n.activeValue));return jsx("div",{className:f("overflow-hidden",e),...r,children:jsx(ld.Provider,{value:true,children:jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${a*100}%)`},children:o.map((i,s)=>jsx("div",{className:"w-full shrink-0","aria-hidden":s!==a,children:i},i.props.value??s))})})})}function fh({value:e,className:t,children:r,...n}){let o=useContext(Jn);return useContext(ld)?jsx("div",{className:f("pt-4",t),role:"tabpanel",...n,children:r}):o?.activeValue!==e?null:jsx("div",{className:f("pt-4",t),role:"tabpanel",...n,children:r})}var gh={Accordion:ms,Tabs:fs},hs=gh;var Qn=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"}}),wa=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 mr=[];function wh(e){mr.push(e);}function kh(e){let t=mr.indexOf(e);t!==-1&&mr.splice(t,1);}function bs(e){return mr.length>0&&mr[mr.length-1]===e}function Nh(e){let t=mr.indexOf(e);return t!==-1?t:mr.length}var ys=createContext(null);function Zn({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:o}){let a=useId();return useEffect(()=>{if(e)return wh(a),()=>kh(a)},[e,a]),useEffect(()=>{if(!e||!r)return;let i=s=>{s.key==="Escape"&&bs(a)&&t(false);};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e,r,t,a]),useEffect(()=>{if(!e||!r)return;let i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i;}},[e,r]),e?jsx(ys.Provider,{value:{id:a,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:createPortal(o,document.body)}):null}function vs({size:e,position:t="center",className:r,children:n,...o}){let a=useContext(ys);if(!a)return null;let s=200+Nh(a.id)*10,l=()=>{a.closeOnOutsideClick&&bs(a.id)&&a.onOpenChange(false);},c=t==="bottom";return a.modal?jsx("div",{className:f("animate-fade-in fixed inset-0 bg-black/50",c?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:s},onClick:l,children:jsx("div",{className:f(Qn({size:e}),c?"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:u=>u.stopPropagation(),...o,children:n})}):jsx("div",{className:f("fixed inset-0 flex items-center justify-center p-4",a.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:s},onClick:a.closeOnOutsideClick&&bs(a.id)?()=>a.onOpenChange(false):void 0,children:jsx("div",{className:f(Qn({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:a.closeOnOutsideClick?u=>u.stopPropagation():void 0,...o,children:n})})}function xs({className:e,...t}){return jsx("div",{className:f("mb-4 space-y-1",e),...t})}function ws({className:e,...t}){return jsx("h2",{className:f("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 ks({className:e,...t}){return jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Ns({className:e,...t}){return jsx("div",{className:f("mt-6 flex justify-end gap-2",e),...t})}function Ch({className:e,...t}){let r=useContext(ys);return jsx("button",{className:f("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 Th={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 Cs({content:e,position:t="top",intent:r,delay:n=200,maxWidth:o,children:a,className:i}){let[s,l]=useState(false),[c,u]=useState();return jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let d=setTimeout(()=>l(true),n);u(d);},onMouseLeave:()=>{clearTimeout(c),l(false);},children:[a,s&&jsx("span",{className:f(wa({intent:r}),Th[t],"pointer-events-none",o?"whitespace-normal":"whitespace-nowrap",i),style:o!==void 0?{maxWidth:o}:void 0,role:"tooltip",children:e})]})}var Lh={right:"drawer-enter-right",left:"drawer-enter-left",top:"drawer-enter-top",bottom:"drawer-enter-bottom"},Dh={right:e=>({width:e}),left:e=>({width:e}),top:e=>({height:e}),bottom:e=>({height:e})},Ah={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 ka({open:e,onOpenChange:t,side:r="right",size:n=r==="top"||r==="bottom"?"50vh":"24rem",backdrop:o=true,closeOnBackdropClick:a=true,children:i,className:s}){let l=useRef(null);return useEffect(()=>{if(!e)return;let c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c;}},[e]),useEffect(()=>{if(!e)return;function c(u){u.key==="Escape"&&t(false);}return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),useEffect(()=>{if(!e)return;let c=l.current;if(!c)return;let u=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');u[0]?.focus();function p(m){m.key!=="Tab"||u.length===0||(m.shiftKey?document.activeElement===u[0]&&(m.preventDefault(),u[u.length-1].focus()):document.activeElement===u[u.length-1]&&(m.preventDefault(),u[0].focus()));}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e]),e?createPortal(jsxs("div",{className:"fixed inset-0 z-50",role:"presentation",children:[o&&jsx("div",{className:"drawer-backdrop absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:()=>a&&t(false),"aria-hidden":"true"}),jsx("div",{ref:l,role:"dialog","aria-modal":"true",className:f("drawer-panel absolute flex flex-col","bg-white shadow-2xl dark:bg-primary-900",Ah[r],Lh[r],s),style:Dh[r](n),children:i})]}),document.body):null}function pd({children:e,className:t}){return jsx("div",{className:f("flex shrink-0 items-center justify-between border-b border-primary-100 px-5 py-4 dark:border-primary-800",t),children:e})}function md({children:e,className:t}){return jsx("div",{className:f("flex-1 overflow-y-auto px-5 py-4",t),children:e})}function fd({children:e,className:t}){return jsx("div",{className:f("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 hd({onClose:e,className:t}){return jsx("button",{type:"button",onClick:e,"aria-label":"Close drawer",className:f("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 gd({item:e,depth:t=0,onClose:r}){let[n,o]=useState(false),a=useRef(null),i=useRef(null),s=e.children&&e.children.length>0,l=useRef(null),c=()=>{l.current=setTimeout(()=>o(false),150);},u=()=>{l.current&&clearTimeout(l.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:a,role:"menuitem","aria-disabled":e.disabled,"aria-haspopup":s,"aria-expanded":s?n:void 0,className:f("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:()=>{u(),s&&o(true);},onMouseLeave:()=>{s&&c();},onClick:p=>{e.disabled||s||(e.onClick?.(p),r());},onKeyDown:p=>{e.disabled||((p.key==="Enter"||p.key===" ")&&(p.preventDefault(),s?o(m=>!m):(e.onClick?.(p),r())),p.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&&!s&&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}),s&&jsx(ChevronRight,{className:"ml-auto h-3.5 w-3.5 text-secondary-400"}),s&&n&&jsx("ul",{ref:i,role:"menu",onMouseEnter:u,onMouseLeave:c,className:f("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(p=>jsx(gd,{item:p,depth:t+1,onClose:r},p.key))})]})}function Vh({items:e,position:t,onClose:r}){let n=useRef(null),[o,a]=useState(t);return useEffect(()=>{let i=n.current;if(!i)return;let s=i.getBoundingClientRect(),l=window.innerWidth,c=window.innerHeight,{x:u,y:p}=t;u+s.width>l-8&&(u=Math.max(8,l-s.width-8)),p+s.height>c-8&&(p=Math.max(8,c-s.height-8)),a({x:u,y:p});},[t]),useEffect(()=>{let i=s=>{n.current&&!n.current.contains(s.target)&&r();};return document.addEventListener("mousedown",i,true),document.addEventListener("touchstart",i,true),document.addEventListener("scroll",r,{passive:true,capture:true}),()=>{document.removeEventListener("mousedown",i,true),document.removeEventListener("touchstart",i,true),document.removeEventListener("scroll",r,true);}},[r]),useEffect(()=>{let i=s=>{s.key==="Escape"&&r(),s.key==="Tab"&&s.preventDefault();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[r]),jsx("ul",{ref:n,role:"menu",style:{position:"fixed",left:o.x,top:o.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(i=>jsx(gd,{item:i,onClose:r},i.key))})}function Ss({items:e,children:t,disabled:r,onOpenChange:n,className:o}){let[a,i]=useState(false),[s,l]=useState({x:0,y:0}),c=useRef(null),u=useCallback((h,b)=>{r||(l({x:h,y:b}),i(true),n?.(true));},[r,n]),p=useCallback(()=>{i(false),n?.(false);},[n]),m=useCallback(h=>{h.preventDefault(),h.stopPropagation(),u(h.clientX,h.clientY);},[u]),d=useCallback(h=>{let b=h.touches[0];c.current=setTimeout(()=>{document.addEventListener("contextmenu",y=>y.preventDefault(),{capture:true,once:true}),u(b.clientX,b.clientY);},500);},[u]),g=useCallback(()=>{c.current&&clearTimeout(c.current);},[]);return jsxs(Fragment,{children:[jsx("div",{className:f("contents",o),style:{WebkitTouchCallout:"none",userSelect:"none"},onContextMenu:m,onTouchStart:d,onTouchEnd:g,onTouchMove:g,onTouchCancel:g,children:t}),a&&jsx(Vh,{items:e,position:s,onClose:p})]})}var _h={Dialog:Zn,Tooltip:Cs,Drawer:ka,ContextMenu:Ss},Ps=_h;var Ca=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"}}),cn=cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),no=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"}}),oo=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"}}),Ta=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 Ds({intent:e,className:t,children:r,...n}){return jsx("div",{className:f(no({intent:e}),t),role:"alert",...n,children:r})}function Xh({className:e,...t}){return jsx("h5",{className:f("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function Gh({className:e,...t}){return jsx("span",{className:f("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function qh({className:e,...t}){return jsx("div",{className:f("flex-1 min-w-0 space-y-1",e),...t})}function Jh({className:e,...t}){return jsx("p",{className:f("text-sm opacity-90",e),...t})}var Qh=0,Fr=[],Ma=new Map,Rs=new Set;function Zh(){return Fr}function Es(){Rs.forEach(e=>e());}function As(e){let t=Ma.get(e);t&&(clearTimeout(t),Ma.delete(e)),Fr=Fr.map(r=>r.id===e?{...r,exiting:true}:r),Es(),setTimeout(()=>{Fr=Fr.filter(r=>r.id!==e),Es();},200);}function eg(e){let t=`alert-${++Qh}`;Fr=[...Fr,{...e,id:t}],Es();let r=e.duration??5e3;if(r>0){let n=setTimeout(()=>{Ma.delete(t),As(t);},r);Ma.set(t,n);}return t}var Ls=16;function tg(e){Ls=e;}var rg={"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"},ng={"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"},og={success:CircleCheck,warning:TriangleAlert,error:CircleX,info:Info};function ag({alert:e,onClose:t}){let r=e.intent??"info",n=og[r],o=e.position??"top-right";return jsxs("div",{className:f(no({intent:r}),ng[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:f(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 ig=e=>e.startsWith("top");function sg(){let e=useSyncExternalStore(n=>(Rs.add(n),()=>Rs.delete(n)),Zh),t=useRef(Ls);if(useEffect(()=>{t.current=Ls;},[]),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:ig(n)?{top:`${t.current}px`}:void 0,className:f("pointer-events-none fixed z-100 flex flex-col gap-2",rg[n]),children:o.map(a=>jsx(ag,{alert:a,onClose:()=>As(a.id)},a.id))},n))}),document.body)}var yd=false;function lg(){if(yd)return;yd=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),createRoot(e).render(jsx(sg,{}));}function cg(){return useEffect(()=>{lg();},[]),{addAlert:eg,removeAlert:As}}function zs({value:e=0,size:t,intent:r,edge:n,showLabel:o=false,indeterminate:a=false,animated:i=false,duration:s=500,className:l,...c}){let u=Math.max(0,Math.min(100,e)),[p,m]=useState(0),d=useRef(0);useEffect(()=>{if(!a)return d.current=requestAnimationFrame(()=>{m(u);}),()=>{d.current&&cancelAnimationFrame(d.current);}},[u,a]);let g=o&&!a&&t!=="xs"&&t!=="sm",h=jsx("div",{role:"progressbar","aria-valuenow":a?void 0:u,"aria-valuemin":0,"aria-valuemax":100,className:f(Ca({size:t,intent:r,edge:n}),l),...c,children:a?jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsx("div",{className:f("progress-fill h-full rounded-full transition-[width] ease-out",i&&"animate-progress-shine"),style:{width:`${p}%`,transitionDuration:`${s}ms`},children:g&&jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(u),"%"]})})});return n==="top"||n==="bottom"?createPortal(h,document.body):h}function Sa({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 Hs({spinning:e=true,tip:t,size:r,className:n,children:o,...a}){return o?jsxs("div",{className:f("relative w-fit",n),...a,children:[jsx("div",{className:f("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(Sa,{size:r}),t&&jsx("span",{className:f(cn({size:r}),"select-none"),children:t})]})]}):e?jsxs("div",{className:f("inline-flex flex-col items-center gap-2",n),...a,children:[jsx(Sa,{size:r}),t&&jsx("span",{className:f(cn({size:r}),"select-none"),children:t})]}):null}var yg=0,io=[],Vs=new Set;function vg(){return io}function Cd(){Vs.forEach(e=>e());}function xg(e,t){let r=++yg;return io=[...io,{id:r,target:e,tip:t}],Cd(),()=>wg(r)}function wg(e){io=io.filter(t=>t.id!==e),Cd();}function kg(){return xg}var kd=false;function Ng(){if(kd||typeof document>"u")return;kd=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(Sg,{}));});}var Pa=new Map;function Cg(e){let t=Pa.get(e);if(t){t.count++;return}let r=getComputedStyle(e),n=e.style.position;r.position==="static"&&(e.style.position="relative"),Pa.set(e,{count:1,original:n});}function Tg(e){let t=Pa.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,Pa.delete(e)));}function Mg({entry:e}){return useEffect(()=>{let t=e.target;if(!Nd(t))return Cg(t),()=>Tg(t)},[e.target]),Nd(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(Sa,{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(Sa,{size:"md"}),e.tip&&jsx("span",{className:f(cn({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function Sg(){let e=useSyncExternalStore(t=>(Vs.add(t),()=>Vs.delete(t)),()=>vg());return e.length===0?null:jsx(Fragment,{children:e.map(t=>jsx(Mg,{entry:t},t.id))})}function Nd(e){return e===document.documentElement||e===document.body}typeof document<"u"&&Ng();function Td(e){if(e!==void 0)return typeof e=="number"?`${e}px`:e}function Ra({variant:e="text",animation:t="pulse",width:r,height:n,lines:o,className:a,style:i,...s}){let l=Td(r),c=Td(n);return e==="text"&&o!==void 0&&o>1?jsx("span",{className:f("flex flex-col gap-2",a),"aria-hidden":"true",role:"presentation",style:i,...s,children:Array.from({length:o},(u,p)=>jsx("span",{className:oo({variant:"text",animation:t}),style:{width:p===o-1?"60%":l??"100%",height:c}},p))}):jsx("span",{className:f(oo({variant:e,animation:t}),a),"aria-hidden":"true",role:"presentation",style:{width:l,height:c,...i},...s})}var Dg=0,Md=320;function Sd(e,t){let[r,n]=useState([]),o=useRef(new Map),a=useCallback(u=>{let p=o.current.get(u);p!==void 0&&(clearTimeout(p),o.current.delete(u));},[]),i=useCallback(u=>{a(u),n(p=>p.map(m=>m.id===u?{...m,_exiting:true}:m)),setTimeout(()=>n(p=>p.filter(m=>m.id!==u)),Md);},[a]),s=useCallback(u=>i(u),[i]),l=useCallback(()=>{o.current.forEach(clearTimeout),o.current.clear(),n(u=>u.map(p=>({...p,_exiting:true}))),setTimeout(()=>n([]),Md);},[]),c=useCallback(u=>{let p=`toast-${++Dg}`,m=u.position??e,d=u.duration!==void 0?u.duration:t;if(n(g=>[...g,{...u,id:p,position:m,duration:d,_exiting:false}]),d>0){let g=setTimeout(()=>{o.current.delete(p),i(p);},d);o.current.set(p,g);}return p},[e,t,i]);return useEffect(()=>{let u=o.current;return ()=>{u.forEach(clearTimeout),u.clear();}},[]),{items:r,toast:c,dismiss:s,dismissAll:l}}var lo=createContext(null),$g={"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"},Og={"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"},Kg={"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"},jg={default:Bell,success:CheckCircle2,danger:XCircle,warning:AlertTriangle,info:Info};function Wg({item:e,onDismiss:t}){let r=e.variant??"default",n=e.position??"top-right",o=e.dismissible!==false,a=jg[r],i=()=>{e.onDismiss?.(e.id),t(e.id);};return jsx("div",{className:f("toast-wrapper",e._exiting&&`toast-wrapper-exiting ${Kg[n]}`),children:jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:f(Ta({variant:r}),"toast-item pointer-events-auto",!e._exiting&&Og[n]),children:[jsx(a,{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:f("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})]}),o&&jsx("button",{type:"button",onClick:i,"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 Ea({children:e,defaultPosition:t="top-right",defaultDuration:r=4e3}){let{items:n,toast:o,dismiss:a,dismissAll:i}=Sd(t,r),s=n.reduce((l,c)=>{let u=c.position??t;return (l[u]??(l[u]=[])).push(c),l},{});return jsxs(lo.Provider,{value:{toast:o,dismiss:a,dismissAll:i},children:[e,typeof document<"u"&&createPortal(jsx(Fragment,{children:Object.entries(s).map(([l,c])=>jsx("div",{className:f("pointer-events-none fixed z-[100] flex flex-col gap-2",$g[l]),children:c.map(u=>jsx(Wg,{item:u,onDismiss:a},u.id))},l))}),document.body)]})}function La(){let e=useContext(lo);if(!e)throw new Error("useToast must be used within a <ToastProvider>");return e}var Xg={Alert:Ds,ProgressBar:zs,Spin:Hs,Skeleton:Ra,ToastProvider:Ea,useToast:La},Bs=Xg;var Ld="#1c1914",Dd="#130f0b",db="#2e261e",Os="#504638",dn="#6b5d4d",Aa=`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")`,ub=[{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 Ks({photos:e,layout:t="strip",actions:r=ub,onAction:n,className:o,showGrain:a=true,sheetTitle:i,sheetLabel:s}){let[l,c]=useState(null),[u,p]=useState(new Set),m=useCallback(b=>c(b),[]),d=useCallback(()=>c(null),[]),g=useCallback((b,y)=>{if(r.find(N=>N.key===b)?.toggle){let N=`${y}-${b}`;p(x=>{let w=new Set(x);return w.has(N)?w.delete(N):w.add(N),w});}n?.(b,e[y],y);},[r,n,e]);return jsxs(Fragment,{children:[jsx(t==="strip"?pb:t==="sheet"?mb:fb,{photos:e,onPhotoClick:m,showGrain:a,className:o,sheetTitle:i,sheetLabel:s}),l!==null&&createPortal(jsx(hb,{photos:e,currentIndex:l,onIndexChange:c,onClose:d,actions:r,activeActions:u,onAction:g,showGrain:a}),document.body)]})}function Ed({count:e=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Ld},children:Array.from({length:e}).map((t,r)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:db}},r))})}function pb({photos:e,onPhotoClick:t,showGrain:r,className:n}){let o=useRef(null);return jsxs("div",{className:f("select-none rounded-lg overflow-hidden",n),style:{background:Dd},children:[jsx(Ed,{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:Ld,scrollSnapType:"x mandatory"},children:e.map((a,i)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(i),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:Os,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:Aa,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:dn},children:[String(i+1).padStart(2,"0"),i%2===0?"":"A"]})]},i))}),jsx(Ed,{count:Math.max(30,e.length*6)})]})}function mb({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:o,sheetLabel:a}){return jsxs("div",{className:f("rounded-lg p-5",n),style:{background:Dd},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:dn},children:o??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:dn},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((i,s)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${s*50}ms both`},onClick:()=>t(s),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:dn},children:String(s+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:Os,aspectRatio:"3/2"},children:[jsx("img",{src:i.src,alt:i.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:Aa}}),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:i.title})})]})]},s))})]})}function fb({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[o,a]=useState(false),[i,s]=useState(null),l=Math.min(e.length,8),c=e.slice(0,l),u=m=>{let d=Math.sin(m*137.508+1)*1e4,g=(d%12-6).toFixed(1),h=(d/7%8-4).toFixed(1),b=(d/13%6-3).toFixed(1);return `rotate(${g}deg) translate(${h}px, ${b}px)`},p=(m,d)=>{let g=(d-1)/2,h=((m-g)*7).toFixed(1),b=((m-g)*110).toFixed(0),y=(-Math.abs(m-g)*10+(i===m?-18:0)).toFixed(0);return `translateX(${b}px) translateY(${y}px) rotate(${h}deg)`};return jsxs("div",{className:f("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),s(null);},children:c.map((m,d)=>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?`${d*35}ms`:`${(l-d)*25}ms`,transform:o?p(d,c.length):u(d),zIndex:o?d+1:c.length-d,width:220,height:147},onClick:()=>t(d),onMouseEnter:()=>o&&s(d),onMouseLeave:()=>s(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:o&&i===d?"rgba(217,171,89,0.5)":Os,boxShadow:o&&i===d?"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:m.src,alt:m.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:Aa}}),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&&i===d&&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:m.title})})]})},d))}),e.length>l&&jsxs("span",{className:"font-mono text-xs",style:{color:dn},children:["+ ",e.length-l," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:dn,opacity:o?0:.7},children:"Hover to explore"})]})}function hb({photos:e,currentIndex:t,onIndexChange:r,onClose:n,actions:o,activeActions:a,onAction:i,showGrain:s}){let l=e[t],[c,u]=useState(1),[p,m]=useState({x:0,y:0}),[d,g]=useState(false),[h,b]=useState(false),y=useRef(false),v=useRef({x:0,y:0}),N=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>b(true));},[]),useEffect(()=>{let C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C;}},[]),useEffect(()=>{let C=I=>{switch(I.key){case "Escape":n();break;case "ArrowLeft":x(-1);break;case "ArrowRight":x(1);break;case "i":case "I":g(k=>!k);break}};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)}),useEffect(()=>{let C=N.current;if(!C)return;let I=k=>{k.preventDefault();let M=k.deltaY<0?1.12:.89;u(R=>{let $=Math.min(8,Math.max(1,R*M));return $<=1&&m({x:0,y:0}),$});};return C.addEventListener("wheel",I,{passive:false}),()=>C.removeEventListener("wheel",I)},[]);let x=useCallback(C=>{let I=t+C;I>=0&&I<e.length&&(r(I),u(1),m({x:0,y:0}));},[t,e.length,r]),w=useCallback(C=>{c<=1||(y.current=true,v.current={x:C.clientX,y:C.clientY},C.target.setPointerCapture(C.pointerId));},[c]),L=useCallback(C=>{if(!y.current)return;let I=C.clientX-v.current.x,k=C.clientY-v.current.y;v.current={x:C.clientX,y:C.clientY},m(M=>({x:M.x+I/c,y:M.y+k/c}));},[c]),P=useCallback(()=>{y.current=false;},[]),A=useCallback(()=>{c>1?(u(1),m({x:0,y:0})):u(2.5);},[c]),D=C=>a.has(`${t}-${C}`),S=l.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}),s&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Aa,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:[c.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>u(C=>Math.min(8,C*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:()=>{u(C=>{let I=Math.max(1,C*.7);return I<=1&&m({x:0,y:0}),I});},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:N,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:c>1?"grab":"default"},onPointerDown:w,onPointerMove:L,onPointerUp:P,onDoubleClick:A,children:[jsx("img",{src:l.src,alt:l.alt??l.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(${c}) translate(${p.x}px, ${p.y}px)`,transition:y.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:C=>{C.stopPropagation(),x(-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:C=>{C.stopPropagation(),x(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:f("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",d?"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:[l.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:l.title}),l.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:l.description}),S&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[S.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.camera,S.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),S.lens&&S.lens]}),(S.aperture||S.shutter||S.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[S.aperture,S.shutter,S.iso&&`ISO ${S.iso}`].filter(Boolean).join(" \xB7 ")]}),S.date&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.date]}),S.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.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(C=>{let I=C.toggle&&D(C.key);return jsx("button",{className:f("rounded-full p-2.5 transition-all duration-200",I?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>i(C.key,t),title:C.label,children:I&&C.activeIcon?C.activeIcon:C.icon},C.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:f("rounded-full p-2.5 transition-all duration-200",d?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>g(C=>!C),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var js="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 Id(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 Pb(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var Rb={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Eb={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Lb={"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 Ws({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:n,theme:o,docked:a=false,visible:i,onVisibleChange:s,onTrackChange:l,onLike:c,autoPlay:u=true,shuffle:p=false,loop:m=false,accent:d="#8b5cf6",className:g}){let [h,b]=useState(t),[y,v]=useState(false),[N,x]=useState(0),[w,L]=useState(0),[P,A]=useState(.8),[D,S]=useState(false),[C,I]=useState(new Set),[k,T]=useState(false),[R,O]=useState(i??!a),[E,ne]=useState(false),[U,z]=useState(false),[H,_]=useState(p),[V,oe]=useState(m),be=useRef(false),M=useRef(null),F=useRef(null),re=useRef(void 0),W=useRef(null),G=useRef(null),le=i??R,ke=n??Pb(r),B=e[h],Z=a,ue=o==="dark"?"dark":o==="light"?"light":"",te="bg-(--mp-bg)",ve="text-(--mp-text)",Ne="text-(--mp-text-muted)",X$1="text-(--accent)",de="border-(--mp-border)";useEffect(()=>{let J=M.current;J&&(J.src=B.src,J.load(),y&&J.play().catch(()=>{}));},[h,B.src]),useEffect(()=>{if(!u||be.current)return;let J=M.current;if(!J)return;let Ce=()=>{be.current=true,v(true),J.play().catch(()=>{});};return J.addEventListener("canplaythrough",Ce,{once:true}),()=>J.removeEventListener("canplaythrough",Ce)},[u]),useEffect(()=>{let J=M.current;J&&(y?J.play().catch(()=>{}):J.pause());},[y]),useEffect(()=>{let J=M.current;J&&(J.muted=D,G.current?G.current.gain.value=D?0:P:J.volume=P);},[P,D]),useEffect(()=>{let J=M.current;if(!J)return;let Ce=()=>x(J.currentTime),Ye=()=>L(J.duration),vt=()=>{V?(J.currentTime=0,J.play().catch(()=>{})):ie();};return J.addEventListener("timeupdate",Ce),J.addEventListener("loadedmetadata",Ye),J.addEventListener("ended",vt),()=>{J.removeEventListener("timeupdate",Ce),J.removeEventListener("loadedmetadata",Ye),J.removeEventListener("ended",vt);}},[h,e.length]);let Q=useCallback(J=>{let Ce=(J%e.length+e.length)%e.length;b(Ce),x(0),l?.(Ce,e[Ce]),le||(O(true),s?.(true));},[e,le,l,s]),ie=useCallback(()=>{if(H){let J;do J=Math.floor(Math.random()*e.length);while(J===h&&e.length>1);Q(J);}else Q(h+1);},[Q,h,H,e.length]),Pe=useCallback(()=>{if(H){let J;do J=Math.floor(Math.random()*e.length);while(J===h&&e.length>1);Q(J);}else Q(h-1);},[Q,h,H,e.length]),Oe=useCallback(()=>{let J=C.has(h);I(Ce=>{let Ye=new Set(Ce);return J?Ye.delete(h):Ye.add(h),Ye}),c?.(h,B,!J);},[h,C,c,B]),Xe=useCallback(J=>{let Ce=J.currentTarget.getBoundingClientRect(),vt=Math.max(0,Math.min(1,(J.clientX-Ce.left)/Ce.width))*w;M.current&&(M.current.currentTime=vt),x(vt);},[w]),se=useCallback(()=>{ne(true);let J=Z?200:400;re.current=setTimeout(()=>{ne(false),O(false),s?.(false);},J);},[Z,s]);useEffect(()=>()=>{re.current&&clearTimeout(re.current);},[]),useEffect(()=>()=>{W.current?.close();},[]);function Re(){if(W.current||!M.current){W.current?.resume();return}try{let J=window.AudioContext??window.webkitAudioContext;if(!J)return;let Ce=new J,Ye=Ce.createGain();Ye.gain.value=D?0:P,Ce.createMediaElementSource(M.current).connect(Ye).connect(Ce.destination),W.current=Ce,G.current=Ye,Ce.resume();}catch{}}let K=U?"fade-in 0.2s ease-out both":`mp-enter-${ke} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,ce=U?"fade-in 0.2s ease-in reverse both":`mp-exit-${ke} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,me=w>0?N/w*100:0;return Z&&!le&&!E?jsxs(Fragment,{children:[jsx("audio",{ref:M,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:f("fixed z-100 cursor-pointer transition-all duration-300",Lb[r]),style:{"--accent":d},onMouseEnter:()=>{z(true),O(true),s?.(true);},children:[jsx("div",{className:f("h-full w-full rounded-full",y?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:y?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),y&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!le&&!E?jsx("audio",{ref:M,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:M,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:f("fixed z-100",Z?Eb[r]:Rb[r],ue),style:{"--accent":d,...E?{animation:ce}:{animation:K}},onMouseEnter:()=>{Z&&(re.current&&(clearTimeout(re.current),re.current=void 0),E&&ne(false),z(true));},onMouseLeave:()=>{Z&&(z(false),se());},children:jsxs("div",{className:f("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",te,de,Z&&"rounded-none",r.endsWith("right")&&Z&&"rounded-l-2xl",r.endsWith("left")&&Z&&"rounded-r-2xl",g),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:B.cover||js,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:y?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:B.cover||js,alt:B.album??B.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"})})]}),y&&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:f("truncate text-sm font-semibold",ve),children:B.title}),B.artist&&jsx("div",{className:f("truncate text-xs",Ne),children:B.artist}),B.album&&jsx("div",{className:f("mt-0.5 truncate text-[10px] tracking-wide",Ne,"opacity-60"),children:B.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:f("rounded-full p-1.5 transition-all duration-200",C.has(h)?"text-rose-500 hover:text-rose-400":f(Ne,"hover:text-rose-500")),onClick:Oe,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:C.has(h)?"currentColor":"none"})}),jsx("button",{className:f("rounded-full p-1.5 transition-colors",Ne,"hover:"+ve.split(" ")[0]),onClick:()=>T(J=>!J),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!Z&&jsx("button",{className:f("rounded-full p-1.5 transition-colors",Ne,"hover:"+ve.split(" ")[0]),onClick:se,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:F,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Xe,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${me}%`}}),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(${me}% - 6px)`}})]}),jsxs("div",{className:f("mt-1 flex justify-between text-[10px] font-mono",Ne),children:[jsx("span",{children:Id(N)}),jsx("span",{children:Id(w)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:f("rounded-full p-1.5 transition-colors",H?X$1:Ne,"hover:text-(--mp-text)"),onClick:()=>_(J=>!J),title:H?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:f("rounded-full p-1.5 transition-colors",V?X$1:Ne,"hover:text-(--mp-text)"),onClick:()=>oe(J=>!J),title:V?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:f("rounded-full p-2 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:Pe,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:f("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:()=>{Re(),v(J=>!J);},title:y?"Pause":"Play",children:y?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:f("rounded-full p-2 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:ie,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:f("rounded-full p-1 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:()=>{Re();let J=!D;S(J),G.current&&(G.current.gain.value=J?0:P);},title:D?"Unmute":"Mute",children:D||P===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:D?0:P,onChange:J=>{Re();let Ce=Number(J.target.value);A(Ce),D&&S(false),G.current&&(G.current.gain.value=Ce);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:f("overflow-hidden transition-all duration-300 ease-in-out",k?"max-h-60":"max-h-0"),children:jsx("div",{className:f("border-t px-2 py-2",de),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((J,Ce)=>{let Ye=Ce===h;return jsxs("button",{className:f("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",Ye?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{Q(Ce),v(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:Ye&&y?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(vt=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+vt*4}px`,animation:`mp-eq-bar ${.4+vt*.15}s ease-in-out infinite alternate`}},vt))}):Ye?jsx(Disc3,{className:f("h-4 w-4",X$1)}):jsx("span",{className:f("text-xs font-mono",Ne),children:Ce+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:J.cover||js,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:f("truncate text-xs font-medium",Ye?X$1:ve),children:J.title}),J.artist&&jsx("div",{className:f("truncate text-[10px]",Ne),children:J.artist})]}),C.has(Ce)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},Ce)})})})})]})})]})}function za(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 Ub={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 Us({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:n=false,loop:o=false,onTrackChange:a,onPlayChange:i,accent:s="#8b5cf6",className:l}){let[c,u]=useState(t),[p,m]=useState(false),[d,g]=useState(0),[h,b]=useState(0),[y,v]=useState(0),[N,x]=useState(.8),[w,L]=useState(false),[P,A]=useState(n),[D,S]=useState(o),[C,I]=useState(false),[k,T]=useState("title"),[R,O]=useState(true),[E,ne]=useState(false),[U,z]=useState(false),[H,_]=useState(false),[V,oe]=useState(true),[be,M]=useState(false),[F,re]=useState(null),W=useRef(null),G=useRef(null),le=useRef(void 0),ke=useRef(false),B=e[c],q=On.useMemo(()=>{let K=e.map((ce,me)=>({media:ce,originalIndex:me}));return K.sort((ce,me)=>{let J=Ub[k](ce.media,me.media);return R?J:-J}),K},[e,k,R]);useEffect(()=>{let K=W.current;if(!K)return;M(true),K.src=B.src,B.poster&&(K.poster=B.poster),K.load();let ce=()=>{M(false),p&&K.play().catch(()=>{});};return K.addEventListener("loadeddata",ce,{once:true}),()=>K.removeEventListener("loadeddata",ce)},[c,B.src]),useEffect(()=>{if(!r||ke.current)return;let K=W.current;if(!K)return;let ce=()=>{ke.current=true,m(true),K.play().catch(()=>{});};return K.addEventListener("canplaythrough",ce,{once:true}),()=>K.removeEventListener("canplaythrough",ce)},[r]),useEffect(()=>{let K=W.current;K&&(p?K.play().catch(()=>{}):K.pause(),i?.(p));},[p]),useEffect(()=>{let K=W.current;K&&(K.volume=w?0:N);},[N,w]),useEffect(()=>{let K=W.current;if(!K)return;let ce=()=>g(K.currentTime),me=()=>b(K.duration),J=()=>{K.buffered.length>0&&v(K.buffered.end(K.buffered.length-1));},Ce=()=>{D?(K.currentTime=0,K.play().catch(()=>{})):te();};return K.addEventListener("timeupdate",ce),K.addEventListener("loadedmetadata",me),K.addEventListener("progress",J),K.addEventListener("ended",Ce),()=>{K.removeEventListener("timeupdate",ce),K.removeEventListener("loadedmetadata",me),K.removeEventListener("progress",J),K.removeEventListener("ended",Ce);}},[c,e.length,D]);let Z=useCallback(()=>{oe(true),le.current&&clearTimeout(le.current),le.current=setTimeout(()=>{p&&oe(false);},3e3);},[p]);useEffect(()=>{p?Z():(oe(true),le.current&&clearTimeout(le.current));},[p,Z]),useEffect(()=>()=>{le.current&&clearTimeout(le.current);},[]);let ue=useCallback(K=>{let ce=(K%e.length+e.length)%e.length;u(ce),g(0),m(true),a?.(ce,e[ce]);},[e,a]),te=useCallback(()=>{if(P){let K;do K=Math.floor(Math.random()*e.length);while(K===c&&e.length>1);ue(K);}else ue(c+1);},[ue,c,P,e.length]),ve=useCallback(()=>{if(P){let K;do K=Math.floor(Math.random()*e.length);while(K===c&&e.length>1);ue(K);}else ue(c-1);},[ue,c,P,e.length]),Ne=useCallback(K=>{let ce=K.currentTarget.getBoundingClientRect(),J=Math.max(0,Math.min(1,(K.clientX-ce.left)/ce.width))*h;W.current&&(W.current.currentTime=J),g(J);},[h]),X$1=useCallback(K=>{let ce=K.currentTarget.getBoundingClientRect(),me=Math.max(0,Math.min(1,(K.clientX-ce.left)/ce.width));re(me*h);},[h]),de=useCallback(()=>{G.current&&(document.fullscreenElement?document.exitFullscreen():G.current.requestFullscreen());},[]);useEffect(()=>{let K=()=>_(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",K),()=>document.removeEventListener("fullscreenchange",K)},[]);let Q=useCallback(()=>{E?(z(true),setTimeout(()=>{ne(false),z(false);},500)):ne(true);},[E]),ie=useCallback(()=>{I(K=>!K);},[]),Pe=useCallback(()=>{let K=["title","type","duration"],ce=K.indexOf(k);R?O(false):(O(true),T(K[(ce+1)%K.length]));},[k,R]);useEffect(()=>{let K=ce=>{if(!(ce.target instanceof HTMLInputElement||ce.target instanceof HTMLTextAreaElement))switch(ce.key){case " ":case "k":ce.preventDefault(),m(me=>!me);break;case "f":ce.preventDefault(),de();break;case "t":ce.preventDefault(),Q();break;case "ArrowLeft":ce.preventDefault(),W.current&&(W.current.currentTime=Math.max(0,d-5));break;case "ArrowRight":ce.preventDefault(),W.current&&(W.current.currentTime=Math.min(h,d+5));break;case "ArrowUp":ce.preventDefault(),x(me=>Math.min(1,me+.05));break;case "ArrowDown":ce.preventDefault(),x(me=>Math.max(0,me-.05));break;case "Escape":E&&Q();break;case "n":ce.preventDefault(),te();break;case "p":ce.preventDefault(),ve();break;case "l":ce.preventDefault(),ie();break}};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[de,Q,ie,te,ve,d,h,E]);let Oe=h>0?d/h*100:0,Xe=h>0?y/h*100:0,se="text-(--accent)",Re=jsxs("div",{ref:G,className:f("group flex overflow-hidden",H?"h-full w-full":"aspect-video w-full",!H&&"rounded-xl",!H&&p&&"shadow-2xl",!H&&!p&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",l),style:{"--accent":s,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:f("relative flex-1 min-w-0 h-full overflow-hidden",be&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:Z,onMouseLeave:()=>{p&&oe(false);},children:[jsx("video",{ref:W,className:"h-full w-full object-contain",poster:B.poster,playsInline:true,preload:"metadata",onClick:()=>m(K=>!K)}),!p&&!be&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>m(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)"}})})}),be&&!V&&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:B.title}),B.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:B.subtitle})]})}),jsx("div",{className:f("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",V?"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:B.title}),B.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:B.subtitle})]}),B.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:B.type})]})}),jsxs("div",{className:f("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",V?"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:Ne,onMouseMove:X$1,onMouseLeave:()=>re(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${Xe}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${Oe}%`}}),F!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${F/h*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:za(F)}),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(${Oe}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>m(K=>!K),title:p?"Pause (k)":"Play (k)",children:p?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:ve,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:te,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:()=>L(K=>!K),title:w?"Unmute":"Mute",children:w||N===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:w?0:N,onChange:K=>{x(Number(K.target.value)),w&&L(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:[za(d)," / ",za(h)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:f("cp-btn",P&&se),onClick:()=>A(K=>!K),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:f("cp-btn",D&&se),onClick:()=>S(K=>!K),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:f("cp-btn",C&&se),onClick:ie,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:f("cp-btn",E&&se),onClick:Q,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:de,title:"Fullscreen (f)",children:H?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:f("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",C?"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:Pe,title:`Sort: ${k} ${R?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),k,R?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:ie,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:q.map(({media:K,originalIndex:ce})=>{let me=ce===c;return jsxs("button",{className:f("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",me?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:me?void 0:{color:"var(--cp-text)"},onClick:()=>{ue(ce);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[K.poster?jsx("img",{src:K.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)"}})}),me&&p&&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(J=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+J*3}px`,animation:`mp-eq-bar ${.3+J*.12}s ease-in-out infinite alternate`}},J))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:K.title}),jsxs("div",{className:"flex items-center gap-2",children:[K.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:K.type}),K.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:za(K.duration)})]})]}),me&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},ce)})})]})}),jsx("style",{children:`
|
|
7
|
+
</svg>`);function Id(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 Pb(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var Rb={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Eb={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Lb={"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 Ws({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:n,theme:o,docked:a=false,visible:i,onVisibleChange:s,onTrackChange:l,onLike:c,autoPlay:u=true,shuffle:p=false,loop:m=false,accent:d="#8b5cf6",className:g}){let [h,b]=useState(t),[y,v]=useState(false),[N,x]=useState(0),[w,L]=useState(0),[P,A]=useState(.8),[D,S]=useState(false),[C,I]=useState(new Set),[k,M]=useState(false),[R,$]=useState(i??!a),[E,ne]=useState(false),[U,z]=useState(false),[H,_]=useState(p),[V,oe]=useState(m),be=useRef(false),T=useRef(null),F=useRef(null),re=useRef(void 0),W=useRef(null),G=useRef(null),le=i??R,ke=n??Pb(r),B=e[h],Z=a,ue=o==="dark"?"dark":o==="light"?"light":"",te="bg-(--mp-bg)",ve="text-(--mp-text)",Ne="text-(--mp-text-muted)",X$1="text-(--accent)",de="border-(--mp-border)";useEffect(()=>{let J=T.current;J&&(J.src=B.src,J.load(),y&&J.play().catch(()=>{}));},[h,B.src]),useEffect(()=>{if(!u||be.current)return;let J=T.current;if(!J)return;let Ce=()=>{be.current=true,v(true),J.play().catch(()=>{});};return J.addEventListener("canplaythrough",Ce,{once:true}),()=>J.removeEventListener("canplaythrough",Ce)},[u]),useEffect(()=>{let J=T.current;J&&(y?J.play().catch(()=>{}):J.pause());},[y]),useEffect(()=>{let J=T.current;J&&(J.muted=D,G.current?G.current.gain.value=D?0:P:J.volume=P);},[P,D]),useEffect(()=>{let J=T.current;if(!J)return;let Ce=()=>x(J.currentTime),Ye=()=>L(J.duration),vt=()=>{V?(J.currentTime=0,J.play().catch(()=>{})):ie();};return J.addEventListener("timeupdate",Ce),J.addEventListener("loadedmetadata",Ye),J.addEventListener("ended",vt),()=>{J.removeEventListener("timeupdate",Ce),J.removeEventListener("loadedmetadata",Ye),J.removeEventListener("ended",vt);}},[h,e.length]);let Q=useCallback(J=>{let Ce=(J%e.length+e.length)%e.length;b(Ce),x(0),l?.(Ce,e[Ce]),le||($(true),s?.(true));},[e,le,l,s]),ie=useCallback(()=>{if(H){let J;do J=Math.floor(Math.random()*e.length);while(J===h&&e.length>1);Q(J);}else Q(h+1);},[Q,h,H,e.length]),Pe=useCallback(()=>{if(H){let J;do J=Math.floor(Math.random()*e.length);while(J===h&&e.length>1);Q(J);}else Q(h-1);},[Q,h,H,e.length]),$e=useCallback(()=>{let J=C.has(h);I(Ce=>{let Ye=new Set(Ce);return J?Ye.delete(h):Ye.add(h),Ye}),c?.(h,B,!J);},[h,C,c,B]),Xe=useCallback(J=>{let Ce=J.currentTarget.getBoundingClientRect(),vt=Math.max(0,Math.min(1,(J.clientX-Ce.left)/Ce.width))*w;T.current&&(T.current.currentTime=vt),x(vt);},[w]),se=useCallback(()=>{ne(true);let J=Z?200:400;re.current=setTimeout(()=>{ne(false),$(false),s?.(false);},J);},[Z,s]);useEffect(()=>()=>{re.current&&clearTimeout(re.current);},[]),useEffect(()=>()=>{W.current?.close();},[]);function Re(){if(W.current||!T.current){W.current?.resume();return}try{let J=window.AudioContext??window.webkitAudioContext;if(!J)return;let Ce=new J,Ye=Ce.createGain();Ye.gain.value=D?0:P,Ce.createMediaElementSource(T.current).connect(Ye).connect(Ce.destination),W.current=Ce,G.current=Ye,Ce.resume();}catch{}}let K=U?"fade-in 0.2s ease-out both":`mp-enter-${ke} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,ce=U?"fade-in 0.2s ease-in reverse both":`mp-exit-${ke} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,me=w>0?N/w*100:0;return Z&&!le&&!E?jsxs(Fragment,{children:[jsx("audio",{ref:T,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:f("fixed z-100 cursor-pointer transition-all duration-300",Lb[r]),style:{"--accent":d},onMouseEnter:()=>{z(true),$(true),s?.(true);},children:[jsx("div",{className:f("h-full w-full rounded-full",y?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:y?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),y&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!le&&!E?jsx("audio",{ref:T,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:T,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:f("fixed z-100",Z?Eb[r]:Rb[r],ue),style:{"--accent":d,...E?{animation:ce}:{animation:K}},onMouseEnter:()=>{Z&&(re.current&&(clearTimeout(re.current),re.current=void 0),E&&ne(false),z(true));},onMouseLeave:()=>{Z&&(z(false),se());},children:jsxs("div",{className:f("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",te,de,Z&&"rounded-none",r.endsWith("right")&&Z&&"rounded-l-2xl",r.endsWith("left")&&Z&&"rounded-r-2xl",g),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:B.cover||js,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:y?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:B.cover||js,alt:B.album??B.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"})})]}),y&&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:f("truncate text-sm font-semibold",ve),children:B.title}),B.artist&&jsx("div",{className:f("truncate text-xs",Ne),children:B.artist}),B.album&&jsx("div",{className:f("mt-0.5 truncate text-[10px] tracking-wide",Ne,"opacity-60"),children:B.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:f("rounded-full p-1.5 transition-all duration-200",C.has(h)?"text-rose-500 hover:text-rose-400":f(Ne,"hover:text-rose-500")),onClick:$e,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:C.has(h)?"currentColor":"none"})}),jsx("button",{className:f("rounded-full p-1.5 transition-colors",Ne,"hover:"+ve.split(" ")[0]),onClick:()=>M(J=>!J),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!Z&&jsx("button",{className:f("rounded-full p-1.5 transition-colors",Ne,"hover:"+ve.split(" ")[0]),onClick:se,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:F,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Xe,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${me}%`}}),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(${me}% - 6px)`}})]}),jsxs("div",{className:f("mt-1 flex justify-between text-[10px] font-mono",Ne),children:[jsx("span",{children:Id(N)}),jsx("span",{children:Id(w)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:f("rounded-full p-1.5 transition-colors",H?X$1:Ne,"hover:text-(--mp-text)"),onClick:()=>_(J=>!J),title:H?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:f("rounded-full p-1.5 transition-colors",V?X$1:Ne,"hover:text-(--mp-text)"),onClick:()=>oe(J=>!J),title:V?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:f("rounded-full p-2 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:Pe,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:f("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:()=>{Re(),v(J=>!J);},title:y?"Pause":"Play",children:y?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:f("rounded-full p-2 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:ie,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:f("rounded-full p-1 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:()=>{Re();let J=!D;S(J),G.current&&(G.current.gain.value=J?0:P);},title:D?"Unmute":"Mute",children:D||P===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:D?0:P,onChange:J=>{Re();let Ce=Number(J.target.value);A(Ce),D&&S(false),G.current&&(G.current.gain.value=Ce);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:f("overflow-hidden transition-all duration-300 ease-in-out",k?"max-h-60":"max-h-0"),children:jsx("div",{className:f("border-t px-2 py-2",de),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((J,Ce)=>{let Ye=Ce===h;return jsxs("button",{className:f("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",Ye?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{Q(Ce),v(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:Ye&&y?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(vt=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+vt*4}px`,animation:`mp-eq-bar ${.4+vt*.15}s ease-in-out infinite alternate`}},vt))}):Ye?jsx(Disc3,{className:f("h-4 w-4",X$1)}):jsx("span",{className:f("text-xs font-mono",Ne),children:Ce+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:J.cover||js,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:f("truncate text-xs font-medium",Ye?X$1:ve),children:J.title}),J.artist&&jsx("div",{className:f("truncate text-[10px]",Ne),children:J.artist})]}),C.has(Ce)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},Ce)})})})})]})})]})}function za(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 Ub={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 Us({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:n=false,loop:o=false,onTrackChange:a,onPlayChange:i,accent:s="#8b5cf6",className:l}){let[c,u]=useState(t),[p,m]=useState(false),[d,g]=useState(0),[h,b]=useState(0),[y,v]=useState(0),[N,x]=useState(.8),[w,L]=useState(false),[P,A]=useState(n),[D,S]=useState(o),[C,I]=useState(false),[k,M]=useState("title"),[R,$]=useState(true),[E,ne]=useState(false),[U,z]=useState(false),[H,_]=useState(false),[V,oe]=useState(true),[be,T]=useState(false),[F,re]=useState(null),W=useRef(null),G=useRef(null),le=useRef(void 0),ke=useRef(false),B=e[c],q=$n.useMemo(()=>{let K=e.map((ce,me)=>({media:ce,originalIndex:me}));return K.sort((ce,me)=>{let J=Ub[k](ce.media,me.media);return R?J:-J}),K},[e,k,R]);useEffect(()=>{let K=W.current;if(!K)return;T(true),K.src=B.src,B.poster&&(K.poster=B.poster),K.load();let ce=()=>{T(false),p&&K.play().catch(()=>{});};return K.addEventListener("loadeddata",ce,{once:true}),()=>K.removeEventListener("loadeddata",ce)},[c,B.src]),useEffect(()=>{if(!r||ke.current)return;let K=W.current;if(!K)return;let ce=()=>{ke.current=true,m(true),K.play().catch(()=>{});};return K.addEventListener("canplaythrough",ce,{once:true}),()=>K.removeEventListener("canplaythrough",ce)},[r]),useEffect(()=>{let K=W.current;K&&(p?K.play().catch(()=>{}):K.pause(),i?.(p));},[p]),useEffect(()=>{let K=W.current;K&&(K.volume=w?0:N);},[N,w]),useEffect(()=>{let K=W.current;if(!K)return;let ce=()=>g(K.currentTime),me=()=>b(K.duration),J=()=>{K.buffered.length>0&&v(K.buffered.end(K.buffered.length-1));},Ce=()=>{D?(K.currentTime=0,K.play().catch(()=>{})):te();};return K.addEventListener("timeupdate",ce),K.addEventListener("loadedmetadata",me),K.addEventListener("progress",J),K.addEventListener("ended",Ce),()=>{K.removeEventListener("timeupdate",ce),K.removeEventListener("loadedmetadata",me),K.removeEventListener("progress",J),K.removeEventListener("ended",Ce);}},[c,e.length,D]);let Z=useCallback(()=>{oe(true),le.current&&clearTimeout(le.current),le.current=setTimeout(()=>{p&&oe(false);},3e3);},[p]);useEffect(()=>{p?Z():(oe(true),le.current&&clearTimeout(le.current));},[p,Z]),useEffect(()=>()=>{le.current&&clearTimeout(le.current);},[]);let ue=useCallback(K=>{let ce=(K%e.length+e.length)%e.length;u(ce),g(0),m(true),a?.(ce,e[ce]);},[e,a]),te=useCallback(()=>{if(P){let K;do K=Math.floor(Math.random()*e.length);while(K===c&&e.length>1);ue(K);}else ue(c+1);},[ue,c,P,e.length]),ve=useCallback(()=>{if(P){let K;do K=Math.floor(Math.random()*e.length);while(K===c&&e.length>1);ue(K);}else ue(c-1);},[ue,c,P,e.length]),Ne=useCallback(K=>{let ce=K.currentTarget.getBoundingClientRect(),J=Math.max(0,Math.min(1,(K.clientX-ce.left)/ce.width))*h;W.current&&(W.current.currentTime=J),g(J);},[h]),X$1=useCallback(K=>{let ce=K.currentTarget.getBoundingClientRect(),me=Math.max(0,Math.min(1,(K.clientX-ce.left)/ce.width));re(me*h);},[h]),de=useCallback(()=>{G.current&&(document.fullscreenElement?document.exitFullscreen():G.current.requestFullscreen());},[]);useEffect(()=>{let K=()=>_(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",K),()=>document.removeEventListener("fullscreenchange",K)},[]);let Q=useCallback(()=>{E?(z(true),setTimeout(()=>{ne(false),z(false);},500)):ne(true);},[E]),ie=useCallback(()=>{I(K=>!K);},[]),Pe=useCallback(()=>{let K=["title","type","duration"],ce=K.indexOf(k);R?$(false):($(true),M(K[(ce+1)%K.length]));},[k,R]);useEffect(()=>{let K=ce=>{if(!(ce.target instanceof HTMLInputElement||ce.target instanceof HTMLTextAreaElement))switch(ce.key){case " ":case "k":ce.preventDefault(),m(me=>!me);break;case "f":ce.preventDefault(),de();break;case "t":ce.preventDefault(),Q();break;case "ArrowLeft":ce.preventDefault(),W.current&&(W.current.currentTime=Math.max(0,d-5));break;case "ArrowRight":ce.preventDefault(),W.current&&(W.current.currentTime=Math.min(h,d+5));break;case "ArrowUp":ce.preventDefault(),x(me=>Math.min(1,me+.05));break;case "ArrowDown":ce.preventDefault(),x(me=>Math.max(0,me-.05));break;case "Escape":E&&Q();break;case "n":ce.preventDefault(),te();break;case "p":ce.preventDefault(),ve();break;case "l":ce.preventDefault(),ie();break}};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[de,Q,ie,te,ve,d,h,E]);let $e=h>0?d/h*100:0,Xe=h>0?y/h*100:0,se="text-(--accent)",Re=jsxs("div",{ref:G,className:f("group flex overflow-hidden",H?"h-full w-full":"aspect-video w-full",!H&&"rounded-xl",!H&&p&&"shadow-2xl",!H&&!p&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",l),style:{"--accent":s,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:f("relative flex-1 min-w-0 h-full overflow-hidden",be&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:Z,onMouseLeave:()=>{p&&oe(false);},children:[jsx("video",{ref:W,className:"h-full w-full object-contain",poster:B.poster,playsInline:true,preload:"metadata",onClick:()=>m(K=>!K)}),!p&&!be&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>m(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)"}})})}),be&&!V&&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:B.title}),B.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:B.subtitle})]})}),jsx("div",{className:f("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",V?"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:B.title}),B.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:B.subtitle})]}),B.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:B.type})]})}),jsxs("div",{className:f("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",V?"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:Ne,onMouseMove:X$1,onMouseLeave:()=>re(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${Xe}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${$e}%`}}),F!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${F/h*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:za(F)}),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(${$e}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>m(K=>!K),title:p?"Pause (k)":"Play (k)",children:p?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:ve,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:te,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:()=>L(K=>!K),title:w?"Unmute":"Mute",children:w||N===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:w?0:N,onChange:K=>{x(Number(K.target.value)),w&&L(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:[za(d)," / ",za(h)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:f("cp-btn",P&&se),onClick:()=>A(K=>!K),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:f("cp-btn",D&&se),onClick:()=>S(K=>!K),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:f("cp-btn",C&&se),onClick:ie,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:f("cp-btn",E&&se),onClick:Q,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:de,title:"Fullscreen (f)",children:H?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:f("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",C?"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:Pe,title:`Sort: ${k} ${R?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),k,R?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:ie,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:q.map(({media:K,originalIndex:ce})=>{let me=ce===c;return jsxs("button",{className:f("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",me?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:me?void 0:{color:"var(--cp-text)"},onClick:()=>{ue(ce);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[K.poster?jsx("img",{src:K.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)"}})}),me&&p&&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(J=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+J*3}px`,animation:`mp-eq-bar ${.3+J*.12}s ease-in-out infinite alternate`}},J))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:K.title}),jsxs("div",{className:"flex items-center gap-2",children:[K.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:K.type}),K.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:za(K.duration)})]})]}),me&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},ce)})})]})}),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:f(E&&"fixed inset-0 z-100 flex items-center justify-center p-8",E&&(U?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:E?K=>{K.target===K.currentTarget&&Q();}:void 0,children:jsx("div",{className:f(E&&"w-full",E&&!H&&"max-w-5xl"),children:Re})})}function Va(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Bd(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 Js(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 iy={".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 Qs(e){if(e.type==="directory")return Folder;let t=e.extension||Va(e.name);return iy[t]||File}function bn(e,t,r){return Math.max(t,Math.min(r,e))}function Od(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function $d(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 Zs({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:n="list",initialPosition:o,initialSize:a,dockable:i=false,dockSide:s="right",visible:l=true,onFileOpen:c,onSelectionChange:u,onNavigate:p,onDelete:m,onClose:d,onMinimize:g,onPathSubmit:h,defaultInputMode:b="search",actions:y,resizable:v=true,minSize:N={width:400,height:300},className:x}){let[w,L]=useState(n),[P,A]=useState(new Set),[D,S]=useState(null),[C,I]=useState(false),[k,T]=useState(false),[R,O]=useState(""),[E,ne]=useState(b),[U,z]=useState(l),[H,_]=useState(false),[V,oe]=useState({w:window.innerWidth,h:window.innerHeight}),be=$d(window.innerWidth,window.innerHeight),[M,F]=useState(o??be.pos),[re,W]=useState(a??be.size),[G,le]=useState(null),ke=useRef(false),B=useRef({x:0,y:0}),q=useRef(null),Z=useRef(false),ue=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),te=useRef(false),ve=useRef(C);useEffect(()=>{ve.current=C;},[C]);let Ne=l!==void 0?l:U,X$1=useMemo(()=>{let $=e.filter(Le=>Le.type==="directory"),ge=e.filter(Le=>Le.type==="file");return $.sort((Le,De)=>Le.name.localeCompare(De.name)),ge.sort((Le,De)=>Le.name.localeCompare(De.name)),[...$,...ge]},[e]),de=useMemo(()=>{if(E!=="search"||!R.trim())return X$1;let $=R.toLowerCase();return X$1.filter(ge=>ge.name.toLowerCase().includes($))},[X$1,R,E]),Q=D!=null?de[D]:null;useEffect(()=>{let $=Od(window.innerWidth),ge=()=>{let Le=window.innerWidth,De=window.innerHeight;if(oe({w:Le,h:De}),ve.current)return;let He=Od(Le);if(He!==$&&!te.current&&!a){let dt=$d(Le,De);W(dt.size),F(dt.pos);}$=He;};return window.addEventListener("resize",ge),()=>window.removeEventListener("resize",ge)},[a]);let ie=useCallback(($,ge)=>{A(Le=>{let De=new Set(Le);return ge.ctrlKey||ge.metaKey?De.has($)?De.delete($):De.add($):(De.clear(),De.add($)),De}),S($);},[]);useEffect(()=>{if(!u)return;let $=Array.from(P).map(ge=>de[ge]).filter(Boolean);u($);},[P]);let Pe=useCallback($=>{let ge=de[$];ge&&(ge.type==="directory"?p?.(ge.path):c?.(ge));},[de,c,p]),Oe=useCallback($=>{C||$.target.closest("button")||(te.current=true,ke.current=true,B.current={x:$.clientX-M.x,y:$.clientY-M.y},$.preventDefault());},[M,C]),Xe=useCallback($=>{if(C||$.target.closest("button"))return;te.current=true;let ge=$.touches[0];ke.current=true,B.current={x:ge.clientX-M.x,y:ge.clientY-M.y};},[M,C]);useEffect(()=>{let $=De=>{if(!ke.current)return;let He=window.innerWidth-100,dt=window.innerHeight-40;F({x:bn(De.clientX-B.current.x,0,He),y:bn(De.clientY-B.current.y,0,dt)});},ge=De=>{if(!ke.current)return;De.preventDefault();let He=De.touches[0],dt=window.innerWidth-100,Gt=window.innerHeight-40;F({x:bn(He.clientX-B.current.x,0,dt),y:bn(He.clientY-B.current.y,0,Gt)});},Le=()=>{ke.current=false,Z.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",$),window.addEventListener("mouseup",Le),window.addEventListener("touchmove",ge,{passive:false}),window.addEventListener("touchend",Le),()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",Le),window.removeEventListener("touchmove",ge),window.removeEventListener("touchend",Le);}},[]);let se=useCallback(($,ge)=>{C||(ge.preventDefault(),ge.stopPropagation(),te.current=true,Z.current=$,ue.current={x:ge.clientX,y:ge.clientY,w:re.width,h:re.height,px:M.x,py:M.y},document.body.style.cursor=$==="e"||$==="w"?"ew-resize":$==="n"||$==="s"?"ns-resize":$==="nw"||$==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[C,re,M]),Re=useCallback(($,ge)=>{if(C)return;ge.preventDefault(),ge.stopPropagation(),te.current=true;let Le=ge.touches[0];Z.current=$,ue.current={x:Le.clientX,y:Le.clientY,w:re.width,h:re.height,px:M.x,py:M.y},document.body.style.userSelect="none";},[C,re,M]);useEffect(()=>{let $=(He,dt)=>{let Gt=Z.current;if(!Gt)return;let Mo=He-ue.current.x,j=dt-ue.current.y,{w:qt,h:ir,px:Sn,py:Yr}=ue.current;if(Gt.includes("e")&&(qt=Math.max(N.width,qt+Mo)),Gt.includes("w")){let Tr=Math.max(N.width,qt-Mo);Sn=Sn+(qt-Tr),qt=Tr;}if(Gt.includes("s")&&(ir=Math.max(N.height,ir+j)),Gt.includes("n")){let Tr=Math.max(N.height,ir-j);Yr=Yr+(ir-Tr),ir=Tr;}W({width:qt,height:ir}),F({x:Sn,y:Yr});},ge=He=>{Z.current&&$(He.clientX,He.clientY);},Le=He=>{Z.current&&(He.preventDefault(),$(He.touches[0].clientX,He.touches[0].clientY));},De=()=>{Z.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",ge),window.addEventListener("mouseup",De),window.addEventListener("touchmove",Le,{passive:false}),window.addEventListener("touchend",De),()=>{window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",De),window.removeEventListener("touchmove",Le),window.removeEventListener("touchend",De);}},[N]);let K=useCallback(()=>{C?(G&&(F(G.pos),W(G.size)),I(false)):(le({pos:M,size:re}),I(true));},[C,M,re,G]),ce=useCallback(()=>{k?T(false):(C&&(I(false),G&&(F(G.pos),W(G.size))),T(true),g?.());},[k,C,G,g]);useEffect(()=>{if(!Ne||k)return;let $=ge=>{if(!(!q.current?.contains(document.activeElement)&&document.activeElement!==q.current)){if(ge.key==="Escape"&&(S(null),A(new Set)),ge.ctrlKey&&ge.key==="a"){ge.preventDefault();let Le=new Set(de.map((De,He)=>He));A(Le);}ge.key==="Delete"&&P.size>0&&m&&(ge.preventDefault(),_(true));}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[Ne,k,de,P,m]);let me={"--fe-accent":r};if(k)return jsx("div",{className:f("fixed z-100 cursor-pointer transition-all duration-300",s==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:me,onClick:()=>T(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(!Ne)return null;let J=C?V.w:Math.min(re.width,V.w-8),Ce=C?V.h:Math.min(re.height,V.h-8),Ye=C?0:bn(M.x,0,Math.max(0,V.w-J)),vt=C?0:bn(M.y,0,Math.max(0,V.h-40)),Wr=J<500;return jsxs("div",{ref:q,className:f("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]",C&&"rounded-none",x),style:{...me,left:Ye,top:vt,width:J,height:Ce,transition:C?"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:Oe,onTouchStart:Xe,onDoubleClick:K,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:()=>L($=>$==="list"?"grid":"list"),title:w==="list"?"Grid view":"List view",children:w==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),i&&jsx("button",{className:"fe-btn",onClick:ce,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:K,title:C?"Restore":"Maximize",children:C?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:()=>{d?.(),z(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:()=>p?.(".."),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:E==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>ne($=>$==="search"?"navigate":"search"),title:E==="search"?"Switch to path navigation":"Switch to file search",children:E==="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:R,onChange:$=>O($.target.value),onKeyDown:$=>{$.key==="Enter"&&R.trim()&&E==="navigate"&&(h?h(R.trim()):p?.(R.trim()));},placeholder:E==="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:[de.length," item",de.length!==1?"s":"",P.size>0&&` \xB7 ${P.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:$=>{$.target===$.currentTarget&&(A(new Set),S(null));},children:de.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"})]}):w==="list"?jsx("div",{className:"space-y-px",children:de.map(($,ge)=>{let Le=Qs($),De=P.has(ge),He=$.extension||Va($.name);return jsxs("div",{className:f("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",De?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:De?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:dt=>ie(ge,dt),onDoubleClick:()=>Pe(ge),children:[jsx(Le,{className:f("h-4 w-4 shrink-0",$.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:$.name}),He&&$.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:He}),$.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Bd($.size)}),$.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Js($.modifiedAt)})]},$.path+ge)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:de.map(($,ge)=>{let Le=Qs($),De=P.has(ge),He=$.extension||Va($.name);return jsxs("div",{className:f("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",De?"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:dt=>ie(ge,dt),onDoubleClick:()=>Pe(ge),children:[jsx(Le,{className:f("h-7 w-7",$.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:$.name}),He&&$.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:He})]},$.path+ge)})})}),jsx("div",{className:f("overflow-hidden transition-[width,opacity] duration-300 ease-out",Wr?f("absolute right-0 top-0 bottom-0 z-10",Q?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):f("shrink-0",Q?"w-56":"w-0")),children:Q&&jsxs("div",{className:f("flex h-full flex-col p-4",Wr?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Wr&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{S(null),A(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:[On.createElement(Qs(Q),{className:f("h-10 w-10 mb-2",Q.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:Q.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(yn,{label:"Type",value:Q.type==="directory"?"Directory":Q.mimeType||Q.extension||Va(Q.name)||"File"}),Q.size!=null&&jsx(yn,{label:"Size",value:Bd(Q.size)}),jsx(yn,{label:"Path",value:Q.path,mono:true}),Q.extension&&jsx(yn,{label:"Extension",value:Q.extension}),Q.modifiedAt&&jsx(yn,{label:"Modified",value:Js(Q.modifiedAt)}),Q.createdAt&&jsx(yn,{label:"Created",value:Js(Q.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[Q.type==="file"&&c&&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:()=>c(Q),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),y?.map($=>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:()=>$.onClick(Q),children:[$.icon&&On.createElement($.icon,{className:"h-3 w-3"}),$.label]},$.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:[de.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[P.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[P.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),v&&!C&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:$=>se("n",$),onTouchStart:$=>Re("n",$)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:$=>se("s",$),onTouchStart:$=>Re("s",$)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:$=>se("w",$),onTouchStart:$=>Re("w",$)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:$=>se("e",$),onTouchStart:$=>Re("e",$)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:$=>se("nw",$),onTouchStart:$=>Re("nw",$)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:$=>se("ne",$),onTouchStart:$=>Re("ne",$)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:$=>se("sw",$),onTouchStart:$=>Re("sw",$)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:$=>se("se",$),onTouchStart:$=>Re("se",$)})]}),jsx("style",{children:`
|
|
23
|
+
`})]});return jsx("div",{className:f(E&&"fixed inset-0 z-100 flex items-center justify-center p-8",E&&(U?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:E?K=>{K.target===K.currentTarget&&Q();}:void 0,children:jsx("div",{className:f(E&&"w-full",E&&!H&&"max-w-5xl"),children:Re})})}function Va(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Bd(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 Js(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 iy={".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 Qs(e){if(e.type==="directory")return Folder;let t=e.extension||Va(e.name);return iy[t]||File}function bn(e,t,r){return Math.max(t,Math.min(r,e))}function $d(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function Od(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 Zs({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:n="list",initialPosition:o,initialSize:a,dockable:i=false,dockSide:s="right",visible:l=true,onFileOpen:c,onSelectionChange:u,onNavigate:p,onDelete:m,onClose:d,onMinimize:g,onPathSubmit:h,defaultInputMode:b="search",actions:y,resizable:v=true,minSize:N={width:400,height:300},className:x}){let[w,L]=useState(n),[P,A]=useState(new Set),[D,S]=useState(null),[C,I]=useState(false),[k,M]=useState(false),[R,$]=useState(""),[E,ne]=useState(b),[U,z]=useState(l),[H,_]=useState(false),[V,oe]=useState({w:window.innerWidth,h:window.innerHeight}),be=Od(window.innerWidth,window.innerHeight),[T,F]=useState(o??be.pos),[re,W]=useState(a??be.size),[G,le]=useState(null),ke=useRef(false),B=useRef({x:0,y:0}),q=useRef(null),Z=useRef(false),ue=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),te=useRef(false),ve=useRef(C);useEffect(()=>{ve.current=C;},[C]);let Ne=l!==void 0?l:U,X$1=useMemo(()=>{let O=e.filter(Le=>Le.type==="directory"),ge=e.filter(Le=>Le.type==="file");return O.sort((Le,De)=>Le.name.localeCompare(De.name)),ge.sort((Le,De)=>Le.name.localeCompare(De.name)),[...O,...ge]},[e]),de=useMemo(()=>{if(E!=="search"||!R.trim())return X$1;let O=R.toLowerCase();return X$1.filter(ge=>ge.name.toLowerCase().includes(O))},[X$1,R,E]),Q=D!=null?de[D]:null;useEffect(()=>{let O=$d(window.innerWidth),ge=()=>{let Le=window.innerWidth,De=window.innerHeight;if(oe({w:Le,h:De}),ve.current)return;let He=$d(Le);if(He!==O&&!te.current&&!a){let dt=Od(Le,De);W(dt.size),F(dt.pos);}O=He;};return window.addEventListener("resize",ge),()=>window.removeEventListener("resize",ge)},[a]);let ie=useCallback((O,ge)=>{A(Le=>{let De=new Set(Le);return ge.ctrlKey||ge.metaKey?De.has(O)?De.delete(O):De.add(O):(De.clear(),De.add(O)),De}),S(O);},[]);useEffect(()=>{if(!u)return;let O=Array.from(P).map(ge=>de[ge]).filter(Boolean);u(O);},[P]);let Pe=useCallback(O=>{let ge=de[O];ge&&(ge.type==="directory"?p?.(ge.path):c?.(ge));},[de,c,p]),$e=useCallback(O=>{C||O.target.closest("button")||(te.current=true,ke.current=true,B.current={x:O.clientX-T.x,y:O.clientY-T.y},O.preventDefault());},[T,C]),Xe=useCallback(O=>{if(C||O.target.closest("button"))return;te.current=true;let ge=O.touches[0];ke.current=true,B.current={x:ge.clientX-T.x,y:ge.clientY-T.y};},[T,C]);useEffect(()=>{let O=De=>{if(!ke.current)return;let He=window.innerWidth-100,dt=window.innerHeight-40;F({x:bn(De.clientX-B.current.x,0,He),y:bn(De.clientY-B.current.y,0,dt)});},ge=De=>{if(!ke.current)return;De.preventDefault();let He=De.touches[0],dt=window.innerWidth-100,Gt=window.innerHeight-40;F({x:bn(He.clientX-B.current.x,0,dt),y:bn(He.clientY-B.current.y,0,Gt)});},Le=()=>{ke.current=false,Z.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",Le),window.addEventListener("touchmove",ge,{passive:false}),window.addEventListener("touchend",Le),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",Le),window.removeEventListener("touchmove",ge),window.removeEventListener("touchend",Le);}},[]);let se=useCallback((O,ge)=>{C||(ge.preventDefault(),ge.stopPropagation(),te.current=true,Z.current=O,ue.current={x:ge.clientX,y:ge.clientY,w:re.width,h:re.height,px:T.x,py:T.y},document.body.style.cursor=O==="e"||O==="w"?"ew-resize":O==="n"||O==="s"?"ns-resize":O==="nw"||O==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[C,re,T]),Re=useCallback((O,ge)=>{if(C)return;ge.preventDefault(),ge.stopPropagation(),te.current=true;let Le=ge.touches[0];Z.current=O,ue.current={x:Le.clientX,y:Le.clientY,w:re.width,h:re.height,px:T.x,py:T.y},document.body.style.userSelect="none";},[C,re,T]);useEffect(()=>{let O=(He,dt)=>{let Gt=Z.current;if(!Gt)return;let To=He-ue.current.x,j=dt-ue.current.y,{w:qt,h:ir,px:Sn,py:Yr}=ue.current;if(Gt.includes("e")&&(qt=Math.max(N.width,qt+To)),Gt.includes("w")){let Mr=Math.max(N.width,qt-To);Sn=Sn+(qt-Mr),qt=Mr;}if(Gt.includes("s")&&(ir=Math.max(N.height,ir+j)),Gt.includes("n")){let Mr=Math.max(N.height,ir-j);Yr=Yr+(ir-Mr),ir=Mr;}W({width:qt,height:ir}),F({x:Sn,y:Yr});},ge=He=>{Z.current&&O(He.clientX,He.clientY);},Le=He=>{Z.current&&(He.preventDefault(),O(He.touches[0].clientX,He.touches[0].clientY));},De=()=>{Z.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",ge),window.addEventListener("mouseup",De),window.addEventListener("touchmove",Le,{passive:false}),window.addEventListener("touchend",De),()=>{window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",De),window.removeEventListener("touchmove",Le),window.removeEventListener("touchend",De);}},[N]);let K=useCallback(()=>{C?(G&&(F(G.pos),W(G.size)),I(false)):(le({pos:T,size:re}),I(true));},[C,T,re,G]),ce=useCallback(()=>{k?M(false):(C&&(I(false),G&&(F(G.pos),W(G.size))),M(true),g?.());},[k,C,G,g]);useEffect(()=>{if(!Ne||k)return;let O=ge=>{if(!(!q.current?.contains(document.activeElement)&&document.activeElement!==q.current)){if(ge.key==="Escape"&&(S(null),A(new Set)),ge.ctrlKey&&ge.key==="a"){ge.preventDefault();let Le=new Set(de.map((De,He)=>He));A(Le);}ge.key==="Delete"&&P.size>0&&m&&(ge.preventDefault(),_(true));}};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[Ne,k,de,P,m]);let me={"--fe-accent":r};if(k)return jsx("div",{className:f("fixed z-100 cursor-pointer transition-all duration-300",s==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:me,onClick:()=>M(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(!Ne)return null;let J=C?V.w:Math.min(re.width,V.w-8),Ce=C?V.h:Math.min(re.height,V.h-8),Ye=C?0:bn(T.x,0,Math.max(0,V.w-J)),vt=C?0:bn(T.y,0,Math.max(0,V.h-40)),Wr=J<500;return jsxs("div",{ref:q,className:f("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]",C&&"rounded-none",x),style:{...me,left:Ye,top:vt,width:J,height:Ce,transition:C?"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:$e,onTouchStart:Xe,onDoubleClick:K,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:()=>L(O=>O==="list"?"grid":"list"),title:w==="list"?"Grid view":"List view",children:w==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),i&&jsx("button",{className:"fe-btn",onClick:ce,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:K,title:C?"Restore":"Maximize",children:C?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:()=>{d?.(),z(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:()=>p?.(".."),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:E==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>ne(O=>O==="search"?"navigate":"search"),title:E==="search"?"Switch to path navigation":"Switch to file search",children:E==="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:R,onChange:O=>$(O.target.value),onKeyDown:O=>{O.key==="Enter"&&R.trim()&&E==="navigate"&&(h?h(R.trim()):p?.(R.trim()));},placeholder:E==="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:[de.length," item",de.length!==1?"s":"",P.size>0&&` \xB7 ${P.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:O=>{O.target===O.currentTarget&&(A(new Set),S(null));},children:de.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"})]}):w==="list"?jsx("div",{className:"space-y-px",children:de.map((O,ge)=>{let Le=Qs(O),De=P.has(ge),He=O.extension||Va(O.name);return jsxs("div",{className:f("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",De?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:De?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:dt=>ie(ge,dt),onDoubleClick:()=>Pe(ge),children:[jsx(Le,{className:f("h-4 w-4 shrink-0",O.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:O.name}),He&&O.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:He}),O.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Bd(O.size)}),O.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Js(O.modifiedAt)})]},O.path+ge)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:de.map((O,ge)=>{let Le=Qs(O),De=P.has(ge),He=O.extension||Va(O.name);return jsxs("div",{className:f("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",De?"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:dt=>ie(ge,dt),onDoubleClick:()=>Pe(ge),children:[jsx(Le,{className:f("h-7 w-7",O.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:O.name}),He&&O.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:He})]},O.path+ge)})})}),jsx("div",{className:f("overflow-hidden transition-[width,opacity] duration-300 ease-out",Wr?f("absolute right-0 top-0 bottom-0 z-10",Q?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):f("shrink-0",Q?"w-56":"w-0")),children:Q&&jsxs("div",{className:f("flex h-full flex-col p-4",Wr?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Wr&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{S(null),A(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:[$n.createElement(Qs(Q),{className:f("h-10 w-10 mb-2",Q.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:Q.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(yn,{label:"Type",value:Q.type==="directory"?"Directory":Q.mimeType||Q.extension||Va(Q.name)||"File"}),Q.size!=null&&jsx(yn,{label:"Size",value:Bd(Q.size)}),jsx(yn,{label:"Path",value:Q.path,mono:true}),Q.extension&&jsx(yn,{label:"Extension",value:Q.extension}),Q.modifiedAt&&jsx(yn,{label:"Modified",value:Js(Q.modifiedAt)}),Q.createdAt&&jsx(yn,{label:"Created",value:Js(Q.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[Q.type==="file"&&c&&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:()=>c(Q),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),y?.map(O=>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:()=>O.onClick(Q),children:[O.icon&&$n.createElement(O.icon,{className:"h-3 w-3"}),O.label]},O.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:[de.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[P.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[P.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),v&&!C&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:O=>se("n",O),onTouchStart:O=>Re("n",O)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:O=>se("s",O),onTouchStart:O=>Re("s",O)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:O=>se("w",O),onTouchStart:O=>Re("w",O)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:O=>se("e",O),onTouchStart:O=>Re("e",O)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:O=>se("nw",O),onTouchStart:O=>Re("nw",O)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:O=>se("ne",O),onTouchStart:O=>Re("ne",O)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:O=>se("sw",O),onTouchStart:O=>Re("sw",O)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:O=>se("se",O),onTouchStart:O=>Re("se",O)})]}),jsx("style",{children:`
|
|
24
24
|
.fe-window {
|
|
25
25
|
background: var(--fe-bg);
|
|
26
26
|
box-shadow: var(--fe-shadow);
|
|
@@ -81,26 +81,26 @@ 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(Zn,{open:H,onOpenChange:_,children:jsxs(vs,{size:"sm",children:[jsxs(xs,{children:[jsxs(ws,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(ks,{children:[P.size===1?`Are you sure you want to delete "${de[Array.from(P)[0]]?.name}"?`:`Are you sure you want to delete ${P.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(Ns,{children:[jsx(Vt,{intent:"ghost",onClick:()=>_(false),children:"Cancel"}),jsxs(Vt,{intent:"danger",onClick:()=>{let $=Array.from(P).map(ge=>de[ge]).filter(Boolean);m?.($),A(new Set),S(null),_(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function yn({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:f("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function cy(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,i=document.createElement("span");i.className="masonry-ripple",i.style.width=`${n}px`,i.style.height=`${n}px`,i.style.left=`${o}px`,i.style.top=`${a}px`,t.appendChild(i),i.addEventListener("animationend",()=>i.remove());}function nl({columns:e,columnWidth:t=240,gap:r=16,items:n,onItemClick:o,className:a,style:i,children:s,...l}){let c=useRef(null),u=useRef([]),[p,m]=useState(()=>e??1),[d,g]=useState([]),[h,b]=useState(0),y=n?n.map((P,A)=>({key:P.key??A,node:P.content})):On.Children.toArray(s).map((P,A)=>({key:P.key??A,node:P})),v=y.length,N=useCallback(P=>e??Math.max(1,Math.floor((P+r)/(t+r))),[e,t,r]),x=useCallback(()=>{let P=c.current;if(!P)return;let A=P.clientWidth,D=N(A);m(D);let S=(A-(D-1)*r)/D,C=new Array(D).fill(0),I=[];for(let T=0;T<v;T++){let R=u.current[T],O=R?R.offsetHeight:0,E=0;for(let ne=1;ne<D;ne++)C[ne]<C[E]&&(E=ne);I.push({top:C[E],left:E*(S+r),width:S}),C[E]+=O+r;}let k=Math.max(0,...C)-(v?r:0);g(I),b(k);},[v,N,r]);useEffect(()=>{let P=c.current;if(!P)return;let A=new ResizeObserver(()=>x());return A.observe(P),()=>A.disconnect()},[x]),useEffect(()=>{let P=requestAnimationFrame(x);return ()=>cancelAnimationFrame(P)},[x]),useEffect(()=>{let P=new ResizeObserver(()=>x());return u.current.forEach(A=>{A&&P.observe(A);}),()=>P.disconnect()},[v,p,x]);let w=useCallback((P,A)=>{let D=P.currentTarget;cy(P,D),o?.(n?.[A],A);},[o,n]),L=P=>{if(!n)return false;let A=n[P];return !!(A.title||A.description||A.actions)};return jsx("div",{ref:c,className:f("relative",a),style:{...i,height:h},...l,children:y.map((P,A)=>jsxs("div",{ref:D=>{u.current[A]=D;},className:"masonry-item",role:"button",tabIndex:0,onClick:D=>w(D,A),onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),o?.(n?.[A],A));},style:{position:"absolute",top:d[A]?.top??0,left:d[A]?.left??0,width:d[A]?.width??"100%"},children:[P.node,L(A)&&jsxs("div",{className:"masonry-item-overlay",children:[n[A].title&&jsx("p",{className:"masonry-item-overlay-title",children:n[A].title}),n[A].description&&jsx("p",{className:"masonry-item-overlay-desc",children:n[A].description}),n[A].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:n[A].actions})]})]},P.key))})}var uy='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="2" y1="2" x2="22" y2="22"/><path d="M10.41 10.41a2 2 0 1 1-2.83-2.83"/><line x1="13.5" y1="6" x2="18" y2="6"/><line x1="6" y1="2" x2="14" y2="10"/><path d="M4 6h1.5"/><path d="M2 18.5C2 19.9 3.1 21 4.5 21H16"/><rect x="2" y="2" width="20" height="20" rx="5" ry="5"/></svg>';function _a(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function py(e){return e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,"").replace(/\s+on[a-z][a-z0-9]*\s*=\s*(?:"[^"]*"|'[^']*'|[^\s/>]*)/gi,"").replace(/\b(href|src|action)\s*=\s*["']\s*(?:javascript|vbscript)\s*:[^"'>]*/gi,'$1="#"').replace(/\bhref\s*=\s*["']\s*data\s*:[^"'>]*/gi,'href="#"')}var Yd=new Marked;Yd.use({renderer:{image({href:e,title:t,text:r}){let n=/^https?:\/\//i.test(e??"")?e:"",o=r?` alt="${_a(r)}"`:' alt=""',a=t?` title="${_a(t)}"`:"",i=_a(r||"Image failed to load");return `<figure class="tw-rich-img-wrap"><img class="tw-rich-img" src="${_a(n)}" loading="lazy"${o}${a} /><div class="tw-rich-img-error">`+uy+`<span>${i}</span></div></figure>`}}});function Ud(e){let t=Yd.parse(e,{async:false});return py(t)}function Oa({text:e="",mode:t="typewriter",speed:r=40,cursor:n=true,cursorChar:o="\u258B",thinking:a=false,streaming:i=false,delay:s=0,onComplete:l,as:c="span",className:u,rich:p=false}){let[m,d]=useState(t==="instant"?e:""),[g,h]=useState(false),[b,y]=useState(t==="instant"),[v,N]=useState(false),x=useRef(null),w=useRef(0),L=useRef(l);L.current=l;let P=useRef(e);P.current=e,useEffect(()=>{if(t!=="typewriter")return;if(d(""),y(false),N(false),h(false),!e){y(true);return}let I=Math.max(10,1e3/r),k=0,T,R=()=>{h(true),T=setInterval(()=>{let E=P.current;k++,d(E.slice(0,k)),k>=E.length&&(clearInterval(T),h(false),y(true),L.current?.());},I);},O;return s>0?O=setTimeout(R,s):R(),()=>{clearTimeout(O),clearInterval(T);}},[e,t]),useEffect(()=>{if(t!=="stream")return;if(e.length===0){w.current=0,d(""),h(false),y(false),N(false);return}if(e.length<=w.current)return;let I=Math.max(10,1e3/r),k=w.current;h(true),y(false),N(false);let T=setInterval(()=>{k++,w.current=k,d(P.current.slice(0,k)),k>=P.current.length&&(clearInterval(T),h(false),L.current?.());},I);return ()=>clearInterval(T)},[e,t]),useEffect(()=>{t==="instant"&&(d(e),h(false),y(true));},[e,t]);let A=useRef(i);useEffect(()=>{let I=A.current;if(A.current=i,I&&!i&&!g&&t==="stream"){N(true);let k=setTimeout(()=>{N(false),y(true);},650);return ()=>clearTimeout(k)}},[i,g,t]),useEffect(()=>{if(!p||!x.current)return;let k=Array.from(x.current.querySelectorAll(".tw-rich-img")).map(T=>{let R=()=>{let O=T.closest(".tw-rich-img-wrap");O&&O.classList.add("tw-rich-img-wrap--error");};return T.addEventListener("error",R,{once:true}),{img:T,onError:R}});return ()=>{k.forEach(({img:T,onError:R})=>T.removeEventListener("error",R));}},[m,p]);let D=n&&(a||g||v||t==="stream"&&i&&!b||t==="typewriter"&&!b),S=a?"tw-cursor--blink":g?"tw-cursor--solid":v?"tw-cursor--out":"tw-cursor--blink",C=c;return p?jsxs("div",{role:"region",className:f(u),children:[jsx("div",{ref:x,className:"tw-rich-prose",dangerouslySetInnerHTML:{__html:Ud(m)}}),D&&jsx("span",{className:f("tw-cursor",S),"aria-hidden":"true",children:o})]}):jsxs(C,{className:f(u),children:[a&&!m&&jsx("span",{"aria-hidden":"true",children:"\u200B"}),m,D&&jsx("span",{className:f("tw-cursor",S),"aria-hidden":"true",children:o})]})}function $a(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function my(e,t){if(!t)return true;let r=$a(t);return $a(e.label).includes(r)||(e.description?$a(e.description).includes(r):false)||(e.keywords?e.keywords.some(n=>$a(n).includes(r)):false)}function fy(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 Qd(e,t,r,n){let[o,a]=useState(""),[i,s]=useState(0);useEffect(()=>{t&&(a(""),s(0));},[t]);let l=useMemo(()=>e.filter(m=>!m.disabled&&my(m,o)),[e,o]),c=useMemo(()=>fy(l),[l]);useEffect(()=>{s(m=>Math.min(m,Math.max(0,l.length-1)));},[l.length]);let u=useCallback(()=>{let m=l[i];m&&(m.onSelect(),r(false));},[l,i,r]),p=useCallback(m=>{switch(m.key){case "ArrowDown":m.preventDefault(),s(d=>(d+1)%Math.max(1,l.length));break;case "ArrowUp":m.preventDefault(),s(d=>(d-1+Math.max(1,l.length))%Math.max(1,l.length));break;case "Enter":m.preventDefault(),u();break;case "Escape":m.preventDefault(),r(false);break}},[l.length,u,r]);return useEffect(()=>{if(!n)return;function m(d){(d.metaKey||d.ctrlKey)&&d.key==="k"&&(d.preventDefault(),r(!t));}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n,t,r]),{query:o,setQuery:a,groups:c,filtered:l,activeIndex:i,setActiveIndex:s,handleKeyDown:p}}function Ka({open:e,onOpenChange:t,commands:r,placeholder:n="Type a command or search\u2026",hotkey:o=true,maxItems:a=8,className:i}){let s=useRef(null),l=useRef(null),{query:c,setQuery:u,groups:p,filtered:m,activeIndex:d,setActiveIndex:g,handleKeyDown:h}=Qd(r,e,t,o);if(useEffect(()=>{if(e){let y=setTimeout(()=>s.current?.focus(),40);return ()=>clearTimeout(y)}},[e]),useEffect(()=>{l.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[d]),!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:f("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",i),onClick:y=>y.stopPropagation(),onKeyDown:h,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:s,value:c,onChange:y=>u(y.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":m[d]?`cmd-item-${m[d].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:l,className:"overflow-y-auto py-2",style:{maxHeight:`${a*2.75}rem`},role:"listbox","aria-label":"Commands",children:m.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"})]}):p.map(y=>jsxs("div",{className:"mb-1 last:mb-0",children:[y.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:y.label}),y.items.map(v=>{let N=b++,x=N===d;return jsxs("button",{id:`cmd-item-${v.id}`,"data-active":x,role:"option","aria-selected":x,className:f("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",x?"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:()=>g(N),onClick:()=>{v.onSelect(),t(false);},children:[v.icon&&jsx("span",{className:f("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",x?"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:v.icon}),jsxs("span",{className:"min-w-0 flex-1",children:[jsx("span",{className:"block truncate font-medium",children:v.label}),v.description&&jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:v.description})]}),v.shortcut&&jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:v.shortcut.map((w,L)=>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:w},L))})]},v.id)})]},y.label||"_default"))}),m.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:[m.length," result",m.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 nu={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"},ou={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 au({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 iu({images:e,title:t}){let r=e.slice(0,4),n=e.length>4?e.length-4:0,o=(a,i,s)=>jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:f("relative block overflow-hidden",s),onClick:l=>l.stopPropagation(),children:[jsx("img",{src:a,alt:`${t} ${i+1}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105"}),i===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]})})]},i);return r.length===0?null:r.length===1?jsx("div",{className:"mt-2.5 h-36 overflow-hidden rounded-xl",children:o(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((a,i)=>o(a,i))}):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:[o(r[0],0,"row-span-2"),o(r[1],1),o(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((a,i)=>o(a,i))})}function su({actions:e}){let t=e.filter(i=>i.variant!=="primary"),r=e.filter(i=>i.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",o="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",a=(i,s,l)=>i.href?jsxs("a",{href:i.href,target:"_blank",rel:"noopener noreferrer",className:l,onClick:c=>c.stopPropagation(),children:[i.icon,i.label]},s):jsxs("button",{type:"button",onClick:i.onClick,className:l,children:[i.icon,i.label]},s);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((i,s)=>a(i,s,n)),r.length>0&&jsx("span",{className:"flex-1"}),r.map((i,s)=>a(i,s,o))]})}function lu({item:e,isActive:t,animated:r,visible:n,orientation:o}){let a=e.status??"pending",i={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"}[a],s={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"}[a],l=t?"shadow-lg shadow-primary-300/30 dark:shadow-primary-500/20":a==="complete"?"shadow-md shadow-success-300/20 dark:shadow-success-400/10":a==="error"?"shadow-md shadow-danger-300/20 dark:shadow-danger-400/10":"shadow-sm shadow-primary-100/50 dark:shadow-black/20",c=a==="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%)":a==="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,u={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"}[a];return jsxs("div",{className:f("relative isolate",r&&"transition-all duration-700",r?n?"opacity-100 translate-y-0":o==="vertical"?"opacity-0 translate-y-6":"opacity-0 translate-x-6":"",o==="horizontal"?"w-56 shrink-0":"flex-1",e.className),children:[!t&&c&&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:c,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:f("relative overflow-hidden rounded-2xl border backdrop-blur-[2px]",t?"border-transparent":f("border",s),i,l),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:m=>m.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:f("mb-2 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",u),children:e.date}),jsx("h3",{className:f("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(iu,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsx(su,{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:f("p-4",(e.image||e.svg)&&"pt-3"),children:[e.date&&jsx("span",{className:f("mb-2.5 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",u),children:e.date}),jsx("h3",{className:f("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(iu,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsx(su,{actions:e.actions})]})]})})]})}function il({items:e,orientation:t="vertical",activeIndex:r,animated:n=true,lineStyle:o="solid",className:a}){let i=useRef(null),s=useRef([]),[l,c]=useState(new Set);useEffect(()=>{if(!n){c(new Set(e.map((m,d)=>d)));return}let p=new IntersectionObserver(m=>{c(d=>{let g=new Set(d);return m.forEach(h=>{let b=Number(h.target.dataset.idx);h.isIntersecting&&g.add(b);}),g});},{threshold:.15});return s.current.forEach(m=>m&&p.observe(m)),()=>p.disconnect()},[e,n]),useEffect(()=>{if(r==null)return;let p=s.current[r];p&&p.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[r]);let u=o==="dashed"?"border-dashed":"";return t==="vertical"?jsxs("div",{ref:i,className:f("relative",a),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((p,m)=>{let d=p.status??"pending",g=m===r;return jsxs("div",{ref:h=>{s.current[m]=h;},"data-idx":m,className:"relative flex gap-4",children:[jsx("div",{className:"relative z-10 flex shrink-0 flex-col items-center",children:jsx("div",{className:f("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 [&_svg]:shrink-0",nu[d],g&&ou[d]),children:jsx(au,{status:d,icon:p.icon})})}),jsx(lu,{item:p,isActive:g,animated:n,visible:l.has(m),orientation:"vertical"})]},p.id??m)})})]}):jsx("div",{ref:i,className:f("relative overflow-x-auto pb-4",a),children:jsx("div",{className:"flex min-w-max gap-6 px-4",children:e.map((p,m)=>{let d=p.status??"pending",g=m===r,h=m===e.length-1;return jsxs("div",{ref:b=>{s.current[m]=b;},"data-idx":m,className:"relative flex flex-col items-center gap-3",children:[jsxs("div",{className:"flex items-center",children:[jsx("div",{className:f("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 z-10 [&_svg]:shrink-0",nu[d],g&&ou[d]),children:jsx(au,{status:d,icon:p.icon})}),!h&&jsx("div",{className:f("h-px w-28 border-t-2",u,d==="complete"?"border-success-400":"border-primary-200 dark:border-primary-700")})]}),jsx(lu,{item:p,isActive:g,animated:n,visible:l.has(m),orientation:"horizontal"})]},p.id??m)})})})}function mo(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 cu(e="en-US",t="narrow"){let r=new Date(2e3,0,2);return Array.from({length:7},(n,o)=>{let a=new Date(r);return a.setDate(r.getDate()+o),new Intl.DateTimeFormat(e,{weekday:t}).format(a)})}function du(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 Ny(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function uu(e,t,r="en-US"){let n=e.getHours(),o=mo(r,"long"),a=mo(r,"short"),i={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MMMM:o[e.getMonth()],MMM:a[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"},s=Object.keys(i).sort((c,u)=>u.length-c.length),l=new RegExp(s.map(Ny).join("|"),"g");return t.replace(l,c=>i[c]??c)}function vn(e,t){return new Date(e,t+1,0).getDate()}function pu(e,t){let r=new Date(e,t,1).getDay(),n=vn(e,t),o=vn(e,t-1),a=[];for(let s=r-1;s>=0;s--)a.push({date:new Date(e,t-1,o-s),thisMonth:false});for(let s=1;s<=n;s++)a.push({date:new Date(e,t,s),thisMonth:true});let i=42-a.length;for(let s=1;s<=i;s++)a.push({date:new Date(e,t+1,s),thisMonth:false});return a}function xn(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function sl(e,t){return xn(e).getTime()===xn(t).getTime()}function mu(e,t){return xn(e)<xn(t)}function fu(e,t){return xn(e)>xn(t)}function ja(e,t,r){return t&&e<t?new Date(t):r&&e>r?new Date(r):e}function hu(e,t,r,n){let o=new Date(e),i=t*(n==="future"?1:-1);switch(r){case "day":o.setDate(o.getDate()+i);break;case "week":o.setDate(o.getDate()+i*7);break;case "month":o.setMonth(o.getMonth()+i);break;case "year":o.setFullYear(o.getFullYear()+i);break}return o}function gu(e,t=200){let r=e-Math.floor(t/2);return Array.from({length:t},(n,o)=>r+o)}function bu(e){let{value:t,defaultValue:r,onChange:n,mode:o="datetime",minDate:a,maxDate:i,use24Hour:s=true,showSeconds:l=true,locale:c="en-US",format:u,onOpen:p,onClose:m}=e,d=t!==void 0,[g,h]=useState(r??null),b=d?t??null:g,[y,v]=useState(false),[N,x]=useState(()=>b??new Date),[w,L]=useState("drum"),[P,A]=useState(()=>(b??new Date).getFullYear()),[D,S]=useState(()=>(b??new Date).getMonth()),[C,I]=useState(1),[k,T]=useState("day"),[R,O]=useState("future"),E=u??du(o,s,l),ne=b?uu(b,E,c):"",U=useCallback(()=>{let M=b??new Date;x(new Date(M)),A(M.getFullYear()),S(M.getMonth()),L("drum"),v(true),p?.();},[b,p]),z=useCallback(()=>{v(false),m?.();},[m]),H=useCallback(()=>{let M=ja(N,a,i);d||h(M),n?.(M),z();},[N,a,i,d,n,z]),_=useCallback(()=>{d||h(null),n?.(null),z();},[d,n,z]),V=useCallback((M,F)=>{x(re=>{let W=new Date(re);switch(M){case "year":W.setFullYear(F);break;case "month":{W.setMonth(F);let G=vn(W.getFullYear(),F);W.getDate()>G&&W.setDate(G);break}case "day":W.setDate(F);break;case "hour":W.setHours(F);break;case "minute":W.setMinutes(F);break;case "second":W.setSeconds(F);break}return ja(W,a,i)});},[a,i]),oe=useCallback(()=>{let M=ja(hu(new Date,C,k,R),a,i);x(M),A(M.getFullYear()),S(M.getMonth());},[C,k,R,a,i]),be=useCallback(M=>{let F=D+M,re=P;F<0&&(F=11,re--),F>11&&(F=0,re++),S(F),A(re);},[D,P]);return {isOpen:y,displayValue:ne,workingDate:N,view:w,calYear:P,calMonth:D,offsetAmount:C,offsetUnit:k,offsetDirection:R,mode:o,use24Hour:s,showSeconds:l,locale:c,minDate:a,maxDate:i,openPicker:U,closePicker:z,confirm:H,clear:_,updateField:V,setView:L,setCalYear:A,setCalMonth:S,setOffsetAmount:I,setOffsetUnit:T,setOffsetDirection:O,applyQuickOffset:oe,navigateCalendar:be}}var ho=40;function xu(e,t,r=true){let n=useRef(t);n.current=t,useEffect(()=>{if(!r)return;function o(a){let i=a.target;e.some(l=>l.current?.contains(i))||n.current();}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r]);}function wu(e,t,r){let n=useRef(false),o=useRef(void 0),a=useRef(r);a.current=r;let i=useRef(t);i.current=t;let s=useCallback((c,u="smooth")=>{let p=e.current;if(!p)return;let m=c*ho;Math.abs(p.scrollTop-m)<2&&u!=="instant"||(u==="instant"?p.scrollTop=m:p.scrollTo({top:m,behavior:u}));},[e]),l=useCallback(()=>{e.current&&(n.current=true,clearTimeout(o.current),o.current=setTimeout(()=>{n.current=false;let u=e.current;if(!u)return;let p=Math.round(u.scrollTop/ho),m=Math.max(0,Math.min(i.current-1,p)),d=m*ho;Math.abs(u.scrollTop-d)>1&&u.scrollTo({top:d,behavior:"smooth"}),a.current(m);},120));},[e]);return {scrollToIndex:s,handleScroll:l,isScrollingRef:n}}function ku(e,t,r){useEffect(()=>{if(!r)return;function n(){let a=e.current,i=t.current;if(!a||!i)return;if(window.innerWidth<=640){i.style.top="",i.style.left="";return}let s=a.getBoundingClientRect(),l=window.innerHeight,c=window.innerWidth,u=i.offsetHeight||460,p=i.offsetWidth||340,m=s.bottom+8,d=s.left;m+u>l-16&&(m=Math.max(16,s.top-u-8)),d+p>c-16&&(d=Math.max(16,c-p-16)),d<16&&(d=16),i.style.top=`${Math.round(m)}px`,i.style.left=`${Math.round(d)}px`;}let o=setTimeout(n,0);return window.addEventListener("resize",n),window.addEventListener("scroll",n,true),()=>{clearTimeout(o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,true);}},[r,e,t]);}function yr({items:e,selectedValue:t,onSelect:r,label:n}){let o=useRef(null),a=useRef(t),i=useRef(false),{scrollToIndex:s,handleScroll:l}=wu(o,e.length,c=>{let u=e[c];u&&(i.current=true,r(u.value),setTimeout(()=>{i.current=false;},200));});return useEffect(()=>{let c=o.current;if(!c)return;let u=e.findIndex(p=>p.value===t);u>=0&&(c.scrollTop=u*ho);},[]),useEffect(()=>{if(a.current!==t&&(a.current=t,!i.current)){let c=e.findIndex(u=>u.value===t);c>=0&&s(c,"smooth");}},[t,e,s]),jsxs("div",{className:"dtp-column",role:"group","aria-label":n,children:[jsx("div",{className:"dtp-column-highlight","aria-hidden":"true"}),jsx("div",{ref:o,className:"dtp-column-list",onScroll:l,role:"listbox","aria-label":n,children:e.map(c=>jsx("div",{className:f("dtp-item",c.value===t&&"dtp-item--selected"),onClick:()=>{let u=e.findIndex(p=>p.value===c.value);u>=0&&s(u,"smooth"),r(c.value);},role:"option","aria-selected":c.value===t,children:c.label},c.value))}),jsx("div",{className:"dtp-fade-top","aria-hidden":"true"}),jsx("div",{className:"dtp-fade-bottom","aria-hidden":"true"})]})}function Ry({year:e,month:t,selectedDate:r,today:n,minDate:o,maxDate:a,locale:i,onSelectDay:s,onPrev:l,onNext:c}){let u=cu(i,"narrow"),p=mo(i,"long"),m=pu(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:l,"aria-label":"Previous month",children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsxs("span",{className:"dtp-cal-title",children:[p[t]," ",e]}),jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:c,"aria-label":"Next month",children:jsx(ChevronRight,{className:"h-4 w-4"})})]}),jsx("div",{className:"dtp-cal-weekdays",role:"row",children:u.map((d,g)=>jsx("div",{className:"dtp-cal-weekday",role:"columnheader","aria-label":d,children:d},g))}),jsx("div",{className:"dtp-cal-days",role:"grid",children:m.map(({date:d,thisMonth:g},h)=>{let b=sl(d,r),y=sl(d,n),v=o!=null&&mu(d,o)||a!=null&&fu(d,a);return jsx("button",{type:"button",role:"gridcell",className:f("dtp-cal-day",!g&&"dtp-cal-day--other",b&&"dtp-cal-day--selected",y&&!b&&"dtp-cal-day--today",v&&"dtp-cal-day--disabled"),onClick:()=>!v&&s(d),disabled:v,"aria-current":y?"date":void 0,"aria-selected":b,"aria-disabled":v,children:d.getDate()},h)})})]})}function Ey({amount:e,unit:t,direction:r,onAmountChange:n,onUnitChange:o,onDirectionChange:a,onApply:i,locale:s}){let l=s.startsWith("zh"),c=[{value:"day",label:l?"\u5929":"Day"},{value:"week",label:l?"\u5468":"Week"},{value:"month",label:l?"\u6708":"Month"},{value:"year",label:l?"\u5E74":"Year"}],u=[{value:"future",label:l?"\u4EE5\u540E":"from now"},{value:"past",label:l?"\u4EE5\u524D":"before now"}];return jsxs("div",{className:"dtp-quick-offset","aria-label":l?"\u5FEB\u901F\u504F\u79FB":"Quick offset",children:[jsx("input",{type:"number",className:"dtp-offset-input",value:e,min:1,max:9999,"aria-label":l?"\u504F\u79FB\u6570\u91CF":"Offset amount",onChange:p=>{let m=parseInt(p.target.value,10);!isNaN(m)&&m>=1&&n(m);}}),jsx("select",{className:"dtp-offset-select",value:t,"aria-label":l?"\u504F\u79FB\u5355\u4F4D":"Offset unit",onChange:p=>o(p.target.value),children:c.map(p=>jsx("option",{value:p.value,children:p.label},p.value))}),jsx("select",{className:"dtp-offset-select",value:r,"aria-label":l?"\u504F\u79FB\u65B9\u5411":"Offset direction",onChange:p=>a(p.target.value),children:u.map(p=>jsx("option",{value:p.value,children:p.label},p.value))}),jsx("button",{type:"button",className:"dtp-offset-apply",onClick:i,children:l?"\u5E94\u7528":"Apply"})]})}function Wa({className:e,popupClassName:t,triggerClassName:r,disabled:n=false,placeholder:o,...a}){let{isOpen:i,displayValue:s,workingDate:l,view:c,calYear:u,calMonth:p,offsetAmount:m,offsetUnit:d,offsetDirection:g,mode:h,use24Hour:b,showSeconds:y,locale:v,minDate:N,maxDate:x,openPicker:w,closePicker:L,confirm:P,clear:A,updateField:D,setView:S,setCalYear:C,setCalMonth:I,setOffsetAmount:k,setOffsetUnit:T,setOffsetDirection:R,applyQuickOffset:O,navigateCalendar:E}=bu({...a}),ne=useRef(null),U=useRef(null),z=new Date;xu([ne,U],L,i),ku(ne,U,i);let H=v.startsWith("zh"),_={cancel:H?"\u53D6\u6D88":"Cancel",confirm:H?"\u786E\u5B9A":"Confirm",calendarView:H?"\u65E5\u5386":"Calendar",scrollView:H?"\u6EDA\u8F6E":"Scroll",placeholder:o??(H?"\u9009\u62E9\u65E5\u671F\u65F6\u95F4":"Select date / time")},V=h==="date"||h==="datetime",oe=h==="time"||h==="datetime",be=gu(l.getFullYear(),200).map(te=>({label:String(te),value:te})),M=mo(v,"short").map((te,ve)=>({label:te,value:ve})),F=vn(l.getFullYear(),l.getMonth()),re=Array.from({length:F},(te,ve)=>({label:String(ve+1).padStart(2,"0"),value:ve+1})),W=Array.from({length:24},(te,ve)=>({label:String(ve).padStart(2,"0"),value:ve})),G=Array.from({length:12},(te,ve)=>({label:String(ve===0?12:ve).padStart(2,"0"),value:ve})),le=[{label:"AM",value:0},{label:"PM",value:1}],ke=Array.from({length:60},(te,ve)=>({label:String(ve).padStart(2,"0"),value:ve})),B=l.getHours(),q=B%12,Z=B<12?0:1,ue=oe&&!V?Clock:Calendar;return jsxs("div",{className:f("dtp-root",e),children:[jsxs("div",{className:"dtp-trigger-wrap",children:[jsxs("button",{ref:ne,type:"button",className:f("dtp-trigger",s&&"dtp-trigger--has-clear",n&&"dtp-trigger--disabled",r),onClick:()=>!n&&(i?L():w()),disabled:n,"aria-haspopup":"dialog","aria-expanded":i,children:[jsx(ue,{className:"dtp-trigger-icon","aria-hidden":"true"}),jsx("span",{className:f("dtp-trigger-text",!s&&"dtp-trigger-placeholder"),children:s||_.placeholder})]}),s&&jsx("button",{type:"button",className:"dtp-trigger-clear","aria-label":H?"\u6E05\u9664":"Clear value",onClick:()=>!n&&A(),children:jsx(X,{className:"h-3.5 w-3.5"})})]}),i&&createPortal(jsxs("div",{ref:U,className:f("dtp-panel",t),role:"dialog","aria-modal":"true","aria-label":H?"\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:s||_.placeholder}),jsx("div",{className:"dtp-panel-actions",children:V&&jsx("button",{type:"button",className:f("dtp-view-btn",c==="calendar"&&"dtp-view-btn--active"),"aria-pressed":c==="calendar",title:c==="calendar"?_.scrollView:_.calendarView,onClick:()=>{c!=="calendar"&&(C(l.getFullYear()),I(l.getMonth())),S(c==="calendar"?"drum":"calendar");},children:jsx(Calendar,{className:"h-4 w-4"})})})]}),jsx("div",{className:"dtp-panel-body",children:c==="drum"?jsxs("div",{className:"dtp-drum",children:[V&&jsxs("div",{className:"dtp-drum-date",children:[jsx(yr,{label:H?"\u5E74":"Year",items:be,selectedValue:l.getFullYear(),onSelect:te=>D("year",te)}),jsx(yr,{label:H?"\u6708":"Month",items:M,selectedValue:l.getMonth(),onSelect:te=>D("month",te)}),jsx(yr,{label:H?"\u65E5":"Day",items:re,selectedValue:l.getDate(),onSelect:te=>D("day",te)})]}),V&&oe&&jsx("div",{className:"dtp-drum-sep","aria-hidden":"true"}),oe&&jsxs("div",{className:"dtp-drum-time",children:[b?jsx(yr,{label:H?"\u65F6":"Hour",items:W,selectedValue:B,onSelect:te=>D("hour",te)}):jsxs(Fragment,{children:[jsx(yr,{label:H?"\u65F6":"Hour",items:G,selectedValue:q,onSelect:te=>{D("hour",Z===1?te+12:te);}}),jsx(yr,{label:"AM/PM",items:le,selectedValue:Z,onSelect:te=>{D("hour",q+(te===1?12:0));}})]}),jsx(yr,{label:H?"\u5206":"Min",items:ke,selectedValue:l.getMinutes(),onSelect:te=>D("minute",te)}),y&&jsx(yr,{label:H?"\u79D2":"Sec",items:ke,selectedValue:l.getSeconds(),onSelect:te=>D("second",te)})]})]}):jsx(Ry,{year:u,month:p,selectedDate:l,today:z,minDate:N,maxDate:x,locale:v,onSelectDay:te=>{D("year",te.getFullYear()),D("month",te.getMonth()),D("day",te.getDate()),S("drum");},onPrev:()=>E(-1),onNext:()=>E(1)})}),V&&jsx("div",{className:"dtp-panel-offset",children:jsx(Ey,{amount:m,unit:d,direction:g,onAmountChange:k,onUnitChange:T,onDirectionChange:R,onApply:O,locale:v})}),jsxs("div",{className:"dtp-panel-footer",children:[jsx("button",{type:"button",className:"dtp-btn-cancel",onClick:L,children:_.cancel}),jsx("button",{type:"button",className:"dtp-btn-confirm",onClick:P,children:_.confirm})]})]}),document.body)]})}var Ua=cva("w-full rounded-md font-mono text-center transition-all focus:outline-none focus:ring-2 disabled:pointer-events-none disabled:opacity-50",{variants:{size:{sm:"h-9 w-9 text-sm",md:"h-12 w-12 text-base",lg:"h-14 w-14 text-lg"},variant:{outline:"border border-secondary-300 bg-transparent focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600 dark:bg-transparent dark:focus:border-primary-400",filled:"border border-transparent bg-secondary-100 focus:border-primary-500 focus:ring-primary-500/20 dark:bg-secondary-800 dark:focus:border-primary-400",underline:"rounded-none border-0 border-b-2 border-secondary-300 bg-transparent px-0 focus:border-primary-500 focus:ring-0 dark:border-secondary-600 dark:focus:border-primary-400"},invalid:{true:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20",false:""}},defaultVariants:{size:"md",variant:"outline",invalid:false}}),ll=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 cl=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"}});function wn({length:e=6,value:t,defaultValue:r="",onChange:n,onComplete:o,size:a="md",variant:i="outline",disabled:s=false,readOnly:l=false,autoFocus:c=false,alphanumeric:u=false,mask:p=false,invalid:m=false,className:d}){let g=t!==void 0,[h,b]=useState(()=>{let S=(r??"").slice(0,e);return Array.from({length:e},(C,I)=>S[I]??"")}),y=g?Array.from({length:e},(S,C)=>(t??"")[C]??""):h,v=useRef([]),N=useRef([]);useEffect(()=>{c&&v.current[0]&&v.current[0].focus();},[c]);let x=useCallback(S=>{g||b(S);let C=S.join("");n?.(C),S.every(I=>I!=="")&&S.length===e&&o?.(C);},[g,n,o,e]),w=S=>{let C=v.current[S];C&&(C.classList.remove("otp-pop"),clearTimeout(N.current[S]),C.offsetWidth,C.classList.add("otp-pop"),N.current[S]=window.setTimeout(()=>C.classList.remove("otp-pop"),200));},L=useCallback((S,C)=>{let I=u?/[a-zA-Z0-9]/g:/[0-9]/g,k=C.match(I)??[];if(k.length===0)return;let T=k[k.length-1],R=[...y];R[S]=T,x(R),w(S),S<e-1&&v.current[S+1]?.focus();},[y,e,u,x]),P=useCallback((S,C)=>{if(C.key==="Backspace"){if(C.preventDefault(),y[S]){let I=[...y];I[S]="",x(I);}else if(S>0){v.current[S-1]?.focus();let I=[...y];I[S-1]="",x(I);}}else if(C.key==="ArrowLeft")C.preventDefault(),S>0&&v.current[S-1]?.focus();else if(C.key==="ArrowRight")C.preventDefault(),S<e-1&&v.current[S+1]?.focus();else if(C.key==="Delete"){C.preventDefault();let I=[...y];I[S]="",x(I);}},[y,e,x]),A=useCallback((S,C)=>{C.preventDefault();let I=C.clipboardData.getData("text"),k=u?/[a-zA-Z0-9]/g:/[0-9]/g,T=I.match(k)??[],R=[...y],O=S;for(let U=0;U<T.length&&S+U<e;U++)R[S+U]=T[U],O=S+U;x(R);let E=R.findIndex((U,z)=>z>O&&U===""),ne=E!==-1?E:Math.min(O+1,e-1);v.current[ne]?.focus();},[y,e,u,x]),D=useCallback(S=>{S.target.select();},[]);return jsx("div",{role:"group","aria-label":"OTP Input",className:f("inline-flex gap-2",d),children:Array.from({length:e},(S,C)=>jsx("input",{ref:I=>{v.current[C]=I;},type:p?"password":"text",inputMode:u?"text":"numeric",pattern:u?"[a-zA-Z0-9]":"[0-9]",maxLength:2,value:y[C],disabled:s,readOnly:l,autoComplete:"one-time-code","aria-label":`Digit ${C+1} of ${e}`,className:f(Ua({size:a,variant:i,invalid:m||void 0}),"text-secondary-900 dark:text-secondary-100"),onChange:I=>L(C,I.target.value),onKeyDown:I=>P(C,I),onPaste:I=>A(C,I),onFocus:D},C))})}var zy={login:"Welcome back",register:"Create account",otp:"Verify your identity",forgot:"Reset password"},Vy={login:"Sign in to your account to continue",register:"Fill in the details to get started",otp:"Enter the 6-digit code sent to your email",forgot:"We'll send a reset link to your email"};function Ga({mode:e,onModeChange:t,onLogin:r,onRegister:n,onOTPComplete:o,onForgotPassword:a,logo:i,title:s,subtitle:l,socialLogins:c,showRememberMe:u=true,isLoading:p=false,error:m,className:d,style:g}){let[h,b]=useState("login"),y=e!==void 0,v=y?e:h,N=useCallback(V=>{y||b(V),t?.(V);},[y,t]),[x,w]=useState(""),[L,P]=useState(""),[A,D]=useState(false),[S,C]=useState(""),[I,k]=useState(""),[T,R]=useState(""),[O,E]=useState(""),ne=useCallback(async V=>{V.preventDefault(),await r?.(x,L,A);},[x,L,A,r]),U=useCallback(async V=>{V.preventDefault(),await n?.(S,I,T);},[S,I,T,n]),z=useCallback(async V=>{V.preventDefault(),await a?.(O);},[O,a]),H=s??zy[v],_=l??Vy[v];return jsxs("div",{className:f("w-full max-w-sm rounded-2xl border border-primary-200 bg-white/90 p-8 shadow-xl backdrop-blur-md","dark:border-primary-700 dark:bg-primary-900/90",d),style:g,children:[i&&jsx("div",{className:"mb-6 flex justify-center",children:i}),jsxs("div",{className:"mb-6 text-center",children:[jsx("h2",{className:"text-xl font-bold text-primary-900 dark:text-primary-50",children:H}),jsx("p",{className:"mt-1 text-sm text-secondary-500 dark:text-secondary-400",children:_})]}),c&&c.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"mb-4 flex flex-col gap-2",children:c.map((V,oe)=>jsxs("button",{type:"button",onClick:V.onClick,disabled:p,className:f("flex w-full items-center justify-center gap-2 rounded-lg border border-secondary-300 px-4 py-2 text-sm font-medium","text-secondary-700 transition-colors hover:bg-secondary-50","dark:border-secondary-600 dark:text-secondary-300 dark:hover:bg-secondary-800","disabled:opacity-50 disabled:cursor-not-allowed","[&_svg]:h-4 [&_svg]:w-4"),children:[V.icon,V.label]},oe))}),jsxs("div",{className:"relative mb-4 flex items-center",children:[jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"}),jsx("span",{className:"mx-3 text-xs text-secondary-400 dark:text-secondary-500",children:"or continue with"}),jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"})]})]}),jsxs("div",{className:"login-panel-slide-enter",children:[v==="login"&&jsxs("form",{onSubmit:ne,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-email",children:"Email"}),jsx(Ft,{id:"lp-email",type:"email",placeholder:"you@example.com",value:x,onChange:V=>w(V.target.value),disabled:p,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-password",children:"Password"}),jsx(Ft,{id:"lp-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:L,onChange:V=>P(V.target.value),disabled:p,required:true})]}),u&&jsxs("div",{className:"flex items-center justify-between",children:[jsx(An,{checked:A,onCheckedChange:V=>D(!!V),label:"Remember me",disabled:p}),jsx("button",{type:"button",className:"text-xs text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("forgot"),children:"Forgot password?"})]}),m&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):jsxs(Fragment,{children:["Sign in"," ",jsx(en,{className:"ml-1 opacity-60",children:jsx(Zr,{size:"xs",children:"\u23CE"})})]})}),jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Don't have an account?"," ",jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("register"),children:"Register"})]})]}),v==="register"&&jsxs("form",{onSubmit:U,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-name",children:"Full name"}),jsx(Ft,{id:"lp-name",type:"text",placeholder:"Jane Doe",value:S,onChange:V=>C(V.target.value),disabled:p,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-reg-email",children:"Email"}),jsx(Ft,{id:"lp-reg-email",type:"email",placeholder:"you@example.com",value:I,onChange:V=>k(V.target.value),disabled:p,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-reg-password",children:"Password"}),jsx(Ft,{id:"lp-reg-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:T,onChange:V=>R(V.target.value),disabled:p,required:true})]}),m&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Create account"}),jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Already have an account?"," ",jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"Sign in"})]})]}),v==="otp"&&jsxs("div",{className:"space-y-6",children:[jsx("div",{className:"flex justify-center",children:jsx(wn,{length:6,size:"md",onComplete:async V=>{await o?.(V);},autoFocus:true})}),m&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-center text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"\u2190 Back to login"})})]}),v==="forgot"&&jsxs("form",{onSubmit:z,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-forgot-email",children:"Email address"}),jsx(Ft,{id:"lp-forgot-email",type:"email",placeholder:"you@example.com",value:O,onChange:V=>E(V.target.value),disabled:p,required:true})]}),m&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Send reset link"}),jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"\u2190 Back to login"})})]})]},v)]})}var Hy=Object.defineProperty,bl=(e,t)=>{for(var r in t)Hy(e,r,{get:t[r],enumerable:true});};function oi(e){let{state:t,transaction:r}=e,{selection:n}=r,{doc:o}=r,{storedMarks:a}=r;return {...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return n},get doc(){return o},get tr(){return n=r.selection,o=r.doc,a=r.storedMarks,r}}}var yl=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state;}get hasCustomState(){return !!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:r}=this,{view:n}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([i,s])=>[i,(...c)=>{let u=s(...c)(a);return !o.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(o),u}]))}get chain(){return ()=>this.createChain()}get can(){return ()=>this.createCan()}createChain(e,t=true){let{rawCommands:r,editor:n,state:o}=this,{view:a}=n,i=[],s=!!e,l=e||o.tr,c=()=>(!s&&t&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(l),i.every(p=>p===true)),u={...Object.fromEntries(Object.entries(r).map(([p,m])=>[p,(...g)=>{let h=this.buildProps(l,t),b=m(...g)(h);return i.push(b),u}])),run:c};return u}createCan(e){let{rawCommands:t,state:r}=this,n=false,o=e||r.tr,a=this.buildProps(o,n);return {...Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...c)=>l(...c)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,n)}}buildProps(e,t=true){let{rawCommands:r,editor:n,state:o}=this,{view:a}=n,i={tr:e,editor:n,view:a,state:oi({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([s,l])=>[s,(...c)=>l(...c)(i)]))}};return i}},$u={};bl($u,{blur:()=>_y,clearContent:()=>Fy,clearNodes:()=>Oy,command:()=>$y,createParagraphNear:()=>jy,cut:()=>Yy,deleteCurrentNode:()=>Uy,deleteNode:()=>Xy,deleteRange:()=>Gy,deleteSelection:()=>Jy,enter:()=>Qy,exitCode:()=>ev,extendMarkRange:()=>rv,first:()=>nv,focus:()=>sv,forEach:()=>lv,insertContent:()=>cv,insertContentAt:()=>yv,joinBackward:()=>Mv,joinDown:()=>Cv,joinForward:()=>Tv,joinItemBackward:()=>Pv,joinItemForward:()=>Ev,joinTextblockBackward:()=>Dv,joinTextblockForward:()=>Iv,joinUp:()=>Nv,keyboardShortcut:()=>Vv,lift:()=>_v,liftEmptyBlock:()=>Bv,liftListItem:()=>$v,newlineInCode:()=>jv,resetAttributes:()=>Wv,scrollIntoView:()=>Yv,selectAll:()=>Xv,selectNodeBackward:()=>qv,selectNodeForward:()=>Qv,selectParentNode:()=>ex,selectTextblockEnd:()=>rx,selectTextblockStart:()=>ox,setContent:()=>ix,setMark:()=>Px,setMeta:()=>Rx,setNode:()=>Ex,setNodeSelection:()=>Dx,setTextDirection:()=>Ax,setTextSelection:()=>Ix,sinkListItem:()=>Vx,splitBlock:()=>Fx,splitListItem:()=>Kx,toggleList:()=>jx,toggleMark:()=>Wx,toggleNode:()=>Yx,toggleWrap:()=>Ux,undoInputRule:()=>Xx,unsetAllMarks:()=>Gx,unsetMark:()=>qx,unsetTextDirection:()=>Jx,updateAttributes:()=>Qx,wrapIn:()=>ew,wrapInList:()=>rw});var _y=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var r;e.isDestroyed||(t.dom.blur(),(r=window?.getSelection())==null||r.removeAllRanges());}),true),Fy=(e=true)=>({commands:t})=>t.setContent("",{emitUpdate:e}),Oy=()=>({state:e,tr:t,dispatch:r})=>{let{selection:n}=t,{ranges:o}=n;return r&&o.forEach(({$from:a,$to:i})=>{e.doc.nodesBetween(a.pos,i.pos,(s,l)=>{if(s.type.isText)return;let{doc:c,mapping:u}=t,p=c.resolve(u.map(l)),m=c.resolve(u.map(l+s.nodeSize)),d=p.blockRange(m);if(!d)return;let g=liftTarget(d);if(s.type.isTextblock){let{defaultType:h}=p.parent.contentMatchAt(p.index());t.setNodeMarkup(d.start,h);}(g||g===0)&&t.lift(d,g);});}),true},$y=e=>t=>e(t),jy=()=>({state:e,dispatch:t})=>createParagraphNear(e,t),Yy=(e,t)=>({editor:r,tr:n})=>{let{state:o}=r,a=o.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);let i=n.mapping.map(t);return n.insert(i,a.content),n.setSelection(new TextSelection(n.doc.resolve(Math.max(i-1,0)))),true},Uy=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return false;let o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===n.type){if(t){let s=o.before(a),l=o.after(a);e.delete(s,l).scrollIntoView();}return true}return false};function nt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Xy=e=>({tr:t,state:r,dispatch:n})=>{let o=nt(e,r.schema),a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===o){if(n){let l=a.before(i),c=a.after(i);t.delete(l,c).scrollIntoView();}return true}return false},Gy=e=>({tr:t,dispatch:r})=>{let{from:n,to:o}=e;return r&&t.delete(n,o),true},Jy=()=>({state:e,dispatch:t})=>deleteSelection(e,t),Qy=()=>({commands:e})=>e.keyboardShortcut("Enter"),ev=()=>({state:e,dispatch:t})=>exitCode(e,t);function vl(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function ti(e,t,r={strict:true}){let n=Object.keys(t);return n.length?n.every(o=>r.strict?t[o]===e[o]:vl(t[o])?t[o].test(e[o]):t[o]===e[o]):true}function Ku(e,t,r={}){return e.find(n=>n.type===t&&ti(Object.fromEntries(Object.keys(r).map(o=>[o,n.attrs[o]])),r))}function Pu(e,t,r={}){return !!Ku(e,t,r)}function ju(e,t,r){var n;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===t))&&(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===t)||(r=r||((n=o.node.marks[0])==null?void 0:n.attrs),!Ku([...o.node.marks],t,r)))return;let i=o.index,s=e.start()+o.offset,l=i+1,c=s+o.node.nodeSize;for(;i>0&&Pu([...e.parent.child(i-1).marks],t,r);)i-=1,s-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&Pu([...e.parent.child(l).marks],t,r);)c+=e.parent.child(l).nodeSize,l+=1;return {from:s,to:c}}function rr(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var rv=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let a=rr(e,n.schema),{doc:i,selection:s}=r,{$from:l,from:c,to:u}=s;if(o){let p=ju(l,a,t);if(p&&p.from<=c&&p.to>=u){let m=TextSelection.create(i,p.from,p.to);r.setSelection(m);}}return true},nv=e=>t=>{let r=typeof e=="function"?e(t):e;for(let n=0;n<r.length;n+=1)if(r[n](t))return true;return false};function Wu(e){return e instanceof TextSelection}function Kr(e=0,t=0,r=0){return Math.min(Math.max(e,t),r)}function av(e,t=null){if(!t)return null;let r=Selection.atStart(e),n=Selection.atEnd(e);if(t==="start"||t===true)return r;if(t==="end")return n;let o=r.from,a=n.to;return t==="all"?TextSelection.create(e,Kr(0,o,a),Kr(e.content.size,o,a)):TextSelection.create(e,Kr(t,o,a),Kr(t,o,a))}function Lu(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ri(){return ["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function iv(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):false}var sv=(e=null,t={})=>({editor:r,view:n,tr:o,dispatch:a})=>{t={scrollIntoView:true,...t};let i=()=>{(ri()||Lu())&&n.dom.focus(),iv()&&!ri()&&!Lu()&&n.dom.focus({preventScroll:true}),requestAnimationFrame(()=>{r.isDestroyed||(n.focus(),t?.scrollIntoView&&r.commands.scrollIntoView());});};try{if(n.hasFocus()&&e===null||e===!1)return !0}catch{return false}if(a&&e===null&&!Wu(r.state.selection))return i(),true;let s=av(o.doc,e)||r.state.selection,l=r.state.selection.eq(s);return a&&(l||o.setSelection(s),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),true},lv=(e,t)=>r=>e.every((n,o)=>t(n,{...r,index:o})),cv=(e,t)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,t),Yu=e=>{let t=e.childNodes;for(let r=t.length-1;r>=0;r-=1){let n=t[r];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):n.nodeType===1&&Yu(n);}return e};function qa(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`,r=new window.DOMParser().parseFromString(t,"text/html").body;return Yu(r)}function xo(e,t,r){if(e instanceof Node||e instanceof Fragment$1)return e;r={slice:true,parseOptions:{},...r};let n=typeof e=="object"&&e!==null,o=typeof e=="string";if(n)try{if(Array.isArray(e)&&e.length>0)return Fragment$1.fromArray(e.map(s=>t.nodeFromJSON(s)));let i=t.nodeFromJSON(e);return r.errorOnInvalidContent&&i.check(),i}catch(a){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",a),xo("",t,r)}if(o){if(r.errorOnInvalidContent){let i=false,s="",l=new Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=true,s=typeof c=="string"?c:c.outerHTML,null)}]}})});if(r.slice?DOMParser.fromSchema(l).parseSlice(qa(e),r.parseOptions):DOMParser.fromSchema(l).parse(qa(e),r.parseOptions),r.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}let a=DOMParser.fromSchema(t);return r.slice?a.parseSlice(qa(e),r.parseOptions).content:a.parse(qa(e),r.parseOptions)}return xo("",t,r)}function gv(e,t,r){let n=e.steps.length-1;if(n<t)return;let o=e.steps[n];if(!(o instanceof ReplaceStep||o instanceof ReplaceAroundStep))return;let a=e.mapping.maps[n],i=0;a.forEach((s,l,c,u)=>{i===0&&(i=u);}),e.setSelection(Selection.near(e.doc.resolve(i),r));}var bv=e=>!("type"in e),yv=(e,t,r)=>({tr:n,dispatch:o,editor:a})=>{var i;if(o){r={parseOptions:a.options.parseOptions,updateSelection:true,applyInputRules:false,applyPasteRules:false,...r};let s,l=b=>{a.emit("contentError",{editor:a,error:b,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=true);}});},c={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{xo(t,a.schema,{parseOptions:c,errorOnInvalidContent:!0});}catch(b){l(b);}try{s=xo(t,a.schema,{parseOptions:c,errorOnInvalidContent:(i=r.errorOnInvalidContent)!=null?i:a.options.enableContentCheck});}catch(b){return l(b),false}let{from:u,to:p}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},m=true,d=true;if((bv(s)?s:[s]).forEach(b=>{b.check(),m=m?b.isText&&b.marks.length===0:false,d=d?b.isBlock:false;}),u===p&&d){let{parent:b}=n.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,p+=1);}let h;if(m){if(Array.isArray(t))h=t.map(b=>b.text||"").join("");else if(t instanceof Fragment$1){let b="";t.forEach(y=>{y.text&&(b+=y.text);}),h=b;}else typeof t=="object"&&t&&t.text?h=t.text:h=t;n.insertText(h,u,p);}else {h=s;let b=n.doc.resolve(u),y=b.node(),v=b.parentOffset===0,N=y.isText||y.isTextblock,x=y.content.size>0;v&&N&&x&&(u=Math.max(0,u-1)),n.replaceWith(u,p,h);}r.updateSelection&&gv(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:u,text:h}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:u,text:h});}return true},Nv=()=>({state:e,dispatch:t})=>joinUp(e,t),Cv=()=>({state:e,dispatch:t})=>joinDown(e,t),Mv=()=>({state:e,dispatch:t})=>joinBackward(e,t),Tv=()=>({state:e,dispatch:t})=>joinForward(e,t),Pv=()=>({state:e,dispatch:t,tr:r})=>{try{let n=joinPoint(e.doc,e.selection.$from.pos,-1);return n==null?!1:(r.join(n,2),t&&t(r),!0)}catch{return false}},Ev=()=>({state:e,dispatch:t,tr:r})=>{try{let n=joinPoint(e.doc,e.selection.$from.pos,1);return n==null?!1:(r.join(n,2),t&&t(r),!0)}catch{return false}},Dv=()=>({state:e,dispatch:t})=>joinTextblockBackward(e,t),Iv=()=>({state:e,dispatch:t})=>joinTextblockForward(e,t);function Uu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):false}function zv(e){let t=e.split(/-(?!$)/),r=t[t.length-1];r==="Space"&&(r=" ");let n,o,a,i;for(let s=0;s<t.length-1;s+=1){let l=t[s];if(/^(cmd|meta|m)$/i.test(l))i=true;else if(/^a(lt)?$/i.test(l))n=true;else if(/^(c|ctrl|control)$/i.test(l))o=true;else if(/^s(hift)?$/i.test(l))a=true;else if(/^mod$/i.test(l))ri()||Uu()?i=true:o=true;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(r=`Alt-${r}`),o&&(r=`Ctrl-${r}`),i&&(r=`Meta-${r}`),a&&(r=`Shift-${r}`),r}var Vv=e=>({editor:t,view:r,tr:n,dispatch:o})=>{let a=zv(e).split(/-(?!$)/),i=a.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),s=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:true,cancelable:true}),l=t.captureTransaction(()=>{r.someProp("handleKeyDown",c=>c(r,s));});return l?.steps.forEach(c=>{let u=c.map(n.mapping);u&&o&&n.maybeStep(u);}),true};function xl(e,t,r={}){let{from:n,to:o,empty:a}=e.selection,i=t?nt(t,e.schema):null,s=[];e.doc.nodesBetween(n,o,(p,m)=>{if(p.isText)return;let d=Math.max(n,m),g=Math.min(o,m+p.nodeSize);s.push({node:p,from:d,to:g});});let l=o-n,c=s.filter(p=>i?i.name===p.node.type.name:true).filter(p=>ti(p.node.attrs,r,{strict:false}));return a?!!c.length:c.reduce((p,m)=>p+m.to-m.from,0)>=l}var _v=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return xl(r,o,t)?lift(r,n):false},Bv=()=>({state:e,dispatch:t})=>liftEmptyBlock(e,t),$v=e=>({state:t,dispatch:r})=>{let n=nt(e,t.schema);return liftListItem(n)(t,r)},jv=()=>({state:e,dispatch:t})=>newlineInCode(e,t);function Xu(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Au(e,t){let r=typeof t=="string"?[t]:t;return Object.keys(e).reduce((n,o)=>(r.includes(o)||(n[o]=e[o]),n),{})}var Wv=(e,t)=>({tr:r,state:n,dispatch:o})=>{let a=null,i=null,s=Xu(typeof e=="string"?e:e.name,n.schema);if(!s)return false;s==="node"&&(a=nt(e,n.schema)),s==="mark"&&(i=rr(e,n.schema));let l=false;return r.selection.ranges.forEach(c=>{n.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,p)=>{a&&a===u.type&&(l=true,o&&r.setNodeMarkup(p,void 0,Au(u.attrs,t))),i&&u.marks.length&&u.marks.forEach(m=>{i===m.type&&(l=true,o&&r.addMark(p,p+u.nodeSize,i.create(Au(m.attrs,t))));});});}),l},Yv=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),true),Xv=()=>({tr:e,dispatch:t})=>{if(t){let r=new AllSelection(e.doc);e.setSelection(r);}return true},qv=()=>({state:e,dispatch:t})=>selectNodeBackward(e,t),Qv=()=>({state:e,dispatch:t})=>selectNodeForward(e,t),ex=()=>({state:e,dispatch:t})=>selectParentNode(e,t),rx=()=>({state:e,dispatch:t})=>selectTextblockEnd(e,t),ox=()=>({state:e,dispatch:t})=>selectTextblockStart(e,t);function ax(e,t,r={},n={}){return xo(e,t,{slice:false,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}var ix=(e,{errorOnInvalidContent:t,emitUpdate:r=true,parseOptions:n={}}={})=>({editor:o,tr:a,dispatch:i,commands:s})=>{let{doc:l}=a;if(n.preserveWhitespace!=="full"){let c=ax(e,o.schema,n,{errorOnInvalidContent:t??o.options.enableContentCheck});return i&&a.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!r),true}return i&&a.setMeta("preventUpdate",!r),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:n,errorOnInvalidContent:t??o.options.enableContentCheck})};function sx(e,t){let r=rr(t,e.schema),{from:n,to:o,empty:a}=e.selection,i=[];a?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,o,l=>{i.push(...l.marks);});let s=i.find(l=>l.type.name===r.name);return s?{...s.attrs}:{}}function cx(e,t){let r=new Transform(e);return t.forEach(n=>{n.steps.forEach(o=>{r.step(o);});}),r}function dx(e){for(let t=0;t<e.edgeCount;t+=1){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function ux(e,t){for(let r=e.depth;r>0;r-=1){let n=e.node(r);if(t(n))return {pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}function wl(e){return t=>ux(t.$from,e)}function ye(e,t,r){return e.config[t]===void 0&&e.parent?ye(e.parent,t,r):typeof e.config[t]=="function"?e.config[t].bind({...r,parent:e.parent?ye(e.parent,t,r):null}):e.config[t]}function fx(e){return typeof e=="function"}function je(e,t=void 0,...r){return fx(e)?t?e.bind(t)(...r):e(...r):e}function kn(e){let t=e.filter(o=>o.type==="extension"),r=e.filter(o=>o.type==="node"),n=e.filter(o=>o.type==="mark");return {baseExtensions:t,nodeExtensions:r,markExtensions:n}}function gx(e){let t=[],r="",n=false,o=false,a=0,i=e.length;for(let s=0;s<i;s+=1){let l=e[s];if(l==="'"&&!o){n=!n,r+=l;continue}if(l==='"'&&!n){o=!o,r+=l;continue}if(!n&&!o){if(l==="("){a+=1,r+=l;continue}if(l===")"&&a>0){a-=1,r+=l;continue}if(l===";"&&a===0){t.push(r),r="";continue}}r+=l;}return r&&t.push(r),t}function Iu(e){let t=[],r=gx(e||""),n=r.length;for(let o=0;o<n;o+=1){let a=r[o],i=a.indexOf(":");if(i===-1)continue;let s=a.slice(0,i).trim(),l=a.slice(i+1).trim();s&&l&&t.push([s,l]);}return t}function Nn(...e){return e.filter(t=>!!t).reduce((t,r)=>{let n={...t};return Object.entries(r).forEach(([o,a])=>{if(!n[o]){n[o]=a;return}if(o==="class"){let s=a?String(a).split(" "):[],l=n[o]?n[o].split(" "):[],c=s.filter(u=>!l.includes(u));n[o]=[...l,...c].join(" ");}else if(o==="style"){let s=new Map([...Iu(n[o]),...Iu(a)]);n[o]=Array.from(s.entries()).map(([l,c])=>`${l}: ${c}`).join("; ");}else n[o]=a;}),n},{})}function xx(e,t,r){let{from:n,to:o}=t,{blockSeparator:a=`
|
|
84
|
+
`}),jsx(Zn,{open:H,onOpenChange:_,children:jsxs(vs,{size:"sm",children:[jsxs(xs,{children:[jsxs(ws,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(ks,{children:[P.size===1?`Are you sure you want to delete "${de[Array.from(P)[0]]?.name}"?`:`Are you sure you want to delete ${P.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(Ns,{children:[jsx(Vt,{intent:"ghost",onClick:()=>_(false),children:"Cancel"}),jsxs(Vt,{intent:"danger",onClick:()=>{let O=Array.from(P).map(ge=>de[ge]).filter(Boolean);m?.(O),A(new Set),S(null),_(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function yn({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:f("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function cy(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,i=document.createElement("span");i.className="masonry-ripple",i.style.width=`${n}px`,i.style.height=`${n}px`,i.style.left=`${o}px`,i.style.top=`${a}px`,t.appendChild(i),i.addEventListener("animationend",()=>i.remove());}function nl({columns:e,columnWidth:t=240,gap:r=16,items:n,onItemClick:o,className:a,style:i,children:s,...l}){let c=useRef(null),u=useRef([]),[p,m]=useState(()=>e??1),[d,g]=useState([]),[h,b]=useState(0),y=n?n.map((P,A)=>({key:P.key??A,node:P.content})):$n.Children.toArray(s).map((P,A)=>({key:P.key??A,node:P})),v=y.length,N=useCallback(P=>e??Math.max(1,Math.floor((P+r)/(t+r))),[e,t,r]),x=useCallback(()=>{let P=c.current;if(!P)return;let A=P.clientWidth,D=N(A);m(D);let S=(A-(D-1)*r)/D,C=new Array(D).fill(0),I=[];for(let M=0;M<v;M++){let R=u.current[M],$=R?R.offsetHeight:0,E=0;for(let ne=1;ne<D;ne++)C[ne]<C[E]&&(E=ne);I.push({top:C[E],left:E*(S+r),width:S}),C[E]+=$+r;}let k=Math.max(0,...C)-(v?r:0);g(I),b(k);},[v,N,r]);useEffect(()=>{let P=c.current;if(!P)return;let A=new ResizeObserver(()=>x());return A.observe(P),()=>A.disconnect()},[x]),useEffect(()=>{let P=requestAnimationFrame(x);return ()=>cancelAnimationFrame(P)},[x]),useEffect(()=>{let P=new ResizeObserver(()=>x());return u.current.forEach(A=>{A&&P.observe(A);}),()=>P.disconnect()},[v,p,x]);let w=useCallback((P,A)=>{let D=P.currentTarget;cy(P,D),o?.(n?.[A],A);},[o,n]),L=P=>{if(!n)return false;let A=n[P];return !!(A.title||A.description||A.actions)};return jsx("div",{ref:c,className:f("relative",a),style:{...i,height:h},...l,children:y.map((P,A)=>jsxs("div",{ref:D=>{u.current[A]=D;},className:"masonry-item",role:"button",tabIndex:0,onClick:D=>w(D,A),onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),o?.(n?.[A],A));},style:{position:"absolute",top:d[A]?.top??0,left:d[A]?.left??0,width:d[A]?.width??"100%"},children:[P.node,L(A)&&jsxs("div",{className:"masonry-item-overlay",children:[n[A].title&&jsx("p",{className:"masonry-item-overlay-title",children:n[A].title}),n[A].description&&jsx("p",{className:"masonry-item-overlay-desc",children:n[A].description}),n[A].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:n[A].actions})]})]},P.key))})}var py='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="2" y1="2" x2="22" y2="22"/><path d="M10.41 10.41a2 2 0 1 1-2.83-2.83"/><line x1="13.5" y1="6" x2="18" y2="6"/><line x1="6" y1="2" x2="14" y2="10"/><path d="M4 6h1.5"/><path d="M2 18.5C2 19.9 3.1 21 4.5 21H16"/><rect x="2" y="2" width="20" height="20" rx="5" ry="5"/></svg>';function _a(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function my(e){return e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,"").replace(/\s+on[a-z][a-z0-9]*\s*=\s*(?:"[^"]*"|'[^']*'|[^\s/>]*)/gi,"").replace(/\b(href|src|action)\s*=\s*["']\s*(?:javascript|vbscript)\s*:[^"'>]*/gi,'$1="#"').replace(/\bhref\s*=\s*["']\s*data\s*:[^"'>]*/gi,'href="#"')}var Yd=new Marked;Yd.use({renderer:{image({href:e,title:t,text:r}){let n=/^https?:\/\//i.test(e??"")?e:"",o=r?` alt="${_a(r)}"`:' alt=""',a=t?` title="${_a(t)}"`:"",i=_a(r||"Image failed to load");return `<figure class="tw-rich-img-wrap"><img class="tw-rich-img" src="${_a(n)}" loading="lazy"${o}${a} /><div class="tw-rich-img-error">`+py+`<span>${i}</span></div></figure>`}}});function Ud(e){let{result:t,store:r}=fy(e),n=Yd.parse(t,{async:false}),o=my(n);return hy(o,r)}function fy(e){let t=[];return {result:e.replace(/\$\$([\s\S]+?)\$\$/g,(n,o)=>`<!--LATEX_${t.push({src:o,display:true})-1}-->`).replace(/\\\[([\s\S]+?)\\\]/g,(n,o)=>`<!--LATEX_${t.push({src:o,display:true})-1}-->`).replace(/\\\(([\s\S]+?)\\\)/g,(n,o)=>`<!--LATEX_${t.push({src:o,display:false})-1}-->`).replace(/(?<!\$)\$(?!\$)((?:[^\n$\\]|\\[^\n])+?)\$(?!\$)/g,(n,o)=>`<!--LATEX_${t.push({src:o,display:false})-1}-->`),store:t}}function hy(e,t){return t.length===0?e:e.replace(/<!--LATEX_(\d+)-->/g,(r,n)=>{let o=t[Number(n)];if(!o)return r;try{return uy.renderToString(o.src,{displayMode:o.display,throwOnError:!1,output:"html",trust:!1})}catch{return o.display?`<span class="tw-latex-raw">\\[${o.src}\\]</span>`:`<code class="tw-latex-raw">$${o.src}$</code>`}})}function $a({text:e="",mode:t="typewriter",speed:r=40,cursor:n=true,cursorChar:o="\u258B",thinking:a=false,streaming:i=false,delay:s=0,onComplete:l,as:c="span",className:u,rich:p=false}){let[m,d]=useState(t==="instant"?e:""),[g,h]=useState(false),[b,y]=useState(t==="instant"),[v,N]=useState(false),x=useRef(null),w=useRef(0),L=useRef(l);L.current=l;let P=useRef(e);P.current=e,useEffect(()=>{if(t!=="typewriter")return;if(d(""),y(false),N(false),h(false),!e){y(true);return}let I=Math.max(10,1e3/r),k=0,M,R=()=>{h(true),M=setInterval(()=>{let E=P.current;k++,d(E.slice(0,k)),k>=E.length&&(clearInterval(M),h(false),y(true),L.current?.());},I);},$;return s>0?$=setTimeout(R,s):R(),()=>{clearTimeout($),clearInterval(M);}},[e,t]),useEffect(()=>{if(t!=="stream")return;if(e.length===0){w.current=0,d(""),h(false),y(false),N(false);return}if(e.length<=w.current)return;let I=Math.max(10,1e3/r),k=w.current;h(true),y(false),N(false);let M=setInterval(()=>{k++,w.current=k,d(P.current.slice(0,k)),k>=P.current.length&&(clearInterval(M),h(false),L.current?.());},I);return ()=>clearInterval(M)},[e,t]),useEffect(()=>{t==="instant"&&(d(e),h(false),y(true));},[e,t]);let A=useRef(i);useEffect(()=>{let I=A.current;if(A.current=i,I&&!i&&!g&&t==="stream"){N(true);let k=setTimeout(()=>{N(false),y(true);},650);return ()=>clearTimeout(k)}},[i,g,t]),useEffect(()=>{if(!p||!x.current)return;let k=Array.from(x.current.querySelectorAll(".tw-rich-img")).map(M=>{let R=()=>{let $=M.closest(".tw-rich-img-wrap");$&&$.classList.add("tw-rich-img-wrap--error");};return M.addEventListener("error",R,{once:true}),{img:M,onError:R}});return ()=>{k.forEach(({img:M,onError:R})=>M.removeEventListener("error",R));}},[m,p]);let D=n&&(a||g||v||t==="stream"&&i&&!b||t==="typewriter"&&!b),S=a?"tw-cursor--blink":g?"tw-cursor--solid":v?"tw-cursor--out":"tw-cursor--blink",C=c;return p?jsxs("div",{role:"region",className:f(u),children:[jsx("div",{ref:x,className:"tw-rich-prose",dangerouslySetInnerHTML:{__html:Ud(m)}}),D&&jsx("span",{className:f("tw-cursor",S),"aria-hidden":"true",children:o})]}):jsxs(C,{className:f(u),children:[a&&!m&&jsx("span",{"aria-hidden":"true",children:"\u200B"}),m,D&&jsx("span",{className:f("tw-cursor",S),"aria-hidden":"true",children:o})]})}function Oa(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function gy(e,t){if(!t)return true;let r=Oa(t);return Oa(e.label).includes(r)||(e.description?Oa(e.description).includes(r):false)||(e.keywords?e.keywords.some(n=>Oa(n).includes(r)):false)}function by(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 Qd(e,t,r,n){let[o,a]=useState(""),[i,s]=useState(0);useEffect(()=>{t&&(a(""),s(0));},[t]);let l=useMemo(()=>e.filter(m=>!m.disabled&&gy(m,o)),[e,o]),c=useMemo(()=>by(l),[l]);useEffect(()=>{s(m=>Math.min(m,Math.max(0,l.length-1)));},[l.length]);let u=useCallback(()=>{let m=l[i];m&&(m.onSelect(),r(false));},[l,i,r]),p=useCallback(m=>{switch(m.key){case "ArrowDown":m.preventDefault(),s(d=>(d+1)%Math.max(1,l.length));break;case "ArrowUp":m.preventDefault(),s(d=>(d-1+Math.max(1,l.length))%Math.max(1,l.length));break;case "Enter":m.preventDefault(),u();break;case "Escape":m.preventDefault(),r(false);break}},[l.length,u,r]);return useEffect(()=>{if(!n)return;function m(d){(d.metaKey||d.ctrlKey)&&d.key==="k"&&(d.preventDefault(),r(!t));}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n,t,r]),{query:o,setQuery:a,groups:c,filtered:l,activeIndex:i,setActiveIndex:s,handleKeyDown:p}}function Ka({open:e,onOpenChange:t,commands:r,placeholder:n="Type a command or search\u2026",hotkey:o=true,maxItems:a=8,className:i}){let s=useRef(null),l=useRef(null),{query:c,setQuery:u,groups:p,filtered:m,activeIndex:d,setActiveIndex:g,handleKeyDown:h}=Qd(r,e,t,o);if(useEffect(()=>{if(e){let y=setTimeout(()=>s.current?.focus(),40);return ()=>clearTimeout(y)}},[e]),useEffect(()=>{l.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[d]),!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:f("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",i),onClick:y=>y.stopPropagation(),onKeyDown:h,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:s,value:c,onChange:y=>u(y.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":m[d]?`cmd-item-${m[d].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:l,className:"overflow-y-auto py-2",style:{maxHeight:`${a*2.75}rem`},role:"listbox","aria-label":"Commands",children:m.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"})]}):p.map(y=>jsxs("div",{className:"mb-1 last:mb-0",children:[y.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:y.label}),y.items.map(v=>{let N=b++,x=N===d;return jsxs("button",{id:`cmd-item-${v.id}`,"data-active":x,role:"option","aria-selected":x,className:f("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",x?"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:()=>g(N),onClick:()=>{v.onSelect(),t(false);},children:[v.icon&&jsx("span",{className:f("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",x?"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:v.icon}),jsxs("span",{className:"min-w-0 flex-1",children:[jsx("span",{className:"block truncate font-medium",children:v.label}),v.description&&jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:v.description})]}),v.shortcut&&jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:v.shortcut.map((w,L)=>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:w},L))})]},v.id)})]},y.label||"_default"))}),m.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:[m.length," result",m.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 nu={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"},ou={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 au({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 iu({images:e,title:t}){let r=e.slice(0,4),n=e.length>4?e.length-4:0,o=(a,i,s)=>jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:f("relative block overflow-hidden",s),onClick:l=>l.stopPropagation(),children:[jsx("img",{src:a,alt:`${t} ${i+1}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105"}),i===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]})})]},i);return r.length===0?null:r.length===1?jsx("div",{className:"mt-2.5 h-36 overflow-hidden rounded-xl",children:o(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((a,i)=>o(a,i))}):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:[o(r[0],0,"row-span-2"),o(r[1],1),o(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((a,i)=>o(a,i))})}function su({actions:e}){let t=e.filter(i=>i.variant!=="primary"),r=e.filter(i=>i.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",o="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",a=(i,s,l)=>i.href?jsxs("a",{href:i.href,target:"_blank",rel:"noopener noreferrer",className:l,onClick:c=>c.stopPropagation(),children:[i.icon,i.label]},s):jsxs("button",{type:"button",onClick:i.onClick,className:l,children:[i.icon,i.label]},s);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((i,s)=>a(i,s,n)),r.length>0&&jsx("span",{className:"flex-1"}),r.map((i,s)=>a(i,s,o))]})}function lu({item:e,isActive:t,animated:r,visible:n,orientation:o}){let a=e.status??"pending",i={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"}[a],s={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"}[a],l=t?"shadow-lg shadow-primary-300/30 dark:shadow-primary-500/20":a==="complete"?"shadow-md shadow-success-300/20 dark:shadow-success-400/10":a==="error"?"shadow-md shadow-danger-300/20 dark:shadow-danger-400/10":"shadow-sm shadow-primary-100/50 dark:shadow-black/20",c=a==="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%)":a==="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,u={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"}[a];return jsxs("div",{className:f("relative isolate",r&&"transition-all duration-700",r?n?"opacity-100 translate-y-0":o==="vertical"?"opacity-0 translate-y-6":"opacity-0 translate-x-6":"",o==="horizontal"?"w-56 shrink-0":"flex-1",e.className),children:[!t&&c&&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:c,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:f("relative overflow-hidden rounded-2xl border backdrop-blur-[2px]",t?"border-transparent":f("border",s),i,l),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:m=>m.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:f("mb-2 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",u),children:e.date}),jsx("h3",{className:f("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(iu,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsx(su,{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:f("p-4",(e.image||e.svg)&&"pt-3"),children:[e.date&&jsx("span",{className:f("mb-2.5 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",u),children:e.date}),jsx("h3",{className:f("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(iu,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsx(su,{actions:e.actions})]})]})})]})}function il({items:e,orientation:t="vertical",activeIndex:r,animated:n=true,lineStyle:o="solid",className:a}){let i=useRef(null),s=useRef([]),[l,c]=useState(new Set);useEffect(()=>{if(!n){c(new Set(e.map((m,d)=>d)));return}let p=new IntersectionObserver(m=>{c(d=>{let g=new Set(d);return m.forEach(h=>{let b=Number(h.target.dataset.idx);h.isIntersecting&&g.add(b);}),g});},{threshold:.15});return s.current.forEach(m=>m&&p.observe(m)),()=>p.disconnect()},[e,n]),useEffect(()=>{if(r==null)return;let p=s.current[r];p&&p.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[r]);let u=o==="dashed"?"border-dashed":"";return t==="vertical"?jsxs("div",{ref:i,className:f("relative",a),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((p,m)=>{let d=p.status??"pending",g=m===r;return jsxs("div",{ref:h=>{s.current[m]=h;},"data-idx":m,className:"relative flex gap-4",children:[jsx("div",{className:"relative z-10 flex shrink-0 flex-col items-center",children:jsx("div",{className:f("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 [&_svg]:shrink-0",nu[d],g&&ou[d]),children:jsx(au,{status:d,icon:p.icon})})}),jsx(lu,{item:p,isActive:g,animated:n,visible:l.has(m),orientation:"vertical"})]},p.id??m)})})]}):jsx("div",{ref:i,className:f("relative overflow-x-auto pb-4",a),children:jsx("div",{className:"flex min-w-max gap-6 px-4",children:e.map((p,m)=>{let d=p.status??"pending",g=m===r,h=m===e.length-1;return jsxs("div",{ref:b=>{s.current[m]=b;},"data-idx":m,className:"relative flex flex-col items-center gap-3",children:[jsxs("div",{className:"flex items-center",children:[jsx("div",{className:f("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 z-10 [&_svg]:shrink-0",nu[d],g&&ou[d]),children:jsx(au,{status:d,icon:p.icon})}),!h&&jsx("div",{className:f("h-px w-28 border-t-2",u,d==="complete"?"border-success-400":"border-primary-200 dark:border-primary-700")})]}),jsx(lu,{item:p,isActive:g,animated:n,visible:l.has(m),orientation:"horizontal"})]},p.id??m)})})})}function mo(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 cu(e="en-US",t="narrow"){let r=new Date(2e3,0,2);return Array.from({length:7},(n,o)=>{let a=new Date(r);return a.setDate(r.getDate()+o),new Intl.DateTimeFormat(e,{weekday:t}).format(a)})}function du(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 My(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function uu(e,t,r="en-US"){let n=e.getHours(),o=mo(r,"long"),a=mo(r,"short"),i={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MMMM:o[e.getMonth()],MMM:a[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"},s=Object.keys(i).sort((c,u)=>u.length-c.length),l=new RegExp(s.map(My).join("|"),"g");return t.replace(l,c=>i[c]??c)}function vn(e,t){return new Date(e,t+1,0).getDate()}function pu(e,t){let r=new Date(e,t,1).getDay(),n=vn(e,t),o=vn(e,t-1),a=[];for(let s=r-1;s>=0;s--)a.push({date:new Date(e,t-1,o-s),thisMonth:false});for(let s=1;s<=n;s++)a.push({date:new Date(e,t,s),thisMonth:true});let i=42-a.length;for(let s=1;s<=i;s++)a.push({date:new Date(e,t+1,s),thisMonth:false});return a}function xn(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function sl(e,t){return xn(e).getTime()===xn(t).getTime()}function mu(e,t){return xn(e)<xn(t)}function fu(e,t){return xn(e)>xn(t)}function ja(e,t,r){return t&&e<t?new Date(t):r&&e>r?new Date(r):e}function hu(e,t,r,n){let o=new Date(e),i=t*(n==="future"?1:-1);switch(r){case "day":o.setDate(o.getDate()+i);break;case "week":o.setDate(o.getDate()+i*7);break;case "month":o.setMonth(o.getMonth()+i);break;case "year":o.setFullYear(o.getFullYear()+i);break}return o}function gu(e,t=200){let r=e-Math.floor(t/2);return Array.from({length:t},(n,o)=>r+o)}function bu(e){let{value:t,defaultValue:r,onChange:n,mode:o="datetime",minDate:a,maxDate:i,use24Hour:s=true,showSeconds:l=true,locale:c="en-US",format:u,onOpen:p,onClose:m}=e,d=t!==void 0,[g,h]=useState(r??null),b=d?t??null:g,[y,v]=useState(false),[N,x]=useState(()=>b??new Date),[w,L]=useState("drum"),[P,A]=useState(()=>(b??new Date).getFullYear()),[D,S]=useState(()=>(b??new Date).getMonth()),[C,I]=useState(1),[k,M]=useState("day"),[R,$]=useState("future"),E=u??du(o,s,l),ne=b?uu(b,E,c):"",U=useCallback(()=>{let T=b??new Date;x(new Date(T)),A(T.getFullYear()),S(T.getMonth()),L("drum"),v(true),p?.();},[b,p]),z=useCallback(()=>{v(false),m?.();},[m]),H=useCallback(()=>{let T=ja(N,a,i);d||h(T),n?.(T),z();},[N,a,i,d,n,z]),_=useCallback(()=>{d||h(null),n?.(null),z();},[d,n,z]),V=useCallback((T,F)=>{x(re=>{let W=new Date(re);switch(T){case "year":W.setFullYear(F);break;case "month":{W.setMonth(F);let G=vn(W.getFullYear(),F);W.getDate()>G&&W.setDate(G);break}case "day":W.setDate(F);break;case "hour":W.setHours(F);break;case "minute":W.setMinutes(F);break;case "second":W.setSeconds(F);break}return ja(W,a,i)});},[a,i]),oe=useCallback(()=>{let T=ja(hu(new Date,C,k,R),a,i);x(T),A(T.getFullYear()),S(T.getMonth());},[C,k,R,a,i]),be=useCallback(T=>{let F=D+T,re=P;F<0&&(F=11,re--),F>11&&(F=0,re++),S(F),A(re);},[D,P]);return {isOpen:y,displayValue:ne,workingDate:N,view:w,calYear:P,calMonth:D,offsetAmount:C,offsetUnit:k,offsetDirection:R,mode:o,use24Hour:s,showSeconds:l,locale:c,minDate:a,maxDate:i,openPicker:U,closePicker:z,confirm:H,clear:_,updateField:V,setView:L,setCalYear:A,setCalMonth:S,setOffsetAmount:I,setOffsetUnit:M,setOffsetDirection:$,applyQuickOffset:oe,navigateCalendar:be}}var ho=40;function xu(e,t,r=true){let n=useRef(t);n.current=t,useEffect(()=>{if(!r)return;function o(a){let i=a.target;e.some(l=>l.current?.contains(i))||n.current();}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r]);}function wu(e,t,r){let n=useRef(false),o=useRef(void 0),a=useRef(r);a.current=r;let i=useRef(t);i.current=t;let s=useCallback((c,u="smooth")=>{let p=e.current;if(!p)return;let m=c*ho;Math.abs(p.scrollTop-m)<2&&u!=="instant"||(u==="instant"?p.scrollTop=m:p.scrollTo({top:m,behavior:u}));},[e]),l=useCallback(()=>{e.current&&(n.current=true,clearTimeout(o.current),o.current=setTimeout(()=>{n.current=false;let u=e.current;if(!u)return;let p=Math.round(u.scrollTop/ho),m=Math.max(0,Math.min(i.current-1,p)),d=m*ho;Math.abs(u.scrollTop-d)>1&&u.scrollTo({top:d,behavior:"smooth"}),a.current(m);},120));},[e]);return {scrollToIndex:s,handleScroll:l,isScrollingRef:n}}function ku(e,t,r){useEffect(()=>{if(!r)return;function n(){let a=e.current,i=t.current;if(!a||!i)return;if(window.innerWidth<=640){i.style.top="",i.style.left="";return}let s=a.getBoundingClientRect(),l=window.innerHeight,c=window.innerWidth,u=i.offsetHeight||460,p=i.offsetWidth||340,m=s.bottom+8,d=s.left;m+u>l-16&&(m=Math.max(16,s.top-u-8)),d+p>c-16&&(d=Math.max(16,c-p-16)),d<16&&(d=16),i.style.top=`${Math.round(m)}px`,i.style.left=`${Math.round(d)}px`;}let o=setTimeout(n,0);return window.addEventListener("resize",n),window.addEventListener("scroll",n,true),()=>{clearTimeout(o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,true);}},[r,e,t]);}function yr({items:e,selectedValue:t,onSelect:r,label:n}){let o=useRef(null),a=useRef(t),i=useRef(false),{scrollToIndex:s,handleScroll:l}=wu(o,e.length,c=>{let u=e[c];u&&(i.current=true,r(u.value),setTimeout(()=>{i.current=false;},200));});return useEffect(()=>{let c=o.current;if(!c)return;let u=e.findIndex(p=>p.value===t);u>=0&&(c.scrollTop=u*ho);},[]),useEffect(()=>{if(a.current!==t&&(a.current=t,!i.current)){let c=e.findIndex(u=>u.value===t);c>=0&&s(c,"smooth");}},[t,e,s]),jsxs("div",{className:"dtp-column",role:"group","aria-label":n,children:[jsx("div",{className:"dtp-column-highlight","aria-hidden":"true"}),jsx("div",{ref:o,className:"dtp-column-list",onScroll:l,role:"listbox","aria-label":n,children:e.map(c=>jsx("div",{className:f("dtp-item",c.value===t&&"dtp-item--selected"),onClick:()=>{let u=e.findIndex(p=>p.value===c.value);u>=0&&s(u,"smooth"),r(c.value);},role:"option","aria-selected":c.value===t,children:c.label},c.value))}),jsx("div",{className:"dtp-fade-top","aria-hidden":"true"}),jsx("div",{className:"dtp-fade-bottom","aria-hidden":"true"})]})}function Dy({year:e,month:t,selectedDate:r,today:n,minDate:o,maxDate:a,locale:i,onSelectDay:s,onPrev:l,onNext:c}){let u=cu(i,"narrow"),p=mo(i,"long"),m=pu(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:l,"aria-label":"Previous month",children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsxs("span",{className:"dtp-cal-title",children:[p[t]," ",e]}),jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:c,"aria-label":"Next month",children:jsx(ChevronRight,{className:"h-4 w-4"})})]}),jsx("div",{className:"dtp-cal-weekdays",role:"row",children:u.map((d,g)=>jsx("div",{className:"dtp-cal-weekday",role:"columnheader","aria-label":d,children:d},g))}),jsx("div",{className:"dtp-cal-days",role:"grid",children:m.map(({date:d,thisMonth:g},h)=>{let b=sl(d,r),y=sl(d,n),v=o!=null&&mu(d,o)||a!=null&&fu(d,a);return jsx("button",{type:"button",role:"gridcell",className:f("dtp-cal-day",!g&&"dtp-cal-day--other",b&&"dtp-cal-day--selected",y&&!b&&"dtp-cal-day--today",v&&"dtp-cal-day--disabled"),onClick:()=>!v&&s(d),disabled:v,"aria-current":y?"date":void 0,"aria-selected":b,"aria-disabled":v,children:d.getDate()},h)})})]})}function Ay({amount:e,unit:t,direction:r,onAmountChange:n,onUnitChange:o,onDirectionChange:a,onApply:i,locale:s}){let l=s.startsWith("zh"),c=[{value:"day",label:l?"\u5929":"Day"},{value:"week",label:l?"\u5468":"Week"},{value:"month",label:l?"\u6708":"Month"},{value:"year",label:l?"\u5E74":"Year"}],u=[{value:"future",label:l?"\u4EE5\u540E":"from now"},{value:"past",label:l?"\u4EE5\u524D":"before now"}];return jsxs("div",{className:"dtp-quick-offset","aria-label":l?"\u5FEB\u901F\u504F\u79FB":"Quick offset",children:[jsx("input",{type:"number",className:"dtp-offset-input",value:e,min:1,max:9999,"aria-label":l?"\u504F\u79FB\u6570\u91CF":"Offset amount",onChange:p=>{let m=parseInt(p.target.value,10);!isNaN(m)&&m>=1&&n(m);}}),jsx("select",{className:"dtp-offset-select",value:t,"aria-label":l?"\u504F\u79FB\u5355\u4F4D":"Offset unit",onChange:p=>o(p.target.value),children:c.map(p=>jsx("option",{value:p.value,children:p.label},p.value))}),jsx("select",{className:"dtp-offset-select",value:r,"aria-label":l?"\u504F\u79FB\u65B9\u5411":"Offset direction",onChange:p=>a(p.target.value),children:u.map(p=>jsx("option",{value:p.value,children:p.label},p.value))}),jsx("button",{type:"button",className:"dtp-offset-apply",onClick:i,children:l?"\u5E94\u7528":"Apply"})]})}function Wa({className:e,popupClassName:t,triggerClassName:r,disabled:n=false,placeholder:o,...a}){let{isOpen:i,displayValue:s,workingDate:l,view:c,calYear:u,calMonth:p,offsetAmount:m,offsetUnit:d,offsetDirection:g,mode:h,use24Hour:b,showSeconds:y,locale:v,minDate:N,maxDate:x,openPicker:w,closePicker:L,confirm:P,clear:A,updateField:D,setView:S,setCalYear:C,setCalMonth:I,setOffsetAmount:k,setOffsetUnit:M,setOffsetDirection:R,applyQuickOffset:$,navigateCalendar:E}=bu({...a}),ne=useRef(null),U=useRef(null),z=new Date;xu([ne,U],L,i),ku(ne,U,i);let H=v.startsWith("zh"),_={cancel:H?"\u53D6\u6D88":"Cancel",confirm:H?"\u786E\u5B9A":"Confirm",calendarView:H?"\u65E5\u5386":"Calendar",scrollView:H?"\u6EDA\u8F6E":"Scroll",placeholder:o??(H?"\u9009\u62E9\u65E5\u671F\u65F6\u95F4":"Select date / time")},V=h==="date"||h==="datetime",oe=h==="time"||h==="datetime",be=gu(l.getFullYear(),200).map(te=>({label:String(te),value:te})),T=mo(v,"short").map((te,ve)=>({label:te,value:ve})),F=vn(l.getFullYear(),l.getMonth()),re=Array.from({length:F},(te,ve)=>({label:String(ve+1).padStart(2,"0"),value:ve+1})),W=Array.from({length:24},(te,ve)=>({label:String(ve).padStart(2,"0"),value:ve})),G=Array.from({length:12},(te,ve)=>({label:String(ve===0?12:ve).padStart(2,"0"),value:ve})),le=[{label:"AM",value:0},{label:"PM",value:1}],ke=Array.from({length:60},(te,ve)=>({label:String(ve).padStart(2,"0"),value:ve})),B=l.getHours(),q=B%12,Z=B<12?0:1,ue=oe&&!V?Clock:Calendar;return jsxs("div",{className:f("dtp-root",e),children:[jsxs("div",{className:"dtp-trigger-wrap",children:[jsxs("button",{ref:ne,type:"button",className:f("dtp-trigger",s&&"dtp-trigger--has-clear",n&&"dtp-trigger--disabled",r),onClick:()=>!n&&(i?L():w()),disabled:n,"aria-haspopup":"dialog","aria-expanded":i,children:[jsx(ue,{className:"dtp-trigger-icon","aria-hidden":"true"}),jsx("span",{className:f("dtp-trigger-text",!s&&"dtp-trigger-placeholder"),children:s||_.placeholder})]}),s&&jsx("button",{type:"button",className:"dtp-trigger-clear","aria-label":H?"\u6E05\u9664":"Clear value",onClick:()=>!n&&A(),children:jsx(X,{className:"h-3.5 w-3.5"})})]}),i&&createPortal(jsxs("div",{ref:U,className:f("dtp-panel",t),role:"dialog","aria-modal":"true","aria-label":H?"\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:s||_.placeholder}),jsx("div",{className:"dtp-panel-actions",children:V&&jsx("button",{type:"button",className:f("dtp-view-btn",c==="calendar"&&"dtp-view-btn--active"),"aria-pressed":c==="calendar",title:c==="calendar"?_.scrollView:_.calendarView,onClick:()=>{c!=="calendar"&&(C(l.getFullYear()),I(l.getMonth())),S(c==="calendar"?"drum":"calendar");},children:jsx(Calendar,{className:"h-4 w-4"})})})]}),jsx("div",{className:"dtp-panel-body",children:c==="drum"?jsxs("div",{className:"dtp-drum",children:[V&&jsxs("div",{className:"dtp-drum-date",children:[jsx(yr,{label:H?"\u5E74":"Year",items:be,selectedValue:l.getFullYear(),onSelect:te=>D("year",te)}),jsx(yr,{label:H?"\u6708":"Month",items:T,selectedValue:l.getMonth(),onSelect:te=>D("month",te)}),jsx(yr,{label:H?"\u65E5":"Day",items:re,selectedValue:l.getDate(),onSelect:te=>D("day",te)})]}),V&&oe&&jsx("div",{className:"dtp-drum-sep","aria-hidden":"true"}),oe&&jsxs("div",{className:"dtp-drum-time",children:[b?jsx(yr,{label:H?"\u65F6":"Hour",items:W,selectedValue:B,onSelect:te=>D("hour",te)}):jsxs(Fragment,{children:[jsx(yr,{label:H?"\u65F6":"Hour",items:G,selectedValue:q,onSelect:te=>{D("hour",Z===1?te+12:te);}}),jsx(yr,{label:"AM/PM",items:le,selectedValue:Z,onSelect:te=>{D("hour",q+(te===1?12:0));}})]}),jsx(yr,{label:H?"\u5206":"Min",items:ke,selectedValue:l.getMinutes(),onSelect:te=>D("minute",te)}),y&&jsx(yr,{label:H?"\u79D2":"Sec",items:ke,selectedValue:l.getSeconds(),onSelect:te=>D("second",te)})]})]}):jsx(Dy,{year:u,month:p,selectedDate:l,today:z,minDate:N,maxDate:x,locale:v,onSelectDay:te=>{D("year",te.getFullYear()),D("month",te.getMonth()),D("day",te.getDate()),S("drum");},onPrev:()=>E(-1),onNext:()=>E(1)})}),V&&jsx("div",{className:"dtp-panel-offset",children:jsx(Ay,{amount:m,unit:d,direction:g,onAmountChange:k,onUnitChange:M,onDirectionChange:R,onApply:$,locale:v})}),jsxs("div",{className:"dtp-panel-footer",children:[jsx("button",{type:"button",className:"dtp-btn-cancel",onClick:L,children:_.cancel}),jsx("button",{type:"button",className:"dtp-btn-confirm",onClick:P,children:_.confirm})]})]}),document.body)]})}var Ua=cva("w-full rounded-md font-mono text-center transition-all focus:outline-none focus:ring-2 disabled:pointer-events-none disabled:opacity-50",{variants:{size:{sm:"h-9 w-9 text-sm",md:"h-12 w-12 text-base",lg:"h-14 w-14 text-lg"},variant:{outline:"border border-secondary-300 bg-transparent focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600 dark:bg-transparent dark:focus:border-primary-400",filled:"border border-transparent bg-secondary-100 focus:border-primary-500 focus:ring-primary-500/20 dark:bg-secondary-800 dark:focus:border-primary-400",underline:"rounded-none border-0 border-b-2 border-secondary-300 bg-transparent px-0 focus:border-primary-500 focus:ring-0 dark:border-secondary-600 dark:focus:border-primary-400"},invalid:{true:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20",false:""}},defaultVariants:{size:"md",variant:"outline",invalid:false}}),ll=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 cl=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"}});function wn({length:e=6,value:t,defaultValue:r="",onChange:n,onComplete:o,size:a="md",variant:i="outline",disabled:s=false,readOnly:l=false,autoFocus:c=false,alphanumeric:u=false,mask:p=false,invalid:m=false,className:d}){let g=t!==void 0,[h,b]=useState(()=>{let S=(r??"").slice(0,e);return Array.from({length:e},(C,I)=>S[I]??"")}),y=g?Array.from({length:e},(S,C)=>(t??"")[C]??""):h,v=useRef([]),N=useRef([]);useEffect(()=>{c&&v.current[0]&&v.current[0].focus();},[c]);let x=useCallback(S=>{g||b(S);let C=S.join("");n?.(C),S.every(I=>I!=="")&&S.length===e&&o?.(C);},[g,n,o,e]),w=S=>{let C=v.current[S];C&&(C.classList.remove("otp-pop"),clearTimeout(N.current[S]),C.offsetWidth,C.classList.add("otp-pop"),N.current[S]=window.setTimeout(()=>C.classList.remove("otp-pop"),200));},L=useCallback((S,C)=>{let I=u?/[a-zA-Z0-9]/g:/[0-9]/g,k=C.match(I)??[];if(k.length===0)return;let M=k[k.length-1],R=[...y];R[S]=M,x(R),w(S),S<e-1&&v.current[S+1]?.focus();},[y,e,u,x]),P=useCallback((S,C)=>{if(C.key==="Backspace"){if(C.preventDefault(),y[S]){let I=[...y];I[S]="",x(I);}else if(S>0){v.current[S-1]?.focus();let I=[...y];I[S-1]="",x(I);}}else if(C.key==="ArrowLeft")C.preventDefault(),S>0&&v.current[S-1]?.focus();else if(C.key==="ArrowRight")C.preventDefault(),S<e-1&&v.current[S+1]?.focus();else if(C.key==="Delete"){C.preventDefault();let I=[...y];I[S]="",x(I);}},[y,e,x]),A=useCallback((S,C)=>{C.preventDefault();let I=C.clipboardData.getData("text"),k=u?/[a-zA-Z0-9]/g:/[0-9]/g,M=I.match(k)??[],R=[...y],$=S;for(let U=0;U<M.length&&S+U<e;U++)R[S+U]=M[U],$=S+U;x(R);let E=R.findIndex((U,z)=>z>$&&U===""),ne=E!==-1?E:Math.min($+1,e-1);v.current[ne]?.focus();},[y,e,u,x]),D=useCallback(S=>{S.target.select();},[]);return jsx("div",{role:"group","aria-label":"OTP Input",className:f("inline-flex gap-2",d),children:Array.from({length:e},(S,C)=>jsx("input",{ref:I=>{v.current[C]=I;},type:p?"password":"text",inputMode:u?"text":"numeric",pattern:u?"[a-zA-Z0-9]":"[0-9]",maxLength:2,value:y[C],disabled:s,readOnly:l,autoComplete:"one-time-code","aria-label":`Digit ${C+1} of ${e}`,className:f(Ua({size:a,variant:i,invalid:m||void 0}),"text-secondary-900 dark:text-secondary-100"),onChange:I=>L(C,I.target.value),onKeyDown:I=>P(C,I),onPaste:I=>A(C,I),onFocus:D},C))})}var _y={login:"Welcome back",register:"Create account",otp:"Verify your identity",forgot:"Reset password"},Fy={login:"Sign in to your account to continue",register:"Fill in the details to get started",otp:"Enter the 6-digit code sent to your email",forgot:"We'll send a reset link to your email"};function Ga({mode:e,onModeChange:t,onLogin:r,onRegister:n,onOTPComplete:o,onForgotPassword:a,logo:i,title:s,subtitle:l,socialLogins:c,showRememberMe:u=true,isLoading:p=false,error:m,className:d,style:g}){let[h,b]=useState("login"),y=e!==void 0,v=y?e:h,N=useCallback(V=>{y||b(V),t?.(V);},[y,t]),[x,w]=useState(""),[L,P]=useState(""),[A,D]=useState(false),[S,C]=useState(""),[I,k]=useState(""),[M,R]=useState(""),[$,E]=useState(""),ne=useCallback(async V=>{V.preventDefault(),await r?.(x,L,A);},[x,L,A,r]),U=useCallback(async V=>{V.preventDefault(),await n?.(S,I,M);},[S,I,M,n]),z=useCallback(async V=>{V.preventDefault(),await a?.($);},[$,a]),H=s??_y[v],_=l??Fy[v];return jsxs("div",{className:f("w-full max-w-sm rounded-2xl border border-primary-200 bg-white/90 p-8 shadow-xl backdrop-blur-md","dark:border-primary-700 dark:bg-primary-900/90",d),style:g,children:[i&&jsx("div",{className:"mb-6 flex justify-center",children:i}),jsxs("div",{className:"mb-6 text-center",children:[jsx("h2",{className:"text-xl font-bold text-primary-900 dark:text-primary-50",children:H}),jsx("p",{className:"mt-1 text-sm text-secondary-500 dark:text-secondary-400",children:_})]}),c&&c.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"mb-4 flex flex-col gap-2",children:c.map((V,oe)=>jsxs("button",{type:"button",onClick:V.onClick,disabled:p,className:f("flex w-full items-center justify-center gap-2 rounded-lg border border-secondary-300 px-4 py-2 text-sm font-medium","text-secondary-700 transition-colors hover:bg-secondary-50","dark:border-secondary-600 dark:text-secondary-300 dark:hover:bg-secondary-800","disabled:opacity-50 disabled:cursor-not-allowed","[&_svg]:h-4 [&_svg]:w-4"),children:[V.icon,V.label]},oe))}),jsxs("div",{className:"relative mb-4 flex items-center",children:[jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"}),jsx("span",{className:"mx-3 text-xs text-secondary-400 dark:text-secondary-500",children:"or continue with"}),jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"})]})]}),jsxs("div",{className:"login-panel-slide-enter",children:[v==="login"&&jsxs("form",{onSubmit:ne,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-email",children:"Email"}),jsx(Ft,{id:"lp-email",type:"email",placeholder:"you@example.com",value:x,onChange:V=>w(V.target.value),disabled:p,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-password",children:"Password"}),jsx(Ft,{id:"lp-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:L,onChange:V=>P(V.target.value),disabled:p,required:true})]}),u&&jsxs("div",{className:"flex items-center justify-between",children:[jsx(An,{checked:A,onCheckedChange:V=>D(!!V),label:"Remember me",disabled:p}),jsx("button",{type:"button",className:"text-xs text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("forgot"),children:"Forgot password?"})]}),m&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):jsxs(Fragment,{children:["Sign in"," ",jsx(en,{className:"ml-1 opacity-60",children:jsx(Zr,{size:"xs",children:"\u23CE"})})]})}),jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Don't have an account?"," ",jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("register"),children:"Register"})]})]}),v==="register"&&jsxs("form",{onSubmit:U,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-name",children:"Full name"}),jsx(Ft,{id:"lp-name",type:"text",placeholder:"Jane Doe",value:S,onChange:V=>C(V.target.value),disabled:p,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-reg-email",children:"Email"}),jsx(Ft,{id:"lp-reg-email",type:"email",placeholder:"you@example.com",value:I,onChange:V=>k(V.target.value),disabled:p,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-reg-password",children:"Password"}),jsx(Ft,{id:"lp-reg-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:M,onChange:V=>R(V.target.value),disabled:p,required:true})]}),m&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Create account"}),jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Already have an account?"," ",jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"Sign in"})]})]}),v==="otp"&&jsxs("div",{className:"space-y-6",children:[jsx("div",{className:"flex justify-center",children:jsx(wn,{length:6,size:"md",onComplete:async V=>{await o?.(V);},autoFocus:true})}),m&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-center text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"\u2190 Back to login"})})]}),v==="forgot"&&jsxs("form",{onSubmit:z,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(_t,{htmlFor:"lp-forgot-email",children:"Email address"}),jsx(Ft,{id:"lp-forgot-email",type:"email",placeholder:"you@example.com",value:$,onChange:V=>E(V.target.value),disabled:p,required:true})]}),m&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Send reset link"}),jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"\u2190 Back to login"})})]})]},v)]})}var By=Object.defineProperty,bl=(e,t)=>{for(var r in t)By(e,r,{get:t[r],enumerable:true});};function oi(e){let{state:t,transaction:r}=e,{selection:n}=r,{doc:o}=r,{storedMarks:a}=r;return {...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return n},get doc(){return o},get tr(){return n=r.selection,o=r.doc,a=r.storedMarks,r}}}var yl=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state;}get hasCustomState(){return !!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:r}=this,{view:n}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([i,s])=>[i,(...c)=>{let u=s(...c)(a);return !o.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(o),u}]))}get chain(){return ()=>this.createChain()}get can(){return ()=>this.createCan()}createChain(e,t=true){let{rawCommands:r,editor:n,state:o}=this,{view:a}=n,i=[],s=!!e,l=e||o.tr,c=()=>(!s&&t&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(l),i.every(p=>p===true)),u={...Object.fromEntries(Object.entries(r).map(([p,m])=>[p,(...g)=>{let h=this.buildProps(l,t),b=m(...g)(h);return i.push(b),u}])),run:c};return u}createCan(e){let{rawCommands:t,state:r}=this,n=false,o=e||r.tr,a=this.buildProps(o,n);return {...Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...c)=>l(...c)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,n)}}buildProps(e,t=true){let{rawCommands:r,editor:n,state:o}=this,{view:a}=n,i={tr:e,editor:n,view:a,state:oi({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([s,l])=>[s,(...c)=>l(...c)(i)]))}};return i}},Ou={};bl(Ou,{blur:()=>$y,clearContent:()=>Oy,clearNodes:()=>jy,command:()=>Wy,createParagraphNear:()=>Uy,cut:()=>Gy,deleteCurrentNode:()=>qy,deleteNode:()=>Jy,deleteRange:()=>Qy,deleteSelection:()=>ev,enter:()=>tv,exitCode:()=>nv,extendMarkRange:()=>av,first:()=>iv,focus:()=>dv,forEach:()=>uv,insertContent:()=>pv,insertContentAt:()=>wv,joinBackward:()=>Pv,joinDown:()=>Sv,joinForward:()=>Rv,joinItemBackward:()=>Lv,joinItemForward:()=>Av,joinTextblockBackward:()=>zv,joinTextblockForward:()=>Hv,joinUp:()=>Mv,keyboardShortcut:()=>Fv,lift:()=>$v,liftEmptyBlock:()=>Kv,liftListItem:()=>Wv,newlineInCode:()=>Uv,resetAttributes:()=>Xv,scrollIntoView:()=>Gv,selectAll:()=>Jv,selectNodeBackward:()=>Zv,selectNodeForward:()=>tx,selectParentNode:()=>nx,selectTextblockEnd:()=>ax,selectTextblockStart:()=>sx,setContent:()=>cx,setMark:()=>Lx,setMeta:()=>Dx,setNode:()=>Ax,setNodeSelection:()=>zx,setTextDirection:()=>Vx,setTextSelection:()=>Hx,sinkListItem:()=>Fx,splitBlock:()=>Ox,splitListItem:()=>Yx,toggleList:()=>Ux,toggleMark:()=>Xx,toggleNode:()=>Gx,toggleWrap:()=>qx,undoInputRule:()=>Jx,unsetAllMarks:()=>Qx,unsetMark:()=>Zx,unsetTextDirection:()=>ew,updateAttributes:()=>tw,wrapIn:()=>nw,wrapInList:()=>aw});var $y=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var r;e.isDestroyed||(t.dom.blur(),(r=window?.getSelection())==null||r.removeAllRanges());}),true),Oy=(e=true)=>({commands:t})=>t.setContent("",{emitUpdate:e}),jy=()=>({state:e,tr:t,dispatch:r})=>{let{selection:n}=t,{ranges:o}=n;return r&&o.forEach(({$from:a,$to:i})=>{e.doc.nodesBetween(a.pos,i.pos,(s,l)=>{if(s.type.isText)return;let{doc:c,mapping:u}=t,p=c.resolve(u.map(l)),m=c.resolve(u.map(l+s.nodeSize)),d=p.blockRange(m);if(!d)return;let g=liftTarget(d);if(s.type.isTextblock){let{defaultType:h}=p.parent.contentMatchAt(p.index());t.setNodeMarkup(d.start,h);}(g||g===0)&&t.lift(d,g);});}),true},Wy=e=>t=>e(t),Uy=()=>({state:e,dispatch:t})=>createParagraphNear(e,t),Gy=(e,t)=>({editor:r,tr:n})=>{let{state:o}=r,a=o.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);let i=n.mapping.map(t);return n.insert(i,a.content),n.setSelection(new TextSelection(n.doc.resolve(Math.max(i-1,0)))),true},qy=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return false;let o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===n.type){if(t){let s=o.before(a),l=o.after(a);e.delete(s,l).scrollIntoView();}return true}return false};function nt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Jy=e=>({tr:t,state:r,dispatch:n})=>{let o=nt(e,r.schema),a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===o){if(n){let l=a.before(i),c=a.after(i);t.delete(l,c).scrollIntoView();}return true}return false},Qy=e=>({tr:t,dispatch:r})=>{let{from:n,to:o}=e;return r&&t.delete(n,o),true},ev=()=>({state:e,dispatch:t})=>deleteSelection(e,t),tv=()=>({commands:e})=>e.keyboardShortcut("Enter"),nv=()=>({state:e,dispatch:t})=>exitCode(e,t);function vl(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function ti(e,t,r={strict:true}){let n=Object.keys(t);return n.length?n.every(o=>r.strict?t[o]===e[o]:vl(t[o])?t[o].test(e[o]):t[o]===e[o]):true}function Ku(e,t,r={}){return e.find(n=>n.type===t&&ti(Object.fromEntries(Object.keys(r).map(o=>[o,n.attrs[o]])),r))}function Pu(e,t,r={}){return !!Ku(e,t,r)}function ju(e,t,r){var n;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===t))&&(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===t)||(r=r||((n=o.node.marks[0])==null?void 0:n.attrs),!Ku([...o.node.marks],t,r)))return;let i=o.index,s=e.start()+o.offset,l=i+1,c=s+o.node.nodeSize;for(;i>0&&Pu([...e.parent.child(i-1).marks],t,r);)i-=1,s-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&Pu([...e.parent.child(l).marks],t,r);)c+=e.parent.child(l).nodeSize,l+=1;return {from:s,to:c}}function rr(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var av=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let a=rr(e,n.schema),{doc:i,selection:s}=r,{$from:l,from:c,to:u}=s;if(o){let p=ju(l,a,t);if(p&&p.from<=c&&p.to>=u){let m=TextSelection.create(i,p.from,p.to);r.setSelection(m);}}return true},iv=e=>t=>{let r=typeof e=="function"?e(t):e;for(let n=0;n<r.length;n+=1)if(r[n](t))return true;return false};function Wu(e){return e instanceof TextSelection}function Kr(e=0,t=0,r=0){return Math.min(Math.max(e,t),r)}function lv(e,t=null){if(!t)return null;let r=Selection.atStart(e),n=Selection.atEnd(e);if(t==="start"||t===true)return r;if(t==="end")return n;let o=r.from,a=n.to;return t==="all"?TextSelection.create(e,Kr(0,o,a),Kr(e.content.size,o,a)):TextSelection.create(e,Kr(t,o,a),Kr(t,o,a))}function Lu(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ri(){return ["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function cv(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):false}var dv=(e=null,t={})=>({editor:r,view:n,tr:o,dispatch:a})=>{t={scrollIntoView:true,...t};let i=()=>{(ri()||Lu())&&n.dom.focus(),cv()&&!ri()&&!Lu()&&n.dom.focus({preventScroll:true}),requestAnimationFrame(()=>{r.isDestroyed||(n.focus(),t?.scrollIntoView&&r.commands.scrollIntoView());});};try{if(n.hasFocus()&&e===null||e===!1)return !0}catch{return false}if(a&&e===null&&!Wu(r.state.selection))return i(),true;let s=lv(o.doc,e)||r.state.selection,l=r.state.selection.eq(s);return a&&(l||o.setSelection(s),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),true},uv=(e,t)=>r=>e.every((n,o)=>t(n,{...r,index:o})),pv=(e,t)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,t),Yu=e=>{let t=e.childNodes;for(let r=t.length-1;r>=0;r-=1){let n=t[r];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):n.nodeType===1&&Yu(n);}return e};function qa(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`,r=new window.DOMParser().parseFromString(t,"text/html").body;return Yu(r)}function xo(e,t,r){if(e instanceof Node||e instanceof Fragment$1)return e;r={slice:true,parseOptions:{},...r};let n=typeof e=="object"&&e!==null,o=typeof e=="string";if(n)try{if(Array.isArray(e)&&e.length>0)return Fragment$1.fromArray(e.map(s=>t.nodeFromJSON(s)));let i=t.nodeFromJSON(e);return r.errorOnInvalidContent&&i.check(),i}catch(a){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",a),xo("",t,r)}if(o){if(r.errorOnInvalidContent){let i=false,s="",l=new Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=true,s=typeof c=="string"?c:c.outerHTML,null)}]}})});if(r.slice?DOMParser.fromSchema(l).parseSlice(qa(e),r.parseOptions):DOMParser.fromSchema(l).parse(qa(e),r.parseOptions),r.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}let a=DOMParser.fromSchema(t);return r.slice?a.parseSlice(qa(e),r.parseOptions).content:a.parse(qa(e),r.parseOptions)}return xo("",t,r)}function vv(e,t,r){let n=e.steps.length-1;if(n<t)return;let o=e.steps[n];if(!(o instanceof ReplaceStep||o instanceof ReplaceAroundStep))return;let a=e.mapping.maps[n],i=0;a.forEach((s,l,c,u)=>{i===0&&(i=u);}),e.setSelection(Selection.near(e.doc.resolve(i),r));}var xv=e=>!("type"in e),wv=(e,t,r)=>({tr:n,dispatch:o,editor:a})=>{var i;if(o){r={parseOptions:a.options.parseOptions,updateSelection:true,applyInputRules:false,applyPasteRules:false,...r};let s,l=b=>{a.emit("contentError",{editor:a,error:b,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=true);}});},c={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{xo(t,a.schema,{parseOptions:c,errorOnInvalidContent:!0});}catch(b){l(b);}try{s=xo(t,a.schema,{parseOptions:c,errorOnInvalidContent:(i=r.errorOnInvalidContent)!=null?i:a.options.enableContentCheck});}catch(b){return l(b),false}let{from:u,to:p}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},m=true,d=true;if((xv(s)?s:[s]).forEach(b=>{b.check(),m=m?b.isText&&b.marks.length===0:false,d=d?b.isBlock:false;}),u===p&&d){let{parent:b}=n.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,p+=1);}let h;if(m){if(Array.isArray(t))h=t.map(b=>b.text||"").join("");else if(t instanceof Fragment$1){let b="";t.forEach(y=>{y.text&&(b+=y.text);}),h=b;}else typeof t=="object"&&t&&t.text?h=t.text:h=t;n.insertText(h,u,p);}else {h=s;let b=n.doc.resolve(u),y=b.node(),v=b.parentOffset===0,N=y.isText||y.isTextblock,x=y.content.size>0;v&&N&&x&&(u=Math.max(0,u-1)),n.replaceWith(u,p,h);}r.updateSelection&&vv(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:u,text:h}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:u,text:h});}return true},Mv=()=>({state:e,dispatch:t})=>joinUp(e,t),Sv=()=>({state:e,dispatch:t})=>joinDown(e,t),Pv=()=>({state:e,dispatch:t})=>joinBackward(e,t),Rv=()=>({state:e,dispatch:t})=>joinForward(e,t),Lv=()=>({state:e,dispatch:t,tr:r})=>{try{let n=joinPoint(e.doc,e.selection.$from.pos,-1);return n==null?!1:(r.join(n,2),t&&t(r),!0)}catch{return false}},Av=()=>({state:e,dispatch:t,tr:r})=>{try{let n=joinPoint(e.doc,e.selection.$from.pos,1);return n==null?!1:(r.join(n,2),t&&t(r),!0)}catch{return false}},zv=()=>({state:e,dispatch:t})=>joinTextblockBackward(e,t),Hv=()=>({state:e,dispatch:t})=>joinTextblockForward(e,t);function Uu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):false}function _v(e){let t=e.split(/-(?!$)/),r=t[t.length-1];r==="Space"&&(r=" ");let n,o,a,i;for(let s=0;s<t.length-1;s+=1){let l=t[s];if(/^(cmd|meta|m)$/i.test(l))i=true;else if(/^a(lt)?$/i.test(l))n=true;else if(/^(c|ctrl|control)$/i.test(l))o=true;else if(/^s(hift)?$/i.test(l))a=true;else if(/^mod$/i.test(l))ri()||Uu()?i=true:o=true;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(r=`Alt-${r}`),o&&(r=`Ctrl-${r}`),i&&(r=`Meta-${r}`),a&&(r=`Shift-${r}`),r}var Fv=e=>({editor:t,view:r,tr:n,dispatch:o})=>{let a=_v(e).split(/-(?!$)/),i=a.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),s=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:true,cancelable:true}),l=t.captureTransaction(()=>{r.someProp("handleKeyDown",c=>c(r,s));});return l?.steps.forEach(c=>{let u=c.map(n.mapping);u&&o&&n.maybeStep(u);}),true};function xl(e,t,r={}){let{from:n,to:o,empty:a}=e.selection,i=t?nt(t,e.schema):null,s=[];e.doc.nodesBetween(n,o,(p,m)=>{if(p.isText)return;let d=Math.max(n,m),g=Math.min(o,m+p.nodeSize);s.push({node:p,from:d,to:g});});let l=o-n,c=s.filter(p=>i?i.name===p.node.type.name:true).filter(p=>ti(p.node.attrs,r,{strict:false}));return a?!!c.length:c.reduce((p,m)=>p+m.to-m.from,0)>=l}var $v=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return xl(r,o,t)?lift(r,n):false},Kv=()=>({state:e,dispatch:t})=>liftEmptyBlock(e,t),Wv=e=>({state:t,dispatch:r})=>{let n=nt(e,t.schema);return liftListItem(n)(t,r)},Uv=()=>({state:e,dispatch:t})=>newlineInCode(e,t);function Xu(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Au(e,t){let r=typeof t=="string"?[t]:t;return Object.keys(e).reduce((n,o)=>(r.includes(o)||(n[o]=e[o]),n),{})}var Xv=(e,t)=>({tr:r,state:n,dispatch:o})=>{let a=null,i=null,s=Xu(typeof e=="string"?e:e.name,n.schema);if(!s)return false;s==="node"&&(a=nt(e,n.schema)),s==="mark"&&(i=rr(e,n.schema));let l=false;return r.selection.ranges.forEach(c=>{n.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,p)=>{a&&a===u.type&&(l=true,o&&r.setNodeMarkup(p,void 0,Au(u.attrs,t))),i&&u.marks.length&&u.marks.forEach(m=>{i===m.type&&(l=true,o&&r.addMark(p,p+u.nodeSize,i.create(Au(m.attrs,t))));});});}),l},Gv=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),true),Jv=()=>({tr:e,dispatch:t})=>{if(t){let r=new AllSelection(e.doc);e.setSelection(r);}return true},Zv=()=>({state:e,dispatch:t})=>selectNodeBackward(e,t),tx=()=>({state:e,dispatch:t})=>selectNodeForward(e,t),nx=()=>({state:e,dispatch:t})=>selectParentNode(e,t),ax=()=>({state:e,dispatch:t})=>selectTextblockEnd(e,t),sx=()=>({state:e,dispatch:t})=>selectTextblockStart(e,t);function lx(e,t,r={},n={}){return xo(e,t,{slice:false,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}var cx=(e,{errorOnInvalidContent:t,emitUpdate:r=true,parseOptions:n={}}={})=>({editor:o,tr:a,dispatch:i,commands:s})=>{let{doc:l}=a;if(n.preserveWhitespace!=="full"){let c=lx(e,o.schema,n,{errorOnInvalidContent:t??o.options.enableContentCheck});return i&&a.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!r),true}return i&&a.setMeta("preventUpdate",!r),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:n,errorOnInvalidContent:t??o.options.enableContentCheck})};function dx(e,t){let r=rr(t,e.schema),{from:n,to:o,empty:a}=e.selection,i=[];a?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,o,l=>{i.push(...l.marks);});let s=i.find(l=>l.type.name===r.name);return s?{...s.attrs}:{}}function px(e,t){let r=new Transform(e);return t.forEach(n=>{n.steps.forEach(o=>{r.step(o);});}),r}function mx(e){for(let t=0;t<e.edgeCount;t+=1){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function fx(e,t){for(let r=e.depth;r>0;r-=1){let n=e.node(r);if(t(n))return {pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}function wl(e){return t=>fx(t.$from,e)}function ye(e,t,r){return e.config[t]===void 0&&e.parent?ye(e.parent,t,r):typeof e.config[t]=="function"?e.config[t].bind({...r,parent:e.parent?ye(e.parent,t,r):null}):e.config[t]}function bx(e){return typeof e=="function"}function je(e,t=void 0,...r){return bx(e)?t?e.bind(t)(...r):e(...r):e}function kn(e){let t=e.filter(o=>o.type==="extension"),r=e.filter(o=>o.type==="node"),n=e.filter(o=>o.type==="mark");return {baseExtensions:t,nodeExtensions:r,markExtensions:n}}function vx(e){let t=[],r="",n=false,o=false,a=0,i=e.length;for(let s=0;s<i;s+=1){let l=e[s];if(l==="'"&&!o){n=!n,r+=l;continue}if(l==='"'&&!n){o=!o,r+=l;continue}if(!n&&!o){if(l==="("){a+=1,r+=l;continue}if(l===")"&&a>0){a-=1,r+=l;continue}if(l===";"&&a===0){t.push(r),r="";continue}}r+=l;}return r&&t.push(r),t}function Iu(e){let t=[],r=vx(e||""),n=r.length;for(let o=0;o<n;o+=1){let a=r[o],i=a.indexOf(":");if(i===-1)continue;let s=a.slice(0,i).trim(),l=a.slice(i+1).trim();s&&l&&t.push([s,l]);}return t}function Nn(...e){return e.filter(t=>!!t).reduce((t,r)=>{let n={...t};return Object.entries(r).forEach(([o,a])=>{if(!n[o]){n[o]=a;return}if(o==="class"){let s=a?String(a).split(" "):[],l=n[o]?n[o].split(" "):[],c=s.filter(u=>!l.includes(u));n[o]=[...l,...c].join(" ");}else if(o==="style"){let s=new Map([...Iu(n[o]),...Iu(a)]);n[o]=Array.from(s.entries()).map(([l,c])=>`${l}: ${c}`).join("; ");}else n[o]=a;}),n},{})}function Nx(e,t,r){let{from:n,to:o}=t,{blockSeparator:a=`
|
|
85
85
|
|
|
86
|
-
`,textSerializers:i={}}=r||{},s="";return e.nodesBetween(n,o,(l,c,u,p)=>{var m;l.isBlock&&c>n&&(s+=a);let d=i?.[l.type.name];if(d)return u&&(s+=d({node:l,pos:c,parent:u,index:p,range:t})),false;l.isText&&(s+=(m=l?.text)==null?void 0:m.slice(Math.max(n,c)-c,o-c));}),s}function wx(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,r])=>[t,r.spec.toText]))}function kx(e,t=JSON.stringify){let r={};return e.filter(n=>{let o=t(n);return Object.prototype.hasOwnProperty.call(r,o)?false:r[o]=true})}function Nx(e){let t=kx(e);return t.length===1?t:t.filter((r,n)=>!t.filter((a,i)=>i!==n).some(a=>r.oldRange.from>=a.oldRange.from&&r.oldRange.to<=a.oldRange.to&&r.newRange.from>=a.newRange.from&&r.newRange.to<=a.newRange.to))}function Cx(e){let{mapping:t,steps:r}=e,n=[];return t.maps.forEach((o,a)=>{let i=[];if(o.ranges.length)o.forEach((s,l)=>{i.push({from:s,to:l});});else {let{from:s,to:l}=r[a];if(s===void 0||l===void 0)return;i.push({from:s,to:l});}i.forEach(({from:s,to:l})=>{let c=t.slice(a).map(s,-1),u=t.slice(a).map(l),p=t.invert().map(c,-1),m=t.invert().map(u);n.push({oldRange:{from:p,to:m},newRange:{from:c,to:u}});});}),Nx(n)}function ei(e,t,r){return Object.fromEntries(Object.entries(r).filter(([n])=>{let o=e.find(a=>a.type===t&&a.name===n);return o?o.attribute.keepOnSplit:false}))}function Tx(e,t,r={}){let{empty:n,ranges:o}=e.selection,a=t?rr(t,e.schema):null;if(n)return !!(e.storedMarks||e.selection.$from.marks()).filter(p=>a?a.name===p.type.name:true).find(p=>ti(p.attrs,r,{strict:false}));let i=0,s=[];if(o.forEach(({$from:p,$to:m})=>{let d=p.pos,g=m.pos;e.doc.nodesBetween(d,g,(h,b)=>{if(a&&h.inlineContent&&!h.type.allowsMarkType(a))return false;if(!h.isText&&!h.marks.length)return;let y=Math.max(d,b),v=Math.min(g,b+h.nodeSize),N=v-y;i+=N,s.push(...h.marks.map(x=>({mark:x,from:y,to:v})));});}),i===0)return false;let l=s.filter(p=>a?a.name===p.mark.type.name:true).filter(p=>ti(p.mark.attrs,r,{strict:false})).reduce((p,m)=>p+m.to-m.from,0),c=s.filter(p=>a?p.mark.type!==a&&p.mark.type.excludes(a):true).reduce((p,m)=>p+m.to-m.from,0);return (l>0?l+c:l)>=i}function Fu(e,t){let{nodeExtensions:r}=kn(t),n=r.find(i=>i.name===e);if(!n)return false;let o={name:n.name,options:n.options,storage:n.storage},a=je(ye(n,"group",o));return typeof a!="string"?false:a.split(" ").includes("list")}function Qu(e,{checkChildren:t=true,ignoreWhitespace:r=false}={}){var n;if(r){if(e.type.name==="hardBreak")return true;if(e.isText)return !/\S/.test((n=e.text)!=null?n:"")}if(e.isText)return !e.text;if(e.isAtom||e.isLeaf)return false;if(e.content.childCount===0)return true;if(t){let o=true;return e.content.forEach(a=>{o!==false&&(Qu(a,{ignoreWhitespace:r,checkChildren:t})||(o=false));}),o}return false}function Sx(e,t,r){var n;let{selection:o}=t,a=null;if(Wu(o)&&(a=o.$cursor),a){let s=(n=e.storedMarks)!=null?n:a.marks();return a.parent.type.allowsMarkType(r)&&(!!r.isInSet(s)||!s.some(c=>c.type.excludes(r)))}let{ranges:i}=o;return i.some(({$from:s,$to:l})=>{let c=s.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(r):false;return e.doc.nodesBetween(s.pos,l.pos,(u,p,m)=>{if(c)return false;if(u.isInline){let d=!m||m.type.allowsMarkType(r),g=!!r.isInSet(u.marks)||!u.marks.some(h=>h.type.excludes(r));c=d&&g;}return !c}),c})}var Px=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let{selection:a}=r,{empty:i,ranges:s}=a,l=rr(e,n.schema);if(o)if(i){let c=sx(n,l);r.addStoredMark(l.create({...c,...t}));}else s.forEach(c=>{let u=c.$from.pos,p=c.$to.pos;n.doc.nodesBetween(u,p,(m,d)=>{let g=Math.max(d,u),h=Math.min(d+m.nodeSize,p);m.marks.find(y=>y.type===l)?m.marks.forEach(y=>{l===y.type&&r.addMark(g,h,l.create({...y.attrs,...t}));}):r.addMark(g,h,l.create(t));});});return Sx(n,r,l)},Rx=(e,t)=>({tr:r})=>(r.setMeta(e,t),true),Ex=(e,t={})=>({state:r,dispatch:n,chain:o})=>{let a=nt(e,r.schema),i;return r.selection.$anchor.sameParent(r.selection.$head)&&(i=r.selection.$anchor.parent.attrs),a.isTextblock?o().command(({commands:s})=>setBlockType(a,{...i,...t})(r)?true:s.clearNodes()).command(({state:s})=>setBlockType(a,{...i,...t})(s,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),false)},Dx=e=>({tr:t,dispatch:r})=>{if(r){let{doc:n}=t,o=Kr(e,0,n.content.size),a=NodeSelection.create(n,o);t.setSelection(a);}return true},Ax=(e,t)=>({tr:r,state:n,dispatch:o})=>{let{selection:a}=n,i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=a.from,s=a.to),o&&r.doc.nodesBetween(i,s,(l,c)=>{l.isText||r.setNodeMarkup(c,void 0,{...l.attrs,dir:e});}),true},Ix=e=>({tr:t,dispatch:r})=>{if(r){let{doc:n}=t,{from:o,to:a}=typeof e=="number"?{from:e,to:e}:e,i=TextSelection.atStart(n).from,s=TextSelection.atEnd(n).to,l=Kr(o,i,s),c=Kr(a,i,s),u=TextSelection.create(n,l,c);t.setSelection(u);}return true},Vx=e=>({state:t,dispatch:r})=>{let n=nt(e,t.schema);return sinkListItem(n)(t,r)};function Ou(e,t){let r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){let n=r.filter(o=>t?.includes(o.type.name));e.tr.ensureMarks(n);}}var Fx=({keepMarks:e=true}={})=>({tr:t,state:r,dispatch:n,editor:o})=>{let{selection:a,doc:i}=t,{$from:s,$to:l}=a,c=o.extensionManager.attributes,u=ei(c,s.node().type.name,s.node().attrs);if(a instanceof NodeSelection&&a.node.isBlock)return !s.parentOffset||!canSplit(i,s.pos)?false:(n&&(e&&Ou(r,o.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),true);if(!s.parent.isBlock)return false;let p=l.parentOffset===l.parent.content.size,m=s.depth===0?void 0:dx(s.node(-1).contentMatchAt(s.indexAfter(-1))),d=p&&m?[{type:m,attrs:u}]:void 0,g=canSplit(t.doc,t.mapping.map(s.pos),1,d);if(!d&&!g&&canSplit(t.doc,t.mapping.map(s.pos),1,m?[{type:m}]:void 0)&&(g=true,d=m?[{type:m,attrs:u}]:void 0),n){if(g&&(a instanceof TextSelection&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,d),m&&!p&&!s.parentOffset&&s.parent.type!==m)){let h=t.mapping.map(s.before()),b=t.doc.resolve(h);s.node(-1).canReplaceWith(b.index(),b.index()+1,m)&&t.setNodeMarkup(t.mapping.map(s.before()),m);}e&&Ou(r,o.extensionManager.splittableMarks),t.scrollIntoView();}return g},Kx=(e,t={})=>({tr:r,state:n,dispatch:o,editor:a})=>{var i;let s=nt(e,n.schema),{$from:l,$to:c}=n.selection,u=n.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return false;let p=l.node(-1);if(p.type!==s)return false;let m=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return false;if(o){let y=Fragment$1.empty,v=l.index(-1)?1:l.index(-2)?2:3;for(let A=l.depth-v;A>=l.depth-3;A-=1)y=Fragment$1.from(l.node(A).copy(y));let N=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...ei(m,l.node().type.name,l.node().attrs),...t},w=((i=s.contentMatch.defaultType)==null?void 0:i.createAndFill(x))||void 0;y=y.append(Fragment$1.from(s.createAndFill(null,w)||void 0));let L=l.before(l.depth-(v-1));r.replace(L,l.after(-N),new Slice(y,4-v,0));let P=-1;r.doc.nodesBetween(L,r.doc.content.size,(A,D)=>{if(P>-1)return false;A.isTextblock&&A.content.size===0&&(P=D+1);}),P>-1&&r.setSelection(TextSelection.near(r.doc.resolve(P))),r.scrollIntoView();}return true}let d=c.pos===l.end()?p.contentMatchAt(0).defaultType:null,g={...ei(m,p.type.name,p.attrs),...t},h={...ei(m,l.node().type.name,l.node().attrs),...t};r.delete(l.pos,c.pos);let b=d?[{type:s,attrs:g},{type:d,attrs:h}]:[{type:s,attrs:g}];if(!canSplit(r.doc,l.pos,2))return false;if(o){let{selection:y,storedMarks:v}=n,{splittableMarks:N}=a.extensionManager,x=v||y.$to.parentOffset&&y.$from.marks();if(r.split(l.pos,2,b).scrollIntoView(),!x||!o)return true;let w=x.filter(L=>N.includes(L.type.name));r.ensureMarks(w);}return true},fl=(e,t)=>{let r=wl(i=>i.type===t)(e.selection);if(!r)return true;let n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(n===void 0)return true;let o=e.doc.nodeAt(n);return r.node.type===o?.type&&canJoin(e.doc,r.pos)&&e.join(r.pos),true},hl=(e,t)=>{let r=wl(i=>i.type===t)(e.selection);if(!r)return true;let n=e.doc.resolve(r.start).after(r.depth);if(n===void 0)return true;let o=e.doc.nodeAt(n);return r.node.type===o?.type&&canJoin(e.doc,n)&&e.join(n),true},jx=(e,t,r,n={})=>({editor:o,tr:a,state:i,dispatch:s,chain:l,commands:c,can:u})=>{let{extensions:p,splittableMarks:m}=o.extensionManager,d=nt(e,i.schema),g=nt(t,i.schema),{selection:h,storedMarks:b}=i,{$from:y,$to:v}=h,N=y.blockRange(v),x=b||h.$to.parentOffset&&h.$from.marks();if(!N)return false;let w=wl(L=>Fu(L.type.name,p))(h);if(N.depth>=1&&w&&N.depth-w.depth<=1){if(w.node.type===d)return c.liftListItem(g);if(Fu(w.node.type.name,p)&&d.validContent(w.node.content)&&s)return l().command(()=>(a.setNodeMarkup(w.pos,d),true)).command(()=>fl(a,d)).command(()=>hl(a,d)).run()}return !r||!x||!s?l().command(()=>u().wrapInList(d,n)?true:c.clearNodes()).wrapInList(d,n).command(()=>fl(a,d)).command(()=>hl(a,d)).run():l().command(()=>{let L=u().wrapInList(d,n),P=x.filter(A=>m.includes(A.type.name));return a.ensureMarks(P),L?true:c.clearNodes()}).wrapInList(d,n).command(()=>fl(a,d)).command(()=>hl(a,d)).run()},Wx=(e,t={},r={})=>({state:n,commands:o})=>{let{extendEmptyMarkRange:a=false}=r,i=rr(e,n.schema);return Tx(n,i,t)?o.unsetMark(i,{extendEmptyMarkRange:a}):o.setMark(i,t)},Yx=(e,t,r={})=>({state:n,commands:o})=>{let a=nt(e,n.schema),i=nt(t,n.schema),s=xl(n,a,r),l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s?o.setNode(i,l):o.setNode(a,{...l,...r})},Ux=(e,t={})=>({state:r,commands:n})=>{let o=nt(e,r.schema);return xl(r,o,t)?n.lift(o):n.wrapIn(o,t)},Xx=()=>({state:e,dispatch:t})=>{let r=e.plugins;for(let n=0;n<r.length;n+=1){let o=r[n],a;if(o.spec.isInputRules&&(a=o.getState(e))){if(t){let i=e.tr,s=a.transform;for(let l=s.steps.length-1;l>=0;l-=1)i.step(s.steps[l].invert(s.docs[l]));if(a.text){let l=i.doc.resolve(a.from).marks();i.replaceWith(a.from,a.to,e.schema.text(a.text,l));}else i.delete(a.from,a.to);}return true}}return false},Gx=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,{empty:n,ranges:o}=r;return n||t&&o.forEach(a=>{e.removeMark(a.$from.pos,a.$to.pos);}),true},qx=(e,t={})=>({tr:r,state:n,dispatch:o})=>{var a;let{extendEmptyMarkRange:i=false}=t,{selection:s}=r,l=rr(e,n.schema),{$from:c,empty:u,ranges:p}=s;if(!o)return true;if(u&&i){let{from:m,to:d}=s,g=(a=c.marks().find(b=>b.type===l))==null?void 0:a.attrs,h=ju(c,l,g);h&&(m=h.from,d=h.to),r.removeMark(m,d,l);}else p.forEach(m=>{r.removeMark(m.$from.pos,m.$to.pos,l);});return r.removeStoredMark(l),true},Jx=e=>({tr:t,state:r,dispatch:n})=>{let{selection:o}=r,a,i;return typeof e=="number"?(a=e,i=e):e&&"from"in e&&"to"in e?(a=e.from,i=e.to):(a=o.from,i=o.to),n&&t.doc.nodesBetween(a,i,(s,l)=>{if(s.isText)return;let c={...s.attrs};delete c.dir,t.setNodeMarkup(l,void 0,c);}),true},Qx=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let a=null,i=null,s=Xu(typeof e=="string"?e:e.name,n.schema);if(!s)return false;s==="node"&&(a=nt(e,n.schema)),s==="mark"&&(i=rr(e,n.schema));let l=false;return r.selection.ranges.forEach(c=>{let u=c.$from.pos,p=c.$to.pos,m,d,g,h;r.selection.empty?n.doc.nodesBetween(u,p,(b,y)=>{a&&a===b.type&&(l=true,g=Math.max(y,u),h=Math.min(y+b.nodeSize,p),m=y,d=b);}):n.doc.nodesBetween(u,p,(b,y)=>{y<u&&a&&a===b.type&&(l=true,g=Math.max(y,u),h=Math.min(y+b.nodeSize,p),m=y,d=b),y>=u&&y<=p&&(a&&a===b.type&&(l=true,o&&r.setNodeMarkup(y,void 0,{...b.attrs,...t})),i&&b.marks.length&&b.marks.forEach(v=>{if(i===v.type&&(l=true,o)){let N=Math.max(y,u),x=Math.min(y+b.nodeSize,p);r.addMark(N,x,i.create({...v.attrs,...t}));}}));}),d&&(m!==void 0&&o&&r.setNodeMarkup(m,void 0,{...d.attrs,...t}),i&&d.marks.length&&d.marks.forEach(b=>{i===b.type&&o&&r.addMark(g,h,i.create({...b.attrs,...t}));}));}),l},ew=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return wrapIn(o,t)(r,n)},rw=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return wrapInList(o,t)(r,n)};function lw(e){return Object.prototype.toString.call(e).slice(8,-1)}function Qa(e){return lw(e)!=="Object"?false:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function ep(e,t){let r={...e};return Qa(e)&&Qa(t)&&Object.keys(t).forEach(n=>{Qa(t[n])&&Qa(e[n])?r[n]=ep(e[n],t[n]):r[n]=t[n];}),r}var Nl=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name;}get options(){return {...je(ye(this,"addOptions",{name:this.name}))||{}}}get storage(){return {...je(ye(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>ep(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Cl=class tp extends Nl{constructor(){super(...arguments),this.type="mark";}static create(t={}){let r=typeof t=="function"?t():t;return new tp(r)}static handleExit({editor:t,mark:r}){let{tr:n}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){let i=o.marks();if(!!!i.find(c=>c?.type.name===r.name))return false;let l=i.find(c=>c?.type.name===r.name);return l&&n.removeStoredMark(l),n.insertText(" ",o.pos),t.view.dispatch(n),true}return false}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}};var gw={};bl(gw,{ClipboardTextSerializer:()=>vw,Commands:()=>xw,Delete:()=>kw,Drop:()=>Mw,Editable:()=>Pw,FocusEvents:()=>Lw,Keymap:()=>Iw,Paste:()=>Hw,Tabindex:()=>Bw,TextDirection:()=>Kw,focusEventsPluginKey:()=>np});var Ke=class rp extends Nl{constructor(){super(...arguments),this.type="extension";}static create(t={}){let r=typeof t=="function"?t():t;return new rp(r)}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}},vw=Ke.create({name:"clipboardTextSerializer",addOptions(){return {blockSeparator:void 0}},addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:r}=e,{doc:n,selection:o}=t,{ranges:a}=o,i=Math.min(...a.map(u=>u.$from.pos)),s=Math.max(...a.map(u=>u.$to.pos)),l=wx(r);return xx(n,{from:i,to:s},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),xw=Ke.create({name:"commands",addCommands(){return {...$u}}}),kw=Ke.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var r,n,o;let a=()=>{var i,s,l,c;if((c=(l=(s=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:s.filterTransaction)==null?void 0:l.call(s,e))!=null?c:e.getMeta("y-sync$"))return;let u=cx(e.before,[e,...t]);Cx(u).forEach(d=>{u.mapping.mapResult(d.oldRange.from).deletedAfter&&u.mapping.mapResult(d.oldRange.to).deletedBefore&&u.before.nodesBetween(d.oldRange.from,d.oldRange.to,(g,h)=>{let b=h+g.nodeSize-2,y=d.oldRange.from<=h&&b<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:h,to:b,newFrom:u.mapping.map(h),newTo:u.mapping.map(b),deletedRange:d.oldRange,newRange:d.newRange,partial:!y,editor:this.editor,transaction:e,combinedTransform:u});});});let m=u.mapping;u.steps.forEach((d,g)=>{var h,b;if(d instanceof RemoveMarkStep){let y=m.slice(g).map(d.from,-1),v=m.slice(g).map(d.to),N=m.invert().map(y,-1),x=m.invert().map(v),w=(h=u.doc.nodeAt(y-1))==null?void 0:h.marks.some(P=>P.eq(d.mark)),L=(b=u.doc.nodeAt(v))==null?void 0:b.marks.some(P=>P.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:N,to:x},newRange:{from:y,to:v},partial:!!(L||w),editor:this.editor,transaction:e,combinedTransform:u});}});};(o=(n=(r=this.editor.options.coreExtensionOptions)==null?void 0:r.delete)==null?void 0:n.async)==null||o?setTimeout(a,0):a();}}),Mw=Ke.create({name:"drop",addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("tiptapDrop"),props:{handleDrop:(e,t,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:r,moved:n});}}})]}}),Pw=Ke.create({name:"editable",addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),np=new PluginKey("focusEvents"),Lw=Ke.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return [new Plugin({key:np,props:{handleDOMEvents:{focus:(t,r)=>{e.isFocused=true;let n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",false);return t.dispatch(n),false},blur:(t,r)=>{e.isFocused=false;let n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",false);return t.dispatch(n),false}}}})]}}),Iw=Ke.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{let{selection:l,doc:c}=s,{empty:u,$anchor:p}=l,{pos:m,parent:d}=p,g=p.parent.isTextblock&&m>0?s.doc.resolve(m-1):p,h=g.parent.type.spec.isolating,b=p.pos-p.parentOffset,y=h&&g.parent.childCount===1?b===p.pos:Selection.atStart(c).from===m;return !u||!d.type.isTextblock||d.textContent.length||!y||y&&p.parent.type.name==="paragraph"?false:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},a={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ri()||Uu()?a:o},addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("clearDocument"),appendTransaction:(e,t,r)=>{if(e.some(h=>h.getMeta("composition")))return;let n=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventClearDocument"));if(!n||o)return;let{empty:a,from:i,to:s}=t.selection,l=Selection.atStart(t.doc).from,c=Selection.atEnd(t.doc).to;if(a||!(i===l&&s===c)||!Qu(r.doc))return;let m=r.tr,d=oi({state:r,transaction:m}),{commands:g}=new yl({editor:this.editor,state:d});if(g.clearNodes(),!!m.steps.length)return m}})]}}),Hw=Ke.create({name:"paste",addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("tiptapPaste"),props:{handlePaste:(e,t,r)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:r});}}})]}}),Bw=Ke.create({name:"tabindex",addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Kw=Ke.create({name:"textDirection",addOptions(){return {direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return [];let{nodeExtensions:e}=kn(this.extensions);return [{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{let r=t.getAttribute("dir");return r&&(r==="ltr"||r==="rtl"||r==="auto")?r:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});var jw={};bl(jw,{createAtomBlockMarkdownSpec:()=>Ww,createBlockMarkdownSpec:()=>Yw,createInlineMarkdownSpec:()=>Gw,parseAttributes:()=>Tl,parseIndentedBlocks:()=>qw,renderNestedMarkdownContent:()=>Jw,serializeAttributes:()=>Sl});function Tl(e){if(!e?.trim())return {};let t={},r=[],n=e.replace(/["']([^"']*)["']/g,c=>(r.push(c),`__QUOTED_${r.length-1}__`)),o=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){let c=o.map(u=>u.trim().slice(1));t.class=c.join(" ");}let a=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]);let i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(i)).forEach(([,c,u])=>{var p;let m=parseInt(((p=u.match(/__QUOTED_(\d+)__/))==null?void 0:p[1])||"0",10),d=r[m];d&&(t[c]=d.slice(1,-1));});let l=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(t[u]=true);}),t}function Sl(e){if(!e||Object.keys(e).length===0)return "";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(n=>t.push(`.${n}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([r,n])=>{r==="class"||r==="id"||(n===true?t.push(r):n!==false&&n!=null&&t.push(`${r}="${String(n)}"`));}),t.join(" ")}function Ww(e){let{nodeName:t,name:r,parseAttributes:n=Tl,serializeAttributes:o=Sl,defaultAttributes:a={},requiredAttributes:i=[],allowedAttributes:s}=e,l=r||t,c=u=>{if(!s)return u;let p={};return s.forEach(m=>{m in u&&(p[m]=u[m]);}),p};return {parseMarkdown:(u,p)=>{let m={...a,...u.attributes};return p.createNode(t,m,[])},markdownTokenizer:{name:t,level:"block",start(u){var p;let m=new RegExp(`^:::${l}(?:\\s|$)`,"m"),d=(p=u.match(m))==null?void 0:p.index;return d!==void 0?d:-1},tokenize(u,p,m){let d=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),g=u.match(d);if(!g)return;let h=g[1]||"",b=n(h);if(!i.find(v=>!(v in b)))return {type:t,raw:g[0],attributes:b}}},renderMarkdown:u=>{let p=c(u.attrs||{}),m=o(p),d=m?` {${m}}`:"";return `:::${l}${d} :::`}}}function Yw(e){let{nodeName:t,name:r,getContent:n,parseAttributes:o=Tl,serializeAttributes:a=Sl,defaultAttributes:i={},content:s="block",allowedAttributes:l}=e,c=r||t,u=p=>{if(!l)return p;let m={};return l.forEach(d=>{d in p&&(m[d]=p[d]);}),m};return {parseMarkdown:(p,m)=>{let d;if(n){let h=n(p);d=typeof h=="string"?[{type:"text",text:h}]:h;}else s==="block"?d=m.parseChildren(p.tokens||[]):d=m.parseInline(p.tokens||[]);let g={...i,...p.attributes};return m.createNode(t,g,d)},markdownTokenizer:{name:t,level:"block",start(p){var m;let d=new RegExp(`^:::${c}`,"m"),g=(m=p.match(d))==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,m,d){var g;let h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=p.match(h);if(!b)return;let[y,v=""]=b,N=o(v),x=1,w=y.length,L="",P=/^:::([\w-]*)(\s.*)?/gm,A=p.slice(w);for(P.lastIndex=0;;){let D=P.exec(A);if(D===null)break;let S=D.index,C=D[1];if(!((g=D[2])!=null&&g.endsWith(":::"))){if(C)x+=1;else if(x-=1,x===0){let I=A.slice(0,S);L=I.trim();let k=p.slice(0,w+S+D[0].length),T=[];if(L)if(s==="block")for(T=d.blockTokens(I),T.forEach(R=>{R.text&&(!R.tokens||R.tokens.length===0)&&(R.tokens=d.inlineTokens(R.text));});T.length>0;){let R=T[T.length-1];if(R.type==="paragraph"&&(!R.text||R.text.trim()===""))T.pop();else break}else T=d.inlineTokens(L);return {type:t,raw:k,attributes:N,content:L,tokens:T}}}}}},renderMarkdown:(p,m)=>{let d=u(p.attrs||{}),g=a(d),h=g?` {${g}}`:"",b=m.renderChildren(p.content||[],`
|
|
86
|
+
`,textSerializers:i={}}=r||{},s="";return e.nodesBetween(n,o,(l,c,u,p)=>{var m;l.isBlock&&c>n&&(s+=a);let d=i?.[l.type.name];if(d)return u&&(s+=d({node:l,pos:c,parent:u,index:p,range:t})),false;l.isText&&(s+=(m=l?.text)==null?void 0:m.slice(Math.max(n,c)-c,o-c));}),s}function Cx(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,r])=>[t,r.spec.toText]))}function Tx(e,t=JSON.stringify){let r={};return e.filter(n=>{let o=t(n);return Object.prototype.hasOwnProperty.call(r,o)?false:r[o]=true})}function Mx(e){let t=Tx(e);return t.length===1?t:t.filter((r,n)=>!t.filter((a,i)=>i!==n).some(a=>r.oldRange.from>=a.oldRange.from&&r.oldRange.to<=a.oldRange.to&&r.newRange.from>=a.newRange.from&&r.newRange.to<=a.newRange.to))}function Sx(e){let{mapping:t,steps:r}=e,n=[];return t.maps.forEach((o,a)=>{let i=[];if(o.ranges.length)o.forEach((s,l)=>{i.push({from:s,to:l});});else {let{from:s,to:l}=r[a];if(s===void 0||l===void 0)return;i.push({from:s,to:l});}i.forEach(({from:s,to:l})=>{let c=t.slice(a).map(s,-1),u=t.slice(a).map(l),p=t.invert().map(c,-1),m=t.invert().map(u);n.push({oldRange:{from:p,to:m},newRange:{from:c,to:u}});});}),Mx(n)}function ei(e,t,r){return Object.fromEntries(Object.entries(r).filter(([n])=>{let o=e.find(a=>a.type===t&&a.name===n);return o?o.attribute.keepOnSplit:false}))}function Rx(e,t,r={}){let{empty:n,ranges:o}=e.selection,a=t?rr(t,e.schema):null;if(n)return !!(e.storedMarks||e.selection.$from.marks()).filter(p=>a?a.name===p.type.name:true).find(p=>ti(p.attrs,r,{strict:false}));let i=0,s=[];if(o.forEach(({$from:p,$to:m})=>{let d=p.pos,g=m.pos;e.doc.nodesBetween(d,g,(h,b)=>{if(a&&h.inlineContent&&!h.type.allowsMarkType(a))return false;if(!h.isText&&!h.marks.length)return;let y=Math.max(d,b),v=Math.min(g,b+h.nodeSize),N=v-y;i+=N,s.push(...h.marks.map(x=>({mark:x,from:y,to:v})));});}),i===0)return false;let l=s.filter(p=>a?a.name===p.mark.type.name:true).filter(p=>ti(p.mark.attrs,r,{strict:false})).reduce((p,m)=>p+m.to-m.from,0),c=s.filter(p=>a?p.mark.type!==a&&p.mark.type.excludes(a):true).reduce((p,m)=>p+m.to-m.from,0);return (l>0?l+c:l)>=i}function Fu(e,t){let{nodeExtensions:r}=kn(t),n=r.find(i=>i.name===e);if(!n)return false;let o={name:n.name,options:n.options,storage:n.storage},a=je(ye(n,"group",o));return typeof a!="string"?false:a.split(" ").includes("list")}function Qu(e,{checkChildren:t=true,ignoreWhitespace:r=false}={}){var n;if(r){if(e.type.name==="hardBreak")return true;if(e.isText)return !/\S/.test((n=e.text)!=null?n:"")}if(e.isText)return !e.text;if(e.isAtom||e.isLeaf)return false;if(e.content.childCount===0)return true;if(t){let o=true;return e.content.forEach(a=>{o!==false&&(Qu(a,{ignoreWhitespace:r,checkChildren:t})||(o=false));}),o}return false}function Ex(e,t,r){var n;let{selection:o}=t,a=null;if(Wu(o)&&(a=o.$cursor),a){let s=(n=e.storedMarks)!=null?n:a.marks();return a.parent.type.allowsMarkType(r)&&(!!r.isInSet(s)||!s.some(c=>c.type.excludes(r)))}let{ranges:i}=o;return i.some(({$from:s,$to:l})=>{let c=s.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(r):false;return e.doc.nodesBetween(s.pos,l.pos,(u,p,m)=>{if(c)return false;if(u.isInline){let d=!m||m.type.allowsMarkType(r),g=!!r.isInSet(u.marks)||!u.marks.some(h=>h.type.excludes(r));c=d&&g;}return !c}),c})}var Lx=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let{selection:a}=r,{empty:i,ranges:s}=a,l=rr(e,n.schema);if(o)if(i){let c=dx(n,l);r.addStoredMark(l.create({...c,...t}));}else s.forEach(c=>{let u=c.$from.pos,p=c.$to.pos;n.doc.nodesBetween(u,p,(m,d)=>{let g=Math.max(d,u),h=Math.min(d+m.nodeSize,p);m.marks.find(y=>y.type===l)?m.marks.forEach(y=>{l===y.type&&r.addMark(g,h,l.create({...y.attrs,...t}));}):r.addMark(g,h,l.create(t));});});return Ex(n,r,l)},Dx=(e,t)=>({tr:r})=>(r.setMeta(e,t),true),Ax=(e,t={})=>({state:r,dispatch:n,chain:o})=>{let a=nt(e,r.schema),i;return r.selection.$anchor.sameParent(r.selection.$head)&&(i=r.selection.$anchor.parent.attrs),a.isTextblock?o().command(({commands:s})=>setBlockType(a,{...i,...t})(r)?true:s.clearNodes()).command(({state:s})=>setBlockType(a,{...i,...t})(s,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),false)},zx=e=>({tr:t,dispatch:r})=>{if(r){let{doc:n}=t,o=Kr(e,0,n.content.size),a=NodeSelection.create(n,o);t.setSelection(a);}return true},Vx=(e,t)=>({tr:r,state:n,dispatch:o})=>{let{selection:a}=n,i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=a.from,s=a.to),o&&r.doc.nodesBetween(i,s,(l,c)=>{l.isText||r.setNodeMarkup(c,void 0,{...l.attrs,dir:e});}),true},Hx=e=>({tr:t,dispatch:r})=>{if(r){let{doc:n}=t,{from:o,to:a}=typeof e=="number"?{from:e,to:e}:e,i=TextSelection.atStart(n).from,s=TextSelection.atEnd(n).to,l=Kr(o,i,s),c=Kr(a,i,s),u=TextSelection.create(n,l,c);t.setSelection(u);}return true},Fx=e=>({state:t,dispatch:r})=>{let n=nt(e,t.schema);return sinkListItem(n)(t,r)};function $u(e,t){let r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){let n=r.filter(o=>t?.includes(o.type.name));e.tr.ensureMarks(n);}}var Ox=({keepMarks:e=true}={})=>({tr:t,state:r,dispatch:n,editor:o})=>{let{selection:a,doc:i}=t,{$from:s,$to:l}=a,c=o.extensionManager.attributes,u=ei(c,s.node().type.name,s.node().attrs);if(a instanceof NodeSelection&&a.node.isBlock)return !s.parentOffset||!canSplit(i,s.pos)?false:(n&&(e&&$u(r,o.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),true);if(!s.parent.isBlock)return false;let p=l.parentOffset===l.parent.content.size,m=s.depth===0?void 0:mx(s.node(-1).contentMatchAt(s.indexAfter(-1))),d=p&&m?[{type:m,attrs:u}]:void 0,g=canSplit(t.doc,t.mapping.map(s.pos),1,d);if(!d&&!g&&canSplit(t.doc,t.mapping.map(s.pos),1,m?[{type:m}]:void 0)&&(g=true,d=m?[{type:m,attrs:u}]:void 0),n){if(g&&(a instanceof TextSelection&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,d),m&&!p&&!s.parentOffset&&s.parent.type!==m)){let h=t.mapping.map(s.before()),b=t.doc.resolve(h);s.node(-1).canReplaceWith(b.index(),b.index()+1,m)&&t.setNodeMarkup(t.mapping.map(s.before()),m);}e&&$u(r,o.extensionManager.splittableMarks),t.scrollIntoView();}return g},Yx=(e,t={})=>({tr:r,state:n,dispatch:o,editor:a})=>{var i;let s=nt(e,n.schema),{$from:l,$to:c}=n.selection,u=n.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return false;let p=l.node(-1);if(p.type!==s)return false;let m=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return false;if(o){let y=Fragment$1.empty,v=l.index(-1)?1:l.index(-2)?2:3;for(let A=l.depth-v;A>=l.depth-3;A-=1)y=Fragment$1.from(l.node(A).copy(y));let N=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...ei(m,l.node().type.name,l.node().attrs),...t},w=((i=s.contentMatch.defaultType)==null?void 0:i.createAndFill(x))||void 0;y=y.append(Fragment$1.from(s.createAndFill(null,w)||void 0));let L=l.before(l.depth-(v-1));r.replace(L,l.after(-N),new Slice(y,4-v,0));let P=-1;r.doc.nodesBetween(L,r.doc.content.size,(A,D)=>{if(P>-1)return false;A.isTextblock&&A.content.size===0&&(P=D+1);}),P>-1&&r.setSelection(TextSelection.near(r.doc.resolve(P))),r.scrollIntoView();}return true}let d=c.pos===l.end()?p.contentMatchAt(0).defaultType:null,g={...ei(m,p.type.name,p.attrs),...t},h={...ei(m,l.node().type.name,l.node().attrs),...t};r.delete(l.pos,c.pos);let b=d?[{type:s,attrs:g},{type:d,attrs:h}]:[{type:s,attrs:g}];if(!canSplit(r.doc,l.pos,2))return false;if(o){let{selection:y,storedMarks:v}=n,{splittableMarks:N}=a.extensionManager,x=v||y.$to.parentOffset&&y.$from.marks();if(r.split(l.pos,2,b).scrollIntoView(),!x||!o)return true;let w=x.filter(L=>N.includes(L.type.name));r.ensureMarks(w);}return true},fl=(e,t)=>{let r=wl(i=>i.type===t)(e.selection);if(!r)return true;let n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(n===void 0)return true;let o=e.doc.nodeAt(n);return r.node.type===o?.type&&canJoin(e.doc,r.pos)&&e.join(r.pos),true},hl=(e,t)=>{let r=wl(i=>i.type===t)(e.selection);if(!r)return true;let n=e.doc.resolve(r.start).after(r.depth);if(n===void 0)return true;let o=e.doc.nodeAt(n);return r.node.type===o?.type&&canJoin(e.doc,n)&&e.join(n),true},Ux=(e,t,r,n={})=>({editor:o,tr:a,state:i,dispatch:s,chain:l,commands:c,can:u})=>{let{extensions:p,splittableMarks:m}=o.extensionManager,d=nt(e,i.schema),g=nt(t,i.schema),{selection:h,storedMarks:b}=i,{$from:y,$to:v}=h,N=y.blockRange(v),x=b||h.$to.parentOffset&&h.$from.marks();if(!N)return false;let w=wl(L=>Fu(L.type.name,p))(h);if(N.depth>=1&&w&&N.depth-w.depth<=1){if(w.node.type===d)return c.liftListItem(g);if(Fu(w.node.type.name,p)&&d.validContent(w.node.content)&&s)return l().command(()=>(a.setNodeMarkup(w.pos,d),true)).command(()=>fl(a,d)).command(()=>hl(a,d)).run()}return !r||!x||!s?l().command(()=>u().wrapInList(d,n)?true:c.clearNodes()).wrapInList(d,n).command(()=>fl(a,d)).command(()=>hl(a,d)).run():l().command(()=>{let L=u().wrapInList(d,n),P=x.filter(A=>m.includes(A.type.name));return a.ensureMarks(P),L?true:c.clearNodes()}).wrapInList(d,n).command(()=>fl(a,d)).command(()=>hl(a,d)).run()},Xx=(e,t={},r={})=>({state:n,commands:o})=>{let{extendEmptyMarkRange:a=false}=r,i=rr(e,n.schema);return Rx(n,i,t)?o.unsetMark(i,{extendEmptyMarkRange:a}):o.setMark(i,t)},Gx=(e,t,r={})=>({state:n,commands:o})=>{let a=nt(e,n.schema),i=nt(t,n.schema),s=xl(n,a,r),l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s?o.setNode(i,l):o.setNode(a,{...l,...r})},qx=(e,t={})=>({state:r,commands:n})=>{let o=nt(e,r.schema);return xl(r,o,t)?n.lift(o):n.wrapIn(o,t)},Jx=()=>({state:e,dispatch:t})=>{let r=e.plugins;for(let n=0;n<r.length;n+=1){let o=r[n],a;if(o.spec.isInputRules&&(a=o.getState(e))){if(t){let i=e.tr,s=a.transform;for(let l=s.steps.length-1;l>=0;l-=1)i.step(s.steps[l].invert(s.docs[l]));if(a.text){let l=i.doc.resolve(a.from).marks();i.replaceWith(a.from,a.to,e.schema.text(a.text,l));}else i.delete(a.from,a.to);}return true}}return false},Qx=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,{empty:n,ranges:o}=r;return n||t&&o.forEach(a=>{e.removeMark(a.$from.pos,a.$to.pos);}),true},Zx=(e,t={})=>({tr:r,state:n,dispatch:o})=>{var a;let{extendEmptyMarkRange:i=false}=t,{selection:s}=r,l=rr(e,n.schema),{$from:c,empty:u,ranges:p}=s;if(!o)return true;if(u&&i){let{from:m,to:d}=s,g=(a=c.marks().find(b=>b.type===l))==null?void 0:a.attrs,h=ju(c,l,g);h&&(m=h.from,d=h.to),r.removeMark(m,d,l);}else p.forEach(m=>{r.removeMark(m.$from.pos,m.$to.pos,l);});return r.removeStoredMark(l),true},ew=e=>({tr:t,state:r,dispatch:n})=>{let{selection:o}=r,a,i;return typeof e=="number"?(a=e,i=e):e&&"from"in e&&"to"in e?(a=e.from,i=e.to):(a=o.from,i=o.to),n&&t.doc.nodesBetween(a,i,(s,l)=>{if(s.isText)return;let c={...s.attrs};delete c.dir,t.setNodeMarkup(l,void 0,c);}),true},tw=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let a=null,i=null,s=Xu(typeof e=="string"?e:e.name,n.schema);if(!s)return false;s==="node"&&(a=nt(e,n.schema)),s==="mark"&&(i=rr(e,n.schema));let l=false;return r.selection.ranges.forEach(c=>{let u=c.$from.pos,p=c.$to.pos,m,d,g,h;r.selection.empty?n.doc.nodesBetween(u,p,(b,y)=>{a&&a===b.type&&(l=true,g=Math.max(y,u),h=Math.min(y+b.nodeSize,p),m=y,d=b);}):n.doc.nodesBetween(u,p,(b,y)=>{y<u&&a&&a===b.type&&(l=true,g=Math.max(y,u),h=Math.min(y+b.nodeSize,p),m=y,d=b),y>=u&&y<=p&&(a&&a===b.type&&(l=true,o&&r.setNodeMarkup(y,void 0,{...b.attrs,...t})),i&&b.marks.length&&b.marks.forEach(v=>{if(i===v.type&&(l=true,o)){let N=Math.max(y,u),x=Math.min(y+b.nodeSize,p);r.addMark(N,x,i.create({...v.attrs,...t}));}}));}),d&&(m!==void 0&&o&&r.setNodeMarkup(m,void 0,{...d.attrs,...t}),i&&d.marks.length&&d.marks.forEach(b=>{i===b.type&&o&&r.addMark(g,h,i.create({...b.attrs,...t}));}));}),l},nw=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return wrapIn(o,t)(r,n)},aw=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return wrapInList(o,t)(r,n)};function uw(e){return Object.prototype.toString.call(e).slice(8,-1)}function Qa(e){return uw(e)!=="Object"?false:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function ep(e,t){let r={...e};return Qa(e)&&Qa(t)&&Object.keys(t).forEach(n=>{Qa(t[n])&&Qa(e[n])?r[n]=ep(e[n],t[n]):r[n]=t[n];}),r}var Nl=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name;}get options(){return {...je(ye(this,"addOptions",{name:this.name}))||{}}}get storage(){return {...je(ye(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>ep(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Cl=class tp extends Nl{constructor(){super(...arguments),this.type="mark";}static create(t={}){let r=typeof t=="function"?t():t;return new tp(r)}static handleExit({editor:t,mark:r}){let{tr:n}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){let i=o.marks();if(!!!i.find(c=>c?.type.name===r.name))return false;let l=i.find(c=>c?.type.name===r.name);return l&&n.removeStoredMark(l),n.insertText(" ",o.pos),t.view.dispatch(n),true}return false}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}};var vw={};bl(vw,{ClipboardTextSerializer:()=>kw,Commands:()=>Nw,Delete:()=>Tw,Drop:()=>Pw,Editable:()=>Lw,FocusEvents:()=>Iw,Keymap:()=>Hw,Paste:()=>Bw,Tabindex:()=>Kw,TextDirection:()=>Yw,focusEventsPluginKey:()=>np});var Ke=class rp extends Nl{constructor(){super(...arguments),this.type="extension";}static create(t={}){let r=typeof t=="function"?t():t;return new rp(r)}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}},kw=Ke.create({name:"clipboardTextSerializer",addOptions(){return {blockSeparator:void 0}},addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:r}=e,{doc:n,selection:o}=t,{ranges:a}=o,i=Math.min(...a.map(u=>u.$from.pos)),s=Math.max(...a.map(u=>u.$to.pos)),l=Cx(r);return Nx(n,{from:i,to:s},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Nw=Ke.create({name:"commands",addCommands(){return {...Ou}}}),Tw=Ke.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var r,n,o;let a=()=>{var i,s,l,c;if((c=(l=(s=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:s.filterTransaction)==null?void 0:l.call(s,e))!=null?c:e.getMeta("y-sync$"))return;let u=px(e.before,[e,...t]);Sx(u).forEach(d=>{u.mapping.mapResult(d.oldRange.from).deletedAfter&&u.mapping.mapResult(d.oldRange.to).deletedBefore&&u.before.nodesBetween(d.oldRange.from,d.oldRange.to,(g,h)=>{let b=h+g.nodeSize-2,y=d.oldRange.from<=h&&b<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:h,to:b,newFrom:u.mapping.map(h),newTo:u.mapping.map(b),deletedRange:d.oldRange,newRange:d.newRange,partial:!y,editor:this.editor,transaction:e,combinedTransform:u});});});let m=u.mapping;u.steps.forEach((d,g)=>{var h,b;if(d instanceof RemoveMarkStep){let y=m.slice(g).map(d.from,-1),v=m.slice(g).map(d.to),N=m.invert().map(y,-1),x=m.invert().map(v),w=(h=u.doc.nodeAt(y-1))==null?void 0:h.marks.some(P=>P.eq(d.mark)),L=(b=u.doc.nodeAt(v))==null?void 0:b.marks.some(P=>P.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:N,to:x},newRange:{from:y,to:v},partial:!!(L||w),editor:this.editor,transaction:e,combinedTransform:u});}});};(o=(n=(r=this.editor.options.coreExtensionOptions)==null?void 0:r.delete)==null?void 0:n.async)==null||o?setTimeout(a,0):a();}}),Pw=Ke.create({name:"drop",addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("tiptapDrop"),props:{handleDrop:(e,t,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:r,moved:n});}}})]}}),Lw=Ke.create({name:"editable",addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),np=new PluginKey("focusEvents"),Iw=Ke.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return [new Plugin({key:np,props:{handleDOMEvents:{focus:(t,r)=>{e.isFocused=true;let n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",false);return t.dispatch(n),false},blur:(t,r)=>{e.isFocused=false;let n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",false);return t.dispatch(n),false}}}})]}}),Hw=Ke.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{let{selection:l,doc:c}=s,{empty:u,$anchor:p}=l,{pos:m,parent:d}=p,g=p.parent.isTextblock&&m>0?s.doc.resolve(m-1):p,h=g.parent.type.spec.isolating,b=p.pos-p.parentOffset,y=h&&g.parent.childCount===1?b===p.pos:Selection.atStart(c).from===m;return !u||!d.type.isTextblock||d.textContent.length||!y||y&&p.parent.type.name==="paragraph"?false:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},a={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ri()||Uu()?a:o},addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("clearDocument"),appendTransaction:(e,t,r)=>{if(e.some(h=>h.getMeta("composition")))return;let n=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventClearDocument"));if(!n||o)return;let{empty:a,from:i,to:s}=t.selection,l=Selection.atStart(t.doc).from,c=Selection.atEnd(t.doc).to;if(a||!(i===l&&s===c)||!Qu(r.doc))return;let m=r.tr,d=oi({state:r,transaction:m}),{commands:g}=new yl({editor:this.editor,state:d});if(g.clearNodes(),!!m.steps.length)return m}})]}}),Bw=Ke.create({name:"paste",addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("tiptapPaste"),props:{handlePaste:(e,t,r)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:r});}}})]}}),Kw=Ke.create({name:"tabindex",addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Yw=Ke.create({name:"textDirection",addOptions(){return {direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return [];let{nodeExtensions:e}=kn(this.extensions);return [{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{let r=t.getAttribute("dir");return r&&(r==="ltr"||r==="rtl"||r==="auto")?r:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return [new Plugin({key:new PluginKey("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});var Uw={};bl(Uw,{createAtomBlockMarkdownSpec:()=>Xw,createBlockMarkdownSpec:()=>Gw,createInlineMarkdownSpec:()=>Qw,parseAttributes:()=>Ml,parseIndentedBlocks:()=>Zw,renderNestedMarkdownContent:()=>ek,serializeAttributes:()=>Sl});function Ml(e){if(!e?.trim())return {};let t={},r=[],n=e.replace(/["']([^"']*)["']/g,c=>(r.push(c),`__QUOTED_${r.length-1}__`)),o=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){let c=o.map(u=>u.trim().slice(1));t.class=c.join(" ");}let a=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]);let i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(i)).forEach(([,c,u])=>{var p;let m=parseInt(((p=u.match(/__QUOTED_(\d+)__/))==null?void 0:p[1])||"0",10),d=r[m];d&&(t[c]=d.slice(1,-1));});let l=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(t[u]=true);}),t}function Sl(e){if(!e||Object.keys(e).length===0)return "";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(n=>t.push(`.${n}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([r,n])=>{r==="class"||r==="id"||(n===true?t.push(r):n!==false&&n!=null&&t.push(`${r}="${String(n)}"`));}),t.join(" ")}function Xw(e){let{nodeName:t,name:r,parseAttributes:n=Ml,serializeAttributes:o=Sl,defaultAttributes:a={},requiredAttributes:i=[],allowedAttributes:s}=e,l=r||t,c=u=>{if(!s)return u;let p={};return s.forEach(m=>{m in u&&(p[m]=u[m]);}),p};return {parseMarkdown:(u,p)=>{let m={...a,...u.attributes};return p.createNode(t,m,[])},markdownTokenizer:{name:t,level:"block",start(u){var p;let m=new RegExp(`^:::${l}(?:\\s|$)`,"m"),d=(p=u.match(m))==null?void 0:p.index;return d!==void 0?d:-1},tokenize(u,p,m){let d=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),g=u.match(d);if(!g)return;let h=g[1]||"",b=n(h);if(!i.find(v=>!(v in b)))return {type:t,raw:g[0],attributes:b}}},renderMarkdown:u=>{let p=c(u.attrs||{}),m=o(p),d=m?` {${m}}`:"";return `:::${l}${d} :::`}}}function Gw(e){let{nodeName:t,name:r,getContent:n,parseAttributes:o=Ml,serializeAttributes:a=Sl,defaultAttributes:i={},content:s="block",allowedAttributes:l}=e,c=r||t,u=p=>{if(!l)return p;let m={};return l.forEach(d=>{d in p&&(m[d]=p[d]);}),m};return {parseMarkdown:(p,m)=>{let d;if(n){let h=n(p);d=typeof h=="string"?[{type:"text",text:h}]:h;}else s==="block"?d=m.parseChildren(p.tokens||[]):d=m.parseInline(p.tokens||[]);let g={...i,...p.attributes};return m.createNode(t,g,d)},markdownTokenizer:{name:t,level:"block",start(p){var m;let d=new RegExp(`^:::${c}`,"m"),g=(m=p.match(d))==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,m,d){var g;let h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=p.match(h);if(!b)return;let[y,v=""]=b,N=o(v),x=1,w=y.length,L="",P=/^:::([\w-]*)(\s.*)?/gm,A=p.slice(w);for(P.lastIndex=0;;){let D=P.exec(A);if(D===null)break;let S=D.index,C=D[1];if(!((g=D[2])!=null&&g.endsWith(":::"))){if(C)x+=1;else if(x-=1,x===0){let I=A.slice(0,S);L=I.trim();let k=p.slice(0,w+S+D[0].length),M=[];if(L)if(s==="block")for(M=d.blockTokens(I),M.forEach(R=>{R.text&&(!R.tokens||R.tokens.length===0)&&(R.tokens=d.inlineTokens(R.text));});M.length>0;){let R=M[M.length-1];if(R.type==="paragraph"&&(!R.text||R.text.trim()===""))M.pop();else break}else M=d.inlineTokens(L);return {type:t,raw:k,attributes:N,content:L,tokens:M}}}}}},renderMarkdown:(p,m)=>{let d=u(p.attrs||{}),g=a(d),h=g?` {${g}}`:"",b=m.renderChildren(p.content||[],`
|
|
87
87
|
|
|
88
88
|
`);return `:::${c}${h}
|
|
89
89
|
|
|
90
90
|
${b}
|
|
91
91
|
|
|
92
|
-
:::`}}}function
|
|
92
|
+
:::`}}}function qw(e){if(!e.trim())return {};let t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,n=r.exec(e);for(;n!==null;){let[,o,a,i]=n;t[o]=a||i,n=r.exec(e);}return t}function Jw(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t}="${r}"`).join(" ")}function Qw(e){let{nodeName:t,name:r,getContent:n,parseAttributes:o=qw,serializeAttributes:a=Jw,defaultAttributes:i={},selfClosing:s=false,allowedAttributes:l}=e,c=r||t,u=m=>{if(!l)return m;let d={};return l.forEach(g=>{let h=typeof g=="string"?g:g.name,b=typeof g=="string"?void 0:g.skipIfDefault;if(h in m){let y=m[h];if(b!==void 0&&y===b)return;d[h]=y;}}),d},p=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return {parseMarkdown:(m,d)=>{let g={...i,...m.attributes};if(s)return d.createNode(t,g);let h=n?n(m):m.content||"";return h?d.createNode(t,g,[d.createTextNode(h)]):d.createNode(t,g,[])},markdownTokenizer:{name:t,level:"inline",start(m){let d=s?new RegExp(`\\[${p}\\s*[^\\]]*\\]`):new RegExp(`\\[${p}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${p}\\]`),g=m.match(d),h=g?.index;return h!==void 0?h:-1},tokenize(m,d,g){let h=s?new RegExp(`^\\[${p}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${p}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${p}\\]`),b=m.match(h);if(!b)return;let y="",v="";if(s){let[,x]=b;v=x;}else {let[,x,w]=b;v=x,y=w||"";}let N=o(v.trim());return {type:t,raw:b[0],content:y.trim(),attributes:N}}},renderMarkdown:m=>{let d="";n?d=n(m):m.content&&m.content.length>0&&(d=m.content.filter(y=>y.type==="text").map(y=>y.text).join(""));let g=u(m.attrs||{}),h=a(g),b=h?` ${h}`:"";return s?`[${c}${b}]`:`[${c}${b}]${d}[/${c}]`}}}function Zw(e,t,r){var n,o,a,i;let s=e.split(`
|
|
93
93
|
`),l=[],c="",u=0,p=t.baseIndentSize||2;for(;u<s.length;){let m=s[u],d=m.match(t.itemPattern);if(!d){if(l.length>0)break;if(m.trim()===""){u+=1,c=`${c}${m}
|
|
94
94
|
`;continue}else return}let g=t.extractItemData(d),{indentLevel:h,mainContent:b}=g;c=`${c}${m}
|
|
95
95
|
`;let y=[b];for(u+=1;u<s.length;){let w=s[u];if(w.trim()===""){let P=s.slice(u+1).findIndex(S=>S.trim()!=="");if(P===-1)break;if((((o=(n=s[u+1+P].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:o.length)||0)>h){y.push(w),c=`${c}${w}
|
|
96
96
|
`,u+=1;continue}else break}if((((i=(a=w.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:i.length)||0)>h)y.push(w),c=`${c}${w}
|
|
97
97
|
`,u+=1;else break}let v,N=y.slice(1);if(N.length>0){let w=N.map(L=>L.slice(h+p)).join(`
|
|
98
|
-
`);w.trim()&&(t.customNestedParser?v=t.customNestedParser(w):v=r.blockTokens(w));}let x=t.createToken(g,v);l.push(x);}if(l.length!==0)return {items:l,raw:c}}function
|
|
98
|
+
`);w.trim()&&(t.customNestedParser?v=t.customNestedParser(w):v=r.blockTokens(w));}let x=t.createToken(g,v);l.push(x);}if(l.length!==0)return {items:l,raw:c}}function ek(e,t,r,n){if(!e||!Array.isArray(e.content))return "";let o=typeof r=="function"?r(n):r,[a,...i]=e.content,s=t.renderChildren([a]),l=`${o}${s}`;return i&&i.length>0&&i.forEach((c,u)=>{var p,m;let d=(m=(p=t.renderChild)==null?void 0:p.call(t,c,u+1))!=null?m:t.renderChildren([c]);if(d!=null){let g=d.split(`
|
|
99
99
|
`).map(h=>h?t.indent(h):t.indent("")).join(`
|
|
100
100
|
`);l+=c.type==="paragraph"?`
|
|
101
101
|
|
|
102
102
|
${g}`:`
|
|
103
|
-
${g}`;}}),l}var Pl=class op extends Nl{constructor(){super(...arguments),this.type="node";}static create(t={}){let r=typeof t=="function"?t():t;return new op(r)}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}};var Zw=20,ap=(e,t=0)=>{let r=[];return !e.children.length||t>Zw||Array.from(e.children).forEach(n=>{n.tagName==="SPAN"?r.push(n):n.children.length&&r.push(...ap(n,t+1));}),r},ek=e=>{if(!e.children.length)return;let t=ap(e);t&&t.forEach(r=>{var n,o;let a=r.getAttribute("style"),i=(o=(n=r.parentElement)==null?void 0:n.closest("span"))==null?void 0:o.getAttribute("style");r.setAttribute("style",`${i};${a}`);});},Rl=Cl.create({name:"textStyle",priority:101,addOptions(){return {HTMLAttributes:{},mergeNestedSpanStyles:true}},parseHTML(){return [{tag:"span",consuming:false,getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&ek(e),{}):false}]},renderHTML({HTMLAttributes:e}){return ["span",Nn(this.options.HTMLAttributes,e),0]},addCommands(){return {toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(r,n)=>{if(r.isTextblock)return true;r.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(a=>!!a))||e.removeMark(n,n+r.nodeSize,this.type);}),true}}}}),tk=Ke.create({name:"backgroundColor",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;let r=e.getAttribute("style");if(r){let n=r.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){let a=n[o].split(":");if(a.length>=2){let i=a[0].trim().toLowerCase(),s=a.slice(1).join(":").trim();if(i==="background-color")return s.replace(/['"]+/g,"")}}}return (t=e.style.backgroundColor)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return {setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),rk=Ke.create({name:"color",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;let r=e.getAttribute("style");if(r){let n=r.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){let a=n[o].split(":");if(a.length>=2){let i=a[0].trim().toLowerCase(),s=a.slice(1).join(":").trim();if(i==="color")return s.replace(/['"]+/g,"")}}}return (t=e.style.color)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return {setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),nk=Ke.create({name:"fontFamily",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return {setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),ok=Ke.create({name:"fontSize",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return {setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),ak=Ke.create({name:"lineHeight",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return {setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Ke.create({name:"textStyleKit",addExtensions(){let e=[];return this.options.backgroundColor!==false&&e.push(tk.configure(this.options.backgroundColor)),this.options.color!==false&&e.push(rk.configure(this.options.color)),this.options.fontFamily!==false&&e.push(nk.configure(this.options.fontFamily)),this.options.fontSize!==false&&e.push(ok.configure(this.options.fontSize)),this.options.lineHeight!==false&&e.push(ak.configure(this.options.lineHeight)),this.options.textStyle!==false&&e.push(Rl.configure(this.options.textStyle)),e}});function sk({node:e,updateAttributes:t,selected:r}){let n=useRef(null),[o,a]=useState(false),i=useRef({x:0,width:0}),{src:s,alt:l,title:c}=e.attrs,u=e.attrs.width;function p(m){m.preventDefault(),m.stopPropagation();let d=n.current?.offsetWidth??(typeof u=="number"?u:200);i.current={x:m.clientX,width:d},a(true);}return useEffect(()=>{if(!o)return;function m(g){let h=g.clientX-i.current.x,b=Math.max(60,Math.round(i.current.width+h));t({width:b,height:null});}function d(){a(false);}return document.addEventListener("mousemove",m),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",d);}},[o,t]),jsxs(NodeViewWrapper,{as:"span",className:`rte-image-wrapper${r?" rte-image-wrapper--selected":""}`,children:[jsx("img",{ref:n,src:s,alt:l??"",title:c??"",draggable:false,style:{display:"block",maxWidth:"100%",width:u?`${u}px`:void 0,cursor:o?"ew-resize":"default"}}),r&&jsxs(Fragment,{children:[jsx("span",{className:"rte-rh rte-rh--nw"}),jsx("span",{className:"rte-rh rte-rh--ne"}),jsx("span",{className:"rte-rh rte-rh--sw"}),jsx("span",{className:"rte-rh rte-rh--se",onMouseDown:p,title:"Drag to resize",role:"separator","aria-label":"Resize image"}),jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:p,title:"Drag to resize",role:"separator","aria-label":"Resize image"}),u&&jsxs("span",{className:"rte-image-size-label","aria-live":"polite",children:[u,"px"]})]})]})}var ip=ik.extend({name:"image",addAttributes(){return {...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute("width");return t?parseInt(t,10):null},renderHTML:e=>e.width?{width:e.width,style:`width:${e.width}px;`}:{}},height:{default:null,parseHTML:e=>{let t=e.getAttribute("height");return t?parseInt(t,10):null},renderHTML:e=>e.height?{height:e.height}:{}}}},addNodeView(){return ReactNodeViewRenderer(sk)}}).configure({inline:true,allowBase64:true});function lk({node:e,updateAttributes:t,selected:r}){let n=useRef(null),[o,a]=useState(false),i=useRef({x:0,width:0}),{src:s}=e.attrs,l=e.attrs.width;function c(u){u.preventDefault(),u.stopPropagation();let p=n.current?.offsetWidth??(typeof l=="number"?l:320);i.current={x:u.clientX,width:p},a(true);}return useEffect(()=>{if(!o)return;function u(m){let d=m.clientX-i.current.x,g=Math.max(120,Math.round(i.current.width+d));t({width:g});}function p(){a(false);}return document.addEventListener("mousemove",u),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p);}},[o,t]),jsx(NodeViewWrapper,{as:"div",className:`rte-video-wrapper${r?" rte-video-wrapper--selected":""}`,children:jsxs("div",{ref:n,style:{display:"inline-block",maxWidth:"100%",width:l?`${l}px`:"100%",position:"relative"},children:[jsx("video",{src:s,controls:true,style:{display:"block",width:"100%",maxWidth:"100%"}}),r&&jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:c,title:"Drag to resize",role:"separator","aria-label":"Resize video"})]})})}var sp=Pl.create({name:"resizableVideo",group:"block",atom:true,draggable:true,addAttributes(){return {src:{default:null},width:{default:null,parseHTML:e=>{let t=e.getAttribute("data-width");return t?parseInt(t,10):null},renderHTML:e=>e.width?{"data-width":e.width}:{}}}},parseHTML(){return [{tag:"div[data-type=resizable-video]"}]},renderHTML({HTMLAttributes:e}){return ["div",Nn({"data-type":"resizable-video"},e)]},addNodeView(){return ReactNodeViewRenderer(lk)}});function ck({node:e,updateAttributes:t,selected:r}){let n=useRef(null),[o,a]=useState(false),i=useRef({x:0,width:0}),{src:s}=e.attrs,l=e.attrs.width??480,c=e.attrs.height??Math.round(l*9/16);function u(p){p.preventDefault(),p.stopPropagation();let m=n.current?.offsetWidth??l;i.current={x:p.clientX,width:m},a(true);}return useEffect(()=>{if(!o)return;function p(d){let g=d.clientX-i.current.x,h=Math.max(160,Math.round(i.current.width+g));t({width:h,height:Math.round(h*9/16)});}function m(){a(false);}return document.addEventListener("mousemove",p),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m);}},[o,t]),jsx(NodeViewWrapper,{as:"div",className:`rte-embed-wrapper${r?" rte-embed-wrapper--selected":""}`,children:jsxs("div",{ref:n,style:{display:"inline-block",position:"relative",width:`${l}px`,maxWidth:"100%"},children:[jsx("iframe",{src:s,width:l,height:c,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation",title:"Embedded video",style:{display:"block",border:"none",maxWidth:"100%"}}),r&&jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:u,title:"Drag to resize",role:"separator","aria-label":"Resize embed"})]})})}var lp=Pl.create({name:"embedFrame",group:"block",atom:true,draggable:true,addAttributes(){return {src:{default:null},width:{default:480},height:{default:270}}},parseHTML(){return [{tag:"div[data-type=embed-frame]"}]},renderHTML({HTMLAttributes:e}){return ["div",Nn({"data-type":"embed-frame"},e)]},addNodeView(){return ReactNodeViewRenderer(ck)}});function ko(e){return marked.parse(e,{async:false})}function ai(e){return e.replace(/<h1[^>]*>([\s\S]*?)<\/h1>/gi,`# $1
|
|
103
|
+
${g}`;}}),l}var Pl=class op extends Nl{constructor(){super(...arguments),this.type="node";}static create(t={}){let r=typeof t=="function"?t():t;return new op(r)}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}};var rk=20,ap=(e,t=0)=>{let r=[];return !e.children.length||t>rk||Array.from(e.children).forEach(n=>{n.tagName==="SPAN"?r.push(n):n.children.length&&r.push(...ap(n,t+1));}),r},nk=e=>{if(!e.children.length)return;let t=ap(e);t&&t.forEach(r=>{var n,o;let a=r.getAttribute("style"),i=(o=(n=r.parentElement)==null?void 0:n.closest("span"))==null?void 0:o.getAttribute("style");r.setAttribute("style",`${i};${a}`);});},Rl=Cl.create({name:"textStyle",priority:101,addOptions(){return {HTMLAttributes:{},mergeNestedSpanStyles:true}},parseHTML(){return [{tag:"span",consuming:false,getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&nk(e),{}):false}]},renderHTML({HTMLAttributes:e}){return ["span",Nn(this.options.HTMLAttributes,e),0]},addCommands(){return {toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(r,n)=>{if(r.isTextblock)return true;r.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(a=>!!a))||e.removeMark(n,n+r.nodeSize,this.type);}),true}}}}),ok=Ke.create({name:"backgroundColor",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;let r=e.getAttribute("style");if(r){let n=r.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){let a=n[o].split(":");if(a.length>=2){let i=a[0].trim().toLowerCase(),s=a.slice(1).join(":").trim();if(i==="background-color")return s.replace(/['"]+/g,"")}}}return (t=e.style.backgroundColor)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return {setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),ak=Ke.create({name:"color",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;let r=e.getAttribute("style");if(r){let n=r.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){let a=n[o].split(":");if(a.length>=2){let i=a[0].trim().toLowerCase(),s=a.slice(1).join(":").trim();if(i==="color")return s.replace(/['"]+/g,"")}}}return (t=e.style.color)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return {setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),ik=Ke.create({name:"fontFamily",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return {setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),sk=Ke.create({name:"fontSize",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return {setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),lk=Ke.create({name:"lineHeight",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return {setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Ke.create({name:"textStyleKit",addExtensions(){let e=[];return this.options.backgroundColor!==false&&e.push(ok.configure(this.options.backgroundColor)),this.options.color!==false&&e.push(ak.configure(this.options.color)),this.options.fontFamily!==false&&e.push(ik.configure(this.options.fontFamily)),this.options.fontSize!==false&&e.push(sk.configure(this.options.fontSize)),this.options.lineHeight!==false&&e.push(lk.configure(this.options.lineHeight)),this.options.textStyle!==false&&e.push(Rl.configure(this.options.textStyle)),e}});function dk({node:e,updateAttributes:t,selected:r}){let n=useRef(null),[o,a]=useState(false),i=useRef({x:0,width:0}),{src:s,alt:l,title:c}=e.attrs,u=e.attrs.width;function p(m){m.preventDefault(),m.stopPropagation();let d=n.current?.offsetWidth??(typeof u=="number"?u:200);i.current={x:m.clientX,width:d},a(true);}return useEffect(()=>{if(!o)return;function m(g){let h=g.clientX-i.current.x,b=Math.max(60,Math.round(i.current.width+h));t({width:b,height:null});}function d(){a(false);}return document.addEventListener("mousemove",m),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",d);}},[o,t]),jsxs(NodeViewWrapper,{as:"span",className:`rte-image-wrapper${r?" rte-image-wrapper--selected":""}`,children:[jsx("img",{ref:n,src:s,alt:l??"",title:c??"",draggable:false,style:{display:"block",maxWidth:"100%",width:u?`${u}px`:void 0,cursor:o?"ew-resize":"default"}}),r&&jsxs(Fragment,{children:[jsx("span",{className:"rte-rh rte-rh--nw"}),jsx("span",{className:"rte-rh rte-rh--ne"}),jsx("span",{className:"rte-rh rte-rh--sw"}),jsx("span",{className:"rte-rh rte-rh--se",onMouseDown:p,title:"Drag to resize",role:"separator","aria-label":"Resize image"}),jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:p,title:"Drag to resize",role:"separator","aria-label":"Resize image"}),u&&jsxs("span",{className:"rte-image-size-label","aria-live":"polite",children:[u,"px"]})]})]})}var ip=ck.extend({name:"image",addAttributes(){return {...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute("width");return t?parseInt(t,10):null},renderHTML:e=>e.width?{width:e.width,style:`width:${e.width}px;`}:{}},height:{default:null,parseHTML:e=>{let t=e.getAttribute("height");return t?parseInt(t,10):null},renderHTML:e=>e.height?{height:e.height}:{}}}},addNodeView(){return ReactNodeViewRenderer(dk)}}).configure({inline:true,allowBase64:true});function uk({node:e,updateAttributes:t,selected:r}){let n=useRef(null),[o,a]=useState(false),i=useRef({x:0,width:0}),{src:s}=e.attrs,l=e.attrs.width;function c(u){u.preventDefault(),u.stopPropagation();let p=n.current?.offsetWidth??(typeof l=="number"?l:320);i.current={x:u.clientX,width:p},a(true);}return useEffect(()=>{if(!o)return;function u(m){let d=m.clientX-i.current.x,g=Math.max(120,Math.round(i.current.width+d));t({width:g});}function p(){a(false);}return document.addEventListener("mousemove",u),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p);}},[o,t]),jsx(NodeViewWrapper,{as:"div",className:`rte-video-wrapper${r?" rte-video-wrapper--selected":""}`,children:jsxs("div",{ref:n,style:{display:"inline-block",maxWidth:"100%",width:l?`${l}px`:"100%",position:"relative"},children:[jsx("video",{src:s,controls:true,style:{display:"block",width:"100%",maxWidth:"100%"}}),r&&jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:c,title:"Drag to resize",role:"separator","aria-label":"Resize video"})]})})}var sp=Pl.create({name:"resizableVideo",group:"block",atom:true,draggable:true,addAttributes(){return {src:{default:null},width:{default:null,parseHTML:e=>{let t=e.getAttribute("data-width");return t?parseInt(t,10):null},renderHTML:e=>e.width?{"data-width":e.width}:{}}}},parseHTML(){return [{tag:"div[data-type=resizable-video]"}]},renderHTML({HTMLAttributes:e}){return ["div",Nn({"data-type":"resizable-video"},e)]},addNodeView(){return ReactNodeViewRenderer(uk)}});function pk({node:e,updateAttributes:t,selected:r}){let n=useRef(null),[o,a]=useState(false),i=useRef({x:0,width:0}),{src:s}=e.attrs,l=e.attrs.width??480,c=e.attrs.height??Math.round(l*9/16);function u(p){p.preventDefault(),p.stopPropagation();let m=n.current?.offsetWidth??l;i.current={x:p.clientX,width:m},a(true);}return useEffect(()=>{if(!o)return;function p(d){let g=d.clientX-i.current.x,h=Math.max(160,Math.round(i.current.width+g));t({width:h,height:Math.round(h*9/16)});}function m(){a(false);}return document.addEventListener("mousemove",p),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m);}},[o,t]),jsx(NodeViewWrapper,{as:"div",className:`rte-embed-wrapper${r?" rte-embed-wrapper--selected":""}`,children:jsxs("div",{ref:n,style:{display:"inline-block",position:"relative",width:`${l}px`,maxWidth:"100%"},children:[jsx("iframe",{src:s,width:l,height:c,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation",title:"Embedded video",style:{display:"block",border:"none",maxWidth:"100%"}}),r&&jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:u,title:"Drag to resize",role:"separator","aria-label":"Resize embed"})]})})}var lp=Pl.create({name:"embedFrame",group:"block",atom:true,draggable:true,addAttributes(){return {src:{default:null},width:{default:480},height:{default:270}}},parseHTML(){return [{tag:"div[data-type=embed-frame]"}]},renderHTML({HTMLAttributes:e}){return ["div",Nn({"data-type":"embed-frame"},e)]},addNodeView(){return ReactNodeViewRenderer(pk)}});function ko(e){return marked.parse(e,{async:false})}function ai(e){return e.replace(/<h1[^>]*>([\s\S]*?)<\/h1>/gi,`# $1
|
|
104
104
|
|
|
105
105
|
`).replace(/<h2[^>]*>([\s\S]*?)<\/h2>/gi,`## $1
|
|
106
106
|
|
|
@@ -124,5 +124,5 @@ ${g}`;}}),l}var Pl=class op extends Nl{constructor(){super(...arguments),this.ty
|
|
|
124
124
|
|
|
125
125
|
`).replace(/<[^>]+>/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/ /g," ").replace(/\n{3,}/g,`
|
|
126
126
|
|
|
127
|
-
`).trim()}function Il(e){return e.trim()?e.trim().split(/\s+/).length:0}function zl(e,t,r=false){if(!t)return [];let n=[],o=r?"g":"gi",a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(a,o);return e.descendants((s,l)=>{if(!s.isText||!s.text)return;let c;for(i.lastIndex=0;(c=i.exec(s.text))!==null;)n.push({from:l+c.index,to:l+c.index+c[0].length});}),n}function ii(e,t,r=false){if(!t)return [];let n=r?"g":"gi",o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(o,n),i=[],s;for(;(s=a.exec(e))!==null;)i.push([s.index,s.index+s[0].length]);return i}var Pt=new PluginKey("rteSearch"),Dk=Ke.create({name:"rteSearch",addProseMirrorPlugins(){return [new Plugin({key:Pt,state:{init(){return {query:"",caseSensitive:false,currentIndex:0,matches:[]}},apply(e,t){let r=e.getMeta(Pt);if(r){let n={...t,...r};return n.matches=zl(e.doc,n.query,n.caseSensitive),n.currentIndex>=n.matches.length&&(n.currentIndex=0),n}if(e.docChanged&&t.query){let n=zl(e.doc,t.query,t.caseSensitive),o=Math.min(t.currentIndex,Math.max(0,n.length-1));return {...t,matches:n,currentIndex:o}}return t}},props:{decorations(e){let t=Pt.getState(e);if(!t?.query||!t.matches.length)return DecorationSet.empty;let r=t.matches.map((n,o)=>Decoration.inline(n.from,n.to,{class:o===t.currentIndex?"rte-search-current":"rte-search-match"}));return DecorationSet.create(e.doc,r)}}})]}});function dp(e){return useEditor({extensions:[gk,bk,yk.configure({types:["heading","paragraph"]}),Rl,Color,xk.configure({multicolor:true}),ip,sp,lp,wk.configure({openOnClick:false}),kk.configure({width:480,height:320}),Nk.configure({placeholder:e.placeholder??"Start typing\u2026"}),Ck,Mk,Tk,Sk,Table$1.configure({resizable:true}),Rk,Ek,Lk,Dk],content:e.defaultValue??"",editable:!e.readOnly,autofocus:e.autoFocus,onUpdate:({editor:r})=>{e.onChange?.({html:r.getHTML(),markdown:"",json:r.getJSON(),text:r.getText()});}})}var M1={tab_home:"Home",tab_insert:"Insert",tab_format:"Format",group_clipboard:"Clipboard",undo:"Undo",redo:"Redo",save:"Save",group_text:"Text",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",group_headings:"Headings",h1:"H1",h2:"H2",h3:"H3",paragraph:"Normal",group_alignment:"Alignment",alignLeft:"Left",alignCenter:"Center",alignRight:"Right",alignJustify:"Justify",group_lists:"Lists",bulletList:"Bullet",orderedList:"Ordered",group_media:"Media",image:"Image",video:"Video",youtube:"Video",group_content:"Content",link:"Link",table:"Table",codeBlock:"Code Block",blockquote:"Quote",divider:"Divider",group_style:"Style",color:"Color",highlight:"Highlight",subscript:"Sub",superscript:"Sup",group_reset:"Reset",clear:"Clear",group_table_rows:"Rows",addRowBefore:"Add Above",addRowAfter:"Add Below",deleteRow:"Del Row",group_table_cols:"Columns",addColBefore:"Add Left",addColAfter:"Add Right",deleteColumn:"Del Col",group_table_cells:"Cells",mergeCells:"Merge",splitCell:"Split",deleteTable:"Del Table"};function nr({icon:e,label:t,onClick:r,disabled:n=false,title:o}){return jsxs("button",{type:"button",className:f("rte-tbar-btn",n&&"rte-tbar-btn--disabled"),onClick:r,disabled:n,title:o??t,children:[e,jsx("span",{className:"rte-tbar-label",children:t})]})}function T1({editor:e,L:t,readOnly:r}){let[,n]=useState(0),[o,a]=useState(null),i=useRef(null);if(useEffect(()=>{if(!e)return;let u=()=>n(p=>p+1);return e.on("selectionUpdate",u),e.on("transaction",u),()=>{e.off("selectionUpdate",u),e.off("transaction",u);}},[e]),useEffect(()=>{if(!o)return;function u(p){i.current&&!i.current.contains(p.target)&&a(null);}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),!e||r||!e.isActive("table"))return null;let s=e.can().mergeCells(),l=e.can().splitCell();function c(){l?e.chain().focus().splitCell().run():a(u=>u?null:"col");}return jsxs("div",{className:"rte-tablebar",role:"toolbar","aria-label":"Table editing",children:[jsx("span",{className:"rte-tbar-group-label",children:t.group_table_rows}),jsx(nr,{icon:jsx(BetweenHorizontalStart,{size:13}),label:t.addRowBefore,onClick:()=>e.chain().focus().addRowBefore().run()}),jsx(nr,{icon:jsx(BetweenHorizontalEnd,{size:13}),label:t.addRowAfter,onClick:()=>e.chain().focus().addRowAfter().run()}),jsx(nr,{icon:jsx(Trash2,{size:13}),label:t.deleteRow,onClick:()=>e.chain().focus().deleteRow().run()}),jsx("div",{className:"rte-tbar-sep"}),jsx("span",{className:"rte-tbar-group-label",children:t.group_table_cols}),jsx(nr,{icon:jsx(BetweenVerticalStart,{size:13}),label:t.addColBefore,onClick:()=>e.chain().focus().addColumnBefore().run()}),jsx(nr,{icon:jsx(BetweenVerticalEnd,{size:13}),label:t.addColAfter,onClick:()=>e.chain().focus().addColumnAfter().run()}),jsx(nr,{icon:jsx(Trash2,{size:13}),label:t.deleteColumn,onClick:()=>e.chain().focus().deleteColumn().run()}),jsx("div",{className:"rte-tbar-sep"}),jsx("span",{className:"rte-tbar-group-label",children:t.group_table_cells}),jsx(nr,{icon:jsx(TableCellsMerge,{size:13}),label:t.mergeCells,onClick:()=>e.chain().focus().mergeCells().run(),disabled:!s,title:s?t.mergeCells:`${t.mergeCells} (Shift+click to select cells)`}),jsxs("div",{className:"rte-tbar-split-wrap",ref:i,children:[jsx(nr,{icon:jsx(TableCellsSplit,{size:13}),label:l?t.splitCell:`${t.splitCell}\u2026`,onClick:c,title:l?t.splitCell:"Split by adding a column or row"}),o&&!l&&jsxs("div",{className:"rte-tbar-split-picker",children:[jsxs("button",{className:"rte-tbar-split-pick-btn",onClick:()=>{e.chain().focus().addColumnAfter().run(),a(null);},children:[jsx(BetweenVerticalEnd,{size:13}),"Split column"]}),jsxs("button",{className:"rte-tbar-split-pick-btn",onClick:()=>{e.chain().focus().addRowAfter().run(),a(null);},children:[jsx(BetweenHorizontalEnd,{size:13}),"Split row"]})]})]}),jsx("div",{className:"rte-tbar-sep"}),jsx(nr,{icon:jsx(Trash2,{size:13}),label:t.deleteTable,onClick:()=>e.chain().focus().deleteTable().run()})]})}function Hl({open:e,onClose:t,children:r}){let n=useRef(null);return useEffect(()=>{if(!e)return;function o(a){n.current&&!n.current.contains(a.target)&&t();}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t]),e?jsx("div",{ref:n,className:"rte-inline-dialog",children:r}):null}function S1({mode:e,onClose:t,onFind:r,onPrev:n,onNext:o,onReplace:a,onReplaceAll:i,matchCount:s,currentIndex:l}){let[c,u]=On.useState(""),[p,m]=On.useState(""),[d,g]=On.useState(false),h=On.useRef(null);useEffect(()=>{h.current?.focus();},[]);function b(w){let L=w.target.value;u(L),r(L,d);}function y(){let w=!d;g(w),r(c,w);}function v(w){if(w.key==="Escape"){t();return}w.key==="Enter"&&(w.shiftKey?n():o());}let N=s>0,x=c?N?`${l+1} / ${s}`:"No results":"";return jsxs("div",{className:"rte-findbar",role:"search","aria-label":"Find and replace",children:[jsxs("div",{className:"rte-findbar-row",children:[jsx(Search,{size:14,className:"rte-findbar-icon"}),jsx("input",{ref:h,className:"rte-findbar-input",value:c,onChange:b,onKeyDown:v,placeholder:"Find\u2026","aria-label":"Find",spellCheck:false}),jsx("button",{className:f("rte-findbar-btn",d&&"rte-findbar-btn--active"),onClick:y,title:"Match case","aria-pressed":d,children:"Aa"}),jsx("span",{className:"rte-findbar-count",children:x}),jsx("button",{className:"rte-findbar-btn",onClick:n,disabled:!N,title:"Previous match (Shift+Enter)","aria-label":"Previous match",children:jsx(ChevronUp,{size:14})}),jsx("button",{className:"rte-findbar-btn",onClick:o,disabled:!N,title:"Next match (Enter)","aria-label":"Next match",children:jsx(ChevronDown,{size:14})}),jsx("button",{className:"rte-findbar-btn rte-findbar-btn--close",onClick:t,title:"Close (Esc)","aria-label":"Close find bar",children:jsx(X,{size:14})})]}),e==="replace"&&jsxs("div",{className:"rte-findbar-row",children:[jsx(Replace,{size:14,className:"rte-findbar-icon"}),jsx("input",{className:"rte-findbar-input",value:p,onChange:w=>m(w.target.value),onKeyDown:w=>w.key==="Escape"&&t(),placeholder:"Replace with\u2026","aria-label":"Replace with",spellCheck:false}),jsx("button",{className:"rte-findbar-btn rte-findbar-btn--action",onClick:()=>a(p),disabled:!N,title:"Replace current",children:"Replace"}),jsx("button",{className:"rte-findbar-btn rte-findbar-btn--action",onClick:()=>i(p),disabled:!N,title:"Replace all",children:"All"})]})]})}var Co=forwardRef(function(t,r){let{mode:n,defaultMode:o="richtext",onModeChange:a,showPreview:i,defaultShowPreview:s=false,onPreviewChange:l,defaultValue:c="",value:u,onChange:p,placeholder:m="Start typing\u2026",readOnly:d=false,height:g=400,minHeight:h,maxHeight:b,showWordCount:y=true,showCharCount:v=true,onImageUpload:N,allowedImageTypes:x,maxImageSize:w,autoFocus:L=false,spellCheck:P=true,className:A,style:D,labels:S,extraRibbonGroups:C,extraRibbonTabs:I,onSave:k}=t,T={...M1,...S},[R,O]=useState(o),E=n??R;function ne(ee){if(ee!==E){if(ee==="markdown"){let ae=j?.getHTML()??re;F(ai(ae));}else {let ae=ko(M);W(ae),j?.commands.setContent(ae);}n===void 0&&O(ee),a?.(ee);}}let[U,z]=useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:false);function H(ee){z(ee),ee?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");}useEffect(()=>{H(U);let ee=window.matchMedia("(prefers-color-scheme: dark)");function ae(Ie){z(Ie.matches),H(Ie.matches);}return ee.addEventListener("change",ae),()=>ee.removeEventListener("change",ae)},[]);let[_,V]=useState(s),oe=i??_;function be(ee){let ae=ee??!oe;i===void 0&&V(ae),l?.(ae);}let[M,F]=useState(E==="markdown"?u??c:""),[re,W]=useState(E==="richtext"?u??c??"":""),[G,le]=useState(false),[ke,B]=useState(""),[q,Z]=useState(false),[ue,te]=useState(""),[ve,Ne]=useState(false),[X,de]=useState(""),[Q,ie]=useState(null),[Pe,Oe]=useState(null),[Xe,se]=useState(0),[Re,K]=useState(0),[ce,me]=useState(""),J=useRef(null),Ce=useRef(null),Ye=useRef(null);useEffect(()=>{function ee(ae){!(ae.metaKey||ae.ctrlKey)||ae.key.toLowerCase()!=="f"||Ce.current?.contains(ae.target)&&(ae.preventDefault(),ae.shiftKey?Oe(ze=>ze==="replace"?null:"replace"):Oe(ze=>ze!==null?null:"find"));}return document.addEventListener("keydown",ee,true),()=>document.removeEventListener("keydown",ee,true)},[]);function vt(ee){let ae=ee.trim();if(/\.(mp4|webm|ogg|ogv|mov|m4v|flv|mkv)(\?[^#]*)?$/i.test(ae))return {kind:"video"};if(/(?:youtube\.com|youtu\.be|youtube-nocookie\.com)/.test(ae))return {kind:"youtube"};let Ie=ae.match(/vimeo\.com\/(?:video\/)?(\d+)/);if(Ie)return {kind:"iframe",embedUrl:`https://player.vimeo.com/video/${Ie[1]}`};let ze=ae.match(/bilibili\.com\/video\/(BV[\w]+|av\d+)/i);if(ze)return {kind:"iframe",embedUrl:`https://player.bilibili.com/player.html?bvid=${ze[1]}&high_quality=1&danmaku=0`};let Je=ae.match(/dailymotion\.com\/(?:video\/|embed\/video\/)([a-z0-9]+)/i);if(Je)return {kind:"iframe",embedUrl:`https://www.dailymotion.com/embed/video/${Je[1]}`};let tt=ae.match(/twitch\.tv\/\w+\/clip\/([\w-]+)/);if(tt){let ft=typeof window<"u"?window.location.hostname:"localhost";return {kind:"iframe",embedUrl:`https://clips.twitch.tv/embed?clip=${tt[1]}&parent=${ft}`}}return null}function Wr(){let ee=X.trim();if(!ee)return;let ae=vt(ee);if(!ae){ie("Unsupported URL. Paste a YouTube, Vimeo, Bilibili, Dailymotion, or direct .mp4/.webm link.");return}ae.kind==="youtube"?j?.chain().focus().setYoutubeVideo({src:ee}).run():ae.kind==="iframe"?j?.chain().focus().insertContent({type:"embedFrame",attrs:{src:ae.embedUrl}}).run():j?.chain().focus().insertContent({type:"resizableVideo",attrs:{src:ee}}).run(),de(""),ie(null),Ne(false);}function $(ee,ae){j&&j.view.dispatch(j.view.state.tr.setMeta(Pt,{query:ee,caseSensitive:ae,currentIndex:0}));}function ge(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=ae.matches.length,ze=((ae.currentIndex+ee)%Ie+Ie)%Ie;j.view.dispatch(j.view.state.tr.setMeta(Pt,{currentIndex:ze}));let Je=ae.matches[ze];Je&&(j.commands.setTextSelection({from:Je.from,to:Je.to}),j.commands.scrollIntoView());}function Le(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=ae.matches[ae.currentIndex];Ie&&(j.chain().setTextSelection({from:Ie.from,to:Ie.to}).insertContent(ee).run(),$(ae.query,ae.caseSensitive));}function De(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=j.chain();[...ae.matches].reverse().forEach(ze=>{Ie.setTextSelection({from:ze.from,to:ze.to}).insertContent(ee);}),Ie.run(),$(ae.query,ae.caseSensitive);}function He(ee,ae){me(ee);let Ie=ii(M,ee,ae);se(Ie.length),K(0);}function dt(ee,ae,Ie){let ze=ii(M,ae,Ie);if(!ze.length)return;let Je=ze.length,tt=((Re+ee)%Je+Je)%Je;K(tt);let ft=Ye.current;ft&&(ft.focus(),ft.setSelectionRange(ze[tt][0],ze[tt][1]));}function Gt(ee,ae,Ie){let ze=ii(M,ee,Ie);if(!ze.length)return;let[Je,tt]=ze[Re]??ze[0],ft=M.slice(0,Je)+ae+M.slice(tt);F(ft);}function Mo(ee,ae,Ie){let ze=ee.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Je=new RegExp(ze,"gi");F(tt=>tt.replace(Je,ae)),se(0),K(0);}let j=dp({defaultValue:E==="richtext"?u??c:"",placeholder:m,readOnly:d,autoFocus:E==="richtext"&&L,onChange:ee=>{W(ee.html),p?.({...ee,markdown:ai(ee.html)});}});useEffect(()=>{u!==void 0&&j&&E==="richtext"&&j.getHTML()!==u&&(j.commands.setContent(u),W(u));},[u,j,E]);let qt=j?Pt.getState(j.view.state):null,ir=E==="richtext"?qt?.matches.length??0:Xe,Sn=E==="richtext"?qt?.currentIndex??0:Re;function Yr(){if(!k)return;let ee=E==="markdown"?M:j?.getHTML()??"";k(ee,E);}useEffect(()=>{if(!k)return;function ee(ae){!(ae.metaKey||ae.ctrlKey)||ae.key.toLowerCase()!=="s"||Ce.current?.contains(ae.target)&&(ae.preventDefault(),Yr());}return document.addEventListener("keydown",ee,true),()=>document.removeEventListener("keydown",ee,true)},[k,E,M,j]);function Tr(ee){let ae=ee.target.value;F(ae),p?.({html:ko(ae),markdown:ae,json:{},text:ae});}let Kp=useCallback(async ee=>{let Ie=Array.from(ee.clipboardData?.items??[]).find(tt=>tt.type.startsWith("image/"));if(!Ie)return;ee.preventDefault();let ze=Ie.getAsFile();if(!ze||x&&!x.includes(ze.type)||w&&ze.size>w)return;let Je;if(N?Je=await N(ze):Je=await new Promise(tt=>{let ft=new FileReader;ft.onload=()=>tt(ft.result),ft.readAsDataURL(ze);}),E==="richtext"&&j)j.chain().focus().setImage({src:Je}).run();else {let tt=ee.currentTarget.querySelector(".rte-markdown-source");if(tt){let ft=tt.selectionStart,Xp=``,Gp=M.slice(0,ft),qp=M.slice(ft);F(Gp+Xp+qp);}}},[E,j,M,N,x,w]);useImperativeHandle(r,()=>({getContent:()=>E==="markdown"?M:j?.getHTML()??"",getMode:()=>E,getHTML:()=>j?.getHTML()??"",getMarkdown:()=>E==="markdown"?M:ai(j?.getHTML()??""),getJSON:()=>j?.getJSON()??{},getText:()=>j?.getText()??"",setHTML:ee=>j?.commands.setContent(ee),setMarkdown:ee=>{F(ee),j?.commands.setContent(ko(ee));},setJSON:ee=>j?.commands.setContent(ee),clear:()=>{j?.commands.clearContent(),F("");},focus:()=>j?.commands.focus(),blur:()=>(j?.view.dom).blur()}));let jp=j?.storage?.characterCount?.characters?.()??M.length,Wp=E==="richtext"?Il(j?.getText()??""):Il(M),Yp=[...[{key:"home",label:T.tab_home,groups:[{key:"clipboard",label:T.group_clipboard,items:[{key:"undo",label:T.undo,icon:jsx(Undo2,{}),disabled:d||!j?.can().undo()||E==="markdown",onClick:()=>j?.chain().focus().undo().run()},{key:"redo",label:T.redo,icon:jsx(Redo2,{}),disabled:d||!j?.can().redo()||E==="markdown",onClick:()=>j?.chain().focus().redo().run()},{key:"save",label:T.save,icon:jsx(Save,{}),disabled:d||!k,onClick:Yr}]},{key:"text",label:T.group_text,items:[{key:"bold",label:T.bold,icon:jsx(Bold,{}),active:j?.isActive("bold"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBold().run()},{key:"italic",label:T.italic,icon:jsx(Italic,{}),active:j?.isActive("italic"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleItalic().run()},{key:"underline",label:T.underline,icon:jsx(Underline,{}),active:j?.isActive("underline"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleUnderline().run()},{key:"strike",label:T.strikethrough,icon:jsx(Strikethrough,{}),active:j?.isActive("strike"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleStrike().run()}]},{key:"headings",label:T.group_headings,items:[{key:"h1",label:T.h1,icon:jsx(Heading1,{}),active:j?.isActive("heading",{level:1}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:1}).run()},{key:"h2",label:T.h2,icon:jsx(Heading2,{}),active:j?.isActive("heading",{level:2}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:2}).run()},{key:"h3",label:T.h3,icon:jsx(Heading3,{}),active:j?.isActive("heading",{level:3}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:3}).run()},{key:"paragraph",label:T.paragraph,icon:jsx(Type,{}),active:j?.isActive("paragraph"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setParagraph().run()}]},{key:"alignment",label:T.group_alignment,items:[{key:"align-left",label:T.alignLeft,icon:jsx(AlignLeft,{}),active:j?.isActive({textAlign:"left"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("left").run()},{key:"align-center",label:T.alignCenter,icon:jsx(AlignCenter,{}),active:j?.isActive({textAlign:"center"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("center").run()},{key:"align-right",label:T.alignRight,icon:jsx(AlignRight,{}),active:j?.isActive({textAlign:"right"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("right").run()},{key:"align-justify",label:T.alignJustify,icon:jsx(AlignJustify,{}),active:j?.isActive({textAlign:"justify"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("justify").run()}]},{key:"lists",label:T.group_lists,items:[{key:"bullet-list",label:T.bulletList,icon:jsx(List,{}),active:j?.isActive("bulletList"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBulletList().run()},{key:"ordered-list",label:T.orderedList,icon:jsx(ListOrdered,{}),active:j?.isActive("orderedList"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleOrderedList().run()}]},...C?.home??[]]},{key:"insert",label:T.tab_insert,groups:[{key:"media",label:T.group_media,items:[{key:"image",label:T.image,icon:jsx(Image,{}),disabled:d||E==="markdown",onClick:()=>le(true)},{key:"video",label:T.video??T.youtube,icon:jsx(Video,{}),disabled:d||E==="markdown",onClick:()=>{de(""),ie(null),Ne(true);}}]},{key:"content",label:T.group_content,items:[{key:"link",label:T.link,icon:jsx(Link,{}),active:j?.isActive("link"),disabled:d||E==="markdown",onClick:()=>{let ee=j?.getAttributes("link").href??"";te(ee),Z(true);}},{key:"table",label:T.table,icon:jsx(Table,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:true}).run()},{key:"code-block",label:T.codeBlock,icon:jsx(Code,{}),active:j?.isActive("codeBlock"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleCodeBlock().run()},{key:"blockquote",label:T.blockquote,icon:jsx(Quote,{}),active:j?.isActive("blockquote"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBlockquote().run()},{key:"hr",label:T.divider,icon:jsx(Minus,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setHorizontalRule().run()}]},...C?.insert??[]]},{key:"format",label:T.tab_format,groups:[{key:"style",label:T.group_style,items:[{key:"color",label:T.color,icon:jsx(Palette,{}),disabled:d||E==="markdown",onClick:()=>{document.getElementById("rte-color-input")?.click();}},{key:"highlight",label:T.highlight,icon:jsx(Highlighter,{}),active:j?.isActive("highlight"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHighlight().run()},{key:"subscript",label:T.subscript,icon:jsx(Subscript,{}),active:j?.isActive("subscript"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleSubscript().run()},{key:"superscript",label:T.superscript,icon:jsx(Superscript,{}),active:j?.isActive("superscript"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleSuperscript().run()}]},{key:"reset",label:T.group_reset,items:[{key:"clear",label:T.clear,icon:jsx(Eraser,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().unsetAllMarks().clearNodes().run()}]},...C?.format??[]]}],...I??[]],To={};g&&(To.height=typeof g=="number"?`${g}px`:g),h&&(To.minHeight=typeof h=="number"?`${h}px`:h),b&&(To.maxHeight=typeof b=="number"?`${b}px`:b);let Up=E==="richtext"?re:ko(M);return jsxs("div",{ref:Ce,className:f("rte-root",A),style:{...To,...D},"data-testid":"rte-root",onPaste:Kp,children:[jsx("input",{id:"rte-color-input",type:"color",className:"sr-only","aria-hidden":true,onChange:ee=>{j?.chain().focus().setColor(ee.target.value).run();}}),jsxs("div",{ref:J,className:"rte-ribbon relative",children:[jsx(Un,{tabs:Yp}),jsxs(Hl,{open:G,onClose:()=>le(false),children:[jsx("input",{type:"url",placeholder:"Image URL\u2026",value:ke,onChange:ee=>B(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&(ke&&j?.chain().focus().setImage({src:ke}).run(),B(""),le(false));},autoFocus:true}),jsx("button",{onClick:()=>{ke&&j?.chain().focus().setImage({src:ke}).run(),B(""),le(false);},children:"Insert"}),jsx("button",{className:"rte-cancel-btn",onClick:()=>le(false),children:"Cancel"})]}),jsxs(Hl,{open:q,onClose:()=>Z(false),children:[jsx("input",{type:"url",placeholder:"https://\u2026",value:ue,onChange:ee=>te(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&(j?.chain().focus().setLink({href:ue}).run(),te(""),Z(false));},autoFocus:true}),jsx("button",{onClick:()=>{j?.chain().focus().setLink({href:ue}).run(),te(""),Z(false);},children:"Apply"}),jsx("button",{className:"rte-cancel-btn",onClick:()=>Z(false),children:"Cancel"})]}),jsxs(Hl,{open:ve,onClose:()=>Ne(false),children:[jsx("input",{type:"url",placeholder:"YouTube, Vimeo, Bilibili, or .mp4 URL\u2026",value:X,onChange:ee=>{de(ee.target.value),ie(null);},onKeyDown:ee=>{ee.key==="Enter"&&Wr();},autoFocus:true,style:{minWidth:280}}),Q&&jsx("span",{style:{fontSize:"0.72rem",color:"var(--color-danger-500)",flex:"0 0 100%"},children:Q}),jsx("button",{onClick:Wr,children:"Embed"}),jsx("button",{className:"rte-cancel-btn",onClick:()=>Ne(false),children:"Cancel"})]})]}),E==="richtext"&&jsx(T1,{editor:j,L:T,readOnly:d??false}),Pe!==null&&jsx(S1,{mode:Pe,onClose:()=>{Oe(null),j&&j.view.dispatch(j.view.state.tr.setMeta(Pt,{query:"",currentIndex:0,matches:[]})),se(0),K(0),me("");},onFind:(ee,ae)=>{E==="richtext"?$(ee,ae):He(ee,ae);},onPrev:()=>{E==="richtext"?ge(-1):dt(-1,ce,false);},onNext:()=>{E==="richtext"?ge(1):dt(1,ce,false);},onReplace:ee=>{if(E==="richtext"){let ae=j?Pt.getState(j.view.state):null;Le(ee),ae&&He(ae.query,ae.caseSensitive);}else Gt(ce,ee,false);},onReplaceAll:ee=>{E==="richtext"?De(ee):Mo(ce,ee);},matchCount:ir,currentIndex:Sn}),jsxs("div",{className:"rte-body",children:[jsx("div",{className:"rte-editor-pane",children:E==="richtext"?jsx(EditorContent,{editor:j,spellCheck:P,readOnly:d}):jsx("textarea",{ref:Ye,className:"rte-markdown-source",value:M,onChange:Tr,placeholder:m,readOnly:d,spellCheck:P,"data-testid":"rte-markdown-source"})}),oe&&jsx("div",{className:"rte-preview-pane","data-testid":"rte-preview-pane",children:jsx("div",{className:"prose",dangerouslySetInnerHTML:{__html:Up}})})]}),jsxs("div",{className:"rte-statusbar",children:[jsxs("div",{className:"rte-statusbar-left",children:[jsx(Rr,{size:"sm",checked:U,onCheckedChange:H,checkedContent:jsx(Moon,{size:10}),uncheckedContent:jsx(Sun,{size:10}),"aria-label":"Toggle dark mode",title:U?"Switch to light mode":"Switch to dark mode"}),jsx("span",{className:"rte-statusbar-divider"}),jsx(Rr,{size:"sm",checked:E==="markdown",onCheckedChange:ee=>ne(ee?"markdown":"richtext"),disabled:n!==void 0,checkedContent:jsx(Code,{size:10}),uncheckedContent:jsx(FileText,{size:10}),"aria-label":"Toggle editor mode",title:n!==void 0?`Mode locked: ${E}`:E==="markdown"?"Markdown mode (click for Rich Text)":"Rich Text mode (click for Markdown)"}),jsx("span",{className:"rte-statusbar-label",children:E==="markdown"?"Markdown":"Rich Text"})]}),jsxs("div",{className:"rte-statusbar-right",children:[jsx(Rr,{size:"sm",checked:oe,onCheckedChange:be,checkedContent:jsx(Eye,{size:10}),uncheckedContent:jsx(EyeOff,{size:10}),"aria-label":"Toggle live preview",title:oe?"Hide preview":"Show live preview"}),jsx("span",{className:"rte-statusbar-label",children:"Preview"}),(y||v)&&jsx("span",{className:"rte-statusbar-divider"}),y&&jsxs("span",{children:[Wp," words"]}),v&&jsxs("span",{children:[jp," chars"]})]})]})]})});Co.displayName="RichTextEditor";var P1={FilmReel:Ks,MiniPlayer:Ws,CinePlayer:Us,FileExplorer:Zs,Masonry:nl,TypewriterText:Oa,CommandPalette:Ka,Timeline:il,DateTimePicker:Wa,LoginPanel:Ga,RichTextEditor:Co},_l=P1;var Bl=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),z1={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},bp={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function Ol({children:e,className:t,intent:r,size:n="md",layout:o="stacked",title:a,description:i,footer:s,onValues:l,onSubmit:c,...u}){let p=z1[n??"md"],[m,d]=useState({}),g=useCallback(h=>{if(h.preventDefault(),c?.(h),l){let b=Object.fromEntries(new FormData(h.currentTarget).entries()),y=l(b,h),v=N=>{if(!N)return;let x={};for(let[w,{result:L,reason:P}]of Object.entries(N))P&&(x[w]={status:L?"success":"error",message:P});d(x);};y instanceof Promise?y.then(v).catch(()=>{}):v(y);}},[c,l]);return jsx(Bl.Provider,{value:{layout:o??"stacked",size:n??"md",labelWidth:p,bulkErrors:m},children:jsxs("form",{className:f(ll({intent:r,size:n}),"flex flex-col",t),onSubmit:g,...u,children:[(a||i)&&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}),i&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:i})]}),jsx("div",{className:f("flex flex-col",bp[n??"md"]),children:e}),s&&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:s})]})})}var V1={error:jsx(AlertCircle,{}),warning:jsx(AlertTriangle,{}),success:jsx(CheckCircle,{}),hint:jsx(Info,{})};function H1({label:e,layout:t,required:r,hint:n,validation:o,name:a,onValidate:i,className:s,children:l}){let c=useContext(Bl),u=useId(),[p,m]=useState(void 0),d=a?c.bulkErrors[a]:void 0,g=o??p??d,b=(t??c.layout)==="inline",y=useCallback(L=>{let P=L!=null&&typeof L=="object"&&"target"in L?L.target.value:L;if(a&&c.bulkErrors[a]&&(c.bulkErrors[a]=void 0),!i){m(void 0);return}let{result:A,reason:D}=i(P);m(D?{status:A?"success":"error",message:D}:void 0);},[i,a,c.bulkErrors]),v=g?`${u}-validation`:n?`${u}-hint`:void 0,N=On.Children.map(l,(L,P)=>{if(P!==0||!On.isValidElement(L))return L;let A=L,D={};if(A.props.id||(D.id=u),v&&!A.props["aria-describedby"]&&(D["aria-describedby"]=v),g?.status==="error"&&!A.props["aria-invalid"]&&(D["aria-invalid"]=true),a&&!A.props.name&&(D.name=a),i){let S=A.props.onChange;D.onChange=C=>{S?.(C),y(C);};}return Object.keys(D).length?On.cloneElement(A,D):L}),x=e!=null&&jsx("label",{htmlFor:u,className:f("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:c.labelWidth,minWidth:c.labelWidth}:void 0,children:e}),w=o?`${u}-validation`:n?`${u}-hint`:void 0;return jsxs("div",{className:f("flex w-full flex-col gap-1.5",b&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",s),children:[x,jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[N,g&&jsxs("p",{id:`${u}-validation`,className:f(cl({status:g.status})),role:g.status==="error"?"alert":void 0,children:[V1[g.status],jsx("span",{children:g.message})]}),n&&jsx("p",{id:w===`${u}-hint`?w:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:n})]})]})}function _1({title:e,description:t,className:r,children:n}){let{size:o}=useContext(Bl);return jsxs("fieldset",{className:f("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",bp[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 F1={Form:Ol,OTPInput:wn},$l=F1;var Yt=cva("relative w-full font-sans select-none",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Ut=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"}}),Xt=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 wr(e){let[t,r]=useState(()=>new Set(e)),n=useCallback(i=>{r(s=>{let l=new Set(s);return l.has(i)?l.delete(i):l.add(i),l});},[]),o=useCallback(i=>t.has(i),[t]),a=useCallback(()=>{r(new Set(e));},[e]);return {visible:t,toggle:n,isVisible:o,showAll:a}}function kr(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 Nr(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 Mn(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 We(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 Rt(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 Cr(e,t,r){return {top:20,right:r?65:20,bottom:e?52:36,left:t?65:52}}function Mr(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 yp(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let i=String(a.x);r.has(i)||(r.add(i),n.push(i));}return n}function Wl(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data)l.y<n&&(n=l.y),l.y>o&&(o=l.y);if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function li(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function ci(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 vp(e,t,r){return e.map(n=>`${t(n.x).toFixed(2)},${r(n.y).toFixed(2)}`).join(" ")}function Yl(e,t,r){if(e.length===0)return "";let n=e.map(i=>({x:t(i.x),y:r(i.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 i=0;i<n.length-1;i++){let s=i===0?{x:2*n[0].x-n[1].x,y:2*n[0].y-n[1].y}:n[i-1],l=n[i],c=n[i+1],u=i+2<n.length?n[i+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},p=l.x+(c.x-s.x)*o/3,m=l.y+(c.y-s.y)*o/3,d=c.x-(u.x-l.x)*o/3,g=c.y-(u.y-l.y)*o/3;a+=` C ${p.toFixed(2)} ${m.toFixed(2)}, ${d.toFixed(2)} ${g.toFixed(2)}, ${c.x.toFixed(2)} ${c.y.toFixed(2)}`;}return a}function xp(e,t,r,n,o){if(e.length===0)return "";let a=n?Yl(e,t,r):`M ${e.map(l=>`${t(l.x).toFixed(2)},${r(l.y).toFixed(2)}`).join(" L ")}`,i=t(e[e.length-1].x).toFixed(2),s=t(e[0].x).toFixed(2);return `${a} L ${i},${o.toFixed(2)} L ${s},${o.toFixed(2)} Z`}function di(e,t=5){return Mn(e[0],e[1],t)}function Ul(e,t,r){if(t.length===0)return -1;let n=1/0,o=0;for(let a=0;a<t.length;a++){let i=Math.abs(r(t[a])-e);i<n&&(n=i,o=a);}return o}function Xl(e,t){return e.data.find(r=>String(r.x)===t)?.y}function wp(e){for(let t of e)for(let r of t.data)if(typeof r.x=="string")return true;return false}function ui({items:e,position:t,onToggle:r}){return jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:f("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 Jl({series:e,xAxis:t,yAxis:r,y2Axis:n,y2Series:o=[],smooth:a=false,showDots:i=true,area:s=false,strokeWidth:l=2,title:c,height:u=300,className:p,legend:m=true,legendPosition:d="bottom",animateOnMount:g=true,emptyText:h="No data to display"}){let b=useRef(null),y=useRef(null),[v,N]=useState(600),[x,w]=useState(null),[L,P]=useState(null);useEffect(()=>{let B=y.current;if(!B)return;let q=B.getBoundingClientRect().width;q>0&&N(q);let Z=new ResizeObserver(ue=>{let te=ue[0]?.contentRect.width;te&&te>0&&N(te);});return Z.observe(B),()=>Z.disconnect()},[]);let A=useMemo(()=>e.map(B=>B.id),[e]),{visible:D,toggle:S,isVisible:C}=wr(A),I=useMemo(()=>kr(e.length),[e.length]),k=useMemo(()=>new Map(e.map((B,q)=>[B.id,B.color??I[q]])),[e,I]),T=useMemo(()=>Cr(!!t?.label,!!r?.label,!!n),[t?.label,r?.label,n]),R=useMemo(()=>Mr(v,u,T),[v,u,T]),O=useMemo(()=>wp(e),[e]),E=useMemo(()=>O?yp(e,D):[],[e,D,O]),ne=useMemo(()=>{if(O){let te=ci(E,[R.plotLeft,R.plotRight]);return ve=>te(ve)}let B=e.flatMap(te=>te.data.map(ve=>ve.x));if(B.length===0)return ()=>R.plotLeft;let q=Math.min(...B),Z=Math.max(...B),ue=li([q,Z],[R.plotLeft,R.plotRight]);return te=>ue(te)},[e,O,E,R]),U=useMemo(()=>Wl(e,D,r),[e,D,r]),z=useMemo(()=>li(U,[R.plotBottom,R.plotTop]),[U,R]),H=useMemo(()=>di(U,r?.tickCount??5),[U,r?.tickCount]),_=useMemo(()=>{if(!n)return null;let B=e.filter(q=>o.includes(q.id));return Wl(B,D,n)},[n,e,o,D]),V=useMemo(()=>_?li(_,[R.plotBottom,R.plotTop]):null,[_,R]),oe=useMemo(()=>_?di(_,n?.tickCount??5):[],[_,n?.tickCount]),be=useMemo(()=>{if(O)return E;let B=e.flatMap(ue=>ue.data.map(te=>Number(te.x)));if(B.length===0)return [];let q=Math.min(...B),Z=Math.max(...B);return di([q,Z],t?.tickCount??6)},[O,E,e,t?.tickCount]),M=useCallback(B=>{let q=B.currentTarget.closest("svg");if(!q)return;let Z=q.getBoundingClientRect(),ue=B.clientX-Z.left,te=b.current?.getBoundingClientRect();if(!te)return;let ve="",Ne=ue;if(O&&E.length>0){let ie=ci(E,[R.plotLeft,R.plotRight]),Pe=Ul(ue,E,ie);ve=E[Pe]??"",Ne=ie(ve);}else if(!O){let ie=be;ve=We((ue-R.plotLeft)/R.plotWidth*(ie[ie.length-1]-ie[0])+ie[0],t?.format),Ne=ue;}let X=e.filter(ie=>C(ie.id)).map(ie=>{o.includes(ie.id)&&V!=null?V:z;let Xe;if(O)Xe=Xl(ie,ve);else {let se=ue,Re=1/0,K;for(let ce of ie.data){let me=ne(ce.x),J=Math.abs(me-se);J<Re&&(Re=J,K=ce.y);}Xe=K;}return {name:ie.name,value:Xe!==void 0?We(Xe,r?.format):"\u2014",color:k.get(ie.id)??"var(--color-chart-1)"}});Ne>=R.plotLeft&&Ne<=R.plotRight&&P(Ne);let de=B.clientX-te.left+12,Q=B.clientY-te.top-10;w({x:de,y:Q,label:ve,items:X});},[O,E,R,e,C,o,V,z,ne,be,t?.format,r?.format,k]),F=useCallback(()=>{w(null),P(null);},[]),re=useCallback(B=>{B.preventDefault();let q=B.touches[0];if(!q)return;let Z=B.currentTarget.closest("svg");if(!Z)return;let ue=Z.getBoundingClientRect(),te=b.current?.getBoundingClientRect();if(!te)return;let ve=q.clientX-ue.left,Ne=ve,X="";if(O&&E.length>0){let Q=ci(E,[R.plotLeft,R.plotRight]),ie=Ul(ve,E,Q);X=E[ie]??"",Ne=Q(X);}Ne>=R.plotLeft&&Ne<=R.plotRight&&P(Ne);let de=e.filter(Q=>C(Q.id)).map(Q=>({name:Q.name,value:O&&X?We(Xl(Q,X)??0,r?.format):"\u2014",color:k.get(Q.id)??"var(--color-chart-1)"}));w({x:q.clientX-te.left+12,y:q.clientY-te.top-10,label:X,items:de});},[O,E,R,e,C,r?.format,k]),W=useMemo(()=>e.map((B,q)=>({id:B.id,label:B.name,color:B.color??I[q],visible:C(B.id)})),[e,I,C]),G=e.some(B=>B.data.length>0),le=jsxs("svg",{role:"img","aria-label":c??"Line chart",width:R.width,height:R.height,viewBox:`0 0 ${R.width} ${R.height}`,shapeRendering:"geometricPrecision",children:[r?.gridLines!==false&&H.map(B=>{let q=z(B);return jsx("line",{x1:R.plotLeft,x2:R.plotRight,y1:q,y2:q,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},B)}),s&&e.map(B=>{if(!C(B.id)||B.data.length===0)return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)",te=xp(B.data,ne,Z,a,R.plotBottom);return jsx("path",{d:te,fill:ue,fillOpacity:.15,stroke:"none",className:g?"chart-area-animate":""},`area-${B.id}`)}),e.map(B=>{if(!C(B.id)||B.data.length===0)return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)";return a?jsx("path",{d:Yl(B.data,ne,Z),fill:"none",stroke:ue,strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},B.id):jsx("polyline",{points:vp(B.data,ne,Z),fill:"none",stroke:ue,strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},B.id)}),i&&e.map(B=>{if(!C(B.id))return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)";return B.data.map((te,ve)=>jsx("circle",{cx:ne(te.x),cy:Z(te.y),r:3,fill:ue,stroke:"white",strokeWidth:1.5,className:f("chart-dot",g?"chart-dot-animate":"")},`${B.id}-${ve}`))}),L!=null&&jsx("line",{className:"chart-crosshair",x1:L,x2:L,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,strokeDasharray:"4 4",opacity:.5,style:{color:"var(--color-secondary-400)"}}),jsx("line",{x1:R.plotLeft,x2:R.plotLeft,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),H.map(B=>{let q=z(B);return jsxs("g",{children:[jsx("line",{x1:R.plotLeft-4,x2:R.plotLeft,y1:q,y2:q,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:R.plotLeft-6,y:q,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,r?.format)})]},B)}),r?.label&&jsx("text",{x:-(R.plotTop+R.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&&V&&jsxs(Fragment,{children:[jsx("line",{x1:R.plotRight,x2:R.plotRight,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),oe.map(B=>{let q=V(B);return jsxs("g",{children:[jsx("line",{x1:R.plotRight,x2:R.plotRight+4,y1:q,y2:q,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:R.plotRight+6,y:q,textAnchor:"start",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,n?.format)})]},B)}),n?.label&&jsx("text",{x:R.plotTop+R.plotHeight/2,y:-(R.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:R.plotLeft,x2:R.plotRight,y1:R.plotBottom,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),(O?E:be).map((B,q)=>{let Z=ne(B);return jsxs("g",{children:[jsx("line",{x1:Z,x2:Z,y1:R.plotBottom,y2:R.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:Z,y:R.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,t?.format)})]},q)}),t?.label&&jsx("text",{x:R.plotLeft+R.plotWidth/2,y:R.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label}),jsx("rect",{x:R.plotLeft,y:R.plotTop,width:R.plotWidth,height:R.plotHeight,fill:"transparent",onMouseMove:M,onMouseLeave:F,onTouchStart:re,onTouchMove:re,onTouchEnd:F,style:{cursor:"crosshair"}})]}),ke=d==="left"||d==="right";return jsxs("div",{ref:b,className:f(Yt(),p),children:[c&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&d==="top"&&jsx(ui,{items:W,position:"top",onToggle:S}),jsxs("div",{className:f("flex items-start",ke&&"gap-0"),children:[m&&d==="left"&&jsx(ui,{items:W,position:"left",onToggle:S}),jsx("div",{ref:y,className:"flex-1 min-w-0 overflow-hidden",children:G?le:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:h})}),m&&d==="right"&&jsx(ui,{items:W,position:"right",onToggle:S})]}),m&&d==="bottom"&&jsx(ui,{items:W,position:"bottom",onToggle:S}),x&&jsxs("div",{className:Xt(),style:{left:x.x,top:x.y},role:"tooltip",children:[x.label&&jsx("div",{className:"mb-1 font-medium text-primary-200",children:x.label}),x.items.map((B,q)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:B.color}}),jsxs("span",{className:"text-primary-300",children:[B.name,":"]}),jsx("span",{className:"font-medium",children:B.value})]},q))]})]})}function Np(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let i=String(a.x);r.has(i)||(r.add(i),n.push(i));}return n}function Cp(e,t,r,n){if(r){let o=0;for(let i of e)if(t.has(i.id))for(let s of i.data)s.y>o&&(o=s.y);o===0&&(o=1);let[,a]=Nr(0,o,.05);return [n?.min??0,n?.max??a]}else {let o=new Map;for(let s of e)if(t.has(s.id))for(let l of s.data){let c=String(l.x);o.set(c,(o.get(c)??0)+l.y);}let a=Math.max(0,...o.values()),[,i]=Nr(0,a===0?1:a,.05);return [n?.min??0,n?.max??i]}}function Mp(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function Tp(e,t=5){return Mn(e[0],e[1],t)}function Sp(e,t,r,n,o,a,i,s,l,c,u){let p=e.filter(v=>t.has(v.id)),m=r.length,d=p.length;if(m===0||d===0)return [];let g=a/m,h=g*(1-c),b=d>0?h*(1-u)/d:0,y=[];for(let v=0;v<r.length;v++){let N=r[v],x=o+v*g+(g-h)/2;for(let w=0;w<p.length;w++){let L=p[w],P=L.data.find(S=>String(S.x)===N);if(!P)continue;let A=x+w*(b+h*u/d),D=l(P.y);y.push({seriesId:L.id,category:N,x:A,y:D,width:Math.max(b,1),height:Math.max(i-D,0),stackBase:i,value:P.y,color:n.get(L.id)??"var(--color-chart-1)"});}}return y}function Pp(e,t,r,n,o,a,i,s,l,c){let u=e.filter(y=>t.has(y.id)),p=r.length,m=u.length;if(p===0||m===0)return [];let d=i/p,g=d*(1-l),h=m>0?g*(1-c)/m:0,b=[];for(let y=0;y<r.length;y++){let v=r[y],N=a+y*d+(d-g)/2;for(let x=0;x<u.length;x++){let w=u[x],L=w.data.find(D=>String(D.x)===v);if(!L)continue;let P=N+x*(h+g*c/Math.max(m,1)),A=s(L.y);b.push({seriesId:w.id,category:v,x:o,y:P,width:Math.max(A-o,0),height:Math.max(h,1),stackBase:o,value:L.y,color:n.get(w.id)??"var(--color-chart-1)"});}}return b}function Rp(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=r.length;if(u===0)return [];let p=i/u*(1-l),m=[],d=new Map;r.forEach(g=>d.set(g,o));for(let g of c)for(let h of r){let b=g.data.find(w=>String(w.x)===h);if(!b)continue;let y=d.get(h)??o,v=Math.max(s(b.y)-o,0),N=r.indexOf(h),x=a+(N+.5)*(i/u);m.push({seriesId:g.id,category:h,x:y,y:x-p/2,width:v,height:Math.max(p,1),stackBase:y,value:b.y,color:n.get(g.id)??"var(--color-chart-1)"}),d.set(h,y+v);}return m}function Ep(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=r.length;if(u===0)return [];let p=a/u*(1-l),m=[],d=new Map;r.forEach(g=>d.set(g,i));for(let g of c)for(let h of r){let b=g.data.find(L=>String(L.x)===h);if(!b)continue;let y=d.get(h)??i,v=Math.max(i-s(b.y),0),N=y-v,x=r.indexOf(h),w=o+(x+.5)*(a/u);m.push({seriesId:g.id,category:h,x:w-p/2,y:N,width:Math.max(p,1),height:v,stackBase:y,value:b.y,color:n.get(g.id)??"var(--color-chart-1)"}),d.set(h,N);}return m}function pi({items:e,position:t,onToggle:r}){return jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:f("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 Ql({series:e,xAxis:t,yAxis:r,orientation:n="vertical",grouped:o=true,barRadius:a=4,barPadding:i=.2,groupPadding:s=.3,title:l,height:c=300,className:u,legend:p=true,legendPosition:m="bottom",animateOnMount:d=true,emptyText:g="No data to display"}){let h=useRef(null),b=useRef(null),[y,v]=useState(600),[N,x]=useState(null);useEffect(()=>{let M=b.current;if(!M)return;let F=M.getBoundingClientRect().width;F>0&&v(F);let re=new ResizeObserver(W=>{let G=W[0]?.contentRect.width;G&&G>0&&v(G);});return re.observe(M),()=>re.disconnect()},[]);let w=useMemo(()=>e.map(M=>M.id),[e]),{visible:L,toggle:P,isVisible:A}=wr(w),D=useMemo(()=>kr(e.length),[e.length]),S=useMemo(()=>new Map(e.map((M,F)=>[M.id,M.color??D[F]])),[e,D]),C=n==="horizontal",I=useMemo(()=>Cr(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=useMemo(()=>Mr(y,c,I),[y,c,I]),T=useMemo(()=>Np(e,L),[e,L]),R=useMemo(()=>Cp(e,L,o,C?t:r),[e,L,o,C,t,r]),O=useMemo(()=>Mp(R,C?[k.plotLeft,k.plotRight]:[k.plotBottom,k.plotTop]),[R,k,C]),E=useMemo(()=>Tp(R,(C?t:r)?.tickCount??5),[R,C,t,r]),ne=useMemo(()=>C?o?Pp(e,L,T,S,k.plotLeft,k.plotTop,k.plotHeight,O,s,i):Rp(e,L,T,S,k.plotLeft,k.plotTop,k.plotHeight,O,s):o?Sp(e,L,T,S,k.plotLeft,k.plotWidth,k.plotBottom,k.plotTop,O,s,i):Ep(e,L,T,S,k.plotLeft,k.plotWidth,k.plotBottom,O,s),[e,L,T,S,k,O,o,C,s,i]),U=T.length>0?k.plotWidth/T.length:1,z=T.length>0?k.plotHeight/T.length:1,H=useCallback((M,F)=>{let re=h.current?.getBoundingClientRect();if(!re)return;let W=e.filter(G=>A(G.id)).map(G=>{let le=G.data.find(ke=>String(ke.x)===F);return {name:G.name,value:le?We(le.y,r?.format):"\u2014",color:S.get(G.id)??"var(--color-chart-1)"}});x({x:M.clientX-re.left+12,y:M.clientY-re.top-10,category:F,items:W});},[e,A,S,r?.format]),_=useMemo(()=>e.map((M,F)=>({id:M.id,label:M.name,color:M.color??D[F],visible:A(M.id)})),[e,D,A]),V=e.some(M=>M.data.length>0),oe=m==="left"||m==="right",be=jsxs("svg",{role:"img","aria-label":l??"Bar chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[E.map(M=>{let F=O(M);return C?jsx("line",{x1:F,x2:F,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},M):jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:F,y2:F,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},M)}),ne.map(M=>{let F=Math.min(a,M.width/2,M.height/2),re=`${M.seriesId}-${M.category}`;return C?jsx("rect",{x:M.x,y:M.y,width:M.width,height:M.height,rx:F,fill:M.color,className:f("chart-bar-h",d&&"chart-bar-animate"),onMouseMove:W=>H(W,M.category),onMouseLeave:()=>x(null)},re):jsx("rect",{x:M.x,y:M.y,width:M.width,height:M.height,rx:F,fill:M.color,className:f("chart-bar-v",d&&"chart-bar-animate"),onMouseMove:W=>H(W,M.category),onMouseLeave:()=>x(null)},re)}),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"}),!C&&E.map(M=>{let F=O(M);return jsxs("g",{children:[jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:k.plotLeft-6,y:F,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(M,r?.format)})]},M)}),C&&E.map(M=>{let F=O(M);return jsxs("g",{children:[jsx("line",{x1:F,x2:F,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:F,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(M,t?.format)})]},M)}),T.map((M,F)=>{if(C){let W=k.plotTop+(F+.5)*z;return jsx("text",{x:k.plotLeft-6,y:W,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:M},M)}let re=k.plotLeft+(F+.5)*U;return jsx("text",{x:re,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:M},M)}),r?.label&&!C&&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:h,className:f(Yt(),u),children:[l&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:l}),p&&m==="top"&&jsx(pi,{items:_,position:"top",onToggle:P}),jsxs("div",{className:f("flex items-start",oe&&"gap-0"),children:[p&&m==="left"&&jsx(pi,{items:_,position:"left",onToggle:P}),jsx("div",{ref:b,className:"flex-1 min-w-0 overflow-hidden",children:V?be:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:g})}),p&&m==="right"&&jsx(pi,{items:_,position:"right",onToggle:P})]}),p&&m==="bottom"&&jsx(pi,{items:_,position:"bottom",onToggle:P}),N&&jsxs("div",{className:Xt(),style:{left:N.x,top:N.y},role:"tooltip",children:[jsx("div",{className:"mb-1 font-medium text-primary-200",children:N.category}),N.items.map((M,F)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:M.color}}),jsxs("span",{className:"text-primary-300",children:[M.name,":"]}),jsx("span",{className:"font-medium",children:M.value})]},F))]})]})}function Ap(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=c.reduce((g,h)=>g+h.value,0);if(u===0)return [];let p=new Map(e.map((g,h)=>[g.id,g.color??r[h%r.length]])),m=[],d=s;for(let g of c){let h=g.value/u*360,b=l/2,y=d+b,v=d+h-b,N=(y+v)/2,x;if(Math.abs(v-y)>=359.9){let w=Rt(a,i,n,y),L=Rt(a,i,n,y+180);x=`M ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 1 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} A ${n} ${n} 0 1 1 ${w.x.toFixed(3)} ${w.y.toFixed(3)} Z`;}else if(o>0){let w=Rt(a,i,n,y),L=Rt(a,i,n,v),P=Rt(a,i,o,v),A=Rt(a,i,o,y),D=v-y>180?1:0;x=`M ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 ${D} 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} L ${P.x.toFixed(3)} ${P.y.toFixed(3)} A ${o} ${o} 0 ${D} 0 ${A.x.toFixed(3)} ${A.y.toFixed(3)} Z`;}else {let w=Rt(a,i,n,y),L=Rt(a,i,n,v),P=v-y>180?1:0;x=`M ${a.toFixed(3)} ${i.toFixed(3)} L ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 ${P} 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} Z`;}m.push({id:g.id,label:g.label,value:g.value,percent:Math.round(g.value/u*1e3)/10,color:p.get(g.id)??"var(--color-chart-1)",startAngle:y,endAngle:v,midAngle:N,path:x,outerR:n,innerR:o,cx:a,cy:i}),d+=h;}return m}function Ip(e,t){let r=(e-90)*Math.PI/180;return {dx:Math.cos(r)*t,dy:Math.sin(r)*t}}function hi({items:e,position:t,onToggle:r}){return jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:f("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 tc({data:e,donut:t=false,donutThickness:r=.5,startAngle:n=-90,padAngle:o=0,labelType:a="percent",centerLabel:i,centerSubLabel:s,explodeOnHover:l=true,explodeOffset:c=8,title:u,height:p=300,className:m,legend:d=true,legendPosition:g="bottom",animateOnMount:h=true,emptyText:b="No data to display"}){let y=useRef(null),v=useRef(null),[N,x]=useState(400),[w,L]=useState(null),[P,A]=useState(null),[D,S]=useState({}),C=useRef(null);useEffect(()=>{let X=v.current;if(!X)return;let de=X.getBoundingClientRect().width;de>0&&x(de);let Q=new ResizeObserver(ie=>{let Pe=ie[0]?.contentRect.width;Pe&&Pe>0&&x(Pe);});return Q.observe(X),()=>Q.disconnect()},[]),useEffect(()=>{function X(Q){let ie=C.current;if(!ie)return;"touches"in Q&&Q.cancelable&&Q.preventDefault();let Pe="touches"in Q?Q.touches[0]?.clientX??ie.startX:Q.clientX,Oe="touches"in Q?Q.touches[0]?.clientY??ie.startY:Q.clientY;S(Xe=>({...Xe,[ie.id]:{dx:ie.origDx+Pe-ie.startX,dy:ie.origDy+Oe-ie.startY}}));}function de(){C.current=null;}return window.addEventListener("mousemove",X),window.addEventListener("mouseup",de),window.addEventListener("touchmove",X,{passive:false}),window.addEventListener("touchend",de),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",de),window.removeEventListener("touchmove",X),window.removeEventListener("touchend",de);}},[]);let I=useMemo(()=>e.map(X=>X.id),[e]),{visible:k,toggle:T,isVisible:R}=wr(I),O=useMemo(()=>kr(e.length),[e.length]),E=10,ne=6.4,U=18,z=14,H=6,_=N,V=p,oe=_/2,be=V/2,M=a!=="none"?U+H+4:H+4,F=Math.max(Math.min(oe,be)-M,20),re=t?F*r:0,W=useMemo(()=>Ap(e,k,O,F,re,oe,be,n,o),[e,k,O,F,re,oe,be,n,o]),G=useMemo(()=>W.map(X=>X.id).join(","),[W]);useEffect(()=>{S({});},[G]);let le=useCallback((X,de)=>{if(C.current)return;let Q=y.current?.getBoundingClientRect();if(!Q)return;L(de);let ie=W.find(Pe=>Pe.id===de);ie&&A({x:X.clientX-Q.left+12,y:X.clientY-Q.top-10,items:[{label:ie.label,value:We(ie.value),percent:`${ie.percent}%`,color:ie.color}]});},[W]),ke=useCallback(()=>{L(null),A(null);},[]),B=useCallback((X,de,Q)=>{let ie=D[X]??{dx:0,dy:0};C.current={id:X,startX:de,startY:Q,origDx:ie.dx,origDy:ie.dy};},[D]),q=useCallback((X,de)=>{X.preventDefault(),L(de);let Q=y.current?.getBoundingClientRect();if(!Q)return;let ie=X.touches[0];if(!ie)return;let Pe=W.find(Oe=>Oe.id===de);Pe&&A({x:ie.clientX-Q.left+12,y:ie.clientY-Q.top-10,items:[{label:Pe.label,value:We(Pe.value),percent:`${Pe.percent}%`,color:Pe.color}]});},[W]),Z=useMemo(()=>{let X=e.reduce((de,Q)=>de+Q.value,0);return e.map((de,Q)=>({id:de.id,label:de.label,color:de.color??O[Q],visible:R(de.id),percent:X>0?Math.round(de.value/X*1e3)/10:0}))},[e,O,R]),ue=e.length>0&&e.some(X=>X.value>0),te=g==="left"||g==="right",ve=useMemo(()=>{if(a==="none")return [];let X=E+3,de=H+E*.5,Q=V-H-E*.5,ie=W.filter(se=>se.percent>=3).map(se=>{let Re="";switch(a){case "percent":Re=`${se.percent}%`;break;case "value":Re=We(se.value);break;case "label":Re=se.label;break;case "label+percent":Re=`${se.label} ${se.percent}%`;break}let K=Rt(se.cx,se.cy,se.outerR+2,se.midAngle),ce=Rt(se.cx,se.cy,se.outerR+U,se.midAngle),me=(se.midAngle-90)*Math.PI/180,J=Math.cos(me)>=0,Ce=Math.ceil(Re.length*ne);return {id:se.id,color:se.color,text:Re,textW:Ce,p1:K,elbowX:ce.x,y:ce.y,isRight:J}}),Pe=ie.filter(se=>se.isRight).sort((se,Re)=>se.y-Re.y),Oe=ie.filter(se=>!se.isRight).sort((se,Re)=>se.y-Re.y);function Xe(se){if(se.length!==0)for(let Re=0;Re<20;Re++){let K=false;for(let me=1;me<se.length;me++){let J=se[me].y-se[me-1].y;if(J<X){let Ce=(X-J)/2;se[me-1].y-=Ce,se[me].y+=Ce,K=true;}}se[0].y<de&&(se[0].y=de);for(let me=1;me<se.length;me++)se[me].y<se[me-1].y+X&&(se[me].y=se[me-1].y+X);let ce=se.length-1;se[ce].y>Q&&(se[ce].y=Q);for(let me=ce-1;me>=0;me--)se[me].y>se[me+1].y-X&&(se[me].y=se[me+1].y-X);for(let me of se)me.y=Math.max(de,Math.min(Q,me.y));if(!K)break}}return Xe(Pe),Xe(Oe),[...Oe,...Pe]},[W,a,V]),Ne=jsxs("svg",{role:"img","aria-label":u??"Pie chart",width:_,height:V,viewBox:`0 0 ${_} ${V}`,shapeRendering:"geometricPrecision",children:[jsxs("g",{className:h?"chart-pie-animate":"",children:[W.map((X,de)=>{let Q=w===X.id,ie=l&&Q,Pe=Ip(X.midAngle,ie?c:0);return jsx("path",{d:X.path,fill:X.color,transform:ie?`translate(${Pe.dx}, ${Pe.dy})`:void 0,className:f("chart-slice",h&&`chart-slice-animate-${Math.min(de,7)}`,Q&&"chart-slice--exploded"),stroke:X.color,strokeWidth:.6,onMouseMove:Oe=>le(Oe,X.id),onMouseLeave:ke,onTouchStart:Oe=>q(Oe,X.id),onTouchEnd:ke,"aria-label":`${X.label}: ${X.percent}%`},X.id)}),ve.map(X=>{let de=D[X.id]??{dx:0,dy:0},Q=X.elbowX+de.dx,ie=X.y+de.dy,Pe=Q+(X.isRight?z:-z),Oe=X.isRight?Pe+3:Pe-3,Xe=z+3+X.textW+6,se=X.isRight?Q:Q-Xe,Re=ie-E-2,K=E*2+4;return jsxs("g",{style:{userSelect:"none"},children:[jsx("polyline",{points:[`${X.p1.x.toFixed(2)},${X.p1.y.toFixed(2)}`,`${Q.toFixed(2)},${ie.toFixed(2)}`,`${Pe.toFixed(2)},${ie.toFixed(2)}`].join(" "),fill:"none",stroke:X.color,strokeWidth:1.2,opacity:.85,strokeLinejoin:"round",strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("text",{x:Oe.toFixed(2),y:ie.toFixed(2),textAnchor:X.isRight?"start":"end",dominantBaseline:"middle",fontSize:E,fill:"currentColor",className:"text-primary-700 dark:text-primary-300",style:{pointerEvents:"none"},children:X.text}),jsx("rect",{x:se,y:Re,width:Xe,height:K,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseDown:ce=>{ce.stopPropagation(),B(X.id,ce.clientX,ce.clientY);},onTouchStart:ce=>{ce.stopPropagation();let me=ce.touches[0];me&&B(X.id,me.clientX,me.clientY);}})]},`label-${X.id}`)})]}),t&&jsx("g",{style:{pointerEvents:"none"},children:w&&W.find(X=>X.id===w)?jsxs(Fragment,{children:[jsxs("text",{x:oe,y:be-8,textAnchor:"middle",dominantBaseline:"middle",fontSize:18,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:[W.find(X=>X.id===w)?.percent,"%"]}),jsx("text",{x:oe,y:be+12,textAnchor:"middle",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:W.find(X=>X.id===w)?.label})]}):jsxs(Fragment,{children:[i&&jsx("text",{x:oe,y:be-(s?8:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:16,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:i}),s&&jsx("text",{x:oe,y:be+14,textAnchor:"middle",dominantBaseline:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:s})]})})]});return jsxs("div",{ref:y,className:f(Yt(),m),children:[u&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),d&&g==="top"&&jsx(hi,{items:Z,position:"top",onToggle:T}),jsxs("div",{className:f("flex items-start justify-center",te&&"gap-0"),children:[d&&g==="left"&&jsx(hi,{items:Z,position:"left",onToggle:T}),jsx("div",{ref:v,className:"flex-1 min-w-0 overflow-hidden",children:ue?Ne:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:p},children:b})}),d&&g==="right"&&jsx(hi,{items:Z,position:"right",onToggle:T})]}),d&&g==="bottom"&&jsx(hi,{items:Z,position:"bottom",onToggle:T}),P&&jsx("div",{className:Xt(),style:{left:P.x,top:P.y},role:"tooltip",children:P.items.map((X,de)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:X.color}}),jsxs("span",{className:"font-medium",children:[X.label,":"]}),jsx("span",{children:X.value}),jsxs("span",{className:"text-primary-300",children:["(",X.percent,")"]})]},de))})]})}function Vp(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data){let c=Number(l.x);c<n&&(n=c),c>o&&(o=c);}if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function Hp(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data)l.y<n&&(n=l.y),l.y>o&&(o=l.y);if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function rc(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function nc(e,t=5){return Mn(e[0],e[1],t)}function _p(e,t,r){let n=1.618033988749895,o=e*137+t,a=o*n%1*2-1,i=o*n*n%1*2-1;return [a*r,i*r]}function Fp(e,t,r=12){if(e.length<2)return null;let n=Math.min(...e),o=Math.max(...e),a=Math.min(...t),i=Math.max(...t);return {cx:(n+o)/2,cy:(a+i)/2,rx:(o-n)/2+r,ry:(i-a)/2+r}}function gi({items:e,position:t,onToggle:r}){return jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:f("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 oc({series:e,xAxis:t,yAxis:r,dotRadius:n=5,dotOpacity:o=.75,clusters:a=false,jitter:i=false,jitterAmount:s=12,linkedLines:l=false,title:c,height:u=300,className:p,legend:m=true,legendPosition:d="bottom",animateOnMount:g=true,emptyText:h="No data to display"}){let b=useRef(null),y=useRef(null),[v,N]=useState(600),[x,w]=useState(null);useEffect(()=>{let M=y.current;if(!M)return;let F=M.getBoundingClientRect().width;F>0&&N(F);let re=new ResizeObserver(W=>{let G=W[0]?.contentRect.width;G&&G>0&&N(G);});return re.observe(M),()=>re.disconnect()},[]);let L=useMemo(()=>e.map(M=>M.id),[e]),{visible:P,toggle:A,isVisible:D}=wr(L),S=useMemo(()=>kr(e.length),[e.length]),C=useMemo(()=>new Map(e.map((M,F)=>[M.id,M.color??S[F]])),[e,S]),I=useMemo(()=>Cr(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=useMemo(()=>Mr(v,u,I),[v,u,I]),T=useMemo(()=>Vp(e,P,t),[e,P,t]),R=useMemo(()=>Hp(e,P,r),[e,P,r]),O=useMemo(()=>rc(T,[k.plotLeft,k.plotRight]),[T,k]),E=useMemo(()=>rc(R,[k.plotBottom,k.plotTop]),[R,k]),ne=useMemo(()=>nc(T,t?.tickCount??6),[T,t?.tickCount]),U=useMemo(()=>nc(R,r?.tickCount??5),[R,r?.tickCount]),z=useCallback((M,F,re,W,G)=>{let le=b.current?.getBoundingClientRect();le&&w({x:M.clientX-le.left+12,y:M.clientY-le.top-10,seriesName:F,xVal:We(re,t?.format),yVal:We(W,r?.format),color:G});},[t?.format,r?.format]),H=useCallback((M,F,re,W,G)=>{M.preventDefault();let le=b.current?.getBoundingClientRect();if(!le)return;let ke=M.touches[0];ke&&w({x:ke.clientX-le.left+12,y:ke.clientY-le.top-10,seriesName:F,xVal:We(re,t?.format),yVal:We(W,r?.format),color:G});},[t?.format,r?.format]),_=useMemo(()=>e.map((M,F)=>({id:M.id,label:M.name,color:M.color??S[F],visible:D(M.id)})),[e,S,D]),V=e.some(M=>M.data.length>0),oe=d==="left"||d==="right",be=jsxs("svg",{role:"img","aria-label":c??"Scatter chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[U.map(M=>jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:E(M),y2:E(M),stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},M)),a&&e.map((M,F)=>{if(!D(M.id)||M.data.length<2)return null;let re=C.get(M.id)??"var(--color-chart-1)",W=M.data.map(ke=>O(Number(ke.x))),G=M.data.map(ke=>E(ke.y)),le=Fp(W,G,16);return le?jsx("ellipse",{cx:le.cx,cy:le.cy,rx:le.rx,ry:le.ry,fill:re,fillOpacity:.06,stroke:re,strokeOpacity:.3,strokeWidth:1.5,strokeDasharray:"5 3",className:g?"chart-cluster-ellipse":"",style:{animationDelay:`${F*.1}s`}},`cluster-${M.id}`):null}),l&&e.map(M=>{if(!D(M.id)||M.data.length<2)return null;let F=C.get(M.id)??"var(--color-chart-1)",W=[...M.data].sort((G,le)=>Number(G.x)-Number(le.x)).map(G=>`${O(Number(G.x)).toFixed(2)},${E(G.y).toFixed(2)}`).join(" ");return jsx("polyline",{points:W,fill:"none",stroke:F,strokeWidth:1.5,className:"chart-scatter-link"},`link-${M.id}`)}),e.map((M,F)=>{if(!D(M.id))return null;let re=C.get(M.id)??"var(--color-chart-1)";return jsx("g",{className:"chart-scatter-group",children:M.data.map((W,G)=>{let[le,ke]=i?_p(F,G,s):[0,0],B=O(Number(W.x))+le,q=E(W.y)+ke;return jsx("circle",{cx:B,cy:q,r:n,fill:re,fillOpacity:o,stroke:re,strokeWidth:1,strokeOpacity:.5,className:f("chart-scatter-dot",g&&"chart-scatter-dot--animate"),style:{color:re},onMouseMove:Z=>z(Z,M.name,W.x,W.y,re),onMouseLeave:()=>w(null),onTouchStart:Z=>H(Z,M.name,W.x,W.y,re),onTouchEnd:()=>w(null)},G)})},M.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"}),U.map(M=>{let F=E(M);return jsxs("g",{children:[jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:k.plotLeft-6,y:F,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(M,r?.format)})]},M)}),ne.map(M=>{let F=O(M);return jsxs("g",{children:[jsx("line",{x1:F,x2:F,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:F,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(M,t?.format)})]},M)}),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:f(Yt(),p),children:[c&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&d==="top"&&jsx(gi,{items:_,position:"top",onToggle:A}),jsxs("div",{className:f("flex items-start",oe&&"gap-0"),children:[m&&d==="left"&&jsx(gi,{items:_,position:"left",onToggle:A}),jsx("div",{ref:y,className:"flex-1 min-w-0 overflow-hidden",children:V?be:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:h})}),m&&d==="right"&&jsx(gi,{items:_,position:"right",onToggle:A})]}),m&&d==="bottom"&&jsx(gi,{items:_,position:"bottom",onToggle:A}),x&&jsxs("div",{className:Xt(),style:{left:x.x,top:x.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:x.color}}),jsx("span",{className:"font-medium",children:x.seriesName})]}),jsxs("div",{className:"text-primary-300",children:["X: ",jsx("span",{className:"font-medium text-primary-50",children:x.xVal})," ","Y: ",jsx("span",{className:"font-medium text-primary-50",children:x.yVal})]})]})]})}var Y1={LineChart:Jl,BarChart:Ql,PieChart:tc,ScatterChart:oc},ac=Y1;var U1={Primitives:Vi,Layout:Oi,DataDisplay:os,Navigation:us,Disclosure:hs,Overlay:Ps,Feedback:Bs,Extras:_l,Forms:$l,Chart:ac},DA=U1;
|
|
128
|
-
export{ms as Accordion,sh as AccordionContent,ah as AccordionItem,ih as AccordionTrigger,Ds as Alert,qh as AlertContent,Jh as AlertDescription,Gh as AlertIcon,Xh as AlertTitle,Ko as Avatar,jo as AvatarGroup,Si as Badge,Ql as BarChart,ua as Breadcrumb,Vt as Button,Hi as Card,af as CardContent,of as CardDescription,sf as CardFooter,rf as CardHeader,nf as CardTitle,ac as Chart,Gi as Chat,An as Checkbox,Us as CinePlayer,Zi as CodeBlock,Ka as CommandPalette,Ss as ContextMenu,os as DataDisplay,Vf as DataTable,Wa as DateTimePicker,Zn as Dialog,Ch as DialogClose,vs as DialogContent,ks as DialogDescription,Ns as DialogFooter,xs as DialogHeader,ws as DialogTitle,hs as Disclosure,ka as Drawer,md as DrawerBody,hd as DrawerClose,fd as DrawerFooter,pd as DrawerHeader,wi as Dropdown,qr as DropdownButton,_l as Extras,Bs as Feedback,Zs as FileExplorer,Ks as FilmReel
|
|
127
|
+
`).trim()}function Il(e){return e.trim()?e.trim().split(/\s+/).length:0}function zl(e,t,r=false){if(!t)return [];let n=[],o=r?"g":"gi",a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(a,o);return e.descendants((s,l)=>{if(!s.isText||!s.text)return;let c;for(i.lastIndex=0;(c=i.exec(s.text))!==null;)n.push({from:l+c.index,to:l+c.index+c[0].length});}),n}function ii(e,t,r=false){if(!t)return [];let n=r?"g":"gi",o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(o,n),i=[],s;for(;(s=a.exec(e))!==null;)i.push([s.index,s.index+s[0].length]);return i}var Pt=new PluginKey("rteSearch"),zk=Ke.create({name:"rteSearch",addProseMirrorPlugins(){return [new Plugin({key:Pt,state:{init(){return {query:"",caseSensitive:false,currentIndex:0,matches:[]}},apply(e,t){let r=e.getMeta(Pt);if(r){let n={...t,...r};return n.matches=zl(e.doc,n.query,n.caseSensitive),n.currentIndex>=n.matches.length&&(n.currentIndex=0),n}if(e.docChanged&&t.query){let n=zl(e.doc,t.query,t.caseSensitive),o=Math.min(t.currentIndex,Math.max(0,n.length-1));return {...t,matches:n,currentIndex:o}}return t}},props:{decorations(e){let t=Pt.getState(e);if(!t?.query||!t.matches.length)return DecorationSet.empty;let r=t.matches.map((n,o)=>Decoration.inline(n.from,n.to,{class:o===t.currentIndex?"rte-search-current":"rte-search-match"}));return DecorationSet.create(e.doc,r)}}})]}});function dp(e){return useEditor({extensions:[vk,xk,wk.configure({types:["heading","paragraph"]}),Rl,Color,Nk.configure({multicolor:true}),ip,sp,lp,Ck.configure({openOnClick:false}),Tk.configure({width:480,height:320}),Mk.configure({placeholder:e.placeholder??"Start typing\u2026"}),Sk,Pk,Rk,Ek,Table$1.configure({resizable:true}),Dk,Ak,Ik,zk],content:e.defaultValue??"",editable:!e.readOnly,autofocus:e.autoFocus,onUpdate:({editor:r})=>{e.onChange?.({html:r.getHTML(),markdown:"",json:r.getJSON(),text:r.getText()});}})}var P1={tab_home:"Home",tab_insert:"Insert",tab_format:"Format",group_clipboard:"Clipboard",undo:"Undo",redo:"Redo",save:"Save",group_text:"Text",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",group_headings:"Headings",h1:"H1",h2:"H2",h3:"H3",paragraph:"Normal",group_alignment:"Alignment",alignLeft:"Left",alignCenter:"Center",alignRight:"Right",alignJustify:"Justify",group_lists:"Lists",bulletList:"Bullet",orderedList:"Ordered",group_media:"Media",image:"Image",video:"Video",youtube:"Video",group_content:"Content",link:"Link",table:"Table",codeBlock:"Code Block",blockquote:"Quote",divider:"Divider",group_style:"Style",color:"Color",highlight:"Highlight",subscript:"Sub",superscript:"Sup",group_reset:"Reset",clear:"Clear",group_table_rows:"Rows",addRowBefore:"Add Above",addRowAfter:"Add Below",deleteRow:"Del Row",group_table_cols:"Columns",addColBefore:"Add Left",addColAfter:"Add Right",deleteColumn:"Del Col",group_table_cells:"Cells",mergeCells:"Merge",splitCell:"Split",deleteTable:"Del Table"};function nr({icon:e,label:t,onClick:r,disabled:n=false,title:o}){return jsxs("button",{type:"button",className:f("rte-tbar-btn",n&&"rte-tbar-btn--disabled"),onClick:r,disabled:n,title:o??t,children:[e,jsx("span",{className:"rte-tbar-label",children:t})]})}function R1({editor:e,L:t,readOnly:r}){let[,n]=useState(0),[o,a]=useState(null),i=useRef(null);if(useEffect(()=>{if(!e)return;let u=()=>n(p=>p+1);return e.on("selectionUpdate",u),e.on("transaction",u),()=>{e.off("selectionUpdate",u),e.off("transaction",u);}},[e]),useEffect(()=>{if(!o)return;function u(p){i.current&&!i.current.contains(p.target)&&a(null);}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),!e||r||!e.isActive("table"))return null;let s=e.can().mergeCells(),l=e.can().splitCell();function c(){l?e.chain().focus().splitCell().run():a(u=>u?null:"col");}return jsxs("div",{className:"rte-tablebar",role:"toolbar","aria-label":"Table editing",children:[jsx("span",{className:"rte-tbar-group-label",children:t.group_table_rows}),jsx(nr,{icon:jsx(BetweenHorizontalStart,{size:13}),label:t.addRowBefore,onClick:()=>e.chain().focus().addRowBefore().run()}),jsx(nr,{icon:jsx(BetweenHorizontalEnd,{size:13}),label:t.addRowAfter,onClick:()=>e.chain().focus().addRowAfter().run()}),jsx(nr,{icon:jsx(Trash2,{size:13}),label:t.deleteRow,onClick:()=>e.chain().focus().deleteRow().run()}),jsx("div",{className:"rte-tbar-sep"}),jsx("span",{className:"rte-tbar-group-label",children:t.group_table_cols}),jsx(nr,{icon:jsx(BetweenVerticalStart,{size:13}),label:t.addColBefore,onClick:()=>e.chain().focus().addColumnBefore().run()}),jsx(nr,{icon:jsx(BetweenVerticalEnd,{size:13}),label:t.addColAfter,onClick:()=>e.chain().focus().addColumnAfter().run()}),jsx(nr,{icon:jsx(Trash2,{size:13}),label:t.deleteColumn,onClick:()=>e.chain().focus().deleteColumn().run()}),jsx("div",{className:"rte-tbar-sep"}),jsx("span",{className:"rte-tbar-group-label",children:t.group_table_cells}),jsx(nr,{icon:jsx(TableCellsMerge,{size:13}),label:t.mergeCells,onClick:()=>e.chain().focus().mergeCells().run(),disabled:!s,title:s?t.mergeCells:`${t.mergeCells} (Shift+click to select cells)`}),jsxs("div",{className:"rte-tbar-split-wrap",ref:i,children:[jsx(nr,{icon:jsx(TableCellsSplit,{size:13}),label:l?t.splitCell:`${t.splitCell}\u2026`,onClick:c,title:l?t.splitCell:"Split by adding a column or row"}),o&&!l&&jsxs("div",{className:"rte-tbar-split-picker",children:[jsxs("button",{className:"rte-tbar-split-pick-btn",onClick:()=>{e.chain().focus().addColumnAfter().run(),a(null);},children:[jsx(BetweenVerticalEnd,{size:13}),"Split column"]}),jsxs("button",{className:"rte-tbar-split-pick-btn",onClick:()=>{e.chain().focus().addRowAfter().run(),a(null);},children:[jsx(BetweenHorizontalEnd,{size:13}),"Split row"]})]})]}),jsx("div",{className:"rte-tbar-sep"}),jsx(nr,{icon:jsx(Trash2,{size:13}),label:t.deleteTable,onClick:()=>e.chain().focus().deleteTable().run()})]})}function Hl({open:e,onClose:t,children:r}){let n=useRef(null);return useEffect(()=>{if(!e)return;function o(a){n.current&&!n.current.contains(a.target)&&t();}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t]),e?jsx("div",{ref:n,className:"rte-inline-dialog",children:r}):null}function E1({mode:e,onClose:t,onFind:r,onPrev:n,onNext:o,onReplace:a,onReplaceAll:i,matchCount:s,currentIndex:l}){let[c,u]=$n.useState(""),[p,m]=$n.useState(""),[d,g]=$n.useState(false),h=$n.useRef(null);useEffect(()=>{h.current?.focus();},[]);function b(w){let L=w.target.value;u(L),r(L,d);}function y(){let w=!d;g(w),r(c,w);}function v(w){if(w.key==="Escape"){t();return}w.key==="Enter"&&(w.shiftKey?n():o());}let N=s>0,x=c?N?`${l+1} / ${s}`:"No results":"";return jsxs("div",{className:"rte-findbar",role:"search","aria-label":"Find and replace",children:[jsxs("div",{className:"rte-findbar-row",children:[jsx(Search,{size:14,className:"rte-findbar-icon"}),jsx("input",{ref:h,className:"rte-findbar-input",value:c,onChange:b,onKeyDown:v,placeholder:"Find\u2026","aria-label":"Find",spellCheck:false}),jsx("button",{className:f("rte-findbar-btn",d&&"rte-findbar-btn--active"),onClick:y,title:"Match case","aria-pressed":d,children:"Aa"}),jsx("span",{className:"rte-findbar-count",children:x}),jsx("button",{className:"rte-findbar-btn",onClick:n,disabled:!N,title:"Previous match (Shift+Enter)","aria-label":"Previous match",children:jsx(ChevronUp,{size:14})}),jsx("button",{className:"rte-findbar-btn",onClick:o,disabled:!N,title:"Next match (Enter)","aria-label":"Next match",children:jsx(ChevronDown,{size:14})}),jsx("button",{className:"rte-findbar-btn rte-findbar-btn--close",onClick:t,title:"Close (Esc)","aria-label":"Close find bar",children:jsx(X,{size:14})})]}),e==="replace"&&jsxs("div",{className:"rte-findbar-row",children:[jsx(Replace,{size:14,className:"rte-findbar-icon"}),jsx("input",{className:"rte-findbar-input",value:p,onChange:w=>m(w.target.value),onKeyDown:w=>w.key==="Escape"&&t(),placeholder:"Replace with\u2026","aria-label":"Replace with",spellCheck:false}),jsx("button",{className:"rte-findbar-btn rte-findbar-btn--action",onClick:()=>a(p),disabled:!N,title:"Replace current",children:"Replace"}),jsx("button",{className:"rte-findbar-btn rte-findbar-btn--action",onClick:()=>i(p),disabled:!N,title:"Replace all",children:"All"})]})]})}var Co=forwardRef(function(t,r){let{mode:n,defaultMode:o="richtext",onModeChange:a,showPreview:i,defaultShowPreview:s=false,onPreviewChange:l,defaultValue:c="",value:u,onChange:p,placeholder:m="Start typing\u2026",readOnly:d=false,height:g=400,minHeight:h,maxHeight:b,showWordCount:y=true,showCharCount:v=true,onImageUpload:N,allowedImageTypes:x,maxImageSize:w,autoFocus:L=false,spellCheck:P=true,className:A,style:D,labels:S,extraRibbonGroups:C,extraRibbonTabs:I,onSave:k}=t,M={...P1,...S},[R,$]=useState(o),E=n??R;function ne(ee){if(ee!==E){if(ee==="markdown"){let ae=j?.getHTML()??re;F(ai(ae));}else {let ae=ko(T);W(ae),j?.commands.setContent(ae);}n===void 0&&$(ee),a?.(ee);}}let[U,z]=useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:false);function H(ee){z(ee),ee?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");}useEffect(()=>{H(U);let ee=window.matchMedia("(prefers-color-scheme: dark)");function ae(Ie){z(Ie.matches),H(Ie.matches);}return ee.addEventListener("change",ae),()=>ee.removeEventListener("change",ae)},[]);let[_,V]=useState(s),oe=i??_;function be(ee){let ae=ee??!oe;i===void 0&&V(ae),l?.(ae);}let[T,F]=useState(E==="markdown"?u??c:""),[re,W]=useState(E==="richtext"?u??c??"":""),[G,le]=useState(false),[ke,B]=useState(""),[q,Z]=useState(false),[ue,te]=useState(""),[ve,Ne]=useState(false),[X,de]=useState(""),[Q,ie]=useState(null),[Pe,$e]=useState(null),[Xe,se]=useState(0),[Re,K]=useState(0),[ce,me]=useState(""),J=useRef(null),Ce=useRef(null),Ye=useRef(null);useEffect(()=>{function ee(ae){!(ae.metaKey||ae.ctrlKey)||ae.key.toLowerCase()!=="f"||Ce.current?.contains(ae.target)&&(ae.preventDefault(),ae.shiftKey?$e(ze=>ze==="replace"?null:"replace"):$e(ze=>ze!==null?null:"find"));}return document.addEventListener("keydown",ee,true),()=>document.removeEventListener("keydown",ee,true)},[]);function vt(ee){let ae=ee.trim();if(/\.(mp4|webm|ogg|ogv|mov|m4v|flv|mkv)(\?[^#]*)?$/i.test(ae))return {kind:"video"};if(/(?:youtube\.com|youtu\.be|youtube-nocookie\.com)/.test(ae))return {kind:"youtube"};let Ie=ae.match(/vimeo\.com\/(?:video\/)?(\d+)/);if(Ie)return {kind:"iframe",embedUrl:`https://player.vimeo.com/video/${Ie[1]}`};let ze=ae.match(/bilibili\.com\/video\/(BV[\w]+|av\d+)/i);if(ze)return {kind:"iframe",embedUrl:`https://player.bilibili.com/player.html?bvid=${ze[1]}&high_quality=1&danmaku=0`};let Je=ae.match(/dailymotion\.com\/(?:video\/|embed\/video\/)([a-z0-9]+)/i);if(Je)return {kind:"iframe",embedUrl:`https://www.dailymotion.com/embed/video/${Je[1]}`};let tt=ae.match(/twitch\.tv\/\w+\/clip\/([\w-]+)/);if(tt){let ft=typeof window<"u"?window.location.hostname:"localhost";return {kind:"iframe",embedUrl:`https://clips.twitch.tv/embed?clip=${tt[1]}&parent=${ft}`}}return null}function Wr(){let ee=X.trim();if(!ee)return;let ae=vt(ee);if(!ae){ie("Unsupported URL. Paste a YouTube, Vimeo, Bilibili, Dailymotion, or direct .mp4/.webm link.");return}ae.kind==="youtube"?j?.chain().focus().setYoutubeVideo({src:ee}).run():ae.kind==="iframe"?j?.chain().focus().insertContent({type:"embedFrame",attrs:{src:ae.embedUrl}}).run():j?.chain().focus().insertContent({type:"resizableVideo",attrs:{src:ee}}).run(),de(""),ie(null),Ne(false);}function O(ee,ae){j&&j.view.dispatch(j.view.state.tr.setMeta(Pt,{query:ee,caseSensitive:ae,currentIndex:0}));}function ge(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=ae.matches.length,ze=((ae.currentIndex+ee)%Ie+Ie)%Ie;j.view.dispatch(j.view.state.tr.setMeta(Pt,{currentIndex:ze}));let Je=ae.matches[ze];Je&&(j.commands.setTextSelection({from:Je.from,to:Je.to}),j.commands.scrollIntoView());}function Le(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=ae.matches[ae.currentIndex];Ie&&(j.chain().setTextSelection({from:Ie.from,to:Ie.to}).insertContent(ee).run(),O(ae.query,ae.caseSensitive));}function De(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=j.chain();[...ae.matches].reverse().forEach(ze=>{Ie.setTextSelection({from:ze.from,to:ze.to}).insertContent(ee);}),Ie.run(),O(ae.query,ae.caseSensitive);}function He(ee,ae){me(ee);let Ie=ii(T,ee,ae);se(Ie.length),K(0);}function dt(ee,ae,Ie){let ze=ii(T,ae,Ie);if(!ze.length)return;let Je=ze.length,tt=((Re+ee)%Je+Je)%Je;K(tt);let ft=Ye.current;ft&&(ft.focus(),ft.setSelectionRange(ze[tt][0],ze[tt][1]));}function Gt(ee,ae,Ie){let ze=ii(T,ee,Ie);if(!ze.length)return;let[Je,tt]=ze[Re]??ze[0],ft=T.slice(0,Je)+ae+T.slice(tt);F(ft);}function To(ee,ae,Ie){let ze=ee.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Je=new RegExp(ze,"gi");F(tt=>tt.replace(Je,ae)),se(0),K(0);}let j=dp({defaultValue:E==="richtext"?u??c:"",placeholder:m,readOnly:d,autoFocus:E==="richtext"&&L,onChange:ee=>{W(ee.html),p?.({...ee,markdown:ai(ee.html)});}});useEffect(()=>{u!==void 0&&j&&E==="richtext"&&j.getHTML()!==u&&(j.commands.setContent(u),W(u));},[u,j,E]);let qt=j?Pt.getState(j.view.state):null,ir=E==="richtext"?qt?.matches.length??0:Xe,Sn=E==="richtext"?qt?.currentIndex??0:Re;function Yr(){if(!k)return;let ee=E==="markdown"?T:j?.getHTML()??"";k(ee,E);}useEffect(()=>{if(!k)return;function ee(ae){!(ae.metaKey||ae.ctrlKey)||ae.key.toLowerCase()!=="s"||Ce.current?.contains(ae.target)&&(ae.preventDefault(),Yr());}return document.addEventListener("keydown",ee,true),()=>document.removeEventListener("keydown",ee,true)},[k,E,T,j]);function Mr(ee){let ae=ee.target.value;F(ae),p?.({html:ko(ae),markdown:ae,json:{},text:ae});}let Kp=useCallback(async ee=>{let Ie=Array.from(ee.clipboardData?.items??[]).find(tt=>tt.type.startsWith("image/"));if(!Ie)return;ee.preventDefault();let ze=Ie.getAsFile();if(!ze||x&&!x.includes(ze.type)||w&&ze.size>w)return;let Je;if(N?Je=await N(ze):Je=await new Promise(tt=>{let ft=new FileReader;ft.onload=()=>tt(ft.result),ft.readAsDataURL(ze);}),E==="richtext"&&j)j.chain().focus().setImage({src:Je}).run();else {let tt=ee.currentTarget.querySelector(".rte-markdown-source");if(tt){let ft=tt.selectionStart,Xp=``,Gp=T.slice(0,ft),qp=T.slice(ft);F(Gp+Xp+qp);}}},[E,j,T,N,x,w]);useImperativeHandle(r,()=>({getContent:()=>E==="markdown"?T:j?.getHTML()??"",getMode:()=>E,getHTML:()=>j?.getHTML()??"",getMarkdown:()=>E==="markdown"?T:ai(j?.getHTML()??""),getJSON:()=>j?.getJSON()??{},getText:()=>j?.getText()??"",setHTML:ee=>j?.commands.setContent(ee),setMarkdown:ee=>{F(ee),j?.commands.setContent(ko(ee));},setJSON:ee=>j?.commands.setContent(ee),clear:()=>{j?.commands.clearContent(),F("");},focus:()=>j?.commands.focus(),blur:()=>(j?.view.dom).blur()}));let jp=j?.storage?.characterCount?.characters?.()??T.length,Wp=E==="richtext"?Il(j?.getText()??""):Il(T),Yp=[...[{key:"home",label:M.tab_home,groups:[{key:"clipboard",label:M.group_clipboard,items:[{key:"undo",label:M.undo,icon:jsx(Undo2,{}),disabled:d||!j?.can().undo()||E==="markdown",onClick:()=>j?.chain().focus().undo().run()},{key:"redo",label:M.redo,icon:jsx(Redo2,{}),disabled:d||!j?.can().redo()||E==="markdown",onClick:()=>j?.chain().focus().redo().run()},{key:"save",label:M.save,icon:jsx(Save,{}),disabled:d||!k,onClick:Yr}]},{key:"text",label:M.group_text,items:[{key:"bold",label:M.bold,icon:jsx(Bold,{}),active:j?.isActive("bold"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBold().run()},{key:"italic",label:M.italic,icon:jsx(Italic,{}),active:j?.isActive("italic"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleItalic().run()},{key:"underline",label:M.underline,icon:jsx(Underline,{}),active:j?.isActive("underline"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleUnderline().run()},{key:"strike",label:M.strikethrough,icon:jsx(Strikethrough,{}),active:j?.isActive("strike"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleStrike().run()}]},{key:"headings",label:M.group_headings,items:[{key:"h1",label:M.h1,icon:jsx(Heading1,{}),active:j?.isActive("heading",{level:1}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:1}).run()},{key:"h2",label:M.h2,icon:jsx(Heading2,{}),active:j?.isActive("heading",{level:2}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:2}).run()},{key:"h3",label:M.h3,icon:jsx(Heading3,{}),active:j?.isActive("heading",{level:3}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:3}).run()},{key:"paragraph",label:M.paragraph,icon:jsx(Type,{}),active:j?.isActive("paragraph"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setParagraph().run()}]},{key:"alignment",label:M.group_alignment,items:[{key:"align-left",label:M.alignLeft,icon:jsx(AlignLeft,{}),active:j?.isActive({textAlign:"left"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("left").run()},{key:"align-center",label:M.alignCenter,icon:jsx(AlignCenter,{}),active:j?.isActive({textAlign:"center"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("center").run()},{key:"align-right",label:M.alignRight,icon:jsx(AlignRight,{}),active:j?.isActive({textAlign:"right"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("right").run()},{key:"align-justify",label:M.alignJustify,icon:jsx(AlignJustify,{}),active:j?.isActive({textAlign:"justify"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("justify").run()}]},{key:"lists",label:M.group_lists,items:[{key:"bullet-list",label:M.bulletList,icon:jsx(List,{}),active:j?.isActive("bulletList"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBulletList().run()},{key:"ordered-list",label:M.orderedList,icon:jsx(ListOrdered,{}),active:j?.isActive("orderedList"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleOrderedList().run()}]},...C?.home??[]]},{key:"insert",label:M.tab_insert,groups:[{key:"media",label:M.group_media,items:[{key:"image",label:M.image,icon:jsx(Image,{}),disabled:d||E==="markdown",onClick:()=>le(true)},{key:"video",label:M.video??M.youtube,icon:jsx(Video,{}),disabled:d||E==="markdown",onClick:()=>{de(""),ie(null),Ne(true);}}]},{key:"content",label:M.group_content,items:[{key:"link",label:M.link,icon:jsx(Link,{}),active:j?.isActive("link"),disabled:d||E==="markdown",onClick:()=>{let ee=j?.getAttributes("link").href??"";te(ee),Z(true);}},{key:"table",label:M.table,icon:jsx(Table,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:true}).run()},{key:"code-block",label:M.codeBlock,icon:jsx(Code,{}),active:j?.isActive("codeBlock"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleCodeBlock().run()},{key:"blockquote",label:M.blockquote,icon:jsx(Quote,{}),active:j?.isActive("blockquote"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBlockquote().run()},{key:"hr",label:M.divider,icon:jsx(Minus,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setHorizontalRule().run()}]},...C?.insert??[]]},{key:"format",label:M.tab_format,groups:[{key:"style",label:M.group_style,items:[{key:"color",label:M.color,icon:jsx(Palette,{}),disabled:d||E==="markdown",onClick:()=>{document.getElementById("rte-color-input")?.click();}},{key:"highlight",label:M.highlight,icon:jsx(Highlighter,{}),active:j?.isActive("highlight"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHighlight().run()},{key:"subscript",label:M.subscript,icon:jsx(Subscript,{}),active:j?.isActive("subscript"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleSubscript().run()},{key:"superscript",label:M.superscript,icon:jsx(Superscript,{}),active:j?.isActive("superscript"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleSuperscript().run()}]},{key:"reset",label:M.group_reset,items:[{key:"clear",label:M.clear,icon:jsx(Eraser,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().unsetAllMarks().clearNodes().run()}]},...C?.format??[]]}],...I??[]],Mo={};g&&(Mo.height=typeof g=="number"?`${g}px`:g),h&&(Mo.minHeight=typeof h=="number"?`${h}px`:h),b&&(Mo.maxHeight=typeof b=="number"?`${b}px`:b);let Up=E==="richtext"?re:ko(T);return jsxs("div",{ref:Ce,className:f("rte-root",A),style:{...Mo,...D},"data-testid":"rte-root",onPaste:Kp,children:[jsx("input",{id:"rte-color-input",type:"color",className:"sr-only","aria-hidden":true,onChange:ee=>{j?.chain().focus().setColor(ee.target.value).run();}}),jsxs("div",{ref:J,className:"rte-ribbon relative",children:[jsx(Un,{tabs:Yp}),jsxs(Hl,{open:G,onClose:()=>le(false),children:[jsx("input",{type:"url",placeholder:"Image URL\u2026",value:ke,onChange:ee=>B(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&(ke&&j?.chain().focus().setImage({src:ke}).run(),B(""),le(false));},autoFocus:true}),jsx("button",{onClick:()=>{ke&&j?.chain().focus().setImage({src:ke}).run(),B(""),le(false);},children:"Insert"}),jsx("button",{className:"rte-cancel-btn",onClick:()=>le(false),children:"Cancel"})]}),jsxs(Hl,{open:q,onClose:()=>Z(false),children:[jsx("input",{type:"url",placeholder:"https://\u2026",value:ue,onChange:ee=>te(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&(j?.chain().focus().setLink({href:ue}).run(),te(""),Z(false));},autoFocus:true}),jsx("button",{onClick:()=>{j?.chain().focus().setLink({href:ue}).run(),te(""),Z(false);},children:"Apply"}),jsx("button",{className:"rte-cancel-btn",onClick:()=>Z(false),children:"Cancel"})]}),jsxs(Hl,{open:ve,onClose:()=>Ne(false),children:[jsx("input",{type:"url",placeholder:"YouTube, Vimeo, Bilibili, or .mp4 URL\u2026",value:X,onChange:ee=>{de(ee.target.value),ie(null);},onKeyDown:ee=>{ee.key==="Enter"&&Wr();},autoFocus:true,style:{minWidth:280}}),Q&&jsx("span",{style:{fontSize:"0.72rem",color:"var(--color-danger-500)",flex:"0 0 100%"},children:Q}),jsx("button",{onClick:Wr,children:"Embed"}),jsx("button",{className:"rte-cancel-btn",onClick:()=>Ne(false),children:"Cancel"})]})]}),E==="richtext"&&jsx(R1,{editor:j,L:M,readOnly:d??false}),Pe!==null&&jsx(E1,{mode:Pe,onClose:()=>{$e(null),j&&j.view.dispatch(j.view.state.tr.setMeta(Pt,{query:"",currentIndex:0,matches:[]})),se(0),K(0),me("");},onFind:(ee,ae)=>{E==="richtext"?O(ee,ae):He(ee,ae);},onPrev:()=>{E==="richtext"?ge(-1):dt(-1,ce,false);},onNext:()=>{E==="richtext"?ge(1):dt(1,ce,false);},onReplace:ee=>{if(E==="richtext"){let ae=j?Pt.getState(j.view.state):null;Le(ee),ae&&He(ae.query,ae.caseSensitive);}else Gt(ce,ee,false);},onReplaceAll:ee=>{E==="richtext"?De(ee):To(ce,ee);},matchCount:ir,currentIndex:Sn}),jsxs("div",{className:"rte-body",children:[jsx("div",{className:"rte-editor-pane",children:E==="richtext"?jsx(EditorContent,{editor:j,spellCheck:P,readOnly:d}):jsx("textarea",{ref:Ye,className:"rte-markdown-source",value:T,onChange:Mr,placeholder:m,readOnly:d,spellCheck:P,"data-testid":"rte-markdown-source"})}),oe&&jsx("div",{className:"rte-preview-pane","data-testid":"rte-preview-pane",children:jsx("div",{className:"prose",dangerouslySetInnerHTML:{__html:Up}})})]}),jsxs("div",{className:"rte-statusbar",children:[jsxs("div",{className:"rte-statusbar-left",children:[jsx(Rr,{size:"sm",checked:U,onCheckedChange:H,checkedContent:jsx(Moon,{size:10}),uncheckedContent:jsx(Sun,{size:10}),"aria-label":"Toggle dark mode",title:U?"Switch to light mode":"Switch to dark mode"}),jsx("span",{className:"rte-statusbar-divider"}),jsx(Rr,{size:"sm",checked:E==="markdown",onCheckedChange:ee=>ne(ee?"markdown":"richtext"),disabled:n!==void 0,checkedContent:jsx(Code,{size:10}),uncheckedContent:jsx(FileText,{size:10}),"aria-label":"Toggle editor mode",title:n!==void 0?`Mode locked: ${E}`:E==="markdown"?"Markdown mode (click for Rich Text)":"Rich Text mode (click for Markdown)"}),jsx("span",{className:"rte-statusbar-label",children:E==="markdown"?"Markdown":"Rich Text"})]}),jsxs("div",{className:"rte-statusbar-right",children:[jsx(Rr,{size:"sm",checked:oe,onCheckedChange:be,checkedContent:jsx(Eye,{size:10}),uncheckedContent:jsx(EyeOff,{size:10}),"aria-label":"Toggle live preview",title:oe?"Hide preview":"Show live preview"}),jsx("span",{className:"rte-statusbar-label",children:"Preview"}),(y||v)&&jsx("span",{className:"rte-statusbar-divider"}),y&&jsxs("span",{children:[Wp," words"]}),v&&jsxs("span",{children:[jp," chars"]})]})]})]})});Co.displayName="RichTextEditor";var L1={FilmReel:Ks,MiniPlayer:Ws,CinePlayer:Us,FileExplorer:Zs,Masonry:nl,TypewriterText:$a,CommandPalette:Ka,Timeline:il,DateTimePicker:Wa,LoginPanel:Ga,RichTextEditor:Co},_l=L1;var Bl=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),_1={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},bp={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function $l({children:e,className:t,intent:r,size:n="md",layout:o="stacked",title:a,description:i,footer:s,onValues:l,onSubmit:c,...u}){let p=_1[n??"md"],[m,d]=useState({}),g=useCallback(h=>{if(h.preventDefault(),c?.(h),l){let b=Object.fromEntries(new FormData(h.currentTarget).entries()),y=l(b,h),v=N=>{if(!N)return;let x={};for(let[w,{result:L,reason:P}]of Object.entries(N))P&&(x[w]={status:L?"success":"error",message:P});d(x);};y instanceof Promise?y.then(v).catch(()=>{}):v(y);}},[c,l]);return jsx(Bl.Provider,{value:{layout:o??"stacked",size:n??"md",labelWidth:p,bulkErrors:m},children:jsxs("form",{className:f(ll({intent:r,size:n}),"flex flex-col",t),onSubmit:g,...u,children:[(a||i)&&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}),i&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:i})]}),jsx("div",{className:f("flex flex-col",bp[n??"md"]),children:e}),s&&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:s})]})})}var F1={error:jsx(AlertCircle,{}),warning:jsx(AlertTriangle,{}),success:jsx(CheckCircle,{}),hint:jsx(Info,{})};function B1({label:e,layout:t,required:r,hint:n,validation:o,name:a,onValidate:i,className:s,children:l}){let c=useContext(Bl),u=useId(),[p,m]=useState(void 0),d=a?c.bulkErrors[a]:void 0,g=o??p??d,b=(t??c.layout)==="inline",y=useCallback(L=>{let P=L!=null&&typeof L=="object"&&"target"in L?L.target.value:L;if(a&&c.bulkErrors[a]&&(c.bulkErrors[a]=void 0),!i){m(void 0);return}let{result:A,reason:D}=i(P);m(D?{status:A?"success":"error",message:D}:void 0);},[i,a,c.bulkErrors]),v=g?`${u}-validation`:n?`${u}-hint`:void 0,N=$n.Children.map(l,(L,P)=>{if(P!==0||!$n.isValidElement(L))return L;let A=L,D={};if(A.props.id||(D.id=u),v&&!A.props["aria-describedby"]&&(D["aria-describedby"]=v),g?.status==="error"&&!A.props["aria-invalid"]&&(D["aria-invalid"]=true),a&&!A.props.name&&(D.name=a),i){let S=A.props.onChange;D.onChange=C=>{S?.(C),y(C);};}return Object.keys(D).length?$n.cloneElement(A,D):L}),x=e!=null&&jsx("label",{htmlFor:u,className:f("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:c.labelWidth,minWidth:c.labelWidth}:void 0,children:e}),w=o?`${u}-validation`:n?`${u}-hint`:void 0;return jsxs("div",{className:f("flex w-full flex-col gap-1.5",b&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",s),children:[x,jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[N,g&&jsxs("p",{id:`${u}-validation`,className:f(cl({status:g.status})),role:g.status==="error"?"alert":void 0,children:[F1[g.status],jsx("span",{children:g.message})]}),n&&jsx("p",{id:w===`${u}-hint`?w:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:n})]})]})}function $1({title:e,description:t,className:r,children:n}){let{size:o}=useContext(Bl);return jsxs("fieldset",{className:f("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",bp[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 O1={Form:$l,OTPInput:wn},Ol=O1;var Yt=cva("relative w-full font-sans select-none",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Ut=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"}}),Xt=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 wr(e){let[t,r]=useState(()=>new Set(e)),n=useCallback(i=>{r(s=>{let l=new Set(s);return l.has(i)?l.delete(i):l.add(i),l});},[]),o=useCallback(i=>t.has(i),[t]),a=useCallback(()=>{r(new Set(e));},[e]);return {visible:t,toggle:n,isVisible:o,showAll:a}}function kr(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 Nr(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 Tn(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 We(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 Rt(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 Cr(e,t,r){return {top:20,right:r?65:20,bottom:e?52:36,left:t?65:52}}function Tr(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 yp(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let i=String(a.x);r.has(i)||(r.add(i),n.push(i));}return n}function Wl(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data)l.y<n&&(n=l.y),l.y>o&&(o=l.y);if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function li(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function ci(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 vp(e,t,r){return e.map(n=>`${t(n.x).toFixed(2)},${r(n.y).toFixed(2)}`).join(" ")}function Yl(e,t,r){if(e.length===0)return "";let n=e.map(i=>({x:t(i.x),y:r(i.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 i=0;i<n.length-1;i++){let s=i===0?{x:2*n[0].x-n[1].x,y:2*n[0].y-n[1].y}:n[i-1],l=n[i],c=n[i+1],u=i+2<n.length?n[i+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},p=l.x+(c.x-s.x)*o/3,m=l.y+(c.y-s.y)*o/3,d=c.x-(u.x-l.x)*o/3,g=c.y-(u.y-l.y)*o/3;a+=` C ${p.toFixed(2)} ${m.toFixed(2)}, ${d.toFixed(2)} ${g.toFixed(2)}, ${c.x.toFixed(2)} ${c.y.toFixed(2)}`;}return a}function xp(e,t,r,n,o){if(e.length===0)return "";let a=n?Yl(e,t,r):`M ${e.map(l=>`${t(l.x).toFixed(2)},${r(l.y).toFixed(2)}`).join(" L ")}`,i=t(e[e.length-1].x).toFixed(2),s=t(e[0].x).toFixed(2);return `${a} L ${i},${o.toFixed(2)} L ${s},${o.toFixed(2)} Z`}function di(e,t=5){return Tn(e[0],e[1],t)}function Ul(e,t,r){if(t.length===0)return -1;let n=1/0,o=0;for(let a=0;a<t.length;a++){let i=Math.abs(r(t[a])-e);i<n&&(n=i,o=a);}return o}function Xl(e,t){return e.data.find(r=>String(r.x)===t)?.y}function wp(e){for(let t of e)for(let r of t.data)if(typeof r.x=="string")return true;return false}function ui({items:e,position:t,onToggle:r}){return jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:f("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 Jl({series:e,xAxis:t,yAxis:r,y2Axis:n,y2Series:o=[],smooth:a=false,showDots:i=true,area:s=false,strokeWidth:l=2,title:c,height:u=300,className:p,legend:m=true,legendPosition:d="bottom",animateOnMount:g=true,emptyText:h="No data to display"}){let b=useRef(null),y=useRef(null),[v,N]=useState(600),[x,w]=useState(null),[L,P]=useState(null);useEffect(()=>{let B=y.current;if(!B)return;let q=B.getBoundingClientRect().width;q>0&&N(q);let Z=new ResizeObserver(ue=>{let te=ue[0]?.contentRect.width;te&&te>0&&N(te);});return Z.observe(B),()=>Z.disconnect()},[]);let A=useMemo(()=>e.map(B=>B.id),[e]),{visible:D,toggle:S,isVisible:C}=wr(A),I=useMemo(()=>kr(e.length),[e.length]),k=useMemo(()=>new Map(e.map((B,q)=>[B.id,B.color??I[q]])),[e,I]),M=useMemo(()=>Cr(!!t?.label,!!r?.label,!!n),[t?.label,r?.label,n]),R=useMemo(()=>Tr(v,u,M),[v,u,M]),$=useMemo(()=>wp(e),[e]),E=useMemo(()=>$?yp(e,D):[],[e,D,$]),ne=useMemo(()=>{if($){let te=ci(E,[R.plotLeft,R.plotRight]);return ve=>te(ve)}let B=e.flatMap(te=>te.data.map(ve=>ve.x));if(B.length===0)return ()=>R.plotLeft;let q=Math.min(...B),Z=Math.max(...B),ue=li([q,Z],[R.plotLeft,R.plotRight]);return te=>ue(te)},[e,$,E,R]),U=useMemo(()=>Wl(e,D,r),[e,D,r]),z=useMemo(()=>li(U,[R.plotBottom,R.plotTop]),[U,R]),H=useMemo(()=>di(U,r?.tickCount??5),[U,r?.tickCount]),_=useMemo(()=>{if(!n)return null;let B=e.filter(q=>o.includes(q.id));return Wl(B,D,n)},[n,e,o,D]),V=useMemo(()=>_?li(_,[R.plotBottom,R.plotTop]):null,[_,R]),oe=useMemo(()=>_?di(_,n?.tickCount??5):[],[_,n?.tickCount]),be=useMemo(()=>{if($)return E;let B=e.flatMap(ue=>ue.data.map(te=>Number(te.x)));if(B.length===0)return [];let q=Math.min(...B),Z=Math.max(...B);return di([q,Z],t?.tickCount??6)},[$,E,e,t?.tickCount]),T=useCallback(B=>{let q=B.currentTarget.closest("svg");if(!q)return;let Z=q.getBoundingClientRect(),ue=B.clientX-Z.left,te=b.current?.getBoundingClientRect();if(!te)return;let ve="",Ne=ue;if($&&E.length>0){let ie=ci(E,[R.plotLeft,R.plotRight]),Pe=Ul(ue,E,ie);ve=E[Pe]??"",Ne=ie(ve);}else if(!$){let ie=be;ve=We((ue-R.plotLeft)/R.plotWidth*(ie[ie.length-1]-ie[0])+ie[0],t?.format),Ne=ue;}let X=e.filter(ie=>C(ie.id)).map(ie=>{o.includes(ie.id)&&V!=null?V:z;let Xe;if($)Xe=Xl(ie,ve);else {let se=ue,Re=1/0,K;for(let ce of ie.data){let me=ne(ce.x),J=Math.abs(me-se);J<Re&&(Re=J,K=ce.y);}Xe=K;}return {name:ie.name,value:Xe!==void 0?We(Xe,r?.format):"\u2014",color:k.get(ie.id)??"var(--color-chart-1)"}});Ne>=R.plotLeft&&Ne<=R.plotRight&&P(Ne);let de=B.clientX-te.left+12,Q=B.clientY-te.top-10;w({x:de,y:Q,label:ve,items:X});},[$,E,R,e,C,o,V,z,ne,be,t?.format,r?.format,k]),F=useCallback(()=>{w(null),P(null);},[]),re=useCallback(B=>{B.preventDefault();let q=B.touches[0];if(!q)return;let Z=B.currentTarget.closest("svg");if(!Z)return;let ue=Z.getBoundingClientRect(),te=b.current?.getBoundingClientRect();if(!te)return;let ve=q.clientX-ue.left,Ne=ve,X="";if($&&E.length>0){let Q=ci(E,[R.plotLeft,R.plotRight]),ie=Ul(ve,E,Q);X=E[ie]??"",Ne=Q(X);}Ne>=R.plotLeft&&Ne<=R.plotRight&&P(Ne);let de=e.filter(Q=>C(Q.id)).map(Q=>({name:Q.name,value:$&&X?We(Xl(Q,X)??0,r?.format):"\u2014",color:k.get(Q.id)??"var(--color-chart-1)"}));w({x:q.clientX-te.left+12,y:q.clientY-te.top-10,label:X,items:de});},[$,E,R,e,C,r?.format,k]),W=useMemo(()=>e.map((B,q)=>({id:B.id,label:B.name,color:B.color??I[q],visible:C(B.id)})),[e,I,C]),G=e.some(B=>B.data.length>0),le=jsxs("svg",{role:"img","aria-label":c??"Line chart",width:R.width,height:R.height,viewBox:`0 0 ${R.width} ${R.height}`,shapeRendering:"geometricPrecision",children:[r?.gridLines!==false&&H.map(B=>{let q=z(B);return jsx("line",{x1:R.plotLeft,x2:R.plotRight,y1:q,y2:q,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},B)}),s&&e.map(B=>{if(!C(B.id)||B.data.length===0)return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)",te=xp(B.data,ne,Z,a,R.plotBottom);return jsx("path",{d:te,fill:ue,fillOpacity:.15,stroke:"none",className:g?"chart-area-animate":""},`area-${B.id}`)}),e.map(B=>{if(!C(B.id)||B.data.length===0)return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)";return a?jsx("path",{d:Yl(B.data,ne,Z),fill:"none",stroke:ue,strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},B.id):jsx("polyline",{points:vp(B.data,ne,Z),fill:"none",stroke:ue,strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},B.id)}),i&&e.map(B=>{if(!C(B.id))return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)";return B.data.map((te,ve)=>jsx("circle",{cx:ne(te.x),cy:Z(te.y),r:3,fill:ue,stroke:"white",strokeWidth:1.5,className:f("chart-dot",g?"chart-dot-animate":"")},`${B.id}-${ve}`))}),L!=null&&jsx("line",{className:"chart-crosshair",x1:L,x2:L,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,strokeDasharray:"4 4",opacity:.5,style:{color:"var(--color-secondary-400)"}}),jsx("line",{x1:R.plotLeft,x2:R.plotLeft,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),H.map(B=>{let q=z(B);return jsxs("g",{children:[jsx("line",{x1:R.plotLeft-4,x2:R.plotLeft,y1:q,y2:q,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:R.plotLeft-6,y:q,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,r?.format)})]},B)}),r?.label&&jsx("text",{x:-(R.plotTop+R.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&&V&&jsxs(Fragment,{children:[jsx("line",{x1:R.plotRight,x2:R.plotRight,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),oe.map(B=>{let q=V(B);return jsxs("g",{children:[jsx("line",{x1:R.plotRight,x2:R.plotRight+4,y1:q,y2:q,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:R.plotRight+6,y:q,textAnchor:"start",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,n?.format)})]},B)}),n?.label&&jsx("text",{x:R.plotTop+R.plotHeight/2,y:-(R.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:R.plotLeft,x2:R.plotRight,y1:R.plotBottom,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),($?E:be).map((B,q)=>{let Z=ne(B);return jsxs("g",{children:[jsx("line",{x1:Z,x2:Z,y1:R.plotBottom,y2:R.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:Z,y:R.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,t?.format)})]},q)}),t?.label&&jsx("text",{x:R.plotLeft+R.plotWidth/2,y:R.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label}),jsx("rect",{x:R.plotLeft,y:R.plotTop,width:R.plotWidth,height:R.plotHeight,fill:"transparent",onMouseMove:T,onMouseLeave:F,onTouchStart:re,onTouchMove:re,onTouchEnd:F,style:{cursor:"crosshair"}})]}),ke=d==="left"||d==="right";return jsxs("div",{ref:b,className:f(Yt(),p),children:[c&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&d==="top"&&jsx(ui,{items:W,position:"top",onToggle:S}),jsxs("div",{className:f("flex items-start",ke&&"gap-0"),children:[m&&d==="left"&&jsx(ui,{items:W,position:"left",onToggle:S}),jsx("div",{ref:y,className:"flex-1 min-w-0 overflow-hidden",children:G?le:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:h})}),m&&d==="right"&&jsx(ui,{items:W,position:"right",onToggle:S})]}),m&&d==="bottom"&&jsx(ui,{items:W,position:"bottom",onToggle:S}),x&&jsxs("div",{className:Xt(),style:{left:x.x,top:x.y},role:"tooltip",children:[x.label&&jsx("div",{className:"mb-1 font-medium text-primary-200",children:x.label}),x.items.map((B,q)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:B.color}}),jsxs("span",{className:"text-primary-300",children:[B.name,":"]}),jsx("span",{className:"font-medium",children:B.value})]},q))]})]})}function Np(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let i=String(a.x);r.has(i)||(r.add(i),n.push(i));}return n}function Cp(e,t,r,n){if(r){let o=0;for(let i of e)if(t.has(i.id))for(let s of i.data)s.y>o&&(o=s.y);o===0&&(o=1);let[,a]=Nr(0,o,.05);return [n?.min??0,n?.max??a]}else {let o=new Map;for(let s of e)if(t.has(s.id))for(let l of s.data){let c=String(l.x);o.set(c,(o.get(c)??0)+l.y);}let a=Math.max(0,...o.values()),[,i]=Nr(0,a===0?1:a,.05);return [n?.min??0,n?.max??i]}}function Tp(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function Mp(e,t=5){return Tn(e[0],e[1],t)}function Sp(e,t,r,n,o,a,i,s,l,c,u){let p=e.filter(v=>t.has(v.id)),m=r.length,d=p.length;if(m===0||d===0)return [];let g=a/m,h=g*(1-c),b=d>0?h*(1-u)/d:0,y=[];for(let v=0;v<r.length;v++){let N=r[v],x=o+v*g+(g-h)/2;for(let w=0;w<p.length;w++){let L=p[w],P=L.data.find(S=>String(S.x)===N);if(!P)continue;let A=x+w*(b+h*u/d),D=l(P.y);y.push({seriesId:L.id,category:N,x:A,y:D,width:Math.max(b,1),height:Math.max(i-D,0),stackBase:i,value:P.y,color:n.get(L.id)??"var(--color-chart-1)"});}}return y}function Pp(e,t,r,n,o,a,i,s,l,c){let u=e.filter(y=>t.has(y.id)),p=r.length,m=u.length;if(p===0||m===0)return [];let d=i/p,g=d*(1-l),h=m>0?g*(1-c)/m:0,b=[];for(let y=0;y<r.length;y++){let v=r[y],N=a+y*d+(d-g)/2;for(let x=0;x<u.length;x++){let w=u[x],L=w.data.find(D=>String(D.x)===v);if(!L)continue;let P=N+x*(h+g*c/Math.max(m,1)),A=s(L.y);b.push({seriesId:w.id,category:v,x:o,y:P,width:Math.max(A-o,0),height:Math.max(h,1),stackBase:o,value:L.y,color:n.get(w.id)??"var(--color-chart-1)"});}}return b}function Rp(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=r.length;if(u===0)return [];let p=i/u*(1-l),m=[],d=new Map;r.forEach(g=>d.set(g,o));for(let g of c)for(let h of r){let b=g.data.find(w=>String(w.x)===h);if(!b)continue;let y=d.get(h)??o,v=Math.max(s(b.y)-o,0),N=r.indexOf(h),x=a+(N+.5)*(i/u);m.push({seriesId:g.id,category:h,x:y,y:x-p/2,width:v,height:Math.max(p,1),stackBase:y,value:b.y,color:n.get(g.id)??"var(--color-chart-1)"}),d.set(h,y+v);}return m}function Ep(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=r.length;if(u===0)return [];let p=a/u*(1-l),m=[],d=new Map;r.forEach(g=>d.set(g,i));for(let g of c)for(let h of r){let b=g.data.find(L=>String(L.x)===h);if(!b)continue;let y=d.get(h)??i,v=Math.max(i-s(b.y),0),N=y-v,x=r.indexOf(h),w=o+(x+.5)*(a/u);m.push({seriesId:g.id,category:h,x:w-p/2,y:N,width:Math.max(p,1),height:v,stackBase:y,value:b.y,color:n.get(g.id)??"var(--color-chart-1)"}),d.set(h,N);}return m}function pi({items:e,position:t,onToggle:r}){return jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:f("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 Ql({series:e,xAxis:t,yAxis:r,orientation:n="vertical",grouped:o=true,barRadius:a=4,barPadding:i=.2,groupPadding:s=.3,title:l,height:c=300,className:u,legend:p=true,legendPosition:m="bottom",animateOnMount:d=true,emptyText:g="No data to display"}){let h=useRef(null),b=useRef(null),[y,v]=useState(600),[N,x]=useState(null);useEffect(()=>{let T=b.current;if(!T)return;let F=T.getBoundingClientRect().width;F>0&&v(F);let re=new ResizeObserver(W=>{let G=W[0]?.contentRect.width;G&&G>0&&v(G);});return re.observe(T),()=>re.disconnect()},[]);let w=useMemo(()=>e.map(T=>T.id),[e]),{visible:L,toggle:P,isVisible:A}=wr(w),D=useMemo(()=>kr(e.length),[e.length]),S=useMemo(()=>new Map(e.map((T,F)=>[T.id,T.color??D[F]])),[e,D]),C=n==="horizontal",I=useMemo(()=>Cr(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=useMemo(()=>Tr(y,c,I),[y,c,I]),M=useMemo(()=>Np(e,L),[e,L]),R=useMemo(()=>Cp(e,L,o,C?t:r),[e,L,o,C,t,r]),$=useMemo(()=>Tp(R,C?[k.plotLeft,k.plotRight]:[k.plotBottom,k.plotTop]),[R,k,C]),E=useMemo(()=>Mp(R,(C?t:r)?.tickCount??5),[R,C,t,r]),ne=useMemo(()=>C?o?Pp(e,L,M,S,k.plotLeft,k.plotTop,k.plotHeight,$,s,i):Rp(e,L,M,S,k.plotLeft,k.plotTop,k.plotHeight,$,s):o?Sp(e,L,M,S,k.plotLeft,k.plotWidth,k.plotBottom,k.plotTop,$,s,i):Ep(e,L,M,S,k.plotLeft,k.plotWidth,k.plotBottom,$,s),[e,L,M,S,k,$,o,C,s,i]),U=M.length>0?k.plotWidth/M.length:1,z=M.length>0?k.plotHeight/M.length:1,H=useCallback((T,F)=>{let re=h.current?.getBoundingClientRect();if(!re)return;let W=e.filter(G=>A(G.id)).map(G=>{let le=G.data.find(ke=>String(ke.x)===F);return {name:G.name,value:le?We(le.y,r?.format):"\u2014",color:S.get(G.id)??"var(--color-chart-1)"}});x({x:T.clientX-re.left+12,y:T.clientY-re.top-10,category:F,items:W});},[e,A,S,r?.format]),_=useMemo(()=>e.map((T,F)=>({id:T.id,label:T.name,color:T.color??D[F],visible:A(T.id)})),[e,D,A]),V=e.some(T=>T.data.length>0),oe=m==="left"||m==="right",be=jsxs("svg",{role:"img","aria-label":l??"Bar chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[E.map(T=>{let F=$(T);return C?jsx("line",{x1:F,x2:F,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},T):jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:F,y2:F,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},T)}),ne.map(T=>{let F=Math.min(a,T.width/2,T.height/2),re=`${T.seriesId}-${T.category}`;return C?jsx("rect",{x:T.x,y:T.y,width:T.width,height:T.height,rx:F,fill:T.color,className:f("chart-bar-h",d&&"chart-bar-animate"),onMouseMove:W=>H(W,T.category),onMouseLeave:()=>x(null)},re):jsx("rect",{x:T.x,y:T.y,width:T.width,height:T.height,rx:F,fill:T.color,className:f("chart-bar-v",d&&"chart-bar-animate"),onMouseMove:W=>H(W,T.category),onMouseLeave:()=>x(null)},re)}),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"}),!C&&E.map(T=>{let F=$(T);return jsxs("g",{children:[jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:k.plotLeft-6,y:F,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(T,r?.format)})]},T)}),C&&E.map(T=>{let F=$(T);return jsxs("g",{children:[jsx("line",{x1:F,x2:F,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:F,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(T,t?.format)})]},T)}),M.map((T,F)=>{if(C){let W=k.plotTop+(F+.5)*z;return jsx("text",{x:k.plotLeft-6,y:W,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:T},T)}let re=k.plotLeft+(F+.5)*U;return jsx("text",{x:re,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:T},T)}),r?.label&&!C&&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:h,className:f(Yt(),u),children:[l&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:l}),p&&m==="top"&&jsx(pi,{items:_,position:"top",onToggle:P}),jsxs("div",{className:f("flex items-start",oe&&"gap-0"),children:[p&&m==="left"&&jsx(pi,{items:_,position:"left",onToggle:P}),jsx("div",{ref:b,className:"flex-1 min-w-0 overflow-hidden",children:V?be:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:g})}),p&&m==="right"&&jsx(pi,{items:_,position:"right",onToggle:P})]}),p&&m==="bottom"&&jsx(pi,{items:_,position:"bottom",onToggle:P}),N&&jsxs("div",{className:Xt(),style:{left:N.x,top:N.y},role:"tooltip",children:[jsx("div",{className:"mb-1 font-medium text-primary-200",children:N.category}),N.items.map((T,F)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:T.color}}),jsxs("span",{className:"text-primary-300",children:[T.name,":"]}),jsx("span",{className:"font-medium",children:T.value})]},F))]})]})}function Ap(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=c.reduce((g,h)=>g+h.value,0);if(u===0)return [];let p=new Map(e.map((g,h)=>[g.id,g.color??r[h%r.length]])),m=[],d=s;for(let g of c){let h=g.value/u*360,b=l/2,y=d+b,v=d+h-b,N=(y+v)/2,x;if(Math.abs(v-y)>=359.9){let w=Rt(a,i,n,y),L=Rt(a,i,n,y+180);x=`M ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 1 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} A ${n} ${n} 0 1 1 ${w.x.toFixed(3)} ${w.y.toFixed(3)} Z`;}else if(o>0){let w=Rt(a,i,n,y),L=Rt(a,i,n,v),P=Rt(a,i,o,v),A=Rt(a,i,o,y),D=v-y>180?1:0;x=`M ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 ${D} 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} L ${P.x.toFixed(3)} ${P.y.toFixed(3)} A ${o} ${o} 0 ${D} 0 ${A.x.toFixed(3)} ${A.y.toFixed(3)} Z`;}else {let w=Rt(a,i,n,y),L=Rt(a,i,n,v),P=v-y>180?1:0;x=`M ${a.toFixed(3)} ${i.toFixed(3)} L ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 ${P} 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} Z`;}m.push({id:g.id,label:g.label,value:g.value,percent:Math.round(g.value/u*1e3)/10,color:p.get(g.id)??"var(--color-chart-1)",startAngle:y,endAngle:v,midAngle:N,path:x,outerR:n,innerR:o,cx:a,cy:i}),d+=h;}return m}function Ip(e,t){let r=(e-90)*Math.PI/180;return {dx:Math.cos(r)*t,dy:Math.sin(r)*t}}function hi({items:e,position:t,onToggle:r}){return jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:f("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 tc({data:e,donut:t=false,donutThickness:r=.5,startAngle:n=-90,padAngle:o=0,labelType:a="percent",centerLabel:i,centerSubLabel:s,explodeOnHover:l=true,explodeOffset:c=8,title:u,height:p=300,className:m,legend:d=true,legendPosition:g="bottom",animateOnMount:h=true,emptyText:b="No data to display"}){let y=useRef(null),v=useRef(null),[N,x]=useState(400),[w,L]=useState(null),[P,A]=useState(null),[D,S]=useState({}),C=useRef(null);useEffect(()=>{let X=v.current;if(!X)return;let de=X.getBoundingClientRect().width;de>0&&x(de);let Q=new ResizeObserver(ie=>{let Pe=ie[0]?.contentRect.width;Pe&&Pe>0&&x(Pe);});return Q.observe(X),()=>Q.disconnect()},[]),useEffect(()=>{function X(Q){let ie=C.current;if(!ie)return;"touches"in Q&&Q.cancelable&&Q.preventDefault();let Pe="touches"in Q?Q.touches[0]?.clientX??ie.startX:Q.clientX,$e="touches"in Q?Q.touches[0]?.clientY??ie.startY:Q.clientY;S(Xe=>({...Xe,[ie.id]:{dx:ie.origDx+Pe-ie.startX,dy:ie.origDy+$e-ie.startY}}));}function de(){C.current=null;}return window.addEventListener("mousemove",X),window.addEventListener("mouseup",de),window.addEventListener("touchmove",X,{passive:false}),window.addEventListener("touchend",de),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",de),window.removeEventListener("touchmove",X),window.removeEventListener("touchend",de);}},[]);let I=useMemo(()=>e.map(X=>X.id),[e]),{visible:k,toggle:M,isVisible:R}=wr(I),$=useMemo(()=>kr(e.length),[e.length]),E=10,ne=6.4,U=18,z=14,H=6,_=N,V=p,oe=_/2,be=V/2,T=a!=="none"?U+H+4:H+4,F=Math.max(Math.min(oe,be)-T,20),re=t?F*r:0,W=useMemo(()=>Ap(e,k,$,F,re,oe,be,n,o),[e,k,$,F,re,oe,be,n,o]),G=useMemo(()=>W.map(X=>X.id).join(","),[W]);useEffect(()=>{S({});},[G]);let le=useCallback((X,de)=>{if(C.current)return;let Q=y.current?.getBoundingClientRect();if(!Q)return;L(de);let ie=W.find(Pe=>Pe.id===de);ie&&A({x:X.clientX-Q.left+12,y:X.clientY-Q.top-10,items:[{label:ie.label,value:We(ie.value),percent:`${ie.percent}%`,color:ie.color}]});},[W]),ke=useCallback(()=>{L(null),A(null);},[]),B=useCallback((X,de,Q)=>{let ie=D[X]??{dx:0,dy:0};C.current={id:X,startX:de,startY:Q,origDx:ie.dx,origDy:ie.dy};},[D]),q=useCallback((X,de)=>{X.preventDefault(),L(de);let Q=y.current?.getBoundingClientRect();if(!Q)return;let ie=X.touches[0];if(!ie)return;let Pe=W.find($e=>$e.id===de);Pe&&A({x:ie.clientX-Q.left+12,y:ie.clientY-Q.top-10,items:[{label:Pe.label,value:We(Pe.value),percent:`${Pe.percent}%`,color:Pe.color}]});},[W]),Z=useMemo(()=>{let X=e.reduce((de,Q)=>de+Q.value,0);return e.map((de,Q)=>({id:de.id,label:de.label,color:de.color??$[Q],visible:R(de.id),percent:X>0?Math.round(de.value/X*1e3)/10:0}))},[e,$,R]),ue=e.length>0&&e.some(X=>X.value>0),te=g==="left"||g==="right",ve=useMemo(()=>{if(a==="none")return [];let X=E+3,de=H+E*.5,Q=V-H-E*.5,ie=W.filter(se=>se.percent>=3).map(se=>{let Re="";switch(a){case "percent":Re=`${se.percent}%`;break;case "value":Re=We(se.value);break;case "label":Re=se.label;break;case "label+percent":Re=`${se.label} ${se.percent}%`;break}let K=Rt(se.cx,se.cy,se.outerR+2,se.midAngle),ce=Rt(se.cx,se.cy,se.outerR+U,se.midAngle),me=(se.midAngle-90)*Math.PI/180,J=Math.cos(me)>=0,Ce=Math.ceil(Re.length*ne);return {id:se.id,color:se.color,text:Re,textW:Ce,p1:K,elbowX:ce.x,y:ce.y,isRight:J}}),Pe=ie.filter(se=>se.isRight).sort((se,Re)=>se.y-Re.y),$e=ie.filter(se=>!se.isRight).sort((se,Re)=>se.y-Re.y);function Xe(se){if(se.length!==0)for(let Re=0;Re<20;Re++){let K=false;for(let me=1;me<se.length;me++){let J=se[me].y-se[me-1].y;if(J<X){let Ce=(X-J)/2;se[me-1].y-=Ce,se[me].y+=Ce,K=true;}}se[0].y<de&&(se[0].y=de);for(let me=1;me<se.length;me++)se[me].y<se[me-1].y+X&&(se[me].y=se[me-1].y+X);let ce=se.length-1;se[ce].y>Q&&(se[ce].y=Q);for(let me=ce-1;me>=0;me--)se[me].y>se[me+1].y-X&&(se[me].y=se[me+1].y-X);for(let me of se)me.y=Math.max(de,Math.min(Q,me.y));if(!K)break}}return Xe(Pe),Xe($e),[...$e,...Pe]},[W,a,V]),Ne=jsxs("svg",{role:"img","aria-label":u??"Pie chart",width:_,height:V,viewBox:`0 0 ${_} ${V}`,shapeRendering:"geometricPrecision",children:[jsxs("g",{className:h?"chart-pie-animate":"",children:[W.map((X,de)=>{let Q=w===X.id,ie=l&&Q,Pe=Ip(X.midAngle,ie?c:0);return jsx("path",{d:X.path,fill:X.color,transform:ie?`translate(${Pe.dx}, ${Pe.dy})`:void 0,className:f("chart-slice",h&&`chart-slice-animate-${Math.min(de,7)}`,Q&&"chart-slice--exploded"),stroke:X.color,strokeWidth:.6,onMouseMove:$e=>le($e,X.id),onMouseLeave:ke,onTouchStart:$e=>q($e,X.id),onTouchEnd:ke,"aria-label":`${X.label}: ${X.percent}%`},X.id)}),ve.map(X=>{let de=D[X.id]??{dx:0,dy:0},Q=X.elbowX+de.dx,ie=X.y+de.dy,Pe=Q+(X.isRight?z:-z),$e=X.isRight?Pe+3:Pe-3,Xe=z+3+X.textW+6,se=X.isRight?Q:Q-Xe,Re=ie-E-2,K=E*2+4;return jsxs("g",{style:{userSelect:"none"},children:[jsx("polyline",{points:[`${X.p1.x.toFixed(2)},${X.p1.y.toFixed(2)}`,`${Q.toFixed(2)},${ie.toFixed(2)}`,`${Pe.toFixed(2)},${ie.toFixed(2)}`].join(" "),fill:"none",stroke:X.color,strokeWidth:1.2,opacity:.85,strokeLinejoin:"round",strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("text",{x:$e.toFixed(2),y:ie.toFixed(2),textAnchor:X.isRight?"start":"end",dominantBaseline:"middle",fontSize:E,fill:"currentColor",className:"text-primary-700 dark:text-primary-300",style:{pointerEvents:"none"},children:X.text}),jsx("rect",{x:se,y:Re,width:Xe,height:K,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseDown:ce=>{ce.stopPropagation(),B(X.id,ce.clientX,ce.clientY);},onTouchStart:ce=>{ce.stopPropagation();let me=ce.touches[0];me&&B(X.id,me.clientX,me.clientY);}})]},`label-${X.id}`)})]}),t&&jsx("g",{style:{pointerEvents:"none"},children:w&&W.find(X=>X.id===w)?jsxs(Fragment,{children:[jsxs("text",{x:oe,y:be-8,textAnchor:"middle",dominantBaseline:"middle",fontSize:18,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:[W.find(X=>X.id===w)?.percent,"%"]}),jsx("text",{x:oe,y:be+12,textAnchor:"middle",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:W.find(X=>X.id===w)?.label})]}):jsxs(Fragment,{children:[i&&jsx("text",{x:oe,y:be-(s?8:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:16,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:i}),s&&jsx("text",{x:oe,y:be+14,textAnchor:"middle",dominantBaseline:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:s})]})})]});return jsxs("div",{ref:y,className:f(Yt(),m),children:[u&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),d&&g==="top"&&jsx(hi,{items:Z,position:"top",onToggle:M}),jsxs("div",{className:f("flex items-start justify-center",te&&"gap-0"),children:[d&&g==="left"&&jsx(hi,{items:Z,position:"left",onToggle:M}),jsx("div",{ref:v,className:"flex-1 min-w-0 overflow-hidden",children:ue?Ne:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:p},children:b})}),d&&g==="right"&&jsx(hi,{items:Z,position:"right",onToggle:M})]}),d&&g==="bottom"&&jsx(hi,{items:Z,position:"bottom",onToggle:M}),P&&jsx("div",{className:Xt(),style:{left:P.x,top:P.y},role:"tooltip",children:P.items.map((X,de)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:X.color}}),jsxs("span",{className:"font-medium",children:[X.label,":"]}),jsx("span",{children:X.value}),jsxs("span",{className:"text-primary-300",children:["(",X.percent,")"]})]},de))})]})}function Vp(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data){let c=Number(l.x);c<n&&(n=c),c>o&&(o=c);}if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function Hp(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data)l.y<n&&(n=l.y),l.y>o&&(o=l.y);if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function rc(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function nc(e,t=5){return Tn(e[0],e[1],t)}function _p(e,t,r){let n=1.618033988749895,o=e*137+t,a=o*n%1*2-1,i=o*n*n%1*2-1;return [a*r,i*r]}function Fp(e,t,r=12){if(e.length<2)return null;let n=Math.min(...e),o=Math.max(...e),a=Math.min(...t),i=Math.max(...t);return {cx:(n+o)/2,cy:(a+i)/2,rx:(o-n)/2+r,ry:(i-a)/2+r}}function gi({items:e,position:t,onToggle:r}){return jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxs("button",{onClick:()=>r(n.id),className:f("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 oc({series:e,xAxis:t,yAxis:r,dotRadius:n=5,dotOpacity:o=.75,clusters:a=false,jitter:i=false,jitterAmount:s=12,linkedLines:l=false,title:c,height:u=300,className:p,legend:m=true,legendPosition:d="bottom",animateOnMount:g=true,emptyText:h="No data to display"}){let b=useRef(null),y=useRef(null),[v,N]=useState(600),[x,w]=useState(null);useEffect(()=>{let T=y.current;if(!T)return;let F=T.getBoundingClientRect().width;F>0&&N(F);let re=new ResizeObserver(W=>{let G=W[0]?.contentRect.width;G&&G>0&&N(G);});return re.observe(T),()=>re.disconnect()},[]);let L=useMemo(()=>e.map(T=>T.id),[e]),{visible:P,toggle:A,isVisible:D}=wr(L),S=useMemo(()=>kr(e.length),[e.length]),C=useMemo(()=>new Map(e.map((T,F)=>[T.id,T.color??S[F]])),[e,S]),I=useMemo(()=>Cr(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=useMemo(()=>Tr(v,u,I),[v,u,I]),M=useMemo(()=>Vp(e,P,t),[e,P,t]),R=useMemo(()=>Hp(e,P,r),[e,P,r]),$=useMemo(()=>rc(M,[k.plotLeft,k.plotRight]),[M,k]),E=useMemo(()=>rc(R,[k.plotBottom,k.plotTop]),[R,k]),ne=useMemo(()=>nc(M,t?.tickCount??6),[M,t?.tickCount]),U=useMemo(()=>nc(R,r?.tickCount??5),[R,r?.tickCount]),z=useCallback((T,F,re,W,G)=>{let le=b.current?.getBoundingClientRect();le&&w({x:T.clientX-le.left+12,y:T.clientY-le.top-10,seriesName:F,xVal:We(re,t?.format),yVal:We(W,r?.format),color:G});},[t?.format,r?.format]),H=useCallback((T,F,re,W,G)=>{T.preventDefault();let le=b.current?.getBoundingClientRect();if(!le)return;let ke=T.touches[0];ke&&w({x:ke.clientX-le.left+12,y:ke.clientY-le.top-10,seriesName:F,xVal:We(re,t?.format),yVal:We(W,r?.format),color:G});},[t?.format,r?.format]),_=useMemo(()=>e.map((T,F)=>({id:T.id,label:T.name,color:T.color??S[F],visible:D(T.id)})),[e,S,D]),V=e.some(T=>T.data.length>0),oe=d==="left"||d==="right",be=jsxs("svg",{role:"img","aria-label":c??"Scatter chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[U.map(T=>jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:E(T),y2:E(T),stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},T)),a&&e.map((T,F)=>{if(!D(T.id)||T.data.length<2)return null;let re=C.get(T.id)??"var(--color-chart-1)",W=T.data.map(ke=>$(Number(ke.x))),G=T.data.map(ke=>E(ke.y)),le=Fp(W,G,16);return le?jsx("ellipse",{cx:le.cx,cy:le.cy,rx:le.rx,ry:le.ry,fill:re,fillOpacity:.06,stroke:re,strokeOpacity:.3,strokeWidth:1.5,strokeDasharray:"5 3",className:g?"chart-cluster-ellipse":"",style:{animationDelay:`${F*.1}s`}},`cluster-${T.id}`):null}),l&&e.map(T=>{if(!D(T.id)||T.data.length<2)return null;let F=C.get(T.id)??"var(--color-chart-1)",W=[...T.data].sort((G,le)=>Number(G.x)-Number(le.x)).map(G=>`${$(Number(G.x)).toFixed(2)},${E(G.y).toFixed(2)}`).join(" ");return jsx("polyline",{points:W,fill:"none",stroke:F,strokeWidth:1.5,className:"chart-scatter-link"},`link-${T.id}`)}),e.map((T,F)=>{if(!D(T.id))return null;let re=C.get(T.id)??"var(--color-chart-1)";return jsx("g",{className:"chart-scatter-group",children:T.data.map((W,G)=>{let[le,ke]=i?_p(F,G,s):[0,0],B=$(Number(W.x))+le,q=E(W.y)+ke;return jsx("circle",{cx:B,cy:q,r:n,fill:re,fillOpacity:o,stroke:re,strokeWidth:1,strokeOpacity:.5,className:f("chart-scatter-dot",g&&"chart-scatter-dot--animate"),style:{color:re},onMouseMove:Z=>z(Z,T.name,W.x,W.y,re),onMouseLeave:()=>w(null),onTouchStart:Z=>H(Z,T.name,W.x,W.y,re),onTouchEnd:()=>w(null)},G)})},T.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"}),U.map(T=>{let F=E(T);return jsxs("g",{children:[jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:k.plotLeft-6,y:F,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(T,r?.format)})]},T)}),ne.map(T=>{let F=$(T);return jsxs("g",{children:[jsx("line",{x1:F,x2:F,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsx("text",{x:F,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(T,t?.format)})]},T)}),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:f(Yt(),p),children:[c&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&d==="top"&&jsx(gi,{items:_,position:"top",onToggle:A}),jsxs("div",{className:f("flex items-start",oe&&"gap-0"),children:[m&&d==="left"&&jsx(gi,{items:_,position:"left",onToggle:A}),jsx("div",{ref:y,className:"flex-1 min-w-0 overflow-hidden",children:V?be:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:h})}),m&&d==="right"&&jsx(gi,{items:_,position:"right",onToggle:A})]}),m&&d==="bottom"&&jsx(gi,{items:_,position:"bottom",onToggle:A}),x&&jsxs("div",{className:Xt(),style:{left:x.x,top:x.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:x.color}}),jsx("span",{className:"font-medium",children:x.seriesName})]}),jsxs("div",{className:"text-primary-300",children:["X: ",jsx("span",{className:"font-medium text-primary-50",children:x.xVal})," ","Y: ",jsx("span",{className:"font-medium text-primary-50",children:x.yVal})]})]})]})}var G1={LineChart:Jl,BarChart:Ql,PieChart:tc,ScatterChart:oc},ac=G1;var q1={Primitives:Vi,Layout:$i,DataDisplay:os,Navigation:us,Disclosure:hs,Overlay:Ps,Feedback:Bs,Extras:_l,Forms:Ol,Chart:ac},VA=q1;
|
|
128
|
+
export{ms as Accordion,sh as AccordionContent,ah as AccordionItem,ih as AccordionTrigger,Ds as Alert,qh as AlertContent,Jh as AlertDescription,Gh as AlertIcon,Xh as AlertTitle,Ko as Avatar,jo as AvatarGroup,Si as Badge,Ql as BarChart,ua as Breadcrumb,Vt as Button,Hi as Card,af as CardContent,of as CardDescription,sf as CardFooter,rf as CardHeader,nf as CardTitle,ac as Chart,Gi as Chat,An as Checkbox,Us as CinePlayer,Zi as CodeBlock,Ka as CommandPalette,Ss as ContextMenu,os as DataDisplay,Vf as DataTable,Wa as DateTimePicker,Zn as Dialog,Ch as DialogClose,vs as DialogContent,ks as DialogDescription,Ns as DialogFooter,xs as DialogHeader,ws as DialogTitle,hs as Disclosure,ka as Drawer,md as DrawerBody,hd as DrawerClose,fd as DrawerFooter,pd as DrawerHeader,wi as Dropdown,qr as DropdownButton,_l as Extras,Bs as Feedback,Zs as FileExplorer,Ks as FilmReel,$l as Form,B1 as FormItem,$1 as FormSection,Ol as Forms,ls as Header,lf as HorizontalCard,_i as ImageCard,mf as ImageCardActions,df as ImageCardBody,pf as ImageCardDescription,uf as ImageCardTitle,Ri as Indicator,Ft as Input,Zr as Kbd,en as KbdGroup,_t as Label,$i as Layout,Jl as LineChart,Yi as List,Ff as ListItem,Ga as LoginPanel,nl as Masonry,ts as MetricCard,Ws as MiniPlayer,cs as NavLink,us as Navigation,wn as OTPInput,Ps as Overlay,ma as Pagination,Fi as Panel,hf as PanelContent,ff as PanelHeader,tc as PieChart,Vi as Primitives,zs as ProgressBar,Di as Radio,Li as RadioGroup,Xo as Rating,Un as RibbonBar,Co as RichTextEditor,oc as ScatterChart,ss as SideNav,Ra as Skeleton,Yo as Slider,Uo as SliderRange,If as SortableTable,Hs as Spin,qo as SplitPanel,es as Stat,Rr as Switch,fh as TabContent,uh as TabList,mh as TabPanels,ph as TabTrigger,Bn as Table,ji as TableBody,Vr as TableCell,Wi as TableEmpty,zr as TableHead,Ki as TableHeader,Fn as TableRow,fs as Tabs,Pi as Tag,Ei as TextBox,il as Timeline,lo as ToastContext,Ea as ToastProvider,Cs as Tooltip,Ui as Tree,Yf as TreeItem,$a as TypewriterText,aa as VirtualList,ha as accordionContentVariants,fa as accordionTriggerVariants,ga as accordionVariants,no as alertVariants,Pn as avatarVariants,So as badgeVariants,Ur as buttonVariants,In as cardVariants,Yt as chartContainerVariants,Ut as chartLegendVariants,Xt as chartTooltipVariants,Eo as checkboxVariants,f as cn,Hn as codeBlockVariants,tg as configureAlertTopOffset,VA as default,Qn as dialogContentVariants,Po as indicatorVariants,Xr as inputVariants,Io as kbdVariants,Ro as labelVariants,Zo as listItemVariants,Qo as listVariants,ra as metricCardVariants,la as navLinkVariants,Ua as otpInputVariants,Go as panelVariants,Ca as progressBarVariants,Lo as radioVariants,Ao as ratingVariants,oo as skeletonVariants,Rn as sliderVariants,cn as spinVariants,ta as statVariants,Do as switchTrackVariants,ba as tabListVariants,ya as tabTriggerVariants,Jo as tableVariants,zo as tagVariants,Ta as toastVariants,wa as tooltipVariants,ea as treeItemVariants,cg as useAlert,kg as useSpin,La as useToast};
|