@jacshuo/onyx 1.4.0 → 1.4.1

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.
@@ -1,9 +1,9 @@
1
- import jt,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,useMemo,useId,useContext}from'react';import {createPortal}from'react-dom';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Heart,ThumbsDown,Bookmark,Share2,Download,ZoomIn,ZoomOut,X,ChevronLeft,ChevronRight,Camera,Aperture,Calendar,MapPin,Info,ListMusic,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3,ListVideo,Theater,Minimize,Maximize,ArrowUpDown,HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,FolderUp,Search,CornerRightDown,Folder,ArrowUp,AlertTriangle,Trash2,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {cva}from'class-variance-authority';function s(...t){return twMerge(clsx(t))}var Lt="#1c1914",Dt="#130f0b",fn="#2e261e",ot="#504638",Ie="#6b5d4d",Ge=`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")`,gn=[{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 st({photos:t,layout:r="strip",actions:l=gn,onAction:g,className:k,showGrain:b=true,sheetTitle:x,sheetLabel:R}){let[S,h]=useState(null),[O,M]=useState(new Set),N=useCallback(q=>h(q),[]),w=useCallback(()=>h(null),[]),X=useCallback((q,T)=>{if(l.find(H=>H.key===q)?.toggle){let H=`${T}-${q}`;M(B=>{let V=new Set(B);return V.has(H)?V.delete(H):V.add(H),V});}g?.(q,t[T],T);},[l,g,t]);return jsxs(Fragment,{children:[jsx(r==="strip"?bn:r==="sheet"?hn:xn,{photos:t,onPhotoClick:N,showGrain:b,className:k,sheetTitle:x,sheetLabel:R}),S!==null&&createPortal(jsx(vn,{photos:t,currentIndex:S,onIndexChange:h,onClose:w,actions:l,activeActions:O,onAction:X,showGrain:b}),document.body)]})}function Pt({count:t=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Lt},children:Array.from({length:t}).map((r,l)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:fn}},l))})}function bn({photos:t,onPhotoClick:r,showGrain:l,className:g}){let k=useRef(null);return jsxs("div",{className:s("select-none rounded-lg overflow-hidden",g),style:{background:Dt},children:[jsx(Pt,{count:Math.max(30,t.length*6)}),jsx("div",{ref:k,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Lt,scrollSnapType:"x mandatory"},children:t.map((b,x)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>r(x),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:ot,width:280,height:187},children:[jsx("img",{src:b.src,alt:b.alt??b.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)"}}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:Ge,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:Ie},children:[String(x+1).padStart(2,"0"),x%2===0?"":"A"]})]},x))}),jsx(Pt,{count:Math.max(30,t.length*6)})]})}function hn({photos:t,onPhotoClick:r,showGrain:l,className:g,sheetTitle:k,sheetLabel:b}){return jsxs("div",{className:s("rounded-lg p-5",g),style:{background:Dt},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:Ie},children:k??`JAC\xB7Film 35mm \xB7 ${t.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Ie},children:b??"Contact Sheet"})]}),jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:t.map((x,R)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${R*50}ms both`},onClick:()=>r(R),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:Ie},children:String(R+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:ot,aspectRatio:"3/2"},children:[jsx("img",{src:x.src,alt:x.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Ge}}),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:x.title})})]})]},R))})]})}function xn({photos:t,onPhotoClick:r,showGrain:l,className:g}){let[k,b]=useState(false),[x,R]=useState(null),S=Math.min(t.length,8),h=t.slice(0,S),O=N=>{let w=Math.sin(N*137.508+1)*1e4,X=(w%12-6).toFixed(1),v=(w/7%8-4).toFixed(1),q=(w/13%6-3).toFixed(1);return `rotate(${X}deg) translate(${v}px, ${q}px)`},M=(N,w)=>{let X=(w-1)/2,v=((N-X)*7).toFixed(1),q=((N-X)*110).toFixed(0),T=(-Math.abs(N-X)*10+(x===N?-18:0)).toFixed(0);return `translateX(${q}px) translateY(${T}px) rotate(${v}deg)`};return jsxs("div",{className:s("flex flex-col items-center gap-4",g),children:[jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>b(true),onMouseLeave:()=>{b(false),R(null);},children:h.map((N,w)=>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:k?`${w*35}ms`:`${(S-w)*25}ms`,transform:k?M(w,h.length):O(w),zIndex:k?w+1:h.length-w,width:220,height:147},onClick:()=>r(w),onMouseEnter:()=>k&&R(w),onMouseLeave:()=>R(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:k&&x===w?"rgba(217,171,89,0.5)":ot,boxShadow:k&&x===w?"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:N.src,alt:N.alt??"",className:"h-full w-full object-cover",draggable:false}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Ge}}),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%)"}}),k&&x===w&&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:N.title})})]})},w))}),t.length>S&&jsxs("span",{className:"font-mono text-xs",style:{color:Ie},children:["+ ",t.length-S," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:Ie,opacity:k?0:.7},children:"Hover to explore"})]})}function vn({photos:t,currentIndex:r,onIndexChange:l,onClose:g,actions:k,activeActions:b,onAction:x,showGrain:R}){let S=t[r],[h,O]=useState(1),[M,N]=useState({x:0,y:0}),[w,X$1]=useState(false),[v,q]=useState(false),T=useRef(false),W=useRef({x:0,y:0}),H=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>q(true));},[]),useEffect(()=>{let o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o;}},[]),useEffect(()=>{let o=I=>{switch(I.key){case "Escape":g();break;case "ArrowLeft":B(-1);break;case "ArrowRight":B(1);break;case "i":case "I":X$1(K=>!K);break}};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)}),useEffect(()=>{let o=H.current;if(!o)return;let I=K=>{K.preventDefault();let ne=K.deltaY<0?1.12:.89;O(U=>{let ie=Math.min(8,Math.max(1,U*ne));return ie<=1&&N({x:0,y:0}),ie});};return o.addEventListener("wheel",I,{passive:false}),()=>o.removeEventListener("wheel",I)},[]);let B=useCallback(o=>{let I=r+o;I>=0&&I<t.length&&(l(I),O(1),N({x:0,y:0}));},[r,t.length,l]),V=useCallback(o=>{h<=1||(T.current=true,W.current={x:o.clientX,y:o.clientY},o.target.setPointerCapture(o.pointerId));},[h]),pe=useCallback(o=>{if(!T.current)return;let I=o.clientX-W.current.x,K=o.clientY-W.current.y;W.current={x:o.clientX,y:o.clientY},N(ne=>({x:ne.x+I/h,y:ne.y+K/h}));},[h]),u=useCallback(()=>{T.current=false;},[]),f=useCallback(()=>{h>1?(O(1),N({x:0,y:0})):O(2.5);},[h]),E=o=>b.has(`${r}-${o}`),P=S.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:g}),R&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Ge,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:[r+1," / ",t.length]}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[h.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>O(o=>Math.min(8,o*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:()=>{O(o=>{let I=Math.max(1,o*.7);return I<=1&&N({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:g,title:"Close",children:jsx(X,{className:"h-5 w-5"})})]})]}),jsxs("div",{ref:H,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:h>1?"grab":"default"},onPointerDown:V,onPointerMove:pe,onPointerUp:u,onDoubleClick:f,children:[jsx("img",{src:S.src,alt:S.alt??S.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(${h}) translate(${M.x}px, ${M.y}px)`,transition:T.current?"none":"transform 0.15s ease-out"},draggable:false},r),r>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:o=>{o.stopPropagation(),B(-1);},children:jsx(ChevronLeft,{className:"h-6 w-6"})}),r<t.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:o=>{o.stopPropagation(),B(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:s("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",w?"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:[S.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:S.title}),S.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:S.description}),P&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[P.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",P.camera,P.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),P.lens&&P.lens]}),(P.aperture||P.shutter||P.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[P.aperture,P.shutter,P.iso&&`ISO ${P.iso}`].filter(Boolean).join(" \xB7 ")]}),P.date&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",P.date]}),P.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",P.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:[k.map(o=>{let I=o.toggle&&E(o.key);return jsx("button",{className:s("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:()=>x(o.key,r),title:o.label,children:I&&o.activeIcon?o.activeIcon:o.icon},o.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",w?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>X$1(o=>!o),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var it="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
1
+ import rn,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,useMemo,useId,useContext}from'react';import {createPortal}from'react-dom';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Heart,ThumbsDown,Bookmark,Share2,Download,ZoomIn,ZoomOut,X,ChevronLeft,ChevronRight,Camera,Aperture,Calendar,MapPin,Info,ListMusic,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3,ListVideo,Theater,Minimize,Maximize,ArrowUpDown,HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,FolderUp,Search,CornerRightDown,Folder,ArrowUp,AlertTriangle,Trash2,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {cva}from'class-variance-authority';function s(...e){return twMerge(clsx(e))}var Bt="#1c1914",Xt="#130f0b",Tn="#2e261e",xt="#504638",qe="#6b5d4d",ct=`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")`,Rn=[{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 vt({photos:e,layout:o="strip",actions:l=Rn,onAction:g,className:w,showGrain:f=true,sheetTitle:v,sheetLabel:z}){let[F,x]=useState(null),[_,D]=useState(new Set),L=useCallback(ee=>x(ee),[]),k=useCallback(()=>x(null),[]),G=useCallback((ee,A)=>{if(l.find($=>$.key===ee)?.toggle){let $=`${A}-${ee}`;D(K=>{let j=new Set(K);return j.has($)?j.delete($):j.add($),j});}g?.(ee,e[A],A);},[l,g,e]);return jsxs(Fragment,{children:[jsx(o==="strip"?zn:o==="sheet"?Fn:An,{photos:e,onPhotoClick:L,showGrain:f,className:w,sheetTitle:v,sheetLabel:z}),F!==null&&createPortal(jsx(In,{photos:e,currentIndex:F,onIndexChange:x,onClose:k,actions:l,activeActions:_,onAction:G,showGrain:f}),document.body)]})}function jt({count:e=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Bt},children:Array.from({length:e}).map((o,l)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:Tn}},l))})}function zn({photos:e,onPhotoClick:o,showGrain:l,className:g}){let w=useRef(null);return jsxs("div",{className:s("select-none rounded-lg overflow-hidden",g),style:{background:Xt},children:[jsx(jt,{count:Math.max(30,e.length*6)}),jsx("div",{ref:w,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Bt,scrollSnapType:"x mandatory"},children:e.map((f,v)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>o(v),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:xt,width:280,height:187},children:[jsx("img",{src:f.src,alt:f.alt??f.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)"}}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:ct,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:qe},children:[String(v+1).padStart(2,"0"),v%2===0?"":"A"]})]},v))}),jsx(jt,{count:Math.max(30,e.length*6)})]})}function Fn({photos:e,onPhotoClick:o,showGrain:l,className:g,sheetTitle:w,sheetLabel:f}){return jsxs("div",{className:s("rounded-lg p-5",g),style:{background:Xt},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:qe},children:w??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:qe},children:f??"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((v,z)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${z*50}ms both`},onClick:()=>o(z),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:qe},children:String(z+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:xt,aspectRatio:"3/2"},children:[jsx("img",{src:v.src,alt:v.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:ct}}),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:v.title})})]})]},z))})]})}function An({photos:e,onPhotoClick:o,showGrain:l,className:g}){let[w,f]=useState(false),[v,z]=useState(null),F=Math.min(e.length,8),x=e.slice(0,F),_=L=>{let k=Math.sin(L*137.508+1)*1e4,G=(k%12-6).toFixed(1),y=(k/7%8-4).toFixed(1),ee=(k/13%6-3).toFixed(1);return `rotate(${G}deg) translate(${y}px, ${ee}px)`},D=(L,k)=>{let G=(k-1)/2,y=((L-G)*7).toFixed(1),ee=((L-G)*110).toFixed(0),A=(-Math.abs(L-G)*10+(v===L?-18:0)).toFixed(0);return `translateX(${ee}px) translateY(${A}px) rotate(${y}deg)`};return jsxs("div",{className:s("flex flex-col items-center gap-4",g),children:[jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>f(true),onMouseLeave:()=>{f(false),z(null);},children:x.map((L,k)=>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:w?`${k*35}ms`:`${(F-k)*25}ms`,transform:w?D(k,x.length):_(k),zIndex:w?k+1:x.length-k,width:220,height:147},onClick:()=>o(k),onMouseEnter:()=>w&&z(k),onMouseLeave:()=>z(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:w&&v===k?"rgba(217,171,89,0.5)":xt,boxShadow:w&&v===k?"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:L.src,alt:L.alt??"",className:"h-full w-full object-cover",draggable:false}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:ct}}),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%)"}}),w&&v===k&&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:L.title})})]})},k))}),e.length>F&&jsxs("span",{className:"font-mono text-xs",style:{color:qe},children:["+ ",e.length-F," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:qe,opacity:w?0:.7},children:"Hover to explore"})]})}function In({photos:e,currentIndex:o,onIndexChange:l,onClose:g,actions:w,activeActions:f,onAction:v,showGrain:z}){let F=e[o],[x,_]=useState(1),[D,L]=useState({x:0,y:0}),[k,G]=useState(false),[y,ee]=useState(false),A=useRef(false),ne=useRef({x:0,y:0}),$=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>ee(true));},[]),useEffect(()=>{let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a;}},[]),useEffect(()=>{let a=O=>{switch(O.key){case "Escape":g();break;case "ArrowLeft":K(-1);break;case "ArrowRight":K(1);break;case "i":case "I":G(Y=>!Y);break}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)}),useEffect(()=>{let a=$.current;if(!a)return;let O=Y=>{Y.preventDefault();let ie=Y.deltaY<0?1.12:.89;_(q=>{let ge=Math.min(8,Math.max(1,q*ie));return ge<=1&&L({x:0,y:0}),ge});};return a.addEventListener("wheel",O,{passive:false}),()=>a.removeEventListener("wheel",O)},[]);let K=useCallback(a=>{let O=o+a;O>=0&&O<e.length&&(l(O),_(1),L({x:0,y:0}));},[o,e.length,l]),j=useCallback(a=>{x<=1||(A.current=true,ne.current={x:a.clientX,y:a.clientY},a.target.setPointerCapture(a.pointerId));},[x]),Me=useCallback(a=>{if(!A.current)return;let O=a.clientX-ne.current.x,Y=a.clientY-ne.current.y;ne.current={x:a.clientX,y:a.clientY},L(ie=>({x:ie.x+O/x,y:ie.y+Y/x}));},[x]),u=useCallback(()=>{A.current=false;},[]),b=useCallback(()=>{x>1?(_(1),L({x:0,y:0})):_(2.5);},[x]),C=a=>f.has(`${o}-${a}`),S=F.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:g}),z&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:ct,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:[o+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:[x.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>_(a=>Math.min(8,a*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:()=>{_(a=>{let O=Math.max(1,a*.7);return O<=1&&L({x:0,y:0}),O});},title:"Zoom out",children:jsx(ZoomOut,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:g,title:"Close",children:jsx(X,{className:"h-5 w-5"})})]})]}),jsxs("div",{ref:$,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:x>1?"grab":"default"},onPointerDown:j,onPointerMove:Me,onPointerUp:u,onDoubleClick:b,children:[jsx("img",{src:F.src,alt:F.alt??F.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(${x}) translate(${D.x}px, ${D.y}px)`,transition:A.current?"none":"transform 0.15s ease-out"},draggable:false},o),o>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:a=>{a.stopPropagation(),K(-1);},children:jsx(ChevronLeft,{className:"h-6 w-6"})}),o<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:a=>{a.stopPropagation(),K(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:s("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",k?"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:[F.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:F.title}),F.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:F.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:[w.map(a=>{let O=a.toggle&&C(a.key);return jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",O?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>v(a.key,o),title:a.label,children:O&&a.activeIcon?a.activeIcon:a.icon},a.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",k?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>G(a=>!a),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var yt="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
2
2
  <rect width="200" height="200" fill="#1e1b2e"/>
3
3
  <circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>
4
4
  <circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>
5
5
  <text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">\u266A</text>
6
- </svg>`);function St(t){if(!isFinite(t)||t<0)return "0:00";let r=Math.floor(t/60),l=Math.floor(t%60);return `${r}:${l.toString().padStart(2,"0")}`}function Tn(t){return t.startsWith("bottom")?"bottom":t.startsWith("top")?"top":"right"}var zn={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Fn={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},An={"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 lt({playlist:t,initialTrack:r=0,position:l="bottom-right",entrance:g,theme:k,docked:b=false,visible:x,onVisibleChange:R,onTrackChange:S,onLike:h,autoPlay:O=true,shuffle:M=false,loop:N=false,accent:w="#8b5cf6",className:X$1}){let [v,q]=useState(r),[T,W]=useState(false),[H,B]=useState(0),[V,pe]=useState(0),[u,f]=useState(.8),[E,P]=useState(false),[o,I]=useState(new Set),[K,ne]=useState(false),[U,ie]=useState(x??!b),[z,le]=useState(false),[ze,Ne]=useState(false),[oe,Ce]=useState(M),[fe,ee]=useState(N),me=useRef(false),Y=useRef(null),he=useRef(null),Z=useRef(void 0),G=x??U,ge=g??Tn(l),$=t[v],L=b,Me=k==="dark"?"dark":k==="light"?"light":"",xe="bg-(--mp-bg)",re="text-(--mp-text)",C="text-(--mp-text-muted)",D="text-(--accent)",Ae="border-(--mp-border)";useEffect(()=>{let e=Y.current;e&&(e.src=$.src,e.load(),T&&e.play().catch(()=>{}));},[v,$.src]),useEffect(()=>{if(!O||me.current)return;let e=Y.current;if(!e)return;let a=()=>{me.current=true,W(true),e.play().catch(()=>{});};return e.addEventListener("canplaythrough",a,{once:true}),()=>e.removeEventListener("canplaythrough",a)},[O]),useEffect(()=>{let e=Y.current;e&&(T?e.play().catch(()=>{}):e.pause());},[T]),useEffect(()=>{let e=Y.current;e&&(e.volume=E?0:u);},[u,E]),useEffect(()=>{let e=Y.current;if(!e)return;let a=()=>B(e.currentTime),y=()=>pe(e.duration),F=()=>{fe?(e.currentTime=0,e.play().catch(()=>{})):Ee();};return e.addEventListener("timeupdate",a),e.addEventListener("loadedmetadata",y),e.addEventListener("ended",F),()=>{e.removeEventListener("timeupdate",a),e.removeEventListener("loadedmetadata",y),e.removeEventListener("ended",F);}},[v,t.length]);let de=useCallback(e=>{let a=(e%t.length+t.length)%t.length;q(a),B(0),S?.(a,t[a]),G||(ie(true),R?.(true));},[t,G,S,R]),Ee=useCallback(()=>{if(oe){let e;do e=Math.floor(Math.random()*t.length);while(e===v&&t.length>1);de(e);}else de(v+1);},[de,v,oe,t.length]),ae=useCallback(()=>{if(oe){let e;do e=Math.floor(Math.random()*t.length);while(e===v&&t.length>1);de(e);}else de(v-1);},[de,v,oe,t.length]),ve=useCallback(()=>{let e=o.has(v);I(a=>{let y=new Set(a);return e?y.delete(v):y.add(v),y}),h?.(v,$,!e);},[v,o,h,$]),Ke=useCallback(e=>{let a=e.currentTarget.getBoundingClientRect(),F=Math.max(0,Math.min(1,(e.clientX-a.left)/a.width))*V;Y.current&&(Y.current.currentTime=F),B(F);},[V]),Pe=useCallback(()=>{le(true);let e=L?200:400;Z.current=setTimeout(()=>{le(false),ie(false),R?.(false);},e);},[L,R]);useEffect(()=>()=>{Z.current&&clearTimeout(Z.current);},[]);let n=ze?"fade-in 0.2s ease-out both":`mp-enter-${ge} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,p=ze?"fade-in 0.2s ease-in reverse both":`mp-exit-${ge} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,_=V>0?H/V*100:0;return L&&!G&&!z?jsxs(Fragment,{children:[jsx("audio",{ref:Y,preload:"metadata"}),jsxs("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",An[l]),style:{"--accent":w},onMouseEnter:()=>{Ne(true),ie(true),R?.(true);},children:[jsx("div",{className:s("h-full w-full rounded-full",T?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:T?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),T&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!G&&!z?jsx("audio",{ref:Y,preload:"metadata"}):jsxs(Fragment,{children:[jsx("audio",{ref:Y,preload:"metadata"}),jsx("div",{className:s("fixed z-100",L?Fn[l]:zn[l],Me),style:{"--accent":w,...z?{animation:p}:{animation:n}},onMouseEnter:()=>{L&&(Z.current&&(clearTimeout(Z.current),Z.current=void 0),z&&le(false),Ne(true));},onMouseLeave:()=>{L&&(Ne(false),Pe());},children:jsxs("div",{className:s("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",xe,Ae,L&&"rounded-none",l.endsWith("right")&&L&&"rounded-l-2xl",l.endsWith("left")&&L&&"rounded-r-2xl",X$1),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:$.cover||it,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:T?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:$.cover||it,alt:$.album??$.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"})})]}),T&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-sm font-semibold",re),children:$.title}),$.artist&&jsx("div",{className:s("truncate text-xs",C),children:$.artist}),$.album&&jsx("div",{className:s("mt-0.5 truncate text-[10px] tracking-wide",C,"opacity-60"),children:$.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:s("rounded-full p-1.5 transition-all duration-200",o.has(v)?"text-rose-500 hover:text-rose-400":s(C,"hover:text-rose-500")),onClick:ve,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:o.has(v)?"currentColor":"none"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",C,"hover:"+re.split(" ")[0]),onClick:()=>ne(e=>!e),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!L&&jsx("button",{className:s("rounded-full p-1.5 transition-colors",C,"hover:"+re.split(" ")[0]),onClick:Pe,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:he,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Ke,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${_}%`}}),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(${_}% - 6px)`}})]}),jsxs("div",{className:s("mt-1 flex justify-between text-[10px] font-mono",C),children:[jsx("span",{children:St(H)}),jsx("span",{children:St(V)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:s("rounded-full p-1.5 transition-colors",oe?D:C,"hover:text-(--mp-text)"),onClick:()=>Ce(e=>!e),title:oe?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",fe?D:C,"hover:text-(--mp-text)"),onClick:()=>ee(e=>!e),title:fe?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",C,"hover:text-(--mp-text)"),onClick:ae,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:s("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>W(e=>!e),title:T?"Pause":"Play",children:T?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",C,"hover:text-(--mp-text)"),onClick:Ee,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:s("rounded-full p-1 transition-colors",C,"hover:text-(--mp-text)"),onClick:()=>P(e=>!e),title:E?"Unmute":"Mute",children:E||u===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:E?0:u,onChange:e=>{f(Number(e.target.value)),E&&P(false);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:s("overflow-hidden transition-all duration-300 ease-in-out",K?"max-h-60":"max-h-0"),children:jsx("div",{className:s("border-t px-2 py-2",Ae),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:t.map((e,a)=>{let y=a===v;return jsxs("button",{className:s("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",y?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{de(a),W(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:y&&T?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(F=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+F*4}px`,animation:`mp-eq-bar ${.4+F*.15}s ease-in-out infinite alternate`}},F))}):y?jsx(Disc3,{className:s("h-4 w-4",D)}):jsx("span",{className:s("text-xs font-mono",C),children:a+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:e.cover||it,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-xs font-medium",y?D:re),children:e.title}),e.artist&&jsx("div",{className:s("truncate text-[10px]",C),children:e.artist})]}),o.has(a)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},a)})})})})]})})]})}function Qe(t){if(!isFinite(t)||t<0)return "0:00";let r=Math.floor(t/3600),l=Math.floor(t%3600/60),g=Math.floor(t%60);return r>0?`${r}:${l.toString().padStart(2,"0")}:${g.toString().padStart(2,"0")}`:`${l}:${g.toString().padStart(2,"0")}`}var Zn={title:(t,r)=>t.title.localeCompare(r.title),type:(t,r)=>(t.type??"").localeCompare(r.type??""),duration:(t,r)=>(t.duration??0)-(r.duration??0)};function dt({playlist:t,initialTrack:r=0,autoPlay:l=false,shuffle:g=false,loop:k=false,onTrackChange:b,onPlayChange:x,accent:R="#8b5cf6",className:S}){let[h,O]=useState(r),[M,N]=useState(false),[w,X$1]=useState(0),[v,q]=useState(0),[T,W]=useState(0),[H,B]=useState(.8),[V,pe]=useState(false),[u,f]=useState(g),[E,P]=useState(k),[o,I]=useState(false),[K,ne]=useState("title"),[U,ie]=useState(true),[z,le]=useState(false),[ze,Ne]=useState(false),[oe,Ce]=useState(false),[fe,ee]=useState(true),[me,Y]=useState(false),[he,Z]=useState(null),G=useRef(null),ge=useRef(null),$=useRef(void 0),Fe=useRef(false),L=t[h],Me=jt.useMemo(()=>{let e=t.map((a,y)=>({media:a,originalIndex:y}));return e.sort((a,y)=>{let F=Zn[K](a.media,y.media);return U?F:-F}),e},[t,K,U]);useEffect(()=>{let e=G.current;if(!e)return;Y(true),e.src=L.src,L.poster&&(e.poster=L.poster),e.load();let a=()=>{Y(false),M&&e.play().catch(()=>{});};return e.addEventListener("loadeddata",a,{once:true}),()=>e.removeEventListener("loadeddata",a)},[h,L.src]),useEffect(()=>{if(!l||Fe.current)return;let e=G.current;if(!e)return;let a=()=>{Fe.current=true,N(true),e.play().catch(()=>{});};return e.addEventListener("canplaythrough",a,{once:true}),()=>e.removeEventListener("canplaythrough",a)},[l]),useEffect(()=>{let e=G.current;e&&(M?e.play().catch(()=>{}):e.pause(),x?.(M));},[M]),useEffect(()=>{let e=G.current;e&&(e.volume=V?0:H);},[H,V]),useEffect(()=>{let e=G.current;if(!e)return;let a=()=>X$1(e.currentTime),y=()=>q(e.duration),F=()=>{e.buffered.length>0&&W(e.buffered.end(e.buffered.length-1));},ye=()=>{E?(e.currentTime=0,e.play().catch(()=>{})):C();};return e.addEventListener("timeupdate",a),e.addEventListener("loadedmetadata",y),e.addEventListener("progress",F),e.addEventListener("ended",ye),()=>{e.removeEventListener("timeupdate",a),e.removeEventListener("loadedmetadata",y),e.removeEventListener("progress",F),e.removeEventListener("ended",ye);}},[h,t.length,E]);let xe=useCallback(()=>{ee(true),$.current&&clearTimeout($.current),$.current=setTimeout(()=>{M&&ee(false);},3e3);},[M]);useEffect(()=>{M?xe():(ee(true),$.current&&clearTimeout($.current));},[M,xe]),useEffect(()=>()=>{$.current&&clearTimeout($.current);},[]);let re=useCallback(e=>{let a=(e%t.length+t.length)%t.length;O(a),X$1(0),N(true),b?.(a,t[a]);},[t,b]),C=useCallback(()=>{if(u){let e;do e=Math.floor(Math.random()*t.length);while(e===h&&t.length>1);re(e);}else re(h+1);},[re,h,u,t.length]),D=useCallback(()=>{if(u){let e;do e=Math.floor(Math.random()*t.length);while(e===h&&t.length>1);re(e);}else re(h-1);},[re,h,u,t.length]),Ae=useCallback(e=>{let a=e.currentTarget.getBoundingClientRect(),F=Math.max(0,Math.min(1,(e.clientX-a.left)/a.width))*v;G.current&&(G.current.currentTime=F),X$1(F);},[v]),de=useCallback(e=>{let a=e.currentTarget.getBoundingClientRect(),y=Math.max(0,Math.min(1,(e.clientX-a.left)/a.width));Z(y*v);},[v]),Ee=useCallback(()=>{ge.current&&(document.fullscreenElement?document.exitFullscreen():ge.current.requestFullscreen());},[]);useEffect(()=>{let e=()=>Ce(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]);let ae=useCallback(()=>{z?(Ne(true),setTimeout(()=>{le(false),Ne(false);},500)):le(true);},[z]),ve=useCallback(()=>{I(e=>!e);},[]),Ke=useCallback(()=>{let e=["title","type","duration"],a=e.indexOf(K);U?ie(false):(ie(true),ne(e[(a+1)%e.length]));},[K,U]);useEffect(()=>{let e=a=>{if(!(a.target instanceof HTMLInputElement||a.target instanceof HTMLTextAreaElement))switch(a.key){case " ":case "k":a.preventDefault(),N(y=>!y);break;case "f":a.preventDefault(),Ee();break;case "t":a.preventDefault(),ae();break;case "ArrowLeft":a.preventDefault(),G.current&&(G.current.currentTime=Math.max(0,w-5));break;case "ArrowRight":a.preventDefault(),G.current&&(G.current.currentTime=Math.min(v,w+5));break;case "ArrowUp":a.preventDefault(),B(y=>Math.min(1,y+.05));break;case "ArrowDown":a.preventDefault(),B(y=>Math.max(0,y-.05));break;case "Escape":z&&ae();break;case "n":a.preventDefault(),C();break;case "p":a.preventDefault(),D();break;case "l":a.preventDefault(),ve();break}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Ee,ae,ve,C,D,w,v,z]);let Pe=v>0?w/v*100:0,n=v>0?T/v*100:0,p="text-(--accent)",_=jsxs("div",{ref:ge,className:s("group flex overflow-hidden",oe?"h-full w-full":"aspect-video w-full",!oe&&"rounded-xl",!oe&&M&&"shadow-2xl",!oe&&!M&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",S),style:{"--accent":R,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:s("relative flex-1 min-w-0 h-full overflow-hidden",me&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:xe,onMouseLeave:()=>{M&&ee(false);},children:[jsx("video",{ref:G,className:"h-full w-full object-contain",poster:L.poster,playsInline:true,preload:"metadata",onClick:()=>N(e=>!e)}),!M&&!me&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>N(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)"}})})}),me&&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:L.title}),L.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:L.subtitle})]})}),jsx("div",{className:s("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",fe?"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:L.title}),L.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:L.subtitle})]}),L.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:L.type})]})}),jsxs("div",{className:s("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",fe?"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:Ae,onMouseMove:de,onMouseLeave:()=>Z(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${n}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${Pe}%`}}),he!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${he/v*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:Qe(he)}),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(${Pe}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>N(e=>!e),title:M?"Pause (k)":"Play (k)",children:M?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:D,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:C,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:()=>pe(e=>!e),title:V?"Unmute":"Mute",children:V||H===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:V?0:H,onChange:e=>{B(Number(e.target.value)),V&&pe(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:[Qe(w)," / ",Qe(v)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:s("cp-btn",u&&p),onClick:()=>f(e=>!e),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",E&&p),onClick:()=>P(e=>!e),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",o&&p),onClick:ve,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",z&&p),onClick:ae,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:Ee,title:"Fullscreen (f)",children:oe?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:s("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",o?"w-72":"w-0"),children:jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:Ke,title:`Sort: ${K} ${U?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),K,U?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:ve,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:Me.map(({media:e,originalIndex:a})=>{let y=a===h;return jsxs("button",{className:s("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",y?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:y?void 0:{color:"var(--cp-text)"},onClick:()=>{re(a);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[e.poster?jsx("img",{src:e.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)"}})}),y&&M&&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(F=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+F*3}px`,animation:`mp-eq-bar ${.3+F*.12}s ease-in-out infinite alternate`}},F))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[e.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:e.type}),e.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:Qe(e.duration)})]})]}),y&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},a)})})]})}),jsx("style",{children:`
6
+ </svg>`);function Yt(e){if(!isFinite(e)||e<0)return "0:00";let o=Math.floor(e/60),l=Math.floor(e%60);return `${o}:${l.toString().padStart(2,"0")}`}function Gn(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var qn={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Zn={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Qn={"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 wt({playlist:e,initialTrack:o=0,position:l="bottom-right",entrance:g,theme:w,docked:f=false,visible:v,onVisibleChange:z,onTrackChange:F,onLike:x,autoPlay:_=true,shuffle:D=false,loop:L=false,accent:k="#8b5cf6",className:G}){let [y,ee]=useState(o),[A,ne]=useState(false),[$,K]=useState(0),[j,Me]=useState(0),[u,b]=useState(.8),[C,S]=useState(false),[a,O]=useState(new Set),[Y,ie]=useState(false),[q,ge]=useState(v??!f),[I,be]=useState(false),[$e,Re]=useState(false),[ce,ze]=useState(D),[me,Fe]=useState(L),De=useRef(false),P=useRef(null),ve=useRef(null),Q=useRef(void 0),W=useRef(null),J=useRef(null),pe=v??q,ke=g??Gn(l),M=e[y],U=f,de=w==="dark"?"dark":w==="light"?"light":"",ye="bg-(--mp-bg)",Ne="text-(--mp-text)",te="text-(--mp-text-muted)",Ee="text-(--accent)",Z="border-(--mp-border)";useEffect(()=>{let r=P.current;r&&(r.src=M.src,r.load(),A&&r.play().catch(()=>{}));},[y,M.src]),useEffect(()=>{if(!_||De.current)return;let r=P.current;if(!r)return;let E=()=>{De.current=true,ne(true),r.play().catch(()=>{});};return r.addEventListener("canplaythrough",E,{once:true}),()=>r.removeEventListener("canplaythrough",E)},[_]),useEffect(()=>{let r=P.current;r&&(A?r.play().catch(()=>{}):r.pause());},[A]),useEffect(()=>{let r=P.current;r&&(r.muted=C,J.current?J.current.gain.value=C?0:u:r.volume=u);},[u,C]),useEffect(()=>{let r=P.current;if(!r)return;let E=()=>K(r.currentTime),re=()=>Me(r.duration),Ce=()=>{me?(r.currentTime=0,r.play().catch(()=>{})):Le();};return r.addEventListener("timeupdate",E),r.addEventListener("loadedmetadata",re),r.addEventListener("ended",Ce),()=>{r.removeEventListener("timeupdate",E),r.removeEventListener("loadedmetadata",re),r.removeEventListener("ended",Ce);}},[y,e.length]);let N=useCallback(r=>{let E=(r%e.length+e.length)%e.length;ee(E),K(0),F?.(E,e[E]),pe||(ge(true),z?.(true));},[e,pe,F,z]),Le=useCallback(()=>{if(ce){let r;do r=Math.floor(Math.random()*e.length);while(r===y&&e.length>1);N(r);}else N(y+1);},[N,y,ce,e.length]),Ye=useCallback(()=>{if(ce){let r;do r=Math.floor(Math.random()*e.length);while(r===y&&e.length>1);N(r);}else N(y-1);},[N,y,ce,e.length]),We=useCallback(()=>{let r=a.has(y);O(E=>{let re=new Set(E);return r?re.delete(y):re.add(y),re}),x?.(y,M,!r);},[y,a,x,M]),at=useCallback(r=>{let E=r.currentTarget.getBoundingClientRect(),Ce=Math.max(0,Math.min(1,(r.clientX-E.left)/E.width))*j;P.current&&(P.current.currentTime=Ce),K(Ce);},[j]),le=useCallback(()=>{be(true);let r=U?200:400;Q.current=setTimeout(()=>{be(false),ge(false),z?.(false);},r);},[U,z]);useEffect(()=>()=>{Q.current&&clearTimeout(Q.current);},[]),useEffect(()=>()=>{W.current?.close();},[]);function fe(){if(W.current||!P.current){W.current?.resume();return}try{let r=window.AudioContext??window.webkitAudioContext;if(!r)return;let E=new r,re=E.createGain();re.gain.value=C?0:u,E.createMediaElementSource(P.current).connect(re).connect(E.destination),W.current=E,J.current=re,E.resume();}catch{}}let n=$e?"fade-in 0.2s ease-out both":`mp-enter-${ke} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,h=$e?"fade-in 0.2s ease-in reverse both":`mp-exit-${ke} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,V=j>0?$/j*100:0;return U&&!pe&&!I?jsxs(Fragment,{children:[jsx("audio",{ref:P,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",Qn[l]),style:{"--accent":k},onMouseEnter:()=>{Re(true),ge(true),z?.(true);},children:[jsx("div",{className:s("h-full w-full rounded-full",A?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:A?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),A&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!pe&&!I?jsx("audio",{ref:P,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:P,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:s("fixed z-100",U?Zn[l]:qn[l],de),style:{"--accent":k,...I?{animation:h}:{animation:n}},onMouseEnter:()=>{U&&(Q.current&&(clearTimeout(Q.current),Q.current=void 0),I&&be(false),Re(true));},onMouseLeave:()=>{U&&(Re(false),le());},children:jsxs("div",{className:s("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",ye,Z,U&&"rounded-none",l.endsWith("right")&&U&&"rounded-l-2xl",l.endsWith("left")&&U&&"rounded-r-2xl",G),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:M.cover||yt,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:A?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:M.cover||yt,alt:M.album??M.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"})})]}),A&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-sm font-semibold",Ne),children:M.title}),M.artist&&jsx("div",{className:s("truncate text-xs",te),children:M.artist}),M.album&&jsx("div",{className:s("mt-0.5 truncate text-[10px] tracking-wide",te,"opacity-60"),children:M.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:s("rounded-full p-1.5 transition-all duration-200",a.has(y)?"text-rose-500 hover:text-rose-400":s(te,"hover:text-rose-500")),onClick:We,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:a.has(y)?"currentColor":"none"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",te,"hover:"+Ne.split(" ")[0]),onClick:()=>ie(r=>!r),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!U&&jsx("button",{className:s("rounded-full p-1.5 transition-colors",te,"hover:"+Ne.split(" ")[0]),onClick:le,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:ve,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:at,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${V}%`}}),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(${V}% - 6px)`}})]}),jsxs("div",{className:s("mt-1 flex justify-between text-[10px] font-mono",te),children:[jsx("span",{children:Yt($)}),jsx("span",{children:Yt(j)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:s("rounded-full p-1.5 transition-colors",ce?Ee:te,"hover:text-(--mp-text)"),onClick:()=>ze(r=>!r),title:ce?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",me?Ee:te,"hover:text-(--mp-text)"),onClick:()=>Fe(r=>!r),title:me?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",te,"hover:text-(--mp-text)"),onClick:Ye,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:s("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>{fe(),ne(r=>!r);},title:A?"Pause":"Play",children:A?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",te,"hover:text-(--mp-text)"),onClick:Le,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:s("rounded-full p-1 transition-colors",te,"hover:text-(--mp-text)"),onClick:()=>{fe();let r=!C;S(r),J.current&&(J.current.gain.value=r?0:u);},title:C?"Unmute":"Mute",children:C||u===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:C?0:u,onChange:r=>{fe();let E=Number(r.target.value);b(E),C&&S(false),J.current&&(J.current.gain.value=E);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:s("overflow-hidden transition-all duration-300 ease-in-out",Y?"max-h-60":"max-h-0"),children:jsx("div",{className:s("border-t px-2 py-2",Z),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((r,E)=>{let re=E===y;return jsxs("button",{className:s("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",re?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{N(E),ne(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:re&&A?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(Ce=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+Ce*4}px`,animation:`mp-eq-bar ${.4+Ce*.15}s ease-in-out infinite alternate`}},Ce))}):re?jsx(Disc3,{className:s("h-4 w-4",Ee)}):jsx("span",{className:s("text-xs font-mono",te),children:E+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:r.cover||yt,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-xs font-medium",re?Ee:Ne),children:r.title}),r.artist&&jsx("div",{className:s("truncate text-[10px]",te),children:r.artist})]}),a.has(E)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},E)})})})})]})})]})}function ut(e){if(!isFinite(e)||e<0)return "0:00";let o=Math.floor(e/3600),l=Math.floor(e%3600/60),g=Math.floor(e%60);return o>0?`${o}:${l.toString().padStart(2,"0")}:${g.toString().padStart(2,"0")}`:`${l}:${g.toString().padStart(2,"0")}`}var fr={title:(e,o)=>e.title.localeCompare(o.title),type:(e,o)=>(e.type??"").localeCompare(o.type??""),duration:(e,o)=>(e.duration??0)-(o.duration??0)};function Nt({playlist:e,initialTrack:o=0,autoPlay:l=false,shuffle:g=false,loop:w=false,onTrackChange:f,onPlayChange:v,accent:z="#8b5cf6",className:F}){let[x,_]=useState(o),[D,L]=useState(false),[k,G]=useState(0),[y,ee]=useState(0),[A,ne]=useState(0),[$,K]=useState(.8),[j,Me]=useState(false),[u,b]=useState(g),[C,S]=useState(w),[a,O]=useState(false),[Y,ie]=useState("title"),[q,ge]=useState(true),[I,be]=useState(false),[$e,Re]=useState(false),[ce,ze]=useState(false),[me,Fe]=useState(true),[De,P]=useState(false),[ve,Q]=useState(null),W=useRef(null),J=useRef(null),pe=useRef(void 0),ke=useRef(false),M=e[x],Ke=rn.useMemo(()=>{let n=e.map((h,V)=>({media:h,originalIndex:V}));return n.sort((h,V)=>{let r=fr[Y](h.media,V.media);return q?r:-r}),n},[e,Y,q]);useEffect(()=>{let n=W.current;if(!n)return;P(true),n.src=M.src,M.poster&&(n.poster=M.poster),n.load();let h=()=>{P(false),D&&n.play().catch(()=>{});};return n.addEventListener("loadeddata",h,{once:true}),()=>n.removeEventListener("loadeddata",h)},[x,M.src]),useEffect(()=>{if(!l||ke.current)return;let n=W.current;if(!n)return;let h=()=>{ke.current=true,L(true),n.play().catch(()=>{});};return n.addEventListener("canplaythrough",h,{once:true}),()=>n.removeEventListener("canplaythrough",h)},[l]),useEffect(()=>{let n=W.current;n&&(D?n.play().catch(()=>{}):n.pause(),v?.(D));},[D]),useEffect(()=>{let n=W.current;n&&(n.volume=j?0:$);},[$,j]),useEffect(()=>{let n=W.current;if(!n)return;let h=()=>G(n.currentTime),V=()=>ee(n.duration),r=()=>{n.buffered.length>0&&ne(n.buffered.end(n.buffered.length-1));},E=()=>{C?(n.currentTime=0,n.play().catch(()=>{})):ye();};return n.addEventListener("timeupdate",h),n.addEventListener("loadedmetadata",V),n.addEventListener("progress",r),n.addEventListener("ended",E),()=>{n.removeEventListener("timeupdate",h),n.removeEventListener("loadedmetadata",V),n.removeEventListener("progress",r),n.removeEventListener("ended",E);}},[x,e.length,C]);let U=useCallback(()=>{Fe(true),pe.current&&clearTimeout(pe.current),pe.current=setTimeout(()=>{D&&Fe(false);},3e3);},[D]);useEffect(()=>{D?U():(Fe(true),pe.current&&clearTimeout(pe.current));},[D,U]),useEffect(()=>()=>{pe.current&&clearTimeout(pe.current);},[]);let de=useCallback(n=>{let h=(n%e.length+e.length)%e.length;_(h),G(0),L(true),f?.(h,e[h]);},[e,f]),ye=useCallback(()=>{if(u){let n;do n=Math.floor(Math.random()*e.length);while(n===x&&e.length>1);de(n);}else de(x+1);},[de,x,u,e.length]),Ne=useCallback(()=>{if(u){let n;do n=Math.floor(Math.random()*e.length);while(n===x&&e.length>1);de(n);}else de(x-1);},[de,x,u,e.length]),te=useCallback(n=>{let h=n.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(1,(n.clientX-h.left)/h.width))*y;W.current&&(W.current.currentTime=r),G(r);},[y]),Ee=useCallback(n=>{let h=n.currentTarget.getBoundingClientRect(),V=Math.max(0,Math.min(1,(n.clientX-h.left)/h.width));Q(V*y);},[y]),Z=useCallback(()=>{J.current&&(document.fullscreenElement?document.exitFullscreen():J.current.requestFullscreen());},[]);useEffect(()=>{let n=()=>ze(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",n),()=>document.removeEventListener("fullscreenchange",n)},[]);let N=useCallback(()=>{I?(Re(true),setTimeout(()=>{be(false),Re(false);},500)):be(true);},[I]),Le=useCallback(()=>{O(n=>!n);},[]),Ye=useCallback(()=>{let n=["title","type","duration"],h=n.indexOf(Y);q?ge(false):(ge(true),ie(n[(h+1)%n.length]));},[Y,q]);useEffect(()=>{let n=h=>{if(!(h.target instanceof HTMLInputElement||h.target instanceof HTMLTextAreaElement))switch(h.key){case " ":case "k":h.preventDefault(),L(V=>!V);break;case "f":h.preventDefault(),Z();break;case "t":h.preventDefault(),N();break;case "ArrowLeft":h.preventDefault(),W.current&&(W.current.currentTime=Math.max(0,k-5));break;case "ArrowRight":h.preventDefault(),W.current&&(W.current.currentTime=Math.min(y,k+5));break;case "ArrowUp":h.preventDefault(),K(V=>Math.min(1,V+.05));break;case "ArrowDown":h.preventDefault(),K(V=>Math.max(0,V-.05));break;case "Escape":I&&N();break;case "n":h.preventDefault(),ye();break;case "p":h.preventDefault(),Ne();break;case "l":h.preventDefault(),Le();break}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[Z,N,Le,ye,Ne,k,y,I]);let We=y>0?k/y*100:0,at=y>0?A/y*100:0,le="text-(--accent)",fe=jsxs("div",{ref:J,className:s("group flex overflow-hidden",ce?"h-full w-full":"aspect-video w-full",!ce&&"rounded-xl",!ce&&D&&"shadow-2xl",!ce&&!D&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",F),style:{"--accent":z,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:s("relative flex-1 min-w-0 h-full overflow-hidden",De&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:U,onMouseLeave:()=>{D&&Fe(false);},children:[jsx("video",{ref:W,className:"h-full w-full object-contain",poster:M.poster,playsInline:true,preload:"metadata",onClick:()=>L(n=>!n)}),!D&&!De&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>L(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)"}})})}),De&&!me&&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:M.title}),M.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:M.subtitle})]})}),jsx("div",{className:s("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",me?"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:M.title}),M.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:M.subtitle})]}),M.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:M.type})]})}),jsxs("div",{className:s("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",me?"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:te,onMouseMove:Ee,onMouseLeave:()=>Q(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${at}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${We}%`}}),ve!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${ve/y*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:ut(ve)}),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(${We}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>L(n=>!n),title:D?"Pause (k)":"Play (k)",children:D?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:Ne,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:ye,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:()=>Me(n=>!n),title:j?"Unmute":"Mute",children:j||$===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:j?0:$,onChange:n=>{K(Number(n.target.value)),j&&Me(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:[ut(k)," / ",ut(y)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:s("cp-btn",u&&le),onClick:()=>b(n=>!n),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",C&&le),onClick:()=>S(n=>!n),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",a&&le),onClick:Le,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",I&&le),onClick:N,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:Z,title:"Fullscreen (f)",children:ce?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:s("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",a?"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:Ye,title:`Sort: ${Y} ${q?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),Y,q?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:Le,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:Ke.map(({media:n,originalIndex:h})=>{let V=h===x;return jsxs("button",{className:s("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",V?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:V?void 0:{color:"var(--cp-text)"},onClick:()=>{de(h);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[n.poster?jsx("img",{src:n.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)"}})}),V&&D&&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(r=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+r*3}px`,animation:`mp-eq-bar ${.3+r*.12}s ease-in-out infinite alternate`}},r))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:n.title}),jsxs("div",{className:"flex items-center gap-2",children:[n.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:n.type}),n.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:ut(n.duration)})]})]}),V&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},h)})})]})}),jsx("style",{children:`
7
7
  .cp-btn {
8
8
  display: flex;
9
9
  align-items: center;
@@ -19,7 +19,7 @@ import jt,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,u
19
19
  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); }
20
20
  50% { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 55%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }
21
21
  }
22
- `})]});return jsx("div",{className:s(z&&"fixed inset-0 z-100 flex items-center justify-center p-8",z&&(ze?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:z?e=>{e.target===e.currentTarget&&ae();}:void 0,children:jsx("div",{className:s(z&&"w-full",z&&!oe&&"max-w-5xl"),children:_})})}var ut=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"}});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 Re=[];function nr(t){Re.push(t);}function rr(t){let r=Re.indexOf(t);r!==-1&&Re.splice(r,1);}function pt(t){return Re.length>0&&Re[Re.length-1]===t}function ar(t){let r=Re.indexOf(t);return r!==-1?r:Re.length}var Ft=createContext(null);function At({open:t,onOpenChange:r,modal:l=true,closeOnOutsideClick:g=false,children:k}){let b=useId();return useEffect(()=>{if(t)return nr(b),()=>rr(b)},[t,b]),useEffect(()=>{if(!t||!l)return;let x=R=>{R.key==="Escape"&&pt(b)&&r(false);};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[t,l,r,b]),useEffect(()=>{if(!t||!l)return;let x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x;}},[t,l]),t?jsx(Ft.Provider,{value:{id:b,onOpenChange:r,modal:l,closeOnOutsideClick:g},children:createPortal(k,document.body)}):null}function It({size:t,position:r="center",className:l,children:g,...k}){let b=useContext(Ft);if(!b)return null;let R=200+ar(b.id)*10,S=()=>{b.closeOnOutsideClick&&pt(b.id)&&b.onOpenChange(false);},h=r==="bottom";return b.modal?jsx("div",{className:s("animate-fade-in fixed inset-0 bg-black/50",h?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:R},onClick:S,children:jsx("div",{className:s(ut({size:t}),h?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",l),role:"dialog","aria-modal":"true",onClick:O=>O.stopPropagation(),...k,children:g})}):jsx("div",{className:s("fixed inset-0 flex items-center justify-center p-4",b.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:R},onClick:b.closeOnOutsideClick&&pt(b.id)?()=>b.onOpenChange(false):void 0,children:jsx("div",{className:s(ut({size:t}),"animate-scale-in pointer-events-auto shadow-2xl",l),role:"dialog",onClick:b.closeOnOutsideClick?O=>O.stopPropagation():void 0,...k,children:g})})}function Ot({className:t,...r}){return jsx("div",{className:s("mb-4 space-y-1",t),...r})}function _t({className:t,...r}){return jsx("h2",{className:s("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",t),...r})}function Ht({className:t,...r}){return jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",t),...r})}function Vt({className:t,...r}){return jsx("div",{className:s("mt-6 flex justify-end gap-2",t),...r})}var $t=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"}});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"}});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"}});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"}});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"}});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"}});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"}});cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});function ft({intent:t,size:r,className:l,...g}){return jsx("button",{className:s($t({intent:t,size:r}),l),...g})}function et(t){let r=t.lastIndexOf(".");return r>0?t.slice(r).toLowerCase():""}function Xt(t){return t==null?"\u2014":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function xt(t){return t?(typeof t=="string"?new Date(t):t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var vr={".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 vt(t){if(t.type==="directory")return Folder;let r=t.extension||et(t.name);return vr[r]||File}function Ut(t,r,l){return Math.max(r,Math.min(l,t))}function yt({files:t,title:r="File Explorer",accent:l="#8b5cf6",defaultView:g="list",initialPosition:k,initialSize:b,dockable:x=false,dockSide:R="right",visible:S=true,onFileOpen:h,onSelectionChange:O,onNavigate:M,onDelete:N,onClose:w,onMinimize:X$1,onPathSubmit:v,defaultInputMode:q="search",actions:T,resizable:W=true,minSize:H={width:400,height:300},className:B}){let[V,pe]=useState(g),[u,f]=useState(new Set),[E,P]=useState(null),[o,I]=useState(false),[K,ne]=useState(false),[U,ie]=useState(""),[z,le]=useState(q),[ze,Ne]=useState(S),[oe,Ce]=useState(false),fe=b??{width:720,height:520},[ee,me]=useState(k??{x:Math.max(0,Math.round((window.innerWidth-fe.width)/2)),y:Math.max(0,Math.round((window.innerHeight-fe.height)/2))}),[Y,he]=useState(fe),[Z,G]=useState(null),ge=useRef(false),$=useRef({x:0,y:0}),Fe=useRef(null),L=useRef(false),Me=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),xe=S!==void 0?S:ze,re=useMemo(()=>{let n=t.filter(_=>_.type==="directory"),p=t.filter(_=>_.type==="file");return n.sort((_,e)=>_.name.localeCompare(e.name)),p.sort((_,e)=>_.name.localeCompare(e.name)),[...n,...p]},[t]),C=useMemo(()=>{if(z!=="search"||!U.trim())return re;let n=U.toLowerCase();return re.filter(p=>p.name.toLowerCase().includes(n))},[re,U,z]),D=E!=null?C[E]:null,Ae=useCallback((n,p)=>{f(_=>{let e=new Set(_);return p.ctrlKey||p.metaKey?e.has(n)?e.delete(n):e.add(n):(e.clear(),e.add(n)),e}),P(n);},[]);useEffect(()=>{if(!O)return;let n=Array.from(u).map(p=>C[p]).filter(Boolean);O(n);},[u]);let de=useCallback(n=>{let p=C[n];p&&(p.type==="directory"?M?.(p.path):h?.(p));},[C,h,M]),Ee=useCallback(n=>{o||n.target.closest("button")||(ge.current=true,$.current={x:n.clientX-ee.x,y:n.clientY-ee.y},n.preventDefault());},[ee,o]);useEffect(()=>{let n=_=>{if(!ge.current)return;let e=window.innerWidth-100,a=window.innerHeight-40;me({x:Ut(_.clientX-$.current.x,0,e),y:Ut(_.clientY-$.current.y,0,a)});},p=()=>{ge.current=false,L.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",n),window.addEventListener("mouseup",p),()=>{window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",p);}},[]);let ae=useCallback((n,p)=>{o||(p.preventDefault(),p.stopPropagation(),L.current=n,Me.current={x:p.clientX,y:p.clientY,w:Y.width,h:Y.height,px:ee.x,py:ee.y},document.body.style.cursor=n==="e"||n==="w"?"ew-resize":n==="n"||n==="s"?"ns-resize":n==="nw"||n==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[o,Y,ee]);useEffect(()=>{let n=_=>{if(!L.current)return;let e=L.current,a=_.clientX-Me.current.x,y=_.clientY-Me.current.y,{w:F,h:ye,px:nt,py:rt}=Me.current;if(e.includes("e")&&(F=Math.max(H.width,F+a)),e.includes("w")){let Xe=Math.max(H.width,F-a);nt=nt+(F-Xe),F=Xe;}if(e.includes("s")&&(ye=Math.max(H.height,ye+y)),e.includes("n")){let Xe=Math.max(H.height,ye-y);rt=rt+(ye-Xe),ye=Xe;}he({width:F,height:ye}),me({x:nt,y:rt});},p=()=>{L.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",n),window.addEventListener("mouseup",p),()=>{window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",p);}},[H]);let ve=useCallback(()=>{o?(Z&&(me(Z.pos),he(Z.size)),I(false)):(G({pos:ee,size:Y}),I(true));},[o,ee,Y,Z]),Ke=useCallback(()=>{K?ne(false):(o&&(I(false),Z&&(me(Z.pos),he(Z.size))),ne(true),X$1?.());},[K,o,Z,X$1]);useEffect(()=>{if(!xe||K)return;let n=p=>{if(!(!Fe.current?.contains(document.activeElement)&&document.activeElement!==Fe.current)){if(p.key==="Escape"&&(P(null),f(new Set)),p.ctrlKey&&p.key==="a"){p.preventDefault();let _=new Set(C.map((e,a)=>a));f(_);}p.key==="Delete"&&u.size>0&&N&&(p.preventDefault(),Ce(true));}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[xe,K,C,u,N]);let Pe={"--fe-accent":l};return K?jsx("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",R==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:Pe,onClick:()=>ne(false),title:`Restore ${r}`,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:r})]})}):xe?jsxs("div",{ref:Fe,className:s("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",o&&"rounded-none",B),style:{...Pe,left:o?0:ee.x,top:o?0:ee.y,width:o?"100vw":Y.width,height:o?"100vh":Y.height,transition:o?"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:Ee,onDoubleClick:ve,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:r}),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:()=>pe(n=>n==="list"?"grid":"list"),title:V==="list"?"Grid view":"List view",children:V==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),x&&jsx("button",{className:"fe-btn",onClick:Ke,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:ve,title:o?"Restore":"Maximize",children:o?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:()=>{w?.(),Ne(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:()=>M?.(".."),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:z==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>le(n=>n==="search"?"navigate":"search"),title:z==="search"?"Switch to path navigation":"Switch to file search",children:z==="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:U,onChange:n=>ie(n.target.value),onKeyDown:n=>{n.key==="Enter"&&U.trim()&&z==="navigate"&&(v?v(U.trim()):M?.(U.trim()));},placeholder:z==="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:[C.length," item",C.length!==1?"s":"",u.size>0&&` \xB7 ${u.size} selected`]})]}),jsxs("div",{className:"flex flex-1 min-h-0",children:[jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:n=>{n.target===n.currentTarget&&(f(new Set),P(null));},children:C.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"})]}):V==="list"?jsx("div",{className:"space-y-px",children:C.map((n,p)=>{let _=vt(n),e=u.has(p),a=n.extension||et(n.name);return jsxs("div",{className:s("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",e?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:e?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:y=>Ae(p,y),onDoubleClick:()=>de(p),children:[jsx(_,{className:s("h-4 w-4 shrink-0",n.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:n.name}),a&&n.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:a}),n.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Xt(n.size)}),n.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:xt(n.modifiedAt)})]},n.path+p)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:C.map((n,p)=>{let _=vt(n),e=u.has(p),a=n.extension||et(n.name);return jsxs("div",{className:s("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",e?"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:y=>Ae(p,y),onDoubleClick:()=>de(p),children:[jsx(_,{className:s("h-7 w-7",n.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:n.name}),a&&n.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:a})]},n.path+p)})})}),jsx("div",{className:s("shrink-0 overflow-hidden transition-[width] duration-300 ease-out",D?"w-56":"w-0"),children:D&&jsxs("div",{className:"fe-panel flex h-full w-56 flex-col border-l border-(--fe-border) p-4",children:[jsxs("div",{className:"mb-3 flex flex-col items-center",children:[jt.createElement(vt(D),{className:s("h-10 w-10 mb-2",D.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:D.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(Be,{label:"Type",value:D.type==="directory"?"Directory":D.mimeType||D.extension||et(D.name)||"File"}),D.size!=null&&jsx(Be,{label:"Size",value:Xt(D.size)}),jsx(Be,{label:"Path",value:D.path,mono:true}),D.extension&&jsx(Be,{label:"Extension",value:D.extension}),D.modifiedAt&&jsx(Be,{label:"Modified",value:xt(D.modifiedAt)}),D.createdAt&&jsx(Be,{label:"Created",value:xt(D.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[D.type==="file"&&h&&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:()=>h(D),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),T?.map(n=>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:()=>n.onClick(D),children:[n.icon&&jt.createElement(n.icon,{className:"h-3 w-3"}),n.label]},n.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:[C.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[u.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[u.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),W&&!o&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-2 right-2 h-1.5 cursor-ns-resize",onMouseDown:n=>ae("n",n)}),jsx("div",{className:"absolute bottom-0 left-2 right-2 h-1.5 cursor-ns-resize",onMouseDown:n=>ae("s",n)}),jsx("div",{className:"absolute top-2 left-0 bottom-2 w-1.5 cursor-ew-resize",onMouseDown:n=>ae("w",n)}),jsx("div",{className:"absolute top-2 right-0 bottom-2 w-1.5 cursor-ew-resize",onMouseDown:n=>ae("e",n)}),jsx("div",{className:"absolute top-0 left-0 h-3 w-3 cursor-nwse-resize",onMouseDown:n=>ae("nw",n)}),jsx("div",{className:"absolute top-0 right-0 h-3 w-3 cursor-nesw-resize",onMouseDown:n=>ae("ne",n)}),jsx("div",{className:"absolute bottom-0 left-0 h-3 w-3 cursor-nesw-resize",onMouseDown:n=>ae("sw",n)}),jsx("div",{className:"absolute bottom-0 right-0 h-3 w-3 cursor-nwse-resize",onMouseDown:n=>ae("se",n)})]}),jsx("style",{children:`
22
+ `})]});return jsx("div",{className:s(I&&"fixed inset-0 z-100 flex items-center justify-center p-8",I&&($e?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:I?n=>{n.target===n.currentTarget&&N();}:void 0,children:jsx("div",{className:s(I&&"w-full",I&&!ce&&"max-w-5xl"),children:fe})})}var Ct=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"}});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 He=[];function vr(e){He.push(e);}function yr(e){let o=He.indexOf(e);o!==-1&&He.splice(o,1);}function Et(e){return He.length>0&&He[He.length-1]===e}function wr(e){let o=He.indexOf(e);return o!==-1?o:He.length}var Gt=createContext(null);function qt({open:e,onOpenChange:o,modal:l=true,closeOnOutsideClick:g=false,children:w}){let f=useId();return useEffect(()=>{if(e)return vr(f),()=>yr(f)},[e,f]),useEffect(()=>{if(!e||!l)return;let v=z=>{z.key==="Escape"&&Et(f)&&o(false);};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,l,o,f]),useEffect(()=>{if(!e||!l)return;let v=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=v;}},[e,l]),e?jsx(Gt.Provider,{value:{id:f,onOpenChange:o,modal:l,closeOnOutsideClick:g},children:createPortal(w,document.body)}):null}function Zt({size:e,position:o="center",className:l,children:g,...w}){let f=useContext(Gt);if(!f)return null;let z=200+wr(f.id)*10,F=()=>{f.closeOnOutsideClick&&Et(f.id)&&f.onOpenChange(false);},x=o==="bottom";return f.modal?jsx("div",{className:s("animate-fade-in fixed inset-0 bg-black/50",x?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:z},onClick:F,children:jsx("div",{className:s(Ct({size:e}),x?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",l),role:"dialog","aria-modal":"true",onClick:_=>_.stopPropagation(),...w,children:g})}):jsx("div",{className:s("fixed inset-0 flex items-center justify-center p-4",f.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:z},onClick:f.closeOnOutsideClick&&Et(f.id)?()=>f.onOpenChange(false):void 0,children:jsx("div",{className:s(Ct({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",l),role:"dialog",onClick:f.closeOnOutsideClick?_=>_.stopPropagation():void 0,...w,children:g})})}function Qt({className:e,...o}){return jsx("div",{className:s("mb-4 space-y-1",e),...o})}function Jt({className:e,...o}){return jsx("h2",{className:s("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...o})}function en({className:e,...o}){return jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...o})}function tn({className:e,...o}){return jsx("div",{className:s("mt-6 flex justify-end gap-2",e),...o})}var nn=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"}});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"}});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"}});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"}});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"}});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"}});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"}});cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});function Lt({intent:e,size:o,className:l,...g}){return jsx("button",{className:s(nn({intent:e,size:o}),l),...g})}function mt(e){let o=e.lastIndexOf(".");return o>0?e.slice(o).toLowerCase():""}function ln(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 Tt(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 Ar={".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 Rt(e){if(e.type==="directory")return Folder;let o=e.extension||mt(e.name);return Ar[o]||File}function rt(e,o,l){return Math.max(o,Math.min(l,e))}function cn(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function dn(e,o){if(e<480)return {size:{width:e-16,height:o-48},pos:{x:8,y:24}};if(e<640){let w=e-24,f=Math.min(o-64,540);return {size:{width:w,height:f},pos:{x:12,y:32}}}if(e<1024){let w=Math.min(640,e-32),f=Math.min(480,o-64);return {size:{width:w,height:f},pos:{x:Math.max(0,Math.round((e-w)/2)),y:Math.max(0,Math.round((o-f)/2))}}}let l=720,g=520;return {size:{width:l,height:g},pos:{x:Math.max(0,Math.round((e-l)/2)),y:Math.max(0,Math.round((o-g)/2))}}}function zt({files:e,title:o="File Explorer",accent:l="#8b5cf6",defaultView:g="list",initialPosition:w,initialSize:f,dockable:v=false,dockSide:z="right",visible:F=true,onFileOpen:x,onSelectionChange:_,onNavigate:D,onDelete:L,onClose:k,onMinimize:G,onPathSubmit:y,defaultInputMode:ee="search",actions:A,resizable:ne=true,minSize:$={width:400,height:300},className:K}){let[j,Me]=useState(g),[u,b]=useState(new Set),[C,S]=useState(null),[a,O]=useState(false),[Y,ie]=useState(false),[q,ge]=useState(""),[I,be]=useState(ee),[$e,Re]=useState(F),[ce,ze]=useState(false),[me,Fe]=useState({w:window.innerWidth,h:window.innerHeight}),De=dn(window.innerWidth,window.innerHeight),[P,ve]=useState(w??De.pos),[Q,W]=useState(f??De.size),[J,pe]=useState(null),ke=useRef(false),M=useRef({x:0,y:0}),Ke=useRef(null),U=useRef(false),de=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),ye=useRef(false),Ne=useRef(a);useEffect(()=>{Ne.current=a;},[a]);let te=F!==void 0?F:$e,Ee=useMemo(()=>{let t=e.filter(T=>T.type==="directory"),m=e.filter(T=>T.type==="file");return t.sort((T,R)=>T.name.localeCompare(R.name)),m.sort((T,R)=>T.name.localeCompare(R.name)),[...t,...m]},[e]),Z=useMemo(()=>{if(I!=="search"||!q.trim())return Ee;let t=q.toLowerCase();return Ee.filter(m=>m.name.toLowerCase().includes(t))},[Ee,q,I]),N=C!=null?Z[C]:null;useEffect(()=>{let t=cn(window.innerWidth),m=()=>{let T=window.innerWidth,R=window.innerHeight;if(Fe({w:T,h:R}),Ne.current)return;let X=cn(T);if(X!==t&&!ye.current&&!f){let we=dn(T,R);W(we.size),ve(we.pos);}t=X;};return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[f]);let Le=useCallback((t,m)=>{b(T=>{let R=new Set(T);return m.ctrlKey||m.metaKey?R.has(t)?R.delete(t):R.add(t):(R.clear(),R.add(t)),R}),S(t);},[]);useEffect(()=>{if(!_)return;let t=Array.from(u).map(m=>Z[m]).filter(Boolean);_(t);},[u]);let Ye=useCallback(t=>{let m=Z[t];m&&(m.type==="directory"?D?.(m.path):x?.(m));},[Z,x,D]),We=useCallback(t=>{a||t.target.closest("button")||(ye.current=true,ke.current=true,M.current={x:t.clientX-P.x,y:t.clientY-P.y},t.preventDefault());},[P,a]),at=useCallback(t=>{if(a||t.target.closest("button"))return;ye.current=true;let m=t.touches[0];ke.current=true,M.current={x:m.clientX-P.x,y:m.clientY-P.y};},[P,a]);useEffect(()=>{let t=R=>{if(!ke.current)return;let X=window.innerWidth-100,we=window.innerHeight-40;ve({x:rt(R.clientX-M.current.x,0,X),y:rt(R.clientY-M.current.y,0,we)});},m=R=>{if(!ke.current)return;R.preventDefault();let X=R.touches[0],we=window.innerWidth-100,je=window.innerHeight-40;ve({x:rt(X.clientX-M.current.x,0,we),y:rt(X.clientY-M.current.y,0,je)});},T=()=>{ke.current=false,U.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",T),window.addEventListener("touchmove",m,{passive:false}),window.addEventListener("touchend",T),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",T),window.removeEventListener("touchmove",m),window.removeEventListener("touchend",T);}},[]);let le=useCallback((t,m)=>{a||(m.preventDefault(),m.stopPropagation(),ye.current=true,U.current=t,de.current={x:m.clientX,y:m.clientY,w:Q.width,h:Q.height,px:P.x,py:P.y},document.body.style.cursor=t==="e"||t==="w"?"ew-resize":t==="n"||t==="s"?"ns-resize":t==="nw"||t==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[a,Q,P]),fe=useCallback((t,m)=>{if(a)return;m.preventDefault(),m.stopPropagation(),ye.current=true;let T=m.touches[0];U.current=t,de.current={x:T.clientX,y:T.clientY,w:Q.width,h:Q.height,px:P.x,py:P.y},document.body.style.userSelect="none";},[a,Q,P]);useEffect(()=>{let t=(X,we)=>{let je=U.current;if(!je)return;let Ot=X-de.current.x,_t=we-de.current.y,{w:Ue,h:Ge,px:gt,py:bt}=de.current;if(je.includes("e")&&(Ue=Math.max($.width,Ue+Ot)),je.includes("w")){let st=Math.max($.width,Ue-Ot);gt=gt+(Ue-st),Ue=st;}if(je.includes("s")&&(Ge=Math.max($.height,Ge+_t)),je.includes("n")){let st=Math.max($.height,Ge-_t);bt=bt+(Ge-st),Ge=st;}W({width:Ue,height:Ge}),ve({x:gt,y:bt});},m=X=>{U.current&&t(X.clientX,X.clientY);},T=X=>{U.current&&(X.preventDefault(),t(X.touches[0].clientX,X.touches[0].clientY));},R=()=>{U.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",m),window.addEventListener("mouseup",R),window.addEventListener("touchmove",T,{passive:false}),window.addEventListener("touchend",R),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",R),window.removeEventListener("touchmove",T),window.removeEventListener("touchend",R);}},[$]);let n=useCallback(()=>{a?(J&&(ve(J.pos),W(J.size)),O(false)):(pe({pos:P,size:Q}),O(true));},[a,P,Q,J]),h=useCallback(()=>{Y?ie(false):(a&&(O(false),J&&(ve(J.pos),W(J.size))),ie(true),G?.());},[Y,a,J,G]);useEffect(()=>{if(!te||Y)return;let t=m=>{if(!(!Ke.current?.contains(document.activeElement)&&document.activeElement!==Ke.current)){if(m.key==="Escape"&&(S(null),b(new Set)),m.ctrlKey&&m.key==="a"){m.preventDefault();let T=new Set(Z.map((R,X)=>X));b(T);}m.key==="Delete"&&u.size>0&&L&&(m.preventDefault(),ze(true));}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[te,Y,Z,u,L]);let V={"--fe-accent":l};if(Y)return jsx("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",z==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:V,onClick:()=>ie(false),title:`Restore ${o}`,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:o})]})});if(!te)return null;let r=a?me.w:Math.min(Q.width,me.w-8),E=a?me.h:Math.min(Q.height,me.h-8),re=a?0:rt(P.x,0,Math.max(0,me.w-r)),Ce=a?0:rt(P.y,0,Math.max(0,me.h-40)),ft=r<500;return jsxs("div",{ref:Ke,className:s("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",a&&"rounded-none",K),style:{...V,left:re,top:Ce,width:r,height:E,transition:a?"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:We,onTouchStart:at,onDoubleClick:n,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:o}),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:()=>Me(t=>t==="list"?"grid":"list"),title:j==="list"?"Grid view":"List view",children:j==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),v&&jsx("button",{className:"fe-btn",onClick:h,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:n,title:a?"Restore":"Maximize",children:a?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:()=>{k?.(),Re(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:()=>D?.(".."),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:I==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>be(t=>t==="search"?"navigate":"search"),title:I==="search"?"Switch to path navigation":"Switch to file search",children:I==="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:q,onChange:t=>ge(t.target.value),onKeyDown:t=>{t.key==="Enter"&&q.trim()&&I==="navigate"&&(y?y(q.trim()):D?.(q.trim()));},placeholder:I==="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:[Z.length," item",Z.length!==1?"s":"",u.size>0&&` \xB7 ${u.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:t=>{t.target===t.currentTarget&&(b(new Set),S(null));},children:Z.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"})]}):j==="list"?jsx("div",{className:"space-y-px",children:Z.map((t,m)=>{let T=Rt(t),R=u.has(m),X=t.extension||mt(t.name);return jsxs("div",{className:s("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",R?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:R?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:we=>Le(m,we),onDoubleClick:()=>Ye(m),children:[jsx(T,{className:s("h-4 w-4 shrink-0",t.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:t.name}),X&&t.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:X}),t.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:ln(t.size)}),t.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Tt(t.modifiedAt)})]},t.path+m)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:Z.map((t,m)=>{let T=Rt(t),R=u.has(m),X=t.extension||mt(t.name);return jsxs("div",{className:s("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",R?"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:we=>Le(m,we),onDoubleClick:()=>Ye(m),children:[jsx(T,{className:s("h-7 w-7",t.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:t.name}),X&&t.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:X})]},t.path+m)})})}),jsx("div",{className:s("overflow-hidden transition-[width,opacity] duration-300 ease-out",ft?s("absolute right-0 top-0 bottom-0 z-10",N?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):s("shrink-0",N?"w-56":"w-0")),children:N&&jsxs("div",{className:s("flex h-full flex-col p-4",ft?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[ft&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{S(null),b(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:[rn.createElement(Rt(N),{className:s("h-10 w-10 mb-2",N.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:N.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(ot,{label:"Type",value:N.type==="directory"?"Directory":N.mimeType||N.extension||mt(N.name)||"File"}),N.size!=null&&jsx(ot,{label:"Size",value:ln(N.size)}),jsx(ot,{label:"Path",value:N.path,mono:true}),N.extension&&jsx(ot,{label:"Extension",value:N.extension}),N.modifiedAt&&jsx(ot,{label:"Modified",value:Tt(N.modifiedAt)}),N.createdAt&&jsx(ot,{label:"Created",value:Tt(N.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[N.type==="file"&&x&&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:()=>x(N),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),A?.map(t=>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:()=>t.onClick(N),children:[t.icon&&rn.createElement(t.icon,{className:"h-3 w-3"}),t.label]},t.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:[Z.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[u.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[u.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),ne&&!a&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:t=>le("n",t),onTouchStart:t=>fe("n",t)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:t=>le("s",t),onTouchStart:t=>fe("s",t)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:t=>le("w",t),onTouchStart:t=>fe("w",t)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:t=>le("e",t),onTouchStart:t=>fe("e",t)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:t=>le("nw",t),onTouchStart:t=>fe("nw",t)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:t=>le("ne",t),onTouchStart:t=>fe("ne",t)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:t=>le("sw",t),onTouchStart:t=>fe("sw",t)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:t=>le("se",t),onTouchStart:t=>fe("se",t)})]}),jsx("style",{children:`
23
23
  .fe-window {
24
24
  background: var(--fe-bg);
25
25
  box-shadow: var(--fe-shadow);
@@ -35,6 +35,13 @@ import jt,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,u
35
35
  .fe-panel {
36
36
  background: var(--fe-surface);
37
37
  }
38
+ .fe-panel-narrow {
39
+ background: color-mix(in srgb, var(--fe-bg) 82%, transparent);
40
+ backdrop-filter: blur(20px) saturate(160%);
41
+ -webkit-backdrop-filter: blur(20px) saturate(160%);
42
+ border-left: 1px solid color-mix(in srgb, var(--fe-border) 80%, transparent);
43
+ box-shadow: -6px 0 32px rgba(0,0,0,0.35), inset 1px 0 0 color-mix(in srgb, var(--fe-accent) 10%, transparent);
44
+ }
38
45
  .fe-statusbar {
39
46
  border-top: 1px solid var(--fe-border);
40
47
  background: var(--fe-surface);
@@ -73,4 +80,4 @@ import jt,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,u
73
80
  from { opacity: 0; transform: translateX(-4px); }
74
81
  to { opacity: 1; transform: translateX(0); }
75
82
  }
76
- `}),jsx(At,{open:oe,onOpenChange:Ce,children:jsxs(It,{size:"sm",children:[jsxs(Ot,{children:[jsxs(_t,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(Ht,{children:[u.size===1?`Are you sure you want to delete "${C[Array.from(u)[0]]?.name}"?`:`Are you sure you want to delete ${u.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(Vt,{children:[jsx(ft,{intent:"ghost",onClick:()=>Ce(false),children:"Cancel"}),jsxs(ft,{intent:"danger",onClick:()=>{let n=Array.from(u).map(p=>C[p]).filter(Boolean);N?.(n),f(new Set),P(null),Ce(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]}):null}function Be({label:t,value:r,mono:l}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:t}),jsx("div",{className:s("text-(--fe-text) break-all leading-snug",l&&"font-mono text-[9px]"),children:r})]})}function kr(t,r){let l=r.getBoundingClientRect(),g=Math.max(l.width,l.height)*1.2,k=t.clientX-l.left,b=t.clientY-l.top,x=document.createElement("span");x.className="masonry-ripple",x.style.width=`${g}px`,x.style.height=`${g}px`,x.style.left=`${k}px`,x.style.top=`${b}px`,r.appendChild(x),x.addEventListener("animationend",()=>x.remove());}function Ct({columns:t,columnWidth:r=240,gap:l=16,items:g,onItemClick:k,className:b,style:x,children:R,...S}){let h=useRef(null),O=useRef([]),[M,N]=useState(()=>t??1),[w,X]=useState([]),[v,q]=useState(0),T=g?g.map((u,f)=>({key:u.key??f,node:u.content})):jt.Children.toArray(R).map((u,f)=>({key:u.key??f,node:u})),W=T.length,H=useCallback(u=>t??Math.max(1,Math.floor((u+l)/(r+l))),[t,r,l]),B=useCallback(()=>{let u=h.current;if(!u)return;let f=u.clientWidth,E=H(f);N(E);let P=(f-(E-1)*l)/E,o=new Array(E).fill(0),I=[];for(let ne=0;ne<W;ne++){let U=O.current[ne],ie=U?U.offsetHeight:0,z=0;for(let le=1;le<E;le++)o[le]<o[z]&&(z=le);I.push({top:o[z],left:z*(P+l),width:P}),o[z]+=ie+l;}let K=Math.max(0,...o)-(W?l:0);X(I),q(K);},[W,H,l]);useEffect(()=>{let u=h.current;if(!u)return;let f=new ResizeObserver(()=>B());return f.observe(u),()=>f.disconnect()},[B]),useEffect(()=>{let u=requestAnimationFrame(B);return ()=>cancelAnimationFrame(u)},[B]),useEffect(()=>{let u=new ResizeObserver(()=>B());return O.current.forEach(f=>{f&&u.observe(f);}),()=>u.disconnect()},[W,M,B]);let V=useCallback((u,f)=>{let E=u.currentTarget;kr(u,E),k?.(g?.[f],f);},[k,g]),pe=u=>{if(!g)return false;let f=g[u];return !!(f.title||f.description||f.actions)};return jsx("div",{ref:h,className:s("relative",b),style:{...x,height:v},...S,children:T.map((u,f)=>jsxs("div",{ref:E=>{O.current[f]=E;},className:"masonry-item",role:"button",tabIndex:0,onClick:E=>V(E,f),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),k?.(g?.[f],f));},style:{position:"absolute",top:w[f]?.top??0,left:w[f]?.left??0,width:w[f]?.width??"100%"},children:[u.node,pe(f)&&jsxs("div",{className:"masonry-item-overlay",children:[g[f].title&&jsx("p",{className:"masonry-item-overlay-title",children:g[f].title}),g[f].description&&jsx("p",{className:"masonry-item-overlay-desc",children:g[f].description}),g[f].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:g[f].actions})]})]},u.key))})}var Nr={FilmReel:st,MiniPlayer:lt,CinePlayer:dt,FileExplorer:yt,Masonry:Ct},Va=Nr;export{dt as CinePlayer,Nr as Extras,yt as FileExplorer,st as FilmReel,Ct as Masonry,lt as MiniPlayer,Va as default};
83
+ `}),jsx(qt,{open:ce,onOpenChange:ze,children:jsxs(Zt,{size:"sm",children:[jsxs(Qt,{children:[jsxs(Jt,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(en,{children:[u.size===1?`Are you sure you want to delete "${Z[Array.from(u)[0]]?.name}"?`:`Are you sure you want to delete ${u.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(tn,{children:[jsx(Lt,{intent:"ghost",onClick:()=>ze(false),children:"Cancel"}),jsxs(Lt,{intent:"danger",onClick:()=>{let t=Array.from(u).map(m=>Z[m]).filter(Boolean);L?.(t),b(new Set),S(null),ze(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function ot({label:e,value:o,mono:l}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsx("div",{className:s("text-(--fe-text) break-all leading-snug",l&&"font-mono text-[9px]"),children:o})]})}function Or(e,o){let l=o.getBoundingClientRect(),g=Math.max(l.width,l.height)*1.2,w=e.clientX-l.left,f=e.clientY-l.top,v=document.createElement("span");v.className="masonry-ripple",v.style.width=`${g}px`,v.style.height=`${g}px`,v.style.left=`${w}px`,v.style.top=`${f}px`,o.appendChild(v),v.addEventListener("animationend",()=>v.remove());}function Ht({columns:e,columnWidth:o=240,gap:l=16,items:g,onItemClick:w,className:f,style:v,children:z,...F}){let x=useRef(null),_=useRef([]),[D,L]=useState(()=>e??1),[k,G]=useState([]),[y,ee]=useState(0),A=g?g.map((u,b)=>({key:u.key??b,node:u.content})):rn.Children.toArray(z).map((u,b)=>({key:u.key??b,node:u})),ne=A.length,$=useCallback(u=>e??Math.max(1,Math.floor((u+l)/(o+l))),[e,o,l]),K=useCallback(()=>{let u=x.current;if(!u)return;let b=u.clientWidth,C=$(b);L(C);let S=(b-(C-1)*l)/C,a=new Array(C).fill(0),O=[];for(let ie=0;ie<ne;ie++){let q=_.current[ie],ge=q?q.offsetHeight:0,I=0;for(let be=1;be<C;be++)a[be]<a[I]&&(I=be);O.push({top:a[I],left:I*(S+l),width:S}),a[I]+=ge+l;}let Y=Math.max(0,...a)-(ne?l:0);G(O),ee(Y);},[ne,$,l]);useEffect(()=>{let u=x.current;if(!u)return;let b=new ResizeObserver(()=>K());return b.observe(u),()=>b.disconnect()},[K]),useEffect(()=>{let u=requestAnimationFrame(K);return ()=>cancelAnimationFrame(u)},[K]),useEffect(()=>{let u=new ResizeObserver(()=>K());return _.current.forEach(b=>{b&&u.observe(b);}),()=>u.disconnect()},[ne,D,K]);let j=useCallback((u,b)=>{let C=u.currentTarget;Or(u,C),w?.(g?.[b],b);},[w,g]),Me=u=>{if(!g)return false;let b=g[u];return !!(b.title||b.description||b.actions)};return jsx("div",{ref:x,className:s("relative",f),style:{...v,height:y},...F,children:A.map((u,b)=>jsxs("div",{ref:C=>{_.current[b]=C;},className:"masonry-item",role:"button",tabIndex:0,onClick:C=>j(C,b),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),w?.(g?.[b],b));},style:{position:"absolute",top:k[b]?.top??0,left:k[b]?.left??0,width:k[b]?.width??"100%"},children:[u.node,Me(b)&&jsxs("div",{className:"masonry-item-overlay",children:[g[b].title&&jsx("p",{className:"masonry-item-overlay-title",children:g[b].title}),g[b].description&&jsx("p",{className:"masonry-item-overlay-desc",children:g[b].description}),g[b].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:g[b].actions})]})]},u.key))})}var _r={FilmReel:vt,MiniPlayer:wt,CinePlayer:Nt,FileExplorer:zt,Masonry:Ht},ra=_r;export{Nt as CinePlayer,_r as Extras,zt as FileExplorer,vt as FilmReel,Ht as Masonry,wt as MiniPlayer,ra as default};
@@ -1 +1 @@
1
- 'use strict';var I=require('react'),lucideReact=require('lucide-react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var I__default=/*#__PURE__*/_interopDefault(I);function p(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var z=classVarianceAuthority.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"}});classVarianceAuthority.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 M=classVarianceAuthority.cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var S=I.createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),K={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},j={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function nt({children:o,className:c,intent:g,size:a="md",layout:f="stacked",title:e,description:m,footer:v,onValues:y,onSubmit:s,...n}){let E=K[a??"md"],[F,C]=I.useState({}),l=I.useCallback(V=>{if(s?.(V),y){let b=Object.fromEntries(new FormData(V.currentTarget).entries()),k=y(b,V),R=h=>{if(!h)return;let w={};for(let[N,{result:r,reason:x}]of Object.entries(h))x&&(w[N]={status:r?"success":"error",message:x});C(w);};k instanceof Promise?k.then(R).catch(()=>{}):R(k);}},[s,y]);return jsxRuntime.jsx(S.Provider,{value:{layout:f??"stacked",size:a??"md",labelWidth:E,bulkErrors:F},children:jsxRuntime.jsxs("form",{className:p(z({intent:g,size:a}),"flex flex-col",c),onSubmit:l,...n,children:[(e||m)&&jsxRuntime.jsxs("div",{className:"mb-(--form-header-mb)",children:[e&&jsxRuntime.jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:e}),m&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:m})]}),jsxRuntime.jsx("div",{className:p("flex flex-col",j[a??"md"]),children:o}),v&&jsxRuntime.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:v})]})})}var Q={error:jsxRuntime.jsx(lucideReact.AlertCircle,{}),warning:jsxRuntime.jsx(lucideReact.AlertTriangle,{}),success:jsxRuntime.jsx(lucideReact.CheckCircle,{}),hint:jsxRuntime.jsx(lucideReact.Info,{})};function it({label:o,layout:c,required:g,hint:a,validation:f,name:e,onValidate:m,className:v,children:y}){let s=I.useContext(S),n=I.useId(),[E,F]=I.useState(void 0),C=e?s.bulkErrors[e]:void 0,l=f??E??C,b=(c??s.layout)==="inline",k=I.useCallback(r=>{let x=r!=null&&typeof r=="object"&&"target"in r?r.target.value:r;if(e&&s.bulkErrors[e]&&(s.bulkErrors[e]=void 0),!m){F(void 0);return}let{result:d,reason:i}=m(x);F(i?{status:d?"success":"error",message:i}:void 0);},[m,e,s.bulkErrors]),R=l?`${n}-validation`:a?`${n}-hint`:void 0,h=I__default.default.Children.map(y,(r,x)=>{if(x!==0||!I__default.default.isValidElement(r))return r;let d=r,i={};if(d.props.id||(i.id=n),R&&!d.props["aria-describedby"]&&(i["aria-describedby"]=R),l?.status==="error"&&!d.props["aria-invalid"]&&(i["aria-invalid"]=true),e&&!d.props.name&&(i.name=e),m){let B=d.props.onChange;i.onChange=L=>{B?.(L),k(L);};}return Object.keys(i).length?I__default.default.cloneElement(d,i):r}),w=o!=null&&jsxRuntime.jsx("label",{htmlFor:n,className:p("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",g&&"after:ml-0.5 after:text-danger-500 after:content-['*']",b&&"pt-1.75"),style:b?{width:s.labelWidth,minWidth:s.labelWidth}:void 0,children:o}),N=f?`${n}-validation`:a?`${n}-hint`:void 0;return jsxRuntime.jsxs("div",{className:p("flex w-full flex-col gap-1.5",b&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",v),children:[w,jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,l&&jsxRuntime.jsxs("p",{id:`${n}-validation`,className:p(M({status:l.status})),role:l.status==="error"?"alert":void 0,children:[Q[l.status],jsxRuntime.jsx("span",{children:l.message})]}),a&&jsxRuntime.jsx("p",{id:N===`${n}-hint`?N:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:a})]})]})}function lt({title:o,description:c,className:g,children:a}){let{size:f}=I.useContext(S);return jsxRuntime.jsxs("fieldset",{className:p("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",j[f],g),children:[(o||c)&&jsxRuntime.jsxs("legend",{className:"px-1.5 pb-1",children:[o&&jsxRuntime.jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:o}),c&&jsxRuntime.jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:c})]}),a]})}exports.Form=nt;exports.FormItem=it;exports.FormSection=lt;
1
+ 'use strict';var I=require('react'),lucideReact=require('lucide-react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var I__default=/*#__PURE__*/_interopDefault(I);function p(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var z=classVarianceAuthority.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"}});classVarianceAuthority.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 M=classVarianceAuthority.cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var S=I.createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),K={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},j={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function nt({children:o,className:c,intent:g,size:a="md",layout:f="stacked",title:e,description:m,footer:F,onValues:y,onSubmit:s,...n}){let E=K[a??"md"],[V,C]=I.useState({}),l=I.useCallback(b=>{if(b.preventDefault(),s?.(b),y){let k=Object.fromEntries(new FormData(b.currentTarget).entries()),v=y(k,b),R=h=>{if(!h)return;let w={};for(let[N,{result:r,reason:x}]of Object.entries(h))x&&(w[N]={status:r?"success":"error",message:x});C(w);};v instanceof Promise?v.then(R).catch(()=>{}):R(v);}},[s,y]);return jsxRuntime.jsx(S.Provider,{value:{layout:f??"stacked",size:a??"md",labelWidth:E,bulkErrors:V},children:jsxRuntime.jsxs("form",{className:p(z({intent:g,size:a}),"flex flex-col",c),onSubmit:l,...n,children:[(e||m)&&jsxRuntime.jsxs("div",{className:"mb-(--form-header-mb)",children:[e&&jsxRuntime.jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:e}),m&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:m})]}),jsxRuntime.jsx("div",{className:p("flex flex-col",j[a??"md"]),children:o}),F&&jsxRuntime.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:F})]})})}var Q={error:jsxRuntime.jsx(lucideReact.AlertCircle,{}),warning:jsxRuntime.jsx(lucideReact.AlertTriangle,{}),success:jsxRuntime.jsx(lucideReact.CheckCircle,{}),hint:jsxRuntime.jsx(lucideReact.Info,{})};function it({label:o,layout:c,required:g,hint:a,validation:f,name:e,onValidate:m,className:F,children:y}){let s=I.useContext(S),n=I.useId(),[E,V]=I.useState(void 0),C=e?s.bulkErrors[e]:void 0,l=f??E??C,k=(c??s.layout)==="inline",v=I.useCallback(r=>{let x=r!=null&&typeof r=="object"&&"target"in r?r.target.value:r;if(e&&s.bulkErrors[e]&&(s.bulkErrors[e]=void 0),!m){V(void 0);return}let{result:d,reason:i}=m(x);V(i?{status:d?"success":"error",message:i}:void 0);},[m,e,s.bulkErrors]),R=l?`${n}-validation`:a?`${n}-hint`:void 0,h=I__default.default.Children.map(y,(r,x)=>{if(x!==0||!I__default.default.isValidElement(r))return r;let d=r,i={};if(d.props.id||(i.id=n),R&&!d.props["aria-describedby"]&&(i["aria-describedby"]=R),l?.status==="error"&&!d.props["aria-invalid"]&&(i["aria-invalid"]=true),e&&!d.props.name&&(i.name=e),m){let B=d.props.onChange;i.onChange=L=>{B?.(L),v(L);};}return Object.keys(i).length?I__default.default.cloneElement(d,i):r}),w=o!=null&&jsxRuntime.jsx("label",{htmlFor:n,className:p("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",g&&"after:ml-0.5 after:text-danger-500 after:content-['*']",k&&"pt-1.75"),style:k?{width:s.labelWidth,minWidth:s.labelWidth}:void 0,children:o}),N=f?`${n}-validation`:a?`${n}-hint`:void 0;return jsxRuntime.jsxs("div",{className:p("flex w-full flex-col gap-1.5",k&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",F),children:[w,jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,l&&jsxRuntime.jsxs("p",{id:`${n}-validation`,className:p(M({status:l.status})),role:l.status==="error"?"alert":void 0,children:[Q[l.status],jsxRuntime.jsx("span",{children:l.message})]}),a&&jsxRuntime.jsx("p",{id:N===`${n}-hint`?N:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:a})]})]})}function lt({title:o,description:c,className:g,children:a}){let{size:f}=I.useContext(S);return jsxRuntime.jsxs("fieldset",{className:p("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",j[f],g),children:[(o||c)&&jsxRuntime.jsxs("legend",{className:"px-1.5 pb-1",children:[o&&jsxRuntime.jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:o}),c&&jsxRuntime.jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:c})]}),a]})}exports.Form=nt;exports.FormItem=it;exports.FormSection=lt;
@@ -1 +1 @@
1
- import I,{createContext,useState,useCallback,useContext,useId}from'react';import {Info,CheckCircle,AlertTriangle,AlertCircle}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,jsxs}from'react/jsx-runtime';function p(...o){return twMerge(clsx(o))}var z=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 M=cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var S=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),K={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},j={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function nt({children:o,className:c,intent:g,size:a="md",layout:f="stacked",title:e,description:m,footer:v,onValues:y,onSubmit:s,...n}){let E=K[a??"md"],[F,C]=useState({}),l=useCallback(V=>{if(s?.(V),y){let b=Object.fromEntries(new FormData(V.currentTarget).entries()),k=y(b,V),R=h=>{if(!h)return;let w={};for(let[N,{result:r,reason:x}]of Object.entries(h))x&&(w[N]={status:r?"success":"error",message:x});C(w);};k instanceof Promise?k.then(R).catch(()=>{}):R(k);}},[s,y]);return jsx(S.Provider,{value:{layout:f??"stacked",size:a??"md",labelWidth:E,bulkErrors:F},children:jsxs("form",{className:p(z({intent:g,size:a}),"flex flex-col",c),onSubmit:l,...n,children:[(e||m)&&jsxs("div",{className:"mb-(--form-header-mb)",children:[e&&jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:e}),m&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:m})]}),jsx("div",{className:p("flex flex-col",j[a??"md"]),children:o}),v&&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:v})]})})}var Q={error:jsx(AlertCircle,{}),warning:jsx(AlertTriangle,{}),success:jsx(CheckCircle,{}),hint:jsx(Info,{})};function it({label:o,layout:c,required:g,hint:a,validation:f,name:e,onValidate:m,className:v,children:y}){let s=useContext(S),n=useId(),[E,F]=useState(void 0),C=e?s.bulkErrors[e]:void 0,l=f??E??C,b=(c??s.layout)==="inline",k=useCallback(r=>{let x=r!=null&&typeof r=="object"&&"target"in r?r.target.value:r;if(e&&s.bulkErrors[e]&&(s.bulkErrors[e]=void 0),!m){F(void 0);return}let{result:d,reason:i}=m(x);F(i?{status:d?"success":"error",message:i}:void 0);},[m,e,s.bulkErrors]),R=l?`${n}-validation`:a?`${n}-hint`:void 0,h=I.Children.map(y,(r,x)=>{if(x!==0||!I.isValidElement(r))return r;let d=r,i={};if(d.props.id||(i.id=n),R&&!d.props["aria-describedby"]&&(i["aria-describedby"]=R),l?.status==="error"&&!d.props["aria-invalid"]&&(i["aria-invalid"]=true),e&&!d.props.name&&(i.name=e),m){let B=d.props.onChange;i.onChange=L=>{B?.(L),k(L);};}return Object.keys(i).length?I.cloneElement(d,i):r}),w=o!=null&&jsx("label",{htmlFor:n,className:p("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",g&&"after:ml-0.5 after:text-danger-500 after:content-['*']",b&&"pt-1.75"),style:b?{width:s.labelWidth,minWidth:s.labelWidth}:void 0,children:o}),N=f?`${n}-validation`:a?`${n}-hint`:void 0;return jsxs("div",{className:p("flex w-full flex-col gap-1.5",b&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",v),children:[w,jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,l&&jsxs("p",{id:`${n}-validation`,className:p(M({status:l.status})),role:l.status==="error"?"alert":void 0,children:[Q[l.status],jsx("span",{children:l.message})]}),a&&jsx("p",{id:N===`${n}-hint`?N:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:a})]})]})}function lt({title:o,description:c,className:g,children:a}){let{size:f}=useContext(S);return jsxs("fieldset",{className:p("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",j[f],g),children:[(o||c)&&jsxs("legend",{className:"px-1.5 pb-1",children:[o&&jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:o}),c&&jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:c})]}),a]})}export{nt as Form,it as FormItem,lt as FormSection};
1
+ import I,{createContext,useState,useCallback,useContext,useId}from'react';import {Info,CheckCircle,AlertTriangle,AlertCircle}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,jsxs}from'react/jsx-runtime';function p(...o){return twMerge(clsx(o))}var z=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 M=cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var S=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),K={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},j={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function nt({children:o,className:c,intent:g,size:a="md",layout:f="stacked",title:e,description:m,footer:F,onValues:y,onSubmit:s,...n}){let E=K[a??"md"],[V,C]=useState({}),l=useCallback(b=>{if(b.preventDefault(),s?.(b),y){let k=Object.fromEntries(new FormData(b.currentTarget).entries()),v=y(k,b),R=h=>{if(!h)return;let w={};for(let[N,{result:r,reason:x}]of Object.entries(h))x&&(w[N]={status:r?"success":"error",message:x});C(w);};v instanceof Promise?v.then(R).catch(()=>{}):R(v);}},[s,y]);return jsx(S.Provider,{value:{layout:f??"stacked",size:a??"md",labelWidth:E,bulkErrors:V},children:jsxs("form",{className:p(z({intent:g,size:a}),"flex flex-col",c),onSubmit:l,...n,children:[(e||m)&&jsxs("div",{className:"mb-(--form-header-mb)",children:[e&&jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:e}),m&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:m})]}),jsx("div",{className:p("flex flex-col",j[a??"md"]),children:o}),F&&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:F})]})})}var Q={error:jsx(AlertCircle,{}),warning:jsx(AlertTriangle,{}),success:jsx(CheckCircle,{}),hint:jsx(Info,{})};function it({label:o,layout:c,required:g,hint:a,validation:f,name:e,onValidate:m,className:F,children:y}){let s=useContext(S),n=useId(),[E,V]=useState(void 0),C=e?s.bulkErrors[e]:void 0,l=f??E??C,k=(c??s.layout)==="inline",v=useCallback(r=>{let x=r!=null&&typeof r=="object"&&"target"in r?r.target.value:r;if(e&&s.bulkErrors[e]&&(s.bulkErrors[e]=void 0),!m){V(void 0);return}let{result:d,reason:i}=m(x);V(i?{status:d?"success":"error",message:i}:void 0);},[m,e,s.bulkErrors]),R=l?`${n}-validation`:a?`${n}-hint`:void 0,h=I.Children.map(y,(r,x)=>{if(x!==0||!I.isValidElement(r))return r;let d=r,i={};if(d.props.id||(i.id=n),R&&!d.props["aria-describedby"]&&(i["aria-describedby"]=R),l?.status==="error"&&!d.props["aria-invalid"]&&(i["aria-invalid"]=true),e&&!d.props.name&&(i.name=e),m){let B=d.props.onChange;i.onChange=L=>{B?.(L),v(L);};}return Object.keys(i).length?I.cloneElement(d,i):r}),w=o!=null&&jsx("label",{htmlFor:n,className:p("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",g&&"after:ml-0.5 after:text-danger-500 after:content-['*']",k&&"pt-1.75"),style:k?{width:s.labelWidth,minWidth:s.labelWidth}:void 0,children:o}),N=f?`${n}-validation`:a?`${n}-hint`:void 0;return jsxs("div",{className:p("flex w-full flex-col gap-1.5",k&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",F),children:[w,jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,l&&jsxs("p",{id:`${n}-validation`,className:p(M({status:l.status})),role:l.status==="error"?"alert":void 0,children:[Q[l.status],jsx("span",{children:l.message})]}),a&&jsx("p",{id:N===`${n}-hint`?N:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:a})]})]})}function lt({title:o,description:c,className:g,children:a}){let{size:f}=useContext(S);return jsxs("fieldset",{className:p("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",j[f],g),children:[(o||c)&&jsxs("legend",{className:"px-1.5 pb-1",children:[o&&jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:o}),c&&jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:c})]}),a]})}export{nt as Form,it as FormItem,lt as FormSection};
@@ -1 +1 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var react=require('react');require('lucide-react');var clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function l(...r){return tailwindMerge.twMerge(clsx.clsx(r))}var y=classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var W=react.createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),H={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},j={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function d({children:r,className:k,intent:F,size:e="md",layout:R="stacked",title:a,description:o,footer:c,onValues:s,onSubmit:p,...v}){let V=H[e??"md"],[h,w]=react.useState({}),N=react.useCallback(n=>{if(p?.(n),s){let E=Object.fromEntries(new FormData(n.currentTarget).entries()),i=s(E,n),u=f=>{if(!f)return;let x={};for(let[C,{result:P,reason:g}]of Object.entries(f))g&&(x[C]={status:P?"success":"error",message:g});w(x);};i instanceof Promise?i.then(u).catch(()=>{}):u(i);}},[p,s]);return jsxRuntime.jsx(W.Provider,{value:{layout:R??"stacked",size:e??"md",labelWidth:V,bulkErrors:h},children:jsxRuntime.jsxs("form",{className:l(y({intent:F,size:e}),"flex flex-col",k),onSubmit:N,...v,children:[(a||o)&&jsxRuntime.jsxs("div",{className:"mb-(--form-header-mb)",children:[a&&jsxRuntime.jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:a}),o&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:o})]}),jsxRuntime.jsx("div",{className:l("flex flex-col",j[e??"md"]),children:r}),c&&jsxRuntime.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:c})]})})}var B={Form:d},nt=B;exports.Form=d;exports.Forms=B;exports.default=nt;
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var react=require('react');require('lucide-react');var clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function l(...a){return tailwindMerge.twMerge(clsx.clsx(a))}var y=classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var W=react.createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),H={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},j={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function d({children:a,className:k,intent:v,size:e="md",layout:F="stacked",title:o,description:s,footer:c,onValues:n,onSubmit:p,...R}){let V=H[e??"md"],[h,w]=react.useState({}),N=react.useCallback(r=>{if(r.preventDefault(),p?.(r),n){let E=Object.fromEntries(new FormData(r.currentTarget).entries()),i=n(E,r),u=f=>{if(!f)return;let x={};for(let[C,{result:P,reason:g}]of Object.entries(f))g&&(x[C]={status:P?"success":"error",message:g});w(x);};i instanceof Promise?i.then(u).catch(()=>{}):u(i);}},[p,n]);return jsxRuntime.jsx(W.Provider,{value:{layout:F??"stacked",size:e??"md",labelWidth:V,bulkErrors:h},children:jsxRuntime.jsxs("form",{className:l(y({intent:v,size:e}),"flex flex-col",k),onSubmit:N,...R,children:[(o||s)&&jsxRuntime.jsxs("div",{className:"mb-(--form-header-mb)",children:[o&&jsxRuntime.jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:o}),s&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:s})]}),jsxRuntime.jsx("div",{className:l("flex flex-col",j[e??"md"]),children:a}),c&&jsxRuntime.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:c})]})})}var B={Form:d},nt=B;exports.Form=d;exports.Forms=B;exports.default=nt;
@@ -1 +1 @@
1
- import {createContext,useState,useCallback}from'react';import'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,jsxs}from'react/jsx-runtime';function l(...r){return twMerge(clsx(r))}var y=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"}});cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var W=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),H={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},j={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function d({children:r,className:k,intent:F,size:e="md",layout:R="stacked",title:a,description:o,footer:c,onValues:s,onSubmit:p,...v}){let V=H[e??"md"],[h,w]=useState({}),N=useCallback(n=>{if(p?.(n),s){let E=Object.fromEntries(new FormData(n.currentTarget).entries()),i=s(E,n),u=f=>{if(!f)return;let x={};for(let[C,{result:P,reason:g}]of Object.entries(f))g&&(x[C]={status:P?"success":"error",message:g});w(x);};i instanceof Promise?i.then(u).catch(()=>{}):u(i);}},[p,s]);return jsx(W.Provider,{value:{layout:R??"stacked",size:e??"md",labelWidth:V,bulkErrors:h},children:jsxs("form",{className:l(y({intent:F,size:e}),"flex flex-col",k),onSubmit:N,...v,children:[(a||o)&&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}),o&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:o})]}),jsx("div",{className:l("flex flex-col",j[e??"md"]),children:r}),c&&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:c})]})})}var B={Form:d},nt=B;export{d as Form,B as Forms,nt as default};
1
+ import {createContext,useState,useCallback}from'react';import'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,jsxs}from'react/jsx-runtime';function l(...a){return twMerge(clsx(a))}var y=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"}});cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var W=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),H={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},j={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function d({children:a,className:k,intent:v,size:e="md",layout:F="stacked",title:o,description:s,footer:c,onValues:n,onSubmit:p,...R}){let V=H[e??"md"],[h,w]=useState({}),N=useCallback(r=>{if(r.preventDefault(),p?.(r),n){let E=Object.fromEntries(new FormData(r.currentTarget).entries()),i=n(E,r),u=f=>{if(!f)return;let x={};for(let[C,{result:P,reason:g}]of Object.entries(f))g&&(x[C]={status:P?"success":"error",message:g});w(x);};i instanceof Promise?i.then(u).catch(()=>{}):u(i);}},[p,n]);return jsx(W.Provider,{value:{layout:F??"stacked",size:e??"md",labelWidth:V,bulkErrors:h},children:jsxs("form",{className:l(y({intent:v,size:e}),"flex flex-col",k),onSubmit:N,...R,children:[(o||s)&&jsxs("div",{className:"mb-(--form-header-mb)",children:[o&&jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:o}),s&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:s})]}),jsx("div",{className:l("flex flex-col",j[e??"md"]),children:a}),c&&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:c})]})})}var B={Form:d},nt=B;export{d as Form,B as Forms,nt as default};