@jacshuo/onyx 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chart/BarChart.cjs +1 -1
- package/dist/Chart/BarChart.js +1 -1
- package/dist/Chart/PieChart.cjs +1 -1
- package/dist/Chart/PieChart.js +1 -1
- package/dist/Chart/ScatterChart.cjs +1 -1
- package/dist/Chart/ScatterChart.js +1 -1
- package/dist/Chart/index.cjs +1 -1
- package/dist/Chart/index.js +1 -1
- package/dist/DataDisplay/VirtualList.cjs +2 -0
- package/dist/DataDisplay/VirtualList.css +1 -0
- package/dist/DataDisplay/VirtualList.d.cts +5 -0
- package/dist/DataDisplay/VirtualList.d.ts +5 -0
- package/dist/DataDisplay/VirtualList.js +2 -0
- package/dist/DataDisplay/index.cjs +3 -2
- package/dist/DataDisplay/index.css +1 -0
- package/dist/DataDisplay/index.d.cts +5 -0
- package/dist/DataDisplay/index.d.ts +5 -0
- package/dist/DataDisplay/index.js +3 -2
- package/dist/Extras/FileExplorer.cjs +2 -2
- package/dist/Extras/FileExplorer.js +2 -2
- package/dist/Extras/LoginPanel.cjs +1 -0
- package/dist/Extras/LoginPanel.css +1 -0
- package/dist/Extras/LoginPanel.d.cts +3 -0
- package/dist/Extras/LoginPanel.d.ts +3 -0
- package/dist/Extras/LoginPanel.js +1 -0
- package/dist/Extras/RichTextEditor.cjs +45 -0
- package/dist/Extras/RichTextEditor.css +1 -0
- package/dist/Extras/RichTextEditor.d.cts +10 -0
- package/dist/Extras/RichTextEditor.d.ts +10 -0
- package/dist/Extras/RichTextEditor.js +45 -0
- package/dist/Extras/TypewriterText.cjs +2 -1
- package/dist/Extras/TypewriterText.css +1 -1
- package/dist/Extras/TypewriterText.js +2 -1
- package/dist/Extras/index.cjs +48 -4
- package/dist/Extras/index.css +1 -1
- package/dist/Extras/index.d.cts +7 -0
- package/dist/Extras/index.d.ts +7 -0
- package/dist/Extras/index.js +48 -4
- package/dist/Forms/Form.cjs +1 -1
- package/dist/Forms/Form.js +1 -1
- package/dist/Forms/OTPInput.cjs +1 -0
- package/dist/Forms/OTPInput.css +1 -0
- package/dist/Forms/OTPInput.d.cts +4 -0
- package/dist/Forms/OTPInput.d.ts +4 -0
- package/dist/Forms/OTPInput.js +1 -0
- package/dist/Forms/Select.cjs +1 -1
- package/dist/Forms/Select.js +1 -1
- package/dist/Forms/index.cjs +1 -1
- package/dist/Forms/index.css +1 -0
- package/dist/Forms/index.d.cts +4 -0
- package/dist/Forms/index.d.ts +4 -0
- package/dist/Forms/index.js +1 -1
- package/dist/Layout/SplitPanel.cjs +1 -0
- package/dist/Layout/SplitPanel.d.cts +3 -0
- package/dist/Layout/SplitPanel.d.ts +3 -0
- package/dist/Layout/SplitPanel.js +1 -0
- package/dist/Layout/index.cjs +1 -1
- package/dist/Layout/index.d.cts +3 -0
- package/dist/Layout/index.d.ts +3 -0
- package/dist/Layout/index.js +1 -1
- package/dist/Navigation/Header.cjs +1 -1
- package/dist/Navigation/Header.js +1 -1
- package/dist/Navigation/RibbonBar.d.cts +3 -3
- package/dist/Navigation/RibbonBar.d.ts +3 -3
- package/dist/Navigation/index.cjs +2 -2
- package/dist/Navigation/index.d.cts +3 -3
- package/dist/Navigation/index.d.ts +3 -3
- package/dist/Navigation/index.js +2 -2
- package/dist/Primitives/Avatar.cjs +1 -1
- package/dist/Primitives/Avatar.js +1 -1
- package/dist/Primitives/Badge.cjs +1 -1
- package/dist/Primitives/Badge.js +1 -1
- package/dist/Primitives/Button.cjs +1 -1
- package/dist/Primitives/Button.js +1 -1
- package/dist/Primitives/Checkbox.cjs +1 -1
- package/dist/Primitives/Checkbox.js +1 -1
- package/dist/Primitives/Dropdown.cjs +1 -1
- package/dist/Primitives/Dropdown.js +1 -1
- package/dist/Primitives/DropdownButton.cjs +1 -1
- package/dist/Primitives/DropdownButton.js +1 -1
- package/dist/Primitives/Indicator.cjs +1 -1
- package/dist/Primitives/Indicator.js +1 -1
- package/dist/Primitives/Input.cjs +1 -1
- package/dist/Primitives/Input.js +1 -1
- package/dist/Primitives/Kbd.cjs +1 -0
- package/dist/Primitives/Kbd.css +0 -0
- package/dist/Primitives/Kbd.d.cts +6 -0
- package/dist/Primitives/Kbd.d.ts +6 -0
- package/dist/Primitives/Kbd.js +1 -0
- package/dist/Primitives/Label.cjs +1 -1
- package/dist/Primitives/Label.js +1 -1
- package/dist/Primitives/Radio.cjs +1 -1
- package/dist/Primitives/Radio.js +1 -1
- package/dist/Primitives/Rating.cjs +2 -0
- package/dist/Primitives/Rating.css +0 -0
- package/dist/Primitives/Rating.d.cts +4 -0
- package/dist/Primitives/Rating.d.ts +4 -0
- package/dist/Primitives/Rating.js +2 -0
- package/dist/Primitives/Slider.cjs +1 -1
- package/dist/Primitives/Slider.js +1 -1
- package/dist/Primitives/Switch.cjs +1 -1
- package/dist/Primitives/Switch.js +1 -1
- package/dist/Primitives/Tag.cjs +1 -1
- package/dist/Primitives/Tag.js +1 -1
- package/dist/Primitives/index.cjs +2 -1
- package/dist/Primitives/index.d.cts +10 -0
- package/dist/Primitives/index.d.ts +10 -0
- package/dist/Primitives/index.js +2 -1
- package/dist/_tsup-dts-rollup.d.cts +843 -1
- package/dist/_tsup-dts-rollup.d.ts +843 -1
- package/dist/index.cjs +49 -5
- package/dist/index.css +1 -1
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +49 -5
- package/dist/styles/DataDisplay/VirtualList.css +35 -0
- package/dist/styles/Extras/CinePlayer.css +63 -1
- package/dist/styles/Extras/FileExplorer.css +39 -1
- package/dist/styles/Extras/FilmReel.css +24 -1
- package/dist/styles/Extras/LoginPanel.css +16 -0
- package/dist/styles/Extras/MiniPlayer.css +84 -1
- package/dist/styles/Extras/RichTextEditor.css +908 -0
- package/dist/styles/Extras/TypewriterText.css +254 -0
- package/dist/styles/Forms/OTPInput.css +11 -0
- package/dist/styles/Layout/SplitPanel.css +15 -0
- package/dist/styles/Primitives/DropdownButton.css +26 -1
- package/dist/styles/Primitives/Kbd.css +1 -0
- package/dist/styles/Primitives/Rating.css +1 -0
- package/dist/styles/base.css +281 -0
- package/dist/styles.css +281 -0
- package/dist/theme.cjs +1 -1
- package/dist/theme.d.cts +3 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -1
- package/package.json +22 -1
package/dist/Extras/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var Pr=require('react'),reactDom=require('react-dom'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),lucideReact=require('lucide-react'),jsxRuntime=require('react/jsx-runtime'),classVarianceAuthority=require('class-variance-authority');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Pr__default=/*#__PURE__*/_interopDefault(Pr);function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var br="#1c1914",hr="#130f0b",In="#2e261e",Yt="#504638",ot="#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")`,_n=[{key:"like",icon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsxRuntime.jsx(lucideReact.ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsxRuntime.jsx(lucideReact.Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsxRuntime.jsx(lucideReact.Download,{className:"h-5 w-5"}),label:"Download"}];function jt({photos:e,layout:t="strip",actions:r=_n,onAction:a,className:l,showGrain:o=true,sheetTitle:n,sheetLabel:f}){let[m,d]=Pr.useState(null),[v,b]=Pr.useState(new Set),i=Pr.useCallback(L=>d(L),[]),p=Pr.useCallback(()=>d(null),[]),P=Pr.useCallback((L,T)=>{if(r.find(F=>F.key===L)?.toggle){let F=`${T}-${L}`;b(H=>{let j=new Set(H);return j.has(F)?j.delete(F):j.add(F),j});}a?.(L,e[T],T);},[r,a,e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(t==="strip"?On:t==="sheet"?Fn:Hn,{photos:e,onPhotoClick:i,showGrain:o,className:l,sheetTitle:n,sheetLabel:f}),m!==null&&reactDom.createPortal(jsxRuntime.jsx(Vn,{photos:e,currentIndex:m,onIndexChange:d,onClose:p,actions:r,activeActions:v,onAction:P,showGrain:o}),document.body)]})}function gr({count:e=30}){return jsxRuntime.jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:br},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:In}},r))})}function On({photos:e,onPhotoClick:t,showGrain:r,className:a}){let l=Pr.useRef(null);return jsxRuntime.jsxs("div",{className:c("select-none rounded-lg overflow-hidden",a),style:{background:hr},children:[jsxRuntime.jsx(gr,{count:Math.max(30,e.length*6)}),jsxRuntime.jsx("div",{ref:l,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:br,scrollSnapType:"x mandatory"},children:e.map((o,n)=>jsxRuntime.jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(n),children:[jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:Yt,width:280,height:187},children:[jsxRuntime.jsx("img",{src:o.src,alt:o.alt??o.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&jsxRuntime.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"}}),jsxRuntime.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%)"}})]}),jsxRuntime.jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:ot},children:[String(n+1).padStart(2,"0"),n%2===0?"":"A"]})]},n))}),jsxRuntime.jsx(gr,{count:Math.max(30,e.length*6)})]})}function Fn({photos:e,onPhotoClick:t,showGrain:r,className:a,sheetTitle:l,sheetLabel:o}){return jsxRuntime.jsxs("div",{className:c("rounded-lg p-5",a),style:{background:hr},children:[jsxRuntime.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:ot},children:l??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:ot},children:o??"Contact Sheet"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((n,f)=>jsxRuntime.jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${f*50}ms both`},onClick:()=>t(f),children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:ot},children:String(f+1).padStart(2,"0")}),jsxRuntime.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:Yt,aspectRatio:"3/2"},children:[jsxRuntime.jsx("img",{src:n.src,alt:n.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Ct}}),jsxRuntime.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:jsxRuntime.jsx("span",{className:"text-xs font-medium text-white/90",children:n.title})})]})]},f))})]})}function Hn({photos:e,onPhotoClick:t,showGrain:r,className:a}){let[l,o]=Pr.useState(false),[n,f]=Pr.useState(null),m=Math.min(e.length,8),d=e.slice(0,m),v=i=>{let p=Math.sin(i*137.508+1)*1e4,P=(p%12-6).toFixed(1),w=(p/7%8-4).toFixed(1),L=(p/13%6-3).toFixed(1);return `rotate(${P}deg) translate(${w}px, ${L}px)`},b=(i,p)=>{let P=(p-1)/2,w=((i-P)*7).toFixed(1),L=((i-P)*110).toFixed(0),T=(-Math.abs(i-P)*10+(n===i?-18:0)).toFixed(0);return `translateX(${L}px) translateY(${T}px) rotate(${w}deg)`};return jsxRuntime.jsxs("div",{className:c("flex flex-col items-center gap-4",a),children:[jsxRuntime.jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>o(true),onMouseLeave:()=>{o(false),f(null);},children:d.map((i,p)=>jsxRuntime.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:l?`${p*35}ms`:`${(m-p)*25}ms`,transform:l?b(p,d.length):v(p),zIndex:l?p+1:d.length-p,width:220,height:147},onClick:()=>t(p),onMouseEnter:()=>l&&f(p),onMouseLeave:()=>f(null),children:jsxRuntime.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:l&&n===p?"rgba(217,171,89,0.5)":Yt,boxShadow:l&&n===p?"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:[jsxRuntime.jsx("img",{src:i.src,alt:i.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Ct}}),jsxRuntime.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%)"}}),l&&n===p&&jsxRuntime.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:jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90",children:i.title})})]})},p))}),e.length>m&&jsxRuntime.jsxs("span",{className:"font-mono text-xs",style:{color:ot},children:["+ ",e.length-m," more"]}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:ot,opacity:l?0:.7},children:"Hover to explore"})]})}function Vn({photos:e,currentIndex:t,onIndexChange:r,onClose:a,actions:l,activeActions:o,onAction:n,showGrain:f}){let m=e[t],[d,v]=Pr.useState(1),[b,i]=Pr.useState({x:0,y:0}),[p,P]=Pr.useState(false),[w,L]=Pr.useState(false),T=Pr.useRef(false),R=Pr.useRef({x:0,y:0}),F=Pr.useRef(null);Pr.useLayoutEffect(()=>{requestAnimationFrame(()=>L(true));},[]),Pr.useEffect(()=>{let u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=u;}},[]),Pr.useEffect(()=>{let u=V=>{switch(V.key){case "Escape":a();break;case "ArrowLeft":H(-1);break;case "ArrowRight":H(1);break;case "i":case "I":P(W=>!W);break}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)}),Pr.useEffect(()=>{let u=F.current;if(!u)return;let V=W=>{W.preventDefault();let ie=W.deltaY<0?1.12:.89;v(G=>{let be=Math.min(8,Math.max(1,G*ie));return be<=1&&i({x:0,y:0}),be});};return u.addEventListener("wheel",V,{passive:false}),()=>u.removeEventListener("wheel",V)},[]);let H=Pr.useCallback(u=>{let V=t+u;V>=0&&V<e.length&&(r(V),v(1),i({x:0,y:0}));},[t,e.length,r]),j=Pr.useCallback(u=>{d<=1||(T.current=true,R.current={x:u.clientX,y:u.clientY},u.target.setPointerCapture(u.pointerId));},[d]),le=Pr.useCallback(u=>{if(!T.current)return;let V=u.clientX-R.current.x,W=u.clientY-R.current.y;R.current={x:u.clientX,y:u.clientY},i(ie=>({x:ie.x+V/d,y:ie.y+W/d}));},[d]),x=Pr.useCallback(()=>{T.current=false;},[]),C=Pr.useCallback(()=>{d>1?(v(1),i({x:0,y:0})):v(2.5);},[d]),S=u=>o.has(`${t}-${u}`),A=m.metadata;return jsxRuntime.jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/95",onClick:a}),f&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Ct,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxRuntime.jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[d.toFixed(1),"x"]}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>v(u=>Math.min(8,u*1.3)),title:"Zoom in",children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{v(u=>{let V=Math.max(1,u*.7);return V<=1&&i({x:0,y:0}),V});},title:"Zoom out",children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:a,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-5 w-5"})})]})]}),jsxRuntime.jsxs("div",{ref:F,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:d>1?"grab":"default"},onPointerDown:j,onPointerMove:le,onPointerUp:x,onDoubleClick:C,children:[jsxRuntime.jsx("img",{src:m.src,alt:m.alt??m.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(${d}) translate(${b.x}px, ${b.y}px)`,transition:T.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsxRuntime.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:u=>{u.stopPropagation(),H(-1);},children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsxRuntime.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:u=>{u.stopPropagation(),H(1);},children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-6 w-6"})})]}),jsxRuntime.jsx("div",{className:c("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",p?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxRuntime.jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[m.title&&jsxRuntime.jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:m.title}),m.description&&jsxRuntime.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:m.description}),A&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[A.camera&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",A.camera,A.lens&&jsxRuntime.jsx("span",{className:"text-white/40",children:"\xB7"}),A.lens&&A.lens]}),(A.aperture||A.shutter||A.iso)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[A.aperture,A.shutter,A.iso&&`ISO ${A.iso}`].filter(Boolean).join(" \xB7 ")]}),A.date&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",A.date]}),A.location&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",A.location]})]})]})}),jsxRuntime.jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[l.map(u=>{let V=u.toggle&&S(u.key);return jsxRuntime.jsx("button",{className:c("rounded-full p-2.5 transition-all duration-200",V?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>n(u.key,t),title:u.label,children:V&&u.activeIcon?u.activeIcon:u.icon},u.key)}),jsxRuntime.jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsxRuntime.jsx("button",{className:c("rounded-full p-2.5 transition-all duration-200",p?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>P(u=>!u),title:"Photo info (I)",children:jsxRuntime.jsx(lucideReact.Info,{className:"h-5 w-5"})})]})})]})}var $t="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var Xr=require('react'),reactDom=require('react-dom'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),lucideReact=require('lucide-react'),jsxRuntime=require('react/jsx-runtime'),classVarianceAuthority=require('class-variance-authority'),marked=require('marked'),react=require('@tiptap/react'),transform=require('@tiptap/pm/transform'),commands=require('@tiptap/pm/commands'),state=require('@tiptap/pm/state'),model=require('@tiptap/pm/model'),schemaList=require('@tiptap/pm/schema-list'),view=require('@tiptap/pm/view');require('@tiptap/pm/keymap');var dp=require('@tiptap/starter-kit'),up=require('@tiptap/extension-underline'),pp=require('@tiptap/extension-text-align'),extensionColor=require('@tiptap/extension-color'),fp=require('@tiptap/extension-highlight'),hp=require('@tiptap/extension-link'),gp=require('@tiptap/extension-youtube'),bp=require('@tiptap/extension-placeholder'),vp=require('@tiptap/extension-character-count'),yp=require('@tiptap/extension-typography'),xp=require('@tiptap/extension-subscript'),wp=require('@tiptap/extension-superscript'),extensionTable=require('@tiptap/extension-table'),Mp=require('@tiptap/extension-table-row'),Np=require('@tiptap/extension-table-header'),Cp=require('@tiptap/extension-table-cell'),ep=require('@tiptap/extension-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Xr__default=/*#__PURE__*/_interopDefault(Xr);var dp__default=/*#__PURE__*/_interopDefault(dp);var up__default=/*#__PURE__*/_interopDefault(up);var pp__default=/*#__PURE__*/_interopDefault(pp);var fp__default=/*#__PURE__*/_interopDefault(fp);var hp__default=/*#__PURE__*/_interopDefault(hp);var gp__default=/*#__PURE__*/_interopDefault(gp);var bp__default=/*#__PURE__*/_interopDefault(bp);var vp__default=/*#__PURE__*/_interopDefault(vp);var yp__default=/*#__PURE__*/_interopDefault(yp);var xp__default=/*#__PURE__*/_interopDefault(xp);var wp__default=/*#__PURE__*/_interopDefault(wp);var Mp__default=/*#__PURE__*/_interopDefault(Mp);var Np__default=/*#__PURE__*/_interopDefault(Np);var Cp__default=/*#__PURE__*/_interopDefault(Cp);var ep__default=/*#__PURE__*/_interopDefault(ep);function v(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var no="#1c1914",oo="#130f0b",Di="#2e261e",Jr="#504638",Ot="#6b5d4d",xr=`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")`,Ai=[{key:"like",icon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsxRuntime.jsx(lucideReact.ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsxRuntime.jsx(lucideReact.Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsxRuntime.jsx(lucideReact.Download,{className:"h-5 w-5"}),label:"Download"}];function Qr({photos:e,layout:t="strip",actions:r=Ai,onAction:n,className:o,showGrain:a=true,sheetTitle:i,sheetLabel:l}){let[s,d]=Xr.useState(null),[m,u]=Xr.useState(new Set),p=Xr.useCallback(g=>d(g),[]),c=Xr.useCallback(()=>d(null),[]),h=Xr.useCallback((g,b)=>{if(r.find(C=>C.key===g)?.toggle){let C=`${b}-${g}`;u(x=>{let M=new Set(x);return M.has(C)?M.delete(C):M.add(C),M});}n?.(g,e[b],b);},[r,n,e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(t==="strip"?zi:t==="sheet"?Li:Ii,{photos:e,onPhotoClick:p,showGrain:a,className:o,sheetTitle:i,sheetLabel:l}),s!==null&&reactDom.createPortal(jsxRuntime.jsx(_i,{photos:e,currentIndex:s,onIndexChange:d,onClose:c,actions:r,activeActions:m,onAction:h,showGrain:a}),document.body)]})}function ro({count:e=30}){return jsxRuntime.jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:no},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:Di}},r))})}function zi({photos:e,onPhotoClick:t,showGrain:r,className:n}){let o=Xr.useRef(null);return jsxRuntime.jsxs("div",{className:v("select-none rounded-lg overflow-hidden",n),style:{background:oo},children:[jsxRuntime.jsx(ro,{count:Math.max(30,e.length*6)}),jsxRuntime.jsx("div",{ref:o,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:no,scrollSnapType:"x mandatory"},children:e.map((a,i)=>jsxRuntime.jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(i),children:[jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:Jr,width:280,height:187},children:[jsxRuntime.jsx("img",{src:a.src,alt:a.alt??a.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:xr,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.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%)"}})]}),jsxRuntime.jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:Ot},children:[String(i+1).padStart(2,"0"),i%2===0?"":"A"]})]},i))}),jsxRuntime.jsx(ro,{count:Math.max(30,e.length*6)})]})}function Li({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:o,sheetLabel:a}){return jsxRuntime.jsxs("div",{className:v("rounded-lg p-5",n),style:{background:oo},children:[jsxRuntime.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Ot},children:o??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Ot},children:a??"Contact Sheet"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((i,l)=>jsxRuntime.jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${l*50}ms both`},onClick:()=>t(l),children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:Ot},children:String(l+1).padStart(2,"0")}),jsxRuntime.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:Jr,aspectRatio:"3/2"},children:[jsxRuntime.jsx("img",{src:i.src,alt:i.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:xr}}),jsxRuntime.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:jsxRuntime.jsx("span",{className:"text-xs font-medium text-white/90",children:i.title})})]})]},l))})]})}function Ii({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[o,a]=Xr.useState(false),[i,l]=Xr.useState(null),s=Math.min(e.length,8),d=e.slice(0,s),m=p=>{let c=Math.sin(p*137.508+1)*1e4,h=(c%12-6).toFixed(1),f=(c/7%8-4).toFixed(1),g=(c/13%6-3).toFixed(1);return `rotate(${h}deg) translate(${f}px, ${g}px)`},u=(p,c)=>{let h=(c-1)/2,f=((p-h)*7).toFixed(1),g=((p-h)*110).toFixed(0),b=(-Math.abs(p-h)*10+(i===p?-18:0)).toFixed(0);return `translateX(${g}px) translateY(${b}px) rotate(${f}deg)`};return jsxRuntime.jsxs("div",{className:v("flex flex-col items-center gap-4",n),children:[jsxRuntime.jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>a(true),onMouseLeave:()=>{a(false),l(null);},children:d.map((p,c)=>jsxRuntime.jsx("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:o?`${c*35}ms`:`${(s-c)*25}ms`,transform:o?u(c,d.length):m(c),zIndex:o?c+1:d.length-c,width:220,height:147},onClick:()=>t(c),onMouseEnter:()=>o&&l(c),onMouseLeave:()=>l(null),children:jsxRuntime.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:o&&i===c?"rgba(217,171,89,0.5)":Jr,boxShadow:o&&i===c?"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:[jsxRuntime.jsx("img",{src:p.src,alt:p.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:xr}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),o&&i===c&&jsxRuntime.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:jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90",children:p.title})})]})},c))}),e.length>s&&jsxRuntime.jsxs("span",{className:"font-mono text-xs",style:{color:Ot},children:["+ ",e.length-s," more"]}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:Ot,opacity:o?0:.7},children:"Hover to explore"})]})}function _i({photos:e,currentIndex:t,onIndexChange:r,onClose:n,actions:o,activeActions:a,onAction:i,showGrain:l}){let s=e[t],[d,m]=Xr.useState(1),[u,p]=Xr.useState({x:0,y:0}),[c,h]=Xr.useState(false),[f,g]=Xr.useState(false),b=Xr.useRef(false),w=Xr.useRef({x:0,y:0}),C=Xr.useRef(null);Xr.useLayoutEffect(()=>{requestAnimationFrame(()=>g(true));},[]),Xr.useEffect(()=>{let y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y;}},[]),Xr.useEffect(()=>{let y=_=>{switch(_.key){case "Escape":n();break;case "ArrowLeft":x(-1);break;case "ArrowRight":x(1);break;case "i":case "I":h(B=>!B);break}};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)}),Xr.useEffect(()=>{let y=C.current;if(!y)return;let _=B=>{B.preventDefault();let R=B.deltaY<0?1.12:.89;m(K=>{let ie=Math.min(8,Math.max(1,K*R));return ie<=1&&p({x:0,y:0}),ie});};return y.addEventListener("wheel",_,{passive:false}),()=>y.removeEventListener("wheel",_)},[]);let x=Xr.useCallback(y=>{let _=t+y;_>=0&&_<e.length&&(r(_),m(1),p({x:0,y:0}));},[t,e.length,r]),M=Xr.useCallback(y=>{d<=1||(b.current=true,w.current={x:y.clientX,y:y.clientY},y.target.setPointerCapture(y.pointerId));},[d]),$=Xr.useCallback(y=>{if(!b.current)return;let _=y.clientX-w.current.x,B=y.clientY-w.current.y;w.current={x:y.clientX,y:y.clientY},p(R=>({x:R.x+_/d,y:R.y+B/d}));},[d]),P=Xr.useCallback(()=>{b.current=false;},[]),L=Xr.useCallback(()=>{d>1?(m(1),p({x:0,y:0})):m(2.5);},[d]),H=y=>a.has(`${t}-${y}`),D=s.metadata;return jsxRuntime.jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/95",onClick:n}),l&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:xr,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxRuntime.jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[d.toFixed(1),"x"]}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>m(y=>Math.min(8,y*1.3)),title:"Zoom in",children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{m(y=>{let _=Math.max(1,y*.7);return _<=1&&p({x:0,y:0}),_});},title:"Zoom out",children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:n,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-5 w-5"})})]})]}),jsxRuntime.jsxs("div",{ref:C,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:d>1?"grab":"default"},onPointerDown:M,onPointerMove:$,onPointerUp:P,onDoubleClick:L,children:[jsxRuntime.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(${d}) translate(${u.x}px, ${u.y}px)`,transition:b.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsxRuntime.jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),x(-1);},children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsxRuntime.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),x(1);},children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-6 w-6"})})]}),jsxRuntime.jsx("div",{className:v("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",c?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxRuntime.jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[s.title&&jsxRuntime.jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:s.title}),s.description&&jsxRuntime.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}),D&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[D.camera&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",D.camera,D.lens&&jsxRuntime.jsx("span",{className:"text-white/40",children:"\xB7"}),D.lens&&D.lens]}),(D.aperture||D.shutter||D.iso)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[D.aperture,D.shutter,D.iso&&`ISO ${D.iso}`].filter(Boolean).join(" \xB7 ")]}),D.date&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",D.date]}),D.location&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",D.location]})]})]})}),jsxRuntime.jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[o.map(y=>{let _=y.toggle&&H(y.key);return jsxRuntime.jsx("button",{className:v("rounded-full p-2.5 transition-all duration-200",_?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>i(y.key,t),title:y.label,children:_&&y.activeIcon?y.activeIcon:y.icon},y.key)}),jsxRuntime.jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsxRuntime.jsx("button",{className:v("rounded-full p-2.5 transition-all duration-200",c?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>h(y=>!y),title:"Photo info (I)",children:jsxRuntime.jsx(lucideReact.Info,{className:"h-5 w-5"})})]})})]})}var Zr="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 xr(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return `${t}:${r.toString().padStart(2,"0")}`}function Jn(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var ea={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},ta={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},ra={"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 Bt({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:a,theme:l,docked:o=false,visible:n,onVisibleChange:f,onTrackChange:m,onLike:d,autoPlay:v=true,shuffle:b=false,loop:i=false,accent:p="#8b5cf6",className:P}){let [w,L]=Pr.useState(t),[T,R]=Pr.useState(false),[F,H]=Pr.useState(0),[j,le]=Pr.useState(0),[x,C]=Pr.useState(.8),[S,A]=Pr.useState(false),[u,V]=Pr.useState(new Set),[W,ie]=Pr.useState(false),[G,be]=Pr.useState(n??!o),[U,ue]=Pr.useState(false),[Pe,ye]=Pr.useState(false),[X,he]=Pr.useState(b),[ce,Te]=Pr.useState(i),Re=Pr.useRef(false),E=Pr.useRef(null),J=Pr.useRef(null),ee=Pr.useRef(void 0),B=Pr.useRef(null),ne=Pr.useRef(null),we=n??G,Se=a??Jn(r),Y=e[w],ae=o,ve=l==="dark"?"dark":l==="light"?"light":"",I="bg-(--mp-bg)",te="text-(--mp-text)",me="text-(--mp-text-muted)",Fe="text-(--accent)",de="border-(--mp-border)";Pr.useEffect(()=>{let h=E.current;h&&(h.src=Y.src,h.load(),T&&h.play().catch(()=>{}));},[w,Y.src]),Pr.useEffect(()=>{if(!v||Re.current)return;let h=E.current;if(!h)return;let K=()=>{Re.current=true,R(true),h.play().catch(()=>{});};return h.addEventListener("canplaythrough",K,{once:true}),()=>h.removeEventListener("canplaythrough",K)},[v]),Pr.useEffect(()=>{let h=E.current;h&&(T?h.play().catch(()=>{}):h.pause());},[T]),Pr.useEffect(()=>{let h=E.current;h&&(h.muted=S,ne.current?ne.current.gain.value=S?0:x:h.volume=x);},[x,S]),Pr.useEffect(()=>{let h=E.current;if(!h)return;let K=()=>H(h.currentTime),pe=()=>le(h.duration),_e=()=>{ce?(h.currentTime=0,h.play().catch(()=>{})):He();};return h.addEventListener("timeupdate",K),h.addEventListener("loadedmetadata",pe),h.addEventListener("ended",_e),()=>{h.removeEventListener("timeupdate",K),h.removeEventListener("loadedmetadata",pe),h.removeEventListener("ended",_e);}},[w,e.length]);let $=Pr.useCallback(h=>{let K=(h%e.length+e.length)%e.length;L(K),H(0),m?.(K,e[K]),we||(be(true),f?.(true));},[e,we,m,f]),He=Pr.useCallback(()=>{if(X){let h;do h=Math.floor(Math.random()*e.length);while(h===w&&e.length>1);$(h);}else $(w+1);},[$,w,X,e.length]),tt=Pr.useCallback(()=>{if(X){let h;do h=Math.floor(Math.random()*e.length);while(h===w&&e.length>1);$(h);}else $(w-1);},[$,w,X,e.length]),rt=Pr.useCallback(()=>{let h=u.has(w);V(K=>{let pe=new Set(K);return h?pe.delete(w):pe.add(w),pe}),d?.(w,Y,!h);},[w,u,d,Y]),bt=Pr.useCallback(h=>{let K=h.currentTarget.getBoundingClientRect(),_e=Math.max(0,Math.min(1,(h.clientX-K.left)/K.width))*j;E.current&&(E.current.currentTime=_e),H(_e);},[j]),ke=Pr.useCallback(()=>{ue(true);let h=ae?200:400;ee.current=setTimeout(()=>{ue(false),be(false),f?.(false);},h);},[ae,f]);Pr.useEffect(()=>()=>{ee.current&&clearTimeout(ee.current);},[]),Pr.useEffect(()=>()=>{B.current?.close();},[]);function Ee(){if(B.current||!E.current){B.current?.resume();return}try{let h=window.AudioContext??window.webkitAudioContext;if(!h)return;let K=new h,pe=K.createGain();pe.gain.value=S?0:x,K.createMediaElementSource(E.current).connect(pe).connect(K.destination),B.current=K,ne.current=pe,K.resume();}catch{}}let g=Pe?"fade-in 0.2s ease-out both":`mp-enter-${Se} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,z=Pe?"fade-in 0.2s ease-in reverse both":`mp-exit-${Se} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,re=j>0?F/j*100:0;return ae&&!we&&!U?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:E,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsxs("div",{className:c("fixed z-100 cursor-pointer transition-all duration-300",ra[r]),style:{"--accent":p},onMouseEnter:()=>{ye(true),be(true),f?.(true);},children:[jsxRuntime.jsx("div",{className:c("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&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!we&&!U?jsxRuntime.jsx("audio",{ref:E,preload:"metadata",crossOrigin:"anonymous"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:E,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsx("div",{className:c("fixed z-100",ae?ta[r]:ea[r],ve),style:{"--accent":p,...U?{animation:z}:{animation:g}},onMouseEnter:()=>{ae&&(ee.current&&(clearTimeout(ee.current),ee.current=void 0),U&&ue(false),ye(true));},onMouseLeave:()=>{ae&&(ye(false),ke());},children:jsxRuntime.jsxs("div",{className:c("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",I,de,ae&&"rounded-none",r.endsWith("right")&&ae&&"rounded-l-2xl",r.endsWith("left")&&ae&&"rounded-r-2xl",P),children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsxRuntime.jsx("img",{src:Y.cover||$t,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxRuntime.jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxRuntime.jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxRuntime.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:[jsxRuntime.jsx("img",{src:Y.cover||$t,alt:Y.album??Y.title,className:"h-full w-full object-cover",draggable:false}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),T&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:c("truncate text-sm font-semibold",te),children:Y.title}),Y.artist&&jsxRuntime.jsx("div",{className:c("truncate text-xs",me),children:Y.artist}),Y.album&&jsxRuntime.jsx("div",{className:c("mt-0.5 truncate text-[10px] tracking-wide",me,"opacity-60"),children:Y.album})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:c("rounded-full p-1.5 transition-all duration-200",u.has(w)?"text-rose-500 hover:text-rose-400":c(me,"hover:text-rose-500")),onClick:rt,title:"Like",children:jsxRuntime.jsx(lucideReact.Heart,{className:"h-4 w-4",fill:u.has(w)?"currentColor":"none"})}),jsxRuntime.jsx("button",{className:c("rounded-full p-1.5 transition-colors",me,"hover:"+te.split(" ")[0]),onClick:()=>ie(h=>!h),title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListMusic,{className:"h-4 w-4"})}),!ae&&jsxRuntime.jsx("button",{className:c("rounded-full p-1.5 transition-colors",me,"hover:"+te.split(" ")[0]),onClick:ke,title:"Dismiss",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxRuntime.jsxs("div",{className:"px-4",children:[jsxRuntime.jsxs("div",{ref:J,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:bt,children:[jsxRuntime.jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${re}%`}}),jsxRuntime.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(${re}% - 6px)`}})]}),jsxRuntime.jsxs("div",{className:c("mt-1 flex justify-between text-[10px] font-mono",me),children:[jsxRuntime.jsx("span",{children:xr(F)}),jsxRuntime.jsx("span",{children:xr(j)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsxRuntime.jsx("button",{className:c("rounded-full p-1.5 transition-colors",X?Fe:me,"hover:text-(--mp-text)"),onClick:()=>he(h=>!h),title:X?"Shuffle On":"Shuffle Off",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:c("rounded-full p-1.5 transition-colors",ce?Fe:me,"hover:text-(--mp-text)"),onClick:()=>Te(h=>!h),title:ce?"Loop On":"Loop Off",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:c("rounded-full p-2 transition-colors",me,"hover:text-(--mp-text)"),onClick:tt,title:"Previous",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:c("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:()=>{Ee(),R(h=>!h);},title:T?"Pause":"Play",children:T?jsxRuntime.jsx(lucideReact.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:c("rounded-full p-2 transition-colors",me,"hover:text-(--mp-text)"),onClick:He,title:"Next",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsxRuntime.jsx("button",{className:c("rounded-full p-1 transition-colors",me,"hover:text-(--mp-text)"),onClick:()=>{Ee();let h=!S;A(h),ne.current&&(ne.current.gain.value=h?0:x);},title:S?"Unmute":"Mute",children:S||x===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:S?0:x,onChange:h=>{Ee();let K=Number(h.target.value);C(K),S&&A(false),ne.current&&(ne.current.gain.value=K);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsxRuntime.jsx("div",{className:c("overflow-hidden transition-all duration-300 ease-in-out",W?"max-h-60":"max-h-0"),children:jsxRuntime.jsx("div",{className:c("border-t px-2 py-2",de),children:jsxRuntime.jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((h,K)=>{let pe=K===w;return jsxRuntime.jsxs("button",{className:c("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",pe?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{$(K),R(true);},children:[jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:pe&&T?jsxRuntime.jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(_e=>jsxRuntime.jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+_e*4}px`,animation:`mp-eq-bar ${.4+_e*.15}s ease-in-out infinite alternate`}},_e))}):pe?jsxRuntime.jsx(lucideReact.Disc3,{className:c("h-4 w-4",Fe)}):jsxRuntime.jsx("span",{className:c("text-xs font-mono",me),children:K+1})}),jsxRuntime.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsxRuntime.jsx("img",{src:h.cover||$t,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:c("truncate text-xs font-medium",pe?Fe:te),children:h.title}),h.artist&&jsxRuntime.jsx("div",{className:c("truncate text-[10px]",me),children:h.artist})]}),u.has(K)&&jsxRuntime.jsx(lucideReact.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},K)})})})})]})})]})}function Dt(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}var va={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function Kt({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:a=false,loop:l=false,onTrackChange:o,onPlayChange:n,accent:f="#8b5cf6",className:m}){let[d,v]=Pr.useState(t),[b,i]=Pr.useState(false),[p,P]=Pr.useState(0),[w,L]=Pr.useState(0),[T,R]=Pr.useState(0),[F,H]=Pr.useState(.8),[j,le]=Pr.useState(false),[x,C]=Pr.useState(a),[S,A]=Pr.useState(l),[u,V]=Pr.useState(false),[W,ie]=Pr.useState("title"),[G,be]=Pr.useState(true),[U,ue]=Pr.useState(false),[Pe,ye]=Pr.useState(false),[X,he]=Pr.useState(false),[ce,Te]=Pr.useState(true),[Re,E]=Pr.useState(false),[J,ee]=Pr.useState(null),B=Pr.useRef(null),ne=Pr.useRef(null),we=Pr.useRef(void 0),Se=Pr.useRef(false),Y=e[d],Ye=Pr__default.default.useMemo(()=>{let g=e.map((z,re)=>({media:z,originalIndex:re}));return g.sort((z,re)=>{let h=va[W](z.media,re.media);return G?h:-h}),g},[e,W,G]);Pr.useEffect(()=>{let g=B.current;if(!g)return;E(true),g.src=Y.src,Y.poster&&(g.poster=Y.poster),g.load();let z=()=>{E(false),b&&g.play().catch(()=>{});};return g.addEventListener("loadeddata",z,{once:true}),()=>g.removeEventListener("loadeddata",z)},[d,Y.src]),Pr.useEffect(()=>{if(!r||Se.current)return;let g=B.current;if(!g)return;let z=()=>{Se.current=true,i(true),g.play().catch(()=>{});};return g.addEventListener("canplaythrough",z,{once:true}),()=>g.removeEventListener("canplaythrough",z)},[r]),Pr.useEffect(()=>{let g=B.current;g&&(b?g.play().catch(()=>{}):g.pause(),n?.(b));},[b]),Pr.useEffect(()=>{let g=B.current;g&&(g.volume=j?0:F);},[F,j]),Pr.useEffect(()=>{let g=B.current;if(!g)return;let z=()=>P(g.currentTime),re=()=>L(g.duration),h=()=>{g.buffered.length>0&&R(g.buffered.end(g.buffered.length-1));},K=()=>{S?(g.currentTime=0,g.play().catch(()=>{})):I();};return g.addEventListener("timeupdate",z),g.addEventListener("loadedmetadata",re),g.addEventListener("progress",h),g.addEventListener("ended",K),()=>{g.removeEventListener("timeupdate",z),g.removeEventListener("loadedmetadata",re),g.removeEventListener("progress",h),g.removeEventListener("ended",K);}},[d,e.length,S]);let ae=Pr.useCallback(()=>{Te(true),we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{b&&Te(false);},3e3);},[b]);Pr.useEffect(()=>{b?ae():(Te(true),we.current&&clearTimeout(we.current));},[b,ae]),Pr.useEffect(()=>()=>{we.current&&clearTimeout(we.current);},[]);let ve=Pr.useCallback(g=>{let z=(g%e.length+e.length)%e.length;v(z),P(0),i(true),o?.(z,e[z]);},[e,o]),I=Pr.useCallback(()=>{if(x){let g;do g=Math.floor(Math.random()*e.length);while(g===d&&e.length>1);ve(g);}else ve(d+1);},[ve,d,x,e.length]),te=Pr.useCallback(()=>{if(x){let g;do g=Math.floor(Math.random()*e.length);while(g===d&&e.length>1);ve(g);}else ve(d-1);},[ve,d,x,e.length]),me=Pr.useCallback(g=>{let z=g.currentTarget.getBoundingClientRect(),h=Math.max(0,Math.min(1,(g.clientX-z.left)/z.width))*w;B.current&&(B.current.currentTime=h),P(h);},[w]),Fe=Pr.useCallback(g=>{let z=g.currentTarget.getBoundingClientRect(),re=Math.max(0,Math.min(1,(g.clientX-z.left)/z.width));ee(re*w);},[w]),de=Pr.useCallback(()=>{ne.current&&(document.fullscreenElement?document.exitFullscreen():ne.current.requestFullscreen());},[]);Pr.useEffect(()=>{let g=()=>he(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",g),()=>document.removeEventListener("fullscreenchange",g)},[]);let $=Pr.useCallback(()=>{U?(ye(true),setTimeout(()=>{ue(false),ye(false);},500)):ue(true);},[U]),He=Pr.useCallback(()=>{V(g=>!g);},[]),tt=Pr.useCallback(()=>{let g=["title","type","duration"],z=g.indexOf(W);G?be(false):(be(true),ie(g[(z+1)%g.length]));},[W,G]);Pr.useEffect(()=>{let g=z=>{if(!(z.target instanceof HTMLInputElement||z.target instanceof HTMLTextAreaElement))switch(z.key){case " ":case "k":z.preventDefault(),i(re=>!re);break;case "f":z.preventDefault(),de();break;case "t":z.preventDefault(),$();break;case "ArrowLeft":z.preventDefault(),B.current&&(B.current.currentTime=Math.max(0,p-5));break;case "ArrowRight":z.preventDefault(),B.current&&(B.current.currentTime=Math.min(w,p+5));break;case "ArrowUp":z.preventDefault(),H(re=>Math.min(1,re+.05));break;case "ArrowDown":z.preventDefault(),H(re=>Math.max(0,re-.05));break;case "Escape":U&&$();break;case "n":z.preventDefault(),I();break;case "p":z.preventDefault(),te();break;case "l":z.preventDefault(),He();break}};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[de,$,He,I,te,p,w,U]);let rt=w>0?p/w*100:0,bt=w>0?T/w*100:0,ke="text-(--accent)",Ee=jsxRuntime.jsxs("div",{ref:ne,className:c("group flex overflow-hidden",X?"h-full w-full":"aspect-video w-full",!X&&"rounded-xl",!X&&b&&"shadow-2xl",!X&&!b&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",m),style:{"--accent":f,background:"var(--cp-bg)"},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:c("relative flex-1 min-w-0 h-full overflow-hidden",Re&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:ae,onMouseLeave:()=>{b&&Te(false);},children:[jsxRuntime.jsx("video",{ref:B,className:"h-full w-full object-contain",poster:Y.poster,playsInline:true,preload:"metadata",onClick:()=>i(g=>!g)}),!b&&!Re&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>i(true),children:jsxRuntime.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:jsxRuntime.jsx(lucideReact.Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),Re&&!ce&&jsxRuntime.jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxRuntime.jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:Y.title}),Y.subtitle&&jsxRuntime.jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:Y.subtitle})]})}),jsxRuntime.jsx("div",{className:c("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",ce?"opacity-100":"pointer-events-none opacity-0"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:Y.title}),Y.subtitle&&jsxRuntime.jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:Y.subtitle})]}),Y.type&&jsxRuntime.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:Y.type})]})}),jsxRuntime.jsxs("div",{className:c("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",ce?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxRuntime.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:me,onMouseMove:Fe,onMouseLeave:()=>ee(null),children:[jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${bt}%`,background:"var(--cp-seek-buffer)"}}),jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${rt}%`}}),J!==null&&jsxRuntime.jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${J/w*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:Dt(J)}),jsxRuntime.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(${rt}% - 7px)`}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>i(g=>!g),title:b?"Pause (k)":"Play (k)",children:b?jsxRuntime.jsx(lucideReact.Pause,{className:"h-5 w-5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:te,title:"Previous (p)",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:I,title:"Next (n)",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>le(g=>!g),title:j?"Unmute":"Mute",children:j||F===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:j?0:F,onChange:g=>{H(Number(g.target.value)),j&&le(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxRuntime.jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[Dt(p)," / ",Dt(w)]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:c("cp-btn",x&&ke),onClick:()=>C(g=>!g),title:"Shuffle",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:c("cp-btn",S&&ke),onClick:()=>A(g=>!g),title:"Loop",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:c("cp-btn",u&&ke),onClick:He,title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListVideo,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:c("cp-btn",U&&ke),onClick:$,title:"Cinema mode (t)",children:jsxRuntime.jsx(lucideReact.Theater,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:de,title:"Fullscreen (f)",children:X?jsxRuntime.jsx(lucideReact.Minimize,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Maximize,{className:"h-4 w-4"})})]})]})]}),jsxRuntime.jsx("div",{className:c("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",u?"w-72":"w-0"),children:jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.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:tt,title:`Sort: ${W} ${G?"\u2191":"\u2193"}`,children:[jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"h-3 w-3"}),W,G?" \u2191":" \u2193"]}),jsxRuntime.jsx("button",{className:"cp-btn p-1!",onClick:He,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:Ye.map(({media:g,originalIndex:z})=>{let re=z===d;return jsxRuntime.jsxs("button",{className:c("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",re?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:re?void 0:{color:"var(--cp-text)"},onClick:()=>{ve(z);},children:[jsxRuntime.jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[g.poster?jsxRuntime.jsx("img",{src:g.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsxRuntime.jsx(lucideReact.Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),re&&b&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsxRuntime.jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(h=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+h*3}px`,animation:`mp-eq-bar ${.3+h*.12}s ease-in-out infinite alternate`}},h))})})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:"truncate text-xs font-medium",children:g.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[g.type&&jsxRuntime.jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:g.type}),g.duration!=null&&jsxRuntime.jsx("span",{className:"font-mono text-[10px] opacity-40",children:Dt(g.duration)})]})]}),re&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},z)})})]})}),jsxRuntime.jsx("style",{children:`
|
|
6
|
+
</svg>`);function io(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return `${t}:${r.toString().padStart(2,"0")}`}function Xi(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var Gi={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Ji={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Qi={"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 en({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:n,theme:o,docked:a=false,visible:i,onVisibleChange:l,onTrackChange:s,onLike:d,autoPlay:m=true,shuffle:u=false,loop:p=false,accent:c="#8b5cf6",className:h}){let [f,g]=Xr.useState(t),[b,w]=Xr.useState(false),[C,x]=Xr.useState(0),[M,$]=Xr.useState(0),[P,L]=Xr.useState(.8),[H,D]=Xr.useState(false),[y,_]=Xr.useState(new Set),[B,R]=Xr.useState(false),[K,ie]=Xr.useState(i??!a),[T,ye]=Xr.useState(false),[he,Ne]=Xr.useState(false),[ne,Te]=Xr.useState(u),[Y,Ee]=Xr.useState(p),We=Xr.useRef(false),O=Xr.useRef(null),ae=Xr.useRef(null),ce=Xr.useRef(void 0),te=Xr.useRef(null),be=Xr.useRef(null),Se=i??K,De=n??Xi(r),J=e[f],de=a,Pe=o==="dark"?"dark":o==="light"?"light":"",G="bg-(--mp-bg)",ge="text-(--mp-text)",ke="text-(--mp-text-muted)",Ze="text-(--accent)",xe="border-(--mp-border)";Xr.useEffect(()=>{let z=O.current;z&&(z.src=J.src,z.load(),b&&z.play().catch(()=>{}));},[f,J.src]),Xr.useEffect(()=>{if(!m||We.current)return;let z=O.current;if(!z)return;let oe=()=>{We.current=true,w(true),z.play().catch(()=>{});};return z.addEventListener("canplaythrough",oe,{once:true}),()=>z.removeEventListener("canplaythrough",oe)},[m]),Xr.useEffect(()=>{let z=O.current;z&&(b?z.play().catch(()=>{}):z.pause());},[b]),Xr.useEffect(()=>{let z=O.current;z&&(z.muted=H,be.current?be.current.gain.value=H?0:P:z.volume=P);},[P,H]),Xr.useEffect(()=>{let z=O.current;if(!z)return;let oe=()=>x(z.currentTime),Re=()=>$(z.duration),et=()=>{Y?(z.currentTime=0,z.play().catch(()=>{})):Ye();};return z.addEventListener("timeupdate",oe),z.addEventListener("loadedmetadata",Re),z.addEventListener("ended",et),()=>{z.removeEventListener("timeupdate",oe),z.removeEventListener("loadedmetadata",Re),z.removeEventListener("ended",et);}},[f,e.length]);let re=Xr.useCallback(z=>{let oe=(z%e.length+e.length)%e.length;g(oe),x(0),s?.(oe,e[oe]),Se||(ie(true),l?.(true));},[e,Se,s,l]),Ye=Xr.useCallback(()=>{if(ne){let z;do z=Math.floor(Math.random()*e.length);while(z===f&&e.length>1);re(z);}else re(f+1);},[re,f,ne,e.length]),ct=Xr.useCallback(()=>{if(ne){let z;do z=Math.floor(Math.random()*e.length);while(z===f&&e.length>1);re(z);}else re(f-1);},[re,f,ne,e.length]),st=Xr.useCallback(()=>{let z=y.has(f);_(oe=>{let Re=new Set(oe);return z?Re.delete(f):Re.add(f),Re}),d?.(f,J,!z);},[f,y,d,J]),St=Xr.useCallback(z=>{let oe=z.currentTarget.getBoundingClientRect(),et=Math.max(0,Math.min(1,(z.clientX-oe.left)/oe.width))*M;O.current&&(O.current.currentTime=et),x(et);},[M]),Ae=Xr.useCallback(()=>{ye(true);let z=de?200:400;ce.current=setTimeout(()=>{ye(false),ie(false),l?.(false);},z);},[de,l]);Xr.useEffect(()=>()=>{ce.current&&clearTimeout(ce.current);},[]),Xr.useEffect(()=>()=>{te.current?.close();},[]);function _e(){if(te.current||!O.current){te.current?.resume();return}try{let z=window.AudioContext??window.webkitAudioContext;if(!z)return;let oe=new z,Re=oe.createGain();Re.gain.value=H?0:P,oe.createMediaElementSource(O.current).connect(Re).connect(oe.destination),te.current=oe,be.current=Re,oe.resume();}catch{}}let E=he?"fade-in 0.2s ease-out both":`mp-enter-${De} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,X=he?"fade-in 0.2s ease-in reverse both":`mp-exit-${De} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,ue=M>0?C/M*100:0;return de&&!Se&&!T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:O,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsxs("div",{className:v("fixed z-100 cursor-pointer transition-all duration-300",Qi[r]),style:{"--accent":c},onMouseEnter:()=>{Ne(true),ie(true),l?.(true);},children:[jsxRuntime.jsx("div",{className:v("h-full w-full rounded-full",b?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:b?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),b&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!Se&&!T?jsxRuntime.jsx("audio",{ref:O,preload:"metadata",crossOrigin:"anonymous"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:O,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsx("div",{className:v("fixed z-100",de?Ji[r]:Gi[r],Pe),style:{"--accent":c,...T?{animation:X}:{animation:E}},onMouseEnter:()=>{de&&(ce.current&&(clearTimeout(ce.current),ce.current=void 0),T&&ye(false),Ne(true));},onMouseLeave:()=>{de&&(Ne(false),Ae());},children:jsxRuntime.jsxs("div",{className:v("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",G,xe,de&&"rounded-none",r.endsWith("right")&&de&&"rounded-l-2xl",r.endsWith("left")&&de&&"rounded-r-2xl",h),children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsxRuntime.jsx("img",{src:J.cover||Zr,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxRuntime.jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxRuntime.jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxRuntime.jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:b?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsxRuntime.jsx("img",{src:J.cover||Zr,alt:J.album??J.title,className:"h-full w-full object-cover",draggable:false}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),b&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:v("truncate text-sm font-semibold",ge),children:J.title}),J.artist&&jsxRuntime.jsx("div",{className:v("truncate text-xs",ke),children:J.artist}),J.album&&jsxRuntime.jsx("div",{className:v("mt-0.5 truncate text-[10px] tracking-wide",ke,"opacity-60"),children:J.album})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:v("rounded-full p-1.5 transition-all duration-200",y.has(f)?"text-rose-500 hover:text-rose-400":v(ke,"hover:text-rose-500")),onClick:st,title:"Like",children:jsxRuntime.jsx(lucideReact.Heart,{className:"h-4 w-4",fill:y.has(f)?"currentColor":"none"})}),jsxRuntime.jsx("button",{className:v("rounded-full p-1.5 transition-colors",ke,"hover:"+ge.split(" ")[0]),onClick:()=>R(z=>!z),title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListMusic,{className:"h-4 w-4"})}),!de&&jsxRuntime.jsx("button",{className:v("rounded-full p-1.5 transition-colors",ke,"hover:"+ge.split(" ")[0]),onClick:Ae,title:"Dismiss",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxRuntime.jsxs("div",{className:"px-4",children:[jsxRuntime.jsxs("div",{ref:ae,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:St,children:[jsxRuntime.jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${ue}%`}}),jsxRuntime.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(${ue}% - 6px)`}})]}),jsxRuntime.jsxs("div",{className:v("mt-1 flex justify-between text-[10px] font-mono",ke),children:[jsxRuntime.jsx("span",{children:io(C)}),jsxRuntime.jsx("span",{children:io(M)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsxRuntime.jsx("button",{className:v("rounded-full p-1.5 transition-colors",ne?Ze:ke,"hover:text-(--mp-text)"),onClick:()=>Te(z=>!z),title:ne?"Shuffle On":"Shuffle Off",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:v("rounded-full p-1.5 transition-colors",Y?Ze:ke,"hover:text-(--mp-text)"),onClick:()=>Ee(z=>!z),title:Y?"Loop On":"Loop Off",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:v("rounded-full p-2 transition-colors",ke,"hover:text-(--mp-text)"),onClick:ct,title:"Previous",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:v("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:()=>{_e(),w(z=>!z);},title:b?"Pause":"Play",children:b?jsxRuntime.jsx(lucideReact.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:v("rounded-full p-2 transition-colors",ke,"hover:text-(--mp-text)"),onClick:Ye,title:"Next",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsxRuntime.jsx("button",{className:v("rounded-full p-1 transition-colors",ke,"hover:text-(--mp-text)"),onClick:()=>{_e();let z=!H;D(z),be.current&&(be.current.gain.value=z?0:P);},title:H?"Unmute":"Mute",children:H||P===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:H?0:P,onChange:z=>{_e();let oe=Number(z.target.value);L(oe),H&&D(false),be.current&&(be.current.gain.value=oe);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsxRuntime.jsx("div",{className:v("overflow-hidden transition-all duration-300 ease-in-out",B?"max-h-60":"max-h-0"),children:jsxRuntime.jsx("div",{className:v("border-t px-2 py-2",xe),children:jsxRuntime.jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((z,oe)=>{let Re=oe===f;return jsxRuntime.jsxs("button",{className:v("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:()=>{re(oe),w(true);},children:[jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:Re&&b?jsxRuntime.jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(et=>jsxRuntime.jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+et*4}px`,animation:`mp-eq-bar ${.4+et*.15}s ease-in-out infinite alternate`}},et))}):Re?jsxRuntime.jsx(lucideReact.Disc3,{className:v("h-4 w-4",Ze)}):jsxRuntime.jsx("span",{className:v("text-xs font-mono",ke),children:oe+1})}),jsxRuntime.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsxRuntime.jsx("img",{src:z.cover||Zr,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:v("truncate text-xs font-medium",Re?Ze:ge),children:z.title}),z.artist&&jsxRuntime.jsx("div",{className:v("truncate text-[10px]",ke),children:z.artist})]}),y.has(oe)&&jsxRuntime.jsx(lucideReact.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},oe)})})})})]})})]})}function kr(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${r}:${n.toString().padStart(2,"0")}`}var fs={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function rn({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:n=false,loop:o=false,onTrackChange:a,onPlayChange:i,accent:l="#8b5cf6",className:s}){let[d,m]=Xr.useState(t),[u,p]=Xr.useState(false),[c,h]=Xr.useState(0),[f,g]=Xr.useState(0),[b,w]=Xr.useState(0),[C,x]=Xr.useState(.8),[M,$]=Xr.useState(false),[P,L]=Xr.useState(n),[H,D]=Xr.useState(o),[y,_]=Xr.useState(false),[B,R]=Xr.useState("title"),[K,ie]=Xr.useState(true),[T,ye]=Xr.useState(false),[he,Ne]=Xr.useState(false),[ne,Te]=Xr.useState(false),[Y,Ee]=Xr.useState(true),[We,O]=Xr.useState(false),[ae,ce]=Xr.useState(null),te=Xr.useRef(null),be=Xr.useRef(null),Se=Xr.useRef(void 0),De=Xr.useRef(false),J=e[d],at=Xr__default.default.useMemo(()=>{let E=e.map((X,ue)=>({media:X,originalIndex:ue}));return E.sort((X,ue)=>{let z=fs[B](X.media,ue.media);return K?z:-z}),E},[e,B,K]);Xr.useEffect(()=>{let E=te.current;if(!E)return;O(true),E.src=J.src,J.poster&&(E.poster=J.poster),E.load();let X=()=>{O(false),u&&E.play().catch(()=>{});};return E.addEventListener("loadeddata",X,{once:true}),()=>E.removeEventListener("loadeddata",X)},[d,J.src]),Xr.useEffect(()=>{if(!r||De.current)return;let E=te.current;if(!E)return;let X=()=>{De.current=true,p(true),E.play().catch(()=>{});};return E.addEventListener("canplaythrough",X,{once:true}),()=>E.removeEventListener("canplaythrough",X)},[r]),Xr.useEffect(()=>{let E=te.current;E&&(u?E.play().catch(()=>{}):E.pause(),i?.(u));},[u]),Xr.useEffect(()=>{let E=te.current;E&&(E.volume=M?0:C);},[C,M]),Xr.useEffect(()=>{let E=te.current;if(!E)return;let X=()=>h(E.currentTime),ue=()=>g(E.duration),z=()=>{E.buffered.length>0&&w(E.buffered.end(E.buffered.length-1));},oe=()=>{H?(E.currentTime=0,E.play().catch(()=>{})):G();};return E.addEventListener("timeupdate",X),E.addEventListener("loadedmetadata",ue),E.addEventListener("progress",z),E.addEventListener("ended",oe),()=>{E.removeEventListener("timeupdate",X),E.removeEventListener("loadedmetadata",ue),E.removeEventListener("progress",z),E.removeEventListener("ended",oe);}},[d,e.length,H]);let de=Xr.useCallback(()=>{Ee(true),Se.current&&clearTimeout(Se.current),Se.current=setTimeout(()=>{u&&Ee(false);},3e3);},[u]);Xr.useEffect(()=>{u?de():(Ee(true),Se.current&&clearTimeout(Se.current));},[u,de]),Xr.useEffect(()=>()=>{Se.current&&clearTimeout(Se.current);},[]);let Pe=Xr.useCallback(E=>{let X=(E%e.length+e.length)%e.length;m(X),h(0),p(true),a?.(X,e[X]);},[e,a]),G=Xr.useCallback(()=>{if(P){let E;do E=Math.floor(Math.random()*e.length);while(E===d&&e.length>1);Pe(E);}else Pe(d+1);},[Pe,d,P,e.length]),ge=Xr.useCallback(()=>{if(P){let E;do E=Math.floor(Math.random()*e.length);while(E===d&&e.length>1);Pe(E);}else Pe(d-1);},[Pe,d,P,e.length]),ke=Xr.useCallback(E=>{let X=E.currentTarget.getBoundingClientRect(),z=Math.max(0,Math.min(1,(E.clientX-X.left)/X.width))*f;te.current&&(te.current.currentTime=z),h(z);},[f]),Ze=Xr.useCallback(E=>{let X=E.currentTarget.getBoundingClientRect(),ue=Math.max(0,Math.min(1,(E.clientX-X.left)/X.width));ce(ue*f);},[f]),xe=Xr.useCallback(()=>{be.current&&(document.fullscreenElement?document.exitFullscreen():be.current.requestFullscreen());},[]);Xr.useEffect(()=>{let E=()=>Te(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",E),()=>document.removeEventListener("fullscreenchange",E)},[]);let re=Xr.useCallback(()=>{T?(Ne(true),setTimeout(()=>{ye(false),Ne(false);},500)):ye(true);},[T]),Ye=Xr.useCallback(()=>{_(E=>!E);},[]),ct=Xr.useCallback(()=>{let E=["title","type","duration"],X=E.indexOf(B);K?ie(false):(ie(true),R(E[(X+1)%E.length]));},[B,K]);Xr.useEffect(()=>{let E=X=>{if(!(X.target instanceof HTMLInputElement||X.target instanceof HTMLTextAreaElement))switch(X.key){case " ":case "k":X.preventDefault(),p(ue=>!ue);break;case "f":X.preventDefault(),xe();break;case "t":X.preventDefault(),re();break;case "ArrowLeft":X.preventDefault(),te.current&&(te.current.currentTime=Math.max(0,c-5));break;case "ArrowRight":X.preventDefault(),te.current&&(te.current.currentTime=Math.min(f,c+5));break;case "ArrowUp":X.preventDefault(),x(ue=>Math.min(1,ue+.05));break;case "ArrowDown":X.preventDefault(),x(ue=>Math.max(0,ue-.05));break;case "Escape":T&&re();break;case "n":X.preventDefault(),G();break;case "p":X.preventDefault(),ge();break;case "l":X.preventDefault(),Ye();break}};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[xe,re,Ye,G,ge,c,f,T]);let st=f>0?c/f*100:0,St=f>0?b/f*100:0,Ae="text-(--accent)",_e=jsxRuntime.jsxs("div",{ref:be,className:v("group flex overflow-hidden",ne?"h-full w-full":"aspect-video w-full",!ne&&"rounded-xl",!ne&&u&&"shadow-2xl",!ne&&!u&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",s),style:{"--accent":l,background:"var(--cp-bg)"},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:v("relative flex-1 min-w-0 h-full overflow-hidden",We&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:de,onMouseLeave:()=>{u&&Ee(false);},children:[jsxRuntime.jsx("video",{ref:te,className:"h-full w-full object-contain",poster:J.poster,playsInline:true,preload:"metadata",onClick:()=>p(E=>!E)}),!u&&!We&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>p(true),children:jsxRuntime.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:jsxRuntime.jsx(lucideReact.Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),We&&!Y&&jsxRuntime.jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxRuntime.jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:J.title}),J.subtitle&&jsxRuntime.jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:J.subtitle})]})}),jsxRuntime.jsx("div",{className:v("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",Y?"opacity-100":"pointer-events-none opacity-0"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:J.title}),J.subtitle&&jsxRuntime.jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:J.subtitle})]}),J.type&&jsxRuntime.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:J.type})]})}),jsxRuntime.jsxs("div",{className:v("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",Y?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxRuntime.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:ke,onMouseMove:Ze,onMouseLeave:()=>ce(null),children:[jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${St}%`,background:"var(--cp-seek-buffer)"}}),jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${st}%`}}),ae!==null&&jsxRuntime.jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${ae/f*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:kr(ae)}),jsxRuntime.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(${st}% - 7px)`}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>p(E=>!E),title:u?"Pause (k)":"Play (k)",children:u?jsxRuntime.jsx(lucideReact.Pause,{className:"h-5 w-5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:ge,title:"Previous (p)",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:G,title:"Next (n)",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>$(E=>!E),title:M?"Unmute":"Mute",children:M||C===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:M?0:C,onChange:E=>{x(Number(E.target.value)),M&&$(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxRuntime.jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[kr(c)," / ",kr(f)]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:v("cp-btn",P&&Ae),onClick:()=>L(E=>!E),title:"Shuffle",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:v("cp-btn",H&&Ae),onClick:()=>D(E=>!E),title:"Loop",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:v("cp-btn",y&&Ae),onClick:Ye,title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListVideo,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:v("cp-btn",T&&Ae),onClick:re,title:"Cinema mode (t)",children:jsxRuntime.jsx(lucideReact.Theater,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:xe,title:"Fullscreen (f)",children:ne?jsxRuntime.jsx(lucideReact.Minimize,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Maximize,{className:"h-4 w-4"})})]})]})]}),jsxRuntime.jsx("div",{className:v("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",y?"w-72":"w-0"),children:jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.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:ct,title:`Sort: ${B} ${K?"\u2191":"\u2193"}`,children:[jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"h-3 w-3"}),B,K?" \u2191":" \u2193"]}),jsxRuntime.jsx("button",{className:"cp-btn p-1!",onClick:Ye,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:at.map(({media:E,originalIndex:X})=>{let ue=X===d;return jsxRuntime.jsxs("button",{className:v("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",ue?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:ue?void 0:{color:"var(--cp-text)"},onClick:()=>{Pe(X);},children:[jsxRuntime.jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[E.poster?jsxRuntime.jsx("img",{src:E.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsxRuntime.jsx(lucideReact.Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),ue&&u&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsxRuntime.jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(z=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+z*3}px`,animation:`mp-eq-bar ${.3+z*.12}s ease-in-out infinite alternate`}},z))})})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:"truncate text-xs font-medium",children:E.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[E.type&&jsxRuntime.jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:E.type}),E.duration!=null&&jsxRuntime.jsx("span",{className:"font-mono text-[10px] opacity-40",children:kr(E.duration)})]})]}),ue&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},X)})})]})}),jsxRuntime.jsx("style",{children:`
|
|
7
7
|
.cp-btn {
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
@@ -19,7 +19,7 @@
|
|
|
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 jsxRuntime.jsx("div",{className:c(U&&"fixed inset-0 z-100 flex items-center justify-center p-8",U&&(Pe?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:U?g=>{g.target===g.currentTarget&&$();}:void 0,children:jsxRuntime.jsx("div",{className:c(U&&"w-full",U&&!X&&"max-w-5xl"),children:Ee})})}var Wt=classVarianceAuthority.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"}});classVarianceAuthority.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 We=[];function Na(e){We.push(e);}function Ca(e){let t=We.indexOf(e);t!==-1&&We.splice(t,1);}function Gt(e){return We.length>0&&We[We.length-1]===e}function Ma(e){let t=We.indexOf(e);return t!==-1?t:We.length}var kr=Pr.createContext(null);function Nr({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:a=false,children:l}){let o=Pr.useId();return Pr.useEffect(()=>{if(e)return Na(o),()=>Ca(o)},[e,o]),Pr.useEffect(()=>{if(!e||!r)return;let n=f=>{f.key==="Escape"&&Gt(o)&&t(false);};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[e,r,t,o]),Pr.useEffect(()=>{if(!e||!r)return;let n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n;}},[e,r]),e?jsxRuntime.jsx(kr.Provider,{value:{id:o,onOpenChange:t,modal:r,closeOnOutsideClick:a},children:reactDom.createPortal(l,document.body)}):null}function Cr({size:e,position:t="center",className:r,children:a,...l}){let o=Pr.useContext(kr);if(!o)return null;let f=200+Ma(o.id)*10,m=()=>{o.closeOnOutsideClick&&Gt(o.id)&&o.onOpenChange(false);},d=t==="bottom";return o.modal?jsxRuntime.jsx("div",{className:c("animate-fade-in fixed inset-0 bg-black/50",d?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:f},onClick:m,children:jsxRuntime.jsx("div",{className:c(Wt({size:e}),d?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",r),role:"dialog","aria-modal":"true",onClick:v=>v.stopPropagation(),...l,children:a})}):jsxRuntime.jsx("div",{className:c("fixed inset-0 flex items-center justify-center p-4",o.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:f},onClick:o.closeOnOutsideClick&&Gt(o.id)?()=>o.onOpenChange(false):void 0,children:jsxRuntime.jsx("div",{className:c(Wt({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:o.closeOnOutsideClick?v=>v.stopPropagation():void 0,...l,children:a})})}function Mr({className:e,...t}){return jsxRuntime.jsx("div",{className:c("mb-4 space-y-1",e),...t})}function Dr({className:e,...t}){return jsxRuntime.jsx("h2",{className:c("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function Tr({className:e,...t}){return jsxRuntime.jsx("p",{className:c("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Sr({className:e,...t}){return jsxRuntime.jsx("div",{className:c("mt-6 flex justify-end gap-2",e),...t})}var Er=classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.cva("bg-primary-200 text-primary-700 dark:bg-primary-700 dark:text-primary-200",{variants:{size:{xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base",xl:"h-16 w-16 text-lg"},shape:{circular:"rounded-full",rounded:"rounded-lg",square:"rounded-none"}},defaultVariants:{size:"md",shape:"circular"}});classVarianceAuthority.cva("relative flex w-full touch-none select-none items-center",{variants:{intent:{primary:"[&_.slider-fill]:bg-primary-500 [&_.slider-thumb]:border-primary-500",secondary:"[&_.slider-fill]:bg-secondary-500 [&_.slider-thumb]:border-secondary-500",success:"[&_.slider-fill]:bg-success-500 [&_.slider-thumb]:border-success-500",danger:"[&_.slider-fill]:bg-danger-500 [&_.slider-thumb]:border-danger-500",warning:"[&_.slider-fill]:bg-warning-500 [&_.slider-thumb]:border-warning-500"},size:{sm:"h-4",md:"h-5",lg:"h-6"}},defaultVariants:{intent:"primary",size:"md"}});classVarianceAuthority.cva("inline-flex items-center gap-1 rounded-full font-medium select-none transition-colors [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-100 text-primary-700 dark:bg-primary-800 dark:text-primary-200",secondary:"bg-secondary-100 text-secondary-700 dark:bg-secondary-800 dark:text-secondary-200",success:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",danger:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",warning:"bg-warning-100 text-warning-700 dark:bg-warning-900/40 dark:text-warning-300",info:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"},size:{sm:"h-5 px-2 text-[0.6875rem] gap-0.5",md:"h-6 px-2.5 text-xs gap-1",lg:"h-7 px-3 text-sm gap-1"},variant:{solid:"",outline:"bg-transparent border",soft:""}},compoundVariants:[{intent:"primary",variant:"outline",class:"border-primary-300 text-primary-700 dark:border-primary-600 dark:text-primary-300"},{intent:"secondary",variant:"outline",class:"border-secondary-300 text-secondary-700 dark:border-secondary-600 dark:text-secondary-300"},{intent:"success",variant:"outline",class:"border-success-400 text-success-700 dark:border-success-600 dark:text-success-300"},{intent:"danger",variant:"outline",class:"border-danger-400 text-danger-700 dark:border-danger-600 dark:text-danger-300"},{intent:"warning",variant:"outline",class:"border-warning-400 text-warning-700 dark:border-warning-600 dark:text-warning-300"},{intent:"info",variant:"outline",class:"border-blue-400 text-blue-700 dark:border-blue-600 dark:text-blue-300"}],defaultVariants:{intent:"primary",size:"md",variant:"solid"}});classVarianceAuthority.cva("relative w-full cursor-pointer rounded-md border bg-white text-sm transition-colors dark:bg-primary-900",{variants:{intent:{default:"border-primary-300 text-primary-900 hover:border-primary-400 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-primary-600 dark:text-primary-100 dark:hover:border-primary-500 dark:focus-within:border-primary-400",danger:"border-danger-500 text-primary-900 focus-within:ring-2 focus-within:ring-danger-500/20 dark:border-danger-500 dark:text-primary-100"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 text-sm",lg:"h-11 px-4 text-base"}},defaultVariants:{intent:"default",size:"md"}});function qt({intent:e,size:t,className:r,...a}){return jsxRuntime.jsx("button",{className:c(Er({intent:e,size:t}),r),...a})}function Tt(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Ar(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 er(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 Ha={".png":lucideReact.Image,".jpg":lucideReact.Image,".jpeg":lucideReact.Image,".gif":lucideReact.Image,".svg":lucideReact.Image,".webp":lucideReact.Image,".ico":lucideReact.Image,".bmp":lucideReact.Image,".mp3":lucideReact.Music,".wav":lucideReact.Music,".flac":lucideReact.Music,".ogg":lucideReact.Music,".aac":lucideReact.Music,".m4a":lucideReact.Music,".mp4":lucideReact.Video,".mkv":lucideReact.Video,".avi":lucideReact.Video,".mov":lucideReact.Video,".wmv":lucideReact.Video,".webm":lucideReact.Video,".ts":lucideReact.FileCode,".tsx":lucideReact.FileCode,".js":lucideReact.FileCode,".jsx":lucideReact.FileCode,".json":lucideReact.FileCode,".html":lucideReact.FileCode,".css":lucideReact.FileCode,".scss":lucideReact.FileCode,".py":lucideReact.FileCode,".rs":lucideReact.FileCode,".go":lucideReact.FileCode,".java":lucideReact.FileCode,".c":lucideReact.FileCode,".cpp":lucideReact.FileCode,".h":lucideReact.FileCode,".sh":lucideReact.Terminal,".bat":lucideReact.Terminal,".ps1":lucideReact.Terminal,".md":lucideReact.FileText,".txt":lucideReact.FileText,".pdf":lucideReact.FileText,".doc":lucideReact.FileText,".docx":lucideReact.FileText,".rtf":lucideReact.FileText,".csv":lucideReact.FileSpreadsheet,".xls":lucideReact.FileSpreadsheet,".xlsx":lucideReact.FileSpreadsheet,".db":lucideReact.Database,".sqlite":lucideReact.Database,".sql":lucideReact.Database,".zip":lucideReact.FileArchive,".tar":lucideReact.FileArchive,".gz":lucideReact.FileArchive,".rar":lucideReact.FileArchive,".7z":lucideReact.FileArchive};function tr(e){if(e.type==="directory")return lucideReact.Folder;let t=e.extension||Tt(e.name);return Ha[t]||lucideReact.File}function mt(e,t,r){return Math.max(t,Math.min(r,e))}function Ir(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function _r(e,t){if(e<480)return {size:{width:e-16,height:t-48},pos:{x:8,y:24}};if(e<640){let l=e-24,o=Math.min(t-64,540);return {size:{width:l,height:o},pos:{x:12,y:32}}}if(e<1024){let l=Math.min(640,e-32),o=Math.min(480,t-64);return {size:{width:l,height:o},pos:{x:Math.max(0,Math.round((e-l)/2)),y:Math.max(0,Math.round((t-o)/2))}}}let r=720,a=520;return {size:{width:r,height:a},pos:{x:Math.max(0,Math.round((e-r)/2)),y:Math.max(0,Math.round((t-a)/2))}}}function rr({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:a="list",initialPosition:l,initialSize:o,dockable:n=false,dockSide:f="right",visible:m=true,onFileOpen:d,onSelectionChange:v,onNavigate:b,onDelete:i,onClose:p,onMinimize:P,onPathSubmit:w,defaultInputMode:L="search",actions:T,resizable:R=true,minSize:F={width:400,height:300},className:H}){let[j,le]=Pr.useState(a),[x,C]=Pr.useState(new Set),[S,A]=Pr.useState(null),[u,V]=Pr.useState(false),[W,ie]=Pr.useState(false),[G,be]=Pr.useState(""),[U,ue]=Pr.useState(L),[Pe,ye]=Pr.useState(m),[X,he]=Pr.useState(false),[ce,Te]=Pr.useState({w:window.innerWidth,h:window.innerHeight}),Re=_r(window.innerWidth,window.innerHeight),[E,J]=Pr.useState(l??Re.pos),[ee,B]=Pr.useState(o??Re.size),[ne,we]=Pr.useState(null),Se=Pr.useRef(false),Y=Pr.useRef({x:0,y:0}),Ye=Pr.useRef(null),ae=Pr.useRef(false),ve=Pr.useRef({x:0,y:0,w:0,h:0,px:0,py:0}),I=Pr.useRef(false),te=Pr.useRef(u);Pr.useEffect(()=>{te.current=u;},[u]);let me=m!==void 0?m:Pe,Fe=Pr.useMemo(()=>{let s=e.filter(q=>q.type==="directory"),M=e.filter(q=>q.type==="file");return s.sort((q,Q)=>q.name.localeCompare(Q.name)),M.sort((q,Q)=>q.name.localeCompare(Q.name)),[...s,...M]},[e]),de=Pr.useMemo(()=>{if(U!=="search"||!G.trim())return Fe;let s=G.toLowerCase();return Fe.filter(M=>M.name.toLowerCase().includes(s))},[Fe,G,U]),$=S!=null?de[S]:null;Pr.useEffect(()=>{let s=Ir(window.innerWidth),M=()=>{let q=window.innerWidth,Q=window.innerHeight;if(Te({w:q,h:Q}),te.current)return;let se=Ir(q);if(se!==s&&!I.current&&!o){let Ae=_r(q,Q);B(Ae.size),J(Ae.pos);}s=se;};return window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[o]);let He=Pr.useCallback((s,M)=>{C(q=>{let Q=new Set(q);return M.ctrlKey||M.metaKey?Q.has(s)?Q.delete(s):Q.add(s):(Q.clear(),Q.add(s)),Q}),A(s);},[]);Pr.useEffect(()=>{if(!v)return;let s=Array.from(x).map(M=>de[M]).filter(Boolean);v(s);},[x]);let tt=Pr.useCallback(s=>{let M=de[s];M&&(M.type==="directory"?b?.(M.path):d?.(M));},[de,d,b]),rt=Pr.useCallback(s=>{u||s.target.closest("button")||(I.current=true,Se.current=true,Y.current={x:s.clientX-E.x,y:s.clientY-E.y},s.preventDefault());},[E,u]),bt=Pr.useCallback(s=>{if(u||s.target.closest("button"))return;I.current=true;let M=s.touches[0];Se.current=true,Y.current={x:M.clientX-E.x,y:M.clientY-E.y};},[E,u]);Pr.useEffect(()=>{let s=Q=>{if(!Se.current)return;let se=window.innerWidth-100,Ae=window.innerHeight-40;J({x:mt(Q.clientX-Y.current.x,0,se),y:mt(Q.clientY-Y.current.y,0,Ae)});},M=Q=>{if(!Se.current)return;Q.preventDefault();let se=Q.touches[0],Ae=window.innerWidth-100,Qe=window.innerHeight-40;J({x:mt(se.clientX-Y.current.x,0,Ae),y:mt(se.clientY-Y.current.y,0,Qe)});},q=()=>{Se.current=false,ae.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",s),window.addEventListener("mouseup",q),window.addEventListener("touchmove",M,{passive:false}),window.addEventListener("touchend",q),()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",q),window.removeEventListener("touchmove",M),window.removeEventListener("touchend",q);}},[]);let ke=Pr.useCallback((s,M)=>{u||(M.preventDefault(),M.stopPropagation(),I.current=true,ae.current=s,ve.current={x:M.clientX,y:M.clientY,w:ee.width,h:ee.height,px:E.x,py:E.y},document.body.style.cursor=s==="e"||s==="w"?"ew-resize":s==="n"||s==="s"?"ns-resize":s==="nw"||s==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[u,ee,E]),Ee=Pr.useCallback((s,M)=>{if(u)return;M.preventDefault(),M.stopPropagation(),I.current=true;let q=M.touches[0];ae.current=s,ve.current={x:q.clientX,y:q.clientY,w:ee.width,h:ee.height,px:E.x,py:E.y},document.body.style.userSelect="none";},[u,ee,E]);Pr.useEffect(()=>{let s=(se,Ae)=>{let Qe=ae.current;if(!Qe)return;let ur=se-ve.current.x,mr=Ae-ve.current.y,{w:nt,h:at,px:Ft,py:Ht}=ve.current;if(Qe.includes("e")&&(nt=Math.max(F.width,nt+ur)),Qe.includes("w")){let ht=Math.max(F.width,nt-ur);Ft=Ft+(nt-ht),nt=ht;}if(Qe.includes("s")&&(at=Math.max(F.height,at+mr)),Qe.includes("n")){let ht=Math.max(F.height,at-mr);Ht=Ht+(at-ht),at=ht;}B({width:nt,height:at}),J({x:Ft,y:Ht});},M=se=>{ae.current&&s(se.clientX,se.clientY);},q=se=>{ae.current&&(se.preventDefault(),s(se.touches[0].clientX,se.touches[0].clientY));},Q=()=>{ae.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",M),window.addEventListener("mouseup",Q),window.addEventListener("touchmove",q,{passive:false}),window.addEventListener("touchend",Q),()=>{window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",Q),window.removeEventListener("touchmove",q),window.removeEventListener("touchend",Q);}},[F]);let g=Pr.useCallback(()=>{u?(ne&&(J(ne.pos),B(ne.size)),V(false)):(we({pos:E,size:ee}),V(true));},[u,E,ee,ne]),z=Pr.useCallback(()=>{W?ie(false):(u&&(V(false),ne&&(J(ne.pos),B(ne.size))),ie(true),P?.());},[W,u,ne,P]);Pr.useEffect(()=>{if(!me||W)return;let s=M=>{if(!(!Ye.current?.contains(document.activeElement)&&document.activeElement!==Ye.current)){if(M.key==="Escape"&&(A(null),C(new Set)),M.ctrlKey&&M.key==="a"){M.preventDefault();let q=new Set(de.map((Q,se)=>se));C(q);}M.key==="Delete"&&x.size>0&&i&&(M.preventDefault(),he(true));}};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[me,W,de,x,i]);let re={"--fe-accent":r};if(W)return jsxRuntime.jsx("div",{className:c("fixed z-100 cursor-pointer transition-all duration-300",f==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:re,onClick:()=>ie(false),title:`Restore ${t}`,children:jsxRuntime.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:[jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!me)return null;let h=u?ce.w:Math.min(ee.width,ce.w-8),K=u?ce.h:Math.min(ee.height,ce.h-8),pe=u?0:mt(E.x,0,Math.max(0,ce.w-h)),_e=u?0:mt(E.y,0,Math.max(0,ce.h-40)),Ot=h<500;return jsxRuntime.jsxs("div",{ref:Ye,className:c("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]",u&&"rounded-none",H),style:{...re,left:pe,top:_e,width:h,height:K,transition:u?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxRuntime.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:rt,onTouchStart:bt,onDoubleClick:g,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsxRuntime.jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:"fe-btn mr-1",onClick:()=>le(s=>s==="list"?"grid":"list"),title:j==="list"?"Grid view":"List view",children:j==="list"?jsxRuntime.jsx(lucideReact.LayoutGrid,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.LayoutList,{className:"h-3.5 w-3.5"})}),n&&jsxRuntime.jsx("button",{className:"fe-btn",onClick:z,title:"Dock to edge",children:jsxRuntime.jsx(lucideReact.Minus,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn",onClick:g,title:u?"Restore":"Maximize",children:u?jsxRuntime.jsx(lucideReact.Minimize2,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Maximize2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{p?.(),ye(false);},title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsxRuntime.jsx("button",{className:"fe-btn p-1",onClick:()=>b?.(".."),title:"Go up",children:jsxRuntime.jsx(lucideReact.FolderUp,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:U==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>ue(s=>s==="search"?"navigate":"search"),title:U==="search"?"Switch to path navigation":"Switch to file search",children:U==="search"?jsxRuntime.jsx(lucideReact.Search,{className:"h-3 w-3"}):jsxRuntime.jsx(lucideReact.CornerRightDown,{className:"h-3 w-3"})}),jsxRuntime.jsx("div",{className:"relative flex-1",children:jsxRuntime.jsx("input",{type:"text",value:G,onChange:s=>be(s.target.value),onKeyDown:s=>{s.key==="Enter"&&G.trim()&&U==="navigate"&&(w?w(G.trim()):b?.(G.trim()));},placeholder:U==="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)"})}),jsxRuntime.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[de.length," item",de.length!==1?"s":"",x.size>0&&` \xB7 ${x.size} selected`]})]}),jsxRuntime.jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:s=>{s.target===s.currentTarget&&(C(new Set),A(null));},children:de.length===0?jsxRuntime.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsxRuntime.jsx(lucideReact.Folder,{className:"mb-2 h-10 w-10"}),jsxRuntime.jsx("span",{className:"text-xs",children:"No files found"})]}):j==="list"?jsxRuntime.jsx("div",{className:"space-y-px",children:de.map((s,M)=>{let q=tr(s),Q=x.has(M),se=s.extension||Tt(s.name);return jsxRuntime.jsxs("div",{className:c("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",Q?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:Q?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:Ae=>He(M,Ae),onDoubleClick:()=>tt(M),children:[jsxRuntime.jsx(q,{className:c("h-4 w-4 shrink-0",s.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:s.name}),se&&s.type==="file"&&jsxRuntime.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:se}),s.size!=null&&jsxRuntime.jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Ar(s.size)}),s.modifiedAt&&jsxRuntime.jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:er(s.modifiedAt)})]},s.path+M)})}):jsxRuntime.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:de.map((s,M)=>{let q=tr(s),Q=x.has(M),se=s.extension||Tt(s.name);return jsxRuntime.jsxs("div",{className:c("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",Q?"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:Ae=>He(M,Ae),onDoubleClick:()=>tt(M),children:[jsxRuntime.jsx(q,{className:c("h-7 w-7",s.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:s.name}),se&&s.type==="file"&&jsxRuntime.jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:se})]},s.path+M)})})}),jsxRuntime.jsx("div",{className:c("overflow-hidden transition-[width,opacity] duration-300 ease-out",Ot?c("absolute right-0 top-0 bottom-0 z-10",$?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):c("shrink-0",$?"w-56":"w-0")),children:$&&jsxRuntime.jsxs("div",{className:c("flex h-full flex-col p-4",Ot?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Ot&&jsxRuntime.jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{A(null),C(new Set);},title:"Close panel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsxs("div",{className:"mb-3 flex flex-col items-center",children:[Pr__default.default.createElement(tr($),{className:c("h-10 w-10 mb-2",$.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:$.name})]}),jsxRuntime.jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsxRuntime.jsx(pt,{label:"Type",value:$.type==="directory"?"Directory":$.mimeType||$.extension||Tt($.name)||"File"}),$.size!=null&&jsxRuntime.jsx(pt,{label:"Size",value:Ar($.size)}),jsxRuntime.jsx(pt,{label:"Path",value:$.path,mono:true}),$.extension&&jsxRuntime.jsx(pt,{label:"Extension",value:$.extension}),$.modifiedAt&&jsxRuntime.jsx(pt,{label:"Modified",value:er($.modifiedAt)}),$.createdAt&&jsxRuntime.jsx(pt,{label:"Created",value:er($.createdAt)})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[$.type==="file"&&d&&jsxRuntime.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:()=>d($),children:[jsxRuntime.jsx(lucideReact.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),T?.map(s=>jsxRuntime.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:()=>s.onClick($),children:[s.icon&&Pr__default.default.createElement(s.icon,{className:"h-3 w-3"}),s.label]},s.key))]})]})})]}),jsxRuntime.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:[jsxRuntime.jsxs("span",{children:[de.length," items"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[x.size>0&&jsxRuntime.jsxs("span",{className:"text-(--fe-accent)/70",children:[x.size," selected"]}),jsxRuntime.jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),R&&!u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:s=>ke("n",s),onTouchStart:s=>Ee("n",s)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:s=>ke("s",s),onTouchStart:s=>Ee("s",s)}),jsxRuntime.jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:s=>ke("w",s),onTouchStart:s=>Ee("w",s)}),jsxRuntime.jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:s=>ke("e",s),onTouchStart:s=>Ee("e",s)}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:s=>ke("nw",s),onTouchStart:s=>Ee("nw",s)}),jsxRuntime.jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:s=>ke("ne",s),onTouchStart:s=>Ee("ne",s)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:s=>ke("sw",s),onTouchStart:s=>Ee("sw",s)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:s=>ke("se",s),onTouchStart:s=>Ee("se",s)})]}),jsxRuntime.jsx("style",{children:`
|
|
22
|
+
`})]});return jsxRuntime.jsx("div",{className:v(T&&"fixed inset-0 z-100 flex items-center justify-center p-8",T&&(he?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:T?E=>{E.target===E.currentTarget&&re();}:void 0,children:jsxRuntime.jsx("div",{className:v(T&&"w-full",T&&!ne&&"max-w-5xl"),children:_e})})}var nn=classVarianceAuthority.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"}});classVarianceAuthority.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 xt=[];function ys(e){xt.push(e);}function xs(e){let t=xt.indexOf(e);t!==-1&&xt.splice(t,1);}function an(e){return xt.length>0&&xt[xt.length-1]===e}function ws(e){let t=xt.indexOf(e);return t!==-1?t:xt.length}var co=Xr.createContext(null);function uo({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:o}){let a=Xr.useId();return Xr.useEffect(()=>{if(e)return ys(a),()=>xs(a)},[e,a]),Xr.useEffect(()=>{if(!e||!r)return;let i=l=>{l.key==="Escape"&&an(a)&&t(false);};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e,r,t,a]),Xr.useEffect(()=>{if(!e||!r)return;let i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i;}},[e,r]),e?jsxRuntime.jsx(co.Provider,{value:{id:a,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:reactDom.createPortal(o,document.body)}):null}function po({size:e,position:t="center",className:r,children:n,...o}){let a=Xr.useContext(co);if(!a)return null;let l=200+ws(a.id)*10,s=()=>{a.closeOnOutsideClick&&an(a.id)&&a.onOpenChange(false);},d=t==="bottom";return a.modal?jsxRuntime.jsx("div",{className:v("animate-fade-in fixed inset-0 bg-black/50",d?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:l},onClick:s,children:jsxRuntime.jsx("div",{className:v(nn({size:e}),d?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",r),role:"dialog","aria-modal":"true",onClick:m=>m.stopPropagation(),...o,children:n})}):jsxRuntime.jsx("div",{className:v("fixed inset-0 flex items-center justify-center p-4",a.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:l},onClick:a.closeOnOutsideClick&&an(a.id)?()=>a.onOpenChange(false):void 0,children:jsxRuntime.jsx("div",{className:v(nn({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:a.closeOnOutsideClick?m=>m.stopPropagation():void 0,...o,children:n})})}function mo({className:e,...t}){return jsxRuntime.jsx("div",{className:v("mb-4 space-y-1",e),...t})}function fo({className:e,...t}){return jsxRuntime.jsx("h2",{className:v("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function ho({className:e,...t}){return jsxRuntime.jsx("p",{className:v("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function go({className:e,...t}){return jsxRuntime.jsx("div",{className:v("mt-6 flex justify-end gap-2",e),...t})}var bo=classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});var vo=classVarianceAuthority.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"}}),yo=classVarianceAuthority.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"}}),xo=classVarianceAuthority.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"}});classVarianceAuthority.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"}});var wo=classVarianceAuthority.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"}});classVarianceAuthority.cva("bg-primary-200 text-primary-700 dark:bg-primary-700 dark:text-primary-200",{variants:{size:{xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base",xl:"h-16 w-16 text-lg"},shape:{circular:"rounded-full",rounded:"rounded-lg",square:"rounded-none"}},defaultVariants:{size:"md",shape:"circular"}});classVarianceAuthority.cva("inline-flex items-center",{variants:{size:{sm:"gap-0.5 [&_.rating-icon]:h-4 [&_.rating-icon]:w-4",md:"gap-1 [&_.rating-icon]:h-6 [&_.rating-icon]:w-6",lg:"gap-1.5 [&_.rating-icon]:h-8 [&_.rating-icon]:w-8"}},defaultVariants:{size:"md"}});var ko=classVarianceAuthority.cva("inline-flex items-center justify-center rounded font-mono font-medium select-none",{variants:{size:{xs:"h-4 min-w-4 px-1 text-[0.6rem]",sm:"h-5 min-w-5 px-1.5 text-xs",md:"h-6 min-w-6 px-2 text-sm",lg:"h-8 min-w-8 px-2.5 text-base"},variant:{default:"border border-secondary-300 bg-secondary-100 text-secondary-700 shadow-[0_2px_0_0_var(--color-secondary-300)] dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:shadow-[0_2px_0_0_var(--color-secondary-600)]",outline:"border border-secondary-400 bg-transparent text-secondary-700 dark:border-secondary-500 dark:text-secondary-300",ghost:"text-secondary-600 dark:text-secondary-400"}},defaultVariants:{size:"sm",variant:"default"}});classVarianceAuthority.cva("relative flex w-full touch-none select-none items-center",{variants:{intent:{primary:"[&_.slider-fill]:bg-primary-500 [&_.slider-thumb]:border-primary-500",secondary:"[&_.slider-fill]:bg-secondary-500 [&_.slider-thumb]:border-secondary-500",success:"[&_.slider-fill]:bg-success-500 [&_.slider-thumb]:border-success-500",danger:"[&_.slider-fill]:bg-danger-500 [&_.slider-thumb]:border-danger-500",warning:"[&_.slider-fill]:bg-warning-500 [&_.slider-thumb]:border-warning-500"},size:{sm:"h-4",md:"h-5",lg:"h-6"}},defaultVariants:{intent:"primary",size:"md"}});classVarianceAuthority.cva("inline-flex items-center gap-1 rounded-full font-medium select-none transition-colors [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-100 text-primary-700 dark:bg-primary-800 dark:text-primary-200",secondary:"bg-secondary-100 text-secondary-700 dark:bg-secondary-800 dark:text-secondary-200",success:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",danger:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",warning:"bg-warning-100 text-warning-700 dark:bg-warning-900/40 dark:text-warning-300",info:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"},size:{sm:"h-5 px-2 text-[0.6875rem] gap-0.5",md:"h-6 px-2.5 text-xs gap-1",lg:"h-7 px-3 text-sm gap-1"},variant:{solid:"",outline:"bg-transparent border",soft:""}},compoundVariants:[{intent:"primary",variant:"outline",class:"border-primary-300 text-primary-700 dark:border-primary-600 dark:text-primary-300"},{intent:"secondary",variant:"outline",class:"border-secondary-300 text-secondary-700 dark:border-secondary-600 dark:text-secondary-300"},{intent:"success",variant:"outline",class:"border-success-400 text-success-700 dark:border-success-600 dark:text-success-300"},{intent:"danger",variant:"outline",class:"border-danger-400 text-danger-700 dark:border-danger-600 dark:text-danger-300"},{intent:"warning",variant:"outline",class:"border-warning-400 text-warning-700 dark:border-warning-600 dark:text-warning-300"},{intent:"info",variant:"outline",class:"border-blue-400 text-blue-700 dark:border-blue-600 dark:text-blue-300"}],defaultVariants:{intent:"primary",size:"md",variant:"solid"}});classVarianceAuthority.cva("relative w-full cursor-pointer rounded-md border bg-white text-sm transition-colors dark:bg-primary-900",{variants:{intent:{default:"border-primary-300 text-primary-900 hover:border-primary-400 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-primary-600 dark:text-primary-100 dark:hover:border-primary-500 dark:focus-within:border-primary-400",danger:"border-danger-500 text-primary-900 focus-within:ring-2 focus-within:ring-danger-500/20 dark:border-danger-500 dark:text-primary-100"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 text-sm",lg:"h-11 px-4 text-base"}},defaultVariants:{intent:"default",size:"md"}});function Pt({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("button",{className:v(bo({intent:e,size:t}),r),...n})}function Mr(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function To(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 dn(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 Is={".png":lucideReact.Image,".jpg":lucideReact.Image,".jpeg":lucideReact.Image,".gif":lucideReact.Image,".svg":lucideReact.Image,".webp":lucideReact.Image,".ico":lucideReact.Image,".bmp":lucideReact.Image,".mp3":lucideReact.Music,".wav":lucideReact.Music,".flac":lucideReact.Music,".ogg":lucideReact.Music,".aac":lucideReact.Music,".m4a":lucideReact.Music,".mp4":lucideReact.Video,".mkv":lucideReact.Video,".avi":lucideReact.Video,".mov":lucideReact.Video,".wmv":lucideReact.Video,".webm":lucideReact.Video,".ts":lucideReact.FileCode,".tsx":lucideReact.FileCode,".js":lucideReact.FileCode,".jsx":lucideReact.FileCode,".json":lucideReact.FileCode,".html":lucideReact.FileCode,".css":lucideReact.FileCode,".scss":lucideReact.FileCode,".py":lucideReact.FileCode,".rs":lucideReact.FileCode,".go":lucideReact.FileCode,".java":lucideReact.FileCode,".c":lucideReact.FileCode,".cpp":lucideReact.FileCode,".h":lucideReact.FileCode,".sh":lucideReact.Terminal,".bat":lucideReact.Terminal,".ps1":lucideReact.Terminal,".md":lucideReact.FileText,".txt":lucideReact.FileText,".pdf":lucideReact.FileText,".doc":lucideReact.FileText,".docx":lucideReact.FileText,".rtf":lucideReact.FileText,".csv":lucideReact.FileSpreadsheet,".xls":lucideReact.FileSpreadsheet,".xlsx":lucideReact.FileSpreadsheet,".db":lucideReact.Database,".sqlite":lucideReact.Database,".sql":lucideReact.Database,".zip":lucideReact.FileArchive,".tar":lucideReact.FileArchive,".gz":lucideReact.FileArchive,".rar":lucideReact.FileArchive,".7z":lucideReact.FileArchive};function un(e){if(e.type==="directory")return lucideReact.Folder;let t=e.extension||Mr(e.name);return Is[t]||lucideReact.File}function Kt(e,t,r){return Math.max(t,Math.min(r,e))}function Eo(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function Po(e,t){if(e<480)return {size:{width:e-16,height:t-48},pos:{x:8,y:24}};if(e<640){let o=e-24,a=Math.min(t-64,540);return {size:{width:o,height:a},pos:{x:12,y:32}}}if(e<1024){let o=Math.min(640,e-32),a=Math.min(480,t-64);return {size:{width:o,height:a},pos:{x:Math.max(0,Math.round((e-o)/2)),y:Math.max(0,Math.round((t-a)/2))}}}let r=720,n=520;return {size:{width:r,height:n},pos:{x:Math.max(0,Math.round((e-r)/2)),y:Math.max(0,Math.round((t-n)/2))}}}function pn({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:n="list",initialPosition:o,initialSize:a,dockable:i=false,dockSide:l="right",visible:s=true,onFileOpen:d,onSelectionChange:m,onNavigate:u,onDelete:p,onClose:c,onMinimize:h,onPathSubmit:f,defaultInputMode:g="search",actions:b,resizable:w=true,minSize:C={width:400,height:300},className:x}){let[M,$]=Xr.useState(n),[P,L]=Xr.useState(new Set),[H,D]=Xr.useState(null),[y,_]=Xr.useState(false),[B,R]=Xr.useState(false),[K,ie]=Xr.useState(""),[T,ye]=Xr.useState(g),[he,Ne]=Xr.useState(s),[ne,Te]=Xr.useState(false),[Y,Ee]=Xr.useState({w:window.innerWidth,h:window.innerHeight}),We=Po(window.innerWidth,window.innerHeight),[O,ae]=Xr.useState(o??We.pos),[ce,te]=Xr.useState(a??We.size),[be,Se]=Xr.useState(null),De=Xr.useRef(false),J=Xr.useRef({x:0,y:0}),at=Xr.useRef(null),de=Xr.useRef(false),Pe=Xr.useRef({x:0,y:0,w:0,h:0,px:0,py:0}),G=Xr.useRef(false),ge=Xr.useRef(y);Xr.useEffect(()=>{ge.current=y;},[y]);let ke=s!==void 0?s:he,Ze=Xr.useMemo(()=>{let k=e.filter(se=>se.type==="directory"),U=e.filter(se=>se.type==="file");return k.sort((se,le)=>se.name.localeCompare(le.name)),U.sort((se,le)=>se.name.localeCompare(le.name)),[...k,...U]},[e]),xe=Xr.useMemo(()=>{if(T!=="search"||!K.trim())return Ze;let k=K.toLowerCase();return Ze.filter(U=>U.name.toLowerCase().includes(k))},[Ze,K,T]),re=H!=null?xe[H]:null;Xr.useEffect(()=>{let k=Eo(window.innerWidth),U=()=>{let se=window.innerWidth,le=window.innerHeight;if(Ee({w:se,h:le}),ge.current)return;let ve=Eo(se);if(ve!==k&&!G.current&&!a){let qe=Po(se,le);te(qe.size),ae(qe.pos);}k=ve;};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[a]);let Ye=Xr.useCallback((k,U)=>{L(se=>{let le=new Set(se);return U.ctrlKey||U.metaKey?le.has(k)?le.delete(k):le.add(k):(le.clear(),le.add(k)),le}),D(k);},[]);Xr.useEffect(()=>{if(!m)return;let k=Array.from(P).map(U=>xe[U]).filter(Boolean);m(k);},[P]);let ct=Xr.useCallback(k=>{let U=xe[k];U&&(U.type==="directory"?u?.(U.path):d?.(U));},[xe,d,u]),st=Xr.useCallback(k=>{y||k.target.closest("button")||(G.current=true,De.current=true,J.current={x:k.clientX-O.x,y:k.clientY-O.y},k.preventDefault());},[O,y]),St=Xr.useCallback(k=>{if(y||k.target.closest("button"))return;G.current=true;let U=k.touches[0];De.current=true,J.current={x:U.clientX-O.x,y:U.clientY-O.y};},[O,y]);Xr.useEffect(()=>{let k=le=>{if(!De.current)return;let ve=window.innerWidth-100,qe=window.innerHeight-40;ae({x:Kt(le.clientX-J.current.x,0,ve),y:Kt(le.clientY-J.current.y,0,qe)});},U=le=>{if(!De.current)return;le.preventDefault();let ve=le.touches[0],qe=window.innerWidth-100,dt=window.innerHeight-40;ae({x:Kt(ve.clientX-J.current.x,0,qe),y:Kt(ve.clientY-J.current.y,0,dt)});},se=()=>{De.current=false,de.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",k),window.addEventListener("mouseup",se),window.addEventListener("touchmove",U,{passive:false}),window.addEventListener("touchend",se),()=>{window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",se),window.removeEventListener("touchmove",U),window.removeEventListener("touchend",se);}},[]);let Ae=Xr.useCallback((k,U)=>{y||(U.preventDefault(),U.stopPropagation(),G.current=true,de.current=k,Pe.current={x:U.clientX,y:U.clientY,w:ce.width,h:ce.height,px:O.x,py:O.y},document.body.style.cursor=k==="e"||k==="w"?"ew-resize":k==="n"||k==="s"?"ns-resize":k==="nw"||k==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[y,ce,O]),_e=Xr.useCallback((k,U)=>{if(y)return;U.preventDefault(),U.stopPropagation(),G.current=true;let se=U.touches[0];de.current=k,Pe.current={x:se.clientX,y:se.clientY,w:ce.width,h:ce.height,px:O.x,py:O.y},document.body.style.userSelect="none";},[y,ce,O]);Xr.useEffect(()=>{let k=(ve,qe)=>{let dt=de.current;if(!dt)return;let br=ve-Pe.current.x,N=qe-Pe.current.y,{w:ut,h:bt,px:er,py:Ht}=Pe.current;if(dt.includes("e")&&(ut=Math.max(C.width,ut+br)),dt.includes("w")){let Tt=Math.max(C.width,ut-br);er=er+(ut-Tt),ut=Tt;}if(dt.includes("s")&&(bt=Math.max(C.height,bt+N)),dt.includes("n")){let Tt=Math.max(C.height,bt-N);Ht=Ht+(bt-Tt),bt=Tt;}te({width:ut,height:bt}),ae({x:er,y:Ht});},U=ve=>{de.current&&k(ve.clientX,ve.clientY);},se=ve=>{de.current&&(ve.preventDefault(),k(ve.touches[0].clientX,ve.touches[0].clientY));},le=()=>{de.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",U),window.addEventListener("mouseup",le),window.addEventListener("touchmove",se,{passive:false}),window.addEventListener("touchend",le),()=>{window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",le),window.removeEventListener("touchmove",se),window.removeEventListener("touchend",le);}},[C]);let E=Xr.useCallback(()=>{y?(be&&(ae(be.pos),te(be.size)),_(false)):(Se({pos:O,size:ce}),_(true));},[y,O,ce,be]),X=Xr.useCallback(()=>{B?R(false):(y&&(_(false),be&&(ae(be.pos),te(be.size))),R(true),h?.());},[B,y,be,h]);Xr.useEffect(()=>{if(!ke||B)return;let k=U=>{if(!(!at.current?.contains(document.activeElement)&&document.activeElement!==at.current)){if(U.key==="Escape"&&(D(null),L(new Set)),U.ctrlKey&&U.key==="a"){U.preventDefault();let se=new Set(xe.map((le,ve)=>ve));L(se);}U.key==="Delete"&&P.size>0&&p&&(U.preventDefault(),Te(true));}};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[ke,B,xe,P,p]);let ue={"--fe-accent":r};if(B)return jsxRuntime.jsx("div",{className:v("fixed z-100 cursor-pointer transition-all duration-300",l==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:ue,onClick:()=>R(false),title:`Restore ${t}`,children:jsxRuntime.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:[jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!ke)return null;let z=y?Y.w:Math.min(ce.width,Y.w-8),oe=y?Y.h:Math.min(ce.height,Y.h-8),Re=y?0:Kt(O.x,0,Math.max(0,Y.w-z)),et=y?0:Kt(O.y,0,Math.max(0,Y.h-40)),_t=z<500;return jsxRuntime.jsxs("div",{ref:at,className:v("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",y&&"rounded-none",x),style:{...ue,left:Re,top:et,width:z,height:oe,transition:y?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxRuntime.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:st,onTouchStart:St,onDoubleClick:E,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsxRuntime.jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:"fe-btn mr-1",onClick:()=>$(k=>k==="list"?"grid":"list"),title:M==="list"?"Grid view":"List view",children:M==="list"?jsxRuntime.jsx(lucideReact.LayoutGrid,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.LayoutList,{className:"h-3.5 w-3.5"})}),i&&jsxRuntime.jsx("button",{className:"fe-btn",onClick:X,title:"Dock to edge",children:jsxRuntime.jsx(lucideReact.Minus,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn",onClick:E,title:y?"Restore":"Maximize",children:y?jsxRuntime.jsx(lucideReact.Minimize2,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Maximize2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{c?.(),Ne(false);},title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsxRuntime.jsx("button",{className:"fe-btn p-1",onClick:()=>u?.(".."),title:"Go up",children:jsxRuntime.jsx(lucideReact.FolderUp,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:T==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>ye(k=>k==="search"?"navigate":"search"),title:T==="search"?"Switch to path navigation":"Switch to file search",children:T==="search"?jsxRuntime.jsx(lucideReact.Search,{className:"h-3 w-3"}):jsxRuntime.jsx(lucideReact.CornerRightDown,{className:"h-3 w-3"})}),jsxRuntime.jsx("div",{className:"relative flex-1",children:jsxRuntime.jsx("input",{type:"text",value:K,onChange:k=>ie(k.target.value),onKeyDown:k=>{k.key==="Enter"&&K.trim()&&T==="navigate"&&(f?f(K.trim()):u?.(K.trim()));},placeholder:T==="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)"})}),jsxRuntime.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[xe.length," item",xe.length!==1?"s":"",P.size>0&&` \xB7 ${P.size} selected`]})]}),jsxRuntime.jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:k=>{k.target===k.currentTarget&&(L(new Set),D(null));},children:xe.length===0?jsxRuntime.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsxRuntime.jsx(lucideReact.Folder,{className:"mb-2 h-10 w-10"}),jsxRuntime.jsx("span",{className:"text-xs",children:"No files found"})]}):M==="list"?jsxRuntime.jsx("div",{className:"space-y-px",children:xe.map((k,U)=>{let se=un(k),le=P.has(U),ve=k.extension||Mr(k.name);return jsxRuntime.jsxs("div",{className:v("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",le?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:le?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:qe=>Ye(U,qe),onDoubleClick:()=>ct(U),children:[jsxRuntime.jsx(se,{className:v("h-4 w-4 shrink-0",k.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:k.name}),ve&&k.type==="file"&&jsxRuntime.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:ve}),k.size!=null&&jsxRuntime.jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:To(k.size)}),k.modifiedAt&&jsxRuntime.jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:dn(k.modifiedAt)})]},k.path+U)})}):jsxRuntime.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:xe.map((k,U)=>{let se=un(k),le=P.has(U),ve=k.extension||Mr(k.name);return jsxRuntime.jsxs("div",{className:v("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",le?"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:qe=>Ye(U,qe),onDoubleClick:()=>ct(U),children:[jsxRuntime.jsx(se,{className:v("h-7 w-7",k.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:k.name}),ve&&k.type==="file"&&jsxRuntime.jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:ve})]},k.path+U)})})}),jsxRuntime.jsx("div",{className:v("overflow-hidden transition-[width,opacity] duration-300 ease-out",_t?v("absolute right-0 top-0 bottom-0 z-10",re?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):v("shrink-0",re?"w-56":"w-0")),children:re&&jsxRuntime.jsxs("div",{className:v("flex h-full flex-col p-4",_t?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[_t&&jsxRuntime.jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{D(null),L(new Set);},title:"Close panel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsxs("div",{className:"mb-3 flex flex-col items-center",children:[Xr__default.default.createElement(un(re),{className:v("h-10 w-10 mb-2",re.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:re.name})]}),jsxRuntime.jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsxRuntime.jsx(Wt,{label:"Type",value:re.type==="directory"?"Directory":re.mimeType||re.extension||Mr(re.name)||"File"}),re.size!=null&&jsxRuntime.jsx(Wt,{label:"Size",value:To(re.size)}),jsxRuntime.jsx(Wt,{label:"Path",value:re.path,mono:true}),re.extension&&jsxRuntime.jsx(Wt,{label:"Extension",value:re.extension}),re.modifiedAt&&jsxRuntime.jsx(Wt,{label:"Modified",value:dn(re.modifiedAt)}),re.createdAt&&jsxRuntime.jsx(Wt,{label:"Created",value:dn(re.createdAt)})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[re.type==="file"&&d&&jsxRuntime.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:()=>d(re),children:[jsxRuntime.jsx(lucideReact.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),b?.map(k=>jsxRuntime.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:()=>k.onClick(re),children:[k.icon&&Xr__default.default.createElement(k.icon,{className:"h-3 w-3"}),k.label]},k.key))]})]})})]}),jsxRuntime.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:[jsxRuntime.jsxs("span",{children:[xe.length," items"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[P.size>0&&jsxRuntime.jsxs("span",{className:"text-(--fe-accent)/70",children:[P.size," selected"]}),jsxRuntime.jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),w&&!y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:k=>Ae("n",k),onTouchStart:k=>_e("n",k)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:k=>Ae("s",k),onTouchStart:k=>_e("s",k)}),jsxRuntime.jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:k=>Ae("w",k),onTouchStart:k=>_e("w",k)}),jsxRuntime.jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:k=>Ae("e",k),onTouchStart:k=>_e("e",k)}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:k=>Ae("nw",k),onTouchStart:k=>_e("nw",k)}),jsxRuntime.jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:k=>Ae("ne",k),onTouchStart:k=>_e("ne",k)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:k=>Ae("sw",k),onTouchStart:k=>_e("sw",k)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:k=>Ae("se",k),onTouchStart:k=>_e("se",k)})]}),jsxRuntime.jsx("style",{children:`
|
|
23
23
|
.fe-window {
|
|
24
24
|
background: var(--fe-bg);
|
|
25
25
|
box-shadow: var(--fe-shadow);
|
|
@@ -80,4 +80,48 @@
|
|
|
80
80
|
from { opacity: 0; transform: translateX(-4px); }
|
|
81
81
|
to { opacity: 1; transform: translateX(0); }
|
|
82
82
|
}
|
|
83
|
-
`}),jsxRuntime.jsx(Nr,{open:X,onOpenChange:he,children:jsxRuntime.jsxs(Cr,{size:"sm",children:[jsxRuntime.jsxs(Mr,{children:[jsxRuntime.jsxs(Dr,{children:[jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxRuntime.jsxs(Tr,{children:[x.size===1?`Are you sure you want to delete "${de[Array.from(x)[0]]?.name}"?`:`Are you sure you want to delete ${x.size} selected items?`," ","This action cannot be undone."]})]}),jsxRuntime.jsxs(Sr,{children:[jsxRuntime.jsx(qt,{intent:"ghost",onClick:()=>he(false),children:"Cancel"}),jsxRuntime.jsxs(qt,{intent:"danger",onClick:()=>{let s=Array.from(x).map(M=>de[M]).filter(Boolean);i?.(s),C(new Set),A(null),he(false);},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function pt({label:e,value:t,mono:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsxRuntime.jsx("div",{className:c("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function ja(e,t){let r=t.getBoundingClientRect(),a=Math.max(r.width,r.height)*1.2,l=e.clientX-r.left,o=e.clientY-r.top,n=document.createElement("span");n.className="masonry-ripple",n.style.width=`${a}px`,n.style.height=`${a}px`,n.style.left=`${l}px`,n.style.top=`${o}px`,t.appendChild(n),n.addEventListener("animationend",()=>n.remove());}function sr({columns:e,columnWidth:t=240,gap:r=16,items:a,onItemClick:l,className:o,style:n,children:f,...m}){let d=Pr.useRef(null),v=Pr.useRef([]),[b,i]=Pr.useState(()=>e??1),[p,P]=Pr.useState([]),[w,L]=Pr.useState(0),T=a?a.map((x,C)=>({key:x.key??C,node:x.content})):Pr__default.default.Children.toArray(f).map((x,C)=>({key:x.key??C,node:x})),R=T.length,F=Pr.useCallback(x=>e??Math.max(1,Math.floor((x+r)/(t+r))),[e,t,r]),H=Pr.useCallback(()=>{let x=d.current;if(!x)return;let C=x.clientWidth,S=F(C);i(S);let A=(C-(S-1)*r)/S,u=new Array(S).fill(0),V=[];for(let ie=0;ie<R;ie++){let G=v.current[ie],be=G?G.offsetHeight:0,U=0;for(let ue=1;ue<S;ue++)u[ue]<u[U]&&(U=ue);V.push({top:u[U],left:U*(A+r),width:A}),u[U]+=be+r;}let W=Math.max(0,...u)-(R?r:0);P(V),L(W);},[R,F,r]);Pr.useEffect(()=>{let x=d.current;if(!x)return;let C=new ResizeObserver(()=>H());return C.observe(x),()=>C.disconnect()},[H]),Pr.useEffect(()=>{let x=requestAnimationFrame(H);return ()=>cancelAnimationFrame(x)},[H]),Pr.useEffect(()=>{let x=new ResizeObserver(()=>H());return v.current.forEach(C=>{C&&x.observe(C);}),()=>x.disconnect()},[R,b,H]);let j=Pr.useCallback((x,C)=>{let S=x.currentTarget;ja(x,S),l?.(a?.[C],C);},[l,a]),le=x=>{if(!a)return false;let C=a[x];return !!(C.title||C.description||C.actions)};return jsxRuntime.jsx("div",{ref:d,className:c("relative",o),style:{...n,height:w},...m,children:T.map((x,C)=>jsxRuntime.jsxs("div",{ref:S=>{v.current[C]=S;},className:"masonry-item",role:"button",tabIndex:0,onClick:S=>j(S,C),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),l?.(a?.[C],C));},style:{position:"absolute",top:p[C]?.top??0,left:p[C]?.left??0,width:p[C]?.width??"100%"},children:[x.node,le(C)&&jsxRuntime.jsxs("div",{className:"masonry-item-overlay",children:[a[C].title&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-title",children:a[C].title}),a[C].description&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-desc",children:a[C].description}),a[C].actions&&jsxRuntime.jsx("div",{className:"masonry-item-overlay-actions",children:a[C].actions})]})]},x.key))})}function Lt({text:e="",mode:t="typewriter",speed:r=40,cursor:a=true,cursorChar:l="\u258B",thinking:o=false,streaming:n=false,delay:f=0,onComplete:m,as:d="span",className:v}){let[b,i]=Pr.useState(t==="instant"?e:""),[p,P]=Pr.useState(false),[w,L]=Pr.useState(t==="instant"),[T,R]=Pr.useState(false),F=Pr.useRef(0),H=Pr.useRef(m);H.current=m;let j=Pr.useRef(e);j.current=e,Pr.useEffect(()=>{if(t!=="typewriter")return;if(i(""),L(false),R(false),P(false),!e){L(true);return}let A=Math.max(10,1e3/r),u=0,V,W=()=>{P(true),V=setInterval(()=>{let G=j.current;u++,i(G.slice(0,u)),u>=G.length&&(clearInterval(V),P(false),L(true),H.current?.());},A);},ie;return f>0?ie=setTimeout(W,f):W(),()=>{clearTimeout(ie),clearInterval(V);}},[e,t]),Pr.useEffect(()=>{if(t!=="stream")return;if(e.length===0){F.current=0,i(""),P(false),L(false),R(false);return}if(e.length<=F.current)return;let A=Math.max(10,1e3/r),u=F.current;P(true),L(false),R(false);let V=setInterval(()=>{u++,F.current=u,i(j.current.slice(0,u)),u>=j.current.length&&(clearInterval(V),P(false),H.current?.());},A);return ()=>clearInterval(V)},[e,t]),Pr.useEffect(()=>{t==="instant"&&(i(e),P(false),L(true));},[e,t]);let le=Pr.useRef(n);Pr.useEffect(()=>{let A=le.current;if(le.current=n,A&&!n&&!p&&t==="stream"){R(true);let u=setTimeout(()=>{R(false),L(true);},650);return ()=>clearTimeout(u)}},[n,p,t]);let x=a&&(o||p||T||t==="stream"&&n&&!w||t==="typewriter"&&!w),C=o?"tw-cursor--blink":p?"tw-cursor--solid":T?"tw-cursor--out":"tw-cursor--blink";return jsxRuntime.jsxs(d,{className:c(v),children:[o&&!b&&jsxRuntime.jsx("span",{"aria-hidden":"true",children:"\u200B"}),b,x&&jsxRuntime.jsx("span",{className:c("tw-cursor",C),"aria-hidden":"true",children:l})]})}function zt(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function Ba(e,t){if(!t)return true;let r=zt(t);return zt(e.label).includes(r)||(e.description?zt(e.description).includes(r):false)||(e.keywords?e.keywords.some(a=>zt(a).includes(r)):false)}function Ua(e){let t=new Map;for(let r of e){let a=r.group??"";t.has(a)||t.set(a,[]),t.get(a).push(r);}return Array.from(t.entries()).map(([r,a])=>({label:r,items:a}))}function Br(e,t,r,a){let[l,o]=Pr.useState(""),[n,f]=Pr.useState(0);Pr.useEffect(()=>{t&&(o(""),f(0));},[t]);let m=Pr.useMemo(()=>e.filter(i=>!i.disabled&&Ba(i,l)),[e,l]),d=Pr.useMemo(()=>Ua(m),[m]);Pr.useEffect(()=>{f(i=>Math.min(i,Math.max(0,m.length-1)));},[m.length]);let v=Pr.useCallback(()=>{let i=m[n];i&&(i.onSelect(),r(false));},[m,n,r]),b=Pr.useCallback(i=>{switch(i.key){case "ArrowDown":i.preventDefault(),f(p=>(p+1)%Math.max(1,m.length));break;case "ArrowUp":i.preventDefault(),f(p=>(p-1+Math.max(1,m.length))%Math.max(1,m.length));break;case "Enter":i.preventDefault(),v();break;case "Escape":i.preventDefault(),r(false);break}},[m.length,v,r]);return Pr.useEffect(()=>{if(!a)return;function i(p){(p.metaKey||p.ctrlKey)&&p.key==="k"&&(p.preventDefault(),r(!t));}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[a,t,r]),{query:l,setQuery:o,groups:d,filtered:m,activeIndex:n,setActiveIndex:f,handleKeyDown:b}}function At({open:e,onOpenChange:t,commands:r,placeholder:a="Type a command or search\u2026",hotkey:l=true,maxItems:o=8,className:n}){let f=Pr.useRef(null),m=Pr.useRef(null),{query:d,setQuery:v,groups:b,filtered:i,activeIndex:p,setActiveIndex:P,handleKeyDown:w}=Br(r,e,t,l);if(Pr.useEffect(()=>{if(e){let T=setTimeout(()=>f.current?.focus(),40);return ()=>clearTimeout(T)}},[e]),Pr.useEffect(()=>{m.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[p]),!e)return null;let L=0;return reactDom.createPortal(jsxRuntime.jsx("div",{className:"cmd-backdrop fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:()=>t(false),role:"presentation",children:jsxRuntime.jsxs("div",{className:c("cmd-panel relative flex w-full max-w-lg flex-col overflow-hidden rounded-xl","border border-primary-200 bg-white shadow-2xl","dark:border-primary-700 dark:bg-primary-900",n),onClick:T=>T.stopPropagation(),onKeyDown:w,role:"dialog","aria-label":"Command palette","aria-modal":"true",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 border-b border-primary-100 px-4 dark:border-primary-700",children:[jsxRuntime.jsx(lucideReact.Search,{className:"h-4 w-4 shrink-0 text-secondary-400","aria-hidden":"true"}),jsxRuntime.jsx("input",{ref:f,value:d,onChange:T=>v(T.target.value),placeholder:a,className:"flex-1 bg-transparent py-3.5 text-sm text-primary-900 outline-none placeholder:text-secondary-400 dark:text-primary-50","aria-label":"Search commands","aria-controls":"cmd-results","aria-autocomplete":"list","aria-activedescendant":i[p]?`cmd-item-${i[p].id}`:void 0,spellCheck:false,autoComplete:"off"}),jsxRuntime.jsx("kbd",{className:"hidden shrink-0 rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-400 dark:border-primary-600 sm:block",children:"esc"})]}),jsxRuntime.jsx("div",{id:"cmd-results",ref:m,className:"overflow-y-auto py-2",style:{maxHeight:`${o*2.75}rem`},role:"listbox","aria-label":"Commands",children:i.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-sm text-secondary-400",children:[jsxRuntime.jsx(lucideReact.Command,{className:"h-8 w-8 opacity-30"}),jsxRuntime.jsx("span",{children:"No commands found"})]}):b.map(T=>jsxRuntime.jsxs("div",{className:"mb-1 last:mb-0",children:[T.label&&jsxRuntime.jsx("p",{className:"px-4 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-secondary-400 dark:text-secondary-500",children:T.label}),T.items.map(R=>{let F=L++,H=F===p;return jsxRuntime.jsxs("button",{id:`cmd-item-${R.id}`,"data-active":H,role:"option","aria-selected":H,className:c("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",H?"bg-primary-100 text-primary-900 dark:bg-primary-800 dark:text-primary-50":"text-primary-700 hover:bg-primary-50 dark:text-primary-300 dark:hover:bg-primary-800/50"),onMouseEnter:()=>P(F),onClick:()=>{R.onSelect(),t(false);},children:[R.icon&&jsxRuntime.jsx("span",{className:c("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",H?"border-primary-300 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-700 dark:text-primary-200":"border-primary-200 bg-primary-50 text-primary-500 dark:border-primary-700 dark:bg-primary-800 dark:text-primary-400"),children:R.icon}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate font-medium",children:R.label}),R.description&&jsxRuntime.jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:R.description})]}),R.shortcut&&jsxRuntime.jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:R.shortcut.map((j,le)=>jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-500 dark:border-primary-700 dark:text-secondary-400",children:j},le))})]},R.id)})]},T.label||"_default"))}),i.length>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between border-t border-primary-100 px-4 py-2 dark:border-primary-700",children:[jsxRuntime.jsxs("span",{className:"text-xs text-secondary-400",children:[i.length," result",i.length!==1?"s":""]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-3 text-xs text-secondary-400",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2191"}),jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2193"}),"Navigate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u21B5"}),"Select"]})]})]})]})}),document.body)}var Gr={complete:"bg-success-500 border-success-500 text-white dark:bg-success-600 dark:border-success-600",active:"bg-primary-500 border-primary-500 text-white dark:bg-primary-400 dark:border-primary-400",error:"bg-danger-500 border-danger-500 text-white dark:bg-danger-600 dark:border-danger-600",pending:"bg-white border-primary-300 text-secondary-400 dark:bg-primary-800 dark:border-primary-600"},qr={complete:"shadow-[0_0_0_4px_theme(colors.success.100)] dark:shadow-[0_0_0_4px_theme(colors.success.900/30)]",active:"shadow-[0_0_0_4px_theme(colors.primary.100)] dark:shadow-[0_0_0_4px_theme(colors.primary.800/50)] animate-pulse",error:"shadow-[0_0_0_4px_theme(colors.danger.100)] dark:shadow-[0_0_0_4px_theme(colors.danger.900/30)]",pending:""};function Qr({status:e,icon:t}){return t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:t}):e==="complete"?jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"}):e==="error"?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"h-3 w-3"}):e==="active"?jsxRuntime.jsx(lucideReact.Dot,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Clock,{className:"h-3 w-3"})}function Zr({images:e,title:t}){let r=e.slice(0,4),a=e.length>4?e.length-4:0,l=(o,n,f)=>jsxRuntime.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:c("relative block overflow-hidden",f),onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsx("img",{src:o,alt:`${t} ${n+1}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105"}),n===r.length-1&&a>0&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60",children:jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white",children:["+",a]})})]},n);return r.length===0?null:r.length===1?jsxRuntime.jsx("div",{className:"mt-2.5 h-36 overflow-hidden rounded-xl",children:l(r[0],0,"h-full")}):r.length===2?jsxRuntime.jsx("div",{className:"mt-2.5 grid h-28 grid-cols-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((o,n)=>l(o,n))}):r.length===3?jsxRuntime.jsxs("div",{className:"mt-2.5 grid h-36 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:[l(r[0],0,"row-span-2"),l(r[1],1),l(r[2],2)]}):jsxRuntime.jsx("div",{className:"mt-2.5 grid h-44 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((o,n)=>l(o,n))})}function Jr({actions:e}){let t=e.filter(n=>n.variant!=="primary"),r=e.filter(n=>n.variant==="primary"),a="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium text-secondary-500 transition-colors hover:bg-secondary-100/80 hover:text-secondary-700 dark:text-secondary-400 dark:hover:bg-primary-800/60 dark:hover:text-secondary-200",l="inline-flex items-center gap-1.5 rounded-lg border border-primary-200/70 bg-primary-50/80 px-3 py-1 text-xs font-semibold text-primary-700 transition-colors hover:bg-primary-100 dark:border-primary-600/60 dark:bg-primary-800/60 dark:text-primary-300 dark:hover:bg-primary-700/60",o=(n,f,m)=>n.href?jsxRuntime.jsxs("a",{href:n.href,target:"_blank",rel:"noopener noreferrer",className:m,onClick:d=>d.stopPropagation(),children:[n.icon,n.label]},f):jsxRuntime.jsxs("button",{type:"button",onClick:n.onClick,className:m,children:[n.icon,n.label]},f);return jsxRuntime.jsxs("div",{className:"mt-3 flex items-center gap-1 border-t border-primary-100/50 pt-2.5 dark:border-primary-700/40",children:[t.map((n,f)=>o(n,f,a)),r.length>0&&jsxRuntime.jsx("span",{className:"flex-1"}),r.map((n,f)=>o(n,f,l))]})}function en({item:e,isActive:t,animated:r,visible:a,orientation:l}){let o=e.status??"pending",n={complete:"bg-gradient-to-br from-white to-success-50/40 dark:from-primary-900 dark:to-success-900/10",active:"bg-gradient-to-br from-white to-primary-50/60 dark:from-primary-900 dark:to-primary-800/40",error:"bg-gradient-to-br from-white to-danger-50/40 dark:from-primary-900 dark:to-danger-900/10",pending:"bg-white dark:bg-primary-900"}[o],f={complete:"border-success-200/70 dark:border-success-800/50",active:"border-primary-300/80 dark:border-primary-600/70",error:"border-danger-200/70 dark:border-danger-800/50",pending:"border-primary-200/60 dark:border-primary-700/50"}[o],m=t?"shadow-lg shadow-primary-300/30 dark:shadow-primary-500/20":o==="complete"?"shadow-md shadow-success-300/20 dark:shadow-success-400/10":o==="error"?"shadow-md shadow-danger-300/20 dark:shadow-danger-400/10":"shadow-sm shadow-primary-100/50 dark:shadow-black/20",d=o==="complete"?"conic-gradient(from 30deg, transparent 0%, var(--tl-glow-complete-1) 18%, var(--tl-glow-complete-2) 30%, var(--tl-holo-cyan) 44%, transparent 60%)":o==="error"?"conic-gradient(from 150deg, transparent 0%, var(--tl-glow-error-1) 18%, var(--tl-glow-error-2) 32%, var(--tl-glow-error-3) 44%, transparent 58%)":null,v={complete:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",active:"bg-primary-100 text-primary-700 dark:bg-primary-800/60 dark:text-primary-300",error:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",pending:"bg-secondary-100 text-secondary-600 dark:bg-primary-800/50 dark:text-secondary-400"}[o];return jsxRuntime.jsxs("div",{className:c("relative isolate",r&&"transition-all duration-700",r?a?"opacity-100 translate-y-0":l==="vertical"?"opacity-0 translate-y-6":"opacity-0 translate-x-6":"",l==="horizontal"?"w-56 shrink-0":"flex-1",e.className),children:[!t&&d&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute animate-[tl-glow-pulse_5s_ease-in-out_infinite]",style:{inset:"-6px",borderRadius:"1.5rem",zIndex:-1,background:d,filter:"blur(14px)",opacity:.22},"aria-hidden":true}),t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-7px",borderRadius:"1.5rem",zIndex:-1,background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, var(--tl-holo-base) 0%, var(--tl-holo-indigo) 18%, var(--tl-holo-violet) 30%, var(--tl-holo-cyan) 45%, var(--tl-holo-mid) 62%, var(--tl-holo-base) 100%)",filter:"blur(10px)",animation:"tl-breathe 2.8s ease-in-out infinite, tl-holo-spin 9s linear infinite"},"aria-hidden":true}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-1.5px",borderRadius:"1.0625rem",zIndex:-1,padding:"1.5px",background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, transparent 0deg, var(--tl-holo-indigo) 55deg, var(--tl-holo-violet) 85deg, var(--tl-holo-cyan) 115deg, transparent 175deg, transparent 360deg)",WebkitMask:"linear-gradient(white 0 0) content-box, linear-gradient(white 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude",animation:"tl-holo-spin 5s linear infinite"},"aria-hidden":true})]}),jsxRuntime.jsx("div",{className:c("relative overflow-hidden rounded-2xl border backdrop-blur-[2px]",t?"border-transparent":c("border",f),n,m),children:e.imagePosition==="left"&&e.image?jsxRuntime.jsxs("div",{className:"flex min-h-[8rem]",children:[jsxRuntime.jsx("a",{href:e.image,target:"_blank",rel:"noopener noreferrer",className:"w-28 shrink-0 overflow-hidden",onClick:i=>i.stopPropagation(),"aria-label":e.title,children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-full w-full object-cover transition-transform duration-500 hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.date&&jsxRuntime.jsx("span",{className:c("mb-2 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",v),children:e.date}),jsxRuntime.jsx("h3",{className:c("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(Zr,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(Jr,{actions:e.actions})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.image&&jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-32 w-full object-cover transition-transform duration-500 hover:scale-105"})}),e.svg&&!e.image&&jsxRuntime.jsx("div",{className:"flex items-center justify-center bg-primary-50/60 p-4 dark:bg-primary-800/40",children:e.svg}),jsxRuntime.jsxs("div",{className:c("p-4",(e.image||e.svg)&&"pt-3"),children:[e.date&&jsxRuntime.jsx("span",{className:c("mb-2.5 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",v),children:e.date}),jsxRuntime.jsx("h3",{className:c("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(Zr,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(Jr,{actions:e.actions})]})]})})]})}function cr({items:e,orientation:t="vertical",activeIndex:r,animated:a=true,lineStyle:l="solid",className:o}){let n=Pr.useRef(null),f=Pr.useRef([]),[m,d]=Pr.useState(new Set);Pr.useEffect(()=>{if(!a){d(new Set(e.map((i,p)=>p)));return}let b=new IntersectionObserver(i=>{d(p=>{let P=new Set(p);return i.forEach(w=>{let L=Number(w.target.dataset.idx);w.isIntersecting&&P.add(L);}),P});},{threshold:.15});return f.current.forEach(i=>i&&b.observe(i)),()=>b.disconnect()},[e,a]),Pr.useEffect(()=>{if(r==null)return;let b=f.current[r];b&&b.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[r]);let v=l==="dashed"?"border-dashed":"";return t==="vertical"?jsxRuntime.jsxs("div",{ref:n,className:c("relative",o),children:[jsxRuntime.jsx("div",{className:"absolute left-5 top-0 h-full w-px bg-primary-200 dark:bg-primary-700"}),jsxRuntime.jsx("div",{className:"space-y-6",children:e.map((b,i)=>{let p=b.status??"pending",P=i===r;return jsxRuntime.jsxs("div",{ref:w=>{f.current[i]=w;},"data-idx":i,className:"relative flex gap-4",children:[jsxRuntime.jsx("div",{className:"relative z-10 flex shrink-0 flex-col items-center",children:jsxRuntime.jsx("div",{className:c("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 [&_svg]:shrink-0",Gr[p],P&&qr[p]),children:jsxRuntime.jsx(Qr,{status:p,icon:b.icon})})}),jsxRuntime.jsx(en,{item:b,isActive:P,animated:a,visible:m.has(i),orientation:"vertical"})]},b.id??i)})})]}):jsxRuntime.jsx("div",{ref:n,className:c("relative overflow-x-auto pb-4",o),children:jsxRuntime.jsx("div",{className:"flex min-w-max gap-6 px-4",children:e.map((b,i)=>{let p=b.status??"pending",P=i===r,w=i===e.length-1;return jsxRuntime.jsxs("div",{ref:L=>{f.current[i]=L;},"data-idx":i,className:"relative flex flex-col items-center gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:c("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 z-10 [&_svg]:shrink-0",Gr[p],P&&qr[p]),children:jsxRuntime.jsx(Qr,{status:p,icon:b.icon})}),!w&&jsxRuntime.jsx("div",{className:c("h-px w-28 border-t-2",v,p==="complete"?"border-success-400":"border-primary-200 dark:border-primary-700")})]}),jsxRuntime.jsx(en,{item:b,isActive:P,animated:a,visible:m.has(i),orientation:"horizontal"})]},b.id??i)})})})}function xt(e="en-US",t="long"){return Array.from({length:12},(r,a)=>new Intl.DateTimeFormat(e,{month:t}).format(new Date(2e3,a,1)))}function tn(e="en-US",t="narrow"){let r=new Date(2e3,0,2);return Array.from({length:7},(a,l)=>{let o=new Date(r);return o.setDate(r.getDate()+l),new Intl.DateTimeFormat(e,{weekday:t}).format(o)})}function rn(e,t=true,r=true){return e==="date"?"YYYY-MM-DD":e==="time"?t?r?"HH:mm:ss":"HH:mm":r?"hh:mm:ss A":"hh:mm A":t?r?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm":r?"YYYY-MM-DD hh:mm:ss A":"YYYY-MM-DD hh:mm A"}function eo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nn(e,t,r="en-US"){let a=e.getHours(),l=xt(r,"long"),o=xt(r,"short"),n={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MMMM:l[e.getMonth()],MMM:o[e.getMonth()],MM:String(e.getMonth()+1).padStart(2,"0"),M:String(e.getMonth()+1),DD:String(e.getDate()).padStart(2,"0"),D:String(e.getDate()),HH:String(a).padStart(2,"0"),H:String(a),hh:String(a%12||12).padStart(2,"0"),h:String(a%12||12),mm:String(e.getMinutes()).padStart(2,"0"),ss:String(e.getSeconds()).padStart(2,"0"),A:a<12?"AM":"PM",a:a<12?"am":"pm"},f=Object.keys(n).sort((d,v)=>v.length-d.length),m=new RegExp(f.map(eo).join("|"),"g");return t.replace(m,d=>n[d]??d)}function ft(e,t){return new Date(e,t+1,0).getDate()}function an(e,t){let r=new Date(e,t,1).getDay(),a=ft(e,t),l=ft(e,t-1),o=[];for(let f=r-1;f>=0;f--)o.push({date:new Date(e,t-1,l-f),thisMonth:false});for(let f=1;f<=a;f++)o.push({date:new Date(e,t,f),thisMonth:true});let n=42-o.length;for(let f=1;f<=n;f++)o.push({date:new Date(e,t+1,f),thisMonth:false});return o}function gt(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function dr(e,t){return gt(e).getTime()===gt(t).getTime()}function on(e,t){return gt(e)<gt(t)}function sn(e,t){return gt(e)>gt(t)}function It(e,t,r){return t&&e<t?new Date(t):r&&e>r?new Date(r):e}function ln(e,t,r,a){let l=new Date(e),n=t*(a==="future"?1:-1);switch(r){case "day":l.setDate(l.getDate()+n);break;case "week":l.setDate(l.getDate()+n*7);break;case "month":l.setMonth(l.getMonth()+n);break;case "year":l.setFullYear(l.getFullYear()+n);break}return l}function cn(e,t=200){let r=e-Math.floor(t/2);return Array.from({length:t},(a,l)=>r+l)}function dn(e){let{value:t,defaultValue:r,onChange:a,mode:l="datetime",minDate:o,maxDate:n,use24Hour:f=true,showSeconds:m=true,locale:d="en-US",format:v,onOpen:b,onClose:i}=e,p=t!==void 0,[P,w]=Pr.useState(r??null),L=p?t??null:P,[T,R]=Pr.useState(false),[F,H]=Pr.useState(()=>L??new Date),[j,le]=Pr.useState("drum"),[x,C]=Pr.useState(()=>(L??new Date).getFullYear()),[S,A]=Pr.useState(()=>(L??new Date).getMonth()),[u,V]=Pr.useState(1),[W,ie]=Pr.useState("day"),[G,be]=Pr.useState("future"),U=v??rn(l,f,m),ue=L?nn(L,U,d):"",Pe=Pr.useCallback(()=>{let E=L??new Date;H(new Date(E)),C(E.getFullYear()),A(E.getMonth()),le("drum"),R(true),b?.();},[L,b]),ye=Pr.useCallback(()=>{R(false),i?.();},[i]),X=Pr.useCallback(()=>{let E=It(F,o,n);p||w(E),a?.(E),ye();},[F,o,n,p,a,ye]),he=Pr.useCallback(()=>{p||w(null),a?.(null),ye();},[p,a,ye]),ce=Pr.useCallback((E,J)=>{H(ee=>{let B=new Date(ee);switch(E){case "year":B.setFullYear(J);break;case "month":{B.setMonth(J);let ne=ft(B.getFullYear(),J);B.getDate()>ne&&B.setDate(ne);break}case "day":B.setDate(J);break;case "hour":B.setHours(J);break;case "minute":B.setMinutes(J);break;case "second":B.setSeconds(J);break}return It(B,o,n)});},[o,n]),Te=Pr.useCallback(()=>{let E=It(ln(new Date,u,W,G),o,n);H(E),C(E.getFullYear()),A(E.getMonth());},[u,W,G,o,n]),Re=Pr.useCallback(E=>{let J=S+E,ee=x;J<0&&(J=11,ee--),J>11&&(J=0,ee++),A(J),C(ee);},[S,x]);return {isOpen:T,displayValue:ue,workingDate:F,view:j,calYear:x,calMonth:S,offsetAmount:u,offsetUnit:W,offsetDirection:G,mode:l,use24Hour:f,showSeconds:m,locale:d,minDate:o,maxDate:n,openPicker:Pe,closePicker:ye,confirm:X,clear:he,updateField:ce,setView:le,setCalYear:C,setCalMonth:A,setOffsetAmount:V,setOffsetUnit:ie,setOffsetDirection:be,applyQuickOffset:Te,navigateCalendar:Re}}var wt=40;function pn(e,t,r=true){let a=Pr.useRef(t);a.current=t,Pr.useEffect(()=>{if(!r)return;function l(o){let n=o.target;e.some(m=>m.current?.contains(n))||a.current();}return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[e,r]);}function fn(e,t,r){let a=Pr.useRef(false),l=Pr.useRef(void 0),o=Pr.useRef(r);o.current=r;let n=Pr.useRef(t);n.current=t;let f=Pr.useCallback((d,v="smooth")=>{let b=e.current;if(!b)return;let i=d*wt;Math.abs(b.scrollTop-i)<2&&v!=="instant"||(v==="instant"?b.scrollTop=i:b.scrollTo({top:i,behavior:v}));},[e]),m=Pr.useCallback(()=>{e.current&&(a.current=true,clearTimeout(l.current),l.current=setTimeout(()=>{a.current=false;let v=e.current;if(!v)return;let b=Math.round(v.scrollTop/wt),i=Math.max(0,Math.min(n.current-1,b)),p=i*wt;Math.abs(v.scrollTop-p)>1&&v.scrollTo({top:p,behavior:"smooth"}),o.current(i);},120));},[e]);return {scrollToIndex:f,handleScroll:m,isScrollingRef:a}}function gn(e,t,r){Pr.useEffect(()=>{if(!r)return;function a(){let o=e.current,n=t.current;if(!o||!n)return;if(window.innerWidth<=640){n.style.top="",n.style.left="";return}let f=o.getBoundingClientRect(),m=window.innerHeight,d=window.innerWidth,v=n.offsetHeight||460,b=n.offsetWidth||340,i=f.bottom+8,p=f.left;i+v>m-16&&(i=Math.max(16,f.top-v-8)),p+b>d-16&&(p=Math.max(16,d-b-16)),p<16&&(p=16),n.style.top=`${Math.round(i)}px`,n.style.left=`${Math.round(p)}px`;}let l=setTimeout(a,0);return window.addEventListener("resize",a),window.addEventListener("scroll",a,true),()=>{clearTimeout(l),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,true);}},[r,e,t]);}function qe({items:e,selectedValue:t,onSelect:r,label:a}){let l=Pr.useRef(null),o=Pr.useRef(t),n=Pr.useRef(false),{scrollToIndex:f,handleScroll:m}=fn(l,e.length,d=>{let v=e[d];v&&(n.current=true,r(v.value),setTimeout(()=>{n.current=false;},200));});return Pr.useEffect(()=>{let d=l.current;if(!d)return;let v=e.findIndex(b=>b.value===t);v>=0&&(d.scrollTop=v*wt);},[]),Pr.useEffect(()=>{if(o.current!==t&&(o.current=t,!n.current)){let d=e.findIndex(v=>v.value===t);d>=0&&f(d,"smooth");}},[t,e,f]),jsxRuntime.jsxs("div",{className:"dtp-column",role:"group","aria-label":a,children:[jsxRuntime.jsx("div",{className:"dtp-column-highlight","aria-hidden":"true"}),jsxRuntime.jsx("div",{ref:l,className:"dtp-column-list",onScroll:m,role:"listbox","aria-label":a,children:e.map(d=>jsxRuntime.jsx("div",{className:c("dtp-item",d.value===t&&"dtp-item--selected"),onClick:()=>{let v=e.findIndex(b=>b.value===d.value);v>=0&&f(v,"smooth"),r(d.value);},role:"option","aria-selected":d.value===t,children:d.label},d.value))}),jsxRuntime.jsx("div",{className:"dtp-fade-top","aria-hidden":"true"}),jsxRuntime.jsx("div",{className:"dtp-fade-bottom","aria-hidden":"true"})]})}function so({year:e,month:t,selectedDate:r,today:a,minDate:l,maxDate:o,locale:n,onSelectDay:f,onPrev:m,onNext:d}){let v=tn(n,"narrow"),b=xt(n,"long"),i=an(e,t);return jsxRuntime.jsxs("div",{className:"dtp-calendar",children:[jsxRuntime.jsxs("div",{className:"dtp-cal-nav",children:[jsxRuntime.jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:m,"aria-label":"Previous month",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-4 w-4"})}),jsxRuntime.jsxs("span",{className:"dtp-cal-title",children:[b[t]," ",e]}),jsxRuntime.jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:d,"aria-label":"Next month",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"dtp-cal-weekdays",role:"row",children:v.map((p,P)=>jsxRuntime.jsx("div",{className:"dtp-cal-weekday",role:"columnheader","aria-label":p,children:p},P))}),jsxRuntime.jsx("div",{className:"dtp-cal-days",role:"grid",children:i.map(({date:p,thisMonth:P},w)=>{let L=dr(p,r),T=dr(p,a),R=l!=null&&on(p,l)||o!=null&&sn(p,o);return jsxRuntime.jsx("button",{type:"button",role:"gridcell",className:c("dtp-cal-day",!P&&"dtp-cal-day--other",L&&"dtp-cal-day--selected",T&&!L&&"dtp-cal-day--today",R&&"dtp-cal-day--disabled"),onClick:()=>!R&&f(p),disabled:R,"aria-current":T?"date":void 0,"aria-selected":L,"aria-disabled":R,children:p.getDate()},w)})})]})}function io({amount:e,unit:t,direction:r,onAmountChange:a,onUnitChange:l,onDirectionChange:o,onApply:n,locale:f}){let m=f.startsWith("zh"),d=[{value:"day",label:m?"\u5929":"Day"},{value:"week",label:m?"\u5468":"Week"},{value:"month",label:m?"\u6708":"Month"},{value:"year",label:m?"\u5E74":"Year"}],v=[{value:"future",label:m?"\u4EE5\u540E":"from now"},{value:"past",label:m?"\u4EE5\u524D":"before now"}];return jsxRuntime.jsxs("div",{className:"dtp-quick-offset","aria-label":m?"\u5FEB\u901F\u504F\u79FB":"Quick offset",children:[jsxRuntime.jsx("input",{type:"number",className:"dtp-offset-input",value:e,min:1,max:9999,"aria-label":m?"\u504F\u79FB\u6570\u91CF":"Offset amount",onChange:b=>{let i=parseInt(b.target.value,10);!isNaN(i)&&i>=1&&a(i);}}),jsxRuntime.jsx("select",{className:"dtp-offset-select",value:t,"aria-label":m?"\u504F\u79FB\u5355\u4F4D":"Offset unit",onChange:b=>l(b.target.value),children:d.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),jsxRuntime.jsx("select",{className:"dtp-offset-select",value:r,"aria-label":m?"\u504F\u79FB\u65B9\u5411":"Offset direction",onChange:b=>o(b.target.value),children:v.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),jsxRuntime.jsx("button",{type:"button",className:"dtp-offset-apply",onClick:n,children:m?"\u5E94\u7528":"Apply"})]})}function _t({className:e,popupClassName:t,triggerClassName:r,disabled:a=false,placeholder:l,...o}){let{isOpen:n,displayValue:f,workingDate:m,view:d,calYear:v,calMonth:b,offsetAmount:i,offsetUnit:p,offsetDirection:P,mode:w,use24Hour:L,showSeconds:T,locale:R,minDate:F,maxDate:H,openPicker:j,closePicker:le,confirm:x,clear:C,updateField:S,setView:A,setCalYear:u,setCalMonth:V,setOffsetAmount:W,setOffsetUnit:ie,setOffsetDirection:G,applyQuickOffset:be,navigateCalendar:U}=dn({...o}),ue=Pr.useRef(null),Pe=Pr.useRef(null),ye=new Date;pn([ue,Pe],le,n),gn(ue,Pe,n);let X=R.startsWith("zh"),he={cancel:X?"\u53D6\u6D88":"Cancel",confirm:X?"\u786E\u5B9A":"Confirm",calendarView:X?"\u65E5\u5386":"Calendar",scrollView:X?"\u6EDA\u8F6E":"Scroll",placeholder:l??(X?"\u9009\u62E9\u65E5\u671F\u65F6\u95F4":"Select date / time")},ce=w==="date"||w==="datetime",Te=w==="time"||w==="datetime",Re=cn(m.getFullYear(),200).map(I=>({label:String(I),value:I})),E=xt(R,"short").map((I,te)=>({label:I,value:te})),J=ft(m.getFullYear(),m.getMonth()),ee=Array.from({length:J},(I,te)=>({label:String(te+1).padStart(2,"0"),value:te+1})),B=Array.from({length:24},(I,te)=>({label:String(te).padStart(2,"0"),value:te})),ne=Array.from({length:12},(I,te)=>({label:String(te===0?12:te).padStart(2,"0"),value:te})),we=[{label:"AM",value:0},{label:"PM",value:1}],Se=Array.from({length:60},(I,te)=>({label:String(te).padStart(2,"0"),value:te})),Y=m.getHours(),Ye=Y%12,ae=Y<12?0:1,ve=Te&&!ce?lucideReact.Clock:lucideReact.Calendar;return jsxRuntime.jsxs("div",{className:c("dtp-root",e),children:[jsxRuntime.jsxs("div",{className:"dtp-trigger-wrap",children:[jsxRuntime.jsxs("button",{ref:ue,type:"button",className:c("dtp-trigger",f&&"dtp-trigger--has-clear",a&&"dtp-trigger--disabled",r),onClick:()=>!a&&(n?le():j()),disabled:a,"aria-haspopup":"dialog","aria-expanded":n,children:[jsxRuntime.jsx(ve,{className:"dtp-trigger-icon","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:c("dtp-trigger-text",!f&&"dtp-trigger-placeholder"),children:f||he.placeholder})]}),f&&jsxRuntime.jsx("button",{type:"button",className:"dtp-trigger-clear","aria-label":X?"\u6E05\u9664":"Clear value",onClick:()=>!a&&C(),children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]}),n&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:Pe,className:c("dtp-panel",t),role:"dialog","aria-modal":"true","aria-label":X?"\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668":"Date time picker",children:[jsxRuntime.jsxs("div",{className:"dtp-panel-header",children:[jsxRuntime.jsx("span",{className:"dtp-panel-preview",children:f||he.placeholder}),jsxRuntime.jsx("div",{className:"dtp-panel-actions",children:ce&&jsxRuntime.jsx("button",{type:"button",className:c("dtp-view-btn",d==="calendar"&&"dtp-view-btn--active"),"aria-pressed":d==="calendar",title:d==="calendar"?he.scrollView:he.calendarView,onClick:()=>{d!=="calendar"&&(u(m.getFullYear()),V(m.getMonth())),A(d==="calendar"?"drum":"calendar");},children:jsxRuntime.jsx(lucideReact.Calendar,{className:"h-4 w-4"})})})]}),jsxRuntime.jsx("div",{className:"dtp-panel-body",children:d==="drum"?jsxRuntime.jsxs("div",{className:"dtp-drum",children:[ce&&jsxRuntime.jsxs("div",{className:"dtp-drum-date",children:[jsxRuntime.jsx(qe,{label:X?"\u5E74":"Year",items:Re,selectedValue:m.getFullYear(),onSelect:I=>S("year",I)}),jsxRuntime.jsx(qe,{label:X?"\u6708":"Month",items:E,selectedValue:m.getMonth(),onSelect:I=>S("month",I)}),jsxRuntime.jsx(qe,{label:X?"\u65E5":"Day",items:ee,selectedValue:m.getDate(),onSelect:I=>S("day",I)})]}),ce&&Te&&jsxRuntime.jsx("div",{className:"dtp-drum-sep","aria-hidden":"true"}),Te&&jsxRuntime.jsxs("div",{className:"dtp-drum-time",children:[L?jsxRuntime.jsx(qe,{label:X?"\u65F6":"Hour",items:B,selectedValue:Y,onSelect:I=>S("hour",I)}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qe,{label:X?"\u65F6":"Hour",items:ne,selectedValue:Ye,onSelect:I=>{S("hour",ae===1?I+12:I);}}),jsxRuntime.jsx(qe,{label:"AM/PM",items:we,selectedValue:ae,onSelect:I=>{S("hour",Ye+(I===1?12:0));}})]}),jsxRuntime.jsx(qe,{label:X?"\u5206":"Min",items:Se,selectedValue:m.getMinutes(),onSelect:I=>S("minute",I)}),T&&jsxRuntime.jsx(qe,{label:X?"\u79D2":"Sec",items:Se,selectedValue:m.getSeconds(),onSelect:I=>S("second",I)})]})]}):jsxRuntime.jsx(so,{year:v,month:b,selectedDate:m,today:ye,minDate:F,maxDate:H,locale:R,onSelectDay:I=>{S("year",I.getFullYear()),S("month",I.getMonth()),S("day",I.getDate()),A("drum");},onPrev:()=>U(-1),onNext:()=>U(1)})}),ce&&jsxRuntime.jsx("div",{className:"dtp-panel-offset",children:jsxRuntime.jsx(io,{amount:i,unit:p,direction:P,onAmountChange:W,onUnitChange:ie,onDirectionChange:G,onApply:be,locale:R})}),jsxRuntime.jsxs("div",{className:"dtp-panel-footer",children:[jsxRuntime.jsx("button",{type:"button",className:"dtp-btn-cancel",onClick:le,children:he.cancel}),jsxRuntime.jsx("button",{type:"button",className:"dtp-btn-confirm",onClick:x,children:he.confirm})]})]}),document.body)]})}var co={FilmReel:jt,MiniPlayer:Bt,CinePlayer:Kt,FileExplorer:rr,Masonry:sr,TypewriterText:Lt,CommandPalette:At,Timeline:cr,DateTimePicker:_t},_i=co;exports.CinePlayer=Kt;exports.CommandPalette=At;exports.DateTimePicker=_t;exports.Extras=co;exports.FileExplorer=rr;exports.FilmReel=jt;exports.Masonry=sr;exports.MiniPlayer=Bt;exports.Timeline=cr;exports.TypewriterText=Lt;exports.default=_i;
|
|
83
|
+
`}),jsxRuntime.jsx(uo,{open:ne,onOpenChange:Te,children:jsxRuntime.jsxs(po,{size:"sm",children:[jsxRuntime.jsxs(mo,{children:[jsxRuntime.jsxs(fo,{children:[jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxRuntime.jsxs(ho,{children:[P.size===1?`Are you sure you want to delete "${xe[Array.from(P)[0]]?.name}"?`:`Are you sure you want to delete ${P.size} selected items?`," ","This action cannot be undone."]})]}),jsxRuntime.jsxs(go,{children:[jsxRuntime.jsx(Pt,{intent:"ghost",onClick:()=>Te(false),children:"Cancel"}),jsxRuntime.jsxs(Pt,{intent:"danger",onClick:()=>{let k=Array.from(P).map(U=>xe[U]).filter(Boolean);p?.(k),L(new Set),D(null),Te(false);},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function Wt({label:e,value:t,mono:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsxRuntime.jsx("div",{className:v("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function Os(e,t){let r=t.getBoundingClientRect(),n=Math.max(r.width,r.height)*1.2,o=e.clientX-r.left,a=e.clientY-r.top,i=document.createElement("span");i.className="masonry-ripple",i.style.width=`${n}px`,i.style.height=`${n}px`,i.style.left=`${o}px`,i.style.top=`${a}px`,t.appendChild(i),i.addEventListener("animationend",()=>i.remove());}function gn({columns:e,columnWidth:t=240,gap:r=16,items:n,onItemClick:o,className:a,style:i,children:l,...s}){let d=Xr.useRef(null),m=Xr.useRef([]),[u,p]=Xr.useState(()=>e??1),[c,h]=Xr.useState([]),[f,g]=Xr.useState(0),b=n?n.map((P,L)=>({key:P.key??L,node:P.content})):Xr__default.default.Children.toArray(l).map((P,L)=>({key:P.key??L,node:P})),w=b.length,C=Xr.useCallback(P=>e??Math.max(1,Math.floor((P+r)/(t+r))),[e,t,r]),x=Xr.useCallback(()=>{let P=d.current;if(!P)return;let L=P.clientWidth,H=C(L);p(H);let D=(L-(H-1)*r)/H,y=new Array(H).fill(0),_=[];for(let R=0;R<w;R++){let K=m.current[R],ie=K?K.offsetHeight:0,T=0;for(let ye=1;ye<H;ye++)y[ye]<y[T]&&(T=ye);_.push({top:y[T],left:T*(D+r),width:D}),y[T]+=ie+r;}let B=Math.max(0,...y)-(w?r:0);h(_),g(B);},[w,C,r]);Xr.useEffect(()=>{let P=d.current;if(!P)return;let L=new ResizeObserver(()=>x());return L.observe(P),()=>L.disconnect()},[x]),Xr.useEffect(()=>{let P=requestAnimationFrame(x);return ()=>cancelAnimationFrame(P)},[x]),Xr.useEffect(()=>{let P=new ResizeObserver(()=>x());return m.current.forEach(L=>{L&&P.observe(L);}),()=>P.disconnect()},[w,u,x]);let M=Xr.useCallback((P,L)=>{let H=P.currentTarget;Os(P,H),o?.(n?.[L],L);},[o,n]),$=P=>{if(!n)return false;let L=n[P];return !!(L.title||L.description||L.actions)};return jsxRuntime.jsx("div",{ref:d,className:v("relative",a),style:{...i,height:f},...s,children:b.map((P,L)=>jsxRuntime.jsxs("div",{ref:H=>{m.current[L]=H;},className:"masonry-item",role:"button",tabIndex:0,onClick:H=>M(H,L),onKeyDown:H=>{(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),o?.(n?.[L],L));},style:{position:"absolute",top:c[L]?.top??0,left:c[L]?.left??0,width:c[L]?.width??"100%"},children:[P.node,$(L)&&jsxRuntime.jsxs("div",{className:"masonry-item-overlay",children:[n[L].title&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-title",children:n[L].title}),n[L].description&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-desc",children:n[L].description}),n[L].actions&&jsxRuntime.jsx("div",{className:"masonry-item-overlay-actions",children:n[L].actions})]})]},P.key))})}var Fs='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="2" y1="2" x2="22" y2="22"/><path d="M10.41 10.41a2 2 0 1 1-2.83-2.83"/><line x1="13.5" y1="6" x2="18" y2="6"/><line x1="6" y1="2" x2="14" y2="10"/><path d="M4 6h1.5"/><path d="M2 18.5C2 19.9 3.1 21 4.5 21H16"/><rect x="2" y="2" width="20" height="20" rx="5" ry="5"/></svg>';function Cr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Bs(e){return e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,"").replace(/\s+on[a-z][a-z0-9]*\s*=\s*(?:"[^"]*"|'[^']*'|[^\s/>]*)/gi,"").replace(/\b(href|src|action)\s*=\s*["']\s*(?:javascript|vbscript)\s*:[^"'>]*/gi,'$1="#"').replace(/\bhref\s*=\s*["']\s*data\s*:[^"'>]*/gi,'href="#"')}var zo=new marked.Marked;zo.use({renderer:{image({href:e,title:t,text:r}){let n=/^https?:\/\//i.test(e??"")?e:"",o=r?` alt="${Cr(r)}"`:' alt=""',a=t?` title="${Cr(t)}"`:"",i=Cr(r||"Image failed to load");return `<figure class="tw-rich-img-wrap"><img class="tw-rich-img" src="${Cr(n)}" loading="lazy"${o}${a} /><div class="tw-rich-img-error">`+Fs+`<span>${i}</span></div></figure>`}}});function Lo(e){let t=zo.parse(e,{async:false});return Bs(t)}function Er({text:e="",mode:t="typewriter",speed:r=40,cursor:n=true,cursorChar:o="\u258B",thinking:a=false,streaming:i=false,delay:l=0,onComplete:s,as:d="span",className:m,rich:u=false}){let[p,c]=Xr.useState(t==="instant"?e:""),[h,f]=Xr.useState(false),[g,b]=Xr.useState(t==="instant"),[w,C]=Xr.useState(false),x=Xr.useRef(null),M=Xr.useRef(0),$=Xr.useRef(s);$.current=s;let P=Xr.useRef(e);P.current=e,Xr.useEffect(()=>{if(t!=="typewriter")return;if(c(""),b(false),C(false),f(false),!e){b(true);return}let _=Math.max(10,1e3/r),B=0,R,K=()=>{f(true),R=setInterval(()=>{let T=P.current;B++,c(T.slice(0,B)),B>=T.length&&(clearInterval(R),f(false),b(true),$.current?.());},_);},ie;return l>0?ie=setTimeout(K,l):K(),()=>{clearTimeout(ie),clearInterval(R);}},[e,t]),Xr.useEffect(()=>{if(t!=="stream")return;if(e.length===0){M.current=0,c(""),f(false),b(false),C(false);return}if(e.length<=M.current)return;let _=Math.max(10,1e3/r),B=M.current;f(true),b(false),C(false);let R=setInterval(()=>{B++,M.current=B,c(P.current.slice(0,B)),B>=P.current.length&&(clearInterval(R),f(false),$.current?.());},_);return ()=>clearInterval(R)},[e,t]),Xr.useEffect(()=>{t==="instant"&&(c(e),f(false),b(true));},[e,t]);let L=Xr.useRef(i);Xr.useEffect(()=>{let _=L.current;if(L.current=i,_&&!i&&!h&&t==="stream"){C(true);let B=setTimeout(()=>{C(false),b(true);},650);return ()=>clearTimeout(B)}},[i,h,t]),Xr.useEffect(()=>{if(!u||!x.current)return;let B=Array.from(x.current.querySelectorAll(".tw-rich-img")).map(R=>{let K=()=>{let ie=R.closest(".tw-rich-img-wrap");ie&&ie.classList.add("tw-rich-img-wrap--error");};return R.addEventListener("error",K,{once:true}),{img:R,onError:K}});return ()=>{B.forEach(({img:R,onError:K})=>R.removeEventListener("error",K));}},[p,u]);let H=n&&(a||h||w||t==="stream"&&i&&!g||t==="typewriter"&&!g),D=a?"tw-cursor--blink":h?"tw-cursor--solid":w?"tw-cursor--out":"tw-cursor--blink",y=d;return u?jsxRuntime.jsxs("div",{role:"region",className:v(m),children:[jsxRuntime.jsx("div",{ref:x,className:"tw-rich-prose",dangerouslySetInnerHTML:{__html:Lo(p)}}),H&&jsxRuntime.jsx("span",{className:v("tw-cursor",D),"aria-hidden":"true",children:o})]}):jsxRuntime.jsxs(y,{className:v(m),children:[a&&!p&&jsxRuntime.jsx("span",{"aria-hidden":"true",children:"\u200B"}),p,H&&jsxRuntime.jsx("span",{className:v("tw-cursor",D),"aria-hidden":"true",children:o})]})}function Pr(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function Vs(e,t){if(!t)return true;let r=Pr(t);return Pr(e.label).includes(r)||(e.description?Pr(e.description).includes(r):false)||(e.keywords?e.keywords.some(n=>Pr(n).includes(r)):false)}function js(e){let t=new Map;for(let r of e){let n=r.group??"";t.has(n)||t.set(n,[]),t.get(n).push(r);}return Array.from(t.entries()).map(([r,n])=>({label:r,items:n}))}function $o(e,t,r,n){let[o,a]=Xr.useState(""),[i,l]=Xr.useState(0);Xr.useEffect(()=>{t&&(a(""),l(0));},[t]);let s=Xr.useMemo(()=>e.filter(p=>!p.disabled&&Vs(p,o)),[e,o]),d=Xr.useMemo(()=>js(s),[s]);Xr.useEffect(()=>{l(p=>Math.min(p,Math.max(0,s.length-1)));},[s.length]);let m=Xr.useCallback(()=>{let p=s[i];p&&(p.onSelect(),r(false));},[s,i,r]),u=Xr.useCallback(p=>{switch(p.key){case "ArrowDown":p.preventDefault(),l(c=>(c+1)%Math.max(1,s.length));break;case "ArrowUp":p.preventDefault(),l(c=>(c-1+Math.max(1,s.length))%Math.max(1,s.length));break;case "Enter":p.preventDefault(),m();break;case "Escape":p.preventDefault(),r(false);break}},[s.length,m,r]);return Xr.useEffect(()=>{if(!n)return;function p(c){(c.metaKey||c.ctrlKey)&&c.key==="k"&&(c.preventDefault(),r(!t));}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[n,t,r]),{query:o,setQuery:a,groups:d,filtered:s,activeIndex:i,setActiveIndex:l,handleKeyDown:u}}function Rr({open:e,onOpenChange:t,commands:r,placeholder:n="Type a command or search\u2026",hotkey:o=true,maxItems:a=8,className:i}){let l=Xr.useRef(null),s=Xr.useRef(null),{query:d,setQuery:m,groups:u,filtered:p,activeIndex:c,setActiveIndex:h,handleKeyDown:f}=$o(r,e,t,o);if(Xr.useEffect(()=>{if(e){let b=setTimeout(()=>l.current?.focus(),40);return ()=>clearTimeout(b)}},[e]),Xr.useEffect(()=>{s.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[c]),!e)return null;let g=0;return reactDom.createPortal(jsxRuntime.jsx("div",{className:"cmd-backdrop fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:()=>t(false),role:"presentation",children:jsxRuntime.jsxs("div",{className:v("cmd-panel relative flex w-full max-w-lg flex-col overflow-hidden rounded-xl","border border-primary-200 bg-white shadow-2xl","dark:border-primary-700 dark:bg-primary-900",i),onClick:b=>b.stopPropagation(),onKeyDown:f,role:"dialog","aria-label":"Command palette","aria-modal":"true",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 border-b border-primary-100 px-4 dark:border-primary-700",children:[jsxRuntime.jsx(lucideReact.Search,{className:"h-4 w-4 shrink-0 text-secondary-400","aria-hidden":"true"}),jsxRuntime.jsx("input",{ref:l,value:d,onChange:b=>m(b.target.value),placeholder:n,className:"flex-1 bg-transparent py-3.5 text-sm text-primary-900 outline-none placeholder:text-secondary-400 dark:text-primary-50","aria-label":"Search commands","aria-controls":"cmd-results","aria-autocomplete":"list","aria-activedescendant":p[c]?`cmd-item-${p[c].id}`:void 0,spellCheck:false,autoComplete:"off"}),jsxRuntime.jsx("kbd",{className:"hidden shrink-0 rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-400 dark:border-primary-600 sm:block",children:"esc"})]}),jsxRuntime.jsx("div",{id:"cmd-results",ref:s,className:"overflow-y-auto py-2",style:{maxHeight:`${a*2.75}rem`},role:"listbox","aria-label":"Commands",children:p.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-sm text-secondary-400",children:[jsxRuntime.jsx(lucideReact.Command,{className:"h-8 w-8 opacity-30"}),jsxRuntime.jsx("span",{children:"No commands found"})]}):u.map(b=>jsxRuntime.jsxs("div",{className:"mb-1 last:mb-0",children:[b.label&&jsxRuntime.jsx("p",{className:"px-4 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-secondary-400 dark:text-secondary-500",children:b.label}),b.items.map(w=>{let C=g++,x=C===c;return jsxRuntime.jsxs("button",{id:`cmd-item-${w.id}`,"data-active":x,role:"option","aria-selected":x,className:v("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",x?"bg-primary-100 text-primary-900 dark:bg-primary-800 dark:text-primary-50":"text-primary-700 hover:bg-primary-50 dark:text-primary-300 dark:hover:bg-primary-800/50"),onMouseEnter:()=>h(C),onClick:()=>{w.onSelect(),t(false);},children:[w.icon&&jsxRuntime.jsx("span",{className:v("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",x?"border-primary-300 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-700 dark:text-primary-200":"border-primary-200 bg-primary-50 text-primary-500 dark:border-primary-700 dark:bg-primary-800 dark:text-primary-400"),children:w.icon}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate font-medium",children:w.label}),w.description&&jsxRuntime.jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:w.description})]}),w.shortcut&&jsxRuntime.jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:w.shortcut.map((M,$)=>jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-500 dark:border-primary-700 dark:text-secondary-400",children:M},$))})]},w.id)})]},b.label||"_default"))}),p.length>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between border-t border-primary-100 px-4 py-2 dark:border-primary-700",children:[jsxRuntime.jsxs("span",{className:"text-xs text-secondary-400",children:[p.length," result",p.length!==1?"s":""]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-3 text-xs text-secondary-400",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2191"}),jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2193"}),"Navigate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u21B5"}),"Select"]})]})]})]})}),document.body)}var Uo={complete:"bg-success-500 border-success-500 text-white dark:bg-success-600 dark:border-success-600",active:"bg-primary-500 border-primary-500 text-white dark:bg-primary-400 dark:border-primary-400",error:"bg-danger-500 border-danger-500 text-white dark:bg-danger-600 dark:border-danger-600",pending:"bg-white border-primary-300 text-secondary-400 dark:bg-primary-800 dark:border-primary-600"},Ko={complete:"shadow-[0_0_0_4px_theme(colors.success.100)] dark:shadow-[0_0_0_4px_theme(colors.success.900/30)]",active:"shadow-[0_0_0_4px_theme(colors.primary.100)] dark:shadow-[0_0_0_4px_theme(colors.primary.800/50)] animate-pulse",error:"shadow-[0_0_0_4px_theme(colors.danger.100)] dark:shadow-[0_0_0_4px_theme(colors.danger.900/30)]",pending:""};function Wo({status:e,icon:t}){return t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:t}):e==="complete"?jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"}):e==="error"?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"h-3 w-3"}):e==="active"?jsxRuntime.jsx(lucideReact.Dot,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Clock,{className:"h-3 w-3"})}function Yo({images:e,title:t}){let r=e.slice(0,4),n=e.length>4?e.length-4:0,o=(a,i,l)=>jsxRuntime.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:v("relative block overflow-hidden",l),onClick:s=>s.stopPropagation(),children:[jsxRuntime.jsx("img",{src:a,alt:`${t} ${i+1}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105"}),i===r.length-1&&n>0&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60",children:jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white",children:["+",n]})})]},i);return r.length===0?null:r.length===1?jsxRuntime.jsx("div",{className:"mt-2.5 h-36 overflow-hidden rounded-xl",children:o(r[0],0,"h-full")}):r.length===2?jsxRuntime.jsx("div",{className:"mt-2.5 grid h-28 grid-cols-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((a,i)=>o(a,i))}):r.length===3?jsxRuntime.jsxs("div",{className:"mt-2.5 grid h-36 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:[o(r[0],0,"row-span-2"),o(r[1],1),o(r[2],2)]}):jsxRuntime.jsx("div",{className:"mt-2.5 grid h-44 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((a,i)=>o(a,i))})}function qo({actions:e}){let t=e.filter(i=>i.variant!=="primary"),r=e.filter(i=>i.variant==="primary"),n="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium text-secondary-500 transition-colors hover:bg-secondary-100/80 hover:text-secondary-700 dark:text-secondary-400 dark:hover:bg-primary-800/60 dark:hover:text-secondary-200",o="inline-flex items-center gap-1.5 rounded-lg border border-primary-200/70 bg-primary-50/80 px-3 py-1 text-xs font-semibold text-primary-700 transition-colors hover:bg-primary-100 dark:border-primary-600/60 dark:bg-primary-800/60 dark:text-primary-300 dark:hover:bg-primary-700/60",a=(i,l,s)=>i.href?jsxRuntime.jsxs("a",{href:i.href,target:"_blank",rel:"noopener noreferrer",className:s,onClick:d=>d.stopPropagation(),children:[i.icon,i.label]},l):jsxRuntime.jsxs("button",{type:"button",onClick:i.onClick,className:s,children:[i.icon,i.label]},l);return jsxRuntime.jsxs("div",{className:"mt-3 flex items-center gap-1 border-t border-primary-100/50 pt-2.5 dark:border-primary-700/40",children:[t.map((i,l)=>a(i,l,n)),r.length>0&&jsxRuntime.jsx("span",{className:"flex-1"}),r.map((i,l)=>a(i,l,o))]})}function Xo({item:e,isActive:t,animated:r,visible:n,orientation:o}){let a=e.status??"pending",i={complete:"bg-gradient-to-br from-white to-success-50/40 dark:from-primary-900 dark:to-success-900/10",active:"bg-gradient-to-br from-white to-primary-50/60 dark:from-primary-900 dark:to-primary-800/40",error:"bg-gradient-to-br from-white to-danger-50/40 dark:from-primary-900 dark:to-danger-900/10",pending:"bg-white dark:bg-primary-900"}[a],l={complete:"border-success-200/70 dark:border-success-800/50",active:"border-primary-300/80 dark:border-primary-600/70",error:"border-danger-200/70 dark:border-danger-800/50",pending:"border-primary-200/60 dark:border-primary-700/50"}[a],s=t?"shadow-lg shadow-primary-300/30 dark:shadow-primary-500/20":a==="complete"?"shadow-md shadow-success-300/20 dark:shadow-success-400/10":a==="error"?"shadow-md shadow-danger-300/20 dark:shadow-danger-400/10":"shadow-sm shadow-primary-100/50 dark:shadow-black/20",d=a==="complete"?"conic-gradient(from 30deg, transparent 0%, var(--tl-glow-complete-1) 18%, var(--tl-glow-complete-2) 30%, var(--tl-holo-cyan) 44%, transparent 60%)":a==="error"?"conic-gradient(from 150deg, transparent 0%, var(--tl-glow-error-1) 18%, var(--tl-glow-error-2) 32%, var(--tl-glow-error-3) 44%, transparent 58%)":null,m={complete:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",active:"bg-primary-100 text-primary-700 dark:bg-primary-800/60 dark:text-primary-300",error:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",pending:"bg-secondary-100 text-secondary-600 dark:bg-primary-800/50 dark:text-secondary-400"}[a];return jsxRuntime.jsxs("div",{className:v("relative isolate",r&&"transition-all duration-700",r?n?"opacity-100 translate-y-0":o==="vertical"?"opacity-0 translate-y-6":"opacity-0 translate-x-6":"",o==="horizontal"?"w-56 shrink-0":"flex-1",e.className),children:[!t&&d&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute animate-[tl-glow-pulse_5s_ease-in-out_infinite]",style:{inset:"-6px",borderRadius:"1.5rem",zIndex:-1,background:d,filter:"blur(14px)",opacity:.22},"aria-hidden":true}),t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-7px",borderRadius:"1.5rem",zIndex:-1,background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, var(--tl-holo-base) 0%, var(--tl-holo-indigo) 18%, var(--tl-holo-violet) 30%, var(--tl-holo-cyan) 45%, var(--tl-holo-mid) 62%, var(--tl-holo-base) 100%)",filter:"blur(10px)",animation:"tl-breathe 2.8s ease-in-out infinite, tl-holo-spin 9s linear infinite"},"aria-hidden":true}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-1.5px",borderRadius:"1.0625rem",zIndex:-1,padding:"1.5px",background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, transparent 0deg, var(--tl-holo-indigo) 55deg, var(--tl-holo-violet) 85deg, var(--tl-holo-cyan) 115deg, transparent 175deg, transparent 360deg)",WebkitMask:"linear-gradient(white 0 0) content-box, linear-gradient(white 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude",animation:"tl-holo-spin 5s linear infinite"},"aria-hidden":true})]}),jsxRuntime.jsx("div",{className:v("relative overflow-hidden rounded-2xl border backdrop-blur-[2px]",t?"border-transparent":v("border",l),i,s),children:e.imagePosition==="left"&&e.image?jsxRuntime.jsxs("div",{className:"flex min-h-[8rem]",children:[jsxRuntime.jsx("a",{href:e.image,target:"_blank",rel:"noopener noreferrer",className:"w-28 shrink-0 overflow-hidden",onClick:p=>p.stopPropagation(),"aria-label":e.title,children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-full w-full object-cover transition-transform duration-500 hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.date&&jsxRuntime.jsx("span",{className:v("mb-2 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",m),children:e.date}),jsxRuntime.jsx("h3",{className:v("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(Yo,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(qo,{actions:e.actions})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.image&&jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-32 w-full object-cover transition-transform duration-500 hover:scale-105"})}),e.svg&&!e.image&&jsxRuntime.jsx("div",{className:"flex items-center justify-center bg-primary-50/60 p-4 dark:bg-primary-800/40",children:e.svg}),jsxRuntime.jsxs("div",{className:v("p-4",(e.image||e.svg)&&"pt-3"),children:[e.date&&jsxRuntime.jsx("span",{className:v("mb-2.5 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",m),children:e.date}),jsxRuntime.jsx("h3",{className:v("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(Yo,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(qo,{actions:e.actions})]})]})})]})}function yn({items:e,orientation:t="vertical",activeIndex:r,animated:n=true,lineStyle:o="solid",className:a}){let i=Xr.useRef(null),l=Xr.useRef([]),[s,d]=Xr.useState(new Set);Xr.useEffect(()=>{if(!n){d(new Set(e.map((p,c)=>c)));return}let u=new IntersectionObserver(p=>{d(c=>{let h=new Set(c);return p.forEach(f=>{let g=Number(f.target.dataset.idx);f.isIntersecting&&h.add(g);}),h});},{threshold:.15});return l.current.forEach(p=>p&&u.observe(p)),()=>u.disconnect()},[e,n]),Xr.useEffect(()=>{if(r==null)return;let u=l.current[r];u&&u.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[r]);let m=o==="dashed"?"border-dashed":"";return t==="vertical"?jsxRuntime.jsxs("div",{ref:i,className:v("relative",a),children:[jsxRuntime.jsx("div",{className:"absolute left-5 top-0 h-full w-px bg-primary-200 dark:bg-primary-700"}),jsxRuntime.jsx("div",{className:"space-y-6",children:e.map((u,p)=>{let c=u.status??"pending",h=p===r;return jsxRuntime.jsxs("div",{ref:f=>{l.current[p]=f;},"data-idx":p,className:"relative flex gap-4",children:[jsxRuntime.jsx("div",{className:"relative z-10 flex shrink-0 flex-col items-center",children:jsxRuntime.jsx("div",{className:v("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 [&_svg]:shrink-0",Uo[c],h&&Ko[c]),children:jsxRuntime.jsx(Wo,{status:c,icon:u.icon})})}),jsxRuntime.jsx(Xo,{item:u,isActive:h,animated:n,visible:s.has(p),orientation:"vertical"})]},u.id??p)})})]}):jsxRuntime.jsx("div",{ref:i,className:v("relative overflow-x-auto pb-4",a),children:jsxRuntime.jsx("div",{className:"flex min-w-max gap-6 px-4",children:e.map((u,p)=>{let c=u.status??"pending",h=p===r,f=p===e.length-1;return jsxRuntime.jsxs("div",{ref:g=>{l.current[p]=g;},"data-idx":p,className:"relative flex flex-col items-center gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:v("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 z-10 [&_svg]:shrink-0",Uo[c],h&&Ko[c]),children:jsxRuntime.jsx(Wo,{status:c,icon:u.icon})}),!f&&jsxRuntime.jsx("div",{className:v("h-px w-28 border-t-2",m,c==="complete"?"border-success-400":"border-primary-200 dark:border-primary-700")})]}),jsxRuntime.jsx(Xo,{item:u,isActive:h,animated:n,visible:s.has(p),orientation:"horizontal"})]},u.id??p)})})})}function or(e="en-US",t="long"){return Array.from({length:12},(r,n)=>new Intl.DateTimeFormat(e,{month:t}).format(new Date(2e3,n,1)))}function Go(e="en-US",t="narrow"){let r=new Date(2e3,0,2);return Array.from({length:7},(n,o)=>{let a=new Date(r);return a.setDate(r.getDate()+o),new Intl.DateTimeFormat(e,{weekday:t}).format(a)})}function Jo(e,t=true,r=true){return e==="date"?"YYYY-MM-DD":e==="time"?t?r?"HH:mm:ss":"HH:mm":r?"hh:mm:ss A":"hh:mm A":t?r?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm":r?"YYYY-MM-DD hh:mm:ss A":"YYYY-MM-DD hh:mm A"}function Qs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qo(e,t,r="en-US"){let n=e.getHours(),o=or(r,"long"),a=or(r,"short"),i={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MMMM:o[e.getMonth()],MMM:a[e.getMonth()],MM:String(e.getMonth()+1).padStart(2,"0"),M:String(e.getMonth()+1),DD:String(e.getDate()).padStart(2,"0"),D:String(e.getDate()),HH:String(n).padStart(2,"0"),H:String(n),hh:String(n%12||12).padStart(2,"0"),h:String(n%12||12),mm:String(e.getMinutes()).padStart(2,"0"),ss:String(e.getSeconds()).padStart(2,"0"),A:n<12?"AM":"PM",a:n<12?"am":"pm"},l=Object.keys(i).sort((d,m)=>m.length-d.length),s=new RegExp(l.map(Qs).join("|"),"g");return t.replace(s,d=>i[d]??d)}function Yt(e,t){return new Date(e,t+1,0).getDate()}function Zo(e,t){let r=new Date(e,t,1).getDay(),n=Yt(e,t),o=Yt(e,t-1),a=[];for(let l=r-1;l>=0;l--)a.push({date:new Date(e,t-1,o-l),thisMonth:false});for(let l=1;l<=n;l++)a.push({date:new Date(e,t,l),thisMonth:true});let i=42-a.length;for(let l=1;l<=i;l++)a.push({date:new Date(e,t+1,l),thisMonth:false});return a}function qt(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function xn(e,t){return qt(e).getTime()===qt(t).getTime()}function ea(e,t){return qt(e)<qt(t)}function ta(e,t){return qt(e)>qt(t)}function Dr(e,t,r){return t&&e<t?new Date(t):r&&e>r?new Date(r):e}function ra(e,t,r,n){let o=new Date(e),i=t*(n==="future"?1:-1);switch(r){case "day":o.setDate(o.getDate()+i);break;case "week":o.setDate(o.getDate()+i*7);break;case "month":o.setMonth(o.getMonth()+i);break;case "year":o.setFullYear(o.getFullYear()+i);break}return o}function na(e,t=200){let r=e-Math.floor(t/2);return Array.from({length:t},(n,o)=>r+o)}function oa(e){let{value:t,defaultValue:r,onChange:n,mode:o="datetime",minDate:a,maxDate:i,use24Hour:l=true,showSeconds:s=true,locale:d="en-US",format:m,onOpen:u,onClose:p}=e,c=t!==void 0,[h,f]=Xr.useState(r??null),g=c?t??null:h,[b,w]=Xr.useState(false),[C,x]=Xr.useState(()=>g??new Date),[M,$]=Xr.useState("drum"),[P,L]=Xr.useState(()=>(g??new Date).getFullYear()),[H,D]=Xr.useState(()=>(g??new Date).getMonth()),[y,_]=Xr.useState(1),[B,R]=Xr.useState("day"),[K,ie]=Xr.useState("future"),T=m??Jo(o,l,s),ye=g?Qo(g,T,d):"",he=Xr.useCallback(()=>{let O=g??new Date;x(new Date(O)),L(O.getFullYear()),D(O.getMonth()),$("drum"),w(true),u?.();},[g,u]),Ne=Xr.useCallback(()=>{w(false),p?.();},[p]),ne=Xr.useCallback(()=>{let O=Dr(C,a,i);c||f(O),n?.(O),Ne();},[C,a,i,c,n,Ne]),Te=Xr.useCallback(()=>{c||f(null),n?.(null),Ne();},[c,n,Ne]),Y=Xr.useCallback((O,ae)=>{x(ce=>{let te=new Date(ce);switch(O){case "year":te.setFullYear(ae);break;case "month":{te.setMonth(ae);let be=Yt(te.getFullYear(),ae);te.getDate()>be&&te.setDate(be);break}case "day":te.setDate(ae);break;case "hour":te.setHours(ae);break;case "minute":te.setMinutes(ae);break;case "second":te.setSeconds(ae);break}return Dr(te,a,i)});},[a,i]),Ee=Xr.useCallback(()=>{let O=Dr(ra(new Date,y,B,K),a,i);x(O),L(O.getFullYear()),D(O.getMonth());},[y,B,K,a,i]),We=Xr.useCallback(O=>{let ae=H+O,ce=P;ae<0&&(ae=11,ce--),ae>11&&(ae=0,ce++),D(ae),L(ce);},[H,P]);return {isOpen:b,displayValue:ye,workingDate:C,view:M,calYear:P,calMonth:H,offsetAmount:y,offsetUnit:B,offsetDirection:K,mode:o,use24Hour:l,showSeconds:s,locale:d,minDate:a,maxDate:i,openPicker:he,closePicker:Ne,confirm:ne,clear:Te,updateField:Y,setView:$,setCalYear:L,setCalMonth:D,setOffsetAmount:_,setOffsetUnit:R,setOffsetDirection:ie,applyQuickOffset:Ee,navigateCalendar:We}}var ir=40;function sa(e,t,r=true){let n=Xr.useRef(t);n.current=t,Xr.useEffect(()=>{if(!r)return;function o(a){let i=a.target;e.some(s=>s.current?.contains(i))||n.current();}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r]);}function la(e,t,r){let n=Xr.useRef(false),o=Xr.useRef(void 0),a=Xr.useRef(r);a.current=r;let i=Xr.useRef(t);i.current=t;let l=Xr.useCallback((d,m="smooth")=>{let u=e.current;if(!u)return;let p=d*ir;Math.abs(u.scrollTop-p)<2&&m!=="instant"||(m==="instant"?u.scrollTop=p:u.scrollTo({top:p,behavior:m}));},[e]),s=Xr.useCallback(()=>{e.current&&(n.current=true,clearTimeout(o.current),o.current=setTimeout(()=>{n.current=false;let m=e.current;if(!m)return;let u=Math.round(m.scrollTop/ir),p=Math.max(0,Math.min(i.current-1,u)),c=p*ir;Math.abs(m.scrollTop-c)>1&&m.scrollTo({top:c,behavior:"smooth"}),a.current(p);},120));},[e]);return {scrollToIndex:l,handleScroll:s,isScrollingRef:n}}function ca(e,t,r){Xr.useEffect(()=>{if(!r)return;function n(){let a=e.current,i=t.current;if(!a||!i)return;if(window.innerWidth<=640){i.style.top="",i.style.left="";return}let l=a.getBoundingClientRect(),s=window.innerHeight,d=window.innerWidth,m=i.offsetHeight||460,u=i.offsetWidth||340,p=l.bottom+8,c=l.left;p+m>s-16&&(p=Math.max(16,l.top-m-8)),c+u>d-16&&(c=Math.max(16,d-u-16)),c<16&&(c=16),i.style.top=`${Math.round(p)}px`,i.style.left=`${Math.round(c)}px`;}let o=setTimeout(n,0);return window.addEventListener("resize",n),window.addEventListener("scroll",n,true),()=>{clearTimeout(o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,true);}},[r,e,t]);}function Mt({items:e,selectedValue:t,onSelect:r,label:n}){let o=Xr.useRef(null),a=Xr.useRef(t),i=Xr.useRef(false),{scrollToIndex:l,handleScroll:s}=la(o,e.length,d=>{let m=e[d];m&&(i.current=true,r(m.value),setTimeout(()=>{i.current=false;},200));});return Xr.useEffect(()=>{let d=o.current;if(!d)return;let m=e.findIndex(u=>u.value===t);m>=0&&(d.scrollTop=m*ir);},[]),Xr.useEffect(()=>{if(a.current!==t&&(a.current=t,!i.current)){let d=e.findIndex(m=>m.value===t);d>=0&&l(d,"smooth");}},[t,e,l]),jsxRuntime.jsxs("div",{className:"dtp-column",role:"group","aria-label":n,children:[jsxRuntime.jsx("div",{className:"dtp-column-highlight","aria-hidden":"true"}),jsxRuntime.jsx("div",{ref:o,className:"dtp-column-list",onScroll:s,role:"listbox","aria-label":n,children:e.map(d=>jsxRuntime.jsx("div",{className:v("dtp-item",d.value===t&&"dtp-item--selected"),onClick:()=>{let m=e.findIndex(u=>u.value===d.value);m>=0&&l(m,"smooth"),r(d.value);},role:"option","aria-selected":d.value===t,children:d.label},d.value))}),jsxRuntime.jsx("div",{className:"dtp-fade-top","aria-hidden":"true"}),jsxRuntime.jsx("div",{className:"dtp-fade-bottom","aria-hidden":"true"})]})}function ol({year:e,month:t,selectedDate:r,today:n,minDate:o,maxDate:a,locale:i,onSelectDay:l,onPrev:s,onNext:d}){let m=Go(i,"narrow"),u=or(i,"long"),p=Zo(e,t);return jsxRuntime.jsxs("div",{className:"dtp-calendar",children:[jsxRuntime.jsxs("div",{className:"dtp-cal-nav",children:[jsxRuntime.jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:s,"aria-label":"Previous month",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-4 w-4"})}),jsxRuntime.jsxs("span",{className:"dtp-cal-title",children:[u[t]," ",e]}),jsxRuntime.jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:d,"aria-label":"Next month",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"dtp-cal-weekdays",role:"row",children:m.map((c,h)=>jsxRuntime.jsx("div",{className:"dtp-cal-weekday",role:"columnheader","aria-label":c,children:c},h))}),jsxRuntime.jsx("div",{className:"dtp-cal-days",role:"grid",children:p.map(({date:c,thisMonth:h},f)=>{let g=xn(c,r),b=xn(c,n),w=o!=null&&ea(c,o)||a!=null&&ta(c,a);return jsxRuntime.jsx("button",{type:"button",role:"gridcell",className:v("dtp-cal-day",!h&&"dtp-cal-day--other",g&&"dtp-cal-day--selected",b&&!g&&"dtp-cal-day--today",w&&"dtp-cal-day--disabled"),onClick:()=>!w&&l(c),disabled:w,"aria-current":b?"date":void 0,"aria-selected":g,"aria-disabled":w,children:c.getDate()},f)})})]})}function al({amount:e,unit:t,direction:r,onAmountChange:n,onUnitChange:o,onDirectionChange:a,onApply:i,locale:l}){let s=l.startsWith("zh"),d=[{value:"day",label:s?"\u5929":"Day"},{value:"week",label:s?"\u5468":"Week"},{value:"month",label:s?"\u6708":"Month"},{value:"year",label:s?"\u5E74":"Year"}],m=[{value:"future",label:s?"\u4EE5\u540E":"from now"},{value:"past",label:s?"\u4EE5\u524D":"before now"}];return jsxRuntime.jsxs("div",{className:"dtp-quick-offset","aria-label":s?"\u5FEB\u901F\u504F\u79FB":"Quick offset",children:[jsxRuntime.jsx("input",{type:"number",className:"dtp-offset-input",value:e,min:1,max:9999,"aria-label":s?"\u504F\u79FB\u6570\u91CF":"Offset amount",onChange:u=>{let p=parseInt(u.target.value,10);!isNaN(p)&&p>=1&&n(p);}}),jsxRuntime.jsx("select",{className:"dtp-offset-select",value:t,"aria-label":s?"\u504F\u79FB\u5355\u4F4D":"Offset unit",onChange:u=>o(u.target.value),children:d.map(u=>jsxRuntime.jsx("option",{value:u.value,children:u.label},u.value))}),jsxRuntime.jsx("select",{className:"dtp-offset-select",value:r,"aria-label":s?"\u504F\u79FB\u65B9\u5411":"Offset direction",onChange:u=>a(u.target.value),children:m.map(u=>jsxRuntime.jsx("option",{value:u.value,children:u.label},u.value))}),jsxRuntime.jsx("button",{type:"button",className:"dtp-offset-apply",onClick:i,children:s?"\u5E94\u7528":"Apply"})]})}function Ar({className:e,popupClassName:t,triggerClassName:r,disabled:n=false,placeholder:o,...a}){let{isOpen:i,displayValue:l,workingDate:s,view:d,calYear:m,calMonth:u,offsetAmount:p,offsetUnit:c,offsetDirection:h,mode:f,use24Hour:g,showSeconds:b,locale:w,minDate:C,maxDate:x,openPicker:M,closePicker:$,confirm:P,clear:L,updateField:H,setView:D,setCalYear:y,setCalMonth:_,setOffsetAmount:B,setOffsetUnit:R,setOffsetDirection:K,applyQuickOffset:ie,navigateCalendar:T}=oa({...a}),ye=Xr.useRef(null),he=Xr.useRef(null),Ne=new Date;sa([ye,he],$,i),ca(ye,he,i);let ne=w.startsWith("zh"),Te={cancel:ne?"\u53D6\u6D88":"Cancel",confirm:ne?"\u786E\u5B9A":"Confirm",calendarView:ne?"\u65E5\u5386":"Calendar",scrollView:ne?"\u6EDA\u8F6E":"Scroll",placeholder:o??(ne?"\u9009\u62E9\u65E5\u671F\u65F6\u95F4":"Select date / time")},Y=f==="date"||f==="datetime",Ee=f==="time"||f==="datetime",We=na(s.getFullYear(),200).map(G=>({label:String(G),value:G})),O=or(w,"short").map((G,ge)=>({label:G,value:ge})),ae=Yt(s.getFullYear(),s.getMonth()),ce=Array.from({length:ae},(G,ge)=>({label:String(ge+1).padStart(2,"0"),value:ge+1})),te=Array.from({length:24},(G,ge)=>({label:String(ge).padStart(2,"0"),value:ge})),be=Array.from({length:12},(G,ge)=>({label:String(ge===0?12:ge).padStart(2,"0"),value:ge})),Se=[{label:"AM",value:0},{label:"PM",value:1}],De=Array.from({length:60},(G,ge)=>({label:String(ge).padStart(2,"0"),value:ge})),J=s.getHours(),at=J%12,de=J<12?0:1,Pe=Ee&&!Y?lucideReact.Clock:lucideReact.Calendar;return jsxRuntime.jsxs("div",{className:v("dtp-root",e),children:[jsxRuntime.jsxs("div",{className:"dtp-trigger-wrap",children:[jsxRuntime.jsxs("button",{ref:ye,type:"button",className:v("dtp-trigger",l&&"dtp-trigger--has-clear",n&&"dtp-trigger--disabled",r),onClick:()=>!n&&(i?$():M()),disabled:n,"aria-haspopup":"dialog","aria-expanded":i,children:[jsxRuntime.jsx(Pe,{className:"dtp-trigger-icon","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:v("dtp-trigger-text",!l&&"dtp-trigger-placeholder"),children:l||Te.placeholder})]}),l&&jsxRuntime.jsx("button",{type:"button",className:"dtp-trigger-clear","aria-label":ne?"\u6E05\u9664":"Clear value",onClick:()=>!n&&L(),children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]}),i&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:he,className:v("dtp-panel",t),role:"dialog","aria-modal":"true","aria-label":ne?"\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668":"Date time picker",children:[jsxRuntime.jsxs("div",{className:"dtp-panel-header",children:[jsxRuntime.jsx("span",{className:"dtp-panel-preview",children:l||Te.placeholder}),jsxRuntime.jsx("div",{className:"dtp-panel-actions",children:Y&&jsxRuntime.jsx("button",{type:"button",className:v("dtp-view-btn",d==="calendar"&&"dtp-view-btn--active"),"aria-pressed":d==="calendar",title:d==="calendar"?Te.scrollView:Te.calendarView,onClick:()=>{d!=="calendar"&&(y(s.getFullYear()),_(s.getMonth())),D(d==="calendar"?"drum":"calendar");},children:jsxRuntime.jsx(lucideReact.Calendar,{className:"h-4 w-4"})})})]}),jsxRuntime.jsx("div",{className:"dtp-panel-body",children:d==="drum"?jsxRuntime.jsxs("div",{className:"dtp-drum",children:[Y&&jsxRuntime.jsxs("div",{className:"dtp-drum-date",children:[jsxRuntime.jsx(Mt,{label:ne?"\u5E74":"Year",items:We,selectedValue:s.getFullYear(),onSelect:G=>H("year",G)}),jsxRuntime.jsx(Mt,{label:ne?"\u6708":"Month",items:O,selectedValue:s.getMonth(),onSelect:G=>H("month",G)}),jsxRuntime.jsx(Mt,{label:ne?"\u65E5":"Day",items:ce,selectedValue:s.getDate(),onSelect:G=>H("day",G)})]}),Y&&Ee&&jsxRuntime.jsx("div",{className:"dtp-drum-sep","aria-hidden":"true"}),Ee&&jsxRuntime.jsxs("div",{className:"dtp-drum-time",children:[g?jsxRuntime.jsx(Mt,{label:ne?"\u65F6":"Hour",items:te,selectedValue:J,onSelect:G=>H("hour",G)}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Mt,{label:ne?"\u65F6":"Hour",items:be,selectedValue:at,onSelect:G=>{H("hour",de===1?G+12:G);}}),jsxRuntime.jsx(Mt,{label:"AM/PM",items:Se,selectedValue:de,onSelect:G=>{H("hour",at+(G===1?12:0));}})]}),jsxRuntime.jsx(Mt,{label:ne?"\u5206":"Min",items:De,selectedValue:s.getMinutes(),onSelect:G=>H("minute",G)}),b&&jsxRuntime.jsx(Mt,{label:ne?"\u79D2":"Sec",items:De,selectedValue:s.getSeconds(),onSelect:G=>H("second",G)})]})]}):jsxRuntime.jsx(ol,{year:m,month:u,selectedDate:s,today:Ne,minDate:C,maxDate:x,locale:w,onSelectDay:G=>{H("year",G.getFullYear()),H("month",G.getMonth()),H("day",G.getDate()),D("drum");},onPrev:()=>T(-1),onNext:()=>T(1)})}),Y&&jsxRuntime.jsx("div",{className:"dtp-panel-offset",children:jsxRuntime.jsx(al,{amount:p,unit:c,direction:h,onAmountChange:B,onUnitChange:R,onDirectionChange:K,onApply:ie,locale:w})}),jsxRuntime.jsxs("div",{className:"dtp-panel-footer",children:[jsxRuntime.jsx("button",{type:"button",className:"dtp-btn-cancel",onClick:$,children:Te.cancel}),jsxRuntime.jsx("button",{type:"button",className:"dtp-btn-confirm",onClick:P,children:Te.confirm})]})]}),document.body)]})}var sl={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},ll={default:"border-secondary-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus-within:border-danger-500 focus-within:ring-2 focus-within:ring-danger-500/20"};function At({state:e="default",inputSize:t="md",className:r,prefix:n,suffix:o,action:a,...i}){if(!n&&!o&&!a)return jsxRuntime.jsx("input",{className:v(vo({state:e,size:t}),r),...i});let l=sl[t??"md"],s=ll[e??"default"];return jsxRuntime.jsxs("div",{className:v("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",l.wrapper,s,r),children:[n&&jsxRuntime.jsx("span",{className:v("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",l.prefix),children:n}),jsxRuntime.jsx("input",{className:v("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",l.input,n&&"pl-2"),...i}),o&&jsxRuntime.jsx("span",{className:v("flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",l.icon),children:o}),a&&jsxRuntime.jsx("button",{type:"button",onClick:a.onClick,"aria-label":a["aria-label"]??"Action",className:v("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",l.icon),children:a.icon})]})}function zt({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("label",{className:v(yo({intent:e,size:t}),r),...n})}var fl={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function pa({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:n,intent:o,size:a,label:i,id:l,className:s,disabled:d,...m}){let u=Xr.useId(),p=l??u,c=a??"md",[h,f]=Xr.useState(t),g=e??h,b=Xr.useCallback(C=>{let x=C.target.checked;e===void 0&&f(x),n?.(x);},[e,n]),w=g||r;return jsxRuntime.jsxs("label",{htmlFor:p,className:v("inline-flex cursor-pointer items-center gap-2 select-none",d&&"pointer-events-none opacity-50",s),children:[jsxRuntime.jsx("input",{...m,id:p,type:"checkbox",className:"sr-only",checked:g,disabled:d,onChange:b}),jsxRuntime.jsx("span",{className:v(xo({intent:o,size:a,checked:w?"on":"off"})),children:jsxRuntime.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:v("text-white transition-all duration-200",fl[c],w?"scale-100 opacity-100":"scale-0 opacity-0"),children:r?jsxRuntime.jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsxRuntime.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),i&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:i})]})}var ma=classVarianceAuthority.cva("w-full rounded-md font-mono text-center transition-all focus:outline-none focus:ring-2 disabled:pointer-events-none disabled:opacity-50",{variants:{size:{sm:"h-9 w-9 text-sm",md:"h-12 w-12 text-base",lg:"h-14 w-14 text-lg"},variant:{outline:"border border-secondary-300 bg-transparent focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600 dark:bg-transparent dark:focus:border-primary-400",filled:"border border-transparent bg-secondary-100 focus:border-primary-500 focus:ring-primary-500/20 dark:bg-secondary-800 dark:focus:border-primary-400",underline:"rounded-none border-0 border-b-2 border-secondary-300 bg-transparent px-0 focus:border-primary-500 focus:ring-0 dark:border-secondary-600 dark:focus:border-primary-400"},invalid:{true:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20",false:""}},defaultVariants:{size:"md",variant:"outline",invalid:false}});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"}});function wn({length:e=6,value:t,defaultValue:r="",onChange:n,onComplete:o,size:a="md",variant:i="outline",disabled:l=false,readOnly:s=false,autoFocus:d=false,alphanumeric:m=false,mask:u=false,invalid:p=false,className:c}){let h=t!==void 0,[f,g]=Xr.useState(()=>{let D=(r??"").slice(0,e);return Array.from({length:e},(y,_)=>D[_]??"")}),b=h?Array.from({length:e},(D,y)=>(t??"")[y]??""):f,w=Xr.useRef([]),C=Xr.useRef([]);Xr.useEffect(()=>{d&&w.current[0]&&w.current[0].focus();},[d]);let x=Xr.useCallback(D=>{h||g(D);let y=D.join("");n?.(y),D.every(_=>_!=="")&&D.length===e&&o?.(y);},[h,n,o,e]),M=D=>{let y=w.current[D];y&&(y.classList.remove("otp-pop"),clearTimeout(C.current[D]),y.offsetWidth,y.classList.add("otp-pop"),C.current[D]=window.setTimeout(()=>y.classList.remove("otp-pop"),200));},$=Xr.useCallback((D,y)=>{let _=m?/[a-zA-Z0-9]/g:/[0-9]/g,B=y.match(_)??[];if(B.length===0)return;let R=B[B.length-1],K=[...b];K[D]=R,x(K),M(D),D<e-1&&w.current[D+1]?.focus();},[b,e,m,x]),P=Xr.useCallback((D,y)=>{if(y.key==="Backspace"){if(y.preventDefault(),b[D]){let _=[...b];_[D]="",x(_);}else if(D>0){w.current[D-1]?.focus();let _=[...b];_[D-1]="",x(_);}}else if(y.key==="ArrowLeft")y.preventDefault(),D>0&&w.current[D-1]?.focus();else if(y.key==="ArrowRight")y.preventDefault(),D<e-1&&w.current[D+1]?.focus();else if(y.key==="Delete"){y.preventDefault();let _=[...b];_[D]="",x(_);}},[b,e,x]),L=Xr.useCallback((D,y)=>{y.preventDefault();let _=y.clipboardData.getData("text"),B=m?/[a-zA-Z0-9]/g:/[0-9]/g,R=_.match(B)??[],K=[...b],ie=D;for(let he=0;he<R.length&&D+he<e;he++)K[D+he]=R[he],ie=D+he;x(K);let T=K.findIndex((he,Ne)=>Ne>ie&&he===""),ye=T!==-1?T:Math.min(ie+1,e-1);w.current[ye]?.focus();},[b,e,m,x]),H=Xr.useCallback(D=>{D.target.select();},[]);return jsxRuntime.jsx("div",{role:"group","aria-label":"OTP Input",className:v("inline-flex gap-2",c),children:Array.from({length:e},(D,y)=>jsxRuntime.jsx("input",{ref:_=>{w.current[y]=_;},type:u?"password":"text",inputMode:m?"text":"numeric",pattern:m?"[a-zA-Z0-9]":"[0-9]",maxLength:2,value:b[y],disabled:l,readOnly:s,autoComplete:"one-time-code","aria-label":`Digit ${y+1} of ${e}`,className:v(ma({size:a,variant:i,invalid:p||void 0}),"text-secondary-900 dark:text-secondary-100"),onChange:_=>$(y,_.target.value),onKeyDown:_=>P(y,_),onPaste:_=>L(y,_),onFocus:H},y))})}function Mn({size:e="sm",variant:t="default",className:r,children:n,...o}){return jsxRuntime.jsx("kbd",{className:v(ko({size:e,variant:t}),r),...o,children:n})}function Nn({separator:e="+",className:t,children:r}){let n=Xr__default.default.Children.toArray(r);return jsxRuntime.jsx("span",{className:v("inline-flex items-center gap-1",t),children:n.map((o,a)=>jsxRuntime.jsxs(Xr__default.default.Fragment,{children:[o,a<n.length-1&&jsxRuntime.jsx("span",{className:"select-none text-xs text-secondary-400 dark:text-secondary-500","aria-hidden":true,children:e})]},a))})}var yl={login:"Welcome back",register:"Create account",otp:"Verify your identity",forgot:"Reset password"},xl={login:"Sign in to your account to continue",register:"Fill in the details to get started",otp:"Enter the 6-digit code sent to your email",forgot:"We'll send a reset link to your email"};function Ir({mode:e,onModeChange:t,onLogin:r,onRegister:n,onOTPComplete:o,onForgotPassword:a,logo:i,title:l,subtitle:s,socialLogins:d,showRememberMe:m=true,isLoading:u=false,error:p,className:c,style:h}){let[f,g]=Xr.useState("login"),b=e!==void 0,w=b?e:f,C=Xr.useCallback(Y=>{b||g(Y),t?.(Y);},[b,t]),[x,M]=Xr.useState(""),[$,P]=Xr.useState(""),[L,H]=Xr.useState(false),[D,y]=Xr.useState(""),[_,B]=Xr.useState(""),[R,K]=Xr.useState(""),[ie,T]=Xr.useState(""),ye=Xr.useCallback(async Y=>{Y.preventDefault(),await r?.(x,$,L);},[x,$,L,r]),he=Xr.useCallback(async Y=>{Y.preventDefault(),await n?.(D,_,R);},[D,_,R,n]),Ne=Xr.useCallback(async Y=>{Y.preventDefault(),await a?.(ie);},[ie,a]),ne=l??yl[w],Te=s??xl[w];return jsxRuntime.jsxs("div",{className:v("w-full max-w-sm rounded-2xl border border-primary-200 bg-white/90 p-8 shadow-xl backdrop-blur-md","dark:border-primary-700 dark:bg-primary-900/90",c),style:h,children:[i&&jsxRuntime.jsx("div",{className:"mb-6 flex justify-center",children:i}),jsxRuntime.jsxs("div",{className:"mb-6 text-center",children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-primary-900 dark:text-primary-50",children:ne}),jsxRuntime.jsx("p",{className:"mt-1 text-sm text-secondary-500 dark:text-secondary-400",children:Te})]}),d&&d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"mb-4 flex flex-col gap-2",children:d.map((Y,Ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:Y.onClick,disabled:u,className:v("flex w-full items-center justify-center gap-2 rounded-lg border border-secondary-300 px-4 py-2 text-sm font-medium","text-secondary-700 transition-colors hover:bg-secondary-50","dark:border-secondary-600 dark:text-secondary-300 dark:hover:bg-secondary-800","disabled:opacity-50 disabled:cursor-not-allowed","[&_svg]:h-4 [&_svg]:w-4"),children:[Y.icon,Y.label]},Ee))}),jsxRuntime.jsxs("div",{className:"relative mb-4 flex items-center",children:[jsxRuntime.jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"}),jsxRuntime.jsx("span",{className:"mx-3 text-xs text-secondary-400 dark:text-secondary-500",children:"or continue with"}),jsxRuntime.jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"})]})]}),jsxRuntime.jsxs("div",{className:"login-panel-slide-enter",children:[w==="login"&&jsxRuntime.jsxs("form",{onSubmit:ye,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(zt,{htmlFor:"lp-email",children:"Email"}),jsxRuntime.jsx(At,{id:"lp-email",type:"email",placeholder:"you@example.com",value:x,onChange:Y=>M(Y.target.value),disabled:u,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(zt,{htmlFor:"lp-password",children:"Password"}),jsxRuntime.jsx(At,{id:"lp-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:$,onChange:Y=>P(Y.target.value),disabled:u,required:true})]}),m&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(pa,{checked:L,onCheckedChange:Y=>H(!!Y),label:"Remember me",disabled:u}),jsxRuntime.jsx("button",{type:"button",className:"text-xs text-primary-500 hover:underline dark:text-primary-400",onClick:()=>C("forgot"),children:"Forgot password?"})]}),p&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:p}),jsxRuntime.jsx(Pt,{type:"submit",className:"w-full",disabled:u,children:u?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Sign in"," ",jsxRuntime.jsx(Nn,{className:"ml-1 opacity-60",children:jsxRuntime.jsx(Mn,{size:"xs",children:"\u23CE"})})]})}),jsxRuntime.jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Don't have an account?"," ",jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>C("register"),children:"Register"})]})]}),w==="register"&&jsxRuntime.jsxs("form",{onSubmit:he,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(zt,{htmlFor:"lp-name",children:"Full name"}),jsxRuntime.jsx(At,{id:"lp-name",type:"text",placeholder:"Jane Doe",value:D,onChange:Y=>y(Y.target.value),disabled:u,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(zt,{htmlFor:"lp-reg-email",children:"Email"}),jsxRuntime.jsx(At,{id:"lp-reg-email",type:"email",placeholder:"you@example.com",value:_,onChange:Y=>B(Y.target.value),disabled:u,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(zt,{htmlFor:"lp-reg-password",children:"Password"}),jsxRuntime.jsx(At,{id:"lp-reg-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:R,onChange:Y=>K(Y.target.value),disabled:u,required:true})]}),p&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:p}),jsxRuntime.jsx(Pt,{type:"submit",className:"w-full",disabled:u,children:u?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Create account"}),jsxRuntime.jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Already have an account?"," ",jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>C("login"),children:"Sign in"})]})]}),w==="otp"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsx("div",{className:"flex justify-center",children:jsxRuntime.jsx(wn,{length:6,size:"md",onComplete:async Y=>{await o?.(Y);},autoFocus:true})}),p&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-center text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:p}),jsxRuntime.jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>C("login"),children:"\u2190 Back to login"})})]}),w==="forgot"&&jsxRuntime.jsxs("form",{onSubmit:Ne,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(zt,{htmlFor:"lp-forgot-email",children:"Email address"}),jsxRuntime.jsx(At,{id:"lp-forgot-email",type:"email",placeholder:"you@example.com",value:ie,onChange:Y=>T(Y.target.value),disabled:u,required:true})]}),p&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:p}),jsxRuntime.jsx(Pt,{type:"submit",className:"w-full",disabled:u,children:u?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Send reset link"}),jsxRuntime.jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>C("login"),children:"\u2190 Back to login"})})]})]},w)]})}function va({item:e,mode:t}){return e.separator?jsxRuntime.jsx("div",{className:"mx-1 h-10 w-px self-center bg-primary-200 dark:bg-primary-700","aria-hidden":true}):jsxRuntime.jsxs("button",{type:"button",title:e.title??e.label,disabled:e.disabled,onClick:e.onClick,"aria-pressed":e.active,className:v("relative flex shrink-0 items-center justify-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400","disabled:cursor-not-allowed disabled:opacity-40",e.active?"bg-primary-100 text-primary-700 shadow-inner dark:bg-primary-800 dark:text-primary-200":"text-primary-700 hover:bg-primary-50 active:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",t==="full"?"min-w-[3.5rem] flex-col gap-0.5 py-2":"","[&_svg]:shrink-0",t==="full"?"[&_svg]:h-5 [&_svg]:w-5":"[&_svg]:h-4 [&_svg]:w-4"),children:[e.icon&&jsxRuntime.jsx("span",{children:e.icon}),t!=="icons"&&jsxRuntime.jsx("span",{className:v(t==="full"?"text-[0.6rem] leading-tight":""),children:e.label})]})}function Nl({group:e,mode:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:v("flex shrink-0 flex-col items-stretch",r&&"opacity-50"),children:[jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 px-1",children:e.items.map(n=>jsxRuntime.jsx(va,{item:r?{...n,disabled:true}:n,mode:t},n.key))}),t==="full"&&jsxRuntime.jsx("div",{className:"mt-1 border-t border-primary-100 px-2 pt-0.5 text-center dark:border-primary-800",children:jsxRuntime.jsx("span",{className:"text-[0.55rem] text-secondary-400 dark:text-secondary-500",children:e.label})})]})}function ya({tabs:e,defaultTab:t,activeTab:r,onTabChange:n,mode:o,onModeChange:a,sticky:i=false,className:l}){let s=e.filter(x=>!x.hidden),[d,m]=Xr.useState(t??s[0]?.key??""),[u,p]=Xr.useState(o??"full"),[c,h]=Xr.useState(true),f=r??d,g=o??u,b=x=>{if(!s.find($=>$.key===x)?.disabled){if(x===f&&g!=="icons"){h($=>!$);return}m(x),n?.(x),h(true);}},C=s.find(x=>x.key===f)??s[0];return jsxRuntime.jsxs("div",{className:v("select-none border-b border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",i&&"sticky top-0 z-30",l),children:[jsxRuntime.jsxs("div",{className:"flex items-center border-b border-primary-100 dark:border-primary-800",children:[jsxRuntime.jsx("div",{className:"flex flex-1 items-end overflow-x-auto",children:s.map(x=>jsxRuntime.jsxs("button",{type:"button",disabled:x.disabled,onClick:()=>b(x.key),className:v("flex shrink-0 items-center gap-1.5 border-b-2 px-4 py-2 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400 [&_svg]:h-4 [&_svg]:w-4",x.disabled?"cursor-not-allowed border-transparent text-secondary-300 opacity-50 dark:text-secondary-600":x.key===f&&c?"border-primary-500 text-primary-700 dark:border-primary-400 dark:text-primary-200":"border-transparent text-secondary-500 hover:border-primary-300 hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-300"),children:[x.icon,x.label]},x.key))}),jsxRuntime.jsx("button",{type:"button",title:c?"Collapse ribbon":"Expand ribbon",onClick:()=>h(x=>!x),className:"ml-auto mr-2 rounded-md p-1.5 text-secondary-400 transition-colors hover:bg-primary-50 hover:text-primary-600 dark:hover:bg-primary-800 dark:hover:text-primary-300",children:c?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"h-4 w-4"})})]}),c&&C&&g!=="icons"&&jsxRuntime.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto px-2 py-1.5",children:C.groups.map((x,M)=>jsxRuntime.jsxs(Xr__default.default.Fragment,{children:[M>0&&jsxRuntime.jsx("div",{className:"mx-1 h-auto w-px self-stretch bg-primary-100 dark:bg-primary-800"}),jsxRuntime.jsx(Nl,{group:x,mode:g,disabled:x.disabled||C.disabled})]},x.key))}),g==="icons"&&c&&C&&jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto px-2 py-1",children:C.groups.flatMap(x=>x.items.map(M=>jsxRuntime.jsx(va,{item:x.disabled||C.disabled?{...M,disabled:true}:M,mode:"icons"},M.key)))})]})}var El={sm:{trackFixed:"h-5 w-9",trackH:"h-5 min-w-9",thumb:"h-3.5 w-3.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-16px)]",pad:"pl-[6px] pr-[18px]",contentLeft:"left-[6px]",contentRight:"right-[6px]",icon:"text-[10px] [&_svg]:h-3 [&_svg]:w-3"},md:{trackFixed:"h-6 w-11",trackH:"h-6 min-w-11",thumb:"h-4.5 w-4.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-20px)]",pad:"pl-[7px] pr-[23px]",contentLeft:"left-[7px]",contentRight:"right-[7px]",icon:"text-xs [&_svg]:h-3.5 [&_svg]:w-3.5"},lg:{trackFixed:"h-7 w-14",trackH:"h-7 min-w-14",thumb:"h-5.5 w-5.5",thumbTop:"top-[3px]",thumbOff:"left-[3px]",thumbOn:"left-[calc(100%-25px)]",pad:"pl-[8px] pr-[28px]",contentLeft:"left-[8px]",contentRight:"right-[8px]",icon:"text-sm [&_svg]:h-4 [&_svg]:w-4"}},Pl={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function Hr({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:n,uncheckedContent:o,intent:a,size:i,label:l,id:s,className:d,disabled:m,...u}){let p=Xr.useId(),c=s??p,h=i??"md",f=a??"primary",g=El[h],b=n!=null||o!=null,[w,C]=Xr.useState(t),x=e??w,M=Xr.useCallback($=>{let P=$.target.checked;e===void 0&&C(P),r?.(P);},[e,r]);return jsxRuntime.jsxs("label",{htmlFor:c,className:v("inline-flex cursor-pointer items-center gap-2",m&&"pointer-events-none opacity-50",d),children:[jsxRuntime.jsx("input",{...u,id:c,type:"checkbox",role:"switch",className:"sr-only",checked:x,disabled:m,onChange:M,"aria-checked":x}),jsxRuntime.jsxs("span",{className:v("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",b?g.trackH:g.trackFixed,wo({intent:a,size:i,checked:x?"on":"off"})),children:[b?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:v("pointer-events-none invisible inline-grid",g.icon),children:[jsxRuntime.jsx("span",{className:v("[grid-area:1/1] whitespace-nowrap",g.pad),children:n}),jsxRuntime.jsx("span",{className:v("[grid-area:1/1] whitespace-nowrap",g.pad),children:o})]}),jsxRuntime.jsx("span",{className:v("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",g.contentLeft,g.icon,Pl[f],x?"opacity-100":"opacity-0"),children:n}),jsxRuntime.jsx("span",{className:v("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",g.contentRight,g.icon,"text-primary-400 dark:text-primary-500",x?"opacity-0":"opacity-100"),children:o})]}):null,jsxRuntime.jsx("span",{className:v("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",g.thumb,g.thumbTop,x?g.thumbOn:g.thumbOff)})]}),l&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:l})]})}var Dl=Object.defineProperty,zn=(e,t)=>{for(var r in t)Dl(e,r,{get:t[r],enumerable:true});};function Wr(e){let{state:t,transaction:r}=e,{selection:n}=r,{doc:o}=r,{storedMarks:a}=r;return {...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return n},get doc(){return o},get tr(){return n=r.selection,o=r.doc,a=r.storedMarks,r}}}var Ln=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state;}get hasCustomState(){return !!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:r}=this,{view:n}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([i,l])=>[i,(...d)=>{let m=l(...d)(a);return !o.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(o),m}]))}get chain(){return ()=>this.createChain()}get can(){return ()=>this.createCan()}createChain(e,t=true){let{rawCommands:r,editor:n,state:o}=this,{view:a}=n,i=[],l=!!e,s=e||o.tr,d=()=>(!l&&t&&!s.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(s),i.every(u=>u===true)),m={...Object.fromEntries(Object.entries(r).map(([u,p])=>[u,(...h)=>{let f=this.buildProps(s,t),g=p(...h)(f);return i.push(g),m}])),run:d};return m}createCan(e){let{rawCommands:t,state:r}=this,n=false,o=e||r.tr,a=this.buildProps(o,n);return {...Object.fromEntries(Object.entries(t).map(([l,s])=>[l,(...d)=>s(...d)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,n)}}buildProps(e,t=true){let{rawCommands:r,editor:n,state:o}=this,{view:a}=n,i={tr:e,editor:n,view:a,state:Wr({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,s])=>[l,(...d)=>s(...d)(i)]))}};return i}},La={};zn(La,{blur:()=>Al,clearContent:()=>zl,clearNodes:()=>Il,command:()=>_l,createParagraphNear:()=>Ol,cut:()=>Fl,deleteCurrentNode:()=>Bl,deleteNode:()=>Vl,deleteRange:()=>jl,deleteSelection:()=>Kl,enter:()=>Wl,exitCode:()=>ql,extendMarkRange:()=>Gl,first:()=>Jl,focus:()=>tc,forEach:()=>rc,insertContent:()=>nc,insertContentAt:()=>pc,joinBackward:()=>yc,joinDown:()=>vc,joinForward:()=>xc,joinItemBackward:()=>kc,joinItemForward:()=>Nc,joinTextblockBackward:()=>Sc,joinTextblockForward:()=>Ec,joinUp:()=>bc,keyboardShortcut:()=>Rc,lift:()=>Ac,liftEmptyBlock:()=>Lc,liftListItem:()=>_c,newlineInCode:()=>Oc,resetAttributes:()=>$c,scrollIntoView:()=>Fc,selectAll:()=>Vc,selectNodeBackward:()=>Uc,selectNodeForward:()=>Wc,selectParentNode:()=>qc,selectTextblockEnd:()=>Gc,selectTextblockStart:()=>Qc,setContent:()=>ed,setMark:()=>kd,setMeta:()=>Md,setNode:()=>Nd,setNodeSelection:()=>Sd,setTextDirection:()=>Td,setTextSelection:()=>Ed,sinkListItem:()=>Rd,splitBlock:()=>zd,splitListItem:()=>Hd,toggleList:()=>Od,toggleMark:()=>$d,toggleNode:()=>Fd,toggleWrap:()=>Bd,undoInputRule:()=>Vd,unsetAllMarks:()=>jd,unsetMark:()=>Ud,unsetTextDirection:()=>Kd,updateAttributes:()=>Wd,wrapIn:()=>qd,wrapInList:()=>Gd});var Al=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var r;e.isDestroyed||(t.dom.blur(),(r=window?.getSelection())==null||r.removeAllRanges());}),true),zl=(e=true)=>({commands:t})=>t.setContent("",{emitUpdate:e}),Il=()=>({state:e,tr:t,dispatch:r})=>{let{selection:n}=t,{ranges:o}=n;return r&&o.forEach(({$from:a,$to:i})=>{e.doc.nodesBetween(a.pos,i.pos,(l,s)=>{if(l.type.isText)return;let{doc:d,mapping:m}=t,u=d.resolve(m.map(s)),p=d.resolve(m.map(s+l.nodeSize)),c=u.blockRange(p);if(!c)return;let h=transform.liftTarget(c);if(l.type.isTextblock){let{defaultType:f}=u.parent.contentMatchAt(u.index());t.setNodeMarkup(c.start,f);}(h||h===0)&&t.lift(c,h);});}),true},_l=e=>t=>e(t),Ol=()=>({state:e,dispatch:t})=>commands.createParagraphNear(e,t),Fl=(e,t)=>({editor:r,tr:n})=>{let{state:o}=r,a=o.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);let i=n.mapping.map(t);return n.insert(i,a.content),n.setSelection(new state.TextSelection(n.doc.resolve(Math.max(i-1,0)))),true},Bl=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return false;let o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===n.type){if(t){let l=o.before(a),s=o.after(a);e.delete(l,s).scrollIntoView();}return true}return false};function Ve(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Vl=e=>({tr:t,state:r,dispatch:n})=>{let o=Ve(e,r.schema),a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===o){if(n){let s=a.before(i),d=a.after(i);t.delete(s,d).scrollIntoView();}return true}return false},jl=e=>({tr:t,dispatch:r})=>{let{from:n,to:o}=e;return r&&t.delete(n,o),true},Kl=()=>({state:e,dispatch:t})=>commands.deleteSelection(e,t),Wl=()=>({commands:e})=>e.keyboardShortcut("Enter"),ql=()=>({state:e,dispatch:t})=>commands.exitCode(e,t);function In(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function jr(e,t,r={strict:true}){let n=Object.keys(t);return n.length?n.every(o=>r.strict?t[o]===e[o]:In(t[o])?t[o].test(e[o]):t[o]===e[o]):true}function Ia(e,t,r={}){return e.find(n=>n.type===t&&jr(Object.fromEntries(Object.keys(r).map(o=>[o,n.attrs[o]])),r))}function xa(e,t,r={}){return !!Ia(e,t,r)}function _a(e,t,r){var n;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if((!o.node||!o.node.marks.some(m=>m.type===t))&&(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(m=>m.type===t)||(r=r||((n=o.node.marks[0])==null?void 0:n.attrs),!Ia([...o.node.marks],t,r)))return;let i=o.index,l=e.start()+o.offset,s=i+1,d=l+o.node.nodeSize;for(;i>0&&xa([...e.parent.child(i-1).marks],t,r);)i-=1,l-=e.parent.child(i).nodeSize;for(;s<e.parent.childCount&&xa([...e.parent.child(s).marks],t,r);)d+=e.parent.child(s).nodeSize,s+=1;return {from:l,to:d}}function ht(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var Gl=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let a=ht(e,n.schema),{doc:i,selection:l}=r,{$from:s,from:d,to:m}=l;if(o){let u=_a(s,a,t);if(u&&u.from<=d&&u.to>=m){let p=state.TextSelection.create(i,u.from,u.to);r.setSelection(p);}}return true},Jl=e=>t=>{let r=typeof e=="function"?e(t):e;for(let n=0;n<r.length;n+=1)if(r[n](t))return true;return false};function Ha(e){return e instanceof state.TextSelection}function It(e=0,t=0,r=0){return Math.min(Math.max(e,t),r)}function Zl(e,t=null){if(!t)return null;let r=state.Selection.atStart(e),n=state.Selection.atEnd(e);if(t==="start"||t===true)return r;if(t==="end")return n;let o=r.from,a=n.to;return t==="all"?state.TextSelection.create(e,It(0,o,a),It(e.content.size,o,a)):state.TextSelection.create(e,It(t,o,a),It(t,o,a))}function Ma(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ur(){return ["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function ec(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):false}var tc=(e=null,t={})=>({editor:r,view:n,tr:o,dispatch:a})=>{t={scrollIntoView:true,...t};let i=()=>{(Ur()||Ma())&&n.dom.focus(),ec()&&!Ur()&&!Ma()&&n.dom.focus({preventScroll:true}),requestAnimationFrame(()=>{r.isDestroyed||(n.focus(),t?.scrollIntoView&&r.commands.scrollIntoView());});};try{if(n.hasFocus()&&e===null||e===!1)return !0}catch{return false}if(a&&e===null&&!Ha(r.state.selection))return i(),true;let l=Zl(o.doc,e)||r.state.selection,s=r.state.selection.eq(l);return a&&(s||o.setSelection(l),s&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),true},rc=(e,t)=>r=>e.every((n,o)=>t(n,{...r,index:o})),nc=(e,t)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,t),Oa=e=>{let t=e.childNodes;for(let r=t.length-1;r>=0;r-=1){let n=t[r];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):n.nodeType===1&&Oa(n);}return e};function Or(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`,r=new window.DOMParser().parseFromString(t,"text/html").body;return Oa(r)}function pr(e,t,r){if(e instanceof model.Node||e instanceof model.Fragment)return e;r={slice:true,parseOptions:{},...r};let n=typeof e=="object"&&e!==null,o=typeof e=="string";if(n)try{if(Array.isArray(e)&&e.length>0)return model.Fragment.fromArray(e.map(l=>t.nodeFromJSON(l)));let i=t.nodeFromJSON(e);return r.errorOnInvalidContent&&i.check(),i}catch(a){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",a),pr("",t,r)}if(o){if(r.errorOnInvalidContent){let i=false,l="",s=new model.Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(i=true,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(r.slice?model.DOMParser.fromSchema(s).parseSlice(Or(e),r.parseOptions):model.DOMParser.fromSchema(s).parse(Or(e),r.parseOptions),r.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let a=model.DOMParser.fromSchema(t);return r.slice?a.parseSlice(Or(e),r.parseOptions).content:a.parse(Or(e),r.parseOptions)}return pr("",t,r)}function dc(e,t,r){let n=e.steps.length-1;if(n<t)return;let o=e.steps[n];if(!(o instanceof transform.ReplaceStep||o instanceof transform.ReplaceAroundStep))return;let a=e.mapping.maps[n],i=0;a.forEach((l,s,d,m)=>{i===0&&(i=m);}),e.setSelection(state.Selection.near(e.doc.resolve(i),r));}var uc=e=>!("type"in e),pc=(e,t,r)=>({tr:n,dispatch:o,editor:a})=>{var i;if(o){r={parseOptions:a.options.parseOptions,updateSelection:true,applyInputRules:false,applyPasteRules:false,...r};let l,s=g=>{a.emit("contentError",{editor:a,error:g,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=true);}});},d={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{pr(t,a.schema,{parseOptions:d,errorOnInvalidContent:!0});}catch(g){s(g);}try{l=pr(t,a.schema,{parseOptions:d,errorOnInvalidContent:(i=r.errorOnInvalidContent)!=null?i:a.options.enableContentCheck});}catch(g){return s(g),false}let{from:m,to:u}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},p=true,c=true;if((uc(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:false,c=c?g.isBlock:false;}),m===u&&c){let{parent:g}=n.doc.resolve(m);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(m-=1,u+=1);}let f;if(p){if(Array.isArray(t))f=t.map(g=>g.text||"").join("");else if(t instanceof model.Fragment){let g="";t.forEach(b=>{b.text&&(g+=b.text);}),f=g;}else typeof t=="object"&&t&&t.text?f=t.text:f=t;n.insertText(f,m,u);}else {f=l;let g=n.doc.resolve(m),b=g.node(),w=g.parentOffset===0,C=b.isText||b.isTextblock,x=b.content.size>0;w&&C&&x&&(m=Math.max(0,m-1)),n.replaceWith(m,u,f);}r.updateSelection&&dc(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:m,text:f}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:m,text:f});}return true},bc=()=>({state:e,dispatch:t})=>commands.joinUp(e,t),vc=()=>({state:e,dispatch:t})=>commands.joinDown(e,t),yc=()=>({state:e,dispatch:t})=>commands.joinBackward(e,t),xc=()=>({state:e,dispatch:t})=>commands.joinForward(e,t),kc=()=>({state:e,dispatch:t,tr:r})=>{try{let n=transform.joinPoint(e.doc,e.selection.$from.pos,-1);return n==null?!1:(r.join(n,2),t&&t(r),!0)}catch{return false}},Nc=()=>({state:e,dispatch:t,tr:r})=>{try{let n=transform.joinPoint(e.doc,e.selection.$from.pos,1);return n==null?!1:(r.join(n,2),t&&t(r),!0)}catch{return false}},Sc=()=>({state:e,dispatch:t})=>commands.joinTextblockBackward(e,t),Ec=()=>({state:e,dispatch:t})=>commands.joinTextblockForward(e,t);function $a(){return typeof navigator<"u"?/Mac/.test(navigator.platform):false}function Pc(e){let t=e.split(/-(?!$)/),r=t[t.length-1];r==="Space"&&(r=" ");let n,o,a,i;for(let l=0;l<t.length-1;l+=1){let s=t[l];if(/^(cmd|meta|m)$/i.test(s))i=true;else if(/^a(lt)?$/i.test(s))n=true;else if(/^(c|ctrl|control)$/i.test(s))o=true;else if(/^s(hift)?$/i.test(s))a=true;else if(/^mod$/i.test(s))Ur()||$a()?i=true:o=true;else throw new Error(`Unrecognized modifier name: ${s}`)}return n&&(r=`Alt-${r}`),o&&(r=`Ctrl-${r}`),i&&(r=`Meta-${r}`),a&&(r=`Shift-${r}`),r}var Rc=e=>({editor:t,view:r,tr:n,dispatch:o})=>{let a=Pc(e).split(/-(?!$)/),i=a.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:true,cancelable:true}),s=t.captureTransaction(()=>{r.someProp("handleKeyDown",d=>d(r,l));});return s?.steps.forEach(d=>{let m=d.map(n.mapping);m&&o&&n.maybeStep(m);}),true};function _n(e,t,r={}){let{from:n,to:o,empty:a}=e.selection,i=t?Ve(t,e.schema):null,l=[];e.doc.nodesBetween(n,o,(u,p)=>{if(u.isText)return;let c=Math.max(n,p),h=Math.min(o,p+u.nodeSize);l.push({node:u,from:c,to:h});});let s=o-n,d=l.filter(u=>i?i.name===u.node.type.name:true).filter(u=>jr(u.node.attrs,r,{strict:false}));return a?!!d.length:d.reduce((u,p)=>u+p.to-p.from,0)>=s}var Ac=(e,t={})=>({state:r,dispatch:n})=>{let o=Ve(e,r.schema);return _n(r,o,t)?commands.lift(r,n):false},Lc=()=>({state:e,dispatch:t})=>commands.liftEmptyBlock(e,t),_c=e=>({state:t,dispatch:r})=>{let n=Ve(e,t.schema);return schemaList.liftListItem(n)(t,r)},Oc=()=>({state:e,dispatch:t})=>commands.newlineInCode(e,t);function Fa(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Ca(e,t){let r=typeof t=="string"?[t]:t;return Object.keys(e).reduce((n,o)=>(r.includes(o)||(n[o]=e[o]),n),{})}var $c=(e,t)=>({tr:r,state:n,dispatch:o})=>{let a=null,i=null,l=Fa(typeof e=="string"?e:e.name,n.schema);if(!l)return false;l==="node"&&(a=Ve(e,n.schema)),l==="mark"&&(i=ht(e,n.schema));let s=false;return r.selection.ranges.forEach(d=>{n.doc.nodesBetween(d.$from.pos,d.$to.pos,(m,u)=>{a&&a===m.type&&(s=true,o&&r.setNodeMarkup(u,void 0,Ca(m.attrs,t))),i&&m.marks.length&&m.marks.forEach(p=>{i===p.type&&(s=true,o&&r.addMark(u,u+m.nodeSize,i.create(Ca(p.attrs,t))));});});}),s},Fc=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),true),Vc=()=>({tr:e,dispatch:t})=>{if(t){let r=new state.AllSelection(e.doc);e.setSelection(r);}return true},Uc=()=>({state:e,dispatch:t})=>commands.selectNodeBackward(e,t),Wc=()=>({state:e,dispatch:t})=>commands.selectNodeForward(e,t),qc=()=>({state:e,dispatch:t})=>commands.selectParentNode(e,t),Gc=()=>({state:e,dispatch:t})=>commands.selectTextblockEnd(e,t),Qc=()=>({state:e,dispatch:t})=>commands.selectTextblockStart(e,t);function Zc(e,t,r={},n={}){return pr(e,t,{slice:false,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}var ed=(e,{errorOnInvalidContent:t,emitUpdate:r=true,parseOptions:n={}}={})=>({editor:o,tr:a,dispatch:i,commands:l})=>{let{doc:s}=a;if(n.preserveWhitespace!=="full"){let d=Zc(e,o.schema,n,{errorOnInvalidContent:t??o.options.enableContentCheck});return i&&a.replaceWith(0,s.content.size,d).setMeta("preventUpdate",!r),true}return i&&a.setMeta("preventUpdate",!r),l.insertContentAt({from:0,to:s.content.size},e,{parseOptions:n,errorOnInvalidContent:t??o.options.enableContentCheck})};function td(e,t){let r=ht(t,e.schema),{from:n,to:o,empty:a}=e.selection,i=[];a?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,o,s=>{i.push(...s.marks);});let l=i.find(s=>s.type.name===r.name);return l?{...l.attrs}:{}}function nd(e,t){let r=new transform.Transform(e);return t.forEach(n=>{n.steps.forEach(o=>{r.step(o);});}),r}function od(e){for(let t=0;t<e.edgeCount;t+=1){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function ad(e,t){for(let r=e.depth;r>0;r-=1){let n=e.node(r);if(t(n))return {pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}function Hn(e){return t=>ad(t.$from,e)}function W(e,t,r){return e.config[t]===void 0&&e.parent?W(e.parent,t,r):typeof e.config[t]=="function"?e.config[t].bind({...r,parent:e.parent?W(e.parent,t,r):null}):e.config[t]}function ld(e){return typeof e=="function"}function Ce(e,t=void 0,...r){return ld(e)?t?e.bind(t)(...r):e(...r):e}function Jt(e){let t=e.filter(o=>o.type==="extension"),r=e.filter(o=>o.type==="node"),n=e.filter(o=>o.type==="mark");return {baseExtensions:t,nodeExtensions:r,markExtensions:n}}function dd(e){let t=[],r="",n=false,o=false,a=0,i=e.length;for(let l=0;l<i;l+=1){let s=e[l];if(s==="'"&&!o){n=!n,r+=s;continue}if(s==='"'&&!n){o=!o,r+=s;continue}if(!n&&!o){if(s==="("){a+=1,r+=s;continue}if(s===")"&&a>0){a-=1,r+=s;continue}if(s===";"&&a===0){t.push(r),r="";continue}}r+=s;}return r&&t.push(r),t}function Sa(e){let t=[],r=dd(e||""),n=r.length;for(let o=0;o<n;o+=1){let a=r[o],i=a.indexOf(":");if(i===-1)continue;let l=a.slice(0,i).trim(),s=a.slice(i+1).trim();l&&s&&t.push([l,s]);}return t}function Qt(...e){return e.filter(t=>!!t).reduce((t,r)=>{let n={...t};return Object.entries(r).forEach(([o,a])=>{if(!n[o]){n[o]=a;return}if(o==="class"){let l=a?String(a).split(" "):[],s=n[o]?n[o].split(" "):[],d=l.filter(m=>!s.includes(m));n[o]=[...s,...d].join(" ");}else if(o==="style"){let l=new Map([...Sa(n[o]),...Sa(a)]);n[o]=Array.from(l.entries()).map(([s,d])=>`${s}: ${d}`).join("; ");}else n[o]=a;}),n},{})}function fd(e,t,r){let{from:n,to:o}=t,{blockSeparator:a=`
|
|
84
|
+
|
|
85
|
+
`,textSerializers:i={}}=r||{},l="";return e.nodesBetween(n,o,(s,d,m,u)=>{var p;s.isBlock&&d>n&&(l+=a);let c=i?.[s.type.name];if(c)return m&&(l+=c({node:s,pos:d,parent:m,index:u,range:t})),false;s.isText&&(l+=(p=s?.text)==null?void 0:p.slice(Math.max(n,d)-d,o-d));}),l}function hd(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,r])=>[t,r.spec.toText]))}function gd(e,t=JSON.stringify){let r={};return e.filter(n=>{let o=t(n);return Object.prototype.hasOwnProperty.call(r,o)?false:r[o]=true})}function bd(e){let t=gd(e);return t.length===1?t:t.filter((r,n)=>!t.filter((a,i)=>i!==n).some(a=>r.oldRange.from>=a.oldRange.from&&r.oldRange.to<=a.oldRange.to&&r.newRange.from>=a.newRange.from&&r.newRange.to<=a.newRange.to))}function vd(e){let{mapping:t,steps:r}=e,n=[];return t.maps.forEach((o,a)=>{let i=[];if(o.ranges.length)o.forEach((l,s)=>{i.push({from:l,to:s});});else {let{from:l,to:s}=r[a];if(l===void 0||s===void 0)return;i.push({from:l,to:s});}i.forEach(({from:l,to:s})=>{let d=t.slice(a).map(l,-1),m=t.slice(a).map(s),u=t.invert().map(d,-1),p=t.invert().map(m);n.push({oldRange:{from:u,to:p},newRange:{from:d,to:m}});});}),bd(n)}function Vr(e,t,r){return Object.fromEntries(Object.entries(r).filter(([n])=>{let o=e.find(a=>a.type===t&&a.name===n);return o?o.attribute.keepOnSplit:false}))}function xd(e,t,r={}){let{empty:n,ranges:o}=e.selection,a=t?ht(t,e.schema):null;if(n)return !!(e.storedMarks||e.selection.$from.marks()).filter(u=>a?a.name===u.type.name:true).find(u=>jr(u.attrs,r,{strict:false}));let i=0,l=[];if(o.forEach(({$from:u,$to:p})=>{let c=u.pos,h=p.pos;e.doc.nodesBetween(c,h,(f,g)=>{if(a&&f.inlineContent&&!f.type.allowsMarkType(a))return false;if(!f.isText&&!f.marks.length)return;let b=Math.max(c,g),w=Math.min(h,g+f.nodeSize),C=w-b;i+=C,l.push(...f.marks.map(x=>({mark:x,from:b,to:w})));});}),i===0)return false;let s=l.filter(u=>a?a.name===u.mark.type.name:true).filter(u=>jr(u.mark.attrs,r,{strict:false})).reduce((u,p)=>u+p.to-p.from,0),d=l.filter(u=>a?u.mark.type!==a&&u.mark.type.excludes(a):true).reduce((u,p)=>u+p.to-p.from,0);return (s>0?s+d:s)>=i}function Da(e,t){let{nodeExtensions:r}=Jt(t),n=r.find(i=>i.name===e);if(!n)return false;let o={name:n.name,options:n.options,storage:n.storage},a=Ce(W(n,"group",o));return typeof a!="string"?false:a.split(" ").includes("list")}function Ua(e,{checkChildren:t=true,ignoreWhitespace:r=false}={}){var n;if(r){if(e.type.name==="hardBreak")return true;if(e.isText)return !/\S/.test((n=e.text)!=null?n:"")}if(e.isText)return !e.text;if(e.isAtom||e.isLeaf)return false;if(e.content.childCount===0)return true;if(t){let o=true;return e.content.forEach(a=>{o!==false&&(Ua(a,{ignoreWhitespace:r,checkChildren:t})||(o=false));}),o}return false}function wd(e,t,r){var n;let{selection:o}=t,a=null;if(Ha(o)&&(a=o.$cursor),a){let l=(n=e.storedMarks)!=null?n:a.marks();return a.parent.type.allowsMarkType(r)&&(!!r.isInSet(l)||!l.some(d=>d.type.excludes(r)))}let{ranges:i}=o;return i.some(({$from:l,$to:s})=>{let d=l.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(r):false;return e.doc.nodesBetween(l.pos,s.pos,(m,u,p)=>{if(d)return false;if(m.isInline){let c=!p||p.type.allowsMarkType(r),h=!!r.isInSet(m.marks)||!m.marks.some(f=>f.type.excludes(r));d=c&&h;}return !d}),d})}var kd=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let{selection:a}=r,{empty:i,ranges:l}=a,s=ht(e,n.schema);if(o)if(i){let d=td(n,s);r.addStoredMark(s.create({...d,...t}));}else l.forEach(d=>{let m=d.$from.pos,u=d.$to.pos;n.doc.nodesBetween(m,u,(p,c)=>{let h=Math.max(c,m),f=Math.min(c+p.nodeSize,u);p.marks.find(b=>b.type===s)?p.marks.forEach(b=>{s===b.type&&r.addMark(h,f,s.create({...b.attrs,...t}));}):r.addMark(h,f,s.create(t));});});return wd(n,r,s)},Md=(e,t)=>({tr:r})=>(r.setMeta(e,t),true),Nd=(e,t={})=>({state:r,dispatch:n,chain:o})=>{let a=Ve(e,r.schema),i;return r.selection.$anchor.sameParent(r.selection.$head)&&(i=r.selection.$anchor.parent.attrs),a.isTextblock?o().command(({commands:l})=>commands.setBlockType(a,{...i,...t})(r)?true:l.clearNodes()).command(({state:l})=>commands.setBlockType(a,{...i,...t})(l,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),false)},Sd=e=>({tr:t,dispatch:r})=>{if(r){let{doc:n}=t,o=It(e,0,n.content.size),a=state.NodeSelection.create(n,o);t.setSelection(a);}return true},Td=(e,t)=>({tr:r,state:n,dispatch:o})=>{let{selection:a}=n,i,l;return typeof t=="number"?(i=t,l=t):t&&"from"in t&&"to"in t?(i=t.from,l=t.to):(i=a.from,l=a.to),o&&r.doc.nodesBetween(i,l,(s,d)=>{s.isText||r.setNodeMarkup(d,void 0,{...s.attrs,dir:e});}),true},Ed=e=>({tr:t,dispatch:r})=>{if(r){let{doc:n}=t,{from:o,to:a}=typeof e=="number"?{from:e,to:e}:e,i=state.TextSelection.atStart(n).from,l=state.TextSelection.atEnd(n).to,s=It(o,i,l),d=It(a,i,l),m=state.TextSelection.create(n,s,d);t.setSelection(m);}return true},Rd=e=>({state:t,dispatch:r})=>{let n=Ve(e,t.schema);return schemaList.sinkListItem(n)(t,r)};function za(e,t){let r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){let n=r.filter(o=>t?.includes(o.type.name));e.tr.ensureMarks(n);}}var zd=({keepMarks:e=true}={})=>({tr:t,state:r,dispatch:n,editor:o})=>{let{selection:a,doc:i}=t,{$from:l,$to:s}=a,d=o.extensionManager.attributes,m=Vr(d,l.node().type.name,l.node().attrs);if(a instanceof state.NodeSelection&&a.node.isBlock)return !l.parentOffset||!transform.canSplit(i,l.pos)?false:(n&&(e&&za(r,o.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),true);if(!l.parent.isBlock)return false;let u=s.parentOffset===s.parent.content.size,p=l.depth===0?void 0:od(l.node(-1).contentMatchAt(l.indexAfter(-1))),c=u&&p?[{type:p,attrs:m}]:void 0,h=transform.canSplit(t.doc,t.mapping.map(l.pos),1,c);if(!c&&!h&&transform.canSplit(t.doc,t.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(h=true,c=p?[{type:p,attrs:m}]:void 0),n){if(h&&(a instanceof state.TextSelection&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,c),p&&!u&&!l.parentOffset&&l.parent.type!==p)){let f=t.mapping.map(l.before()),g=t.doc.resolve(f);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&t.setNodeMarkup(t.mapping.map(l.before()),p);}e&&za(r,o.extensionManager.splittableMarks),t.scrollIntoView();}return h},Hd=(e,t={})=>({tr:r,state:n,dispatch:o,editor:a})=>{var i;let l=Ve(e,n.schema),{$from:s,$to:d}=n.selection,m=n.selection.node;if(m&&m.isBlock||s.depth<2||!s.sameParent(d))return false;let u=s.node(-1);if(u.type!==l)return false;let p=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==l||s.index(-2)!==s.node(-2).childCount-1)return false;if(o){let b=model.Fragment.empty,w=s.index(-1)?1:s.index(-2)?2:3;for(let L=s.depth-w;L>=s.depth-3;L-=1)b=model.Fragment.from(s.node(L).copy(b));let C=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,x={...Vr(p,s.node().type.name,s.node().attrs),...t},M=((i=l.contentMatch.defaultType)==null?void 0:i.createAndFill(x))||void 0;b=b.append(model.Fragment.from(l.createAndFill(null,M)||void 0));let $=s.before(s.depth-(w-1));r.replace($,s.after(-C),new model.Slice(b,4-w,0));let P=-1;r.doc.nodesBetween($,r.doc.content.size,(L,H)=>{if(P>-1)return false;L.isTextblock&&L.content.size===0&&(P=H+1);}),P>-1&&r.setSelection(state.TextSelection.near(r.doc.resolve(P))),r.scrollIntoView();}return true}let c=d.pos===s.end()?u.contentMatchAt(0).defaultType:null,h={...Vr(p,u.type.name,u.attrs),...t},f={...Vr(p,s.node().type.name,s.node().attrs),...t};r.delete(s.pos,d.pos);let g=c?[{type:l,attrs:h},{type:c,attrs:f}]:[{type:l,attrs:h}];if(!transform.canSplit(r.doc,s.pos,2))return false;if(o){let{selection:b,storedMarks:w}=n,{splittableMarks:C}=a.extensionManager,x=w||b.$to.parentOffset&&b.$from.marks();if(r.split(s.pos,2,g).scrollIntoView(),!x||!o)return true;let M=x.filter($=>C.includes($.type.name));r.ensureMarks(M);}return true},Rn=(e,t)=>{let r=Hn(i=>i.type===t)(e.selection);if(!r)return true;let n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(n===void 0)return true;let o=e.doc.nodeAt(n);return r.node.type===o?.type&&transform.canJoin(e.doc,r.pos)&&e.join(r.pos),true},Dn=(e,t)=>{let r=Hn(i=>i.type===t)(e.selection);if(!r)return true;let n=e.doc.resolve(r.start).after(r.depth);if(n===void 0)return true;let o=e.doc.nodeAt(n);return r.node.type===o?.type&&transform.canJoin(e.doc,n)&&e.join(n),true},Od=(e,t,r,n={})=>({editor:o,tr:a,state:i,dispatch:l,chain:s,commands:d,can:m})=>{let{extensions:u,splittableMarks:p}=o.extensionManager,c=Ve(e,i.schema),h=Ve(t,i.schema),{selection:f,storedMarks:g}=i,{$from:b,$to:w}=f,C=b.blockRange(w),x=g||f.$to.parentOffset&&f.$from.marks();if(!C)return false;let M=Hn($=>Da($.type.name,u))(f);if(C.depth>=1&&M&&C.depth-M.depth<=1){if(M.node.type===c)return d.liftListItem(h);if(Da(M.node.type.name,u)&&c.validContent(M.node.content)&&l)return s().command(()=>(a.setNodeMarkup(M.pos,c),true)).command(()=>Rn(a,c)).command(()=>Dn(a,c)).run()}return !r||!x||!l?s().command(()=>m().wrapInList(c,n)?true:d.clearNodes()).wrapInList(c,n).command(()=>Rn(a,c)).command(()=>Dn(a,c)).run():s().command(()=>{let $=m().wrapInList(c,n),P=x.filter(L=>p.includes(L.type.name));return a.ensureMarks(P),$?true:d.clearNodes()}).wrapInList(c,n).command(()=>Rn(a,c)).command(()=>Dn(a,c)).run()},$d=(e,t={},r={})=>({state:n,commands:o})=>{let{extendEmptyMarkRange:a=false}=r,i=ht(e,n.schema);return xd(n,i,t)?o.unsetMark(i,{extendEmptyMarkRange:a}):o.setMark(i,t)},Fd=(e,t,r={})=>({state:n,commands:o})=>{let a=Ve(e,n.schema),i=Ve(t,n.schema),l=_n(n,a,r),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),l?o.setNode(i,s):o.setNode(a,{...s,...r})},Bd=(e,t={})=>({state:r,commands:n})=>{let o=Ve(e,r.schema);return _n(r,o,t)?n.lift(o):n.wrapIn(o,t)},Vd=()=>({state:e,dispatch:t})=>{let r=e.plugins;for(let n=0;n<r.length;n+=1){let o=r[n],a;if(o.spec.isInputRules&&(a=o.getState(e))){if(t){let i=e.tr,l=a.transform;for(let s=l.steps.length-1;s>=0;s-=1)i.step(l.steps[s].invert(l.docs[s]));if(a.text){let s=i.doc.resolve(a.from).marks();i.replaceWith(a.from,a.to,e.schema.text(a.text,s));}else i.delete(a.from,a.to);}return true}}return false},jd=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,{empty:n,ranges:o}=r;return n||t&&o.forEach(a=>{e.removeMark(a.$from.pos,a.$to.pos);}),true},Ud=(e,t={})=>({tr:r,state:n,dispatch:o})=>{var a;let{extendEmptyMarkRange:i=false}=t,{selection:l}=r,s=ht(e,n.schema),{$from:d,empty:m,ranges:u}=l;if(!o)return true;if(m&&i){let{from:p,to:c}=l,h=(a=d.marks().find(g=>g.type===s))==null?void 0:a.attrs,f=_a(d,s,h);f&&(p=f.from,c=f.to),r.removeMark(p,c,s);}else u.forEach(p=>{r.removeMark(p.$from.pos,p.$to.pos,s);});return r.removeStoredMark(s),true},Kd=e=>({tr:t,state:r,dispatch:n})=>{let{selection:o}=r,a,i;return typeof e=="number"?(a=e,i=e):e&&"from"in e&&"to"in e?(a=e.from,i=e.to):(a=o.from,i=o.to),n&&t.doc.nodesBetween(a,i,(l,s)=>{if(l.isText)return;let d={...l.attrs};delete d.dir,t.setNodeMarkup(s,void 0,d);}),true},Wd=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let a=null,i=null,l=Fa(typeof e=="string"?e:e.name,n.schema);if(!l)return false;l==="node"&&(a=Ve(e,n.schema)),l==="mark"&&(i=ht(e,n.schema));let s=false;return r.selection.ranges.forEach(d=>{let m=d.$from.pos,u=d.$to.pos,p,c,h,f;r.selection.empty?n.doc.nodesBetween(m,u,(g,b)=>{a&&a===g.type&&(s=true,h=Math.max(b,m),f=Math.min(b+g.nodeSize,u),p=b,c=g);}):n.doc.nodesBetween(m,u,(g,b)=>{b<m&&a&&a===g.type&&(s=true,h=Math.max(b,m),f=Math.min(b+g.nodeSize,u),p=b,c=g),b>=m&&b<=u&&(a&&a===g.type&&(s=true,o&&r.setNodeMarkup(b,void 0,{...g.attrs,...t})),i&&g.marks.length&&g.marks.forEach(w=>{if(i===w.type&&(s=true,o)){let C=Math.max(b,m),x=Math.min(b+g.nodeSize,u);r.addMark(C,x,i.create({...w.attrs,...t}));}}));}),c&&(p!==void 0&&o&&r.setNodeMarkup(p,void 0,{...c.attrs,...t}),i&&c.marks.length&&c.marks.forEach(g=>{i===g.type&&o&&r.addMark(h,f,i.create({...g.attrs,...t}));}));}),s},qd=(e,t={})=>({state:r,dispatch:n})=>{let o=Ve(e,r.schema);return commands.wrapIn(o,t)(r,n)},Gd=(e,t={})=>({state:r,dispatch:n})=>{let o=Ve(e,r.schema);return schemaList.wrapInList(o,t)(r,n)};function ru(e){return Object.prototype.toString.call(e).slice(8,-1)}function Fr(e){return ru(e)!=="Object"?false:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Wa(e,t){let r={...e};return Fr(e)&&Fr(t)&&Object.keys(t).forEach(n=>{Fr(t[n])&&Fr(e[n])?r[n]=Wa(e[n],t[n]):r[n]=t[n];}),r}var $n=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name;}get options(){return {...Ce(W(this,"addOptions",{name:this.name}))||{}}}get storage(){return {...Ce(W(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Wa(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Fn=class Ya extends $n{constructor(){super(...arguments),this.type="mark";}static create(t={}){let r=typeof t=="function"?t():t;return new Ya(r)}static handleExit({editor:t,mark:r}){let{tr:n}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){let i=o.marks();if(!!!i.find(d=>d?.type.name===r.name))return false;let s=i.find(d=>d?.type.name===r.name);return s&&n.removeStoredMark(s),n.insertText(" ",o.pos),t.view.dispatch(n),true}return false}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}};var du={};zn(du,{ClipboardTextSerializer:()=>mu,Commands:()=>fu,Delete:()=>gu,Drop:()=>yu,Editable:()=>ku,FocusEvents:()=>Cu,Keymap:()=>Eu,Paste:()=>Du,Tabindex:()=>Lu,TextDirection:()=>Hu,focusEventsPluginKey:()=>Xa});var Me=class qa extends $n{constructor(){super(...arguments),this.type="extension";}static create(t={}){let r=typeof t=="function"?t():t;return new qa(r)}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}},mu=Me.create({name:"clipboardTextSerializer",addOptions(){return {blockSeparator:void 0}},addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:r}=e,{doc:n,selection:o}=t,{ranges:a}=o,i=Math.min(...a.map(m=>m.$from.pos)),l=Math.max(...a.map(m=>m.$to.pos)),s=hd(r);return fd(n,{from:i,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:s})}}})]}}),fu=Me.create({name:"commands",addCommands(){return {...La}}}),gu=Me.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var r,n,o;let a=()=>{var i,l,s,d;if((d=(s=(l=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:l.filterTransaction)==null?void 0:s.call(l,e))!=null?d:e.getMeta("y-sync$"))return;let m=nd(e.before,[e,...t]);vd(m).forEach(c=>{m.mapping.mapResult(c.oldRange.from).deletedAfter&&m.mapping.mapResult(c.oldRange.to).deletedBefore&&m.before.nodesBetween(c.oldRange.from,c.oldRange.to,(h,f)=>{let g=f+h.nodeSize-2,b=c.oldRange.from<=f&&g<=c.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:f,to:g,newFrom:m.mapping.map(f),newTo:m.mapping.map(g),deletedRange:c.oldRange,newRange:c.newRange,partial:!b,editor:this.editor,transaction:e,combinedTransform:m});});});let p=m.mapping;m.steps.forEach((c,h)=>{var f,g;if(c instanceof transform.RemoveMarkStep){let b=p.slice(h).map(c.from,-1),w=p.slice(h).map(c.to),C=p.invert().map(b,-1),x=p.invert().map(w),M=(f=m.doc.nodeAt(b-1))==null?void 0:f.marks.some(P=>P.eq(c.mark)),$=(g=m.doc.nodeAt(w))==null?void 0:g.marks.some(P=>P.eq(c.mark));this.editor.emit("delete",{type:"mark",mark:c.mark,from:c.from,to:c.to,deletedRange:{from:C,to:x},newRange:{from:b,to:w},partial:!!($||M),editor:this.editor,transaction:e,combinedTransform:m});}});};(o=(n=(r=this.editor.options.coreExtensionOptions)==null?void 0:r.delete)==null?void 0:n.async)==null||o?setTimeout(a,0):a();}}),yu=Me.create({name:"drop",addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("tiptapDrop"),props:{handleDrop:(e,t,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:r,moved:n});}}})]}}),ku=Me.create({name:"editable",addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Xa=new state.PluginKey("focusEvents"),Cu=Me.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return [new state.Plugin({key:Xa,props:{handleDOMEvents:{focus:(t,r)=>{e.isFocused=true;let n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",false);return t.dispatch(n),false},blur:(t,r)=>{e.isFocused=false;let n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",false);return t.dispatch(n),false}}}})]}}),Eu=Me.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:l})=>{let{selection:s,doc:d}=l,{empty:m,$anchor:u}=s,{pos:p,parent:c}=u,h=u.parent.isTextblock&&p>0?l.doc.resolve(p-1):u,f=h.parent.type.spec.isolating,g=u.pos-u.parentOffset,b=f&&h.parent.childCount===1?g===u.pos:state.Selection.atStart(d).from===p;return !m||!c.type.isTextblock||c.textContent.length||!b||b&&u.parent.type.name==="paragraph"?false:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},a={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ur()||$a()?a:o},addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("clearDocument"),appendTransaction:(e,t,r)=>{if(e.some(f=>f.getMeta("composition")))return;let n=e.some(f=>f.docChanged)&&!t.doc.eq(r.doc),o=e.some(f=>f.getMeta("preventClearDocument"));if(!n||o)return;let{empty:a,from:i,to:l}=t.selection,s=state.Selection.atStart(t.doc).from,d=state.Selection.atEnd(t.doc).to;if(a||!(i===s&&l===d)||!Ua(r.doc))return;let p=r.tr,c=Wr({state:r,transaction:p}),{commands:h}=new Ln({editor:this.editor,state:c});if(h.clearNodes(),!!p.steps.length)return p}})]}}),Du=Me.create({name:"paste",addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("tiptapPaste"),props:{handlePaste:(e,t,r)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:r});}}})]}}),Lu=Me.create({name:"tabindex",addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Hu=Me.create({name:"textDirection",addOptions(){return {direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return [];let{nodeExtensions:e}=Jt(this.extensions);return [{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{let r=t.getAttribute("dir");return r&&(r==="ltr"||r==="rtl"||r==="auto")?r:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});var Ou={};zn(Ou,{createAtomBlockMarkdownSpec:()=>$u,createBlockMarkdownSpec:()=>Fu,createInlineMarkdownSpec:()=>ju,parseAttributes:()=>Vn,parseIndentedBlocks:()=>Uu,renderNestedMarkdownContent:()=>Ku,serializeAttributes:()=>jn});function Vn(e){if(!e?.trim())return {};let t={},r=[],n=e.replace(/["']([^"']*)["']/g,d=>(r.push(d),`__QUOTED_${r.length-1}__`)),o=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){let d=o.map(m=>m.trim().slice(1));t.class=d.join(" ");}let a=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]);let i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(i)).forEach(([,d,m])=>{var u;let p=parseInt(((u=m.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),c=r[p];c&&(t[d]=c.slice(1,-1));});let s=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(m=>{m.match(/^[a-zA-Z][\w-]*$/)&&(t[m]=true);}),t}function jn(e){if(!e||Object.keys(e).length===0)return "";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(n=>t.push(`.${n}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([r,n])=>{r==="class"||r==="id"||(n===true?t.push(r):n!==false&&n!=null&&t.push(`${r}="${String(n)}"`));}),t.join(" ")}function $u(e){let{nodeName:t,name:r,parseAttributes:n=Vn,serializeAttributes:o=jn,defaultAttributes:a={},requiredAttributes:i=[],allowedAttributes:l}=e,s=r||t,d=m=>{if(!l)return m;let u={};return l.forEach(p=>{p in m&&(u[p]=m[p]);}),u};return {parseMarkdown:(m,u)=>{let p={...a,...m.attributes};return u.createNode(t,p,[])},markdownTokenizer:{name:t,level:"block",start(m){var u;let p=new RegExp(`^:::${s}(?:\\s|$)`,"m"),c=(u=m.match(p))==null?void 0:u.index;return c!==void 0?c:-1},tokenize(m,u,p){let c=new RegExp(`^:::${s}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),h=m.match(c);if(!h)return;let f=h[1]||"",g=n(f);if(!i.find(w=>!(w in g)))return {type:t,raw:h[0],attributes:g}}},renderMarkdown:m=>{let u=d(m.attrs||{}),p=o(u),c=p?` {${p}}`:"";return `:::${s}${c} :::`}}}function Fu(e){let{nodeName:t,name:r,getContent:n,parseAttributes:o=Vn,serializeAttributes:a=jn,defaultAttributes:i={},content:l="block",allowedAttributes:s}=e,d=r||t,m=u=>{if(!s)return u;let p={};return s.forEach(c=>{c in u&&(p[c]=u[c]);}),p};return {parseMarkdown:(u,p)=>{let c;if(n){let f=n(u);c=typeof f=="string"?[{type:"text",text:f}]:f;}else l==="block"?c=p.parseChildren(u.tokens||[]):c=p.parseInline(u.tokens||[]);let h={...i,...u.attributes};return p.createNode(t,h,c)},markdownTokenizer:{name:t,level:"block",start(u){var p;let c=new RegExp(`^:::${d}`,"m"),h=(p=u.match(c))==null?void 0:p.index;return h!==void 0?h:-1},tokenize(u,p,c){var h;let f=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=u.match(f);if(!g)return;let[b,w=""]=g,C=o(w),x=1,M=b.length,$="",P=/^:::([\w-]*)(\s.*)?/gm,L=u.slice(M);for(P.lastIndex=0;;){let H=P.exec(L);if(H===null)break;let D=H.index,y=H[1];if(!((h=H[2])!=null&&h.endsWith(":::"))){if(y)x+=1;else if(x-=1,x===0){let _=L.slice(0,D);$=_.trim();let B=u.slice(0,M+D+H[0].length),R=[];if($)if(l==="block")for(R=c.blockTokens(_),R.forEach(K=>{K.text&&(!K.tokens||K.tokens.length===0)&&(K.tokens=c.inlineTokens(K.text));});R.length>0;){let K=R[R.length-1];if(K.type==="paragraph"&&(!K.text||K.text.trim()===""))R.pop();else break}else R=c.inlineTokens($);return {type:t,raw:B,attributes:C,content:$,tokens:R}}}}}},renderMarkdown:(u,p)=>{let c=m(u.attrs||{}),h=a(c),f=h?` {${h}}`:"",g=p.renderChildren(u.content||[],`
|
|
86
|
+
|
|
87
|
+
`);return `:::${d}${f}
|
|
88
|
+
|
|
89
|
+
${g}
|
|
90
|
+
|
|
91
|
+
:::`}}}function Bu(e){if(!e.trim())return {};let t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,n=r.exec(e);for(;n!==null;){let[,o,a,i]=n;t[o]=a||i,n=r.exec(e);}return t}function Vu(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t}="${r}"`).join(" ")}function ju(e){let{nodeName:t,name:r,getContent:n,parseAttributes:o=Bu,serializeAttributes:a=Vu,defaultAttributes:i={},selfClosing:l=false,allowedAttributes:s}=e,d=r||t,m=p=>{if(!s)return p;let c={};return s.forEach(h=>{let f=typeof h=="string"?h:h.name,g=typeof h=="string"?void 0:h.skipIfDefault;if(f in p){let b=p[f];if(g!==void 0&&b===g)return;c[f]=b;}}),c},u=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return {parseMarkdown:(p,c)=>{let h={...i,...p.attributes};if(l)return c.createNode(t,h);let f=n?n(p):p.content||"";return f?c.createNode(t,h,[c.createTextNode(f)]):c.createNode(t,h,[])},markdownTokenizer:{name:t,level:"inline",start(p){let c=l?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),h=p.match(c),f=h?.index;return f!==void 0?f:-1},tokenize(p,c,h){let f=l?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),g=p.match(f);if(!g)return;let b="",w="";if(l){let[,x]=g;w=x;}else {let[,x,M]=g;w=x,b=M||"";}let C=o(w.trim());return {type:t,raw:g[0],content:b.trim(),attributes:C}}},renderMarkdown:p=>{let c="";n?c=n(p):p.content&&p.content.length>0&&(c=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));let h=m(p.attrs||{}),f=a(h),g=f?` ${f}`:"";return l?`[${d}${g}]`:`[${d}${g}]${c}[/${d}]`}}}function Uu(e,t,r){var n,o,a,i;let l=e.split(`
|
|
92
|
+
`),s=[],d="",m=0,u=t.baseIndentSize||2;for(;m<l.length;){let p=l[m],c=p.match(t.itemPattern);if(!c){if(s.length>0)break;if(p.trim()===""){m+=1,d=`${d}${p}
|
|
93
|
+
`;continue}else return}let h=t.extractItemData(c),{indentLevel:f,mainContent:g}=h;d=`${d}${p}
|
|
94
|
+
`;let b=[g];for(m+=1;m<l.length;){let M=l[m];if(M.trim()===""){let P=l.slice(m+1).findIndex(D=>D.trim()!=="");if(P===-1)break;if((((o=(n=l[m+1+P].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:o.length)||0)>f){b.push(M),d=`${d}${M}
|
|
95
|
+
`,m+=1;continue}else break}if((((i=(a=M.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:i.length)||0)>f)b.push(M),d=`${d}${M}
|
|
96
|
+
`,m+=1;else break}let w,C=b.slice(1);if(C.length>0){let M=C.map($=>$.slice(f+u)).join(`
|
|
97
|
+
`);M.trim()&&(t.customNestedParser?w=t.customNestedParser(M):w=r.blockTokens(M));}let x=t.createToken(h,w);s.push(x);}if(s.length!==0)return {items:s,raw:d}}function Ku(e,t,r,n){if(!e||!Array.isArray(e.content))return "";let o=typeof r=="function"?r(n):r,[a,...i]=e.content,l=t.renderChildren([a]),s=`${o}${l}`;return i&&i.length>0&&i.forEach((d,m)=>{var u,p;let c=(p=(u=t.renderChild)==null?void 0:u.call(t,d,m+1))!=null?p:t.renderChildren([d]);if(c!=null){let h=c.split(`
|
|
98
|
+
`).map(f=>f?t.indent(f):t.indent("")).join(`
|
|
99
|
+
`);s+=d.type==="paragraph"?`
|
|
100
|
+
|
|
101
|
+
${h}`:`
|
|
102
|
+
${h}`;}}),s}var Un=class Ga extends $n{constructor(){super(...arguments),this.type="node";}static create(t={}){let r=typeof t=="function"?t():t;return new Ga(r)}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}};var Yu=20,Ja=(e,t=0)=>{let r=[];return !e.children.length||t>Yu||Array.from(e.children).forEach(n=>{n.tagName==="SPAN"?r.push(n):n.children.length&&r.push(...Ja(n,t+1));}),r},qu=e=>{if(!e.children.length)return;let t=Ja(e);t&&t.forEach(r=>{var n,o;let a=r.getAttribute("style"),i=(o=(n=r.parentElement)==null?void 0:n.closest("span"))==null?void 0:o.getAttribute("style");r.setAttribute("style",`${i};${a}`);});},Kn=Fn.create({name:"textStyle",priority:101,addOptions(){return {HTMLAttributes:{},mergeNestedSpanStyles:true}},parseHTML(){return [{tag:"span",consuming:false,getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&qu(e),{}):false}]},renderHTML({HTMLAttributes:e}){return ["span",Qt(this.options.HTMLAttributes,e),0]},addCommands(){return {toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(r,n)=>{if(r.isTextblock)return true;r.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(a=>!!a))||e.removeMark(n,n+r.nodeSize,this.type);}),true}}}}),Xu=Me.create({name:"backgroundColor",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;let r=e.getAttribute("style");if(r){let n=r.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){let a=n[o].split(":");if(a.length>=2){let i=a[0].trim().toLowerCase(),l=a.slice(1).join(":").trim();if(i==="background-color")return l.replace(/['"]+/g,"")}}}return (t=e.style.backgroundColor)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return {setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Gu=Me.create({name:"color",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;let r=e.getAttribute("style");if(r){let n=r.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){let a=n[o].split(":");if(a.length>=2){let i=a[0].trim().toLowerCase(),l=a.slice(1).join(":").trim();if(i==="color")return l.replace(/['"]+/g,"")}}}return (t=e.style.color)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return {setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Ju=Me.create({name:"fontFamily",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return {setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Qu=Me.create({name:"fontSize",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return {setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Zu=Me.create({name:"lineHeight",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return {setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Me.create({name:"textStyleKit",addExtensions(){let e=[];return this.options.backgroundColor!==false&&e.push(Xu.configure(this.options.backgroundColor)),this.options.color!==false&&e.push(Gu.configure(this.options.color)),this.options.fontFamily!==false&&e.push(Ju.configure(this.options.fontFamily)),this.options.fontSize!==false&&e.push(Qu.configure(this.options.fontSize)),this.options.lineHeight!==false&&e.push(Zu.configure(this.options.lineHeight)),this.options.textStyle!==false&&e.push(Kn.configure(this.options.textStyle)),e}});function tp({node:e,updateAttributes:t,selected:r}){let n=Xr.useRef(null),[o,a]=Xr.useState(false),i=Xr.useRef({x:0,width:0}),{src:l,alt:s,title:d}=e.attrs,m=e.attrs.width;function u(p){p.preventDefault(),p.stopPropagation();let c=n.current?.offsetWidth??(typeof m=="number"?m:200);i.current={x:p.clientX,width:c},a(true);}return Xr.useEffect(()=>{if(!o)return;function p(h){let f=h.clientX-i.current.x,g=Math.max(60,Math.round(i.current.width+f));t({width:g,height:null});}function c(){a(false);}return document.addEventListener("mousemove",p),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",c);}},[o,t]),jsxRuntime.jsxs(react.NodeViewWrapper,{as:"span",className:`rte-image-wrapper${r?" rte-image-wrapper--selected":""}`,children:[jsxRuntime.jsx("img",{ref:n,src:l,alt:s??"",title:d??"",draggable:false,style:{display:"block",maxWidth:"100%",width:m?`${m}px`:void 0,cursor:o?"ew-resize":"default"}}),r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"rte-rh rte-rh--nw"}),jsxRuntime.jsx("span",{className:"rte-rh rte-rh--ne"}),jsxRuntime.jsx("span",{className:"rte-rh rte-rh--sw"}),jsxRuntime.jsx("span",{className:"rte-rh rte-rh--se",onMouseDown:u,title:"Drag to resize",role:"separator","aria-label":"Resize image"}),jsxRuntime.jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:u,title:"Drag to resize",role:"separator","aria-label":"Resize image"}),m&&jsxRuntime.jsxs("span",{className:"rte-image-size-label","aria-live":"polite",children:[m,"px"]})]})]})}var Qa=ep__default.default.extend({name:"image",addAttributes(){return {...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute("width");return t?parseInt(t,10):null},renderHTML:e=>e.width?{width:e.width,style:`width:${e.width}px;`}:{}},height:{default:null,parseHTML:e=>{let t=e.getAttribute("height");return t?parseInt(t,10):null},renderHTML:e=>e.height?{height:e.height}:{}}}},addNodeView(){return react.ReactNodeViewRenderer(tp)}}).configure({inline:true,allowBase64:true});function rp({node:e,updateAttributes:t,selected:r}){let n=Xr.useRef(null),[o,a]=Xr.useState(false),i=Xr.useRef({x:0,width:0}),{src:l}=e.attrs,s=e.attrs.width;function d(m){m.preventDefault(),m.stopPropagation();let u=n.current?.offsetWidth??(typeof s=="number"?s:320);i.current={x:m.clientX,width:u},a(true);}return Xr.useEffect(()=>{if(!o)return;function m(p){let c=p.clientX-i.current.x,h=Math.max(120,Math.round(i.current.width+c));t({width:h});}function u(){a(false);}return document.addEventListener("mousemove",m),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",u);}},[o,t]),jsxRuntime.jsx(react.NodeViewWrapper,{as:"div",className:`rte-video-wrapper${r?" rte-video-wrapper--selected":""}`,children:jsxRuntime.jsxs("div",{ref:n,style:{display:"inline-block",maxWidth:"100%",width:s?`${s}px`:"100%",position:"relative"},children:[jsxRuntime.jsx("video",{src:l,controls:true,style:{display:"block",width:"100%",maxWidth:"100%"}}),r&&jsxRuntime.jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:d,title:"Drag to resize",role:"separator","aria-label":"Resize video"})]})})}var Za=Un.create({name:"resizableVideo",group:"block",atom:true,draggable:true,addAttributes(){return {src:{default:null},width:{default:null,parseHTML:e=>{let t=e.getAttribute("data-width");return t?parseInt(t,10):null},renderHTML:e=>e.width?{"data-width":e.width}:{}}}},parseHTML(){return [{tag:"div[data-type=resizable-video]"}]},renderHTML({HTMLAttributes:e}){return ["div",Qt({"data-type":"resizable-video"},e)]},addNodeView(){return react.ReactNodeViewRenderer(rp)}});function np({node:e,updateAttributes:t,selected:r}){let n=Xr.useRef(null),[o,a]=Xr.useState(false),i=Xr.useRef({x:0,width:0}),{src:l}=e.attrs,s=e.attrs.width??480,d=e.attrs.height??Math.round(s*9/16);function m(u){u.preventDefault(),u.stopPropagation();let p=n.current?.offsetWidth??s;i.current={x:u.clientX,width:p},a(true);}return Xr.useEffect(()=>{if(!o)return;function u(c){let h=c.clientX-i.current.x,f=Math.max(160,Math.round(i.current.width+h));t({width:f,height:Math.round(f*9/16)});}function p(){a(false);}return document.addEventListener("mousemove",u),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p);}},[o,t]),jsxRuntime.jsx(react.NodeViewWrapper,{as:"div",className:`rte-embed-wrapper${r?" rte-embed-wrapper--selected":""}`,children:jsxRuntime.jsxs("div",{ref:n,style:{display:"inline-block",position:"relative",width:`${s}px`,maxWidth:"100%"},children:[jsxRuntime.jsx("iframe",{src:l,width:s,height:d,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation",title:"Embedded video",style:{display:"block",border:"none",maxWidth:"100%"}}),r&&jsxRuntime.jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:m,title:"Drag to resize",role:"separator","aria-label":"Resize embed"})]})})}var ei=Un.create({name:"embedFrame",group:"block",atom:true,draggable:true,addAttributes(){return {src:{default:null},width:{default:480},height:{default:270}}},parseHTML(){return [{tag:"div[data-type=embed-frame]"}]},renderHTML({HTMLAttributes:e}){return ["div",Qt({"data-type":"embed-frame"},e)]},addNodeView(){return react.ReactNodeViewRenderer(np)}});function fr(e){return marked.marked.parse(e,{async:false})}function Yr(e){return e.replace(/<h1[^>]*>([\s\S]*?)<\/h1>/gi,`# $1
|
|
103
|
+
|
|
104
|
+
`).replace(/<h2[^>]*>([\s\S]*?)<\/h2>/gi,`## $1
|
|
105
|
+
|
|
106
|
+
`).replace(/<h3[^>]*>([\s\S]*?)<\/h3>/gi,`### $1
|
|
107
|
+
|
|
108
|
+
`).replace(/<h4[^>]*>([\s\S]*?)<\/h4>/gi,`#### $1
|
|
109
|
+
|
|
110
|
+
`).replace(/<h5[^>]*>([\s\S]*?)<\/h5>/gi,`##### $1
|
|
111
|
+
|
|
112
|
+
`).replace(/<h6[^>]*>([\s\S]*?)<\/h6>/gi,`###### $1
|
|
113
|
+
|
|
114
|
+
`).replace(/<blockquote[^>]*>([\s\S]*?)<\/blockquote>/gi,(t,r)=>r.trim().replace(/^/gm,"> ")+`
|
|
115
|
+
|
|
116
|
+
`).replace(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/gi,"```\n$1\n```\n\n").replace(/<hr\s*\/?>/gi,`
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
`).replace(/<li[^>]*>([\s\S]*?)<\/li>/gi,`- $1
|
|
120
|
+
`).replace(/<\/?(ul|ol)[^>]*>/gi,`
|
|
121
|
+
`).replace(/<strong[^>]*>([\s\S]*?)<\/strong>/gi,"**$1**").replace(/<b[^>]*>([\s\S]*?)<\/b>/gi,"**$1**").replace(/<em[^>]*>([\s\S]*?)<\/em>/gi,"_$1_").replace(/<i[^>]*>([\s\S]*?)<\/i>/gi,"_$1_").replace(/<s[^>]*>([\s\S]*?)<\/s>/gi,"~~$1~~").replace(/<del[^>]*>([\s\S]*?)<\/del>/gi,"~~$1~~").replace(/<code[^>]*>([\s\S]*?)<\/code>/gi,"`$1`").replace(/<a[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi,"[$2]($1)").replace(/<img[^>]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*\/?>/gi,"").replace(/<img[^>]*src="([^"]*)"[^>]*\/?>/gi,"").replace(/<br\s*\/?>/gi,`
|
|
122
|
+
`).replace(/<p[^>]*>([\s\S]*?)<\/p>/gi,`$1
|
|
123
|
+
|
|
124
|
+
`).replace(/<[^>]+>/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/ /g," ").replace(/\n{3,}/g,`
|
|
125
|
+
|
|
126
|
+
`).trim()}function Gn(e){return e.trim()?e.trim().split(/\s+/).length:0}function Jn(e,t,r=false){if(!t)return [];let n=[],o=r?"g":"gi",a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(a,o);return e.descendants((l,s)=>{if(!l.isText||!l.text)return;let d;for(i.lastIndex=0;(d=i.exec(l.text))!==null;)n.push({from:s+d.index,to:s+d.index+d[0].length});}),n}function qr(e,t,r=false){if(!t)return [];let n=r?"g":"gi",o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(o,n),i=[],l;for(;(l=a.exec(e))!==null;)i.push([l.index,l.index+l[0].length]);return i}var ot=new state.PluginKey("rteSearch"),Sp=Me.create({name:"rteSearch",addProseMirrorPlugins(){return [new state.Plugin({key:ot,state:{init(){return {query:"",caseSensitive:false,currentIndex:0,matches:[]}},apply(e,t){let r=e.getMeta(ot);if(r){let n={...t,...r};return n.matches=Jn(e.doc,n.query,n.caseSensitive),n.currentIndex>=n.matches.length&&(n.currentIndex=0),n}if(e.docChanged&&t.query){let n=Jn(e.doc,t.query,t.caseSensitive),o=Math.min(t.currentIndex,Math.max(0,n.length-1));return {...t,matches:n,currentIndex:o}}return t}},props:{decorations(e){let t=ot.getState(e);if(!t?.query||!t.matches.length)return view.DecorationSet.empty;let r=t.matches.map((n,o)=>view.Decoration.inline(n.from,n.to,{class:o===t.currentIndex?"rte-search-current":"rte-search-match"}));return view.DecorationSet.create(e.doc,r)}}})]}});function ri(e){return react.useEditor({extensions:[dp__default.default,up__default.default,pp__default.default.configure({types:["heading","paragraph"]}),Kn,extensionColor.Color,fp__default.default.configure({multicolor:true}),Qa,Za,ei,hp__default.default.configure({openOnClick:false}),gp__default.default.configure({width:480,height:320}),bp__default.default.configure({placeholder:e.placeholder??"Start typing\u2026"}),vp__default.default,yp__default.default,xp__default.default,wp__default.default,extensionTable.Table.configure({resizable:true}),Mp__default.default,Np__default.default,Cp__default.default,Sp],content:e.defaultValue??"",editable:!e.readOnly,autofocus:e.autoFocus,onUpdate:({editor:r})=>{e.onChange?.({html:r.getHTML(),markdown:"",json:r.getJSON(),text:r.getText()});}})}var ym={tab_home:"Home",tab_insert:"Insert",tab_format:"Format",group_clipboard:"Clipboard",undo:"Undo",redo:"Redo",save:"Save",group_text:"Text",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",group_headings:"Headings",h1:"H1",h2:"H2",h3:"H3",paragraph:"Normal",group_alignment:"Alignment",alignLeft:"Left",alignCenter:"Center",alignRight:"Right",alignJustify:"Justify",group_lists:"Lists",bulletList:"Bullet",orderedList:"Ordered",group_media:"Media",image:"Image",video:"Video",youtube:"Video",group_content:"Content",link:"Link",table:"Table",codeBlock:"Code Block",blockquote:"Quote",divider:"Divider",group_style:"Style",color:"Color",highlight:"Highlight",subscript:"Sub",superscript:"Sup",group_reset:"Reset",clear:"Clear",group_table_rows:"Rows",addRowBefore:"Add Above",addRowAfter:"Add Below",deleteRow:"Del Row",group_table_cols:"Columns",addColBefore:"Add Left",addColAfter:"Add Right",deleteColumn:"Del Col",group_table_cells:"Cells",mergeCells:"Merge",splitCell:"Split",deleteTable:"Del Table"};function gt({icon:e,label:t,onClick:r,disabled:n=false,title:o}){return jsxRuntime.jsxs("button",{type:"button",className:v("rte-tbar-btn",n&&"rte-tbar-btn--disabled"),onClick:r,disabled:n,title:o??t,children:[e,jsxRuntime.jsx("span",{className:"rte-tbar-label",children:t})]})}function xm({editor:e,L:t,readOnly:r}){let[,n]=Xr.useState(0),[o,a]=Xr.useState(null),i=Xr.useRef(null);if(Xr.useEffect(()=>{if(!e)return;let m=()=>n(u=>u+1);return e.on("selectionUpdate",m),e.on("transaction",m),()=>{e.off("selectionUpdate",m),e.off("transaction",m);}},[e]),Xr.useEffect(()=>{if(!o)return;function m(u){i.current&&!i.current.contains(u.target)&&a(null);}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]),!e||r||!e.isActive("table"))return null;let l=e.can().mergeCells(),s=e.can().splitCell();function d(){s?e.chain().focus().splitCell().run():a(m=>m?null:"col");}return jsxRuntime.jsxs("div",{className:"rte-tablebar",role:"toolbar","aria-label":"Table editing",children:[jsxRuntime.jsx("span",{className:"rte-tbar-group-label",children:t.group_table_rows}),jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.BetweenHorizontalStart,{size:13}),label:t.addRowBefore,onClick:()=>e.chain().focus().addRowBefore().run()}),jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.BetweenHorizontalEnd,{size:13}),label:t.addRowAfter,onClick:()=>e.chain().focus().addRowAfter().run()}),jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.Trash2,{size:13}),label:t.deleteRow,onClick:()=>e.chain().focus().deleteRow().run()}),jsxRuntime.jsx("div",{className:"rte-tbar-sep"}),jsxRuntime.jsx("span",{className:"rte-tbar-group-label",children:t.group_table_cols}),jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.BetweenVerticalStart,{size:13}),label:t.addColBefore,onClick:()=>e.chain().focus().addColumnBefore().run()}),jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.BetweenVerticalEnd,{size:13}),label:t.addColAfter,onClick:()=>e.chain().focus().addColumnAfter().run()}),jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.Trash2,{size:13}),label:t.deleteColumn,onClick:()=>e.chain().focus().deleteColumn().run()}),jsxRuntime.jsx("div",{className:"rte-tbar-sep"}),jsxRuntime.jsx("span",{className:"rte-tbar-group-label",children:t.group_table_cells}),jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.TableCellsMerge,{size:13}),label:t.mergeCells,onClick:()=>e.chain().focus().mergeCells().run(),disabled:!l,title:l?t.mergeCells:`${t.mergeCells} (Shift+click to select cells)`}),jsxRuntime.jsxs("div",{className:"rte-tbar-split-wrap",ref:i,children:[jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.TableCellsSplit,{size:13}),label:s?t.splitCell:`${t.splitCell}\u2026`,onClick:d,title:s?t.splitCell:"Split by adding a column or row"}),o&&!s&&jsxRuntime.jsxs("div",{className:"rte-tbar-split-picker",children:[jsxRuntime.jsxs("button",{className:"rte-tbar-split-pick-btn",onClick:()=>{e.chain().focus().addColumnAfter().run(),a(null);},children:[jsxRuntime.jsx(lucideReact.BetweenVerticalEnd,{size:13}),"Split column"]}),jsxRuntime.jsxs("button",{className:"rte-tbar-split-pick-btn",onClick:()=>{e.chain().focus().addRowAfter().run(),a(null);},children:[jsxRuntime.jsx(lucideReact.BetweenHorizontalEnd,{size:13}),"Split row"]})]})]}),jsxRuntime.jsx("div",{className:"rte-tbar-sep"}),jsxRuntime.jsx(gt,{icon:jsxRuntime.jsx(lucideReact.Trash2,{size:13}),label:t.deleteTable,onClick:()=>e.chain().focus().deleteTable().run()})]})}function Zn({open:e,onClose:t,children:r}){let n=Xr.useRef(null);return Xr.useEffect(()=>{if(!e)return;function o(a){n.current&&!n.current.contains(a.target)&&t();}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t]),e?jsxRuntime.jsx("div",{ref:n,className:"rte-inline-dialog",children:r}):null}function wm({mode:e,onClose:t,onFind:r,onPrev:n,onNext:o,onReplace:a,onReplaceAll:i,matchCount:l,currentIndex:s}){let[d,m]=Xr__default.default.useState(""),[u,p]=Xr__default.default.useState(""),[c,h]=Xr__default.default.useState(false),f=Xr__default.default.useRef(null);Xr.useEffect(()=>{f.current?.focus();},[]);function g(M){let $=M.target.value;m($),r($,c);}function b(){let M=!c;h(M),r(d,M);}function w(M){if(M.key==="Escape"){t();return}M.key==="Enter"&&(M.shiftKey?n():o());}let C=l>0,x=d?C?`${s+1} / ${l}`:"No results":"";return jsxRuntime.jsxs("div",{className:"rte-findbar",role:"search","aria-label":"Find and replace",children:[jsxRuntime.jsxs("div",{className:"rte-findbar-row",children:[jsxRuntime.jsx(lucideReact.Search,{size:14,className:"rte-findbar-icon"}),jsxRuntime.jsx("input",{ref:f,className:"rte-findbar-input",value:d,onChange:g,onKeyDown:w,placeholder:"Find\u2026","aria-label":"Find",spellCheck:false}),jsxRuntime.jsx("button",{className:v("rte-findbar-btn",c&&"rte-findbar-btn--active"),onClick:b,title:"Match case","aria-pressed":c,children:"Aa"}),jsxRuntime.jsx("span",{className:"rte-findbar-count",children:x}),jsxRuntime.jsx("button",{className:"rte-findbar-btn",onClick:n,disabled:!C,title:"Previous match (Shift+Enter)","aria-label":"Previous match",children:jsxRuntime.jsx(lucideReact.ChevronUp,{size:14})}),jsxRuntime.jsx("button",{className:"rte-findbar-btn",onClick:o,disabled:!C,title:"Next match (Enter)","aria-label":"Next match",children:jsxRuntime.jsx(lucideReact.ChevronDown,{size:14})}),jsxRuntime.jsx("button",{className:"rte-findbar-btn rte-findbar-btn--close",onClick:t,title:"Close (Esc)","aria-label":"Close find bar",children:jsxRuntime.jsx(lucideReact.X,{size:14})})]}),e==="replace"&&jsxRuntime.jsxs("div",{className:"rte-findbar-row",children:[jsxRuntime.jsx(lucideReact.Replace,{size:14,className:"rte-findbar-icon"}),jsxRuntime.jsx("input",{className:"rte-findbar-input",value:u,onChange:M=>p(M.target.value),onKeyDown:M=>M.key==="Escape"&&t(),placeholder:"Replace with\u2026","aria-label":"Replace with",spellCheck:false}),jsxRuntime.jsx("button",{className:"rte-findbar-btn rte-findbar-btn--action",onClick:()=>a(u),disabled:!C,title:"Replace current",children:"Replace"}),jsxRuntime.jsx("button",{className:"rte-findbar-btn rte-findbar-btn--action",onClick:()=>i(u),disabled:!C,title:"Replace all",children:"All"})]})]})}var gr=Xr.forwardRef(function(t,r){let{mode:n,defaultMode:o="richtext",onModeChange:a,showPreview:i,defaultShowPreview:l=false,onPreviewChange:s,defaultValue:d="",value:m,onChange:u,placeholder:p="Start typing\u2026",readOnly:c=false,height:h=400,minHeight:f,maxHeight:g,showWordCount:b=true,showCharCount:w=true,onImageUpload:C,allowedImageTypes:x,maxImageSize:M,autoFocus:$=false,spellCheck:P=true,className:L,style:H,labels:D,extraRibbonGroups:y,extraRibbonTabs:_,onSave:B}=t,R={...ym,...D},[K,ie]=Xr.useState(o),T=n??K;function ye(A){if(A!==T){if(A==="markdown"){let I=N?.getHTML()??ce;ae(Yr(I));}else {let I=fr(O);te(I),N?.commands.setContent(I);}n===void 0&&ie(A),a?.(A);}}let[he,Ne]=Xr.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:false);function ne(A){Ne(A),A?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");}Xr.useEffect(()=>{ne(he);let A=window.matchMedia("(prefers-color-scheme: dark)");function I(pe){Ne(pe.matches),ne(pe.matches);}return A.addEventListener("change",I),()=>A.removeEventListener("change",I)},[]);let[Te,Y]=Xr.useState(l),Ee=i??Te;function We(A){let I=A??!Ee;i===void 0&&Y(I),s?.(I);}let[O,ae]=Xr.useState(T==="markdown"?m??d:""),[ce,te]=Xr.useState(T==="richtext"?m??d??"":""),[be,Se]=Xr.useState(false),[De,J]=Xr.useState(""),[at,de]=Xr.useState(false),[Pe,G]=Xr.useState(""),[ge,ke]=Xr.useState(false),[Ze,xe]=Xr.useState(""),[re,Ye]=Xr.useState(null),[ct,st]=Xr.useState(null),[St,Ae]=Xr.useState(0),[_e,E]=Xr.useState(0),[X,ue]=Xr.useState(""),z=Xr.useRef(null),oe=Xr.useRef(null),Re=Xr.useRef(null);Xr.useEffect(()=>{function A(I){!(I.metaKey||I.ctrlKey)||I.key.toLowerCase()!=="f"||oe.current?.contains(I.target)&&(I.preventDefault(),I.shiftKey?st(me=>me==="replace"?null:"replace"):st(me=>me!==null?null:"find"));}return document.addEventListener("keydown",A,true),()=>document.removeEventListener("keydown",A,true)},[]);function et(A){let I=A.trim();if(/\.(mp4|webm|ogg|ogv|mov|m4v|flv|mkv)(\?[^#]*)?$/i.test(I))return {kind:"video"};if(/(?:youtube\.com|youtu\.be|youtube-nocookie\.com)/.test(I))return {kind:"youtube"};let pe=I.match(/vimeo\.com\/(?:video\/)?(\d+)/);if(pe)return {kind:"iframe",embedUrl:`https://player.vimeo.com/video/${pe[1]}`};let me=I.match(/bilibili\.com\/video\/(BV[\w]+|av\d+)/i);if(me)return {kind:"iframe",embedUrl:`https://player.bilibili.com/player.html?bvid=${me[1]}&high_quality=1&danmaku=0`};let Ie=I.match(/dailymotion\.com\/(?:video\/|embed\/video\/)([a-z0-9]+)/i);if(Ie)return {kind:"iframe",embedUrl:`https://www.dailymotion.com/embed/video/${Ie[1]}`};let Fe=I.match(/twitch\.tv\/\w+\/clip\/([\w-]+)/);if(Fe){let Je=typeof window<"u"?window.location.hostname:"localhost";return {kind:"iframe",embedUrl:`https://clips.twitch.tv/embed?clip=${Fe[1]}&parent=${Je}`}}return null}function _t(){let A=Ze.trim();if(!A)return;let I=et(A);if(!I){Ye("Unsupported URL. Paste a YouTube, Vimeo, Bilibili, Dailymotion, or direct .mp4/.webm link.");return}I.kind==="youtube"?N?.chain().focus().setYoutubeVideo({src:A}).run():I.kind==="iframe"?N?.chain().focus().insertContent({type:"embedFrame",attrs:{src:I.embedUrl}}).run():N?.chain().focus().insertContent({type:"resizableVideo",attrs:{src:A}}).run(),xe(""),Ye(null),ke(false);}function k(A,I){N&&N.view.dispatch(N.view.state.tr.setMeta(ot,{query:A,caseSensitive:I,currentIndex:0}));}function U(A){if(!N)return;let I=ot.getState(N.view.state);if(!I||!I.matches.length)return;let pe=I.matches.length,me=((I.currentIndex+A)%pe+pe)%pe;N.view.dispatch(N.view.state.tr.setMeta(ot,{currentIndex:me}));let Ie=I.matches[me];Ie&&(N.commands.setTextSelection({from:Ie.from,to:Ie.to}),N.commands.scrollIntoView());}function se(A){if(!N)return;let I=ot.getState(N.view.state);if(!I||!I.matches.length)return;let pe=I.matches[I.currentIndex];pe&&(N.chain().setTextSelection({from:pe.from,to:pe.to}).insertContent(A).run(),k(I.query,I.caseSensitive));}function le(A){if(!N)return;let I=ot.getState(N.view.state);if(!I||!I.matches.length)return;let pe=N.chain();[...I.matches].reverse().forEach(me=>{pe.setTextSelection({from:me.from,to:me.to}).insertContent(A);}),pe.run(),k(I.query,I.caseSensitive);}function ve(A,I){ue(A);let pe=qr(O,A,I);Ae(pe.length),E(0);}function qe(A,I,pe){let me=qr(O,I,pe);if(!me.length)return;let Ie=me.length,Fe=((_e+A)%Ie+Ie)%Ie;E(Fe);let Je=Re.current;Je&&(Je.focus(),Je.setSelectionRange(me[Fe][0],me[Fe][1]));}function dt(A,I,pe){let me=qr(O,A,pe);if(!me.length)return;let[Ie,Fe]=me[_e]??me[0],Je=O.slice(0,Ie)+I+O.slice(Fe);ae(Je);}function br(A,I,pe){let me=A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ie=new RegExp(me,"gi");ae(Fe=>Fe.replace(Ie,I)),Ae(0),E(0);}let N=ri({defaultValue:T==="richtext"?m??d:"",placeholder:p,readOnly:c,autoFocus:T==="richtext"&&$,onChange:A=>{te(A.html),u?.({...A,markdown:Yr(A.html)});}});Xr.useEffect(()=>{m!==void 0&&N&&T==="richtext"&&N.getHTML()!==m&&(N.commands.setContent(m),te(m));},[m,N,T]);let ut=N?ot.getState(N.view.state):null,bt=T==="richtext"?ut?.matches.length??0:St,er=T==="richtext"?ut?.currentIndex??0:_e;function Ht(){if(!B)return;let A=T==="markdown"?O:N?.getHTML()??"";B(A,T);}Xr.useEffect(()=>{if(!B)return;function A(I){!(I.metaKey||I.ctrlKey)||I.key.toLowerCase()!=="s"||oe.current?.contains(I.target)&&(I.preventDefault(),Ht());}return document.addEventListener("keydown",A,true),()=>document.removeEventListener("keydown",A,true)},[B,T,O,N]);function Tt(A){let I=A.target.value;ae(I),u?.({html:fr(I),markdown:I,json:{},text:I});}let ii=Xr.useCallback(async A=>{let pe=Array.from(A.clipboardData?.items??[]).find(Fe=>Fe.type.startsWith("image/"));if(!pe)return;A.preventDefault();let me=pe.getAsFile();if(!me||x&&!x.includes(me.type)||M&&me.size>M)return;let Ie;if(C?Ie=await C(me):Ie=await new Promise(Fe=>{let Je=new FileReader;Je.onload=()=>Fe(Je.result),Je.readAsDataURL(me);}),T==="richtext"&&N)N.chain().focus().setImage({src:Ie}).run();else {let Fe=A.currentTarget.querySelector(".rte-markdown-source");if(Fe){let Je=Fe.selectionStart,ui=``,pi=O.slice(0,Je),mi=O.slice(Je);ae(pi+ui+mi);}}},[T,N,O,C,x,M]);Xr.useImperativeHandle(r,()=>({getContent:()=>T==="markdown"?O:N?.getHTML()??"",getMode:()=>T,getHTML:()=>N?.getHTML()??"",getMarkdown:()=>T==="markdown"?O:Yr(N?.getHTML()??""),getJSON:()=>N?.getJSON()??{},getText:()=>N?.getText()??"",setHTML:A=>N?.commands.setContent(A),setMarkdown:A=>{ae(A),N?.commands.setContent(fr(A));},setJSON:A=>N?.commands.setContent(A),clear:()=>{N?.commands.clearContent(),ae("");},focus:()=>N?.commands.focus(),blur:()=>(N?.view.dom).blur()}));let si=N?.storage?.characterCount?.characters?.()??O.length,li=T==="richtext"?Gn(N?.getText()??""):Gn(O),ci=[...[{key:"home",label:R.tab_home,groups:[{key:"clipboard",label:R.group_clipboard,items:[{key:"undo",label:R.undo,icon:jsxRuntime.jsx(lucideReact.Undo2,{}),disabled:c||!N?.can().undo()||T==="markdown",onClick:()=>N?.chain().focus().undo().run()},{key:"redo",label:R.redo,icon:jsxRuntime.jsx(lucideReact.Redo2,{}),disabled:c||!N?.can().redo()||T==="markdown",onClick:()=>N?.chain().focus().redo().run()},{key:"save",label:R.save,icon:jsxRuntime.jsx(lucideReact.Save,{}),disabled:c||!B,onClick:Ht}]},{key:"text",label:R.group_text,items:[{key:"bold",label:R.bold,icon:jsxRuntime.jsx(lucideReact.Bold,{}),active:N?.isActive("bold"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleBold().run()},{key:"italic",label:R.italic,icon:jsxRuntime.jsx(lucideReact.Italic,{}),active:N?.isActive("italic"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleItalic().run()},{key:"underline",label:R.underline,icon:jsxRuntime.jsx(lucideReact.Underline,{}),active:N?.isActive("underline"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleUnderline().run()},{key:"strike",label:R.strikethrough,icon:jsxRuntime.jsx(lucideReact.Strikethrough,{}),active:N?.isActive("strike"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleStrike().run()}]},{key:"headings",label:R.group_headings,items:[{key:"h1",label:R.h1,icon:jsxRuntime.jsx(lucideReact.Heading1,{}),active:N?.isActive("heading",{level:1}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleHeading({level:1}).run()},{key:"h2",label:R.h2,icon:jsxRuntime.jsx(lucideReact.Heading2,{}),active:N?.isActive("heading",{level:2}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleHeading({level:2}).run()},{key:"h3",label:R.h3,icon:jsxRuntime.jsx(lucideReact.Heading3,{}),active:N?.isActive("heading",{level:3}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleHeading({level:3}).run()},{key:"paragraph",label:R.paragraph,icon:jsxRuntime.jsx(lucideReact.Type,{}),active:N?.isActive("paragraph"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().setParagraph().run()}]},{key:"alignment",label:R.group_alignment,items:[{key:"align-left",label:R.alignLeft,icon:jsxRuntime.jsx(lucideReact.AlignLeft,{}),active:N?.isActive({textAlign:"left"}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().setTextAlign("left").run()},{key:"align-center",label:R.alignCenter,icon:jsxRuntime.jsx(lucideReact.AlignCenter,{}),active:N?.isActive({textAlign:"center"}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().setTextAlign("center").run()},{key:"align-right",label:R.alignRight,icon:jsxRuntime.jsx(lucideReact.AlignRight,{}),active:N?.isActive({textAlign:"right"}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().setTextAlign("right").run()},{key:"align-justify",label:R.alignJustify,icon:jsxRuntime.jsx(lucideReact.AlignJustify,{}),active:N?.isActive({textAlign:"justify"}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().setTextAlign("justify").run()}]},{key:"lists",label:R.group_lists,items:[{key:"bullet-list",label:R.bulletList,icon:jsxRuntime.jsx(lucideReact.List,{}),active:N?.isActive("bulletList"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleBulletList().run()},{key:"ordered-list",label:R.orderedList,icon:jsxRuntime.jsx(lucideReact.ListOrdered,{}),active:N?.isActive("orderedList"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleOrderedList().run()}]},...y?.home??[]]},{key:"insert",label:R.tab_insert,groups:[{key:"media",label:R.group_media,items:[{key:"image",label:R.image,icon:jsxRuntime.jsx(lucideReact.Image,{}),disabled:c||T==="markdown",onClick:()=>Se(true)},{key:"video",label:R.video??R.youtube,icon:jsxRuntime.jsx(lucideReact.Video,{}),disabled:c||T==="markdown",onClick:()=>{xe(""),Ye(null),ke(true);}}]},{key:"content",label:R.group_content,items:[{key:"link",label:R.link,icon:jsxRuntime.jsx(lucideReact.Link,{}),active:N?.isActive("link"),disabled:c||T==="markdown",onClick:()=>{let A=N?.getAttributes("link").href??"";G(A),de(true);}},{key:"table",label:R.table,icon:jsxRuntime.jsx(lucideReact.Table,{}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:true}).run()},{key:"code-block",label:R.codeBlock,icon:jsxRuntime.jsx(lucideReact.Code,{}),active:N?.isActive("codeBlock"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleCodeBlock().run()},{key:"blockquote",label:R.blockquote,icon:jsxRuntime.jsx(lucideReact.Quote,{}),active:N?.isActive("blockquote"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleBlockquote().run()},{key:"hr",label:R.divider,icon:jsxRuntime.jsx(lucideReact.Minus,{}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().setHorizontalRule().run()}]},...y?.insert??[]]},{key:"format",label:R.tab_format,groups:[{key:"style",label:R.group_style,items:[{key:"color",label:R.color,icon:jsxRuntime.jsx(lucideReact.Palette,{}),disabled:c||T==="markdown",onClick:()=>{document.getElementById("rte-color-input")?.click();}},{key:"highlight",label:R.highlight,icon:jsxRuntime.jsx(lucideReact.Highlighter,{}),active:N?.isActive("highlight"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleHighlight().run()},{key:"subscript",label:R.subscript,icon:jsxRuntime.jsx(lucideReact.Subscript,{}),active:N?.isActive("subscript"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleSubscript().run()},{key:"superscript",label:R.superscript,icon:jsxRuntime.jsx(lucideReact.Superscript,{}),active:N?.isActive("superscript"),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().toggleSuperscript().run()}]},{key:"reset",label:R.group_reset,items:[{key:"clear",label:R.clear,icon:jsxRuntime.jsx(lucideReact.Eraser,{}),disabled:c||T==="markdown",onClick:()=>N?.chain().focus().unsetAllMarks().clearNodes().run()}]},...y?.format??[]]}],..._??[]],vr={};h&&(vr.height=typeof h=="number"?`${h}px`:h),f&&(vr.minHeight=typeof f=="number"?`${f}px`:f),g&&(vr.maxHeight=typeof g=="number"?`${g}px`:g);let di=T==="richtext"?ce:fr(O);return jsxRuntime.jsxs("div",{ref:oe,className:v("rte-root",L),style:{...vr,...H},"data-testid":"rte-root",onPaste:ii,children:[jsxRuntime.jsx("input",{id:"rte-color-input",type:"color",className:"sr-only","aria-hidden":true,onChange:A=>{N?.chain().focus().setColor(A.target.value).run();}}),jsxRuntime.jsxs("div",{ref:z,className:"rte-ribbon relative",children:[jsxRuntime.jsx(ya,{tabs:ci}),jsxRuntime.jsxs(Zn,{open:be,onClose:()=>Se(false),children:[jsxRuntime.jsx("input",{type:"url",placeholder:"Image URL\u2026",value:De,onChange:A=>J(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(De&&N?.chain().focus().setImage({src:De}).run(),J(""),Se(false));},autoFocus:true}),jsxRuntime.jsx("button",{onClick:()=>{De&&N?.chain().focus().setImage({src:De}).run(),J(""),Se(false);},children:"Insert"}),jsxRuntime.jsx("button",{className:"rte-cancel-btn",onClick:()=>Se(false),children:"Cancel"})]}),jsxRuntime.jsxs(Zn,{open:at,onClose:()=>de(false),children:[jsxRuntime.jsx("input",{type:"url",placeholder:"https://\u2026",value:Pe,onChange:A=>G(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(N?.chain().focus().setLink({href:Pe}).run(),G(""),de(false));},autoFocus:true}),jsxRuntime.jsx("button",{onClick:()=>{N?.chain().focus().setLink({href:Pe}).run(),G(""),de(false);},children:"Apply"}),jsxRuntime.jsx("button",{className:"rte-cancel-btn",onClick:()=>de(false),children:"Cancel"})]}),jsxRuntime.jsxs(Zn,{open:ge,onClose:()=>ke(false),children:[jsxRuntime.jsx("input",{type:"url",placeholder:"YouTube, Vimeo, Bilibili, or .mp4 URL\u2026",value:Ze,onChange:A=>{xe(A.target.value),Ye(null);},onKeyDown:A=>{A.key==="Enter"&&_t();},autoFocus:true,style:{minWidth:280}}),re&&jsxRuntime.jsx("span",{style:{fontSize:"0.72rem",color:"var(--color-danger-500)",flex:"0 0 100%"},children:re}),jsxRuntime.jsx("button",{onClick:_t,children:"Embed"}),jsxRuntime.jsx("button",{className:"rte-cancel-btn",onClick:()=>ke(false),children:"Cancel"})]})]}),T==="richtext"&&jsxRuntime.jsx(xm,{editor:N,L:R,readOnly:c??false}),ct!==null&&jsxRuntime.jsx(wm,{mode:ct,onClose:()=>{st(null),N&&N.view.dispatch(N.view.state.tr.setMeta(ot,{query:"",currentIndex:0,matches:[]})),Ae(0),E(0),ue("");},onFind:(A,I)=>{T==="richtext"?k(A,I):ve(A,I);},onPrev:()=>{T==="richtext"?U(-1):qe(-1,X,false);},onNext:()=>{T==="richtext"?U(1):qe(1,X,false);},onReplace:A=>{if(T==="richtext"){let I=N?ot.getState(N.view.state):null;se(A),I&&ve(I.query,I.caseSensitive);}else dt(X,A,false);},onReplaceAll:A=>{T==="richtext"?le(A):br(X,A);},matchCount:bt,currentIndex:er}),jsxRuntime.jsxs("div",{className:"rte-body",children:[jsxRuntime.jsx("div",{className:"rte-editor-pane",children:T==="richtext"?jsxRuntime.jsx(react.EditorContent,{editor:N,spellCheck:P,readOnly:c}):jsxRuntime.jsx("textarea",{ref:Re,className:"rte-markdown-source",value:O,onChange:Tt,placeholder:p,readOnly:c,spellCheck:P,"data-testid":"rte-markdown-source"})}),Ee&&jsxRuntime.jsx("div",{className:"rte-preview-pane","data-testid":"rte-preview-pane",children:jsxRuntime.jsx("div",{className:"prose",dangerouslySetInnerHTML:{__html:di}})})]}),jsxRuntime.jsxs("div",{className:"rte-statusbar",children:[jsxRuntime.jsxs("div",{className:"rte-statusbar-left",children:[jsxRuntime.jsx(Hr,{size:"sm",checked:he,onCheckedChange:ne,checkedContent:jsxRuntime.jsx(lucideReact.Moon,{size:10}),uncheckedContent:jsxRuntime.jsx(lucideReact.Sun,{size:10}),"aria-label":"Toggle dark mode",title:he?"Switch to light mode":"Switch to dark mode"}),jsxRuntime.jsx("span",{className:"rte-statusbar-divider"}),jsxRuntime.jsx(Hr,{size:"sm",checked:T==="markdown",onCheckedChange:A=>ye(A?"markdown":"richtext"),disabled:n!==void 0,checkedContent:jsxRuntime.jsx(lucideReact.Code,{size:10}),uncheckedContent:jsxRuntime.jsx(lucideReact.FileText,{size:10}),"aria-label":"Toggle editor mode",title:n!==void 0?`Mode locked: ${T}`:T==="markdown"?"Markdown mode (click for Rich Text)":"Rich Text mode (click for Markdown)"}),jsxRuntime.jsx("span",{className:"rte-statusbar-label",children:T==="markdown"?"Markdown":"Rich Text"})]}),jsxRuntime.jsxs("div",{className:"rte-statusbar-right",children:[jsxRuntime.jsx(Hr,{size:"sm",checked:Ee,onCheckedChange:We,checkedContent:jsxRuntime.jsx(lucideReact.Eye,{size:10}),uncheckedContent:jsxRuntime.jsx(lucideReact.EyeOff,{size:10}),"aria-label":"Toggle live preview",title:Ee?"Hide preview":"Show live preview"}),jsxRuntime.jsx("span",{className:"rte-statusbar-label",children:"Preview"}),(b||w)&&jsxRuntime.jsx("span",{className:"rte-statusbar-divider"}),b&&jsxRuntime.jsxs("span",{children:[li," words"]}),w&&jsxRuntime.jsxs("span",{children:[si," chars"]})]})]})]})});gr.displayName="RichTextEditor";var km={FilmReel:Qr,MiniPlayer:en,CinePlayer:rn,FileExplorer:pn,Masonry:gn,TypewriterText:Er,CommandPalette:Rr,Timeline:yn,DateTimePicker:Ar,LoginPanel:Ir,RichTextEditor:gr},Fv=km;
|
|
127
|
+
exports.CinePlayer=rn;exports.CommandPalette=Rr;exports.DateTimePicker=Ar;exports.Extras=km;exports.FileExplorer=pn;exports.FilmReel=Qr;exports.LoginPanel=Ir;exports.Masonry=gn;exports.MiniPlayer=en;exports.RichTextEditor=gr;exports.Timeline=yn;exports.TypewriterText=Er;exports.default=Fv;
|