@moondreamsdev/dreamer-ui 1.7.23 → 1.7.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- "use strict";var Ue=Object.defineProperty;var Qe=(r,a,t)=>a in r?Ue(r,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[a]=t;var je=(r,a,t)=>Qe(r,typeof a!="symbol"?a+"":a,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),k=require("./join-BVMUUvyP.cjs"),L=require("./Window-CjC02flR.cjs"),J=require("./Toast-CQnaydN2.cjs"),re=require("./X-CgjeP2OI.cjs");require("./useTheme-Bdg1t0Zr.cjs");const Xe=require("./useScreenSize-UGyolnfn.cjs"),ye=require("react-dom"),ve=require("./utils.cjs.js");function fe({id:r,title:a,content:t,children:o,className:s="",disabled:n=!1,isOpen:i=!1,onToggle:u,triggerClassName:c="",bodyClassName:x=""}){const f=l.useId(),d=r||`accordion-item-${f}`,h=`${d}-header`,m=`${d}-panel`,g=()=>{!n&&u&&u()},v=p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),g())};return e.jsxs("div",{className:k.join("border-b border-gray-200",n&&"opacity-60 cursor-not-allowed",s),children:[e.jsxs("button",{id:h,type:"button",className:k.join("w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary",n?"cursor-not-allowed":"hover:bg-gray-50/10 cursor-pointer",c),"aria-expanded":i,"aria-controls":m,disabled:n,onClick:g,onKeyDown:v,children:[e.jsx("span",{children:a}),e.jsx("span",{className:k.join("transform transition-transform ease-linear",i?"rotate-180":"rotate-0"),"aria-hidden":"true",children:e.jsx(L.ChevronDown,{size:18})})]}),e.jsx("div",{id:m,role:"region","aria-labelledby":h,className:k.join("transition-all ease-linear px-4",i?"max-h-96 opacity-100 overflow-auto py-3":"max-h-0 opacity-0 overflow-hidden",x),children:i&&(o||t)})]})}function Je({id:r,items:a=[],children:t,className:o="",itemClassName:s="",allowMultiple:n=!1,defaultOpenItems:i=[],triggersClassName:u="",bodiesClassName:c=""}){const x=l.useId(),f=r||`accordion-group-${x}`,[d,h]=l.useState(new Set(i)),m=p=>{h(C=>{const b=new Set(C);return b.has(p)?b.delete(p):(n||b.clear(),b.add(p)),b})},g=p=>`${x}-item-${p}`,v=p=>d.has(p);return e.jsxs("div",{id:f,className:o,children:[a.length>0&&a.map((p,C)=>{const b=p.id||g(C);return e.jsx(fe,{id:b,title:p.title,content:p.content,disabled:p.disabled,isOpen:v(b),onToggle:()=>m(b),className:s,triggerClassName:u,bodyClassName:c},b)}),a.length===0&&t&&l.Children.map(t,(p,C)=>{if(l.isValidElement(p)&&p.type===fe){const b=p.props.id||g(C);return l.createElement(fe,{...p.props,key:b,id:b,className:k.join(s,p.props.className),isOpen:v(b),onToggle:()=>m(b),triggerClassName:k.join(u,p.props.triggerClassName),bodyClassName:k.join(c,p.props.bodyClassName)})}return null})]})}const Oe=r=>({__type:"input",...r}),et=r=>({__type:"textarea",...r}),tt=r=>({__type:"select",...r}),rt=r=>({__type:"checkbox",...r}),st=r=>({__type:"radio",...r}),nt=r=>({__type:"checkboxGroup",...r}),at=r=>({__type:"custom",...r}),ze={input:Oe,textarea:et,select:tt,checkbox:rt,radio:st,checkboxGroup:nt,custom:at};function ot(r,a){const[t,o]=l.useState({}),s=l.useCallback((f,d)=>{if(f.required){if(f.__type==="checkboxGroup"){if(!d||!Array.isArray(d)||d.length===0)return`${f.label} is required`}else if(!d||typeof d=="string"&&d.trim()==="")return`${f.label} is required`}if(f.isValid&&d){const h=f.isValid,m=h(d);if(!m.valid)return m.message||`${f.label} is invalid`}return null},[]),n=l.useCallback((f=a)=>{const d={};return r.forEach(h=>{const m=s(h,f[h.name]);m&&(d[h.name]=m)}),o(d),Object.keys(d).length===0},[r,a,s]),i=l.useCallback((f,d)=>{const h=r.find(g=>g.name===f);if(!h)return;const m=s(h,d);return o(g=>{const v={...g};return m?v[f]=m:delete v[f],v}),!m},[r,s]),u=l.useCallback(()=>{o({})},[]),c=l.useMemo(()=>Object.values(t).some(f=>f),[t]),x=l.useMemo(()=>r.every(f=>{const d=a[f.name];if(f.required){if(f.__type==="checkboxGroup"){if(!d||!Array.isArray(d)||d.length===0)return!1}else if(!d||typeof d=="string"&&d.trim()==="")return!1}if(f.isValid&&d){const h=f.isValid;return h(d).valid}return!0})&&!c,[r,a,c]);return{errors:t,hasErrors:c,isFormValid:x,validateForm:n,validateSingleField:i,clearErrors:u}}const pe={spacing:{tight:"gap-3",normal:"gap-4",loose:"gap-6"},columns:{1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"},colSpan:{1:"col-span-1",2:"col-span-1 md:col-span-2",3:"col-span-1 md:col-span-2 lg:col-span-3",4:"col-span-1 md:col-span-2 lg:col-span-4",full:"col-span-full"}},be={spacing:"normal",columns:1,responsive:!0};function Me({id:r,children:a,message:t,placement:o="top",disabled:s=!1,delay:n=100,showArrow:i=!0,className:u}){const[c,x]=l.useState(!1),[f,d]=l.useState(!1),[h,m]=l.useState(!1),[g,v]=l.useState(!1),p=l.useRef(null),C=l.useId(),b=r??C,y=l.useCallback(()=>{s||(p.current&&clearTimeout(p.current),p.current=window.setTimeout(()=>{x(!0)},n))},[s,n]),w=l.useCallback((D=!1)=>{if(p.current&&clearTimeout(p.current),D){x(!1);return}p.current=window.setTimeout(()=>{x(!1)},100)},[]);l.useEffect(()=>{!f&&!h&&!g&&c&&w()},[f,h,g,c,w]),l.useEffect(()=>{if(!c)return;const D=()=>{w(!0)};return window.addEventListener("scroll",D,!0),()=>{window.removeEventListener("scroll",D,!0)}},[c,w]),l.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const F=()=>{const D="absolute z-50 px-2 py-1 text-sm rounded shadow-lg bg-tooltip text-tooltip-foreground pointer-events-auto transition-all ease-out w-max max-w-xs",N=c?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none",E={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},A={top:"origin-bottom",bottom:"origin-top",left:"origin-right",right:"origin-left"};return k.join(D,E[o],A[o],N,u)},M=()=>{if(!i)return"";const D="absolute w-0 h-0 pointer-events-none",N={top:"top-full left-1/2 -translate-x-1/2 border-l-[6px] border-r-[6px] border-t-[6px] border-l-transparent border-r-transparent border-t-tooltip",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-[6px] border-r-[6px] border-b-[6px] border-l-transparent border-r-transparent border-b-tooltip",left:"left-full top-1/2 -translate-y-1/2 border-t-[6px] border-b-[6px] border-l-[6px] border-t-transparent border-b-transparent border-l-tooltip",right:"right-full top-1/2 -translate-y-1/2 border-t-[6px] border-b-[6px] border-r-[6px] border-t-transparent border-b-transparent border-r-tooltip"};return k.join(D,N[o])},j=a.props;return e.jsx(e.Fragment,{children:l.cloneElement(a,{style:{...j.style,position:"relative"},onMouseEnter:()=>{d(!0),y()},onMouseLeave:()=>{d(!1)},onFocus:()=>{v(!0),y()},onBlur:()=>{v(!1),w(!0)},onKeyDown:D=>{D.key==="Escape"&&w(!0)},"aria-describedby":s?void 0:b,children:e.jsxs(e.Fragment,{children:[j.children,!s&&e.jsxs("div",{id:b,role:"tooltip",className:F(),"aria-hidden":!c,"aria-live":c?"polite":void 0,onMouseEnter:()=>{m(!0),p.current&&clearTimeout(p.current)},onMouseLeave:()=>{m(!1)},children:[t,i&&e.jsx("div",{className:M(),"aria-hidden":!0})]})]})})})}function Te({id:r,ref:a,design:t="filled",iconSize:o=14,className:s,...n}){const i=t==="filled"?L.InfoCircledFilled:re.InfoCircled;return e.jsx(Me,{...n,children:e.jsx("div",{id:r,ref:a,className:k.join("inline-block cursor-help text-muted-foreground transition-colors align-top",s),"data-help-icon":"true","data-design":t,"data-size":o,children:e.jsx(i,{size:o,className:"fill-current"})})})}function se({display:r="inline",width:a="fit-content",className:t="",required:o,helpMessage:s,suffix:n,htmlFor:i,children:u,description:c,...x}){var g,v;const f=l.useId(),d=(((g=s==null?void 0:s.trim())==null?void 0:g.length)||0)>0,h=(((v=c==null?void 0:c.trim())==null?void 0:v.length)||0)>0,m=h?`${i??f}-description`:void 0;return e.jsxs("div",{style:{display:r==="inline"?"inline-block":"block",width:a},className:k.join("mb-0.5",t),children:[e.jsxs("div",{className:"relative flex",children:[e.jsxs("label",{className:"font-medium",htmlFor:i,...x,children:[u,o&&e.jsx("span",{className:"text-red-500 font-medium ml-1","aria-label":"required",children:"*"})]}),d&&e.jsx(Te,{message:s,className:"ml-1",design:"outlined",iconSize:14}),n&&e.jsx("span",{className:"ml-1",children:n})]}),h&&e.jsx("small",{id:m,className:"block opacity-80 mt-0.5",role:"note",children:c})]})}function me({elementId:r,type:a,message:t}){return l.useEffect(()=>{const o=document.getElementById(r);if(o){if(!t&&a==="error"){o.removeAttribute("data-error");return}if(!t&&a==="success"){o.removeAttribute("data-success");return}return o.setAttribute("aria-describedby",`${r}-${a}-message`),o.setAttribute("aria-invalid",a==="error"?"true":"false"),a==="error"&&o.setAttribute("data-error","true"),a==="success"&&o.setAttribute("data-success","true"),()=>{o.removeAttribute("aria-describedby"),o.removeAttribute("aria-invalid"),o.removeAttribute("data-error"),o.removeAttribute("data-success")}}},[r,a,t]),t?e.jsxs("small",{className:k.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start",a==="error"&&"text-destructive",a==="success"&&"text-success"),role:"status",children:[a==="error"?e.jsx(re.ExclamationTriangle,{}):e.jsx(L.CheckCircled,{}),e.jsx("span",{id:`${r}-${a}-message`,children:t})]}):null}const lt={base:"",transparent:"border border-transparent focus:border-current/60 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",underline:"border-b border-border focus:border-current/60 disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",outline:"border border-border focus:border-current/60 disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",solid:"bg-muted/50 focus:bg-muted/70 not-disabled:data-error:border-destructive/70 not-disabled:data-success:border-success/70"},it={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},we={variant:"outline",rounded:"none"};function Re({variant:r=we.variant,rounded:a,displayOnlyMode:t=!1,errorMessage:o,successMessage:s,type:n="text",className:i,...u}){const c=l.useId(),[x,f]=l.useState(!1);let d=a;r==="outline"&&!a&&(d="md"),d=d||we.rounded;const g=k.join("appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted-foreground/70 hide-number-input-arrows transition-all","file:mr-2 file:border-0 file:rounded-md file:px-1.5 file:py-1 file:bg-primary hover:file:bg-primary/85 file:text-sm file:font-medium file:text-foreground file:transition-colors",!t&&lt[r],!t&&it[d],n==="password"&&"pr-10",!t&&"px-2 py-1",t&&"pointer-events-none cursor-text",i),v=!t&&(o||s),p=n==="password",C=v;return!C&&!p?e.jsx("input",{...u,id:c,name:u.name||c,type:n,"aria-disabled":u.disabled,readOnly:t,"aria-readonly":t||u["aria-readonly"],"data-error":o?!0:void 0,"data-success":s?!0:void 0,className:g}):!C&&p?e.jsxs("div",{className:"relative",children:[e.jsx("input",{...u,id:c,name:u.name||c,type:n==="password"&&x?"text":n,"aria-disabled":u.disabled,readOnly:t,"aria-readonly":t||u["aria-readonly"],"data-error":o?!0:void 0,"data-success":s?!0:void 0,className:g}),e.jsx("button",{onClick:()=>f(!x),className:"absolute inset-y-0 right-0 px-2 hover:cursor-pointer","aria-label":"Toggle password visibility","data-state":x?"visible":"hidden",children:x?e.jsx(L.EyeOpened,{size:20}):e.jsx(L.EyeClosed,{size:20})})]}):e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:k.join(n==="password"&&"relative"),children:[e.jsx("input",{...u,id:c,name:u.name||c,type:n==="password"&&x?"text":n,"aria-disabled":u.disabled,readOnly:t,"aria-readonly":t||u["aria-readonly"],"data-error":o?!0:void 0,"data-success":s?!0:void 0,className:g}),n==="password"&&e.jsx("button",{onClick:()=>f(!x),className:"absolute inset-y-0 right-0 px-2 hover:cursor-pointer","aria-label":"Toggle password visibility","data-state":x?"visible":"hidden",children:x?e.jsx(L.EyeOpened,{size:20}):e.jsx(L.EyeClosed,{size:20})})]}),e.jsx(me,{elementId:c,type:"error",message:o}),e.jsx(me,{elementId:c,type:"success",message:s})]})}function ct({elementId:r,maxLength:a}){const[t,o]=l.useState(0);return l.useEffect(()=>{const s=document.getElementById(r);if(!s)return;const n=()=>{const i=s.value.length;o(i);const u=i>=a;s.setAttribute("aria-describedby",`${r}-character-count`),s.setAttribute("aria-invalid",u?"true":"false"),u?s.setAttribute("data-error","true"):s.removeAttribute("data-error")};return n(),s.addEventListener("input",n),s.setAttribute("maxlength",String(a)),()=>{s.removeEventListener("input",n),s.removeAttribute("maxlength"),s.removeAttribute("aria-describedby"),s.removeAttribute("aria-invalid"),s.removeAttribute("data-error")}},[r,a]),e.jsx("small",{className:k.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end",t>=a&&"text-destructive",t<a&&"text-current"),role:"status",children:e.jsxs("span",{id:`${r}-character-count`,children:[t," / ",a," characters"]})})}function dt(r,a){l.useEffect(()=>{const t=document.getElementById(r);if(!t)return;if(!a){t.style.height="auto";return}const o=()=>{t.style.height="auto",t.style.height=`${t.scrollHeight}px`};return o(),t.addEventListener("input",o),t.addEventListener("resize",o),window.addEventListener("resize",o),()=>{t.removeEventListener("input",o),t.removeEventListener("resize",o),window.removeEventListener("resize",o)}},[r,a])}const ut={base:"","left-line":"border-l border-border focus:border-current/60 disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",outline:"border border-border focus:border-current/60 disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",solid:"bg-muted/50 focus:bg-muted/70 not-disabled:data-error:border-destructive/70 not-disabled:data-success:border-success/70"},ft={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},ke={variant:"outline",rounded:"none"};function Be({variant:r=ke.variant,rounded:a,displayOnlyMode:t=!1,errorMessage:o,successMessage:s,showResizeHandle:n=!1,autoExpand:i=!1,characterLimit:u=0,className:c,...x}){const f=l.useId();dt(f,i||t);let d=a;r==="outline"&&!a&&(d="md"),d=d||ke.rounded;const m=k.join("appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted-foreground/70 hide-number-input-arrows transition-all",!t&&ut[r],!t&&ft[d],!t&&"px-2 py-1",t&&"pointer-events-none cursor-text",!n&&"no-resize-handle",c);return u>0||!t&&(o||s)?e.jsxs("div",{className:"w-full -space-y-1.5",children:[e.jsx("textarea",{...x,id:f,"aria-disabled":x.disabled,readOnly:t,"aria-readonly":t||x["aria-readonly"],style:{resize:i?"none":void 0},className:m}),u>0&&e.jsx(ct,{elementId:f,maxLength:u}),e.jsx(me,{elementId:f,type:"error",message:o}),e.jsx(me,{elementId:f,type:"success",message:s})]}):e.jsx("textarea",{...x,id:f,"aria-disabled":x.disabled,readOnly:t,"aria-readonly":t||x["aria-readonly"],style:{resize:i?"none":void 0},className:m})}function xt(r){const[a,t]=l.useState(!1),[o,s]=l.useState(!1);return l.useEffect(()=>{r?(s(!0),setTimeout(()=>t(!0),10)):(t(!1),setTimeout(()=>s(!1),150))},[r]),{show:a,shouldRender:o}}function mt({isOpen:r,setIsOpen:a,filteredOptions:t,highlightedIndex:o,setHighlightedIndex:s,onSelect:n,triggerRef:i}){return{handleKeyDown:l.useCallback(c=>{var x;switch(c.key){case"ArrowDown":if(c.preventDefault(),!r)a(!0);else{const f=o<t.length-1?o+1:0;let d=f;for(let h=0;h<t.length;h++){const m=(f+h)%t.length;if(!t[m].disabled){d=m;break}}s(d)}break;case"ArrowUp":if(c.preventDefault(),!r)a(!0);else{const f=o>0?o-1:t.length-1;let d=f;for(let h=0;h<t.length;h++){const m=(f-h+t.length)%t.length;if(!t[m].disabled){d=m;break}}s(d)}break;case"Enter":case" ":if(c.preventDefault(),!r)a(!0);else if(o>=0&&o<t.length){const f=t[o];f.disabled||n(f)}break;case"Escape":c.preventDefault(),r&&(a(!1),(x=i.current)==null||x.focus());break;case"Tab":r&&a(!1);break}},[r,a,t,o,s,n,i])}}function ht({isOpen:r,filteredOptions:a,selectedOption:t,shouldRender:o,optionsContainerRef:s}){const[n,i]=l.useState(-1),u=l.useMemo(()=>t?a.findIndex(c=>c.value===t.value):-1,[a,t]);return l.useEffect(()=>{r&&a.length>0?i(t&&u>=0?u:0):i(-1)},[a,r,t,u]),l.useEffect(()=>{if(n>=0&&s.current&&o){const c=()=>{const x=s.current,f=x==null?void 0:x.querySelector(`[data-option-index="${n}"]`);if(f){const d=r&&t&&n===u?"auto":"smooth";f.scrollIntoView({behavior:d,block:"nearest"})}};r&&o&&t?setTimeout(c,10):c()}},[n,o,r,t,a,s,u]),{highlightedIndex:n,setHighlightedIndex:i}}const Ce={sm:{trigger:"px-2 py-1 text-sm",options:"px-2 py-2 text-xs"},md:{trigger:"px-3 py-2 text-base",options:"px-3 py-2.5 text-sm"},lg:{trigger:"px-4 py-3 text-lg",options:"px-4 py-3 text-base"}};function pt(r){const a=l.useRef(null),t=l.useRef(null),o=l.useRef(null),[s,n]=l.useState(!1),[i,u]=l.useState(!1),[c,x]=l.useState({vertical:!1,horizontal:!1}),f=l.useRef(null),d=l.useRef(null),h=l.useCallback(()=>{const v=a.current;if(!v)return;const p=v.scrollHeight>v.clientHeight,C=v.scrollWidth>v.clientWidth;x({vertical:p,horizontal:C})},[]),m=l.useCallback(()=>{const v=a.current,p=t.current,C=o.current;if(v){if(p&&c.vertical){const y=(c.horizontal?v.clientHeight-r:v.clientHeight)/v.scrollHeight,w=Math.max(y*100,10),F=v.scrollHeight-v.clientHeight,M=F>0?v.scrollTop/F:0,j=100-w,D=M*j;p.style.height=`${w}%`,p.style.top=`${D}%`,p.style.transform="none"}if(C&&c.horizontal){const y=(c.vertical?v.clientWidth-r:v.clientWidth)/v.scrollWidth,w=Math.max(y*100,10),F=v.scrollWidth-v.clientWidth,M=F>0?v.scrollLeft/F:0,j=100-w,D=M*j;C.style.width=`${w}%`,C.style.left=`${D}%`,C.style.transform="none"}}},[c,r]),g=l.useCallback(()=>{f.current&&clearTimeout(f.current),d.current&&clearTimeout(d.current),n(!0),u(!1),m(),f.current=setTimeout(()=>{u(!0),d.current=setTimeout(()=>{n(!1),u(!1)},300)},1e3)},[m]);return l.useEffect(()=>{const v=a.current;if(!v)return;h();const p=new ResizeObserver(h);p.observe(v);const C=new MutationObserver(h);return C.observe(v,{childList:!0,subtree:!0,attributes:!0}),()=>{p.disconnect(),C.disconnect()}},[h]),l.useEffect(()=>{m()},[c,m]),l.useEffect(()=>()=>{f.current&&clearTimeout(f.current),d.current&&clearTimeout(d.current)},[]),{viewportRef:a,verticalThumbRef:t,horizontalThumbRef:o,isScrolling:s,isFadingOut:i,scrollbarVisible:c,handleScroll:g}}function Le({className:r,thumbClassName:a,viewportClassName:t,scrollbarClassName:o,scrollbarThickness:s=8,children:n,id:i,ref:u,...c}){const{viewportRef:x,verticalThumbRef:f,horizontalThumbRef:d,isScrolling:h,isFadingOut:m,scrollbarVisible:g,handleScroll:v}=pt(s),p=k.join("relative flex-1 rounded-full bg-slate-400/60 hover:bg-slate-400/80 active:bg-slate-400",a);return e.jsxs("div",{ref:u,id:i,className:k.join("relative overflow-hidden",r),"data-scroll-area-root":"",...c,children:[e.jsx("div",{ref:x,className:k.join("h-full w-full overflow-auto rounded-[inherit] hide-scroll-bars",t),onScroll:v,"data-scroll-area-viewport":"",children:n}),g.vertical&&(h||m)&&e.jsx("div",{className:k.join("touch-none select-none transition-all","p-[1px]","absolute right-0 top-0",m?"opacity-0":"opacity-100",o),"data-scroll-area-scrollbar":"vertical","data-state":h?"visible":"hidden",style:{width:`${s}px`,height:g.horizontal?`calc(100% - ${s}px)`:"100%"},children:e.jsx("div",{ref:f,className:k.join("absolute rounded-full",p),"data-scroll-area-thumb":"",style:{height:"20%",top:"0%",width:"100%"}})}),g.horizontal&&(h||m)&&e.jsx("div",{className:k.join("touch-none select-none transition-all","p-[1px]","absolute bottom-0 left-0",m?"opacity-0":"opacity-100",o),"data-scroll-area-scrollbar":"horizontal","data-state":h?"visible":"hidden",style:{height:`${s}px`,width:g.vertical?`calc(100% - ${s}px)`:"100%"},children:e.jsx("div",{ref:d,className:k.join("absolute rounded-full",p),"data-scroll-area-thumb":"",style:{width:"20%",left:"0%",height:"100%"}})}),g.vertical&&g.horizontal&&e.jsx("div",{className:k.join("bg-transparent","absolute bottom-0 right-0"),"data-scroll-area-corner":"",style:{height:`${s}px`,width:`${s}px`}})]})}function Ve({options:r,value:a,placeholder:t="Select an option...",searchable:o=!1,disabled:s=!1,clearable:n=!1,size:i="md",className:u,triggerClassName:c,dropdownClassName:x,id:f,ref:d,onChange:h,onSearch:m,searchPlaceholder:g="Search options..."}){const v=l.useId(),C=`${f??v}-listbox`,b=S=>`${C}-option-${S}`,[y,w]=l.useState(!1),[F,M]=l.useState(""),j=l.useRef(null),D=l.useRef(null),N=l.useRef(null),E=l.useRef(null),{show:A,shouldRender:z}=xt(y),$=l.useMemo(()=>!o||!F?r:r.filter(S=>{var B;return S.text.toLowerCase().includes(F.toLowerCase())||((B=S.description)==null?void 0:B.toLowerCase().includes(F.toLowerCase()))}),[r,o,F]),I=l.useMemo(()=>r.find(S=>S.value===a),[r,a]),{highlightedIndex:T,setHighlightedIndex:V}=ht({isOpen:y,filteredOptions:$,selectedOption:I,shouldRender:z,optionsContainerRef:E}),P=T>=0?b(T):void 0;l.useEffect(()=>{y&&z&&o&&D.current&&D.current.focus()},[y,o,z]);const Y=l.useCallback(S=>{var B;S.disabled||(h==null||h(S.value),w(!1),M(""),(B=j.current)==null||B.focus())},[h]),{handleKeyDown:R}=mt({isOpen:y,setIsOpen:w,filteredOptions:$,highlightedIndex:T,setHighlightedIndex:V,onSelect:Y,triggerRef:j});l.useEffect(()=>{if(!y)return;const S=B=>{var K;N.current&&!N.current.contains(B.target)&&!((K=j.current)!=null&&K.contains(B.target))&&(w(!1),M(""))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[y]);const G=()=>{s||(w(!y),y||(M(""),V(-1)))},X=S=>{S.disabled||(h==null||h(S.value),w(!1),M(""))},te=S=>{const B=S.target.value;M(B),m==null||m(B),V(-1)},q=S=>{S.preventDefault(),S.stopPropagation(),h==null||h("")};return e.jsxs("div",{className:k.join("relative",u),id:f,ref:d,"data-select":"true","data-value":a,"data-searchable":o,"data-disabled":s,"data-clearable":n,children:[e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:j,type:"button",className:k.join("flex items-center justify-between w-full text-left bg-inherit border border-border rounded-md transition-colors","hover:border-primary focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",s&&"opacity-50 cursor-not-allowed hover:border-border",y&&"border-primary ring-1 ring-primary",Ce[i].trigger,c),onClick:G,onKeyDown:R,disabled:s,"aria-disabled":s,"aria-haspopup":"listbox","aria-expanded":y,"aria-controls":y?C:void 0,"aria-activedescendant":y&&!o?P:void 0,"aria-label":I?I.text:t,"data-select-trigger":"true",children:[e.jsx("span",{className:k.join("block truncate",!I&&"opacity-70"),children:I?I.text:t}),e.jsx("div",{className:"flex items-center ml-2",children:e.jsx(L.ChevronDown,{size:16,className:k.join("transition-transform",y&&"rotate-180")})})]}),n&&I&&e.jsx("button",{type:"button",onClick:q,className:"absolute right-8 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-accent/20 transition-colors group z-10","aria-label":"Clear selection","data-select-clear":"true",children:e.jsx(re.X,{size:14,className:"opacity-70 group-hover:opacity-100 transition-opacity"})})]}),z&&e.jsxs("div",{ref:N,className:k.join("absolute z-50 w-full mt-1 bg-popover text-popover-foreground border border-border rounded-md shadow-lg transition-all",A?"opacity-100 translate-y-0":"opacity-0 -translate-y-2",x),id:C,role:"listbox","data-select-content":"true",children:[o&&e.jsx("div",{className:"border-b border-border",children:e.jsx("input",{ref:D,type:"text",value:F,onChange:te,onKeyDown:R,placeholder:g,className:"w-full px-2 py-2 text-inherit focus:outline-none","aria-autocomplete":"list","aria-controls":C,"aria-activedescendant":P,"data-select-search":"true"})}),e.jsx(Le,{ref:E,viewportClassName:"max-h-60",children:$.length>0?$.map((S,B)=>e.jsxs("div",{id:b(B),className:k.join("flex items-center cursor-pointer transition-colors","hover:bg-accent/10 focus:bg-accent/10",Ce[i].options,S.disabled&&"opacity-50 cursor-not-allowed",B===T&&"bg-accent/20",a===S.value&&"bg-accent/30"),onClick:()=>X(S),role:"option","aria-selected":a===S.value,"aria-disabled":S.disabled,"data-select-option":"true","data-value":S.value,"data-highlighted":B===T,"data-option-index":B,children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium",children:S.text}),S.description&&e.jsx("div",{className:"text-xs opacity-70 mt-0.5",children:S.description})]}),a===S.value&&e.jsx(L.Check,{size:16,className:"ml-2 text-primary flex-shrink-0"})]},S.value)):e.jsx("div",{className:"px-3 py-2 text-sm opacity-70 text-center",children:o&&F?"No results found":"No options available"})})]})]})}function bt(r){const[a,t]=l.useState(""),o=l.useCallback(s=>{let n=s,i="";for(;n&&!i;){const u=window.getComputedStyle(n).backgroundColor;u&&u!=="transparent"&&u!=="rgba(0, 0, 0, 0)"&&(i=u),n=n.parentElement}return i||"transparent"},[]);return l.useEffect(()=>{const s=document.getElementById(r);if(s){const n=o(s.parentElement);t(n)}},[r,o]),a}function ie({ref:r,id:a,size:t=20,color:o,filled:s=!1,rounded:n=!0,checked:i=!1,indeterminate:u=!1,onCheckedChange:c,disabled:x,className:f="",display:d="inline",...h}){const m=l.useId(),g=l.useMemo(()=>a||`checkbox-${m}`,[a,m]),v=bt(g),[p,C]=l.useState(i),[b,y]=l.useState(u);l.useEffect(()=>{C(i)},[i]),l.useEffect(()=>{y(u)},[u]);const w=()=>{if(!x){const j=b?!0:!p;C(j),y(!1),c==null||c(j)}},F=j=>{j.key===" "&&(j.preventDefault(),w())},M=k.join("items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",d==="inline"?"inline-flex":"flex",n&&"rounded",x&&"opacity-40 cursor-not-allowed",!x&&"cursor-pointer",f);return e.jsx("button",{id:g,type:"button",ref:r,tabIndex:0,role:"checkbox",onClick:w,"aria-checked":b?"mixed":p,"aria-disabled":x,onKeyDownCapture:F,style:{width:t,height:t,color:o,backgroundColor:(p||b)&&s?"currentcolor":"transparent"},className:M,...h,children:b?e.jsx(L.Dash,{size:t,color:s?v:void 0}):e.jsx(L.Check,{size:t,color:s?v:void 0,className:p?"opacity-100":"opacity-0"})})}function Ge({itemId:r,checked:a,onChange:t,name:o,disabled:s=!1,className:n=""}){const i="relative inline-flex items-center justify-center rounded-full",u=()=>{s||t()},c=k.join(i,!a&&"hover:border-current/60",!s&&"border-current cursor-pointer",s&&"border-muted/60 cursor-not-allowed",n);return e.jsx("div",{id:r,role:"radio",tabIndex:-1,"aria-checked":a,"aria-disabled":s,"aria-description":`Radio button for ${o}`,"aria-labelledby":`${r}-label`,onClick:u,className:c,style:{width:"1em",height:"1em",padding:"0.1em",borderWidth:"0.06em"},children:a&&e.jsx("div",{className:k.join("size-full aspect-square rounded-full",s&&"bg-muted/60",!s&&"bg-current")})})}function xe({value:r,children:a,className:t="",isSelected:o=!1,onChange:s,disabled:n=!1,hideInput:i=!1,description:u,name:c}){const f=`radio-${l.useId()}-${r}`,d=()=>{n||s==null||s(r)};return e.jsxs("div",{title:u,className:k.join("relative flex items-center",t,i&&`p-2 border-2 focus-within:border-dashed focus-within:${n?"border-current/50":"border-current/80"}`,i&&!o&&`border-transparent ${n?"":"not-focus-within:hover:border-border/60"}`,i&&o&&"border-border",n&&"opacity-60 cursor-not-allowed"),style:{gap:"0.5em"},children:[!i&&e.jsx(Ge,{itemId:f,name:c||"",checked:o,onChange:d,disabled:n,className:k.join(i&&"")}),e.jsx("div",{id:i?f:void 0,tabIndex:i?-1:void 0,role:i?"radio":void 0,onClick:i?d:void 0,"aria-checked":i?o?"true":"false":void 0,"aria-disabled":i?n:void 0,"aria-description":i?u||`Radio button for ${c}`:void 0,"aria-labelledby":i?`${f}-label`:void 0,className:k.join(i&&"size-full",typeof a=="object"&&"grow focus:outline-none"),children:e.jsx("label",{id:`${f}-label`,onClick:i?void 0:d,className:k.join(n&&"cursor-not-allowed",!n&&"cursor-pointer"),children:a})})]})}function gt(r,a){const[t,o]=l.useState(a),[s,n]=l.useState(-1),[i,u]=l.useState(!1),c=l.useCallback((m,g)=>{var C;const v=m[g];v.hasAttribute("disabled")||v.getAttribute("aria-disabled")==="true"||((C=m[g])==null||C.click(),n(g))},[]),x=l.useCallback((m,g)=>{var p;if(m.preventDefault(),i||!g.length)return;const v=a!==-1?a:0;(p=g[v])==null||p.focus(),o(v),a!==-1&&c(g,v)},[a,i,c]),f=l.useCallback(m=>{var C;if(!m.shiftKey)return;m.preventDefault();const g=Array.from(document.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')).filter(b=>!b.hasAttribute("disabled")&&b.tabIndex>=0),v=g.findIndex(b=>b.id===r),p=v>0?v-1:g.length-1;(C=g[p])==null||C.focus()},[r]),d=l.useCallback((m,g)=>{var y;if(!g.length)return;const v=m.target;if(!g.some(w=>w.id===v.id))return;const C=t!==-1?t:0;let b=C;switch(m.key){case"ArrowUp":case"ArrowLeft":m.preventDefault(),b=C>0?C-1:g.length-1;break;case"ArrowDown":case"ArrowRight":m.preventDefault(),b=(C+1)%g.length;break;case" ":m.preventDefault(),c(g,C);return;case"Tab":f(m);return;default:return}(y=g[b])==null||y.focus(),o(b),s!==-1&&c(g,b)},[t,s,f,c]),h=l.useCallback(()=>{const m=document.querySelector(`[id="${r}"][role="radiogroup"]`);return m?Array.from(m.querySelectorAll('[role="radio"]')):[]},[r]);l.useEffect(()=>{const m=document.querySelector(`[id="${r}"][role="radiogroup"]`);if(!m)return;const g=h(),v=y=>x(y,g),p=y=>d(y,g),C=()=>u(!0),b=()=>u(!1);return document.addEventListener("keydown",p),m.addEventListener("focus",v),m.addEventListener("mousedown",C),document.addEventListener("mouseup",b),()=>{document.removeEventListener("keydown",p),m.removeEventListener("focus",v),m.removeEventListener("mousedown",C),document.removeEventListener("mouseup",b)}},[r,h,x,d])}function We({options:r=[],value:a,onChange:t,id:o,children:s,className:n="",childrenClassName:i="",hideInputs:u=!1}){const c=l.useId(),x=o||`radio-group-${c}`;gt(x,r.findIndex(d=>d===a));const f=l.useMemo(()=>r.reduce((d,h)=>(typeof h=="string"?d.some(m=>m.value===h)||d.push({label:h,value:h}):d.push(h),d),[]),[r]);return e.jsxs("div",{id:x,role:"radiogroup",tabIndex:0,className:k.join(n,"focus:outline-none"),children:[f.length>0&&f.map((d,h)=>e.jsx(xe,{value:d.value,isSelected:a===d.value,onChange:t,name:x,disabled:d.disabled,description:d.description,hideInput:u,className:i,children:d.label},`${d.value}-${h}`)),f.length===0&&s&&l.Children.map(s,d=>l.isValidElement(d)&&d.type===xe?e.jsx(xe,{...d.props,className:k.join(i,d.props.className),hideInput:d.props.hideInput||u,isSelected:a===d.props.value,onChange:t,name:x,children:d.props.children}):null)]})}function _e({form:r,initialData:a={},onDataChange:t,onSubmit:o,submitButton:s,columns:n=be.columns,responsive:i=be.responsive,spacing:u=be.spacing,className:c,id:x,ref:f}){const[d,h]=l.useState(a),{errors:m,validateForm:g,validateSingleField:v,isFormValid:p}=ot(r,d),C=l.useCallback((j,D)=>{const N={...d,[j]:D};h(N),t==null||t(N),v(j,D)},[d,t,v]),b=l.useCallback(j=>{j.preventDefault(),g(d)&&o&&o(d)},[d,g,o]),y=j=>{const D=[],N={};return j.colSpan&&n>1&&D.push(pe.colSpan[j.colSpan]),{className:k.join(D.join(" "),j.className),style:N}},w=j=>{const D=d[j.name],N=m[j.name],E=x?`${x}-${j.name}`:j.name,{className:A,style:z}=y(j),$=()=>{switch(j.__type){case"input":{const I=j;return e.jsxs(e.Fragment,{children:[e.jsx(se,{htmlFor:E,required:j.required,description:j.description,children:j.label}),e.jsx(Re,{id:E,type:I.type||"text",placeholder:I.placeholder,value:D||"",onChange:T=>C(j.name,T.target.value),disabled:j.disabled,variant:I.variant,rounded:I.rounded,errorMessage:N,"data-field-name":j.name,"data-field-type":j.__type})]})}case"textarea":{const I=j;return e.jsxs(e.Fragment,{children:[e.jsx(se,{htmlFor:E,required:j.required,description:j.description,children:j.label}),e.jsx(Be,{id:E,placeholder:I.placeholder,value:D||"",onChange:T=>C(j.name,T.target.value),disabled:j.disabled,variant:I.variant,rounded:I.rounded,rows:I.rows,autoExpand:I.autoExpand,characterLimit:I.characterLimit,errorMessage:N,"data-field-name":j.name,"data-field-type":j.__type})]})}case"select":{const I=j,T=I.options.map(V=>({text:V.label,value:V.value,disabled:V.disabled}));return e.jsxs(e.Fragment,{children:[e.jsx(se,{htmlFor:E,required:j.required,description:j.description,children:j.label}),e.jsx(Ve,{id:E,options:T,value:D||"",onChange:V=>C(j.name,V),placeholder:I.placeholder,disabled:j.disabled,searchable:I.searchable,clearable:I.clearable,"data-field-name":j.name,"data-field-type":j.__type}),N&&e.jsx("p",{className:"text-sm text-destructive mt-1",role:"alert",children:N})]})}case"checkbox":{const I=j,T=16;return e.jsxs("div",{className:"space-x-2",children:[e.jsx(ie,{id:E,checked:D||!1,onCheckedChange:V=>C(j.name,V),disabled:j.disabled,"data-field-name":j.name,"data-field-type":j.__type,size:T}),e.jsxs("div",{className:"inline-block",style:{maxWidth:`calc(100% - ${T+10}px)`},children:[" ",e.jsx(se,{htmlFor:E,className:"cursor-pointer",children:I.text||j.label}),j.description&&e.jsx("p",{className:"text-sm opacity-80 mt-1",children:j.description}),N&&e.jsx("p",{className:"text-sm text-destructive mt-1",role:"alert",children:N})]})]})}case"radio":{const T=j.options.map(V=>({label:V.label,value:V.value,disabled:V.disabled}));return e.jsxs(e.Fragment,{children:[e.jsx(se,{required:j.required,children:j.label}),j.description&&e.jsx("p",{className:"text-sm opacity-80 mb-2",children:j.description}),e.jsx(We,{options:T,value:D||"",onChange:V=>C(j.name,V),id:E,"data-field-name":j.name,"data-field-type":j.__type}),N&&e.jsx("p",{className:"text-sm text-destructive mt-1",role:"alert",children:N})]})}case"checkboxGroup":{const I=j,T=D||[],V=16,P=I.options.map(q=>q.value),Y=P.length>0&&P.every(q=>T.includes(q)),R=T.length===0,G=!Y&&!R,X=(q,S)=>{let B;S?B=[...T,q]:B=T.filter(K=>K!==q),C(j.name,B)},te=q=>{if(q){const S=I.options.filter(B=>!B.disabled).map(B=>B.value);C(j.name,S)}else C(j.name,[])};return e.jsxs(e.Fragment,{children:[e.jsx(se,{required:j.required,children:j.label}),j.description&&e.jsx("p",{className:"text-sm opacity-80 mb-2",children:j.description}),e.jsxs("div",{"data-field-name":j.name,"data-field-type":j.__type,children:[I.selectAll&&e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(ie,{id:`${E}-select-all`,checked:Y,indeterminate:G,onCheckedChange:q=>te(q),disabled:j.disabled,size:V,className:"mt-1"}),e.jsx("div",{className:"inline-block",style:{maxWidth:`calc(100% - ${V+10}px)`},children:e.jsx(se,{htmlFor:`${E}-select-all`,className:"cursor-pointer font-medium",children:"Select All"})})]}),I.options.map((q,S)=>{const B=`${E}-${S}`,K=T.includes(q.value);return e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(ie,{id:B,checked:K,onCheckedChange:H=>X(q.value,H),disabled:j.disabled||q.disabled,size:V,className:"mt-1"}),e.jsx("div",{className:"inline-block",style:{maxWidth:`calc(100% - ${V+10}px)`},children:e.jsx(se,{htmlFor:B,className:"cursor-pointer",children:q.label})})]},q.value)})]}),N&&e.jsx("p",{className:"text-sm text-destructive mt-1",role:"alert",children:N})]})}case"custom":{const I=j;return e.jsxs(e.Fragment,{children:[j.label&&e.jsx(se,{required:j.required,description:j.description,children:j.label}),e.jsx("div",{"data-field-name":j.name,"data-field-type":j.__type,children:I.renderComponent({value:D,onValueChange:T=>C(j.name,T),disabled:j.disabled,error:N,name:j.name})})]})}default:return null}};return e.jsx("div",{className:A,style:z,children:$()},j.name)},F=k.join("grid",n&&n>1?pe.columns[n]:"grid-cols-1",pe.spacing[u],c),M=()=>s?l.isValidElement(s)?l.cloneElement(s,{disabled:!p,"aria-disabled":!p,...s.props??{}}):e.jsx("div",{className:"col-span-full",children:s}):null;return e.jsxs("form",{ref:f,id:x,onSubmit:b,className:F,"data-form-fields":r.length,"data-form-columns":n,"data-form-responsive":i,"data-form-valid":p,children:[r.map(w),M()]})}const yt={google:{label:"Continue with Google",icon:e.jsx(L.Google,{size:15})},github:{label:"Continue with GitHub",icon:e.jsx(L.GitHub,{size:15})},facebook:{label:"Continue with Facebook",icon:e.jsx(L.Facebook,{size:15})},apple:{label:"Continue with Apple",icon:e.jsx(L.Apple,{size:15})}};function vt({methods:r=["email"],action:a="login",onMethodClick:t,onEmailSubmit:o,onSuccess:s,onActionChange:n,errorMessage:i,validatePassword:u,className:c,id:x,ref:f}){const[d,h]=l.useState(a==="both"?"login":a),[m,g]=l.useState(""),{input:v}=ze,p=d==="login",C=a==="both",b=r.includes("email"),y=r.filter(D=>D!=="email"),w=m||i,F=[v({name:"email",label:"Email",type:"email",placeholder:"you@email.com",required:!0,variant:"outline"}),v({name:"password",label:"Password",type:"password",placeholder:"Password",required:!0,variant:"outline",...u&&{isValid:D=>{const N=u(D);return{valid:!N,message:N}}}}),...p?[]:[v({name:"confirmPassword",label:"Confirm Password",type:"password",placeholder:"Confirm Password",required:!0,variant:"outline"})]],M=async D=>{if(g(""),!p&&D.confirmPassword!==D.password){g("Passwords do not match.");return}if(o){const N=await o({data:{email:D.email,password:D.password,confirmPassword:D.confirmPassword},action:d});if(N!=null&&N.error){g(N.error.message);return}}s==null||s(d)},j=()=>{h(D=>{const N=D==="login"?"sign up":"login";return n==null||n(N),N}),g("")};return e.jsxs("div",{className:k.join("flex flex-col gap-3",c),id:x,"data-auth-mode":d,"data-action":a,children:[y.map(D=>{const N=yt[D];return e.jsxs(J.Button,{variant:"outline",onClick:()=>t==null?void 0:t(D),className:"flex items-center justify-center gap-2","data-auth-method":D,children:[N.icon,N.label]},D)}),y.length>0&&b&&e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-border",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),b&&e.jsxs(e.Fragment,{children:[e.jsx(_e,{form:F,onSubmit:M,submitButton:e.jsx(J.Button,{type:"submit",variant:"primary",className:"mt-2 w-full",children:p?"Log In":"Sign Up"}),ref:f,spacing:"tight"}),w&&e.jsx("small",{className:"block text-center text-destructive mt-2",role:"alert",children:w}),C&&e.jsx("div",{className:"text-center mt-3",children:e.jsx(J.Button,{type:"button",variant:"link",className:"text-sm opacity-90",onClick:j,"data-toggle-mode":!0,children:p?"Don't have an account? Sign Up":"Already have an account? Log In"})})]})]})}function jt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"40",r:"32",fill:"url(#astronautHelmet)",stroke:"#4F46E5",strokeWidth:"2"}),e.jsx("circle",{cx:"50",cy:"40",r:"24",fill:"#FED7AA"}),e.jsx("circle",{cx:"43",cy:"36",r:"3",fill:"#1F2937"}),e.jsx("circle",{cx:"57",cy:"36",r:"3",fill:"#1F2937"}),e.jsx("path",{d:"M46 46 Q50 50 54 46",stroke:"#1F2937",strokeWidth:"2",fill:"none"}),e.jsx("rect",{x:"38",y:"65",width:"24",height:"30",rx:"12",fill:"#E5E7EB"}),e.jsx("rect",{x:"44",y:"70",width:"12",height:"8",rx:"2",fill:"#6366F1"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"astronautHelmet",cx:"50%",cy:"30%",r:"70%",children:[e.jsx("stop",{stopColor:"#DBEAFE"}),e.jsx("stop",{offset:"1",stopColor:"#93C5FD"})]})})]})}function wt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"url(#moonGradient)"}),e.jsx("circle",{cx:"38",cy:"35",r:"4",fill:"#D1D5DB"}),e.jsx("circle",{cx:"65",cy:"42",r:"3",fill:"#D1D5DB"}),e.jsx("circle",{cx:"42",cy:"65",r:"5",fill:"#D1D5DB"}),e.jsx("circle",{cx:"45",cy:"45",r:"2.5",fill:"#1F2937"}),e.jsx("circle",{cx:"58",cy:"45",r:"2.5",fill:"#1F2937"}),e.jsx("path",{d:"M47 55 Q52 60 57 55",stroke:"#1F2937",strokeWidth:"2",fill:"none"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"moonGradient",cx:"30%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#F9FAFB"}),e.jsx("stop",{offset:"1",stopColor:"#E5E7EB"})]})})]})}function kt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("path",{d:"M50 15 L58 38 L82 38 L64 52 L72 75 L50 61 L28 75 L36 52 L18 38 L42 38 Z",fill:"url(#starGradient)"}),e.jsx("circle",{cx:"44",cy:"42",r:"2",fill:"#1F2937"}),e.jsx("circle",{cx:"56",cy:"42",r:"2",fill:"#1F2937"}),e.jsx("path",{d:"M46 50 Q50 54 54 50",stroke:"#1F2937",strokeWidth:"2",fill:"none"}),e.jsx("circle",{cx:"65",cy:"25",r:"1.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"35",cy:"30",r:"1",fill:"#FCD34D"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"starGradient",cx:"50%",cy:"40%",r:"60%",children:[e.jsx("stop",{stopColor:"#FEF3C7"}),e.jsx("stop",{offset:"1",stopColor:"#FCD34D"})]})})]})}function Ct({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"38",fill:"url(#galaxyGradient)"}),e.jsx("path",{d:"M20 50 Q35 30 50 50 Q65 70 80 50",stroke:"#8B5CF6",strokeWidth:"3",opacity:"0.7"}),e.jsx("path",{d:"M50 20 Q70 35 50 50 Q30 65 50 80",stroke:"#A78BFA",strokeWidth:"2",opacity:"0.5"}),e.jsx("circle",{cx:"50",cy:"50",r:"12",fill:"#1E1B4B"}),e.jsx("circle",{cx:"46",cy:"47",r:"1.5",fill:"#E0E7FF"}),e.jsx("circle",{cx:"54",cy:"47",r:"1.5",fill:"#E0E7FF"}),e.jsx("path",{d:"M47 53 Q50 56 53 53",stroke:"#E0E7FF",strokeWidth:"1.5",fill:"none"}),e.jsx("circle",{cx:"30",cy:"25",r:"1",fill:"#FFF"}),e.jsx("circle",{cx:"75",cy:"70",r:"1.5",fill:"#FFF"}),e.jsx("circle",{cx:"25",cy:"75",r:"1",fill:"#FFF"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"galaxyGradient",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#4C1D95"}),e.jsx("stop",{offset:"0.5",stopColor:"#7C3AED"}),e.jsx("stop",{offset:"1",stopColor:"#1E1B4B"})]})})]})}function Nt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("ellipse",{cx:"50",cy:"50",rx:"35",ry:"30",fill:"url(#nebulaGradient)",opacity:"0.8"}),e.jsx("ellipse",{cx:"40",cy:"45",rx:"20",ry:"25",fill:"url(#nebulaPink)",opacity:"0.6"}),e.jsx("ellipse",{cx:"60",cy:"55",rx:"25",ry:"20",fill:"url(#nebulaBlue)",opacity:"0.6"}),e.jsx("circle",{cx:"50",cy:"50",r:"15",fill:"#312E81",opacity:"0.9"}),e.jsx("circle",{cx:"46",cy:"47",r:"2",fill:"#E0E7FF"}),e.jsx("circle",{cx:"54",cy:"47",r:"2",fill:"#E0E7FF"}),e.jsx("path",{d:"M47 53 Q50 56 53 53",stroke:"#E0E7FF",strokeWidth:"1.5",fill:"none"}),e.jsx("circle",{cx:"25",cy:"30",r:"1",fill:"#FFF",opacity:"0.9"}),e.jsx("circle",{cx:"75",cy:"25",r:"1.5",fill:"#FFF",opacity:"0.8"}),e.jsx("circle",{cx:"30",cy:"75",r:"1",fill:"#FFF",opacity:"0.9"}),e.jsx("circle",{cx:"70",cy:"75",r:"1.5",fill:"#FFF",opacity:"0.7"}),e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"nebulaGradient",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#7C3AED"}),e.jsx("stop",{offset:"1",stopColor:"#312E81"})]}),e.jsxs("radialGradient",{id:"nebulaPink",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#F472B6"}),e.jsx("stop",{offset:"1",stopColor:"#BE185D"})]}),e.jsxs("radialGradient",{id:"nebulaBlue",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#3B82F6"}),e.jsx("stop",{offset:"1",stopColor:"#1E40AF"})]})]})]})}function Dt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"32",fill:"url(#planetGradient)"}),e.jsx("ellipse",{cx:"50",cy:"50",rx:"45",ry:"8",fill:"none",stroke:"#A78BFA",strokeWidth:"2",opacity:"0.7"}),e.jsx("circle",{cx:"38",cy:"40",r:"5",fill:"#065F46",opacity:"0.6"}),e.jsx("circle",{cx:"62",cy:"45",r:"4",fill:"#065F46",opacity:"0.6"}),e.jsx("circle",{cx:"45",cy:"62",r:"3",fill:"#065F46",opacity:"0.6"}),e.jsx("circle",{cx:"46",cy:"48",r:"2.5",fill:"#1F2937"}),e.jsx("circle",{cx:"54",cy:"48",r:"2.5",fill:"#1F2937"}),e.jsx("path",{d:"M47 55 Q50 58 53 55",stroke:"#1F2937",strokeWidth:"2",fill:"none"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"planetGradient",cx:"30%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#A7F3D0"}),e.jsx("stop",{offset:"0.6",stopColor:"#34D399"}),e.jsx("stop",{offset:"1",stopColor:"#059669"})]})})]})}function Et({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"55",r:"28",fill:"url(#catGradient)"}),e.jsx("path",{d:"M28 40 L38 25 L42 45 Z",fill:"#6366F1"}),e.jsx("path",{d:"M58 45 L62 25 L72 40 Z",fill:"#6366F1"}),e.jsx("path",{d:"M32 38 L36 30 L38 40 Z",fill:"#EC4899"}),e.jsx("path",{d:"M62 40 L64 30 L68 38 Z",fill:"#EC4899"}),e.jsx("ellipse",{cx:"43",cy:"50",rx:"4",ry:"6",fill:"#FCD34D"}),e.jsx("ellipse",{cx:"57",cy:"50",rx:"4",ry:"6",fill:"#FCD34D"}),e.jsx("ellipse",{cx:"43",cy:"52",rx:"1.5",ry:"4",fill:"#1F2937"}),e.jsx("ellipse",{cx:"57",cy:"52",rx:"1.5",ry:"4",fill:"#1F2937"}),e.jsx("path",{d:"M48 58 L50 60 L52 58 Z",fill:"#EC4899"}),e.jsx("path",{d:"M50 60 Q46 64 42 62",stroke:"#1F2937",strokeWidth:"1.5",fill:"none"}),e.jsx("path",{d:"M50 60 Q54 64 58 62",stroke:"#1F2937",strokeWidth:"1.5",fill:"none"}),e.jsx("line",{x1:"25",y1:"55",x2:"35",y2:"57",stroke:"#1F2937",strokeWidth:"1"}),e.jsx("line",{x1:"65",y1:"57",x2:"75",y2:"55",stroke:"#1F2937",strokeWidth:"1"}),e.jsx("circle",{cx:"20",cy:"25",r:"1.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"80",cy:"30",r:"1",fill:"#FCD34D"}),e.jsx("circle",{cx:"15",cy:"70",r:"1",fill:"#FCD34D"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"catGradient",cx:"50%",cy:"40%",r:"70%",children:[e.jsx("stop",{stopColor:"#A78BFA"}),e.jsx("stop",{offset:"1",stopColor:"#6366F1"})]})})]})}function St({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"35",cy:"55",r:"18",fill:"url(#cloudGradient)"}),e.jsx("circle",{cx:"55",cy:"50",r:"22",fill:"url(#cloudGradient)"}),e.jsx("circle",{cx:"45",cy:"65",r:"15",fill:"url(#cloudGradient)"}),e.jsx("circle",{cx:"65",cy:"60",r:"16",fill:"url(#cloudGradient)"}),e.jsx("circle",{cx:"48",cy:"52",r:"2.5",fill:"#6366F1"}),e.jsx("circle",{cx:"56",cy:"52",r:"2.5",fill:"#6366F1"}),e.jsx("path",{d:"M49 58 Q52 62 55 58",stroke:"#6366F1",strokeWidth:"2",fill:"none"}),e.jsx("circle",{cx:"70",cy:"35",r:"3",fill:"rgba(167, 139, 250, 0.3)",stroke:"#A78BFA"}),e.jsx("circle",{cx:"78",cy:"28",r:"2",fill:"rgba(167, 139, 250, 0.3)",stroke:"#A78BFA"}),e.jsx("circle",{cx:"83",cy:"20",r:"1.5",fill:"rgba(167, 139, 250, 0.3)",stroke:"#A78BFA"}),e.jsx("circle",{cx:"70",cy:"35",r:"0.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"78",cy:"28",r:"0.5",fill:"#FCD34D"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"cloudGradient",cx:"50%",cy:"40%",r:"70%",children:[e.jsx("stop",{stopColor:"#F8FAFC"}),e.jsx("stop",{offset:"1",stopColor:"#E2E8F0"})]})})]})}function Ft({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("ellipse",{cx:"50",cy:"45",rx:"15",ry:"30",fill:"url(#rocketGradient)"}),e.jsx("path",{d:"M35 20 L50 10 L65 20 L50 25 Z",fill:"#EF4444"}),e.jsx("circle",{cx:"50",cy:"35",r:"8",fill:"#DBEAFE",stroke:"#2563EB",strokeWidth:"2"}),e.jsx("circle",{cx:"47",cy:"33",r:"1.5",fill:"#1F2937"}),e.jsx("circle",{cx:"53",cy:"33",r:"1.5",fill:"#1F2937"}),e.jsx("path",{d:"M48 37 Q50 39 52 37",stroke:"#1F2937",strokeWidth:"1",fill:"none"}),e.jsx("path",{d:"M35 60 L25 70 L35 75 Z",fill:"#6B7280"}),e.jsx("path",{d:"M65 60 L75 70 L65 75 Z",fill:"#6B7280"}),e.jsx("ellipse",{cx:"50",cy:"80",rx:"8",ry:"12",fill:"#F59E0B"}),e.jsx("ellipse",{cx:"50",cy:"82",rx:"5",ry:"8",fill:"#EF4444"}),e.jsx("circle",{cx:"25",cy:"20",r:"1",fill:"#FCD34D"}),e.jsx("circle",{cx:"75",cy:"25",r:"1.5",fill:"#FCD34D"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"rocketGradient",cx:"30%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#E5E7EB"}),e.jsx("stop",{offset:"1",stopColor:"#9CA3AF"})]})})]})}function It({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"38",fill:"url(#constellationBg)",opacity:"0.8"}),e.jsx("circle",{cx:"35",cy:"25",r:"2",fill:"#FCD34D"}),e.jsx("circle",{cx:"50",cy:"30",r:"2.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"65",cy:"35",r:"2",fill:"#FCD34D"}),e.jsx("circle",{cx:"30",cy:"50",r:"1.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"70",cy:"50",r:"2",fill:"#FCD34D"}),e.jsx("circle",{cx:"40",cy:"70",r:"2.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"60",cy:"75",r:"1.5",fill:"#FCD34D"}),e.jsx("line",{x1:"35",y1:"25",x2:"50",y2:"30",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"50",y1:"30",x2:"65",y2:"35",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"30",y1:"50",x2:"50",y2:"30",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"50",y1:"30",x2:"70",y2:"50",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"30",y1:"50",x2:"40",y2:"70",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"70",y1:"50",x2:"60",y2:"75",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("circle",{cx:"48",cy:"48",r:"2",fill:"#E0E7FF"}),e.jsx("circle",{cx:"52",cy:"48",r:"2",fill:"#E0E7FF"}),e.jsx("path",{d:"M48 54 Q50 56 52 54",stroke:"#E0E7FF",strokeWidth:"1.5",fill:"none"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"constellationBg",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#1E1B4B"}),e.jsx("stop",{offset:"1",stopColor:"#0F0D2A"})]})})]})}function At({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"35",cy:"35",r:"18",fill:"url(#cometGradient)"}),e.jsx("circle",{cx:"31",cy:"31",r:"2",fill:"#1F2937"}),e.jsx("circle",{cx:"39",cy:"31",r:"2",fill:"#1F2937"}),e.jsx("path",{d:"M32 38 Q35 41 38 38",stroke:"#1F2937",strokeWidth:"1.5",fill:"none"}),e.jsx("path",{d:"M50 50 Q65 65 85 85",stroke:"url(#tailGradient1)",strokeWidth:"8",opacity:"0.7"}),e.jsx("path",{d:"M48 52 Q60 68 75 88",stroke:"url(#tailGradient2)",strokeWidth:"6",opacity:"0.5"}),e.jsx("path",{d:"M52 48 Q70 62 90 82",stroke:"url(#tailGradient3)",strokeWidth:"4",opacity:"0.3"}),e.jsx("circle",{cx:"60",cy:"60",r:"1.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"70",cy:"70",r:"1",fill:"#FCD34D"}),e.jsx("circle",{cx:"80",cy:"80",r:"0.8",fill:"#FCD34D"}),e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"cometGradient",cx:"30%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#FEF3C7"}),e.jsx("stop",{offset:"1",stopColor:"#F59E0B"})]}),e.jsxs("linearGradient",{id:"tailGradient1",x1:"50%",y1:"50%",x2:"85%",y2:"85%",children:[e.jsx("stop",{stopColor:"#FCD34D"}),e.jsx("stop",{offset:"1",stopColor:"transparent"})]}),e.jsxs("linearGradient",{id:"tailGradient2",x1:"48%",y1:"52%",x2:"75%",y2:"88%",children:[e.jsx("stop",{stopColor:"#F472B6"}),e.jsx("stop",{offset:"1",stopColor:"transparent"})]}),e.jsxs("linearGradient",{id:"tailGradient3",x1:"52%",y1:"48%",x2:"90%",y2:"82%",children:[e.jsx("stop",{stopColor:"#A78BFA"}),e.jsx("stop",{offset:"1",stopColor:"transparent"})]})]})]})}function $t({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"url(#twilightGradient)"}),e.jsx("ellipse",{cx:"50",cy:"65",rx:"25",ry:"15",fill:"#1F2937",opacity:"0.8"}),e.jsx("circle",{cx:"30",cy:"25",r:"1.5",fill:"#FFF"}),e.jsx("circle",{cx:"70",cy:"30",r:"1",fill:"#FFF"}),e.jsx("circle",{cx:"40",cy:"35",r:"1.2",fill:"#FFF"}),e.jsx("circle",{cx:"60",cy:"25",r:"0.8",fill:"#FFF"}),e.jsx("path",{d:"M20 40 Q15 35 20 30 Q25 35 20 40",fill:"#FCD34D"}),e.jsx("circle",{cx:"47",cy:"62",r:"1.5",fill:"#E0E7FF"}),e.jsx("circle",{cx:"53",cy:"62",r:"1.5",fill:"#E0E7FF"}),e.jsx("path",{d:"M48 67 Q50 69 52 67",stroke:"#E0E7FF",strokeWidth:"1",fill:"none"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"twilightGradient",cx:"50%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#7C3AED"}),e.jsx("stop",{offset:"0.7",stopColor:"#3730A3"}),e.jsx("stop",{offset:"1",stopColor:"#1E1B4B"})]})})]})}const zt={astronaut:jt,moon:wt,star:kt,galaxy:Ct,nebula:Nt,planet:Dt,"cosmic-cat":Et,"dream-cloud":St,rocket:Ft,constellation:It,comet:At,twilight:$t},Mt={xs:{size:"w-8 h-8",iconSize:"24"},sm:{size:"w-10 h-10",iconSize:"32"},md:{size:"w-12 h-12",iconSize:"40"},lg:{size:"w-16 h-16",iconSize:"56"},xl:{size:"w-20 h-20",iconSize:"72"},"2xl":{size:"w-24 h-24",iconSize:"88"}},Tt={circle:"rounded-full",square:"rounded-lg"};function Rt({id:r,ref:a,size:t="md",shape:o="circle",preset:s,alt:n,className:i,src:u,initials:c,...x}){const f=Mt[t],d=Tt[o],h=s?zt[s]:null;return e.jsx("div",{id:r,ref:a,className:k.join("relative inline-flex items-center justify-center overflow-hidden bg-gray-100 border-2 border-border",f.size,d,i),"data-size":t,"data-shape":o,"data-preset":s,role:"img","aria-label":n||`Avatar ${s?`of ${s}`:""}`,...x,children:u?e.jsx("img",{src:u,alt:n||"User avatar",className:"w-full h-full object-cover"}):h?e.jsx(h,{size:f.iconSize}):c?e.jsx("span",{className:"text-gray-600 font-medium text-sm",children:c.slice(0,2).toUpperCase()}):e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-gray-300 to-gray-400"})})}const Bt={decorative:{"aria-hidden":!0},status:{role:"status"},alert:{role:"alert"},interactive:{}},Lt={base:"",primary:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",accent:"bg-accent text-accent-foreground",destructive:"bg-destructive text-destructive-foreground",success:"bg-success text-success-foreground",warning:"bg-warning text-warning-foreground",muted:"bg-muted text-muted-foreground"},Vt={base:"",primary:"border border-primary bg-transparent text-primary",secondary:"border border-secondary bg-transparent text-secondary",accent:"border border-accent bg-transparent text-accent",destructive:"border border-destructive bg-transparent text-destructive",success:"border border-success bg-transparent text-success",warning:"border border-warning bg-transparent text-warning",muted:"border border-muted-foreground bg-transparent text-muted-foreground"},ge={xs:{text:"text-xs",aspectSquare:"p-1",aspectVideo:"px-2 py-0.5"},sm:{text:"text-sm",aspectSquare:"p-1.5",aspectVideo:"px-2.5 py-1"},md:{text:"text-base",aspectSquare:"p-2",aspectVideo:"px-3 py-1.5"}};function Gt({id:r,ref:a,variant:t="muted",outline:o=!1,children:s,className:n,aspect:i="video",use:u="decorative",size:c="xs",...x}){return e.jsx("span",{id:r,ref:a,className:k.join("font-medium rounded-full inline-flex select-none",ge[c].text,i==="square"&&ge[c].aspectSquare,i==="video"&&ge[c].aspectVideo,o?Vt[t]:Lt[t],n),"data-variant":t,"data-outline":o,"data-aspect":i,"data-use":u,"data-size":c,...Bt[u],...x,children:s})}function Wt(r={}){const{initialDate:a=new Date,mode:t="single",minDate:o,maxDate:s,view:n="month",onDateSelect:i,onRangeSelect:u}=r,[c,x]=l.useState({currentDate:a,selectedDate:t==="single"?a:null,selectedRange:null,view:n}),f=l.useCallback(N=>!!(o&&N<o||s&&N>s),[o,s]),d=l.useCallback(N=>{f(N)||(t==="single"?(x(E=>({...E,selectedDate:N})),i==null||i(N)):t==="range"&&x(E=>{const{selectedRange:A}=E;if(!(A!=null&&A.start)||A.start&&A.end){const z={start:N,end:null};return u==null||u(z),{...E,selectedRange:z}}else{const z=A.start,$=N,I={start:z<$?z:$,end:z<$?$:z};return u==null||u(I),{...E,selectedRange:I}}}))},[t,f,i,u]),h=l.useCallback(N=>{x(E=>{const A=new Date(E.currentDate);return N==="prev"?A.setMonth(A.getMonth()-1):A.setMonth(A.getMonth()+1),{...E,currentDate:A}})},[]),m=l.useCallback(N=>{x(E=>{const A=new Date(E.currentDate),z=N==="prev"?-7:7;return A.setDate(A.getDate()+z),{...E,currentDate:A}})},[]),g=l.useCallback(N=>{x(E=>{const A=new Date(E.currentDate),z=N==="prev"?-1:1;return A.setDate(A.getDate()+z),{...E,currentDate:A}})},[]),v=l.useCallback(N=>{c.view==="month"?h(N):c.view==="week"?m(N):g(N)},[c.view,h,m,g]),p=l.useCallback(N=>{x(E=>({...E,view:N}))},[]),C=l.useCallback(N=>{x(E=>({...E,currentDate:N}))},[]),b=l.useCallback(N=>{x(E=>{const A=new Date(E.currentDate);return A.setMonth(N),{...E,currentDate:A}})},[]),y=l.useCallback(N=>{x(E=>{const A=new Date(E.currentDate);return A.setFullYear(N),{...E,currentDate:A}})},[]),w=l.useMemo(()=>{const{currentDate:N,view:E}=c,A=[];if(E==="month"){const z=new Date(N.getFullYear(),N.getMonth(),1),$=new Date(z);$.setDate($.getDate()-z.getDay());for(let I=0;I<42;I++){const T=new Date($);T.setDate(T.getDate()+I),A.push(T)}}else if(E==="week"){const z=new Date(N);z.setDate(N.getDate()-N.getDay());for(let $=0;$<7;$++){const I=new Date(z);I.setDate(I.getDate()+$),A.push(I)}}else A.push(new Date(N));return A},[c]),F=l.useCallback(N=>{if(t==="single")return c.selectedDate&&N.toDateString()===c.selectedDate.toDateString();if(t==="range"&&c.selectedRange){const{start:E,end:A}=c.selectedRange;if(E&&A)return N>=E&&N<=A;if(E)return N.toDateString()===E.toDateString()}return!1},[t,c.selectedDate,c.selectedRange]),M=l.useCallback(N=>{var E,A;if(t==="range"&&((E=c.selectedRange)!=null&&E.start)&&((A=c.selectedRange)!=null&&A.end)){const{start:z,end:$}=c.selectedRange;return N>z&&N<$}return!1},[t,c.selectedRange]),j=l.useCallback(N=>{var E;return t==="range"&&((E=c.selectedRange)!=null&&E.start)?N.toDateString()===c.selectedRange.start.toDateString():!1},[t,c.selectedRange]),D=l.useCallback(N=>{var E;return t==="range"&&((E=c.selectedRange)!=null&&E.end)?N.toDateString()===c.selectedRange.end.toDateString():!1},[t,c.selectedRange]);return{currentDate:c.currentDate,selectedDate:c.selectedDate,selectedRange:c.selectedRange,view:c.view,daysInView:w,selectDate:d,navigate:v,changeView:p,goToDate:C,changeMonth:b,changeYear:y,isDateSelected:F,isDateDisabled:f,isDateInRange:M,isDateRangeStart:j,isDateRangeEnd:D}}const _t={small:{container:"text-xs",cell:"w-7 h-7 text-xs",header:"text-sm px-2 py-1",navigation:"p-1",weekdays:"text-xs px-1 py-1"},medium:{container:"text-sm",cell:"w-9 h-9 text-sm",header:"text-base px-3 py-2",navigation:"p-2",weekdays:"text-sm px-2 py-2"},large:{container:"text-base",cell:"w-12 h-12 text-base",header:"text-lg px-4 py-3",navigation:"p-3",weekdays:"text-base px-3 py-2"},auto:{container:"w-full h-full",cell:"flex-1 min-h-[2rem] text-sm",header:"text-base px-3 py-2",navigation:"p-2",weekdays:"text-sm px-2 py-2"}},qt={month:"grid-cols-7",week:"grid-cols-7",day:"grid-cols-1"},Ne={size:"medium",view:"month"},Pt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ce=["January","February","March","April","May","June","July","August","September","October","November","December"],De=100;function Kt({id:r,ref:a,className:t,size:o=Ne.size,customStyles:s={},view:n=Ne.view,mode:i="single",initialDate:u,minDate:c,maxDate:x,renderCell:f,showViewSelector:d=!1,showNavigation:h=!0,navigationLayout:m="around",useMonthYearSelector:g=!1,showTodayButton:v=!1,onDateSelect:p,onRangeSelect:C,...b}){const y=Wt({initialDate:u,mode:i,minDate:c,maxDate:x,view:n,onDateSelect:p,onRangeSelect:C}),w=_t[o],F=qt[y.view],M=S=>{const B=new Date;return S.toDateString()===B.toDateString()},j=S=>S.getMonth()===y.currentDate.getMonth()&&S.getFullYear()===y.currentDate.getFullYear(),D=()=>{y.goToDate(new Date)},N=()=>{const{currentDate:S,view:B}=y,K=ce[S.getMonth()],H=S.getFullYear();if(B==="month")return`${K} ${H}`;if(B==="week"){const _=new Date(S);_.setDate(S.getDate()-S.getDay());const U=new Date(_);return U.setDate(U.getDate()+6),_.getMonth()===U.getMonth()?`${K} ${_.getDate()}-${U.getDate()}, ${H}`:`${ce[_.getMonth()]} ${_.getDate()} - ${ce[U.getMonth()]} ${U.getDate()}, ${H}`}return`${K} ${S.getDate()}, ${H}`},E=()=>d?e.jsx("div",{className:G,children:["month","week","day"].map(S=>e.jsx("button",{onClick:()=>y.changeView(S),className:k.join("px-2 py-1 rounded capitalize transition-colors",y.view===S?"bg-accent text-accent-foreground":"hover:bg-accent/20"),children:S},S))}):null,A=()=>{if(!g)return null;const S=y.currentDate.getMonth(),B=y.currentDate.getFullYear(),K=B-De,H=B+De,_=[];for(let Z=K;Z<=H;Z++)_.push(Z);const U=k.join("border border-border rounded px-2 py-1 text-sm focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/50",s.monthYearSelectorsClassName);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:S,onChange:Z=>y.changeMonth(parseInt(Z.target.value)),className:U,children:ce.map((Z,ne)=>e.jsx("option",{value:ne,children:Z},Z))}),e.jsx("select",{value:B,onChange:Z=>y.changeYear(parseInt(Z.target.value)),className:U,children:_.map(Z=>e.jsx("option",{value:Z,children:Z},Z))})]})},z=()=>{if(!v)return null;const S=k.join("px-3 py-1 text-xs rounded border border-border hover:bg-accent/20 transition-colors focus:outline-none focus:ring focus:ring-accent/50",s.todayButtonClassName);return e.jsx("button",{onClick:D,className:S,"aria-label":"Go to today",children:"Today"})},$=S=>{const B=y.isDateSelected(S),K=y.isDateDisabled(S),H=M(S),_=y.isDateInRange(S),U=y.isDateRangeStart(S),Z=y.isDateRangeEnd(S),ne=j(S),ae=k.join("w-full flex items-center justify-center transition-colors cursor-pointer","focus:outline-none",w.cell),W=k.join(!_&&"rounded-md",!B&&"hover:bg-accent/20 focus:bg-accent/20",ae,s.cellClassName,B&&k.join("bg-accent text-accent-foreground",s.selectedCellClassName),_&&k.join("bg-accent/30",s.rangeCellClassName),U&&k.join("bg-accent text-accent-foreground rounded-r-none",s.rangeStartCellClassName),Z&&k.join("bg-accent text-accent-foreground rounded-l-none",s.rangeEndCellClassName),H&&!B&&k.join("border border-accent",s.todayCellClassName),K&&k.join("opacity-50 cursor-not-allowed hover:bg-transparent",s.disabledCellClassName),y.view==="month"&&!ne&&"text-muted-foreground/50"),Q=f?f(S,!!B,K,H):S.getDate();return e.jsx("button",{onClick:()=>y.selectDate(S),disabled:K,className:W,"data-date":S.toISOString().split("T")[0],"data-selected":!!B,"data-disabled":K,"data-today":H,"aria-label":`${S.getDate()} ${ce[S.getMonth()]} ${S.getFullYear()}`,"aria-selected":!!B,"aria-disabled":K,children:Q},S.toISOString())},I=k.join("bg-background border rounded-lg",w.container,s.containerClassName,t),T=k.join("flex items-center border-b px-4 py-2","justify-between",w.header,s.headerClassName),V=k.join("flex items-center gap-1",s.navigationClassName),P=k.join("p-1 rounded hover:bg-accent/20 transition-colors",w.navigation,s.prevButtonClassName),Y=k.join("p-1 rounded hover:bg-accent/20 transition-colors",w.navigation,s.nextButtonClassName),R=k.join("font-semibold text-foreground",s.titleClassName),G=k.join("flex gap-1 text-xs",s.viewSelectorClassName),X=k.join("grid grid-cols-7 border-b text-muted-foreground font-medium",w.weekdays,s.weekdaysClassName),te=k.join("text-center",s.weekdayClassName),q=k.join("grid gap-y-1 p-2",y.view==="month"&&F,y.view==="week"&&k.join(F,s.weekGridClassName),y.view==="day"&&k.join(F,s.dayGridClassName),y.view==="month"&&s.monthGridClassName);return e.jsxs("div",{id:r,ref:a,className:I,"data-size":o,"data-view":y.view,"data-mode":i,role:"application","aria-label":"Calendar",...b,children:[e.jsxs("div",{className:T,children:[m==="adjacent"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4",children:[h&&e.jsxs("div",{className:V,children:[e.jsx("button",{onClick:()=>y.navigate("prev"),className:P,"aria-label":"Previous",children:e.jsx(L.ChevronLeft,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>y.navigate("next"),className:Y,"aria-label":"Next",children:e.jsx(L.ChevronRight,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[!g&&e.jsx("h2",{className:R,children:N()}),A()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[E(),z()]})]}),m==="around"&&e.jsxs(e.Fragment,{children:[h&&e.jsx("button",{onClick:()=>y.navigate("prev"),className:P,"aria-label":"Previous",children:e.jsx(L.ChevronLeft,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[!g&&e.jsx("h2",{className:R,children:N()}),A()]}),e.jsxs("div",{className:"flex items-center gap-2",children:[E(),z()]})]}),h&&e.jsx("button",{onClick:()=>y.navigate("next"),className:Y,"aria-label":"Next",children:e.jsx(L.ChevronRight,{className:"w-4 h-4"})})]})]}),(y.view==="month"||y.view==="week")&&e.jsx("div",{className:X,children:Pt.map(S=>e.jsx("div",{className:te,children:S},S))}),e.jsx("div",{className:q,children:y.daysInView.map(S=>$(S))},`${y.currentDate.getFullYear()}-${y.currentDate.getMonth()}-${y.view}`)]})}const Ht={info:{border:"border-blue-600",interior:"bg-blue-800/20",core:"text-blue-400",description:"text-blue-200"},destructive:{border:"border-destructive",interior:"bg-destructive/10",core:"text-destructive",description:"text-destructive"},success:{border:"border-success",interior:"bg-success/10",core:"text-success",description:"text-success"},warning:{border:"border-yellow-700",interior:"bg-yellow-800/20",core:"text-yellow-400",description:"text-yellow-200"},base:{border:"",interior:"",core:"",description:"opacity-90"}},Zt={info:e.jsx(re.InfoCircled,{size:22}),destructive:e.jsx(re.CrossCircled,{size:22}),success:e.jsx(L.CheckCircled,{size:22}),warning:e.jsx(re.ExclamationTriangle,{size:20}),base:e.jsx(L.DeepRing,{size:22})};function Yt({id:r,ref:a,variant:t="base",icon:o,title:s,description:n,className:i,dismissible:u=!1,onDismiss:c}){const x=l.useId(),f=r||`callout-${x}`,[d,h]=l.useState(!1),m=Ht[t],g=Zt[t],v=()=>{h(!0),c&&c()};return d?null:e.jsxs("div",{id:f,ref:a,className:k.join("relative rounded-lg p-2 sm:p-4 border",m.border,m.interior,i),"data-variant":t,role:"note","aria-describedby":n?`${f}-description`:void 0,"aria-labelledby":s?`${f}-title`:void 0,children:[e.jsxs("div",{className:"flex items-start gap-x-2",children:[o!==null&&e.jsx("span",{className:m.core,children:o===void 0?g:o}),(s||n)&&e.jsxs("div",{className:"flex-1",children:[s&&e.jsx("div",{id:`${f}-title`,className:k.join("font-medium",m.core),children:s}),n&&e.jsx("div",{id:`${f}-description`,className:k.join("mt-0.5 font-light",m.description),children:n})]})]}),u&&e.jsx("button",{type:"button",onClick:v,"data-callout-close-button":"true",className:k.join(m.core,"rounded-md p-0.5 top-2.5 right-2.5 absolute focus:outline-none hover:ring focus:ring-2 focus:ring-current leading-0"),"aria-label":"Close callout",children:e.jsx(re.X,{size:18})})]})}const Ut={sm:{container:"text-sm",header:"text-base font-medium",content:"text-sm leading-relaxed",footer:"text-xs",paddingMulti:1/3},md:{container:"text-base",header:"text-lg font-semibold",content:"text-base leading-relaxed",footer:"text-sm",paddingMulti:1/2},lg:{container:"text-lg",header:"text-xl font-bold",content:"text-lg leading-relaxed",footer:"text-base",paddingMulti:1}};function Qt({id:r,className:a,ref:t,size:o="md",padding:s=16,header:n,footer:i,children:u,imageSrc:c,imageAlt:x,imageComponent:f,imageToEdge:d=!0,...h}){const m=Ut[o],g=c||f;return e.jsxs("div",{id:r,ref:t,"data-testid":"card","data-size":o,"data-padding":s,className:k.join("border border-border rounded-lg shadow-sm","w-full max-w-full",m.container,a),...h,children:[g&&e.jsx("div",{style:d?void 0:{padding:s,paddingBottom:0},className:"w-full overflow-hidden",children:f||e.jsx("img",{src:c,alt:x||"",className:"w-full h-auto object-cover rounded-xs",loading:"lazy"})}),e.jsxs("div",{style:{padding:s,rowGap:s*m.paddingMulti},className:"flex flex-col",children:[n&&e.jsx("div",{className:m.header,children:n}),u&&e.jsx("div",{className:m.content,children:u}),i&&e.jsx("div",{className:m.footer,children:i})]})]})}function Xt({totalItems:r,itemsToShow:a,infinite:t,autoScroll:o,scrollInterval:s,pauseScrollOnHover:n,currentIndex:i,onIndexChange:u}){const[c,x]=l.useState(i||0),[f,d]=l.useState(!1),h=l.useRef(null),m=Math.ceil(r/a),g=t||c>0,v=t||c<m-1,p=l.useCallback(y=>{const w=Math.max(0,Math.min(y,m-1));x(w),u==null||u(w)},[m,u]),C=l.useCallback(()=>{if(g){const y=c===0&&t?m-1:c-1;p(y)}},[c,g,t,m,p]),b=l.useCallback(()=>{if(v){const y=c===m-1&&t?0:c+1;p(y)}},[c,v,t,m,p]);return l.useEffect(()=>{i!==void 0&&i!==c&&x(i)},[i,c]),l.useEffect(()=>{if(!o)return;const y=()=>{h.current=setInterval(()=>{n&&f||b()},s)},w=()=>{h.current&&(clearInterval(h.current),h.current=null)};return!f||!n?y():w(),w},[o,s,n,f,b]),l.useEffect(()=>{x(0)},[a]),{currentSlide:c,canGoPrev:g,canGoNext:v,goToPrev:C,goToNext:b,goToSlide:p,isHovered:f,setIsHovered:d}}const de={sm:{button:"h-6 w-6 text-xs",icon:"size-3"},md:{button:"h-8 w-8 text-sm",icon:"size-4"},lg:{button:"h-10 w-10 text-lg",icon:"size-5"}},Ee={default:"bg-accent text-accent-foreground hover:bg-accent-foreground hover:text-accent",outline:"border border-border bg-background hover:bg-accent hover:text-accent-foreground hover:border-accent",ghost:"hover:text-accent"},ue={aligned:{prev:"absolute top-1/2 -translate-x-1/2 -translate-y-1/2 z-10",next:"absolute right-0 top-1/2 translate-x-1/2 -translate-y-1/2 z-10"},exterior:{prev:"absolute -left-10 top-1/2 -translate-y-1/2 z-10",next:"absolute -right-10 top-1/2 -translate-y-1/2 z-10"},interior:{prev:"absolute left-2 top-1/2 -translate-y-1/2 z-10",next:"absolute right-2 top-1/2 -translate-y-1/2 z-10"}};function Jt({children:r,id:a,ref:t,className:o,autoScroll:s=!1,scrollInterval:n=3e3,pauseScrollOnHover:i=!0,currentIndex:u,onIndexChange:c,hidePrevNext:x=!1,hideDots:f=!1,itemsToShow:d=1,buttonSize:h="md",buttonVariant:m="default",buttonPosition:g="exterior",infinite:v=!0,prevButton:p,nextButton:C,itemsClassName:b,containerClassName:y,dotsClassName:w,gap:F=8}){var B,K;const M=l.useRef(null),j=l.Children.toArray(r).filter(l.isValidElement),D=j.length,{screenSize:N}=Xe.useScreenSize(),E=l.useMemo(()=>{if(typeof d=="number")return d;if(typeof d=="object"&&d&&N){const H=["2xl","xl","lg","md","sm","xs"],_=H.indexOf(N);for(let U=_;U<H.length;U++){const Z=H[U];if(d[Z]!==void 0)return d[Z]}}return 1},[d,N]),{currentSlide:A,canGoPrev:z,canGoNext:$,goToPrev:I,goToNext:T,goToSlide:V,setIsHovered:P}=Xt({totalItems:D,itemsToShow:E,infinite:v,autoScroll:s,scrollInterval:n,pauseScrollOnHover:i,currentIndex:u,onIndexChange:c}),Y=l.useCallback(H=>{if(E===1)return{leftWidth:0,rightWidth:0,widthReduction:0};const _=F*(E-1)/E;return H%E===0?{leftWidth:0,rightWidth:F/2,widthReduction:_}:H%E===E-1?{leftWidth:F/2,rightWidth:0,widthReduction:_}:{leftWidth:F/2,rightWidth:F/2,widthReduction:_}},[E,F]),R=()=>{I()},G=()=>{T()},X=()=>{i&&P(!0)},te=()=>{i&&P(!1)},q=-(A*(100/D)*E),S=k.join("inline-flex items-center justify-center rounded-md font-medium transition-all focus-visible:outline-none focus-visible:ring focus-visible:ring-ring disabled:pointer-events-none",g==="aligned"?"disabled:opacity-90":"disabled:opacity-50");return e.jsxs("div",{className:k.join("relative",o),"data-carousel-wrapper":"true",children:[!x&&e.jsx(e.Fragment,{children:p?l.cloneElement(p,{onClick:R,disabled:!z,className:k.join(((B=p.props)==null?void 0:B.className)||"",ue[g].prev),role:"button","aria-disabled":!z,"aria-label":"Previous slide","data-carousel-prev":"true"}):e.jsx("button",{type:"button",onClick:R,disabled:!z,className:k.join(S,de[h].button,Ee[m],ue[g].prev),"aria-disabled":!z,"aria-label":"Previous slide","data-carousel-prev":"true",children:e.jsx(L.ChevronLeft,{className:de[h].icon})})}),e.jsxs("div",{id:a,ref:t,className:k.join("relative overflow-hidden",y),onMouseEnter:X,onMouseLeave:te,"data-carousel":"true","data-current-index":A,"data-items-to-show":E,"data-auto-scroll":s,"data-button-position":g,children:[e.jsx("div",{ref:M,className:"flex transition-transform ease-in-out",style:{transform:`translateX(${q}%)`,width:`${D/E*100}%`},children:j.map((H,_)=>{const{leftWidth:U,rightWidth:Z,widthReduction:ne}=Y(_);return e.jsx("div",{className:k.join("flex-shrink-0",b),style:{width:`calc(${100/D}% - ${ne}px)`,marginRight:Z>0?`${Z}px`:void 0,marginLeft:U>0?`${U}px`:void 0},"data-slide-index":_,children:H},_)})}),!f&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex space-x-2",children:Array.from({length:Math.ceil(D/E)}).map((H,_)=>e.jsx("button",{type:"button",onClick:()=>V(_),className:k.join("w-2 h-2 rounded-full transition-colors",_===A?"bg-accent":"bg-muted-foreground/60 hover:bg-muted-foreground/100",w),"aria-label":`Go to slide ${_+1}`,"data-carousel-dot":_},_))})]}),!x&&e.jsx(e.Fragment,{children:C?l.cloneElement(C,{onClick:G,disabled:!$,className:k.join(((K=C.props)==null?void 0:K.className)||"",ue[g].next),role:"button","aria-disabled":!$,"aria-label":"Next slide","data-carousel-next":"true"}):e.jsx("button",{type:"button",onClick:G,disabled:!$,className:k.join(S,de[h].button,Ee[m],ue[g].next),"aria-disabled":!$,"aria-label":"Next slide","data-carousel-next":"true",children:e.jsx(L.ChevronRight,{className:de[h].icon})})})]})}function Ot({children:r,className:a,linkTo:t,linkProps:o,onButtonClick:s,buttonProps:n,...i}){return t&&s&&console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'),e.jsxs("div",{className:k.join("relative w-fit",a),...i,children:[r,t&&e.jsx("a",{...o,rel:(o==null?void 0:o.rel)||"noreferrer",href:t,className:k.join("absolute inset-0",o==null?void 0:o.className)}),!t&&s&&e.jsx("button",{...n,type:"button",onClick:s,className:k.join("absolute inset-0 cursor-pointer",n==null?void 0:n.className)})]})}function er(r){const[a,t]=l.useState(null);return l.useEffect(()=>{var u;const o=(u=document.getElementById(r))==null?void 0:u.parentElement;if(!o)return;const s=()=>{const c=window.getComputedStyle(o),x=parseFloat(c.fontSize),f=c.lineHeight==="normal"?x*1.2:parseFloat(c.lineHeight),d=x-2,h=d/x,m=f*h;t({fontSize:x,lineHeight:f,smallerFontSize:d,smallerLineHeight:m})};s();const n=new ResizeObserver(s);n.observe(o);const i=new MutationObserver(s);return i.observe(o,{attributes:!0,attributeFilter:["style","class"],subtree:!1}),()=>{n.disconnect(),i.disconnect()}},[r]),a}const tr={base:"",modest:"opacity-90 bg-muted/10",accent:"text-accent bg-muted/10",current:"text-current bg-current/10"};function rr({id:r,ref:a,content:t,variant:o="accent",className:s,style:n,...i}){const u=l.useId(),c=r||`code-${u}`,x=er(c);return e.jsx("code",{id:c,ref:a,className:k.join("px-2 py-1 rounded",tr[o],s),"data-variant":o,style:{fontSize:x?`${x.smallerFontSize}px`:void 0,lineHeight:x?`${x.smallerLineHeight}px`:void 0,...n},...i,children:t})}const sr={keyword:"text-rose-400",runner:"text-amber-400",comment:"text-gray-500/80",command:"text-gray-100",variable:"text-blue-400",string:"text-white/70",option:"text-purple-400",plain:"text-gray-200",operator:"text-pink-500",substitution:"text-green-300"},nr={selector:"text-blue-400 font-medium",property:"text-purple-400",value:"text-green-400",punctuation:"text-gray-400",atRule:"text-pink-400 font-semibold",comment:"text-gray-500 italic",string:"text-green-400",number:"text-green-400",plain:"text-gray-100",function:"text-cyan-400"},ar={key:"text-purple-400 font-semibold",string:"text-green-400",number:"text-orange-400 font-medium",boolean:"text-cyan-400 font-medium",punctuation:"text-gray-400",plain:"text-gray-100"},or={heading:"text-blue-400 font-bold","heading-hash":"text-gray-500",bold:"text-white font-bold",italic:"text-white italic","bold-marker":"text-gray-400","italic-marker":"text-gray-400",link:"text-blue-400 underline","link-text":"text-blue-400","link-url":"text-green-400","link-bracket":"text-gray-400","link-paren":"text-gray-400",code:"text-pink-400 bg-gray-800 px-1 rounded text-sm","code-marker":"text-gray-500","code-block":"text-green-400","code-block-marker":"text-gray-500","list-marker":"text-orange-400 font-medium","list-item":"text-gray-200",blockquote:"text-gray-300 italic","blockquote-marker":"text-gray-500",plain:"text-gray-200"},lr={keyword:"text-purple-400 font-semibold",type:"text-cyan-400 font-medium",string:"text-green-400","jsx-bracket":"text-gray-400","jsx-tag":"text-blue-400 font-medium","jsx-attribute":"text-amber-400","jsx-brace":"text-yellow-400",jsx:"text-blue-400 font-medium",property:"text-amber-400",number:"text-orange-400 font-medium",comment:"text-gray-500 italic",function:"text-rose-400 font-semibold",hook:"text-rose-400 font-semibold",operator:"text-gray-300",plain:"text-gray-100"},ir=new Set(["for","in","do","done","else","if","fi","then","while","until","case","esac"]),cr=new Set(["npm","npx","pnpm","yarn","vite"]);function dr(r){const a=[];let t=0;for(a.push({text:"`",type:"string"}),t=1;t<r.length;){const o=r[t];if(o==="`"){a.push({text:"`",type:"string"}),t++;break}if(o==="$"&&t+1<r.length&&r[t+1]==="{"){a.push({text:"${",type:"string"}),t+=2;let n=1;const i=t;for(;t<r.length&&n>0;)r[t]==="{"?n++:r[t]==="}"&&n--,n>0&&t++;if(n===0){const u=r.slice(i,t);if(u.trim().length>0){const c=he(u,!1,0);a.push(...c)}a.push({text:"}",type:"string"}),t++}else a.push({text:r.slice(i,t),type:"string"});continue}const s=t;for(;t<r.length&&r[t]!=="`"&&!(r[t]==="$"&&t+1<r.length&&r[t+1]==="{");)t++;t>s&&a.push({text:r.slice(s,t),type:"string"})}return{tokens:a,consumed:t}}function ur(r){const a=[];let t=0;for(;t<r.length;){const o=r[t];if(o==="`"){if(a.push({text:"`",type:"string"}),t++,t<r.length){const n=he(r.slice(t),!1,0,!1);a.push(...n)}break}if(o==="$"&&t+1<r.length&&r[t+1]==="{"){a.push({text:"${",type:"string"}),t+=2;let n=1;const i=t;for(;t<r.length&&n>0;)r[t]==="{"?n++:r[t]==="}"&&n--,n>0&&t++;if(n===0){const u=r.slice(i,t);if(u.trim().length>0){const c=he(u,!1,0,!1);a.push(...c)}a.push({text:"}",type:"string"}),t++}else{a.push({text:r.slice(i),type:"string"});break}continue}const s=t;for(;t<r.length&&r[t]!=="`"&&!(r[t]==="$"&&t+1<r.length&&r[t+1]==="{");)t++;t>s&&a.push({text:r.slice(s,t),type:"string"})}return{tokens:a}}function qe(r){const a=[];if(r.trim()==="")return a.push({text:" ",type:"plain"}),a;if(r.trim().startsWith("#"))return a.push({text:r,type:"comment"}),a;const t=/(\$\([^)]*\)|"[^"]*"|'[^']*'|\$[\w_]+|[a-zA-Z_]\w*=|--?[a-zA-Z0-9][\w-]*(?:=.*)?|>>|>|#.*|\s+|[^\s]+)/g,o=n=>{if(/^\$\([^)]*\)$/.test(n)){const i=n.slice(2,-1);return[{text:"$(",type:"operator"},...qe(i),{text:")",type:"operator"}]}if(/^".*"$/.test(n)){const i=n.slice(1,-1),u=[];let c=0;const x=/\$[\w_]+/g;let f;for(;(f=x.exec(i))!==null;)f.index>c&&u.push({text:i.slice(c,f.index),type:"string"}),u.push({text:f[0],type:"variable"}),c=f.index+f[0].length;return c<i.length&&u.push({text:i.slice(c),type:"string"}),[{text:'"',type:"string"},...u,{text:'"',type:"string"}]}return/^'.*'$/.test(n)?[{text:n,type:"string"}]:/^\$[\w_]+$/.test(n)?[{text:n,type:"variable"}]:/^[a-zA-Z_]\w*=$/.test(n)?[{text:n,type:"variable"}]:/^--?[a-zA-Z0-9][\w-]*(=.*)?$/.test(n)?[{text:n,type:"option"}]:/^>>|>$/.test(n)?[{text:n,type:"operator"}]:/^#.*$/.test(n)?[{text:n,type:"comment"}]:/^\s+$/.test(n)?[{text:n,type:"plain"}]:ir.has(n)?[{text:n,type:"keyword"}]:cr.has(n)?[{text:n,type:"runner"}]:[{text:n,type:"command"}]};let s;for(;(s=t.exec(r))!==null;)a.push(...o(s[0]));return a}function fr(r,a=!1){const t=[];let o=a;if(r.trim()==="")return t.push({text:" ",type:"plain"}),{tokens:t,inComment:o};let s="selector",n=0;r.match(/^\s+/)&&r.includes(":")&&!r.includes("{")&&(s="property",n=1);const i=/(\/\*[\s\S]*?\*\/|\/\*[\s\S]*$|\*\/)|(@[a-zA-Z-]+)|(\{|\}|:|;|,|\(|\))|("(?:[^"]*)"|'(?:[^']*)')|([a-zA-Z-]+)(?=\()|([0-9.]+(?:px|rem|em|%|vh|vw|deg|s|ms|fr)?)|(#[a-fA-F0-9]{3,8})|([a-zA-Z0-9_-]+|[.#][a-zA-Z0-9_-]+)|(\s+)|(\S+)/g;let u;for(;u=i.exec(r);){const[,c,x,f,d,h,m,g,v,p,C]=u;if(c)c.includes("/*")&&!c.includes("*/")?o=!0:c.includes("*/")&&(o=!1),t.push({text:c,type:"comment"});else if(o)u[0].includes("*/")&&(o=!1),t.push({text:u[0],type:"comment"});else if(x)t.push({text:x,type:"atRule"});else if(h)t.push({text:h,type:"function"});else if(f)f==="{"?(n++,s="property"):f==="}"?(n--,s=n>0?"property":"selector"):f===":"?s==="property"&&(s="value"):f===";"?n>0&&(s="property"):f===","&&n===0&&(s="selector"),t.push({text:f,type:"punctuation"});else if(d)t.push({text:d,type:"string"});else if(m)t.push({text:m,type:"number"});else if(g)t.push({text:g,type:"value"});else if(v){let b;v.startsWith(".")||v.startsWith("#")||s==="selector"?b="selector":s==="property"?b="property":b="value",t.push({text:v,type:b})}else if(p)t.push({text:p.replace(/ /g," "),type:"plain"});else if(C){const b=s==="value"?"value":"plain";t.push({text:C,type:b})}}return{tokens:t,inComment:o}}function xr(r){const a=/("[^"]*")\s*(:)|("[^"]*")|(\d+)|(true|false|null)|(\{|\}|\[|\]|,)/g,t=[];let o=0,s;for(;(s=a.exec(r))!==null;)s.index>o&&t.push({text:r.slice(o,s.index),type:"plain"}),s[1]&&s[2]?(t.push({text:s[1],type:"key"}),t.push({text:s[2],type:"punctuation"})):s[3]?t.push({text:s[3],type:"string"}):s[4]?t.push({text:s[4],type:"number"}):s[5]?t.push({text:s[5],type:"boolean"}):s[6]&&t.push({text:s[6],type:"punctuation"}),o=a.lastIndex;return o<r.length&&t.push({text:r.slice(o),type:"plain"}),t}function he(r,a=!1,t=0,o=!1){const s=[];let n=r,i=a,u=t;if(o){const c=ur(n);return s.push(...c.tokens),s}for(;n.length>0;){const c=n.match(/^\/\*[\s\S]*?\*\//);if(c){s.push({text:c[0],type:"comment"}),n=n.slice(c[0].length);continue}const x=n.match(/^\/\/.*$/m);if(x){s.push({text:x[0],type:"comment"}),n=n.slice(x[0].length);continue}if(n.match(/^`/)){const D=dr(n);s.push(...D.tokens),n=n.slice(D.consumed);continue}const d=n.match(/^("[^"]*"|'[^']*')/);if(d){s.push({text:d[0],type:"string"}),n=n.slice(d[0].length);continue}const h=n.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);if(h){s.push({text:"<",type:"jsx-bracket"}),s.push({text:h[1],type:"jsx-tag"}),n=n.slice(h[0].length),i=!0;continue}const m=n.match(/^<\/([a-zA-Z][a-zA-Z0-9]*)>/);if(m){s.push({text:"</",type:"jsx-bracket"}),s.push({text:m[1],type:"jsx-tag"}),s.push({text:">",type:"jsx-bracket"}),n=n.slice(m[0].length),i=!1;continue}if(n.match(/^\/?>/)){const D=n.match(/^(\/?>\s*)/);if(D){s.push({text:D[1].trim(),type:"jsx-bracket"}),n=n.slice(D[1].length),D[1].includes(">")&&(i=!1);continue}}const g=n.match(/^([a-zA-Z][a-zA-Z0-9]*)(\s*)(=)/);if(g&&i&&u===0){s.push({text:g[1],type:"jsx-attribute"}),g[2]&&s.push({text:g[2],type:"plain"}),s.push({text:"=",type:"plain"}),n=n.slice(g[0].length);continue}const v=n.match(/^[{}]/);if(v){s.push({text:v[0],type:"jsx-brace"}),v[0]==="{"?u++:v[0]==="}"&&u--,n=n.slice(1);continue}const p=n.match(/^\s+/);if(p){s.push({text:p[0],type:"plain"}),n=n.slice(p[0].length);continue}const C=n.match(/^(=>|===|!==|==|!=|<=|>=|&&|\|\||[+\-*/%=<>!&|^~?:;,()[\]{}.])/);if(C){s.push({text:C[0],type:"operator"}),n=n.slice(C[0].length);continue}const b=n.match(/^(const|let|var|function|if|else|for|while|return|import|export|class|extends|interface|type|enum|async|await|public|private|protected|static|from|as|default|new|this|super|try|catch|finally|throw|break|continue|switch|case|typeof|instanceof)\b/);if(b){s.push({text:b[0],type:"keyword"}),n=n.slice(b[0].length);continue}const y=n.match(/^(use[A-Z][a-zA-Z]*)\b/);if(y){s.push({text:y[0],type:"hook"}),n=n.slice(y[0].length);continue}const w=n.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=(\?\.)?\()/);if(w){s.push({text:w[1],type:"function"}),n=n.slice(w[1].length);continue}const F=n.match(/^(string|number|boolean|object|any|void|never|unknown|null|undefined|Promise|Array|React\.FC|FC|JSX\.Element|HTMLElement|Event|MouseEvent|KeyboardEvent|ChangeEvent)\b/);if(F){s.push({text:F[0],type:"type"}),n=n.slice(F[0].length);continue}const M=n.match(/^(\d+\.?\d*)/);if(M){s.push({text:M[0],type:"number"}),n=n.slice(M[0].length);continue}const j=n.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=:)/);if(j&&!i){s.push({text:j[1],type:"property"}),n=n.slice(j[1].length);continue}s.push({text:n[0],type:"plain"}),n=n.slice(1)}return s}function mr(r){const a=[];if(r.trim()==="")return a.push({text:" ",type:"plain"}),a;const t=r,o=t.match(/^(#{1,6})\s*(.*)$/);if(o)return a.push({text:o[1],type:"heading-hash"}),o[2]&&(a.push({text:" ",type:"plain"}),a.push({text:o[2],type:"heading"})),a;const s=t.match(/^(>\s*)(.*)$/);if(s)return a.push({text:s[1],type:"blockquote-marker"}),s[2]&&a.push({text:s[2],type:"blockquote"}),a;const n=t.match(/^(\s*)([-*+]|\d+\.)\s*(.*)$/);if(n)return n[1]&&a.push({text:n[1],type:"plain"}),a.push({text:n[2],type:"list-marker"}),a.push({text:" ",type:"plain"}),n[3]&&Se(n[3],a),a;const i=t.match(/^(```)\s*(.*)$/);return i?(a.push({text:i[1],type:"code-block-marker"}),i[2]&&(a.push({text:" ",type:"plain"}),a.push({text:i[2],type:"code-block"})),a):(Se(t,a),a)}function Se(r,a){let t=r;for(;t.length>0;){const o=t.match(/^(\[)([^\]]*?)(\])(\()([^)]*?)(\))/);if(o){a.push({text:o[1],type:"link-bracket"}),a.push({text:o[2],type:"link-text"}),a.push({text:o[3],type:"link-bracket"}),a.push({text:o[4],type:"link-paren"}),a.push({text:o[5],type:"link-url"}),a.push({text:o[6],type:"link-paren"}),t=t.slice(o[0].length);continue}const s=t.match(/^(`+)([^`]*?)\1/);if(s){a.push({text:s[1],type:"code-marker"}),a.push({text:s[2],type:"code"}),a.push({text:s[1],type:"code-marker"}),t=t.slice(s[0].length);continue}const n=t.match(/^(\*\*|__)([^*_]*?)\1/);if(n){a.push({text:n[1],type:"bold-marker"}),a.push({text:n[2],type:"bold"}),a.push({text:n[1],type:"bold-marker"}),t=t.slice(n[0].length);continue}const i=t.match(/^(\*|_)([^*_]*?)\1/);if(i){a.push({text:i[1],type:"italic-marker"}),a.push({text:i[2],type:"italic"}),a.push({text:i[1],type:"italic-marker"}),t=t.slice(i[0].length);continue}a.push({text:t[0],type:"plain"}),t=t.slice(1)}}function hr(r,a){const t={...sr,...a};return r.map((o,s)=>{const n=qe(o);return e.jsx("div",{className:"leading-6",children:n.map((i,u)=>e.jsx("span",{className:t[i.type]||"text-gray-100",children:i.text},u))},s)})}function pr(r,a){const t={...nr,...a};let o=!1;return r.map((s,n)=>{const{tokens:i,inComment:u}=fr(s,o);return o=u,e.jsx("div",{className:"leading-6",children:i.map((c,x)=>e.jsx("span",{className:t[c.type]||"text-gray-100",children:c.text},x))},n)})}function br(r,a){const t={...ar,...a};return r.map((o,s)=>e.jsx("div",{className:"leading-6",children:xr(o).map((n,i)=>e.jsx("span",{className:t[n.type]||"text-gray-100",children:n.text},i))},s))}function gr(r,a){const t={...lr,...a};let o=!1,s=0,n=!1;return r.map((i,u)=>{if(i.trim()==="")return e.jsx("div",{className:"leading-6",children:" "},u);const c=he(i,o,s,n);(i.match(/`/g)||[]).length%2===1&&(n=!n),i.includes("<")&&i.match(/<[a-zA-Z]/)&&(o=!0),i.includes(">")&&!i.includes("<")&&(o=!1,s=0);const f=(i.match(/\{/g)||[]).length,d=(i.match(/\}/g)||[]).length;return s+=f-d,s<0&&(s=0),e.jsx("div",{className:"leading-6",children:c.map((h,m)=>e.jsx("span",{className:t[h.type]||"text-gray-100",children:h.text},m))},u)})}function yr(r,a){const t={...or,...a};return r.map((o,s)=>e.jsx("div",{className:"leading-6",children:mr(o).map((n,i)=>e.jsx("span",{className:t[n.type]||"text-gray-100",children:n.text},i))},s))}function vr(r){const[a,t]=l.useState(!1),o=l.useCallback(async()=>{try{await navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),3e3)}catch(s){console.error("Failed to copy code:",s)}},[r]);return{copied:a,handleCopy:o}}function jr(r,a){const t=l.useRef(null),o=l.useRef(null);return l.useEffect(()=>{if(r){t.current=document.activeElement,document.body.style.overflow="hidden",setTimeout(()=>{var n;(n=o.current)==null||n.focus()},100);const s=n=>{n.key==="Escape"&&a(!1)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),document.body.style.overflow=""}}else t.current&&(t.current.focus(),t.current=null)},[r,a]),{containerRef:o}}function wr(r,a,t,o){return{handleKeyDown:l.useCallback(n=>{n.key==="c"&&(n.metaKey||n.ctrlKey)&&r?(n.preventDefault(),t()):n.key==="f"&&a&&(n.preventDefault(),o())},[r,a,t,o])}}function kr(r){switch(r){case"typescript":case"ts":return"ts";case"tsx":return"tsx";case"json":return"json";case"bash":case"sh":return"sh";case"css":return"css";case"markdown":case"md":return"md";default:return"txt"}}function Cr({code:r,language:a="typescript",allowCopy:t=!0,allowDownload:o=!1,allowFullscreen:s=!1,filename:n,showTrafficLights:i=!0,showLineNumbers:u=!1,hideHeader:c=!1,hideFiletype:x=!1,maxHeight:f,tokenClasses:d,className:h,id:m,ref:g,...v}){const[p,C]=l.useState(!1),{containerRef:b}=jr(p,C),{copied:y,handleCopy:w}=vr(r),F=l.useCallback(()=>{const I=n||`code.${kr(a)}`;ve.downloadFile(r,I)},[r,n,a]),M=l.useCallback(()=>{C(I=>!I)},[]),{handleKeyDown:j}=wr(t,s,w,M),D=l.useMemo(()=>r.split(`
2
- `),[r]),N=l.useCallback((I=!0)=>e.jsxs("div",{className:k.join("flex items-center space-x-2",!I&&"absolute top-2 right-2 z-10"),children:[!x&&e.jsx("span",{className:"text-xs text-gray-400 uppercase tracking-wide font-medium","aria-label":`Code language: ${a}`,children:a}),s&&e.jsx("button",{onClick:M,className:"p-1.5 leading-0 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors motion-reduce:transition-none min-h-[44px] min-w-[44px] flex items-center justify-center md:min-h-auto md:min-w-auto md:p-1.5",title:p?"Exit fullscreen":"Fullscreen","aria-label":p?"Exit fullscreen mode":"Enter fullscreen mode","aria-pressed":p,type:"button",children:p?e.jsx(L.Dash,{size:14}):e.jsx(L.Window,{size:14})}),o&&e.jsx("button",{onClick:F,className:"p-1.5 leading-0 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors motion-reduce:transition-none min-h-[44px] min-w-[44px] flex items-center justify-center md:min-h-auto md:min-w-auto md:p-1.5",title:"Download code","aria-label":"Download code as file",type:"button",children:e.jsx(L.Download,{size:14})}),t&&e.jsx("button",{onClick:w,className:"p-1.5 leading-0 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors motion-reduce:transition-none min-h-[44px] min-w-[44px] flex items-center justify-center md:min-h-auto md:min-w-auto md:p-1.5",title:y?"Code copied!":"Copy code","aria-label":y?"Code copied to clipboard":"Copy code to clipboard","aria-live":"polite",type:"button",children:y?e.jsx(L.Check,{size:14,className:"text-green-400"}):e.jsx(L.Copy,{size:14})})]}),[x,a,s,p,o,F,t,w,y,M]),E=l.useMemo(()=>a==="json"?br(D,d):a==="tsx"||a==="ts"||a==="typescript"?gr(D,d):a==="bash"||a==="sh"?hr(D,d):a==="css"?pr(D,d):a==="markdown"||a==="md"?yr(D,d):[e.jsx("span",{className:"text-gray-400",children:"Unsupported language"},0)],[D,d,a]),A=l.useMemo(()=>u?D.map((I,T)=>e.jsx("div",{className:"text-gray-500 text-right pl-3 pr-1 select-none min-w-8 text-sm font-mono leading-6","aria-hidden":"true",role:"presentation",children:T+1},T)):null,[u,D]),z=l.useMemo(()=>({maxHeight:f&&!p?`${f}px`:p?c?"calc(100vh - 5px)":"calc(100vh - 45px)":void 0,overflow:f||p?"auto":"visible"}),[f,p,c]),$=e.jsxs("div",{id:m,ref:I=>{b.current=I,typeof g=="function"?g(I):g&&(g.current=I)},className:k.join("bg-gray-900 rounded-lg border border-gray-700 overflow-hidden motion-reduce:transition-none",p&&"fixed inset-0 z-[9999] max-h-fit",h),"data-language":a,"data-filename":n,"data-fullscreen":p,role:"region","aria-label":`Code block${n?` for ${n}`:""} in ${a}`,"aria-describedby":u?`${m}-description`:void 0,tabIndex:0,onKeyDown:j,...v,children:[u&&e.jsxs("div",{id:`${m}-description`,className:"sr-only",children:["Code block with line numbers. Use Cmd+C or Ctrl+C to copy code.",s&&" Press F to toggle fullscreen."]}),e.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:y&&"Code copied to clipboard"}),!c&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-800 border-b border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[i&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("div",{className:"w-3 h-3 bg-red-500 rounded-full"}),e.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full"}),e.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full"})]}),n&&e.jsx("span",{className:"text-sm text-gray-300 font-medium",children:n})]}),N(!0)]}),e.jsxs("div",{className:k.join("flex overflow-hidden",c&&"relative"),style:z,children:[c&&N(!1),e.jsx("div",{className:"flex-1 overflow-x-auto",children:e.jsxs("div",{className:"flex",children:[u&&e.jsx("div",{className:"bg-gray-800 py-4 border-r border-gray-700 flex flex-col flex-shrink-0","aria-hidden":"true",role:"presentation",children:A}),e.jsx("div",{className:"flex-1 p-4",children:e.jsx("pre",{className:"text-sm font-mono focus:outline-none",role:"code","aria-label":`${a} code content`,tabIndex:-1,children:e.jsx("code",{children:E})})})]})})]})]});return e.jsxs(e.Fragment,{children:[!p&&$,p&&ye.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black z-[9998]",onClick:()=>C(!1),"aria-hidden":"true"}),$]}),document.body)]})}function Nr({textToCopy:r,delay:a=2e3,children:t,icon:o,copiedIcon:s,showCopyText:n=!1,iconSize:i=16,className:u,onClick:c,variant:x,size:f,rounded:d,id:h,disabled:m,ref:g}){const[v,p]=l.useState(!1),C=l.useCallback(async F=>{try{await navigator.clipboard.writeText(F),p(!0),setTimeout(()=>{p(!1)},a)}catch(M){console.error("Failed to copy text:",M)}},[a]),b=F=>{C(r),c&&c(F)},w=t||n?"inline mr-2":"inline";return e.jsx(J.Button,{variant:x,size:f,rounded:d,id:h,disabled:m,ref:g,onClick:b,className:k.join(u),"data-copied":v,"aria-label":v?"Copied to clipboard":"Copy to clipboard",children:v?e.jsxs(e.Fragment,{children:[s??e.jsx(L.Check,{size:i,className:w}),t||n&&"Copied!"]}):e.jsxs(e.Fragment,{children:[o??e.jsx(L.Copy,{size:i,className:w}),t||n&&"Copy"]})})}function Dr({children:r,label:a,isOpen:t,onToggle:o,id:s,ref:n,disabled:i=!1,className:u,buttonClassName:c}){const x=l.useId(),f=s??x,[d,h]=l.useState(!1),m=t!==void 0?t:d,g=()=>{i||(t===void 0&&h(v=>!v),o==null||o(!m))};return l.useEffect(()=>{h(t??!1)},[t]),e.jsxs("div",{ref:n,id:f,"data-open":m,className:k.join("overflow-hidden",u),children:[e.jsx("button",{id:`${f}-button`,type:"button","aria-expanded":m,"aria-controls":`${f}-panel`,disabled:i,tabIndex:0,className:k.join("w-full px-4 py-3 font-medium hover:bg-primary/10 disabled:opacity-50 disabled:cursor-not-allowed",c),onClick:g,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),g())},"data-open":m,"data-label":typeof a=="string"?a:void 0,children:e.jsxs("div",{className:"flex items-center w-full gap-2",children:[e.jsx("span",{className:"flex-1 text-left",children:a}),m?e.jsx(L.CaretCollapse,{className:"size-5","aria-hidden":"true"}):e.jsx(L.CaretExpand,{className:"size-5","aria-hidden":"true"})]})}),e.jsx("div",{id:`${f}-panel`,role:"region","aria-labelledby":f,"aria-live":"polite",hidden:!m,children:r})]})}function Er(r){const[a,t]=l.useState(!1),[o,s]=l.useState(!1);return l.useEffect(()=>{if(r){s(!0);const n=setTimeout(()=>t(!0),10);return()=>clearTimeout(n)}else{t(!1);const n=setTimeout(()=>s(!1),300);return()=>clearTimeout(n)}},[r]),{show:a,shouldRender:o}}function Sr({isOpen:r,onClose:a,enabled:t=!0}){const[o,s]=l.useState(!1),[n,i]=l.useState(0),[u,c]=l.useState(0),x=l.useCallback(w=>{!t||!r||(s(!0),c(w),document.body.style.userSelect="none")},[t,r]),f=l.useCallback(w=>{if(!o||!t)return;const F=w-u,M=Math.max(0,F);i(M)},[o,t,u]),d=l.useCallback(()=>{if(!o||!t)return;s(!1),document.body.style.userSelect="",n>100&&a(),i(0)},[o,t,n,a]),h=l.useCallback(w=>{w.preventDefault(),x(w.clientY)},[x]),m=l.useCallback(w=>{f(w.clientY)},[f]),g=l.useCallback(()=>{d()},[d]),v=l.useCallback(w=>{w.preventDefault(),x(w.touches[0].clientY)},[x]),p=l.useCallback(w=>{w.preventDefault(),f(w.touches[0].clientY)},[f]),C=l.useCallback(()=>{d()},[d]);l.useEffect(()=>{if(o)return document.addEventListener("mousemove",m),document.addEventListener("mouseup",g),document.addEventListener("touchmove",p,{passive:!1}),document.addEventListener("touchend",C),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",C)}},[o,m,g,p,C]);const b=l.useCallback(w=>{t&&(w.key==="ArrowDown"||w.key==="Escape")&&(w.preventDefault(),a())},[t,a]);return{dragHandlers:t?{onMouseDown:h,onTouchStart:v,onKeyDown:b}:{},translateY:n,isDragging:o}}function Fr(r,a){const t=l.useRef(null);l.useEffect(()=>{if(!a)return;t.current=document.activeElement;const o=document.getElementById(r);o&&o.focus();const s=n=>{if(n.key!=="Tab")return;const i=document.getElementById(r);if(!i)return;const u=i.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),c=u[0],x=u[u.length-1];n.shiftKey&&document.activeElement===c?(n.preventDefault(),x==null||x.focus()):!n.shiftKey&&document.activeElement===x&&(n.preventDefault(),c==null||c.focus())};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),t.current&&typeof t.current.focus=="function"&&t.current.focus()}},[r,a])}function Ir(r,a){l.useEffect(()=>{if(!r)return;const t=window.getComputedStyle(document.body).overflow;document.body.style.overflow="hidden";const o=s=>{s.key==="Escape"&&a()};return document.addEventListener("keydown",o),()=>{document.body.style.overflow=t,document.removeEventListener("keydown",o)}},[r,a])}function Ar({ref:r,id:a,isOpen:t,onClose:o,title:s,children:n,footer:i,className:u,overlayClassName:c,showCloseButton:x=!1,disableCloseOnOverlayClick:f=!1,enableDragGestures:d=!0,ariaLabelledBy:h,ariaDescribedBy:m}){const g=l.useId(),v=a||`drawer-${g}`,p=`${g}-title`,{show:C,shouldRender:b}=Er(t),{dragHandlers:y,translateY:w,isDragging:F}=Sr({isOpen:t,onClose:o,enabled:d});if(Fr(v,b),Ir(b,o),!b)return null;const M=()=>s?l.isValidElement(s)?e.jsx("div",{children:s}):e.jsx("h2",{className:"text-2xl font-semibold",id:p,children:s}):null,j=()=>{if(!i)return null;if(l.isValidElement(i)){const D=i,N=D.props.className||"";return l.cloneElement(D,{className:k.join("px-6 py-4",N)})}return e.jsx("div",{className:"px-6 py-4",children:i})};return e.jsx(e.Fragment,{children:ye.createPortal(e.jsxs("div",{"aria-labelledby":h??s?p:void 0,"aria-describedby":m,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[100] overflow-hidden","data-drawer-open":t,children:[e.jsx("div",{className:k.join("fixed inset-0 bg-black/40 transition-opacity",C?"opacity-100":"opacity-0",c),onClick:()=>{f||o()}}),e.jsx("div",{className:"fixed inset-x-0 bottom-0 flex max-h-full",children:e.jsx("div",{id:v,ref:r,tabIndex:-1,className:k.join("relative w-screen transform shadow-xl bg-popover text-popover-foreground transition-transform ease-in-out border-t border-border rounded-t-lg",C?"translate-y-0":"translate-y-full",u),style:{transform:d&&w!==0?`translateY(${w}px)`:void 0,transition:w!==0?"none":void 0},children:e.jsxs("div",{className:"flex h-full flex-col",children:[d&&e.jsx("div",{className:k.join("flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing",d&&"select-none"),...y,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":d?"Drag to resize drawer":void 0,children:e.jsx("div",{className:k.join("w-12 h-1.5 bg-popover-foreground/25 rounded-full transition-colors",d&&"hover:bg-popover-foreground/50",F&&"bg-popover-foreground/50")})}),s&&e.jsx("div",{className:"px-6 pt-4",children:M()}),x&&e.jsx("button",{type:"button",onClick:o,"data-drawer-close-button":"true","aria-label":"Close drawer",className:"rounded-md p-0.5 top-3 right-3 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0",children:e.jsx(re.X,{size:18})}),e.jsx("div",{className:k.join("flex-1 overflow-y-auto px-6 pb-6",s?"pt-6":"pt-4"),children:n}),j()]})})})]}),document.body)})}function $r(r){switch(r){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}function zr({internalIsOpen:r,autoSwitchPlacement:a,placement:t,offset:o,triggerRef:s,popoverRef:n}){const[i,u]=l.useState(t);return l.useEffect(()=>{if(!r||!a)return;const c=()=>{if(!s.current||!n.current)return;const d=s.current.getBoundingClientRect(),h=n.current.getBoundingClientRect(),m=window.innerWidth,g=window.innerHeight;let v=t;const p=$r(t);if(t==="top"||t==="bottom"){const C=t==="top"?d.top>=h.height+o:g-d.bottom>=h.height+o,b=p==="top"?d.top>=h.height+o:g-d.bottom>=h.height+o;!C&&b&&(v=p)}else{const C=t==="left"?d.left>=h.width+o:m-d.right>=h.width+o,b=p==="left"?d.left>=h.width+o:m-d.right>=h.width+o;!C&&b&&(v=p)}u(v)};c();const x=()=>c();window.addEventListener("scroll",x,!0),window.addEventListener("resize",x);const f=new ResizeObserver(c);return s.current&&f.observe(s.current),n.current&&f.observe(n.current),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x),f.disconnect()}},[r,t,o,a,s,n]),i}const Mr={bottom:{start:"top-full left-0 origin-top-left",center:"top-full left-1/2 -translate-x-1/2 origin-top",end:"top-full right-0 origin-top-right"},top:{start:"bottom-full left-0 origin-bottom-left",center:"bottom-full left-1/2 -translate-x-1/2 origin-bottom",end:"bottom-full right-0 origin-bottom-right"},left:{start:"right-full top-0 origin-top-right",center:"right-full top-1/2 -translate-y-1/2 origin-right",end:"right-full bottom-0 origin-bottom-right"},right:{start:"left-full top-0 origin-top-left",center:"left-full top-1/2 -translate-y-1/2 origin-left",end:"left-full bottom-0 origin-bottom-left"}};function Tr(r,a){switch(r){case"top":return{marginBottom:`${a}px`};case"bottom":return{marginTop:`${a}px`};case"left":return{marginRight:`${a}px`};case"right":return{marginLeft:`${a}px`};default:return{}}}function Pe({id:r,ref:a,isOpen:t,onOpenChange:o,children:s,className:n,closeOnOverlayClick:i=!0,trigger:u,placement:c="bottom",alignment:x="center",closeOnTriggerClick:f=!0,offset:d=8,autoSwitchPlacement:h=!0,hoverable:m=!1}){const[g,v]=l.useState(t??!1),p=l.useRef(null),C=l.useRef(null),b=l.useRef(null),y=l.useId(),w=l.useRef(null),F=zr({internalIsOpen:g,autoSwitchPlacement:h,placement:c,offset:d,triggerRef:C,popoverRef:p}),M=l.useCallback(z=>{o&&o(z),t===void 0&&v(z)},[t,o]),j=l.useCallback(()=>{w.current&&(clearTimeout(w.current),w.current=null)},[]),D=l.useCallback(()=>{m&&(j(),M(!0))},[m,j,M]),N=l.useCallback(()=>{m&&(j(),w.current=setTimeout(()=>{M(!1)},200))},[m,j,M]);l.useEffect(()=>{t!==void 0&&v(t)},[t]),l.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]),l.useEffect(()=>{if(!g)return;const z=$=>{$.key==="Escape"&&M(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[g,M]),l.useEffect(()=>{if(!g||!i)return;const z=$=>{const I=$.target;p.current&&!p.current.contains(I)&&C.current&&!C.current.contains(I)&&M(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[g,i,M]),l.useEffect(()=>{var z,$;g?(b.current=document.activeElement,(z=p.current)==null||z.focus()):(($=b.current)==null||$.focus(),b.current=null)},[g]);const E=u.props,A=l.cloneElement(u,{"aria-expanded":g,"aria-haspopup":"dialog","aria-controls":y,ref:ve.mergeRefs(C,E.ref),onClick:z=>{var $,I;if(($=E.onClick)==null||$.call(E,z),!m&&!(!f&&g)&&t===void 0){if(z.defaultPrevented||(I=p.current)!=null&&I.contains(z.target))return;M(!g)}},onMouseEnter:z=>{var $;($=E.onMouseEnter)==null||$.call(E,z),D()},onMouseLeave:z=>{var $;($=E.onMouseLeave)==null||$.call(E,z),N()}});return e.jsxs("div",{id:r,ref:a,className:"relative inline-block",children:[A,e.jsx("div",{id:y,ref:p,className:k.join("absolute z-[90] transform rounded-md shadow-lg bg-popover text-popover-foreground transition-all ease-out",g?"opacity-100 scale-100":"opacity-0 scale-75 pointer-events-none",Mr[F][x],n),style:Tr(F,d),role:"dialog","aria-modal":"true",tabIndex:-1,inert:g?void 0:!0,"aria-hidden":g?void 0:!0,onMouseEnter:m?D:void 0,onMouseLeave:m?N:void 0,children:s})]})}function Ke({option:r,...a}){const{onItemSelect:t}=J.useDropdownMenuContext(),o=()=>{r.onClick&&r.onClick(),r.value&&t(r.value)},s=r.subItems&&r.subItems.length>0,n=r.href&&!r.disabled,i=n?"a":"div";return e.jsxs(i,{href:n?r.href:void 0,className:k.join("relative flex items-center gap-2 px-3 py-2 text-sm focus:outline-none focus:bg-popover-foreground/10",r.disabled?"opacity-50 cursor-default":"cursor-pointer"),onClick:r.disabled?void 0:o,...a,children:[r.icon&&e.jsx("span",{className:"size-4",children:r.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{children:r.label}),r.description&&e.jsx("div",{className:"text-xs text-popover-foreground/60",children:r.description})]}),r.keyboardShortcut&&e.jsx("div",{className:"text-xs text-popover-foreground/60",children:r.keyboardShortcut}),s&&e.jsx(L.ChevronRight,{className:"size-4"})]})}function Rr({option:r,level:a,index:t}){const{focus:o,setFocus:s}=J.useDropdownMenuContext(),[n,i]=l.useState(!1),[u,c]=l.useState(!1),x=l.useRef(null),f=l.useRef(void 0),d=l.useId(),h=()=>{r.disabled||(s({level:a,index:t}),g())},m=()=>{s(null),v()},g=()=>{i(!0)},v=()=>{i(!1)},p=y=>{if(y.key==="ArrowRight"){if(y.preventDefault(),r.disabled)return;c(!1)}};l.useEffect(()=>{const y=o==null?void 0:o.level,w=f.current,F=a+1;y&&w&&w===F&&y===w-1?c(!0):c(!1),f.current=y},[o,a]);const C=r.subItems!==void 0&&r.subItems.length>0,b=n&&!u&&C;return e.jsxs("div",{ref:x,className:"relative focus:outline-none focus:bg-popover-foreground/10",onMouseEnter:h,onMouseLeave:m,onFocus:g,onBlur:v,onKeyDown:p,tabIndex:0,"data-menu-item":r.value,"data-level":a,"data-index":t,"aria-haspopup":C?"true":void 0,"aria-expanded":b?"true":"false","aria-disabled":r.disabled?"true":void 0,"aria-label":r.label,"aria-controls":b?d:void 0,children:[e.jsx(Ke,{option:r}),b&&e.jsx("div",{className:"absolute left-full top-0 z-30",children:e.jsx(He,{items:r.subItems??[],level:a+1,id:d})})]})}function He({items:r,level:a,id:t}){const{setFocus:o,className:s=""}=J.useDropdownMenuContext();let n=0;const i=(u,c)=>{switch(u.__type){case"option":return u.subItems&&u.subItems.length>0?e.jsx(Rr,{option:u,level:a,index:n++},c):e.jsx(Ke,{option:u,"data-menu-item":u.value,"data-level":a,"data-index":n++,tabIndex:-1,"aria-disabled":u.disabled?"true":void 0,onMouseEnter:x=>{if(x.preventDefault(),u.disabled)return;const f=Number(x.currentTarget.getAttribute("data-index"));o({level:a,index:f})},onMouseLeave:x=>{x.preventDefault(),o(null)}},c);case"group":return e.jsxs("div",{children:[u.title&&e.jsx("div",{className:"px-3 py-2 text-xs font-semibold text-popover-foreground/50 uppercase",children:u.title}),u.items.map((x,f)=>i(x,`${c}-${f}`))]},c);case"separator":return e.jsx("div",{"aria-hidden":!0,className:"my-1 mx-2 border-t border-popover-foreground/20"},c);case"custom":return e.jsx("div",{children:u.render()},c);default:return null}};return e.jsx("div",{id:t,className:k.join("border py-1 border-popover-foreground/20 rounded-md min-w-52 shadow-lg bg-popover text-popover-foreground",s),tabIndex:0,"data-level":a,"data-menu":!0,role:"menu","aria-label":`Dropdown menu level ${a}`,children:r.map((u,c)=>i(u,String(c)))})}function Br(r,a){return Array.from(r.querySelectorAll(`[data-menu-item][data-level="${a}"]`))}function Lr(r,a){const t=a===null?0:(a+1)%r.length;for(let o=0;o<r.length;o++){const s=(t+o)%r.length;if(!r[s].hasAttribute("aria-disabled"))return s}return-1}function Vr(r,a){const t=a===null?r.length-1:(a-1+r.length)%r.length;for(let o=0;o<r.length;o++){const s=(t-o+r.length)%r.length;if(!r[s].hasAttribute("aria-disabled"))return s}return-1}function Gr({dropdownId:r,focus:a,setFocus:t,isOpen:o,onClose:s}){const n=l.useCallback(i=>{var d;if(!o)return;const{level:u,index:c}=a||{level:1,index:null},x=document.querySelector(`#${r} [data-menu][data-level="${u}"]`);if(!x)return;const f=Br(x,u);if(f.length!==0)switch(i.key){case"ArrowDown":{i.preventDefault();const h=Lr(f,c);if(h===-1)return;t({level:u,index:h});break}case"ArrowUp":{i.preventDefault();const h=Vr(f,c);if(h===-1)return;t({level:u,index:h});break}case"ArrowRight":{if(i.preventDefault(),c!==null){const m=f[c].querySelector("[data-menu]");m&&m.querySelector("[data-menu-item]")&&t({level:u+1,index:0})}break}case"ArrowLeft":{i.preventDefault();const h=(d=x.parentElement)==null?void 0:d.closest("[data-menu-item]");if(!h){console.error(`No parent menu found leaving menu level ${u}`);return}const m=h.getAttribute("data-index")?Number(h.getAttribute("data-index")):-1;h&&t({level:u-1,index:m===-1?0:m});break}case"Enter":{if(i.preventDefault(),c!==null){const h=f[c];h==null||h.click(),t(null)}break}case"Escape":{i.preventDefault(),s==null||s(),t(null);break}case"Tab":{s();break}}},[o,a,t,s,r]);return l.useEffect(()=>{if(o)return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[n,o]),{handleKeyDown:n}}function Wr(r,a,t){return document.querySelector(`#${r} [data-menu-item][data-level="${a}"][data-index="${t}"]`)}function _r({id:r,items:a,onItemSelect:t,trigger:o,isOpen:s,placement:n="bottom",alignment:i="start",onOpenChange:u,className:c="",...x}){const f=l.useId(),d=r||`dropdown-menu-${f}`,[h,m]=l.useState(null),[g,v]=l.useState(!1),p=s===void 0,C=p?g:s,b=l.useCallback(()=>{m(null),v(!1)},[]),y=l.useCallback(j=>{t&&t(j),b()},[t,b]),w=l.useCallback(j=>{p&&v(j),u&&u(j)},[p,u]),F=l.useMemo(()=>({id:d,focus:h,setFocus:m,isOpen:C,onItemSelect:y,onClose:b,className:c}),[h,m,y,b,c,C,d]);Gr({dropdownId:d,focus:h,setFocus:m,isOpen:C,onClose:b});const M=l.useMemo(()=>l.cloneElement(o,{onClick:j=>{p&&v(N=>!N);const D=o.props;D.onClick&&D.onClick(j)}}),[p,v,o]);return l.useEffect(()=>{if(h){const j=Wr(d,h.level,h.index);j==null||j.focus()}},[h,d]),e.jsx(Pe,{id:d,isOpen:p?g:C,trigger:M,placement:n,alignment:i,onOpenChange:w,className:k.join("min-w-52",c),...x,children:e.jsx(J.DropdownMenuContext.Provider,{value:F,children:e.jsx(He,{items:a,level:1})})})}const qr=r=>({__type:"option",...r}),Pr=(r,a)=>({__type:"group",title:a,items:r}),Kr=()=>({__type:"separator"}),Hr=r=>({__type:"custom",render:r}),Zr={option:qr,group:Pr,separator:Kr,custom:Hr};function Yr(r=[]){const[a,t]=l.useState(r),[o,s]=l.useState(null),[n,i]=l.useState(null),u=l.useRef(null),c=l.useCallback((b,y)=>{const w={...y,id:`item-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,content:b};return t(F=>[...F,w]),w},[]),x=l.useCallback(b=>{t(y=>y.filter(w=>w.id!==b))},[]),f=l.useCallback((b,y)=>{b!==y&&t(w=>{const F=[...w],[M]=F.splice(b,1);return F.splice(y,0,M),F})},[]),d=l.useCallback(b=>{b>0&&f(b,b-1)},[f]),h=l.useCallback(b=>{b<a.length-1&&f(b,b+1)},[f,a.length]),m=l.useCallback((b,y)=>{s(b),u.current=y,i(y)},[]),g=l.useCallback((b,y)=>{b.preventDefault(),i(y)},[]),v=l.useCallback(()=>{if(o&&n!==null&&u.current!==null){const b=u.current,y=n;b!==y&&f(b,y)}s(null),i(null),u.current=null},[o,n,f]),p=l.useCallback(b=>{b.preventDefault(),v()},[v]),C=l.useCallback(()=>{if(!o||n===null||u.current===null)return a;const b=u.current,y=n;if(b===y)return a;const w=[...a],[F]=w.splice(b,1);return w.splice(y,0,F),w},[a,o,n,u]);return{items:a,visualItems:C(),addItem:c,deleteItem:x,moveItem:f,moveItemUp:d,moveItemDown:h,draggedItem:o,draggedOverIndex:n,handleDragStart:m,handleDragOver:g,handleDragEnd:v,handleDrop:p}}const Ur={sm:"text-sm",md:"text-base",lg:"text-lg"},Qr={sm:"text-sm gap-2",md:"text-base gap-3",lg:"text-lg gap-4"},Xr={sm:14,md:15,lg:16};function Fe({size:r=8,className:a=""}){return e.jsx("div",{className:`rounded-full flex-shrink-0 bg-current ${a}`,style:{width:r,height:r}})}function Jr({size:r=12,className:a=""}){return e.jsx("div",{className:`flex-shrink-0 bg-current ${a}`,style:{width:r,height:2}})}function Or({items:r=[],size:a="md",id:t,className:o="",ref:s,allowAdd:n=!0,allowDelete:i=!0,allowReorder:u=!0,addPlaceholder:c="Add new item...",onItemsChange:x,renderItem:f,marker:d,itemRenderer:h,showDividers:m=!0,showReorderButtons:g=!0,title:v,truncateText:p=!1}){const[C,b]=l.useState(""),[y,w]=l.useState(null),F=l.useRef(null),M=l.useId(),j=l.useRef(!1),D=l.useRef(r),N=t||`dynamic-list-${M}`,E=`${N}-title`,{items:A,visualItems:z,addItem:$,deleteItem:I,moveItemUp:T,moveItemDown:V,draggedItem:P,draggedOverIndex:Y,handleDragStart:R,handleDragOver:G,handleDragEnd:X,handleDrop:te}=Yr(r),q=h||f;l.useEffect(()=>{if(!j.current){j.current=!0;return}D.current!==A&&(D.current=A,x==null||x(A))},[A,x]);const S=W=>document.querySelector(`#${N} #${CSS.escape(W)}`),B=()=>{var W;C.trim()&&($(C.trim()),b(""),(W=F.current)==null||W.focus())},K=(W,Q)=>{var le;if(!i)return;W.preventDefault();const O=Q<A.length-1?Q+1:Q-1,oe=A[O];I(A[Q].id),O>=0&&oe?setTimeout(()=>{const ee=S(oe.id);ee==null||ee.focus()},0):((le=F.current)==null||le.focus(),w(null))},H=W=>{W.key==="Enter"&&B()},_=(W,Q)=>{switch(W.key){case"ArrowUp":if(!u)return;W.preventDefault(),T(Q),Q>0&&w(Q-1);break;case"ArrowDown":if(!u)return;W.preventDefault(),V(Q),Q<A.length-1&&w(Q+1);break;case"Backspace":case"Delete":K(W,Q);break}},U=()=>{if(!v)return null;const W=k.join("font-medium opacity-60",Ur[a]);if(typeof v=="string")return e.jsx("h4",{id:E,className:W,children:v});const Q=v.props;return l.cloneElement(v,{id:E,className:k.join(W,Q.className)})},Z=W=>{if(!d)return null;if(l.isValidElement(d))return d;switch(d){case"disc":return e.jsx(Fe,{className:"text-muted-foreground"});case"dash":return e.jsx(Jr,{className:"text-muted-foreground"});case"decimal":return e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex-shrink-0 min-w-4 text-right",children:[W+1,"."]});default:return e.jsx(Fe,{className:"text-muted-foreground"})}},ne=Qr[a],ae=Xr[a];return e.jsxs("div",{ref:s,id:N,className:o,"data-size":a,"data-allow-add":n,"data-allow-delete":i,"data-allow-reorder":u,"data-marker":typeof d=="string"?d:"custom",children:[U(),e.jsxs("ul",{className:ne,role:"list","aria-labelledby":v?E:void 0,children:[z.map((W,Q)=>{const O=A.findIndex(ee=>ee.id===W.id),oe=(P==null?void 0:P.id)===W.id,le=y===O;return e.jsxs("div",{children:[e.jsxs("li",{id:W.id,title:p?W.content:void 0,className:k.join("flex items-center group relative transition-all",oe&&"opacity-30",P&&Y===Q&&!oe?"border-t-2 border-primary":""),draggable:u,onDragStart:ee=>{ee.dataTransfer.effectAllowed="move",R(W,O)},onDragOver:ee=>G(ee,Q),onDragEnd:X,onDrop:te,onMouseEnter:()=>w(O),onMouseLeave:()=>w(null),onFocus:ee=>{ee.currentTarget===ee.target&&w(O)},tabIndex:0,role:"listitem","aria-label":`List item ${O+1}: ${W.content}`,onKeyDown:ee=>_(ee,O),"aria-description":`${u?"Use up/down arrow keys to reorder. ":""}${i?"Press Backspace/Delete to remove this item.":""}`,children:[u&&e.jsx("div",{className:k.join("absolute -translate-x-full flex-shrink-0 pl-2 pr-1 py-2 cursor-move transition-opacity opacity-0",(oe||le&&!P)&&"opacity-100"),children:e.jsx(L.GripVertical,{size:ae+2})}),d&&e.jsx("div",{className:k.join("flex-shrink-0 flex items-center justify-center py-2 pr-2"),children:Z(O)}),e.jsxs("div",{className:k.join("flex-1 flex min-w-0"),children:[e.jsx("div",{className:k.join("flex-1 min-w-0 py-2 pr-2"),children:q?q(W,O):e.jsx("span",{className:k.join("block",p&&"truncate"),children:W.content})}),!P&&e.jsxs("div",{className:k.join("flex-shrink-0 flex items-center gap-1 pr-2 opacity-0 transition-opacity",le&&"opacity-100"),children:[u&&g&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>T(O),disabled:O===0,className:"p-0.5 opacity-50 leading-0 hover:opacity-80 disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors","aria-hidden":!0,tabIndex:-1,children:e.jsx(L.ChevronUp,{size:ae})}),e.jsx("button",{type:"button",onClick:()=>V(O),disabled:O===A.length-1,className:"p-0.5 opacity-50 leading-0 hover:opacity-80 disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors","aria-hidden":!0,tabIndex:-1,children:e.jsx(L.ChevronDown,{size:ae})})]}),i&&e.jsx("button",{tabIndex:le?0:-1,type:"button",onClick:ee=>K(ee,O),className:"p-0.5 text-destructive opacity-70 h-fit hover:opacity-90 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-destructive","aria-label":"Delete item",children:e.jsx(L.Trash,{size:ae})})]})]})]}),m&&Q<A.length-1&&e.jsx("hr",{className:"border-border/50"})]},W.id)}),A.length===0&&e.jsxs("li",{className:k.join("text-center text-muted-foreground py-8",ne),children:["No items yet. ",n&&"Add an item below to get started."]})]}),n&&e.jsxs("div",{className:k.join("border-t border-border/50 flex items-center gap-2",ne),children:[e.jsx("input",{id:`${N}-new-item-input`,ref:F,type:"text",value:C,onChange:W=>b(W.target.value),onKeyDown:H,placeholder:c,className:"flex-1 bg-transparent border-none outline-none placeholder-muted-foreground pt-1","aria-label":"Add new list item"}),e.jsx("button",{type:"button",onClick:B,disabled:!C.trim(),className:"flex-shrink-0 p-1.5 text-muted-foreground opacity-70 enabled:hover:opacity-100 disabled:opacity-30 disabled:cursor-not-allowed rounded transition-opacity","aria-label":"Add item",children:e.jsx(L.Plus,{size:16})})]})]})}const es={danger:{container:"border-destructive bg-destructive/10",icon:"text-destructive",title:"text-destructive",description:"text-destructive/80",button:"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus:ring-destructive",details:"bg-destructive/5 border-destructive/20 text-destructive"},warning:{container:"border-yellow-600 bg-yellow-600/10",icon:"text-yellow-600",title:"text-yellow-600",description:"text-yellow-600/80",button:"bg-yellow-600 text-white hover:bg-yellow-600/90 focus:ring-yellow-600",details:"bg-yellow-600/5 border-yellow-600/20 text-yellow-600"},info:{container:"border-blue-600 bg-blue-600/10",icon:"text-blue-600",title:"text-blue-600",description:"text-blue-600/80",button:"bg-blue-600 text-white hover:bg-blue-600/90 focus:ring-blue-600",details:"bg-blue-600/5 border-blue-600/20 text-blue-600"}},ts={danger:e.jsx(re.ExclamationTriangle,{size:24}),warning:e.jsx(re.ExclamationTriangle,{size:24}),info:e.jsx(re.InfoCircled,{size:24})};function rs({id:r,variant:a="danger",showRetry:t=!0,fallbackMessage:o,fallback:s,onRetry:n,onError:i,className:u,children:c,inDevEnv:x=!1}){return e.jsx(ss,{id:r,variant:a,showRetry:t,fallbackMessage:o,fallback:s,onRetry:n,onError:i,className:u,inDevEnv:x,children:c})}class ss extends l.Component{constructor(t){super(t);je(this,"handleRetry",()=>{var t,o;this.setState({hasError:!1,error:void 0,errorInfo:void 0}),(o=(t=this.props).onRetry)==null||o.call(t)});this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,o){var s,n;this.setState({error:t,errorInfo:o}),(n=(s=this.props).onError)==null||n.call(s,t,o),this.props.inDevEnv&&(console.error("ErrorBoundary caught an error:",t),console.error("Error info:",o))}render(){var x;const{id:t,variant:o="danger",showRetry:s=!0,fallbackMessage:n="Something went wrong",fallback:i,className:u,inDevEnv:c}=this.props;if(this.state.hasError){if(i)return i;const f=es[o],d=ts[o];return e.jsxs("div",{id:t,"data-variant":o,"data-has-error":this.state.hasError,className:k.join("rounded-lg border p-6 text-center",f.container,u),role:"alert","aria-live":"assertive",children:[e.jsx("div",{className:k.join("mb-4 flex justify-center",f.icon),children:d}),e.jsx("h3",{className:k.join("text-lg font-semibold mb-2",f.title),children:"Oops! Something went wrong"}),e.jsx("p",{className:k.join("text-sm mb-4",f.description),children:n}),c&&this.state.error&&e.jsxs("details",{className:"mt-4 text-left",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium mb-2",children:"Error Details (Development Only)"}),e.jsxs("div",{className:k.join("rounded border p-3 text-xs font-mono whitespace-pre-wrap overflow-auto max-h-40",f.details),children:[e.jsx("div",{className:"font-bold mb-1",children:"Error:"}),e.jsx("div",{className:"mb-2",children:this.state.error.toString()}),((x=this.state.errorInfo)==null?void 0:x.componentStack)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-bold mb-1",children:"Component Stack:"}),e.jsx("div",{children:this.state.errorInfo.componentStack})]})]})]}),s&&e.jsx("button",{type:"button",onClick:this.handleRetry,className:k.join("inline-flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-colors","focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-transparent",f.button),"aria-label":"Try again",children:"Try Again"})]})}return this.props.children}}const ns={link:"text-primary hover:text-primary-foreground hover:bg-primary/10 aria-current:text-primary-foreground aria-current:bg-primary",outline:"border border-primary text-primary hover:bg-primary hover:text-primary-foreground aria-current:bg-primary aria-current:text-primary-foreground aria-current:border-primary",filled:"bg-secondary text-secondary-foreground hover:bg-primary hover:text-primary-foreground aria-current:bg-primary aria-current:text-primary-foreground"},as={sm:"px-2 py-1 text-sm min-w-[32px] min-h-8",md:"px-2 py-1 text-base min-w-[40px] min-h-10"};function os({page:r,pageCount:a=5,maxVisiblePages:t=5,showFirstLast:o=!0,onPageChange:s,size:n="md",variant:i="link",className:u,ref:c,buttonsClassName:x,...f}){const d=a===1/0,m=l.useCallback(()=>{if(d)return[];const w=a,F=Math.min(t,w);if(w<=F)return Array.from({length:w},(N,E)=>E+1);const M=Math.floor(F/2);let j=Math.max(1,r-M),D=Math.min(w,j+F-1);return D-j+1<F&&(j=Math.max(1,D-F+1),D=Math.min(w,j+F-1)),Array.from({length:D-j+1},(N,E)=>j+E)},[d,t,r,a])(),g=r>1,v=d||r<a,p=o&&!d,C=o&&!d,b=w=>{w>=1&&(d||w<=a)&&s(w)},y=l.useCallback(()=>{const w=k.join("flex items-center justify-center min-w-fit","disabled:opacity-50 disabled:cursor-not-allowed",as[n],"rounded-md");return k.join(w,ns[i],x)},[i,n,x]);return e.jsxs("nav",{ref:c,className:k.join("flex items-center justify-center gap-1",u),role:"navigation","aria-label":"Pagination","data-page":r,"data-page-count":d?"infinite":a,...f,children:[p&&e.jsxs("button",{onClick:()=>b(1),className:y(),disabled:r===1,"aria-label":"Go to first page",children:[e.jsx(L.ChevronDoubleLeft,{size:n==="sm"?12:15}),e.jsx("span",{className:"ml-1",children:"First"})]}),e.jsxs("button",{onClick:()=>b(r-1),className:y(),disabled:!g,"aria-label":"Go to previous page",children:[e.jsx(L.ChevronLeft,{size:n==="sm"?12:15}),e.jsx("span",{className:"ml-1",children:"Previous"})]}),!d&&m.map(w=>e.jsx("button",{onClick:()=>b(w),className:k.join(y(),"aspect-square"),"aria-label":`Go to page ${w}`,"aria-current":w===r?!0:void 0,children:w},w)),e.jsxs("button",{onClick:()=>b(r+1),className:y(),disabled:!v,"aria-label":"Go to next page",children:[e.jsx("span",{className:"mr-1",children:"Next"}),e.jsx(L.ChevronRight,{size:n==="sm"?12:15})]}),C&&e.jsxs("button",{onClick:()=>b(a),className:y(),disabled:r===a,"aria-label":"Go to last page",children:[e.jsx("span",{className:"mr-1",children:"Last"}),e.jsx(L.ChevronDoubleRight,{size:n==="sm"?12:15})]})]})}function ls(r){const[a,t]=l.useState(!1),[o,s]=l.useState(!1);return l.useEffect(()=>{r?(s(!0),setTimeout(()=>t(!0),10)):(t(!1),setTimeout(()=>s(!1),300))},[r]),{show:a,shouldRender:o}}function is(r,a){l.useEffect(()=>{const t=o=>{o.key==="Escape"&&r&&a()};return document.addEventListener("keydown",t),r&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",t),document.body.style.overflow="auto"}},[r,a])}function cs(r,a){const t=l.useRef(null),o=l.useCallback(()=>{const s=document.getElementById(r);if(!s)return;const n=s.querySelectorAll('[data-panel-action="true"]');if(n.length>0){n[0].focus();return}const i=s.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(i.length>0){const u=Array.from(i).filter(c=>!(c instanceof HTMLButtonElement&&c.getAttribute("data-panel-close-button")==="true"));if(u.length>0){u[0].focus();return}i[0].focus();return}s.focus()},[r]);l.useEffect(()=>(a&&(t.current=document.activeElement,o()),()=>{document.body.style.overflow="auto",t.current instanceof HTMLElement&&t.current.focus()}),[a,o])}function ds({ref:r,id:a,isOpen:t,onClose:o,title:s,children:n,footer:i,className:u,overlayClassName:c,hideCloseButton:x=!1,disableCloseOnOverlayClick:f=!1,ariaLabelledBy:d,ariaDescribedBy:h}){const m=l.useId(),g=a||`panel-${m}`,v=a?`${a}-title`:`panel-title-${m}`,{show:p,shouldRender:C}=ls(t);if(cs(g,C),is(C,o),!C)return null;const b=()=>s?l.isValidElement(s)?e.jsx("div",{children:s}):e.jsx("h2",{className:"text-2xl font-semibold",id:v,children:s}):null,y=()=>{if(!i)return null;if(l.isValidElement(i)){const w=i,F=w.props.className||"";return l.cloneElement(w,{className:k.join("px-6 py-4",F)})}return e.jsx("div",{className:"px-6 py-4",children:i})};return e.jsx(e.Fragment,{children:ye.createPortal(e.jsxs("div",{"aria-labelledby":d??s?v:void 0,"aria-describedby":h,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[100] overflow-hidden","data-panel-open":t,children:[e.jsx("div",{className:k.join("fixed inset-0 bg-black/40 transition-opacity",p?"opacity-100":"opacity-0",c),onClick:()=>{f||o()}}),e.jsx("div",{className:"fixed inset-y-0 right-0 flex max-w-full",children:e.jsx("div",{id:g,ref:r,tabIndex:-1,className:k.join("relative h-full max-w-md transform shadow-xl bg-popover text-popover-foreground transition-transform ease-in-out border-l border-border",p?"translate-x-0":"translate-x-full",u),children:e.jsxs("div",{className:"flex h-full flex-col",children:[s&&e.jsx("div",{className:"px-6 pt-6",children:b()}),!x&&e.jsx("button",{type:"button",onClick:o,"data-panel-close-button":"true","aria-label":"Close panel",className:"rounded-md p-0.5 top-3 right-3 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0",children:e.jsx(re.X,{size:18})}),e.jsx("div",{className:k.join("flex-1 overflow-y-auto px-6 pb-6",s?"pt-6":"pt-10"),children:n}),y()]})})})]}),document.body)})}const us={thin:{horizontal:"h-px",vertical:"w-px"},medium:{horizontal:"h-0.5",vertical:"w-0.5"},thick:{horizontal:"h-1",vertical:"w-1"},"extra-thick":{horizontal:"h-2",vertical:"w-2"}},fs={horizontal:"w-full",vertical:"min-h-4 h-full"};function xs({orientation:r="horizontal",decorative:a=!1,thickness:t="thin",className:o,...s}){const n=k.join("shrink-0 bg-border",fs[r],us[t][r],o);return e.jsx("div",{...s,className:n,role:a?"presentation":"separator","aria-orientation":a?void 0:r,"aria-hidden":a,"data-orientation":r,"data-thickness":t})}const Ie={shape:{rectangle:"rounded-md min-h-1",circle:"rounded-full aspect-square min-h-1",text:"rounded-sm min-h-1 h-4"},lineSpacing:{xs:"space-y-1",sm:"space-y-2",md:"space-y-3",lg:"space-y-4",xl:"space-y-6"}};function ms({shape:r="rectangle",lineSpacing:a="sm",className:t,lines:o=1,animate:s=!0,ref:n,...i}){const u=k.join("bg-muted/70",s&&"animate-pulse",Ie.shape[r],t);return o>1?e.jsx("div",{ref:n,className:Ie.lineSpacing[a],role:"presentation","aria-hidden":"true","data-testid":"skeleton-container","data-lines":o,"data-shape":r,"data-animate":s,...i,children:Array.from({length:o},(c,x)=>e.jsx("div",{className:k.join(u,x===o-1&&"w-3/4"),role:"presentation","aria-hidden":"true","data-testid":"skeleton-line","data-line-index":x},x))}):e.jsx("div",{ref:n,className:u,role:"presentation","aria-hidden":"true","data-testid":"skeleton","data-shape":r,"data-animate":s,...i})}function hs({id:r,value:a,defaultValue:t=0,onValueChange:o,min:s=0,max:n=100,step:i=1,disabled:u=!1,trackClassName:c,rangeClassName:x,thumbClassName:f,className:d,ref:h,ariaLabel:m,ariaLabelledBy:g,...v}){const[p,C]=l.useState(t),b=a!==void 0,y=b?a:p,w=l.useRef(null),F=l.useRef(!1),M=l.useRef(0),j=l.useCallback($=>{const I=Math.max(s,Math.min(n,$)),T=Math.round(I/i)*i;b||C(T),o==null||o(T)},[s,n,i,b,o]),D=l.useCallback(($,I=!1)=>{var Y;const T=(Y=w.current)==null?void 0:Y.getBoundingClientRect();if(!T)return y;let V=$.clientX;I&&(V=V-M.current);const P=Math.max(0,Math.min(1,(V-T.left)/T.width));return s+(n-s)*P},[s,n,y]),N=l.useCallback($=>{if(u||$.target!==$.currentTarget)return;const I=D($);j(I)},[u,D,j]),E=l.useCallback($=>{var Y;if(u)return;$.stopPropagation(),F.current=!0;const I=(Y=w.current)==null?void 0:Y.getBoundingClientRect(),T=$.currentTarget.getBoundingClientRect();if(I&&T){const R=T.left+T.width/2;M.current=$.clientX-R}$.currentTarget.setPointerCapture($.pointerId);const V=R=>{if(!F.current)return;const G=D(R,!0);j(G)},P=R=>{if(R.pointerId===$.pointerId){F.current=!1,M.current=0;try{$.currentTarget.releasePointerCapture(R.pointerId)}catch{}document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",P)}};document.addEventListener("pointermove",V),document.addEventListener("pointerup",P)},[u,D,j]),A=l.useCallback($=>{if(u)return;let I=y;switch($.key){case"ArrowRight":case"ArrowUp":I=y+i;break;case"ArrowLeft":case"ArrowDown":I=y-i;break;case"Home":I=s;break;case"End":I=n;break;case"PageUp":I=y+i*10;break;case"PageDown":I=y-i*10;break;default:return}$.preventDefault(),j(I)},[u,y,i,s,n,j]),z=n===s?0:(y-s)/(n-s)*100;return e.jsx("div",{id:r,ref:h,className:k.join("relative flex items-center w-full touch-none select-none",u&&"opacity-50 cursor-not-allowed",d),"data-disabled":u,"data-value":y,"data-min":s,"data-max":n,"data-step":i,...v,children:e.jsxs("div",{ref:w,className:k.join("relative h-1.5 w-full rounded-full bg-muted-foreground cursor-pointer",u&&"cursor-not-allowed",c),onPointerDown:N,children:[e.jsx("div",{className:k.join("absolute h-full rounded-full pointer-events-none",!F.current&&"transition-all",x),style:{width:`${z}%`}}),e.jsx("div",{className:k.join("absolute size-5 -top-2 rounded-full shadow-md cursor-grab",u&&"cursor-not-allowed",!u&&"cursor-grab focus:outline-none focus:ring-2",F.current?"cursor-grabbing scale-110":"transition-all",f),style:{left:`calc(${z}% - 10px)`},tabIndex:u?-1:0,role:"slider","aria-valuemin":s,"aria-valuemax":n,"aria-valuenow":y,"aria-label":m,"aria-labelledby":g,"aria-disabled":u,onKeyDown:A,onPointerDown:E})]})})}function ps({data:r,initialSort:a={key:null,direction:null}}){const[t,o]=l.useState(a),[s,n]=l.useState();return{sortedData:l.useMemo(()=>!t.key||!t.direction?r:[...r].sort((c,x)=>{if(s){const m=s(c,x);return t.direction==="desc"?-m:m}const f=c[t.key],d=x[t.key];if(f===d)return 0;let h=0;return typeof f=="string"&&typeof d=="string"?h=f.localeCompare(d):typeof f=="number"&&typeof d=="number"?h=f-d:f instanceof Date&&d instanceof Date?h=f.getTime()-d.getTime():h=String(f).localeCompare(String(d)),t.direction==="desc"?-h:h}),[r,t,s]),sortConfig:t,handleSort:(c,x)=>{n(()=>x),o(f=>{if(f.key===c){const d=f.direction==="asc"?"desc":f.direction==="desc"?null:"asc";return{key:d?c:null,direction:d}}else return{key:c,direction:"asc"}})}}}function bs({initialSelected:r=[]}={}){const[a,t]=l.useState(new Set(r));return{selectedRows:a,isRowSelected:f=>a.has(f),selectRow:f=>{t(d=>new Set([...d,f]))},deselectRow:f=>{t(d=>{const h=new Set(d);return h.delete(f),h})},selectAll:f=>{t(new Set(f))},deselectAll:()=>{t(new Set)},isAllSelected:f=>f.length>0&&f.every(d=>a.has(d)),isPartiallySelected:f=>{const d=f.filter(h=>a.has(h)).length;return d>0&&d<f.length}}}const gs={sm:{container:"text-sm",table:"w-full border-collapse",header:"border-b border-border",headerCell:"px-3 py-2.5 font-medium",sortButton:"inline-flex items-center gap-1 hover:text-accent transition-colors",cell:"px-3 py-2 text-sm",selectedRow:"bg-accent/10 hover:bg-accent/20",checkbox:"pl-5 pr-2 text-left w-3",checkboxSize:12},md:{container:"text-base",table:"w-full border-collapse",header:"border-b-2 border-border",headerCell:"px-4 py-3 font-semibold",sortButton:"inline-flex items-center gap-2 hover:text-accent transition-colors",cell:"px-4 py-3",selectedRow:"bg-accent/10 hover:bg-accent/20",checkbox:"pl-6 pr-3 py-3 text-left w-6",checkboxSize:16},lg:{container:"text-lg",table:"w-full border-collapse",header:"border-b-2 border-border",headerCell:"px-6 py-4 font-bold",sortButton:"inline-flex items-center gap-2 hover:text-accent transition-colors",cell:"px-6 py-4",selectedRow:"bg-accent/10 hover:bg-accent/20",checkbox:"pl-6 pr-3 py-4 text-left w-8",checkboxSize:18}};function ys({id:r,className:a,ref:t,size:o="md",data:s,columns:n,selectable:i=!1,getRowId:u=(b,y)=>y,initialSelected:c=[],onSelectionChange:x,showHeader:f=!0,striped:d=!1,hoverable:h=!0,emptyState:m,loading:g=!1,loadingContent:v,caption:p,...C}){const b=gs[o],{sortedData:y,sortConfig:w,handleSort:F}=ps({data:s,initialSort:{key:null,direction:null}}),{selectedRows:M,isRowSelected:j,selectRow:D,deselectRow:N,selectAll:E,deselectAll:A,isAllSelected:z,isPartiallySelected:$}=bs({initialSelected:c}),I=s.map((R,G)=>u(R,G));l.useEffect(()=>{x&&x(Array.from(M))},[M,x]);const T=()=>{z(I)?A():E(I)},V=(R,G)=>G.accessor?typeof G.accessor=="function"?G.accessor(R):R[G.accessor]:R[G.key],P=(R,G)=>{const X=V(R,G);return G.cell?G.cell(R,X):e.jsx(e.Fragment,{children:X})},Y=R=>{switch(R){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}};return g?e.jsx("div",{id:r,ref:t,className:k.join("flex items-center justify-center p-8",b.container,a),...C,children:v||e.jsx("div",{children:"Loading..."})}):s.length===0?e.jsx("div",{id:r,ref:t,className:k.join("flex items-center justify-center p-8",b.container,a),...C,children:m||e.jsx("div",{className:"text-muted-foreground",children:"No data available"})}):e.jsx("div",{id:r,ref:t,className:k.join("overflow-x-auto border border-border rounded-lg",b.container,a),"data-testid":"table-container","data-size":o,"data-selectable":i,...C,children:e.jsxs("table",{className:b.table,role:"table",children:[p&&e.jsx("caption",{className:"sr-only",children:p}),e.jsxs("colgroup",{children:[i&&e.jsx("col",{style:{width:"1%"}}),n.map(R=>e.jsx("col",{style:R.width?{width:R.width}:{},className:R.columnClassName},R.key))]}),f&&e.jsx("thead",{className:b.header,role:"rowgroup",children:e.jsxs("tr",{role:"row",children:[i&&e.jsx("th",{className:b.checkbox,role:"columnheader","aria-label":"Select all rows",children:e.jsx(ie,{size:b.checkboxSize,checked:z(I),indeterminate:$(I),onCheckedChange:T,"aria-label":"Select all rows",className:"align-middle"})}),n.map(R=>{const G=w.key===R.key?w.direction:null;return e.jsx("th",{className:k.join(b.headerCell,Y(R.align),R.headerClassName),role:"columnheader","aria-sort":w.key===R.key?w.direction==="asc"?"ascending":w.direction==="desc"?"descending":"none":R.sortable?"none":void 0,children:R.sortable?e.jsxs("button",{className:b.sortButton,onClick:()=>F(R.key,R.sortFunction),"aria-label":`Sort by ${R.header}`,children:[R.header,e.jsxs("div",{className:"flex flex-col items-center -space-y-1",children:[e.jsx(L.ChevronUp,{size:b.checkboxSize-4,className:G==="asc"?"text-accent":"opacity-40"}),e.jsx(L.ChevronDown,{size:b.checkboxSize-4,className:G==="desc"?"text-accent":"opacity-40"})]})]}):R.header},R.key)})]})}),e.jsx("tbody",{role:"rowgroup",children:y.map((R,G)=>{const X=u(R,G),te=j(X),q=G===y.length-1;return e.jsxs("tr",{className:k.join("transition-all",!q&&"border-b border-border",h&&"hover:bg-accent/15",d&&G%2===1&&"bg-accent/25",te&&b.selectedRow),role:"row","aria-selected":i?te:void 0,"data-testid":"table-row","data-row-id":X,"data-selected":te,children:[i&&e.jsx("td",{className:b.checkbox,role:"cell",children:e.jsx(ie,{size:b.checkboxSize,checked:te,onCheckedChange:S=>{S?D(X):N(X)},"aria-label":`Select row ${G+1}`})}),n.map(S=>e.jsx("td",{className:k.join(b.cell,Y(S.align),S.cellClassName),role:"cell",children:P(R,S)},S.key))]},X)})})]})})}const vs=({defaultValue:r,value:a,onValueChange:t}={})=>{const[o,s]=l.useState(r||""),n=a!==void 0,i=n?a:o,u=l.useCallback(c=>{n||s(c),t==null||t(c)},[n,t]);return{value:i,onValueChange:u}},Ae={width:{fit:"w-fit",full:"w-full *:flex-1"},variant:{underline:"border-b border-border",pills:"",bordered:"border border-border rounded-lg p-1"}},js={underline:"border-b-2 border-transparent data-[state=active]:border-accent data-[state=active]:text-accent hover:text-accent/80",pills:"rounded-md data-[state=active]:bg-accent data-[state=active]:text-accent-foreground hover:bg-accent/30",bordered:"rounded data-[state=active]:bg-accent data-[state=active]:text-accent-foreground hover:bg-accent/30"};function Ze({children:r,className:a,id:t,ref:o}){const{tabsWidth:s,variant:n}=J.useTabsContext();return e.jsx("div",{className:"overflow-x-auto hide-scroll-bars",children:e.jsx("div",{id:t,ref:o,role:"tablist",className:k.join("flex",Ae.width[s],Ae.variant[n],a),"data-tabs-width":s,"data-variant":n,children:r})})}function Ye({value:r,disabled:a=!1,className:t,children:o,onClick:s,id:n,ref:i}){const{selectedValue:u,onValueChange:c,variant:x,triggersClassName:f}=J.useTabsContext(),d=l.useRef(null),h=u===r,m=()=>{const p=d.current;p&&p.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},g=p=>{a||(c(r),m(),s==null||s(p))};return e.jsx("button",{id:n,ref:ve.mergeRefs(d,i),role:"tab",type:"button","aria-selected":h,"aria-controls":`tabs-content-${r}`,"data-state":h?"active":"inactive","data-value":r,disabled:a,className:k.join("inline-flex items-center justify-center whitespace-nowrap px-3 py-2 text-sm ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",h?"font-medium":"font-light",js[x],f,t),onClick:g,children:o})}function ws({defaultValue:r,value:a,onValueChange:t,tabsWidth:o="fit",variant:s="underline",className:n,tabsList:i,children:u,ref:c,id:x,triggersClassName:f,contentClassName:d}){const{value:h,onValueChange:m}=vs({defaultValue:r,value:a,onValueChange:t}),g={selectedValue:h,onValueChange:m,tabsWidth:o,variant:s,triggersClassName:f,contentClassName:d};return e.jsx(J.TabsContext.Provider,{value:g,children:e.jsxs("div",{id:x,ref:c,className:n,"data-tabs-width":o,"data-variant":s,children:[i&&e.jsx(Ze,{children:i.map(v=>e.jsx(Ye,{value:v.value,children:v.label},v.value))}),u]})})}function ks({value:r,className:a,children:t,ref:o}){const{selectedValue:s,contentClassName:n}=J.useTabsContext(),i=s===r;return i?e.jsx("div",{ref:o,role:"tabpanel",id:`tabs-content-${r}`,"aria-labelledby":`tabs-trigger-${r}`,"data-state":i?"active":"inactive","data-value":r,className:k.join("mt-4 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",n,a),tabIndex:0,children:t}):null}const Cs={sm:{container:"h-5 min-w-9 w-9",thumb:"h-4 w-4",translate:"translate-x-4"},md:{container:"h-6 min-w-11 w-11",thumb:"h-5 w-5",translate:"translate-x-5"},lg:{container:"h-7 min-w-13 w-13",thumb:"h-6 w-6",translate:"translate-x-6"}},Ns={default:{unchecked:"bg-muted-foreground",checked:"bg-primary"},success:{unchecked:"bg-muted-foreground",checked:"bg-success"},destructive:{unchecked:"bg-muted-foreground",checked:"bg-destructive"}},$e={variant:"default",size:"md"};function Ds({ref:r,id:a,size:t=$e.size,variant:o=$e.variant,checked:s,onCheckedChange:n,disabled:i=!1,className:u,thumbClassName:c,backgroundClassNames:x,...f}){const d=l.useId(),h=l.useMemo(()=>a||`toggle-${d}`,[a,d]),[m,g]=l.useState(s);l.useEffect(()=>{g(s)},[s]);const v=()=>{if(!i){const F=!m;s===void 0&&g(F),n==null||n(F)}},p=F=>{(F.key===" "||F.key==="Enter")&&(F.preventDefault(),v())},C=Cs[t],b=Ns[o],y=k.join("relative inline-flex items-center rounded-full transition-all ease-in-out","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",C.container,m?(x==null?void 0:x.checked)||b.checked:(x==null?void 0:x.unchecked)||b.unchecked,i&&"opacity-50 cursor-not-allowed",!i&&"cursor-pointer",u),w=k.join("absolute left-0.5 top-1/2 -translate-y-1/2 rounded-full bg-white shadow-sm transition-transform ease-in-out",C.thumb,m&&C.translate,c);return e.jsxs("button",{ref:r,id:h,type:"button",role:"switch",tabIndex:0,"aria-checked":m,"aria-disabled":i,disabled:i,onClick:v,onKeyDown:p,className:y,...f,children:[e.jsx("span",{className:w}),e.jsx("span",{className:"sr-only",children:m?"Enabled":"Disabled"})]})}exports.ActionModal=J.ActionModal;exports.Button=J.Button;exports.LoadingDots=J.LoadingDots;exports.Modal=J.Modal;exports.Toast=J.Toast;exports.Accordion=Je;exports.AccordionItem=fe;exports.AuthForm=vt;exports.Avatar=Rt;exports.Badge=Gt;exports.Calendar=Kt;exports.Callout=Yt;exports.Card=Qt;exports.Carousel=Jt;exports.Checkbox=ie;exports.Clickable=Ot;exports.Code=rr;exports.CodeBlock=Cr;exports.CopyButton=Nr;exports.Disclosure=Dr;exports.Drawer=Ar;exports.DropdownMenu=_r;exports.DropdownMenuFactories=Zr;exports.DynamicList=Or;exports.ErrorBoundary=rs;exports.Form=_e;exports.FormFactories=ze;exports.HelpIcon=Te;exports.Input=Re;exports.Label=se;exports.Pagination=os;exports.Panel=ds;exports.Popover=Pe;exports.RadioGroup=We;exports.RadioGroupItem=xe;exports.RadioInput=Ge;exports.ScrollArea=Le;exports.Select=Ve;exports.Separator=xs;exports.Skeleton=ms;exports.Slider=hs;exports.Table=ys;exports.Tabs=ws;exports.TabsContent=ks;exports.TabsList=Ze;exports.TabsTrigger=Ye;exports.Textarea=Be;exports.Toggle=Ds;exports.Tooltip=Me;
1
+ "use strict";var Ue=Object.defineProperty;var Qe=(r,a,t)=>a in r?Ue(r,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[a]=t;var we=(r,a,t)=>Qe(r,typeof a!="symbol"?a+"":a,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),w=require("./join-BVMUUvyP.cjs"),L=require("./Window-CjC02flR.cjs"),J=require("./Toast-CQnaydN2.cjs"),re=require("./X-CgjeP2OI.cjs");require("./useTheme-Bdg1t0Zr.cjs");const Xe=require("./useScreenSize-UGyolnfn.cjs"),ye=require("react-dom"),je=require("./utils.cjs.js");function fe({id:r,title:a,content:t,children:o,className:s="",disabled:n=!1,isOpen:i=!1,onToggle:d,triggerClassName:c="",bodyClassName:m=""}){const f=l.useId(),u=r||`accordion-item-${f}`,h=`${u}-header`,x=`${u}-panel`,b=()=>{!n&&d&&d()},y=p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),b())};return e.jsxs("div",{className:w.join("border-b border-gray-200",n&&"opacity-60 cursor-not-allowed",s),children:[e.jsxs("button",{id:h,type:"button",className:w.join("w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary",n?"cursor-not-allowed":"hover:bg-gray-50/10 cursor-pointer",c),"aria-expanded":i,"aria-controls":x,disabled:n,onClick:b,onKeyDown:y,children:[e.jsx("span",{children:a}),e.jsx("span",{className:w.join("transform transition-transform ease-linear",i?"rotate-180":"rotate-0"),"aria-hidden":"true",children:e.jsx(L.ChevronDown,{size:18})})]}),e.jsx("div",{id:x,role:"region","aria-labelledby":h,className:w.join("transition-all ease-linear px-4",i?"max-h-96 opacity-100 overflow-auto py-3":"max-h-0 opacity-0 overflow-hidden",m),children:i&&(o||t)})]})}function Je({id:r,items:a=[],children:t,className:o="",itemClassName:s="",allowMultiple:n=!1,defaultOpenItems:i=[],triggersClassName:d="",bodiesClassName:c=""}){const m=l.useId(),f=r||`accordion-group-${m}`,[u,h]=l.useState(new Set(i)),x=p=>{h(C=>{const g=new Set(C);return g.has(p)?g.delete(p):(n||g.clear(),g.add(p)),g})},b=p=>`${m}-item-${p}`,y=p=>u.has(p);return e.jsxs("div",{id:f,className:o,children:[a.length>0&&a.map((p,C)=>{const g=p.id||b(C);return e.jsx(fe,{id:g,title:p.title,content:p.content,disabled:p.disabled,isOpen:y(g),onToggle:()=>x(g),className:s,triggerClassName:d,bodyClassName:c},g)}),a.length===0&&t&&l.Children.map(t,(p,C)=>{if(l.isValidElement(p)&&p.type===fe){const g=p.props.id||b(C);return l.createElement(fe,{...p.props,key:g,id:g,className:w.join(s,p.props.className),isOpen:y(g),onToggle:()=>x(g),triggerClassName:w.join(d,p.props.triggerClassName),bodyClassName:w.join(c,p.props.bodyClassName)})}return null})]})}const Oe=r=>({__type:"input",...r}),et=r=>({__type:"textarea",...r}),tt=r=>({__type:"select",...r}),rt=r=>({__type:"checkbox",...r}),st=r=>({__type:"radio",...r}),nt=r=>({__type:"checkboxGroup",...r}),at=r=>({__type:"custom",...r}),Me={input:Oe,textarea:et,select:tt,checkbox:rt,radio:st,checkboxGroup:nt,custom:at};function ot(r,a){const[t,o]=l.useState({}),s=l.useCallback((f,u)=>{if(f.required){if(f.__type==="checkboxGroup"){if(!u||!Array.isArray(u)||u.length===0)return`${f.label} is required`}else if(!u||typeof u=="string"&&u.trim()==="")return`${f.label} is required`}if(f.isValid&&u){const h=f.isValid,x=h(u);if(!x.valid)return x.message||`${f.label} is invalid`}return null},[]),n=l.useCallback((f=a)=>{const u={};return r.forEach(h=>{const x=s(h,f[h.name]);x&&(u[h.name]=x)}),o(u),Object.keys(u).length===0},[r,a,s]),i=l.useCallback((f,u)=>{const h=r.find(b=>b.name===f);if(!h)return;const x=s(h,u);return o(b=>{const y={...b};return x?y[f]=x:delete y[f],y}),!x},[r,s]),d=l.useCallback(()=>{o({})},[]),c=l.useMemo(()=>Object.values(t).some(f=>f),[t]),m=l.useMemo(()=>r.every(f=>{const u=a[f.name];if(f.required){if(f.__type==="checkboxGroup"){if(!u||!Array.isArray(u)||u.length===0)return!1}else if(!u||typeof u=="string"&&u.trim()==="")return!1}if(f.isValid&&u){const h=f.isValid;return h(u).valid}return!0})&&!c,[r,a,c]);return{errors:t,hasErrors:c,isFormValid:m,validateForm:n,validateSingleField:i,clearErrors:d}}const pe={spacing:{tight:"gap-3",normal:"gap-4",loose:"gap-6"},columns:{1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"},colSpan:{1:"col-span-1",2:"col-span-1 md:col-span-2",3:"col-span-1 md:col-span-2 lg:col-span-3",4:"col-span-1 md:col-span-2 lg:col-span-4",full:"col-span-full"}},be={spacing:"normal",columns:1,responsive:!0};function ze({id:r,children:a,message:t,placement:o="top",disabled:s=!1,delay:n=100,showArrow:i=!0,className:d}){const[c,m]=l.useState(!1),[f,u]=l.useState(!1),[h,x]=l.useState(!1),[b,y]=l.useState(!1),p=l.useRef(null),C=l.useId(),g=r??C,j=l.useCallback(()=>{s||(p.current&&clearTimeout(p.current),p.current=window.setTimeout(()=>{m(!0)},n))},[s,n]),k=l.useCallback((D=!1)=>{if(p.current&&clearTimeout(p.current),D){m(!1);return}p.current=window.setTimeout(()=>{m(!1)},100)},[]);l.useEffect(()=>{!f&&!h&&!b&&c&&k()},[f,h,b,c,k]),l.useEffect(()=>{if(!c)return;const D=()=>{k(!0)};return window.addEventListener("scroll",D,!0),()=>{window.removeEventListener("scroll",D,!0)}},[c,k]),l.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const S=()=>{const D="absolute z-50 px-2 py-1 text-sm rounded shadow-lg bg-tooltip text-tooltip-foreground pointer-events-auto transition-all ease-out w-max max-w-xs",N=c?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none",E={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},I={top:"origin-bottom",bottom:"origin-top",left:"origin-right",right:"origin-left"};return w.join(D,E[o],I[o],N,d)},M=()=>{if(!i)return"";const D="absolute w-0 h-0 pointer-events-none",N={top:"top-full left-1/2 -translate-x-1/2 border-l-[6px] border-r-[6px] border-t-[6px] border-l-transparent border-r-transparent border-t-tooltip",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-[6px] border-r-[6px] border-b-[6px] border-l-transparent border-r-transparent border-b-tooltip",left:"left-full top-1/2 -translate-y-1/2 border-t-[6px] border-b-[6px] border-l-[6px] border-t-transparent border-b-transparent border-l-tooltip",right:"right-full top-1/2 -translate-y-1/2 border-t-[6px] border-b-[6px] border-r-[6px] border-t-transparent border-b-transparent border-r-tooltip"};return w.join(D,N[o])},v=a.props;return e.jsx(e.Fragment,{children:l.cloneElement(a,{style:{...v.style,position:"relative"},onMouseEnter:()=>{u(!0),j()},onMouseLeave:()=>{u(!1)},onFocus:()=>{y(!0),j()},onBlur:()=>{y(!1),k(!0)},onKeyDown:D=>{D.key==="Escape"&&k(!0)},"aria-describedby":s?void 0:g,children:e.jsxs(e.Fragment,{children:[v.children,!s&&e.jsxs("div",{id:g,role:"tooltip",className:S(),"aria-hidden":!c,"aria-live":c?"polite":void 0,onMouseEnter:()=>{x(!0),p.current&&clearTimeout(p.current)},onMouseLeave:()=>{x(!1)},children:[t,i&&e.jsx("div",{className:M(),"aria-hidden":!0})]})]})})})}function Te({id:r,ref:a,design:t="filled",iconSize:o=14,className:s,...n}){const i=t==="filled"?L.InfoCircledFilled:re.InfoCircled;return e.jsx(ze,{...n,children:e.jsx("div",{id:r,ref:a,className:w.join("inline-block cursor-help text-muted-foreground transition-colors align-top",s),"data-help-icon":"true","data-design":t,"data-size":o,children:e.jsx(i,{size:o,className:"fill-current"})})})}function se({display:r="inline",width:a="fit-content",className:t="",required:o,helpMessage:s,suffix:n,htmlFor:i,children:d,description:c,...m}){var b,y;const f=l.useId(),u=(((b=s==null?void 0:s.trim())==null?void 0:b.length)||0)>0,h=(((y=c==null?void 0:c.trim())==null?void 0:y.length)||0)>0,x=h?`${i??f}-description`:void 0;return e.jsxs("div",{style:{display:r==="inline"?"inline-block":"block",width:a},className:w.join("mb-0.5",t),children:[e.jsxs("div",{className:"relative flex",children:[e.jsxs("label",{className:"font-medium",htmlFor:i,...m,children:[d,o&&e.jsx("span",{className:"text-red-500 font-medium ml-1","aria-label":"required",children:"*"})]}),u&&e.jsx(Te,{message:s,className:"ml-1",design:"outlined",iconSize:14}),n&&e.jsx("span",{className:"ml-1",children:n})]}),h&&e.jsx("small",{id:x,className:"block opacity-80 mt-0.5",role:"note",children:c})]})}function me({elementId:r,type:a,message:t}){return l.useEffect(()=>{const o=document.getElementById(r);if(o){if(!t&&a==="error"){o.removeAttribute("data-error");return}if(!t&&a==="success"){o.removeAttribute("data-success");return}return o.setAttribute("aria-describedby",`${r}-${a}-message`),o.setAttribute("aria-invalid",a==="error"?"true":"false"),a==="error"&&o.setAttribute("data-error","true"),a==="success"&&o.setAttribute("data-success","true"),()=>{o.removeAttribute("aria-describedby"),o.removeAttribute("aria-invalid"),o.removeAttribute("data-error"),o.removeAttribute("data-success")}}},[r,a,t]),t?e.jsxs("small",{className:w.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start",a==="error"&&"text-destructive",a==="success"&&"text-success"),role:"status",children:[a==="error"?e.jsx(re.ExclamationTriangle,{}):e.jsx(L.CheckCircled,{}),e.jsx("span",{id:`${r}-${a}-message`,children:t})]}):null}const lt={base:"",transparent:"border border-transparent focus:border-current/60 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",underline:"border-b border-border focus:border-current/60 disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",outline:"border border-border focus:border-current/60 disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",solid:"bg-muted/50 focus:bg-muted/70 not-disabled:data-error:border-destructive/70 not-disabled:data-success:border-success/70"},it={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},ke={variant:"outline",rounded:"none"};function Re({variant:r=ke.variant,rounded:a,displayOnlyMode:t=!1,errorMessage:o,successMessage:s,type:n="text",className:i,...d}){const c=l.useId(),[m,f]=l.useState(!1);let u=a;r==="outline"&&!a&&(u="md"),u=u||ke.rounded;const b=w.join("appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted-foreground/70 hide-number-input-arrows transition-all","file:mr-2 file:border-0 file:rounded-md file:px-1.5 file:py-1 file:bg-primary hover:file:bg-primary/85 file:text-sm file:font-medium file:text-foreground file:transition-colors",!t&&lt[r],!t&&it[u],n==="password"&&"pr-10",!t&&"px-2 py-1",t&&"pointer-events-none cursor-text",i),y=!t&&(o||s),p=n==="password",C=y;return!C&&!p?e.jsx("input",{...d,id:c,name:d.name||c,type:n,"aria-disabled":d.disabled,readOnly:t,"aria-readonly":t||d["aria-readonly"],"data-error":o?!0:void 0,"data-success":s?!0:void 0,className:b}):!C&&p?e.jsxs("div",{className:"relative",children:[e.jsx("input",{...d,id:c,name:d.name||c,type:n==="password"&&m?"text":n,"aria-disabled":d.disabled,readOnly:t,"aria-readonly":t||d["aria-readonly"],"data-error":o?!0:void 0,"data-success":s?!0:void 0,className:b}),e.jsx("button",{onClick:()=>f(!m),className:"absolute inset-y-0 right-0 px-2 hover:cursor-pointer","aria-label":"Toggle password visibility","data-state":m?"visible":"hidden",children:m?e.jsx(L.EyeOpened,{size:20}):e.jsx(L.EyeClosed,{size:20})})]}):e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:w.join(n==="password"&&"relative"),children:[e.jsx("input",{...d,id:c,name:d.name||c,type:n==="password"&&m?"text":n,"aria-disabled":d.disabled,readOnly:t,"aria-readonly":t||d["aria-readonly"],"data-error":o?!0:void 0,"data-success":s?!0:void 0,className:b}),n==="password"&&e.jsx("button",{onClick:()=>f(!m),className:"absolute inset-y-0 right-0 px-2 hover:cursor-pointer","aria-label":"Toggle password visibility","data-state":m?"visible":"hidden",children:m?e.jsx(L.EyeOpened,{size:20}):e.jsx(L.EyeClosed,{size:20})})]}),e.jsx(me,{elementId:c,type:"error",message:o}),e.jsx(me,{elementId:c,type:"success",message:s})]})}function ct({elementId:r,maxLength:a}){const[t,o]=l.useState(0);return l.useEffect(()=>{const s=document.getElementById(r);if(!s)return;const n=()=>{const i=s.value.length;o(i);const d=i>=a;s.setAttribute("aria-describedby",`${r}-character-count`),s.setAttribute("aria-invalid",d?"true":"false"),d?s.setAttribute("data-error","true"):s.removeAttribute("data-error")};return n(),s.addEventListener("input",n),s.setAttribute("maxlength",String(a)),()=>{s.removeEventListener("input",n),s.removeAttribute("maxlength"),s.removeAttribute("aria-describedby"),s.removeAttribute("aria-invalid"),s.removeAttribute("data-error")}},[r,a]),e.jsx("small",{className:w.join("mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end",t>=a&&"text-destructive",t<a&&"text-current"),role:"status",children:e.jsxs("span",{id:`${r}-character-count`,children:[t," / ",a," characters"]})})}function dt(r,a){l.useEffect(()=>{const t=document.getElementById(r);if(!t)return;if(!a){t.style.height="auto";return}const o=()=>{t.style.height="auto",t.style.height=`${t.scrollHeight}px`};return o(),t.addEventListener("input",o),t.addEventListener("resize",o),window.addEventListener("resize",o),()=>{t.removeEventListener("input",o),t.removeEventListener("resize",o),window.removeEventListener("resize",o)}},[r,a])}const ut={base:"","left-line":"border-l border-border focus:border-current/60 disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",outline:"border border-border focus:border-current/60 disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",solid:"bg-muted/50 focus:bg-muted/70 not-disabled:data-error:border-destructive/70 not-disabled:data-success:border-success/70"},ft={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"px-3 rounded-full"},Ce={variant:"outline",rounded:"none"};function Be({variant:r=Ce.variant,rounded:a,displayOnlyMode:t=!1,errorMessage:o,successMessage:s,showResizeHandle:n=!1,autoExpand:i=!1,characterLimit:d=0,className:c,...m}){const f=l.useId();dt(f,i||t);let u=a;r==="outline"&&!a&&(u="md"),u=u||Ce.rounded;const x=w.join("appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted-foreground/70 hide-number-input-arrows transition-all",!t&&ut[r],!t&&ft[u],!t&&"px-2 py-1",t&&"pointer-events-none cursor-text",!n&&"no-resize-handle",c);return d>0||!t&&(o||s)?e.jsxs("div",{className:"w-full -space-y-1.5",children:[e.jsx("textarea",{...m,id:f,"aria-disabled":m.disabled,readOnly:t,"aria-readonly":t||m["aria-readonly"],style:{resize:i?"none":void 0},className:x}),d>0&&e.jsx(ct,{elementId:f,maxLength:d}),e.jsx(me,{elementId:f,type:"error",message:o}),e.jsx(me,{elementId:f,type:"success",message:s})]}):e.jsx("textarea",{...m,id:f,"aria-disabled":m.disabled,readOnly:t,"aria-readonly":t||m["aria-readonly"],style:{resize:i?"none":void 0},className:x})}function xt(r){const[a,t]=l.useState(!1),[o,s]=l.useState(!1);return l.useEffect(()=>{r?(s(!0),setTimeout(()=>t(!0),10)):(t(!1),setTimeout(()=>s(!1),150))},[r]),{show:a,shouldRender:o}}function mt({isOpen:r,setIsOpen:a,filteredOptions:t,highlightedIndex:o,setHighlightedIndex:s,onSelect:n,triggerRef:i}){return{handleKeyDown:l.useCallback(c=>{var m;switch(c.key){case"ArrowDown":if(c.preventDefault(),!r)a(!0);else{const f=o<t.length-1?o+1:0;let u=f;for(let h=0;h<t.length;h++){const x=(f+h)%t.length;if(!t[x].disabled){u=x;break}}s(u)}break;case"ArrowUp":if(c.preventDefault(),!r)a(!0);else{const f=o>0?o-1:t.length-1;let u=f;for(let h=0;h<t.length;h++){const x=(f-h+t.length)%t.length;if(!t[x].disabled){u=x;break}}s(u)}break;case"Enter":case" ":if(c.preventDefault(),!r)a(!0);else if(o>=0&&o<t.length){const f=t[o];f.disabled||n(f)}break;case"Escape":c.preventDefault(),r&&(a(!1),(m=i.current)==null||m.focus());break;case"Tab":r&&a(!1);break}},[r,a,t,o,s,n,i])}}function ht({isOpen:r,filteredOptions:a,selectedOption:t,shouldRender:o,optionsContainerRef:s}){const[n,i]=l.useState(-1),d=l.useMemo(()=>t?a.findIndex(c=>c.value===t.value):-1,[a,t]);return l.useEffect(()=>{r&&a.length>0?i(t&&d>=0?d:0):i(-1)},[a,r,t,d]),l.useEffect(()=>{if(n>=0&&s.current&&o){const c=()=>{const m=s.current,f=m==null?void 0:m.querySelector(`[data-option-index="${n}"]`);if(f){const u=r&&t&&n===d?"auto":"smooth";f.scrollIntoView({behavior:u,block:"nearest"})}};r&&o&&t?setTimeout(c,10):c()}},[n,o,r,t,a,s,d]),{highlightedIndex:n,setHighlightedIndex:i}}const ge={sm:{trigger:"px-2 py-1 text-sm",options:"px-2 py-2 text-xs"},md:{trigger:"px-3 py-2 text-base",options:"px-3 py-2.5 text-sm"},lg:{trigger:"px-4 py-3 text-lg",options:"px-4 py-3 text-base"}};function pt(r){const a=l.useRef(null),t=l.useRef(null),o=l.useRef(null),[s,n]=l.useState(!1),[i,d]=l.useState(!1),[c,m]=l.useState({vertical:!1,horizontal:!1}),f=l.useRef(null),u=l.useRef(null),h=l.useCallback(()=>{const y=a.current;if(!y)return;const p=y.scrollHeight>y.clientHeight,C=y.scrollWidth>y.clientWidth;m({vertical:p,horizontal:C})},[]),x=l.useCallback(()=>{const y=a.current,p=t.current,C=o.current;if(y){if(p&&c.vertical){const j=(c.horizontal?y.clientHeight-r:y.clientHeight)/y.scrollHeight,k=Math.max(j*100,10),S=y.scrollHeight-y.clientHeight,M=S>0?y.scrollTop/S:0,v=100-k,D=M*v;p.style.height=`${k}%`,p.style.top=`${D}%`,p.style.transform="none"}if(C&&c.horizontal){const j=(c.vertical?y.clientWidth-r:y.clientWidth)/y.scrollWidth,k=Math.max(j*100,10),S=y.scrollWidth-y.clientWidth,M=S>0?y.scrollLeft/S:0,v=100-k,D=M*v;C.style.width=`${k}%`,C.style.left=`${D}%`,C.style.transform="none"}}},[c,r]),b=l.useCallback(()=>{f.current&&clearTimeout(f.current),u.current&&clearTimeout(u.current),n(!0),d(!1),x(),f.current=setTimeout(()=>{d(!0),u.current=setTimeout(()=>{n(!1),d(!1)},300)},1e3)},[x]);return l.useEffect(()=>{const y=a.current;if(!y)return;h();const p=new ResizeObserver(h);p.observe(y);const C=new MutationObserver(h);return C.observe(y,{childList:!0,subtree:!0,attributes:!0}),()=>{p.disconnect(),C.disconnect()}},[h]),l.useEffect(()=>{x()},[c,x]),l.useEffect(()=>()=>{f.current&&clearTimeout(f.current),u.current&&clearTimeout(u.current)},[]),{viewportRef:a,verticalThumbRef:t,horizontalThumbRef:o,isScrolling:s,isFadingOut:i,scrollbarVisible:c,handleScroll:b}}function Le({className:r,thumbClassName:a,viewportClassName:t,scrollbarClassName:o,scrollbarThickness:s=8,children:n,id:i,ref:d,...c}){const{viewportRef:m,verticalThumbRef:f,horizontalThumbRef:u,isScrolling:h,isFadingOut:x,scrollbarVisible:b,handleScroll:y}=pt(s),p=w.join("relative flex-1 rounded-full bg-slate-400/60 hover:bg-slate-400/80 active:bg-slate-400",a);return e.jsxs("div",{ref:d,id:i,className:w.join("relative overflow-hidden",r),"data-scroll-area-root":"",...c,children:[e.jsx("div",{ref:m,className:w.join("h-full w-full overflow-auto rounded-[inherit] hide-scroll-bars",t),onScroll:y,"data-scroll-area-viewport":"",children:n}),b.vertical&&(h||x)&&e.jsx("div",{className:w.join("touch-none select-none transition-all","p-[1px]","absolute right-0 top-0",x?"opacity-0":"opacity-100",o),"data-scroll-area-scrollbar":"vertical","data-state":h?"visible":"hidden",style:{width:`${s}px`,height:b.horizontal?`calc(100% - ${s}px)`:"100%"},children:e.jsx("div",{ref:f,className:w.join("absolute rounded-full",p),"data-scroll-area-thumb":"",style:{height:"20%",top:"0%",width:"100%"}})}),b.horizontal&&(h||x)&&e.jsx("div",{className:w.join("touch-none select-none transition-all","p-[1px]","absolute bottom-0 left-0",x?"opacity-0":"opacity-100",o),"data-scroll-area-scrollbar":"horizontal","data-state":h?"visible":"hidden",style:{height:`${s}px`,width:b.vertical?`calc(100% - ${s}px)`:"100%"},children:e.jsx("div",{ref:u,className:w.join("absolute rounded-full",p),"data-scroll-area-thumb":"",style:{width:"20%",left:"0%",height:"100%"}})}),b.vertical&&b.horizontal&&e.jsx("div",{className:w.join("bg-transparent","absolute bottom-0 right-0"),"data-scroll-area-corner":"",style:{height:`${s}px`,width:`${s}px`}})]})}function Ve({options:r,value:a,placeholder:t="Select an option...",searchable:o=!1,disabled:s=!1,clearable:n=!1,allowAdd:i=!1,size:d="md",className:c,triggerClassName:m,dropdownClassName:f,id:u,ref:h,onChange:x,onSearch:b,onAdd:y,searchPlaceholder:p="Search options..."}){const C=l.useId(),j=`${u??C}-listbox`,k=$=>`${j}-option-${$}`,[S,M]=l.useState(!1),[v,D]=l.useState(""),N=l.useRef(null),E=l.useRef(null),I=l.useRef(null),z=l.useRef(null),{show:A,shouldRender:F}=xt(S),R=l.useMemo(()=>!o||!v?r:r.filter($=>{var V;return $.text.toLowerCase().includes(v.toLowerCase())||((V=$.description)==null?void 0:V.toLowerCase().includes(v.toLowerCase()))}),[r,o,v]),G=l.useMemo(()=>!i||!o||!v?!1:!r.some(V=>V.text.toLowerCase()===v.toLowerCase())&&R.length===0,[i,o,v,r,R]),P=l.useMemo(()=>r.find($=>$.value===a),[r,a]),{highlightedIndex:Y,setHighlightedIndex:B}=ht({isOpen:S,filteredOptions:R,selectedOption:P,shouldRender:F,optionsContainerRef:z}),_=Y>=0?k(Y):void 0;l.useEffect(()=>{S&&F&&o&&E.current&&E.current.focus()},[S,o,F]);const X=l.useCallback($=>{var V;$.disabled||(x==null||x($.value),M(!1),D(""),(V=N.current)==null||V.focus())},[x]),{handleKeyDown:te}=mt({isOpen:S,setIsOpen:M,filteredOptions:R,highlightedIndex:Y,setHighlightedIndex:B,onSelect:X,triggerRef:N});l.useEffect(()=>{if(!S)return;const $=V=>{var H;I.current&&!I.current.contains(V.target)&&!((H=N.current)!=null&&H.contains(V.target))&&(M(!1),D(""))};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[S]);const K=()=>{s||(M(!S),S||(D(""),B(-1)))},T=$=>{$.disabled||(x==null||x($.value),M(!1),D(""))},W=()=>{const $=v.trim();$&&(y==null||y($),M(!1),D(""))},U=$=>{const V=$.target.value;D(V),b==null||b(V),B(-1)},Z=$=>{$.preventDefault(),$.stopPropagation(),x==null||x("")};return e.jsxs("div",{className:w.join("relative",c),id:u,ref:h,"data-select":"true","data-value":a,"data-searchable":o,"data-disabled":s,"data-clearable":n,"data-allow-add":i,children:[e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:N,type:"button",className:w.join("flex items-center justify-between w-full text-left bg-inherit border border-border rounded-md transition-colors","hover:border-primary focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",s&&"opacity-50 cursor-not-allowed hover:border-border",S&&"border-primary ring-1 ring-primary",ge[d].trigger,m),onClick:K,onKeyDown:te,disabled:s,"aria-disabled":s,"aria-haspopup":"listbox","aria-expanded":S,"aria-controls":S?j:void 0,"aria-activedescendant":S&&!o?_:void 0,"aria-label":P?P.text:t,"data-select-trigger":"true",children:[e.jsx("span",{className:w.join("block truncate",!P&&"opacity-70"),children:P?P.text:t}),e.jsx("div",{className:"flex items-center ml-2",children:e.jsx(L.ChevronDown,{size:16,className:w.join("transition-transform",S&&"rotate-180")})})]}),n&&P&&e.jsx("button",{type:"button",onClick:Z,className:"absolute right-8 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-accent/20 transition-colors group z-10","aria-label":"Clear selection","data-select-clear":"true",children:e.jsx(re.X,{size:14,className:"opacity-70 group-hover:opacity-100 transition-opacity"})})]}),F&&e.jsxs("div",{ref:I,className:w.join("absolute z-50 w-full mt-1 bg-popover text-popover-foreground border border-border rounded-md shadow-lg transition-all",A?"opacity-100 translate-y-0":"opacity-0 -translate-y-2",f),id:j,role:"listbox","data-select-content":"true",children:[o&&e.jsx("div",{className:"border-b border-border",children:e.jsx("input",{ref:E,type:"text",value:v,onChange:U,onKeyDown:te,placeholder:p,className:"w-full px-2 py-2 text-inherit focus:outline-none","aria-autocomplete":"list","aria-controls":j,"aria-activedescendant":_,"data-select-search":"true"})}),e.jsx(Le,{ref:z,viewportClassName:"max-h-60",children:R.length>0?R.map(($,V)=>e.jsxs("div",{id:k(V),className:w.join("flex items-center cursor-pointer transition-colors","hover:bg-accent/10 focus:bg-accent/10",ge[d].options,$.disabled&&"opacity-50 cursor-not-allowed",V===Y&&"bg-accent/20",a===$.value&&"bg-accent/30"),onClick:()=>T($),role:"option","aria-selected":a===$.value,"aria-disabled":$.disabled,"data-select-option":"true","data-value":$.value,"data-highlighted":V===Y,"data-option-index":V,children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium",children:$.text}),$.description&&e.jsx("div",{className:"text-xs opacity-70 mt-0.5",children:$.description})]}),a===$.value&&e.jsx(L.Check,{size:16,className:"ml-2 text-primary flex-shrink-0"})]},$.value)):G?e.jsx("div",{className:w.join("flex items-center cursor-pointer transition-colors","hover:bg-accent/10 focus:bg-accent/10",ge[d].options),onClick:W,role:"option","aria-selected":!1,"data-select-add-option":"true","aria-label":`Add ${v} as a new option`,children:e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"font-medium",children:['Add "',v,'"']})})}):e.jsx("div",{className:"px-3 py-2 text-sm opacity-70 text-center",children:o&&v?"No results found":"No options available"})})]})]})}function bt(r){const[a,t]=l.useState(""),o=l.useCallback(s=>{let n=s,i="";for(;n&&!i;){const d=window.getComputedStyle(n).backgroundColor;d&&d!=="transparent"&&d!=="rgba(0, 0, 0, 0)"&&(i=d),n=n.parentElement}return i||"transparent"},[]);return l.useEffect(()=>{const s=document.getElementById(r);if(s){const n=o(s.parentElement);t(n)}},[r,o]),a}function ie({ref:r,id:a,size:t=20,color:o,filled:s=!1,rounded:n=!0,checked:i=!1,indeterminate:d=!1,onCheckedChange:c,disabled:m,className:f="",display:u="inline",...h}){const x=l.useId(),b=l.useMemo(()=>a||`checkbox-${x}`,[a,x]),y=bt(b),[p,C]=l.useState(i),[g,j]=l.useState(d);l.useEffect(()=>{C(i)},[i]),l.useEffect(()=>{j(d)},[d]);const k=()=>{if(!m){const v=g?!0:!p;C(v),j(!1),c==null||c(v)}},S=v=>{v.key===" "&&(v.preventDefault(),k())},M=w.join("items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",u==="inline"?"inline-flex":"flex",n&&"rounded",m&&"opacity-40 cursor-not-allowed",!m&&"cursor-pointer",f);return e.jsx("button",{id:b,type:"button",ref:r,tabIndex:0,role:"checkbox",onClick:k,"aria-checked":g?"mixed":p,"aria-disabled":m,onKeyDownCapture:S,style:{width:t,height:t,color:o,backgroundColor:(p||g)&&s?"currentcolor":"transparent"},className:M,...h,children:g?e.jsx(L.Dash,{size:t,color:s?y:void 0}):e.jsx(L.Check,{size:t,color:s?y:void 0,className:p?"opacity-100":"opacity-0"})})}function Ge({itemId:r,checked:a,onChange:t,name:o,disabled:s=!1,className:n=""}){const i="relative inline-flex items-center justify-center rounded-full",d=()=>{s||t()},c=w.join(i,!a&&"hover:border-current/60",!s&&"border-current cursor-pointer",s&&"border-muted/60 cursor-not-allowed",n);return e.jsx("div",{id:r,role:"radio",tabIndex:-1,"aria-checked":a,"aria-disabled":s,"aria-description":`Radio button for ${o}`,"aria-labelledby":`${r}-label`,onClick:d,className:c,style:{width:"1em",height:"1em",padding:"0.1em",borderWidth:"0.06em"},children:a&&e.jsx("div",{className:w.join("size-full aspect-square rounded-full",s&&"bg-muted/60",!s&&"bg-current")})})}function xe({value:r,children:a,className:t="",isSelected:o=!1,onChange:s,disabled:n=!1,hideInput:i=!1,description:d,name:c}){const f=`radio-${l.useId()}-${r}`,u=()=>{n||s==null||s(r)};return e.jsxs("div",{title:d,className:w.join("relative flex items-center",t,i&&`p-2 border-2 focus-within:border-dashed focus-within:${n?"border-current/50":"border-current/80"}`,i&&!o&&`border-transparent ${n?"":"not-focus-within:hover:border-border/60"}`,i&&o&&"border-border",n&&"opacity-60 cursor-not-allowed"),style:{gap:"0.5em"},children:[!i&&e.jsx(Ge,{itemId:f,name:c||"",checked:o,onChange:u,disabled:n,className:w.join(i&&"")}),e.jsx("div",{id:i?f:void 0,tabIndex:i?-1:void 0,role:i?"radio":void 0,onClick:i?u:void 0,"aria-checked":i?o?"true":"false":void 0,"aria-disabled":i?n:void 0,"aria-description":i?d||`Radio button for ${c}`:void 0,"aria-labelledby":i?`${f}-label`:void 0,className:w.join(i&&"size-full",typeof a=="object"&&"grow focus:outline-none"),children:e.jsx("label",{id:`${f}-label`,onClick:i?void 0:u,className:w.join(n&&"cursor-not-allowed",!n&&"cursor-pointer"),children:a})})]})}function gt(r,a){const[t,o]=l.useState(a),[s,n]=l.useState(-1),[i,d]=l.useState(!1),c=l.useCallback((x,b)=>{var C;const y=x[b];y.hasAttribute("disabled")||y.getAttribute("aria-disabled")==="true"||((C=x[b])==null||C.click(),n(b))},[]),m=l.useCallback((x,b)=>{var p;if(x.preventDefault(),i||!b.length)return;const y=a!==-1?a:0;(p=b[y])==null||p.focus(),o(y),a!==-1&&c(b,y)},[a,i,c]),f=l.useCallback(x=>{var C;if(!x.shiftKey)return;x.preventDefault();const b=Array.from(document.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')).filter(g=>!g.hasAttribute("disabled")&&g.tabIndex>=0),y=b.findIndex(g=>g.id===r),p=y>0?y-1:b.length-1;(C=b[p])==null||C.focus()},[r]),u=l.useCallback((x,b)=>{var j;if(!b.length)return;const y=x.target;if(!b.some(k=>k.id===y.id))return;const C=t!==-1?t:0;let g=C;switch(x.key){case"ArrowUp":case"ArrowLeft":x.preventDefault(),g=C>0?C-1:b.length-1;break;case"ArrowDown":case"ArrowRight":x.preventDefault(),g=(C+1)%b.length;break;case" ":x.preventDefault(),c(b,C);return;case"Tab":f(x);return;default:return}(j=b[g])==null||j.focus(),o(g),s!==-1&&c(b,g)},[t,s,f,c]),h=l.useCallback(()=>{const x=document.querySelector(`[id="${r}"][role="radiogroup"]`);return x?Array.from(x.querySelectorAll('[role="radio"]')):[]},[r]);l.useEffect(()=>{const x=document.querySelector(`[id="${r}"][role="radiogroup"]`);if(!x)return;const b=h(),y=j=>m(j,b),p=j=>u(j,b),C=()=>d(!0),g=()=>d(!1);return document.addEventListener("keydown",p),x.addEventListener("focus",y),x.addEventListener("mousedown",C),document.addEventListener("mouseup",g),()=>{document.removeEventListener("keydown",p),x.removeEventListener("focus",y),x.removeEventListener("mousedown",C),document.removeEventListener("mouseup",g)}},[r,h,m,u])}function We({options:r=[],value:a,onChange:t,id:o,children:s,className:n="",childrenClassName:i="",hideInputs:d=!1}){const c=l.useId(),m=o||`radio-group-${c}`;gt(m,r.findIndex(u=>u===a));const f=l.useMemo(()=>r.reduce((u,h)=>(typeof h=="string"?u.some(x=>x.value===h)||u.push({label:h,value:h}):u.push(h),u),[]),[r]);return e.jsxs("div",{id:m,role:"radiogroup",tabIndex:0,className:w.join(n,"focus:outline-none"),children:[f.length>0&&f.map((u,h)=>e.jsx(xe,{value:u.value,isSelected:a===u.value,onChange:t,name:m,disabled:u.disabled,description:u.description,hideInput:d,className:i,children:u.label},`${u.value}-${h}`)),f.length===0&&s&&l.Children.map(s,u=>l.isValidElement(u)&&u.type===xe?e.jsx(xe,{...u.props,className:w.join(i,u.props.className),hideInput:u.props.hideInput||d,isSelected:a===u.props.value,onChange:t,name:m,children:u.props.children}):null)]})}function _e({form:r,initialData:a={},onDataChange:t,onSubmit:o,submitButton:s,columns:n=be.columns,responsive:i=be.responsive,spacing:d=be.spacing,className:c,id:m,ref:f}){const[u,h]=l.useState(a),{errors:x,validateForm:b,validateSingleField:y,isFormValid:p}=ot(r,u),C=l.useCallback((v,D)=>{const N={...u,[v]:D};h(N),t==null||t(N),y(v,D)},[u,t,y]),g=l.useCallback(v=>{v.preventDefault(),b(u)&&o&&o(u)},[u,b,o]),j=v=>{const D=[],N={};return v.colSpan&&n>1&&D.push(pe.colSpan[v.colSpan]),{className:w.join(D.join(" "),v.className),style:N}},k=v=>{const D=u[v.name],N=x[v.name],E=m?`${m}-${v.name}`:v.name,{className:I,style:z}=j(v),A=()=>{switch(v.__type){case"input":{const F=v;return e.jsxs(e.Fragment,{children:[e.jsx(se,{htmlFor:E,required:v.required,description:v.description,children:v.label}),e.jsx(Re,{id:E,type:F.type||"text",placeholder:F.placeholder,value:D||"",onChange:R=>C(v.name,R.target.value),disabled:v.disabled,variant:F.variant,rounded:F.rounded,errorMessage:N,"data-field-name":v.name,"data-field-type":v.__type})]})}case"textarea":{const F=v;return e.jsxs(e.Fragment,{children:[e.jsx(se,{htmlFor:E,required:v.required,description:v.description,children:v.label}),e.jsx(Be,{id:E,placeholder:F.placeholder,value:D||"",onChange:R=>C(v.name,R.target.value),disabled:v.disabled,variant:F.variant,rounded:F.rounded,rows:F.rows,autoExpand:F.autoExpand,characterLimit:F.characterLimit,errorMessage:N,"data-field-name":v.name,"data-field-type":v.__type})]})}case"select":{const F=v,R=F.options.map(G=>({text:G.label,value:G.value,disabled:G.disabled}));return e.jsxs(e.Fragment,{children:[e.jsx(se,{htmlFor:E,required:v.required,description:v.description,children:v.label}),e.jsx(Ve,{id:E,options:R,value:D||"",onChange:G=>C(v.name,G),placeholder:F.placeholder,disabled:v.disabled,searchable:F.searchable,clearable:F.clearable,"data-field-name":v.name,"data-field-type":v.__type}),N&&e.jsx("p",{className:"text-sm text-destructive mt-1",role:"alert",children:N})]})}case"checkbox":{const F=v,R=16;return e.jsxs("div",{className:"space-x-2",children:[e.jsx(ie,{id:E,checked:D||!1,onCheckedChange:G=>C(v.name,G),disabled:v.disabled,"data-field-name":v.name,"data-field-type":v.__type,size:R}),e.jsxs("div",{className:"inline-block",style:{maxWidth:`calc(100% - ${R+10}px)`},children:[" ",e.jsx(se,{htmlFor:E,className:"cursor-pointer",children:F.text||v.label}),v.description&&e.jsx("p",{className:"text-sm opacity-80 mt-1",children:v.description}),N&&e.jsx("p",{className:"text-sm text-destructive mt-1",role:"alert",children:N})]})]})}case"radio":{const R=v.options.map(G=>({label:G.label,value:G.value,disabled:G.disabled}));return e.jsxs(e.Fragment,{children:[e.jsx(se,{required:v.required,children:v.label}),v.description&&e.jsx("p",{className:"text-sm opacity-80 mb-2",children:v.description}),e.jsx(We,{options:R,value:D||"",onChange:G=>C(v.name,G),id:E,"data-field-name":v.name,"data-field-type":v.__type}),N&&e.jsx("p",{className:"text-sm text-destructive mt-1",role:"alert",children:N})]})}case"checkboxGroup":{const F=v,R=D||[],G=16,P=F.options.map(K=>K.value),Y=P.length>0&&P.every(K=>R.includes(K)),B=R.length===0,_=!Y&&!B,X=(K,T)=>{let W;T?W=[...R,K]:W=R.filter(U=>U!==K),C(v.name,W)},te=K=>{if(K){const T=F.options.filter(W=>!W.disabled).map(W=>W.value);C(v.name,T)}else C(v.name,[])};return e.jsxs(e.Fragment,{children:[e.jsx(se,{required:v.required,children:v.label}),v.description&&e.jsx("p",{className:"text-sm opacity-80 mb-2",children:v.description}),e.jsxs("div",{"data-field-name":v.name,"data-field-type":v.__type,children:[F.selectAll&&e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(ie,{id:`${E}-select-all`,checked:Y,indeterminate:_,onCheckedChange:K=>te(K),disabled:v.disabled,size:G,className:"mt-1"}),e.jsx("div",{className:"inline-block",style:{maxWidth:`calc(100% - ${G+10}px)`},children:e.jsx(se,{htmlFor:`${E}-select-all`,className:"cursor-pointer font-medium",children:"Select All"})})]}),F.options.map((K,T)=>{const W=`${E}-${T}`,U=R.includes(K.value);return e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(ie,{id:W,checked:U,onCheckedChange:Z=>X(K.value,Z),disabled:v.disabled||K.disabled,size:G,className:"mt-1"}),e.jsx("div",{className:"inline-block",style:{maxWidth:`calc(100% - ${G+10}px)`},children:e.jsx(se,{htmlFor:W,className:"cursor-pointer",children:K.label})})]},K.value)})]}),N&&e.jsx("p",{className:"text-sm text-destructive mt-1",role:"alert",children:N})]})}case"custom":{const F=v;return e.jsxs(e.Fragment,{children:[v.label&&e.jsx(se,{required:v.required,description:v.description,children:v.label}),e.jsx("div",{"data-field-name":v.name,"data-field-type":v.__type,children:F.renderComponent({value:D,onValueChange:R=>C(v.name,R),disabled:v.disabled,error:N,name:v.name})})]})}default:return null}};return e.jsx("div",{className:I,style:z,children:A()},v.name)},S=w.join("grid",n&&n>1?pe.columns[n]:"grid-cols-1",pe.spacing[d],c),M=()=>s?l.isValidElement(s)?l.cloneElement(s,{disabled:!p,"aria-disabled":!p,...s.props??{}}):e.jsx("div",{className:"col-span-full",children:s}):null;return e.jsxs("form",{ref:f,id:m,onSubmit:g,className:S,"data-form-fields":r.length,"data-form-columns":n,"data-form-responsive":i,"data-form-valid":p,children:[r.map(k),M()]})}const vt={google:{label:"Continue with Google",icon:e.jsx(L.Google,{size:15})},github:{label:"Continue with GitHub",icon:e.jsx(L.GitHub,{size:15})},facebook:{label:"Continue with Facebook",icon:e.jsx(L.Facebook,{size:15})},apple:{label:"Continue with Apple",icon:e.jsx(L.Apple,{size:15})}};function yt({methods:r=["email"],action:a="login",onMethodClick:t,onEmailSubmit:o,onSuccess:s,onActionChange:n,errorMessage:i,validatePassword:d,className:c,id:m,ref:f}){const[u,h]=l.useState(a==="both"?"login":a),[x,b]=l.useState(""),{input:y}=Me,p=u==="login",C=a==="both",g=r.includes("email"),j=r.filter(D=>D!=="email"),k=x||i,S=[y({name:"email",label:"Email",type:"email",placeholder:"you@email.com",required:!0,variant:"outline"}),y({name:"password",label:"Password",type:"password",placeholder:"Password",required:!0,variant:"outline",...d&&{isValid:D=>{const N=d(D);return{valid:!N,message:N}}}}),...p?[]:[y({name:"confirmPassword",label:"Confirm Password",type:"password",placeholder:"Confirm Password",required:!0,variant:"outline"})]],M=async D=>{if(b(""),!p&&D.confirmPassword!==D.password){b("Passwords do not match.");return}if(o){const N=await o({data:{email:D.email,password:D.password,confirmPassword:D.confirmPassword},action:u});if(N!=null&&N.error){b(N.error.message);return}}s==null||s(u)},v=()=>{h(D=>{const N=D==="login"?"sign up":"login";return n==null||n(N),N}),b("")};return e.jsxs("div",{className:w.join("flex flex-col gap-3",c),id:m,"data-auth-mode":u,"data-action":a,children:[j.map(D=>{const N=vt[D];return e.jsxs(J.Button,{variant:"outline",onClick:()=>t==null?void 0:t(D),className:"flex items-center justify-center gap-2","data-auth-method":D,children:[N.icon,N.label]},D)}),j.length>0&&g&&e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-border",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),g&&e.jsxs(e.Fragment,{children:[e.jsx(_e,{form:S,onSubmit:M,submitButton:e.jsx(J.Button,{type:"submit",variant:"primary",className:"mt-2 w-full",children:p?"Log In":"Sign Up"}),ref:f,spacing:"tight"}),k&&e.jsx("small",{className:"block text-center text-destructive mt-2",role:"alert",children:k}),C&&e.jsx("div",{className:"text-center mt-3",children:e.jsx(J.Button,{type:"button",variant:"link",className:"text-sm opacity-90",onClick:v,"data-toggle-mode":!0,children:p?"Don't have an account? Sign Up":"Already have an account? Log In"})})]})]})}function jt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"40",r:"32",fill:"url(#astronautHelmet)",stroke:"#4F46E5",strokeWidth:"2"}),e.jsx("circle",{cx:"50",cy:"40",r:"24",fill:"#FED7AA"}),e.jsx("circle",{cx:"43",cy:"36",r:"3",fill:"#1F2937"}),e.jsx("circle",{cx:"57",cy:"36",r:"3",fill:"#1F2937"}),e.jsx("path",{d:"M46 46 Q50 50 54 46",stroke:"#1F2937",strokeWidth:"2",fill:"none"}),e.jsx("rect",{x:"38",y:"65",width:"24",height:"30",rx:"12",fill:"#E5E7EB"}),e.jsx("rect",{x:"44",y:"70",width:"12",height:"8",rx:"2",fill:"#6366F1"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"astronautHelmet",cx:"50%",cy:"30%",r:"70%",children:[e.jsx("stop",{stopColor:"#DBEAFE"}),e.jsx("stop",{offset:"1",stopColor:"#93C5FD"})]})})]})}function wt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"url(#moonGradient)"}),e.jsx("circle",{cx:"38",cy:"35",r:"4",fill:"#D1D5DB"}),e.jsx("circle",{cx:"65",cy:"42",r:"3",fill:"#D1D5DB"}),e.jsx("circle",{cx:"42",cy:"65",r:"5",fill:"#D1D5DB"}),e.jsx("circle",{cx:"45",cy:"45",r:"2.5",fill:"#1F2937"}),e.jsx("circle",{cx:"58",cy:"45",r:"2.5",fill:"#1F2937"}),e.jsx("path",{d:"M47 55 Q52 60 57 55",stroke:"#1F2937",strokeWidth:"2",fill:"none"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"moonGradient",cx:"30%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#F9FAFB"}),e.jsx("stop",{offset:"1",stopColor:"#E5E7EB"})]})})]})}function kt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("path",{d:"M50 15 L58 38 L82 38 L64 52 L72 75 L50 61 L28 75 L36 52 L18 38 L42 38 Z",fill:"url(#starGradient)"}),e.jsx("circle",{cx:"44",cy:"42",r:"2",fill:"#1F2937"}),e.jsx("circle",{cx:"56",cy:"42",r:"2",fill:"#1F2937"}),e.jsx("path",{d:"M46 50 Q50 54 54 50",stroke:"#1F2937",strokeWidth:"2",fill:"none"}),e.jsx("circle",{cx:"65",cy:"25",r:"1.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"35",cy:"30",r:"1",fill:"#FCD34D"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"starGradient",cx:"50%",cy:"40%",r:"60%",children:[e.jsx("stop",{stopColor:"#FEF3C7"}),e.jsx("stop",{offset:"1",stopColor:"#FCD34D"})]})})]})}function Ct({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"38",fill:"url(#galaxyGradient)"}),e.jsx("path",{d:"M20 50 Q35 30 50 50 Q65 70 80 50",stroke:"#8B5CF6",strokeWidth:"3",opacity:"0.7"}),e.jsx("path",{d:"M50 20 Q70 35 50 50 Q30 65 50 80",stroke:"#A78BFA",strokeWidth:"2",opacity:"0.5"}),e.jsx("circle",{cx:"50",cy:"50",r:"12",fill:"#1E1B4B"}),e.jsx("circle",{cx:"46",cy:"47",r:"1.5",fill:"#E0E7FF"}),e.jsx("circle",{cx:"54",cy:"47",r:"1.5",fill:"#E0E7FF"}),e.jsx("path",{d:"M47 53 Q50 56 53 53",stroke:"#E0E7FF",strokeWidth:"1.5",fill:"none"}),e.jsx("circle",{cx:"30",cy:"25",r:"1",fill:"#FFF"}),e.jsx("circle",{cx:"75",cy:"70",r:"1.5",fill:"#FFF"}),e.jsx("circle",{cx:"25",cy:"75",r:"1",fill:"#FFF"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"galaxyGradient",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#4C1D95"}),e.jsx("stop",{offset:"0.5",stopColor:"#7C3AED"}),e.jsx("stop",{offset:"1",stopColor:"#1E1B4B"})]})})]})}function Nt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("ellipse",{cx:"50",cy:"50",rx:"35",ry:"30",fill:"url(#nebulaGradient)",opacity:"0.8"}),e.jsx("ellipse",{cx:"40",cy:"45",rx:"20",ry:"25",fill:"url(#nebulaPink)",opacity:"0.6"}),e.jsx("ellipse",{cx:"60",cy:"55",rx:"25",ry:"20",fill:"url(#nebulaBlue)",opacity:"0.6"}),e.jsx("circle",{cx:"50",cy:"50",r:"15",fill:"#312E81",opacity:"0.9"}),e.jsx("circle",{cx:"46",cy:"47",r:"2",fill:"#E0E7FF"}),e.jsx("circle",{cx:"54",cy:"47",r:"2",fill:"#E0E7FF"}),e.jsx("path",{d:"M47 53 Q50 56 53 53",stroke:"#E0E7FF",strokeWidth:"1.5",fill:"none"}),e.jsx("circle",{cx:"25",cy:"30",r:"1",fill:"#FFF",opacity:"0.9"}),e.jsx("circle",{cx:"75",cy:"25",r:"1.5",fill:"#FFF",opacity:"0.8"}),e.jsx("circle",{cx:"30",cy:"75",r:"1",fill:"#FFF",opacity:"0.9"}),e.jsx("circle",{cx:"70",cy:"75",r:"1.5",fill:"#FFF",opacity:"0.7"}),e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"nebulaGradient",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#7C3AED"}),e.jsx("stop",{offset:"1",stopColor:"#312E81"})]}),e.jsxs("radialGradient",{id:"nebulaPink",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#F472B6"}),e.jsx("stop",{offset:"1",stopColor:"#BE185D"})]}),e.jsxs("radialGradient",{id:"nebulaBlue",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#3B82F6"}),e.jsx("stop",{offset:"1",stopColor:"#1E40AF"})]})]})]})}function Dt({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"32",fill:"url(#planetGradient)"}),e.jsx("ellipse",{cx:"50",cy:"50",rx:"45",ry:"8",fill:"none",stroke:"#A78BFA",strokeWidth:"2",opacity:"0.7"}),e.jsx("circle",{cx:"38",cy:"40",r:"5",fill:"#065F46",opacity:"0.6"}),e.jsx("circle",{cx:"62",cy:"45",r:"4",fill:"#065F46",opacity:"0.6"}),e.jsx("circle",{cx:"45",cy:"62",r:"3",fill:"#065F46",opacity:"0.6"}),e.jsx("circle",{cx:"46",cy:"48",r:"2.5",fill:"#1F2937"}),e.jsx("circle",{cx:"54",cy:"48",r:"2.5",fill:"#1F2937"}),e.jsx("path",{d:"M47 55 Q50 58 53 55",stroke:"#1F2937",strokeWidth:"2",fill:"none"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"planetGradient",cx:"30%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#A7F3D0"}),e.jsx("stop",{offset:"0.6",stopColor:"#34D399"}),e.jsx("stop",{offset:"1",stopColor:"#059669"})]})})]})}function Et({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"55",r:"28",fill:"url(#catGradient)"}),e.jsx("path",{d:"M28 40 L38 25 L42 45 Z",fill:"#6366F1"}),e.jsx("path",{d:"M58 45 L62 25 L72 40 Z",fill:"#6366F1"}),e.jsx("path",{d:"M32 38 L36 30 L38 40 Z",fill:"#EC4899"}),e.jsx("path",{d:"M62 40 L64 30 L68 38 Z",fill:"#EC4899"}),e.jsx("ellipse",{cx:"43",cy:"50",rx:"4",ry:"6",fill:"#FCD34D"}),e.jsx("ellipse",{cx:"57",cy:"50",rx:"4",ry:"6",fill:"#FCD34D"}),e.jsx("ellipse",{cx:"43",cy:"52",rx:"1.5",ry:"4",fill:"#1F2937"}),e.jsx("ellipse",{cx:"57",cy:"52",rx:"1.5",ry:"4",fill:"#1F2937"}),e.jsx("path",{d:"M48 58 L50 60 L52 58 Z",fill:"#EC4899"}),e.jsx("path",{d:"M50 60 Q46 64 42 62",stroke:"#1F2937",strokeWidth:"1.5",fill:"none"}),e.jsx("path",{d:"M50 60 Q54 64 58 62",stroke:"#1F2937",strokeWidth:"1.5",fill:"none"}),e.jsx("line",{x1:"25",y1:"55",x2:"35",y2:"57",stroke:"#1F2937",strokeWidth:"1"}),e.jsx("line",{x1:"65",y1:"57",x2:"75",y2:"55",stroke:"#1F2937",strokeWidth:"1"}),e.jsx("circle",{cx:"20",cy:"25",r:"1.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"80",cy:"30",r:"1",fill:"#FCD34D"}),e.jsx("circle",{cx:"15",cy:"70",r:"1",fill:"#FCD34D"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"catGradient",cx:"50%",cy:"40%",r:"70%",children:[e.jsx("stop",{stopColor:"#A78BFA"}),e.jsx("stop",{offset:"1",stopColor:"#6366F1"})]})})]})}function St({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"35",cy:"55",r:"18",fill:"url(#cloudGradient)"}),e.jsx("circle",{cx:"55",cy:"50",r:"22",fill:"url(#cloudGradient)"}),e.jsx("circle",{cx:"45",cy:"65",r:"15",fill:"url(#cloudGradient)"}),e.jsx("circle",{cx:"65",cy:"60",r:"16",fill:"url(#cloudGradient)"}),e.jsx("circle",{cx:"48",cy:"52",r:"2.5",fill:"#6366F1"}),e.jsx("circle",{cx:"56",cy:"52",r:"2.5",fill:"#6366F1"}),e.jsx("path",{d:"M49 58 Q52 62 55 58",stroke:"#6366F1",strokeWidth:"2",fill:"none"}),e.jsx("circle",{cx:"70",cy:"35",r:"3",fill:"rgba(167, 139, 250, 0.3)",stroke:"#A78BFA"}),e.jsx("circle",{cx:"78",cy:"28",r:"2",fill:"rgba(167, 139, 250, 0.3)",stroke:"#A78BFA"}),e.jsx("circle",{cx:"83",cy:"20",r:"1.5",fill:"rgba(167, 139, 250, 0.3)",stroke:"#A78BFA"}),e.jsx("circle",{cx:"70",cy:"35",r:"0.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"78",cy:"28",r:"0.5",fill:"#FCD34D"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"cloudGradient",cx:"50%",cy:"40%",r:"70%",children:[e.jsx("stop",{stopColor:"#F8FAFC"}),e.jsx("stop",{offset:"1",stopColor:"#E2E8F0"})]})})]})}function Ft({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("ellipse",{cx:"50",cy:"45",rx:"15",ry:"30",fill:"url(#rocketGradient)"}),e.jsx("path",{d:"M35 20 L50 10 L65 20 L50 25 Z",fill:"#EF4444"}),e.jsx("circle",{cx:"50",cy:"35",r:"8",fill:"#DBEAFE",stroke:"#2563EB",strokeWidth:"2"}),e.jsx("circle",{cx:"47",cy:"33",r:"1.5",fill:"#1F2937"}),e.jsx("circle",{cx:"53",cy:"33",r:"1.5",fill:"#1F2937"}),e.jsx("path",{d:"M48 37 Q50 39 52 37",stroke:"#1F2937",strokeWidth:"1",fill:"none"}),e.jsx("path",{d:"M35 60 L25 70 L35 75 Z",fill:"#6B7280"}),e.jsx("path",{d:"M65 60 L75 70 L65 75 Z",fill:"#6B7280"}),e.jsx("ellipse",{cx:"50",cy:"80",rx:"8",ry:"12",fill:"#F59E0B"}),e.jsx("ellipse",{cx:"50",cy:"82",rx:"5",ry:"8",fill:"#EF4444"}),e.jsx("circle",{cx:"25",cy:"20",r:"1",fill:"#FCD34D"}),e.jsx("circle",{cx:"75",cy:"25",r:"1.5",fill:"#FCD34D"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"rocketGradient",cx:"30%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#E5E7EB"}),e.jsx("stop",{offset:"1",stopColor:"#9CA3AF"})]})})]})}function It({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"38",fill:"url(#constellationBg)",opacity:"0.8"}),e.jsx("circle",{cx:"35",cy:"25",r:"2",fill:"#FCD34D"}),e.jsx("circle",{cx:"50",cy:"30",r:"2.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"65",cy:"35",r:"2",fill:"#FCD34D"}),e.jsx("circle",{cx:"30",cy:"50",r:"1.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"70",cy:"50",r:"2",fill:"#FCD34D"}),e.jsx("circle",{cx:"40",cy:"70",r:"2.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"60",cy:"75",r:"1.5",fill:"#FCD34D"}),e.jsx("line",{x1:"35",y1:"25",x2:"50",y2:"30",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"50",y1:"30",x2:"65",y2:"35",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"30",y1:"50",x2:"50",y2:"30",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"50",y1:"30",x2:"70",y2:"50",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"30",y1:"50",x2:"40",y2:"70",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("line",{x1:"70",y1:"50",x2:"60",y2:"75",stroke:"#A78BFA",strokeWidth:"1",opacity:"0.7"}),e.jsx("circle",{cx:"48",cy:"48",r:"2",fill:"#E0E7FF"}),e.jsx("circle",{cx:"52",cy:"48",r:"2",fill:"#E0E7FF"}),e.jsx("path",{d:"M48 54 Q50 56 52 54",stroke:"#E0E7FF",strokeWidth:"1.5",fill:"none"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"constellationBg",cx:"50%",cy:"50%",r:"70%",children:[e.jsx("stop",{stopColor:"#1E1B4B"}),e.jsx("stop",{offset:"1",stopColor:"#0F0D2A"})]})})]})}function At({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"35",cy:"35",r:"18",fill:"url(#cometGradient)"}),e.jsx("circle",{cx:"31",cy:"31",r:"2",fill:"#1F2937"}),e.jsx("circle",{cx:"39",cy:"31",r:"2",fill:"#1F2937"}),e.jsx("path",{d:"M32 38 Q35 41 38 38",stroke:"#1F2937",strokeWidth:"1.5",fill:"none"}),e.jsx("path",{d:"M50 50 Q65 65 85 85",stroke:"url(#tailGradient1)",strokeWidth:"8",opacity:"0.7"}),e.jsx("path",{d:"M48 52 Q60 68 75 88",stroke:"url(#tailGradient2)",strokeWidth:"6",opacity:"0.5"}),e.jsx("path",{d:"M52 48 Q70 62 90 82",stroke:"url(#tailGradient3)",strokeWidth:"4",opacity:"0.3"}),e.jsx("circle",{cx:"60",cy:"60",r:"1.5",fill:"#FCD34D"}),e.jsx("circle",{cx:"70",cy:"70",r:"1",fill:"#FCD34D"}),e.jsx("circle",{cx:"80",cy:"80",r:"0.8",fill:"#FCD34D"}),e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"cometGradient",cx:"30%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#FEF3C7"}),e.jsx("stop",{offset:"1",stopColor:"#F59E0B"})]}),e.jsxs("linearGradient",{id:"tailGradient1",x1:"50%",y1:"50%",x2:"85%",y2:"85%",children:[e.jsx("stop",{stopColor:"#FCD34D"}),e.jsx("stop",{offset:"1",stopColor:"transparent"})]}),e.jsxs("linearGradient",{id:"tailGradient2",x1:"48%",y1:"52%",x2:"75%",y2:"88%",children:[e.jsx("stop",{stopColor:"#F472B6"}),e.jsx("stop",{offset:"1",stopColor:"transparent"})]}),e.jsxs("linearGradient",{id:"tailGradient3",x1:"52%",y1:"48%",x2:"90%",y2:"82%",children:[e.jsx("stop",{stopColor:"#A78BFA"}),e.jsx("stop",{offset:"1",stopColor:"transparent"})]})]})]})}function $t({size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 100 100",fill:"none",children:[e.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"url(#twilightGradient)"}),e.jsx("ellipse",{cx:"50",cy:"65",rx:"25",ry:"15",fill:"#1F2937",opacity:"0.8"}),e.jsx("circle",{cx:"30",cy:"25",r:"1.5",fill:"#FFF"}),e.jsx("circle",{cx:"70",cy:"30",r:"1",fill:"#FFF"}),e.jsx("circle",{cx:"40",cy:"35",r:"1.2",fill:"#FFF"}),e.jsx("circle",{cx:"60",cy:"25",r:"0.8",fill:"#FFF"}),e.jsx("path",{d:"M20 40 Q15 35 20 30 Q25 35 20 40",fill:"#FCD34D"}),e.jsx("circle",{cx:"47",cy:"62",r:"1.5",fill:"#E0E7FF"}),e.jsx("circle",{cx:"53",cy:"62",r:"1.5",fill:"#E0E7FF"}),e.jsx("path",{d:"M48 67 Q50 69 52 67",stroke:"#E0E7FF",strokeWidth:"1",fill:"none"}),e.jsx("defs",{children:e.jsxs("radialGradient",{id:"twilightGradient",cx:"50%",cy:"30%",r:"80%",children:[e.jsx("stop",{stopColor:"#7C3AED"}),e.jsx("stop",{offset:"0.7",stopColor:"#3730A3"}),e.jsx("stop",{offset:"1",stopColor:"#1E1B4B"})]})})]})}const Mt={astronaut:jt,moon:wt,star:kt,galaxy:Ct,nebula:Nt,planet:Dt,"cosmic-cat":Et,"dream-cloud":St,rocket:Ft,constellation:It,comet:At,twilight:$t},zt={xs:{size:"w-8 h-8",iconSize:"24"},sm:{size:"w-10 h-10",iconSize:"32"},md:{size:"w-12 h-12",iconSize:"40"},lg:{size:"w-16 h-16",iconSize:"56"},xl:{size:"w-20 h-20",iconSize:"72"},"2xl":{size:"w-24 h-24",iconSize:"88"}},Tt={circle:"rounded-full",square:"rounded-lg"};function Rt({id:r,ref:a,size:t="md",shape:o="circle",preset:s,alt:n,className:i,src:d,initials:c,...m}){const f=zt[t],u=Tt[o],h=s?Mt[s]:null;return e.jsx("div",{id:r,ref:a,className:w.join("relative inline-flex items-center justify-center overflow-hidden bg-gray-100 border-2 border-border",f.size,u,i),"data-size":t,"data-shape":o,"data-preset":s,role:"img","aria-label":n||`Avatar ${s?`of ${s}`:""}`,...m,children:d?e.jsx("img",{src:d,alt:n||"User avatar",className:"w-full h-full object-cover"}):h?e.jsx(h,{size:f.iconSize}):c?e.jsx("span",{className:"text-gray-600 font-medium text-sm",children:c.slice(0,2).toUpperCase()}):e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-gray-300 to-gray-400"})})}const Bt={decorative:{"aria-hidden":!0},status:{role:"status"},alert:{role:"alert"},interactive:{}},Lt={base:"",primary:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",accent:"bg-accent text-accent-foreground",destructive:"bg-destructive text-destructive-foreground",success:"bg-success text-success-foreground",warning:"bg-warning text-warning-foreground",muted:"bg-muted text-muted-foreground"},Vt={base:"",primary:"border border-primary bg-transparent text-primary",secondary:"border border-secondary bg-transparent text-secondary",accent:"border border-accent bg-transparent text-accent",destructive:"border border-destructive bg-transparent text-destructive",success:"border border-success bg-transparent text-success",warning:"border border-warning bg-transparent text-warning",muted:"border border-muted-foreground bg-transparent text-muted-foreground"},ve={xs:{text:"text-xs",aspectSquare:"p-1",aspectVideo:"px-2 py-0.5"},sm:{text:"text-sm",aspectSquare:"p-1.5",aspectVideo:"px-2.5 py-1"},md:{text:"text-base",aspectSquare:"p-2",aspectVideo:"px-3 py-1.5"}};function Gt({id:r,ref:a,variant:t="muted",outline:o=!1,children:s,className:n,aspect:i="video",use:d="decorative",size:c="xs",...m}){return e.jsx("span",{id:r,ref:a,className:w.join("font-medium rounded-full inline-flex select-none",ve[c].text,i==="square"&&ve[c].aspectSquare,i==="video"&&ve[c].aspectVideo,o?Vt[t]:Lt[t],n),"data-variant":t,"data-outline":o,"data-aspect":i,"data-use":d,"data-size":c,...Bt[d],...m,children:s})}function Wt(r={}){const{initialDate:a=new Date,mode:t="single",minDate:o,maxDate:s,view:n="month",onDateSelect:i,onRangeSelect:d}=r,[c,m]=l.useState({currentDate:a,selectedDate:t==="single"?a:null,selectedRange:null,view:n}),f=l.useCallback(N=>!!(o&&N<o||s&&N>s),[o,s]),u=l.useCallback(N=>{f(N)||(t==="single"?(m(E=>({...E,selectedDate:N})),i==null||i(N)):t==="range"&&m(E=>{const{selectedRange:I}=E;if(!(I!=null&&I.start)||I.start&&I.end){const z={start:N,end:null};return d==null||d(z),{...E,selectedRange:z}}else{const z=I.start,A=N,F={start:z<A?z:A,end:z<A?A:z};return d==null||d(F),{...E,selectedRange:F}}}))},[t,f,i,d]),h=l.useCallback(N=>{m(E=>{const I=new Date(E.currentDate);return N==="prev"?I.setMonth(I.getMonth()-1):I.setMonth(I.getMonth()+1),{...E,currentDate:I}})},[]),x=l.useCallback(N=>{m(E=>{const I=new Date(E.currentDate),z=N==="prev"?-7:7;return I.setDate(I.getDate()+z),{...E,currentDate:I}})},[]),b=l.useCallback(N=>{m(E=>{const I=new Date(E.currentDate),z=N==="prev"?-1:1;return I.setDate(I.getDate()+z),{...E,currentDate:I}})},[]),y=l.useCallback(N=>{c.view==="month"?h(N):c.view==="week"?x(N):b(N)},[c.view,h,x,b]),p=l.useCallback(N=>{m(E=>({...E,view:N}))},[]),C=l.useCallback(N=>{m(E=>({...E,currentDate:N}))},[]),g=l.useCallback(N=>{m(E=>{const I=new Date(E.currentDate);return I.setMonth(N),{...E,currentDate:I}})},[]),j=l.useCallback(N=>{m(E=>{const I=new Date(E.currentDate);return I.setFullYear(N),{...E,currentDate:I}})},[]),k=l.useMemo(()=>{const{currentDate:N,view:E}=c,I=[];if(E==="month"){const z=new Date(N.getFullYear(),N.getMonth(),1),A=new Date(z);A.setDate(A.getDate()-z.getDay());for(let F=0;F<42;F++){const R=new Date(A);R.setDate(R.getDate()+F),I.push(R)}}else if(E==="week"){const z=new Date(N);z.setDate(N.getDate()-N.getDay());for(let A=0;A<7;A++){const F=new Date(z);F.setDate(F.getDate()+A),I.push(F)}}else I.push(new Date(N));return I},[c]),S=l.useCallback(N=>{if(t==="single")return c.selectedDate&&N.toDateString()===c.selectedDate.toDateString();if(t==="range"&&c.selectedRange){const{start:E,end:I}=c.selectedRange;if(E&&I)return N>=E&&N<=I;if(E)return N.toDateString()===E.toDateString()}return!1},[t,c.selectedDate,c.selectedRange]),M=l.useCallback(N=>{var E,I;if(t==="range"&&((E=c.selectedRange)!=null&&E.start)&&((I=c.selectedRange)!=null&&I.end)){const{start:z,end:A}=c.selectedRange;return N>z&&N<A}return!1},[t,c.selectedRange]),v=l.useCallback(N=>{var E;return t==="range"&&((E=c.selectedRange)!=null&&E.start)?N.toDateString()===c.selectedRange.start.toDateString():!1},[t,c.selectedRange]),D=l.useCallback(N=>{var E;return t==="range"&&((E=c.selectedRange)!=null&&E.end)?N.toDateString()===c.selectedRange.end.toDateString():!1},[t,c.selectedRange]);return{currentDate:c.currentDate,selectedDate:c.selectedDate,selectedRange:c.selectedRange,view:c.view,daysInView:k,selectDate:u,navigate:y,changeView:p,goToDate:C,changeMonth:g,changeYear:j,isDateSelected:S,isDateDisabled:f,isDateInRange:M,isDateRangeStart:v,isDateRangeEnd:D}}const _t={small:{container:"text-xs",cell:"w-7 h-7 text-xs",header:"text-sm px-2 py-1",navigation:"p-1",weekdays:"text-xs px-1 py-1"},medium:{container:"text-sm",cell:"w-9 h-9 text-sm",header:"text-base px-3 py-2",navigation:"p-2",weekdays:"text-sm px-2 py-2"},large:{container:"text-base",cell:"w-12 h-12 text-base",header:"text-lg px-4 py-3",navigation:"p-3",weekdays:"text-base px-3 py-2"},auto:{container:"w-full h-full",cell:"flex-1 min-h-[2rem] text-sm",header:"text-base px-3 py-2",navigation:"p-2",weekdays:"text-sm px-2 py-2"}},qt={month:"grid-cols-7",week:"grid-cols-7",day:"grid-cols-1"},Ne={size:"medium",view:"month"},Pt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ce=["January","February","March","April","May","June","July","August","September","October","November","December"],De=100;function Kt({id:r,ref:a,className:t,size:o=Ne.size,customStyles:s={},view:n=Ne.view,mode:i="single",initialDate:d,minDate:c,maxDate:m,renderCell:f,showViewSelector:u=!1,showNavigation:h=!0,navigationLayout:x="around",useMonthYearSelector:b=!1,showTodayButton:y=!1,onDateSelect:p,onRangeSelect:C,...g}){const j=Wt({initialDate:d,mode:i,minDate:c,maxDate:m,view:n,onDateSelect:p,onRangeSelect:C}),k=_t[o],S=qt[j.view],M=T=>{const W=new Date;return T.toDateString()===W.toDateString()},v=T=>T.getMonth()===j.currentDate.getMonth()&&T.getFullYear()===j.currentDate.getFullYear(),D=()=>{j.goToDate(new Date)},N=()=>{const{currentDate:T,view:W}=j,U=ce[T.getMonth()],Z=T.getFullYear();if(W==="month")return`${U} ${Z}`;if(W==="week"){const $=new Date(T);$.setDate(T.getDate()-T.getDay());const V=new Date($);return V.setDate(V.getDate()+6),$.getMonth()===V.getMonth()?`${U} ${$.getDate()}-${V.getDate()}, ${Z}`:`${ce[$.getMonth()]} ${$.getDate()} - ${ce[V.getMonth()]} ${V.getDate()}, ${Z}`}return`${U} ${T.getDate()}, ${Z}`},E=()=>u?e.jsx("div",{className:_,children:["month","week","day"].map(T=>e.jsx("button",{onClick:()=>j.changeView(T),className:w.join("px-2 py-1 rounded capitalize transition-colors",j.view===T?"bg-accent text-accent-foreground":"hover:bg-accent/20"),children:T},T))}):null,I=()=>{if(!b)return null;const T=j.currentDate.getMonth(),W=j.currentDate.getFullYear(),U=W-De,Z=W+De,$=[];for(let H=U;H<=Z;H++)$.push(H);const V=w.join("border border-border rounded px-2 py-1 text-sm focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/50",s.monthYearSelectorsClassName);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:T,onChange:H=>j.changeMonth(parseInt(H.target.value)),className:V,children:ce.map((H,ne)=>e.jsx("option",{value:ne,children:H},H))}),e.jsx("select",{value:W,onChange:H=>j.changeYear(parseInt(H.target.value)),className:V,children:$.map(H=>e.jsx("option",{value:H,children:H},H))})]})},z=()=>{if(!y)return null;const T=w.join("px-3 py-1 text-xs rounded border border-border hover:bg-accent/20 transition-colors focus:outline-none focus:ring focus:ring-accent/50",s.todayButtonClassName);return e.jsx("button",{onClick:D,className:T,"aria-label":"Go to today",children:"Today"})},A=T=>{const W=j.isDateSelected(T),U=j.isDateDisabled(T),Z=M(T),$=j.isDateInRange(T),V=j.isDateRangeStart(T),H=j.isDateRangeEnd(T),ne=v(T),ae=w.join("w-full flex items-center justify-center transition-colors cursor-pointer","focus:outline-none",k.cell),q=w.join(!$&&"rounded-md",!W&&"hover:bg-accent/20 focus:bg-accent/20",ae,s.cellClassName,W&&w.join("bg-accent text-accent-foreground",s.selectedCellClassName),$&&w.join("bg-accent/30",s.rangeCellClassName),V&&w.join("bg-accent text-accent-foreground rounded-r-none",s.rangeStartCellClassName),H&&w.join("bg-accent text-accent-foreground rounded-l-none",s.rangeEndCellClassName),Z&&!W&&w.join("border border-accent",s.todayCellClassName),U&&w.join("opacity-50 cursor-not-allowed hover:bg-transparent",s.disabledCellClassName),j.view==="month"&&!ne&&"text-muted-foreground/50"),Q=f?f(T,!!W,U,Z):T.getDate();return e.jsx("button",{onClick:()=>j.selectDate(T),disabled:U,className:q,"data-date":T.toISOString().split("T")[0],"data-selected":!!W,"data-disabled":U,"data-today":Z,"aria-label":`${T.getDate()} ${ce[T.getMonth()]} ${T.getFullYear()}`,"aria-selected":!!W,"aria-disabled":U,children:Q},T.toISOString())},F=w.join("bg-background border rounded-lg",k.container,s.containerClassName,t),R=w.join("flex items-center border-b px-4 py-2","justify-between",k.header,s.headerClassName),G=w.join("flex items-center gap-1",s.navigationClassName),P=w.join("p-1 rounded hover:bg-accent/20 transition-colors",k.navigation,s.prevButtonClassName),Y=w.join("p-1 rounded hover:bg-accent/20 transition-colors",k.navigation,s.nextButtonClassName),B=w.join("font-semibold text-foreground",s.titleClassName),_=w.join("flex gap-1 text-xs",s.viewSelectorClassName),X=w.join("grid grid-cols-7 border-b text-muted-foreground font-medium",k.weekdays,s.weekdaysClassName),te=w.join("text-center",s.weekdayClassName),K=w.join("grid gap-y-1 p-2",j.view==="month"&&S,j.view==="week"&&w.join(S,s.weekGridClassName),j.view==="day"&&w.join(S,s.dayGridClassName),j.view==="month"&&s.monthGridClassName);return e.jsxs("div",{id:r,ref:a,className:F,"data-size":o,"data-view":j.view,"data-mode":i,role:"application","aria-label":"Calendar",...g,children:[e.jsxs("div",{className:R,children:[x==="adjacent"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4",children:[h&&e.jsxs("div",{className:G,children:[e.jsx("button",{onClick:()=>j.navigate("prev"),className:P,"aria-label":"Previous",children:e.jsx(L.ChevronLeft,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>j.navigate("next"),className:Y,"aria-label":"Next",children:e.jsx(L.ChevronRight,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[!b&&e.jsx("h2",{className:B,children:N()}),I()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[E(),z()]})]}),x==="around"&&e.jsxs(e.Fragment,{children:[h&&e.jsx("button",{onClick:()=>j.navigate("prev"),className:P,"aria-label":"Previous",children:e.jsx(L.ChevronLeft,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[!b&&e.jsx("h2",{className:B,children:N()}),I()]}),e.jsxs("div",{className:"flex items-center gap-2",children:[E(),z()]})]}),h&&e.jsx("button",{onClick:()=>j.navigate("next"),className:Y,"aria-label":"Next",children:e.jsx(L.ChevronRight,{className:"w-4 h-4"})})]})]}),(j.view==="month"||j.view==="week")&&e.jsx("div",{className:X,children:Pt.map(T=>e.jsx("div",{className:te,children:T},T))}),e.jsx("div",{className:K,children:j.daysInView.map(T=>A(T))},`${j.currentDate.getFullYear()}-${j.currentDate.getMonth()}-${j.view}`)]})}const Ht={info:{border:"border-blue-600",interior:"bg-blue-800/20",core:"text-blue-400",description:"text-blue-200"},destructive:{border:"border-destructive",interior:"bg-destructive/10",core:"text-destructive",description:"text-destructive"},success:{border:"border-success",interior:"bg-success/10",core:"text-success",description:"text-success"},warning:{border:"border-yellow-700",interior:"bg-yellow-800/20",core:"text-yellow-400",description:"text-yellow-200"},base:{border:"",interior:"",core:"",description:"opacity-90"}},Zt={info:e.jsx(re.InfoCircled,{size:22}),destructive:e.jsx(re.CrossCircled,{size:22}),success:e.jsx(L.CheckCircled,{size:22}),warning:e.jsx(re.ExclamationTriangle,{size:20}),base:e.jsx(L.DeepRing,{size:22})};function Yt({id:r,ref:a,variant:t="base",icon:o,title:s,description:n,className:i,dismissible:d=!1,onDismiss:c}){const m=l.useId(),f=r||`callout-${m}`,[u,h]=l.useState(!1),x=Ht[t],b=Zt[t],y=()=>{h(!0),c&&c()};return u?null:e.jsxs("div",{id:f,ref:a,className:w.join("relative rounded-lg p-2 sm:p-4 border",x.border,x.interior,i),"data-variant":t,role:"note","aria-describedby":n?`${f}-description`:void 0,"aria-labelledby":s?`${f}-title`:void 0,children:[e.jsxs("div",{className:"flex items-start gap-x-2",children:[o!==null&&e.jsx("span",{className:x.core,children:o===void 0?b:o}),(s||n)&&e.jsxs("div",{className:"flex-1",children:[s&&e.jsx("div",{id:`${f}-title`,className:w.join("font-medium",x.core),children:s}),n&&e.jsx("div",{id:`${f}-description`,className:w.join("mt-0.5 font-light",x.description),children:n})]})]}),d&&e.jsx("button",{type:"button",onClick:y,"data-callout-close-button":"true",className:w.join(x.core,"rounded-md p-0.5 top-2.5 right-2.5 absolute focus:outline-none hover:ring focus:ring-2 focus:ring-current leading-0"),"aria-label":"Close callout",children:e.jsx(re.X,{size:18})})]})}const Ut={sm:{container:"text-sm",header:"text-base font-medium",content:"text-sm leading-relaxed",footer:"text-xs",paddingMulti:1/3},md:{container:"text-base",header:"text-lg font-semibold",content:"text-base leading-relaxed",footer:"text-sm",paddingMulti:1/2},lg:{container:"text-lg",header:"text-xl font-bold",content:"text-lg leading-relaxed",footer:"text-base",paddingMulti:1}};function Qt({id:r,className:a,ref:t,size:o="md",padding:s=16,header:n,footer:i,children:d,imageSrc:c,imageAlt:m,imageComponent:f,imageToEdge:u=!0,...h}){const x=Ut[o],b=c||f;return e.jsxs("div",{id:r,ref:t,"data-testid":"card","data-size":o,"data-padding":s,className:w.join("border border-border rounded-lg shadow-sm","w-full max-w-full",x.container,a),...h,children:[b&&e.jsx("div",{style:u?void 0:{padding:s,paddingBottom:0},className:"w-full overflow-hidden",children:f||e.jsx("img",{src:c,alt:m||"",className:"w-full h-auto object-cover rounded-xs",loading:"lazy"})}),e.jsxs("div",{style:{padding:s,rowGap:s*x.paddingMulti},className:"flex flex-col",children:[n&&e.jsx("div",{className:x.header,children:n}),d&&e.jsx("div",{className:x.content,children:d}),i&&e.jsx("div",{className:x.footer,children:i})]})]})}function Xt({totalItems:r,itemsToShow:a,infinite:t,autoScroll:o,scrollInterval:s,pauseScrollOnHover:n,currentIndex:i,onIndexChange:d}){const[c,m]=l.useState(i||0),[f,u]=l.useState(!1),h=l.useRef(null),x=Math.ceil(r/a),b=t||c>0,y=t||c<x-1,p=l.useCallback(j=>{const k=Math.max(0,Math.min(j,x-1));m(k),d==null||d(k)},[x,d]),C=l.useCallback(()=>{if(b){const j=c===0&&t?x-1:c-1;p(j)}},[c,b,t,x,p]),g=l.useCallback(()=>{if(y){const j=c===x-1&&t?0:c+1;p(j)}},[c,y,t,x,p]);return l.useEffect(()=>{i!==void 0&&i!==c&&m(i)},[i,c]),l.useEffect(()=>{if(!o)return;const j=()=>{h.current=setInterval(()=>{n&&f||g()},s)},k=()=>{h.current&&(clearInterval(h.current),h.current=null)};return!f||!n?j():k(),k},[o,s,n,f,g]),l.useEffect(()=>{m(0)},[a]),{currentSlide:c,canGoPrev:b,canGoNext:y,goToPrev:C,goToNext:g,goToSlide:p,isHovered:f,setIsHovered:u}}const de={sm:{button:"h-6 w-6 text-xs",icon:"size-3"},md:{button:"h-8 w-8 text-sm",icon:"size-4"},lg:{button:"h-10 w-10 text-lg",icon:"size-5"}},Ee={default:"bg-accent text-accent-foreground hover:bg-accent-foreground hover:text-accent",outline:"border border-border bg-background hover:bg-accent hover:text-accent-foreground hover:border-accent",ghost:"hover:text-accent"},ue={aligned:{prev:"absolute top-1/2 -translate-x-1/2 -translate-y-1/2 z-10",next:"absolute right-0 top-1/2 translate-x-1/2 -translate-y-1/2 z-10"},exterior:{prev:"absolute -left-10 top-1/2 -translate-y-1/2 z-10",next:"absolute -right-10 top-1/2 -translate-y-1/2 z-10"},interior:{prev:"absolute left-2 top-1/2 -translate-y-1/2 z-10",next:"absolute right-2 top-1/2 -translate-y-1/2 z-10"}};function Jt({children:r,id:a,ref:t,className:o,autoScroll:s=!1,scrollInterval:n=3e3,pauseScrollOnHover:i=!0,currentIndex:d,onIndexChange:c,hidePrevNext:m=!1,hideDots:f=!1,itemsToShow:u=1,buttonSize:h="md",buttonVariant:x="default",buttonPosition:b="exterior",infinite:y=!0,prevButton:p,nextButton:C,itemsClassName:g,containerClassName:j,dotsClassName:k,gap:S=8}){var W,U;const M=l.useRef(null),v=l.Children.toArray(r).filter(l.isValidElement),D=v.length,{screenSize:N}=Xe.useScreenSize(),E=l.useMemo(()=>{if(typeof u=="number")return u;if(typeof u=="object"&&u&&N){const Z=["2xl","xl","lg","md","sm","xs"],$=Z.indexOf(N);for(let V=$;V<Z.length;V++){const H=Z[V];if(u[H]!==void 0)return u[H]}}return 1},[u,N]),{currentSlide:I,canGoPrev:z,canGoNext:A,goToPrev:F,goToNext:R,goToSlide:G,setIsHovered:P}=Xt({totalItems:D,itemsToShow:E,infinite:y,autoScroll:s,scrollInterval:n,pauseScrollOnHover:i,currentIndex:d,onIndexChange:c}),Y=l.useCallback(Z=>{if(E===1)return{leftWidth:0,rightWidth:0,widthReduction:0};const $=S*(E-1)/E;return Z%E===0?{leftWidth:0,rightWidth:S/2,widthReduction:$}:Z%E===E-1?{leftWidth:S/2,rightWidth:0,widthReduction:$}:{leftWidth:S/2,rightWidth:S/2,widthReduction:$}},[E,S]),B=()=>{F()},_=()=>{R()},X=()=>{i&&P(!0)},te=()=>{i&&P(!1)},K=-(I*(100/D)*E),T=w.join("inline-flex items-center justify-center rounded-md font-medium transition-all focus-visible:outline-none focus-visible:ring focus-visible:ring-ring disabled:pointer-events-none",b==="aligned"?"disabled:opacity-90":"disabled:opacity-50");return e.jsxs("div",{className:w.join("relative",o),"data-carousel-wrapper":"true",children:[!m&&e.jsx(e.Fragment,{children:p?l.cloneElement(p,{onClick:B,disabled:!z,className:w.join(((W=p.props)==null?void 0:W.className)||"",ue[b].prev),role:"button","aria-disabled":!z,"aria-label":"Previous slide","data-carousel-prev":"true"}):e.jsx("button",{type:"button",onClick:B,disabled:!z,className:w.join(T,de[h].button,Ee[x],ue[b].prev),"aria-disabled":!z,"aria-label":"Previous slide","data-carousel-prev":"true",children:e.jsx(L.ChevronLeft,{className:de[h].icon})})}),e.jsxs("div",{id:a,ref:t,className:w.join("relative overflow-hidden",j),onMouseEnter:X,onMouseLeave:te,"data-carousel":"true","data-current-index":I,"data-items-to-show":E,"data-auto-scroll":s,"data-button-position":b,children:[e.jsx("div",{ref:M,className:"flex transition-transform ease-in-out",style:{transform:`translateX(${K}%)`,width:`${D/E*100}%`},children:v.map((Z,$)=>{const{leftWidth:V,rightWidth:H,widthReduction:ne}=Y($);return e.jsx("div",{className:w.join("flex-shrink-0",g),style:{width:`calc(${100/D}% - ${ne}px)`,marginRight:H>0?`${H}px`:void 0,marginLeft:V>0?`${V}px`:void 0},"data-slide-index":$,children:Z},$)})}),!f&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex space-x-2",children:Array.from({length:Math.ceil(D/E)}).map((Z,$)=>e.jsx("button",{type:"button",onClick:()=>G($),className:w.join("w-2 h-2 rounded-full transition-colors",$===I?"bg-accent":"bg-muted-foreground/60 hover:bg-muted-foreground/100",k),"aria-label":`Go to slide ${$+1}`,"data-carousel-dot":$},$))})]}),!m&&e.jsx(e.Fragment,{children:C?l.cloneElement(C,{onClick:_,disabled:!A,className:w.join(((U=C.props)==null?void 0:U.className)||"",ue[b].next),role:"button","aria-disabled":!A,"aria-label":"Next slide","data-carousel-next":"true"}):e.jsx("button",{type:"button",onClick:_,disabled:!A,className:w.join(T,de[h].button,Ee[x],ue[b].next),"aria-disabled":!A,"aria-label":"Next slide","data-carousel-next":"true",children:e.jsx(L.ChevronRight,{className:de[h].icon})})})]})}function Ot({children:r,className:a,linkTo:t,linkProps:o,onButtonClick:s,buttonProps:n,...i}){return t&&s&&console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'),e.jsxs("div",{className:w.join("relative w-fit",a),...i,children:[r,t&&e.jsx("a",{...o,rel:(o==null?void 0:o.rel)||"noreferrer",href:t,className:w.join("absolute inset-0",o==null?void 0:o.className)}),!t&&s&&e.jsx("button",{...n,type:"button",onClick:s,className:w.join("absolute inset-0 cursor-pointer",n==null?void 0:n.className)})]})}function er(r){const[a,t]=l.useState(null);return l.useEffect(()=>{var d;const o=(d=document.getElementById(r))==null?void 0:d.parentElement;if(!o)return;const s=()=>{const c=window.getComputedStyle(o),m=parseFloat(c.fontSize),f=c.lineHeight==="normal"?m*1.2:parseFloat(c.lineHeight),u=m-2,h=u/m,x=f*h;t({fontSize:m,lineHeight:f,smallerFontSize:u,smallerLineHeight:x})};s();const n=new ResizeObserver(s);n.observe(o);const i=new MutationObserver(s);return i.observe(o,{attributes:!0,attributeFilter:["style","class"],subtree:!1}),()=>{n.disconnect(),i.disconnect()}},[r]),a}const tr={base:"",modest:"opacity-90 bg-muted/10",accent:"text-accent bg-muted/10",current:"text-current bg-current/10"};function rr({id:r,ref:a,content:t,variant:o="accent",className:s,style:n,...i}){const d=l.useId(),c=r||`code-${d}`,m=er(c);return e.jsx("code",{id:c,ref:a,className:w.join("px-2 py-1 rounded",tr[o],s),"data-variant":o,style:{fontSize:m?`${m.smallerFontSize}px`:void 0,lineHeight:m?`${m.smallerLineHeight}px`:void 0,...n},...i,children:t})}const sr={keyword:"text-rose-400",runner:"text-amber-400",comment:"text-gray-500/80",command:"text-gray-100",variable:"text-blue-400",string:"text-white/70",option:"text-purple-400",plain:"text-gray-200",operator:"text-pink-500",substitution:"text-green-300"},nr={selector:"text-blue-400 font-medium",property:"text-purple-400",value:"text-green-400",punctuation:"text-gray-400",atRule:"text-pink-400 font-semibold",comment:"text-gray-500 italic",string:"text-green-400",number:"text-green-400",plain:"text-gray-100",function:"text-cyan-400"},ar={key:"text-purple-400 font-semibold",string:"text-green-400",number:"text-orange-400 font-medium",boolean:"text-cyan-400 font-medium",punctuation:"text-gray-400",plain:"text-gray-100"},or={heading:"text-blue-400 font-bold","heading-hash":"text-gray-500",bold:"text-white font-bold",italic:"text-white italic","bold-marker":"text-gray-400","italic-marker":"text-gray-400",link:"text-blue-400 underline","link-text":"text-blue-400","link-url":"text-green-400","link-bracket":"text-gray-400","link-paren":"text-gray-400",code:"text-pink-400 bg-gray-800 px-1 rounded text-sm","code-marker":"text-gray-500","code-block":"text-green-400","code-block-marker":"text-gray-500","list-marker":"text-orange-400 font-medium","list-item":"text-gray-200",blockquote:"text-gray-300 italic","blockquote-marker":"text-gray-500",plain:"text-gray-200"},lr={keyword:"text-purple-400 font-semibold",type:"text-cyan-400 font-medium",string:"text-green-400","jsx-bracket":"text-gray-400","jsx-tag":"text-blue-400 font-medium","jsx-attribute":"text-amber-400","jsx-brace":"text-yellow-400",jsx:"text-blue-400 font-medium",property:"text-amber-400",number:"text-orange-400 font-medium",comment:"text-gray-500 italic",function:"text-rose-400 font-semibold",hook:"text-rose-400 font-semibold",operator:"text-gray-300",plain:"text-gray-100"},ir=new Set(["for","in","do","done","else","if","fi","then","while","until","case","esac"]),cr=new Set(["npm","npx","pnpm","yarn","vite"]);function dr(r){const a=[];let t=0;for(a.push({text:"`",type:"string"}),t=1;t<r.length;){const o=r[t];if(o==="`"){a.push({text:"`",type:"string"}),t++;break}if(o==="$"&&t+1<r.length&&r[t+1]==="{"){a.push({text:"${",type:"string"}),t+=2;let n=1;const i=t;for(;t<r.length&&n>0;)r[t]==="{"?n++:r[t]==="}"&&n--,n>0&&t++;if(n===0){const d=r.slice(i,t);if(d.trim().length>0){const c=he(d,!1,0);a.push(...c)}a.push({text:"}",type:"string"}),t++}else a.push({text:r.slice(i,t),type:"string"});continue}const s=t;for(;t<r.length&&r[t]!=="`"&&!(r[t]==="$"&&t+1<r.length&&r[t+1]==="{");)t++;t>s&&a.push({text:r.slice(s,t),type:"string"})}return{tokens:a,consumed:t}}function ur(r){const a=[];let t=0;for(;t<r.length;){const o=r[t];if(o==="`"){if(a.push({text:"`",type:"string"}),t++,t<r.length){const n=he(r.slice(t),!1,0,!1);a.push(...n)}break}if(o==="$"&&t+1<r.length&&r[t+1]==="{"){a.push({text:"${",type:"string"}),t+=2;let n=1;const i=t;for(;t<r.length&&n>0;)r[t]==="{"?n++:r[t]==="}"&&n--,n>0&&t++;if(n===0){const d=r.slice(i,t);if(d.trim().length>0){const c=he(d,!1,0,!1);a.push(...c)}a.push({text:"}",type:"string"}),t++}else{a.push({text:r.slice(i),type:"string"});break}continue}const s=t;for(;t<r.length&&r[t]!=="`"&&!(r[t]==="$"&&t+1<r.length&&r[t+1]==="{");)t++;t>s&&a.push({text:r.slice(s,t),type:"string"})}return{tokens:a}}function qe(r){const a=[];if(r.trim()==="")return a.push({text:" ",type:"plain"}),a;if(r.trim().startsWith("#"))return a.push({text:r,type:"comment"}),a;const t=/(\$\([^)]*\)|"[^"]*"|'[^']*'|\$[\w_]+|[a-zA-Z_]\w*=|--?[a-zA-Z0-9][\w-]*(?:=.*)?|>>|>|#.*|\s+|[^\s]+)/g,o=n=>{if(/^\$\([^)]*\)$/.test(n)){const i=n.slice(2,-1);return[{text:"$(",type:"operator"},...qe(i),{text:")",type:"operator"}]}if(/^".*"$/.test(n)){const i=n.slice(1,-1),d=[];let c=0;const m=/\$[\w_]+/g;let f;for(;(f=m.exec(i))!==null;)f.index>c&&d.push({text:i.slice(c,f.index),type:"string"}),d.push({text:f[0],type:"variable"}),c=f.index+f[0].length;return c<i.length&&d.push({text:i.slice(c),type:"string"}),[{text:'"',type:"string"},...d,{text:'"',type:"string"}]}return/^'.*'$/.test(n)?[{text:n,type:"string"}]:/^\$[\w_]+$/.test(n)?[{text:n,type:"variable"}]:/^[a-zA-Z_]\w*=$/.test(n)?[{text:n,type:"variable"}]:/^--?[a-zA-Z0-9][\w-]*(=.*)?$/.test(n)?[{text:n,type:"option"}]:/^>>|>$/.test(n)?[{text:n,type:"operator"}]:/^#.*$/.test(n)?[{text:n,type:"comment"}]:/^\s+$/.test(n)?[{text:n,type:"plain"}]:ir.has(n)?[{text:n,type:"keyword"}]:cr.has(n)?[{text:n,type:"runner"}]:[{text:n,type:"command"}]};let s;for(;(s=t.exec(r))!==null;)a.push(...o(s[0]));return a}function fr(r,a=!1){const t=[];let o=a;if(r.trim()==="")return t.push({text:" ",type:"plain"}),{tokens:t,inComment:o};let s="selector",n=0;r.match(/^\s+/)&&r.includes(":")&&!r.includes("{")&&(s="property",n=1);const i=/(\/\*[\s\S]*?\*\/|\/\*[\s\S]*$|\*\/)|(@[a-zA-Z-]+)|(\{|\}|:|;|,|\(|\))|("(?:[^"]*)"|'(?:[^']*)')|([a-zA-Z-]+)(?=\()|([0-9.]+(?:px|rem|em|%|vh|vw|deg|s|ms|fr)?)|(#[a-fA-F0-9]{3,8})|([a-zA-Z0-9_-]+|[.#][a-zA-Z0-9_-]+)|(\s+)|(\S+)/g;let d;for(;d=i.exec(r);){const[,c,m,f,u,h,x,b,y,p,C]=d;if(c)c.includes("/*")&&!c.includes("*/")?o=!0:c.includes("*/")&&(o=!1),t.push({text:c,type:"comment"});else if(o)d[0].includes("*/")&&(o=!1),t.push({text:d[0],type:"comment"});else if(m)t.push({text:m,type:"atRule"});else if(h)t.push({text:h,type:"function"});else if(f)f==="{"?(n++,s="property"):f==="}"?(n--,s=n>0?"property":"selector"):f===":"?s==="property"&&(s="value"):f===";"?n>0&&(s="property"):f===","&&n===0&&(s="selector"),t.push({text:f,type:"punctuation"});else if(u)t.push({text:u,type:"string"});else if(x)t.push({text:x,type:"number"});else if(b)t.push({text:b,type:"value"});else if(y){let g;y.startsWith(".")||y.startsWith("#")||s==="selector"?g="selector":s==="property"?g="property":g="value",t.push({text:y,type:g})}else if(p)t.push({text:p.replace(/ /g," "),type:"plain"});else if(C){const g=s==="value"?"value":"plain";t.push({text:C,type:g})}}return{tokens:t,inComment:o}}function xr(r){const a=/("[^"]*")\s*(:)|("[^"]*")|(\d+)|(true|false|null)|(\{|\}|\[|\]|,)/g,t=[];let o=0,s;for(;(s=a.exec(r))!==null;)s.index>o&&t.push({text:r.slice(o,s.index),type:"plain"}),s[1]&&s[2]?(t.push({text:s[1],type:"key"}),t.push({text:s[2],type:"punctuation"})):s[3]?t.push({text:s[3],type:"string"}):s[4]?t.push({text:s[4],type:"number"}):s[5]?t.push({text:s[5],type:"boolean"}):s[6]&&t.push({text:s[6],type:"punctuation"}),o=a.lastIndex;return o<r.length&&t.push({text:r.slice(o),type:"plain"}),t}function he(r,a=!1,t=0,o=!1){const s=[];let n=r,i=a,d=t;if(o){const c=ur(n);return s.push(...c.tokens),s}for(;n.length>0;){const c=n.match(/^\/\*[\s\S]*?\*\//);if(c){s.push({text:c[0],type:"comment"}),n=n.slice(c[0].length);continue}const m=n.match(/^\/\/.*$/m);if(m){s.push({text:m[0],type:"comment"}),n=n.slice(m[0].length);continue}if(n.match(/^`/)){const D=dr(n);s.push(...D.tokens),n=n.slice(D.consumed);continue}const u=n.match(/^("[^"]*"|'[^']*')/);if(u){s.push({text:u[0],type:"string"}),n=n.slice(u[0].length);continue}const h=n.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);if(h){s.push({text:"<",type:"jsx-bracket"}),s.push({text:h[1],type:"jsx-tag"}),n=n.slice(h[0].length),i=!0;continue}const x=n.match(/^<\/([a-zA-Z][a-zA-Z0-9]*)>/);if(x){s.push({text:"</",type:"jsx-bracket"}),s.push({text:x[1],type:"jsx-tag"}),s.push({text:">",type:"jsx-bracket"}),n=n.slice(x[0].length),i=!1;continue}if(n.match(/^\/?>/)){const D=n.match(/^(\/?>\s*)/);if(D){s.push({text:D[1].trim(),type:"jsx-bracket"}),n=n.slice(D[1].length),D[1].includes(">")&&(i=!1);continue}}const b=n.match(/^([a-zA-Z][a-zA-Z0-9]*)(\s*)(=)/);if(b&&i&&d===0){s.push({text:b[1],type:"jsx-attribute"}),b[2]&&s.push({text:b[2],type:"plain"}),s.push({text:"=",type:"plain"}),n=n.slice(b[0].length);continue}const y=n.match(/^[{}]/);if(y){s.push({text:y[0],type:"jsx-brace"}),y[0]==="{"?d++:y[0]==="}"&&d--,n=n.slice(1);continue}const p=n.match(/^\s+/);if(p){s.push({text:p[0],type:"plain"}),n=n.slice(p[0].length);continue}const C=n.match(/^(=>|===|!==|==|!=|<=|>=|&&|\|\||[+\-*/%=<>!&|^~?:;,()[\]{}.])/);if(C){s.push({text:C[0],type:"operator"}),n=n.slice(C[0].length);continue}const g=n.match(/^(const|let|var|function|if|else|for|while|return|import|export|class|extends|interface|type|enum|async|await|public|private|protected|static|from|as|default|new|this|super|try|catch|finally|throw|break|continue|switch|case|typeof|instanceof)\b/);if(g){s.push({text:g[0],type:"keyword"}),n=n.slice(g[0].length);continue}const j=n.match(/^(use[A-Z][a-zA-Z]*)\b/);if(j){s.push({text:j[0],type:"hook"}),n=n.slice(j[0].length);continue}const k=n.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=(\?\.)?\()/);if(k){s.push({text:k[1],type:"function"}),n=n.slice(k[1].length);continue}const S=n.match(/^(string|number|boolean|object|any|void|never|unknown|null|undefined|Promise|Array|React\.FC|FC|JSX\.Element|HTMLElement|Event|MouseEvent|KeyboardEvent|ChangeEvent)\b/);if(S){s.push({text:S[0],type:"type"}),n=n.slice(S[0].length);continue}const M=n.match(/^(\d+\.?\d*)/);if(M){s.push({text:M[0],type:"number"}),n=n.slice(M[0].length);continue}const v=n.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=:)/);if(v&&!i){s.push({text:v[1],type:"property"}),n=n.slice(v[1].length);continue}s.push({text:n[0],type:"plain"}),n=n.slice(1)}return s}function mr(r){const a=[];if(r.trim()==="")return a.push({text:" ",type:"plain"}),a;const t=r,o=t.match(/^(#{1,6})\s*(.*)$/);if(o)return a.push({text:o[1],type:"heading-hash"}),o[2]&&(a.push({text:" ",type:"plain"}),a.push({text:o[2],type:"heading"})),a;const s=t.match(/^(>\s*)(.*)$/);if(s)return a.push({text:s[1],type:"blockquote-marker"}),s[2]&&a.push({text:s[2],type:"blockquote"}),a;const n=t.match(/^(\s*)([-*+]|\d+\.)\s*(.*)$/);if(n)return n[1]&&a.push({text:n[1],type:"plain"}),a.push({text:n[2],type:"list-marker"}),a.push({text:" ",type:"plain"}),n[3]&&Se(n[3],a),a;const i=t.match(/^(```)\s*(.*)$/);return i?(a.push({text:i[1],type:"code-block-marker"}),i[2]&&(a.push({text:" ",type:"plain"}),a.push({text:i[2],type:"code-block"})),a):(Se(t,a),a)}function Se(r,a){let t=r;for(;t.length>0;){const o=t.match(/^(\[)([^\]]*?)(\])(\()([^)]*?)(\))/);if(o){a.push({text:o[1],type:"link-bracket"}),a.push({text:o[2],type:"link-text"}),a.push({text:o[3],type:"link-bracket"}),a.push({text:o[4],type:"link-paren"}),a.push({text:o[5],type:"link-url"}),a.push({text:o[6],type:"link-paren"}),t=t.slice(o[0].length);continue}const s=t.match(/^(`+)([^`]*?)\1/);if(s){a.push({text:s[1],type:"code-marker"}),a.push({text:s[2],type:"code"}),a.push({text:s[1],type:"code-marker"}),t=t.slice(s[0].length);continue}const n=t.match(/^(\*\*|__)([^*_]*?)\1/);if(n){a.push({text:n[1],type:"bold-marker"}),a.push({text:n[2],type:"bold"}),a.push({text:n[1],type:"bold-marker"}),t=t.slice(n[0].length);continue}const i=t.match(/^(\*|_)([^*_]*?)\1/);if(i){a.push({text:i[1],type:"italic-marker"}),a.push({text:i[2],type:"italic"}),a.push({text:i[1],type:"italic-marker"}),t=t.slice(i[0].length);continue}a.push({text:t[0],type:"plain"}),t=t.slice(1)}}function hr(r,a){const t={...sr,...a};return r.map((o,s)=>{const n=qe(o);return e.jsx("div",{className:"leading-6",children:n.map((i,d)=>e.jsx("span",{className:t[i.type]||"text-gray-100",children:i.text},d))},s)})}function pr(r,a){const t={...nr,...a};let o=!1;return r.map((s,n)=>{const{tokens:i,inComment:d}=fr(s,o);return o=d,e.jsx("div",{className:"leading-6",children:i.map((c,m)=>e.jsx("span",{className:t[c.type]||"text-gray-100",children:c.text},m))},n)})}function br(r,a){const t={...ar,...a};return r.map((o,s)=>e.jsx("div",{className:"leading-6",children:xr(o).map((n,i)=>e.jsx("span",{className:t[n.type]||"text-gray-100",children:n.text},i))},s))}function gr(r,a){const t={...lr,...a};let o=!1,s=0,n=!1;return r.map((i,d)=>{if(i.trim()==="")return e.jsx("div",{className:"leading-6",children:" "},d);const c=he(i,o,s,n);(i.match(/`/g)||[]).length%2===1&&(n=!n),i.includes("<")&&i.match(/<[a-zA-Z]/)&&(o=!0),i.includes(">")&&!i.includes("<")&&(o=!1,s=0);const f=(i.match(/\{/g)||[]).length,u=(i.match(/\}/g)||[]).length;return s+=f-u,s<0&&(s=0),e.jsx("div",{className:"leading-6",children:c.map((h,x)=>e.jsx("span",{className:t[h.type]||"text-gray-100",children:h.text},x))},d)})}function vr(r,a){const t={...or,...a};return r.map((o,s)=>e.jsx("div",{className:"leading-6",children:mr(o).map((n,i)=>e.jsx("span",{className:t[n.type]||"text-gray-100",children:n.text},i))},s))}function yr(r){const[a,t]=l.useState(!1),o=l.useCallback(async()=>{try{await navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),3e3)}catch(s){console.error("Failed to copy code:",s)}},[r]);return{copied:a,handleCopy:o}}function jr(r,a){const t=l.useRef(null),o=l.useRef(null);return l.useEffect(()=>{if(r){t.current=document.activeElement,document.body.style.overflow="hidden",setTimeout(()=>{var n;(n=o.current)==null||n.focus()},100);const s=n=>{n.key==="Escape"&&a(!1)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),document.body.style.overflow=""}}else t.current&&(t.current.focus(),t.current=null)},[r,a]),{containerRef:o}}function wr(r,a,t,o){return{handleKeyDown:l.useCallback(n=>{n.key==="c"&&(n.metaKey||n.ctrlKey)&&r?(n.preventDefault(),t()):n.key==="f"&&a&&(n.preventDefault(),o())},[r,a,t,o])}}function kr(r){switch(r){case"typescript":case"ts":return"ts";case"tsx":return"tsx";case"json":return"json";case"bash":case"sh":return"sh";case"css":return"css";case"markdown":case"md":return"md";default:return"txt"}}function Cr({code:r,language:a="typescript",allowCopy:t=!0,allowDownload:o=!1,allowFullscreen:s=!1,filename:n,showTrafficLights:i=!0,showLineNumbers:d=!1,hideHeader:c=!1,hideFiletype:m=!1,maxHeight:f,tokenClasses:u,className:h,id:x,ref:b,...y}){const[p,C]=l.useState(!1),{containerRef:g}=jr(p,C),{copied:j,handleCopy:k}=yr(r),S=l.useCallback(()=>{const F=n||`code.${kr(a)}`;je.downloadFile(r,F)},[r,n,a]),M=l.useCallback(()=>{C(F=>!F)},[]),{handleKeyDown:v}=wr(t,s,k,M),D=l.useMemo(()=>r.split(`
2
+ `),[r]),N=l.useCallback((F=!0)=>e.jsxs("div",{className:w.join("flex items-center space-x-2",!F&&"absolute top-2 right-2 z-10"),children:[!m&&e.jsx("span",{className:"text-xs text-gray-400 uppercase tracking-wide font-medium","aria-label":`Code language: ${a}`,children:a}),s&&e.jsx("button",{onClick:M,className:"p-1.5 leading-0 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors motion-reduce:transition-none min-h-[44px] min-w-[44px] flex items-center justify-center md:min-h-auto md:min-w-auto md:p-1.5",title:p?"Exit fullscreen":"Fullscreen","aria-label":p?"Exit fullscreen mode":"Enter fullscreen mode","aria-pressed":p,type:"button",children:p?e.jsx(L.Dash,{size:14}):e.jsx(L.Window,{size:14})}),o&&e.jsx("button",{onClick:S,className:"p-1.5 leading-0 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors motion-reduce:transition-none min-h-[44px] min-w-[44px] flex items-center justify-center md:min-h-auto md:min-w-auto md:p-1.5",title:"Download code","aria-label":"Download code as file",type:"button",children:e.jsx(L.Download,{size:14})}),t&&e.jsx("button",{onClick:k,className:"p-1.5 leading-0 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors motion-reduce:transition-none min-h-[44px] min-w-[44px] flex items-center justify-center md:min-h-auto md:min-w-auto md:p-1.5",title:j?"Code copied!":"Copy code","aria-label":j?"Code copied to clipboard":"Copy code to clipboard","aria-live":"polite",type:"button",children:j?e.jsx(L.Check,{size:14,className:"text-green-400"}):e.jsx(L.Copy,{size:14})})]}),[m,a,s,p,o,S,t,k,j,M]),E=l.useMemo(()=>a==="json"?br(D,u):a==="tsx"||a==="ts"||a==="typescript"?gr(D,u):a==="bash"||a==="sh"?hr(D,u):a==="css"?pr(D,u):a==="markdown"||a==="md"?vr(D,u):[e.jsx("span",{className:"text-gray-400",children:"Unsupported language"},0)],[D,u,a]),I=l.useMemo(()=>d?D.map((F,R)=>e.jsx("div",{className:"text-gray-500 text-right pl-3 pr-1 select-none min-w-8 text-sm font-mono leading-6","aria-hidden":"true",role:"presentation",children:R+1},R)):null,[d,D]),z=l.useMemo(()=>({maxHeight:f&&!p?`${f}px`:p?c?"calc(100vh - 5px)":"calc(100vh - 45px)":void 0,overflow:f||p?"auto":"visible"}),[f,p,c]),A=e.jsxs("div",{id:x,ref:F=>{g.current=F,typeof b=="function"?b(F):b&&(b.current=F)},className:w.join("bg-gray-900 rounded-lg border border-gray-700 overflow-hidden motion-reduce:transition-none",p&&"fixed inset-0 z-[9999] max-h-fit",h),"data-language":a,"data-filename":n,"data-fullscreen":p,role:"region","aria-label":`Code block${n?` for ${n}`:""} in ${a}`,"aria-describedby":d?`${x}-description`:void 0,tabIndex:0,onKeyDown:v,...y,children:[d&&e.jsxs("div",{id:`${x}-description`,className:"sr-only",children:["Code block with line numbers. Use Cmd+C or Ctrl+C to copy code.",s&&" Press F to toggle fullscreen."]}),e.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:j&&"Code copied to clipboard"}),!c&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-800 border-b border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[i&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("div",{className:"w-3 h-3 bg-red-500 rounded-full"}),e.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full"}),e.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full"})]}),n&&e.jsx("span",{className:"text-sm text-gray-300 font-medium",children:n})]}),N(!0)]}),e.jsxs("div",{className:w.join("flex overflow-hidden",c&&"relative"),style:z,children:[c&&N(!1),e.jsx("div",{className:"flex-1 overflow-x-auto",children:e.jsxs("div",{className:"flex",children:[d&&e.jsx("div",{className:"bg-gray-800 py-4 border-r border-gray-700 flex flex-col flex-shrink-0","aria-hidden":"true",role:"presentation",children:I}),e.jsx("div",{className:"flex-1 p-4",children:e.jsx("pre",{className:"text-sm font-mono focus:outline-none",role:"code","aria-label":`${a} code content`,tabIndex:-1,children:e.jsx("code",{children:E})})})]})})]})]});return e.jsxs(e.Fragment,{children:[!p&&A,p&&ye.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black z-[9998]",onClick:()=>C(!1),"aria-hidden":"true"}),A]}),document.body)]})}function Nr({textToCopy:r,delay:a=2e3,children:t,icon:o,copiedIcon:s,showCopyText:n=!1,iconSize:i=16,className:d,onClick:c,variant:m,size:f,rounded:u,id:h,disabled:x,ref:b}){const[y,p]=l.useState(!1),C=l.useCallback(async S=>{try{await navigator.clipboard.writeText(S),p(!0),setTimeout(()=>{p(!1)},a)}catch(M){console.error("Failed to copy text:",M)}},[a]),g=S=>{C(r),c&&c(S)},k=t||n?"inline mr-2":"inline";return e.jsx(J.Button,{variant:m,size:f,rounded:u,id:h,disabled:x,ref:b,onClick:g,className:w.join(d),"data-copied":y,"aria-label":y?"Copied to clipboard":"Copy to clipboard",children:y?e.jsxs(e.Fragment,{children:[s??e.jsx(L.Check,{size:i,className:k}),t||n&&"Copied!"]}):e.jsxs(e.Fragment,{children:[o??e.jsx(L.Copy,{size:i,className:k}),t||n&&"Copy"]})})}function Dr({children:r,label:a,isOpen:t,onToggle:o,id:s,ref:n,disabled:i=!1,className:d,buttonClassName:c}){const m=l.useId(),f=s??m,[u,h]=l.useState(!1),x=t!==void 0?t:u,b=()=>{i||(t===void 0&&h(y=>!y),o==null||o(!x))};return l.useEffect(()=>{h(t??!1)},[t]),e.jsxs("div",{ref:n,id:f,"data-open":x,className:w.join("overflow-hidden",d),children:[e.jsx("button",{id:`${f}-button`,type:"button","aria-expanded":x,"aria-controls":`${f}-panel`,disabled:i,tabIndex:0,className:w.join("w-full px-4 py-3 font-medium hover:bg-primary/10 disabled:opacity-50 disabled:cursor-not-allowed",c),onClick:b,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),b())},"data-open":x,"data-label":typeof a=="string"?a:void 0,children:e.jsxs("div",{className:"flex items-center w-full gap-2",children:[e.jsx("span",{className:"flex-1 text-left",children:a}),x?e.jsx(L.CaretCollapse,{className:"size-5","aria-hidden":"true"}):e.jsx(L.CaretExpand,{className:"size-5","aria-hidden":"true"})]})}),e.jsx("div",{id:`${f}-panel`,role:"region","aria-labelledby":f,"aria-live":"polite",hidden:!x,children:r})]})}function Er(r){const[a,t]=l.useState(!1),[o,s]=l.useState(!1);return l.useEffect(()=>{if(r){s(!0);const n=setTimeout(()=>t(!0),10);return()=>clearTimeout(n)}else{t(!1);const n=setTimeout(()=>s(!1),300);return()=>clearTimeout(n)}},[r]),{show:a,shouldRender:o}}function Sr({isOpen:r,onClose:a,enabled:t=!0}){const[o,s]=l.useState(!1),[n,i]=l.useState(0),[d,c]=l.useState(0),m=l.useCallback(k=>{!t||!r||(s(!0),c(k),document.body.style.userSelect="none")},[t,r]),f=l.useCallback(k=>{if(!o||!t)return;const S=k-d,M=Math.max(0,S);i(M)},[o,t,d]),u=l.useCallback(()=>{if(!o||!t)return;s(!1),document.body.style.userSelect="",n>100&&a(),i(0)},[o,t,n,a]),h=l.useCallback(k=>{k.preventDefault(),m(k.clientY)},[m]),x=l.useCallback(k=>{f(k.clientY)},[f]),b=l.useCallback(()=>{u()},[u]),y=l.useCallback(k=>{k.preventDefault(),m(k.touches[0].clientY)},[m]),p=l.useCallback(k=>{k.preventDefault(),f(k.touches[0].clientY)},[f]),C=l.useCallback(()=>{u()},[u]);l.useEffect(()=>{if(o)return document.addEventListener("mousemove",x),document.addEventListener("mouseup",b),document.addEventListener("touchmove",p,{passive:!1}),document.addEventListener("touchend",C),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",b),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",C)}},[o,x,b,p,C]);const g=l.useCallback(k=>{t&&(k.key==="ArrowDown"||k.key==="Escape")&&(k.preventDefault(),a())},[t,a]);return{dragHandlers:t?{onMouseDown:h,onTouchStart:y,onKeyDown:g}:{},translateY:n,isDragging:o}}function Fr(r,a){const t=l.useRef(null);l.useEffect(()=>{if(!a)return;t.current=document.activeElement;const o=document.getElementById(r);o&&o.focus();const s=n=>{if(n.key!=="Tab")return;const i=document.getElementById(r);if(!i)return;const d=i.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),c=d[0],m=d[d.length-1];n.shiftKey&&document.activeElement===c?(n.preventDefault(),m==null||m.focus()):!n.shiftKey&&document.activeElement===m&&(n.preventDefault(),c==null||c.focus())};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),t.current&&typeof t.current.focus=="function"&&t.current.focus()}},[r,a])}function Ir(r,a){l.useEffect(()=>{if(!r)return;const t=window.getComputedStyle(document.body).overflow;document.body.style.overflow="hidden";const o=s=>{s.key==="Escape"&&a()};return document.addEventListener("keydown",o),()=>{document.body.style.overflow=t,document.removeEventListener("keydown",o)}},[r,a])}function Ar({ref:r,id:a,isOpen:t,onClose:o,title:s,children:n,footer:i,className:d,overlayClassName:c,showCloseButton:m=!1,disableCloseOnOverlayClick:f=!1,enableDragGestures:u=!0,ariaLabelledBy:h,ariaDescribedBy:x}){const b=l.useId(),y=a||`drawer-${b}`,p=`${b}-title`,{show:C,shouldRender:g}=Er(t),{dragHandlers:j,translateY:k,isDragging:S}=Sr({isOpen:t,onClose:o,enabled:u});if(Fr(y,g),Ir(g,o),!g)return null;const M=()=>s?l.isValidElement(s)?e.jsx("div",{children:s}):e.jsx("h2",{className:"text-2xl font-semibold",id:p,children:s}):null,v=()=>{if(!i)return null;if(l.isValidElement(i)){const D=i,N=D.props.className||"";return l.cloneElement(D,{className:w.join("px-6 py-4",N)})}return e.jsx("div",{className:"px-6 py-4",children:i})};return e.jsx(e.Fragment,{children:ye.createPortal(e.jsxs("div",{"aria-labelledby":h??s?p:void 0,"aria-describedby":x,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[100] overflow-hidden","data-drawer-open":t,children:[e.jsx("div",{className:w.join("fixed inset-0 bg-black/40 transition-opacity",C?"opacity-100":"opacity-0",c),onClick:()=>{f||o()}}),e.jsx("div",{className:"fixed inset-x-0 bottom-0 flex max-h-full",children:e.jsx("div",{id:y,ref:r,tabIndex:-1,className:w.join("relative w-screen transform shadow-xl bg-popover text-popover-foreground transition-transform ease-in-out border-t border-border rounded-t-lg",C?"translate-y-0":"translate-y-full",d),style:{transform:u&&k!==0?`translateY(${k}px)`:void 0,transition:k!==0?"none":void 0},children:e.jsxs("div",{className:"flex h-full flex-col",children:[u&&e.jsx("div",{className:w.join("flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing",u&&"select-none"),...j,role:u?"button":void 0,tabIndex:u?0:void 0,"aria-label":u?"Drag to resize drawer":void 0,children:e.jsx("div",{className:w.join("w-12 h-1.5 bg-popover-foreground/25 rounded-full transition-colors",u&&"hover:bg-popover-foreground/50",S&&"bg-popover-foreground/50")})}),s&&e.jsx("div",{className:"px-6 pt-4",children:M()}),m&&e.jsx("button",{type:"button",onClick:o,"data-drawer-close-button":"true","aria-label":"Close drawer",className:"rounded-md p-0.5 top-3 right-3 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0",children:e.jsx(re.X,{size:18})}),e.jsx("div",{className:w.join("flex-1 overflow-y-auto px-6 pb-6",s?"pt-6":"pt-4"),children:n}),v()]})})})]}),document.body)})}function $r(r){switch(r){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}function Mr({internalIsOpen:r,autoSwitchPlacement:a,placement:t,offset:o,triggerRef:s,popoverRef:n}){const[i,d]=l.useState(t);return l.useEffect(()=>{if(!r||!a)return;const c=()=>{if(!s.current||!n.current)return;const u=s.current.getBoundingClientRect(),h=n.current.getBoundingClientRect(),x=window.innerWidth,b=window.innerHeight;let y=t;const p=$r(t);if(t==="top"||t==="bottom"){const C=t==="top"?u.top>=h.height+o:b-u.bottom>=h.height+o,g=p==="top"?u.top>=h.height+o:b-u.bottom>=h.height+o;!C&&g&&(y=p)}else{const C=t==="left"?u.left>=h.width+o:x-u.right>=h.width+o,g=p==="left"?u.left>=h.width+o:x-u.right>=h.width+o;!C&&g&&(y=p)}d(y)};c();const m=()=>c();window.addEventListener("scroll",m,!0),window.addEventListener("resize",m);const f=new ResizeObserver(c);return s.current&&f.observe(s.current),n.current&&f.observe(n.current),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m),f.disconnect()}},[r,t,o,a,s,n]),i}const zr={bottom:{start:"top-full left-0 origin-top-left",center:"top-full left-1/2 -translate-x-1/2 origin-top",end:"top-full right-0 origin-top-right"},top:{start:"bottom-full left-0 origin-bottom-left",center:"bottom-full left-1/2 -translate-x-1/2 origin-bottom",end:"bottom-full right-0 origin-bottom-right"},left:{start:"right-full top-0 origin-top-right",center:"right-full top-1/2 -translate-y-1/2 origin-right",end:"right-full bottom-0 origin-bottom-right"},right:{start:"left-full top-0 origin-top-left",center:"left-full top-1/2 -translate-y-1/2 origin-left",end:"left-full bottom-0 origin-bottom-left"}};function Tr(r,a){switch(r){case"top":return{marginBottom:`${a}px`};case"bottom":return{marginTop:`${a}px`};case"left":return{marginRight:`${a}px`};case"right":return{marginLeft:`${a}px`};default:return{}}}function Pe({id:r,ref:a,isOpen:t,onOpenChange:o,children:s,className:n,closeOnOverlayClick:i=!0,trigger:d,placement:c="bottom",alignment:m="center",closeOnTriggerClick:f=!0,offset:u=8,autoSwitchPlacement:h=!0,hoverable:x=!1}){const[b,y]=l.useState(t??!1),p=l.useRef(null),C=l.useRef(null),g=l.useRef(null),j=l.useId(),k=l.useRef(null),S=Mr({internalIsOpen:b,autoSwitchPlacement:h,placement:c,offset:u,triggerRef:C,popoverRef:p}),M=l.useCallback(z=>{o&&o(z),t===void 0&&y(z)},[t,o]),v=l.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null)},[]),D=l.useCallback(()=>{x&&(v(),M(!0))},[x,v,M]),N=l.useCallback(()=>{x&&(v(),k.current=setTimeout(()=>{M(!1)},200))},[x,v,M]);l.useEffect(()=>{t!==void 0&&y(t)},[t]),l.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]),l.useEffect(()=>{if(!b)return;const z=A=>{A.key==="Escape"&&M(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[b,M]),l.useEffect(()=>{if(!b||!i)return;const z=A=>{const F=A.target;p.current&&!p.current.contains(F)&&C.current&&!C.current.contains(F)&&M(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[b,i,M]),l.useEffect(()=>{var z,A;b?(g.current=document.activeElement,(z=p.current)==null||z.focus()):((A=g.current)==null||A.focus(),g.current=null)},[b]);const E=d.props,I=l.cloneElement(d,{"aria-expanded":b,"aria-haspopup":"dialog","aria-controls":j,ref:je.mergeRefs(C,E.ref),onClick:z=>{var A,F;if((A=E.onClick)==null||A.call(E,z),!x&&!(!f&&b)&&t===void 0){if(z.defaultPrevented||(F=p.current)!=null&&F.contains(z.target))return;M(!b)}},onMouseEnter:z=>{var A;(A=E.onMouseEnter)==null||A.call(E,z),D()},onMouseLeave:z=>{var A;(A=E.onMouseLeave)==null||A.call(E,z),N()}});return e.jsxs("div",{id:r,ref:a,className:"relative inline-block",children:[I,e.jsx("div",{id:j,ref:p,className:w.join("absolute z-[90] transform rounded-md shadow-lg bg-popover text-popover-foreground transition-all ease-out",b?"opacity-100 scale-100":"opacity-0 scale-75 pointer-events-none",zr[S][m],n),style:Tr(S,u),role:"dialog","aria-modal":"true",tabIndex:-1,inert:b?void 0:!0,"aria-hidden":b?void 0:!0,onMouseEnter:x?D:void 0,onMouseLeave:x?N:void 0,children:s})]})}function Ke({option:r,...a}){const{onItemSelect:t}=J.useDropdownMenuContext(),o=()=>{r.onClick&&r.onClick(),r.value&&t(r.value)},s=r.subItems&&r.subItems.length>0,n=r.href&&!r.disabled,i=n?"a":"div";return e.jsxs(i,{href:n?r.href:void 0,className:w.join("relative flex items-center gap-2 px-3 py-2 text-sm focus:outline-none focus:bg-popover-foreground/10",r.disabled?"opacity-50 cursor-default":"cursor-pointer"),onClick:r.disabled?void 0:o,...a,children:[r.icon&&e.jsx("span",{className:"size-4",children:r.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{children:r.label}),r.description&&e.jsx("div",{className:"text-xs text-popover-foreground/60",children:r.description})]}),r.keyboardShortcut&&e.jsx("div",{className:"text-xs text-popover-foreground/60",children:r.keyboardShortcut}),s&&e.jsx(L.ChevronRight,{className:"size-4"})]})}function Rr({option:r,level:a,index:t}){const{focus:o,setFocus:s}=J.useDropdownMenuContext(),[n,i]=l.useState(!1),[d,c]=l.useState(!1),m=l.useRef(null),f=l.useRef(void 0),u=l.useId(),h=()=>{r.disabled||(s({level:a,index:t}),b())},x=()=>{s(null),y()},b=()=>{i(!0)},y=()=>{i(!1)},p=j=>{if(j.key==="ArrowRight"){if(j.preventDefault(),r.disabled)return;c(!1)}};l.useEffect(()=>{const j=o==null?void 0:o.level,k=f.current,S=a+1;j&&k&&k===S&&j===k-1?c(!0):c(!1),f.current=j},[o,a]);const C=r.subItems!==void 0&&r.subItems.length>0,g=n&&!d&&C;return e.jsxs("div",{ref:m,className:"relative focus:outline-none focus:bg-popover-foreground/10",onMouseEnter:h,onMouseLeave:x,onFocus:b,onBlur:y,onKeyDown:p,tabIndex:0,"data-menu-item":r.value,"data-level":a,"data-index":t,"aria-haspopup":C?"true":void 0,"aria-expanded":g?"true":"false","aria-disabled":r.disabled?"true":void 0,"aria-label":r.label,"aria-controls":g?u:void 0,children:[e.jsx(Ke,{option:r}),g&&e.jsx("div",{className:"absolute left-full top-0 z-30",children:e.jsx(He,{items:r.subItems??[],level:a+1,id:u})})]})}function He({items:r,level:a,id:t}){const{setFocus:o,className:s=""}=J.useDropdownMenuContext();let n=0;const i=(d,c)=>{switch(d.__type){case"option":return d.subItems&&d.subItems.length>0?e.jsx(Rr,{option:d,level:a,index:n++},c):e.jsx(Ke,{option:d,"data-menu-item":d.value,"data-level":a,"data-index":n++,tabIndex:-1,"aria-disabled":d.disabled?"true":void 0,onMouseEnter:m=>{if(m.preventDefault(),d.disabled)return;const f=Number(m.currentTarget.getAttribute("data-index"));o({level:a,index:f})},onMouseLeave:m=>{m.preventDefault(),o(null)}},c);case"group":return e.jsxs("div",{children:[d.title&&e.jsx("div",{className:"px-3 py-2 text-xs font-semibold text-popover-foreground/50 uppercase",children:d.title}),d.items.map((m,f)=>i(m,`${c}-${f}`))]},c);case"separator":return e.jsx("div",{"aria-hidden":!0,className:"my-1 mx-2 border-t border-popover-foreground/20"},c);case"custom":return e.jsx("div",{children:d.render()},c);default:return null}};return e.jsx("div",{id:t,className:w.join("border py-1 border-popover-foreground/20 rounded-md min-w-52 shadow-lg bg-popover text-popover-foreground",s),tabIndex:0,"data-level":a,"data-menu":!0,role:"menu","aria-label":`Dropdown menu level ${a}`,children:r.map((d,c)=>i(d,String(c)))})}function Br(r,a){return Array.from(r.querySelectorAll(`[data-menu-item][data-level="${a}"]`))}function Lr(r,a){const t=a===null?0:(a+1)%r.length;for(let o=0;o<r.length;o++){const s=(t+o)%r.length;if(!r[s].hasAttribute("aria-disabled"))return s}return-1}function Vr(r,a){const t=a===null?r.length-1:(a-1+r.length)%r.length;for(let o=0;o<r.length;o++){const s=(t-o+r.length)%r.length;if(!r[s].hasAttribute("aria-disabled"))return s}return-1}function Gr({dropdownId:r,focus:a,setFocus:t,isOpen:o,onClose:s}){const n=l.useCallback(i=>{var u;if(!o)return;const{level:d,index:c}=a||{level:1,index:null},m=document.querySelector(`#${r} [data-menu][data-level="${d}"]`);if(!m)return;const f=Br(m,d);if(f.length!==0)switch(i.key){case"ArrowDown":{i.preventDefault();const h=Lr(f,c);if(h===-1)return;t({level:d,index:h});break}case"ArrowUp":{i.preventDefault();const h=Vr(f,c);if(h===-1)return;t({level:d,index:h});break}case"ArrowRight":{if(i.preventDefault(),c!==null){const x=f[c].querySelector("[data-menu]");x&&x.querySelector("[data-menu-item]")&&t({level:d+1,index:0})}break}case"ArrowLeft":{i.preventDefault();const h=(u=m.parentElement)==null?void 0:u.closest("[data-menu-item]");if(!h){console.error(`No parent menu found leaving menu level ${d}`);return}const x=h.getAttribute("data-index")?Number(h.getAttribute("data-index")):-1;h&&t({level:d-1,index:x===-1?0:x});break}case"Enter":{if(i.preventDefault(),c!==null){const h=f[c];h==null||h.click(),t(null)}break}case"Escape":{i.preventDefault(),s==null||s(),t(null);break}case"Tab":{s();break}}},[o,a,t,s,r]);return l.useEffect(()=>{if(o)return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[n,o]),{handleKeyDown:n}}function Wr(r,a,t){return document.querySelector(`#${r} [data-menu-item][data-level="${a}"][data-index="${t}"]`)}function _r({id:r,items:a,onItemSelect:t,trigger:o,isOpen:s,placement:n="bottom",alignment:i="start",onOpenChange:d,className:c="",...m}){const f=l.useId(),u=r||`dropdown-menu-${f}`,[h,x]=l.useState(null),[b,y]=l.useState(!1),p=s===void 0,C=p?b:s,g=l.useCallback(()=>{x(null),y(!1)},[]),j=l.useCallback(v=>{t&&t(v),g()},[t,g]),k=l.useCallback(v=>{p&&y(v),d&&d(v)},[p,d]),S=l.useMemo(()=>({id:u,focus:h,setFocus:x,isOpen:C,onItemSelect:j,onClose:g,className:c}),[h,x,j,g,c,C,u]);Gr({dropdownId:u,focus:h,setFocus:x,isOpen:C,onClose:g});const M=l.useMemo(()=>l.cloneElement(o,{onClick:v=>{p&&y(N=>!N);const D=o.props;D.onClick&&D.onClick(v)}}),[p,y,o]);return l.useEffect(()=>{if(h){const v=Wr(u,h.level,h.index);v==null||v.focus()}},[h,u]),e.jsx(Pe,{id:u,isOpen:p?b:C,trigger:M,placement:n,alignment:i,onOpenChange:k,className:w.join("min-w-52",c),...m,children:e.jsx(J.DropdownMenuContext.Provider,{value:S,children:e.jsx(He,{items:a,level:1})})})}const qr=r=>({__type:"option",...r}),Pr=(r,a)=>({__type:"group",title:a,items:r}),Kr=()=>({__type:"separator"}),Hr=r=>({__type:"custom",render:r}),Zr={option:qr,group:Pr,separator:Kr,custom:Hr};function Yr(r=[]){const[a,t]=l.useState(r),[o,s]=l.useState(null),[n,i]=l.useState(null),d=l.useRef(null),c=l.useCallback((g,j)=>{const k={...j,id:`item-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,content:g};return t(S=>[...S,k]),k},[]),m=l.useCallback(g=>{t(j=>j.filter(k=>k.id!==g))},[]),f=l.useCallback((g,j)=>{g!==j&&t(k=>{const S=[...k],[M]=S.splice(g,1);return S.splice(j,0,M),S})},[]),u=l.useCallback(g=>{g>0&&f(g,g-1)},[f]),h=l.useCallback(g=>{g<a.length-1&&f(g,g+1)},[f,a.length]),x=l.useCallback((g,j)=>{s(g),d.current=j,i(j)},[]),b=l.useCallback((g,j)=>{g.preventDefault(),i(j)},[]),y=l.useCallback(()=>{if(o&&n!==null&&d.current!==null){const g=d.current,j=n;g!==j&&f(g,j)}s(null),i(null),d.current=null},[o,n,f]),p=l.useCallback(g=>{g.preventDefault(),y()},[y]),C=l.useCallback(()=>{if(!o||n===null||d.current===null)return a;const g=d.current,j=n;if(g===j)return a;const k=[...a],[S]=k.splice(g,1);return k.splice(j,0,S),k},[a,o,n,d]);return{items:a,visualItems:C(),addItem:c,deleteItem:m,moveItem:f,moveItemUp:u,moveItemDown:h,draggedItem:o,draggedOverIndex:n,handleDragStart:x,handleDragOver:b,handleDragEnd:y,handleDrop:p}}const Ur={sm:"text-sm",md:"text-base",lg:"text-lg"},Qr={sm:"text-sm gap-2",md:"text-base gap-3",lg:"text-lg gap-4"},Xr={sm:14,md:15,lg:16};function Fe({size:r=8,className:a=""}){return e.jsx("div",{className:`rounded-full flex-shrink-0 bg-current ${a}`,style:{width:r,height:r}})}function Jr({size:r=12,className:a=""}){return e.jsx("div",{className:`flex-shrink-0 bg-current ${a}`,style:{width:r,height:2}})}function Or({items:r=[],size:a="md",id:t,className:o="",ref:s,allowAdd:n=!0,allowDelete:i=!0,allowReorder:d=!0,addPlaceholder:c="Add new item...",onItemsChange:m,renderItem:f,marker:u,itemRenderer:h,showDividers:x=!0,showReorderButtons:b=!0,title:y,truncateText:p=!1}){const[C,g]=l.useState(""),[j,k]=l.useState(null),S=l.useRef(null),M=l.useId(),v=l.useRef(!1),D=l.useRef(r),N=t||`dynamic-list-${M}`,E=`${N}-title`,{items:I,visualItems:z,addItem:A,deleteItem:F,moveItemUp:R,moveItemDown:G,draggedItem:P,draggedOverIndex:Y,handleDragStart:B,handleDragOver:_,handleDragEnd:X,handleDrop:te}=Yr(r),K=h||f;l.useEffect(()=>{if(!v.current){v.current=!0;return}D.current!==I&&(D.current=I,m==null||m(I))},[I,m]);const T=q=>document.querySelector(`#${N} #${CSS.escape(q)}`),W=()=>{var q;C.trim()&&(A(C.trim()),g(""),(q=S.current)==null||q.focus())},U=(q,Q)=>{var le;if(!i)return;q.preventDefault();const O=Q<I.length-1?Q+1:Q-1,oe=I[O];F(I[Q].id),O>=0&&oe?setTimeout(()=>{const ee=T(oe.id);ee==null||ee.focus()},0):((le=S.current)==null||le.focus(),k(null))},Z=q=>{q.key==="Enter"&&W()},$=(q,Q)=>{switch(q.key){case"ArrowUp":if(!d)return;q.preventDefault(),R(Q),Q>0&&k(Q-1);break;case"ArrowDown":if(!d)return;q.preventDefault(),G(Q),Q<I.length-1&&k(Q+1);break;case"Backspace":case"Delete":U(q,Q);break}},V=()=>{if(!y)return null;const q=w.join("font-medium opacity-60",Ur[a]);if(typeof y=="string")return e.jsx("h4",{id:E,className:q,children:y});const Q=y.props;return l.cloneElement(y,{id:E,className:w.join(q,Q.className)})},H=q=>{if(!u)return null;if(l.isValidElement(u))return u;switch(u){case"disc":return e.jsx(Fe,{className:"text-muted-foreground"});case"dash":return e.jsx(Jr,{className:"text-muted-foreground"});case"decimal":return e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex-shrink-0 min-w-4 text-right",children:[q+1,"."]});default:return e.jsx(Fe,{className:"text-muted-foreground"})}},ne=Qr[a],ae=Xr[a];return e.jsxs("div",{ref:s,id:N,className:o,"data-size":a,"data-allow-add":n,"data-allow-delete":i,"data-allow-reorder":d,"data-marker":typeof u=="string"?u:"custom",children:[V(),e.jsxs("ul",{className:ne,role:"list","aria-labelledby":y?E:void 0,children:[z.map((q,Q)=>{const O=I.findIndex(ee=>ee.id===q.id),oe=(P==null?void 0:P.id)===q.id,le=j===O;return e.jsxs("div",{children:[e.jsxs("li",{id:q.id,title:p?q.content:void 0,className:w.join("flex items-center group relative transition-all",oe&&"opacity-30",P&&Y===Q&&!oe?"border-t-2 border-primary":""),draggable:d,onDragStart:ee=>{ee.dataTransfer.effectAllowed="move",B(q,O)},onDragOver:ee=>_(ee,Q),onDragEnd:X,onDrop:te,onMouseEnter:()=>k(O),onMouseLeave:()=>k(null),onFocus:ee=>{ee.currentTarget===ee.target&&k(O)},tabIndex:0,role:"listitem","aria-label":`List item ${O+1}: ${q.content}`,onKeyDown:ee=>$(ee,O),"aria-description":`${d?"Use up/down arrow keys to reorder. ":""}${i?"Press Backspace/Delete to remove this item.":""}`,children:[d&&e.jsx("div",{className:w.join("absolute -translate-x-full flex-shrink-0 pl-2 pr-1 py-2 cursor-move transition-opacity opacity-0",(oe||le&&!P)&&"opacity-100"),children:e.jsx(L.GripVertical,{size:ae+2})}),u&&e.jsx("div",{className:w.join("flex-shrink-0 flex items-center justify-center py-2 pr-2"),children:H(O)}),e.jsxs("div",{className:w.join("flex-1 flex min-w-0"),children:[e.jsx("div",{className:w.join("flex-1 min-w-0 py-2 pr-2"),children:K?K(q,O):e.jsx("span",{className:w.join("block",p&&"truncate"),children:q.content})}),!P&&e.jsxs("div",{className:w.join("flex-shrink-0 flex items-center gap-1 pr-2 opacity-0 transition-opacity",le&&"opacity-100"),children:[d&&b&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>R(O),disabled:O===0,className:"p-0.5 opacity-50 leading-0 hover:opacity-80 disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors","aria-hidden":!0,tabIndex:-1,children:e.jsx(L.ChevronUp,{size:ae})}),e.jsx("button",{type:"button",onClick:()=>G(O),disabled:O===I.length-1,className:"p-0.5 opacity-50 leading-0 hover:opacity-80 disabled:opacity-30 disabled:cursor-not-allowed rounded transition-colors","aria-hidden":!0,tabIndex:-1,children:e.jsx(L.ChevronDown,{size:ae})})]}),i&&e.jsx("button",{tabIndex:le?0:-1,type:"button",onClick:ee=>U(ee,O),className:"p-0.5 text-destructive opacity-70 h-fit hover:opacity-90 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-destructive","aria-label":"Delete item",children:e.jsx(L.Trash,{size:ae})})]})]})]}),x&&Q<I.length-1&&e.jsx("hr",{className:"border-border/50"})]},q.id)}),I.length===0&&e.jsxs("li",{className:w.join("text-center text-muted-foreground py-8",ne),children:["No items yet. ",n&&"Add an item below to get started."]})]}),n&&e.jsxs("div",{className:w.join("border-t border-border/50 flex items-center gap-2",ne),children:[e.jsx("input",{id:`${N}-new-item-input`,ref:S,type:"text",value:C,onChange:q=>g(q.target.value),onKeyDown:Z,placeholder:c,className:"flex-1 bg-transparent border-none outline-none placeholder-muted-foreground pt-1","aria-label":"Add new list item"}),e.jsx("button",{type:"button",onClick:W,disabled:!C.trim(),className:"flex-shrink-0 p-1.5 text-muted-foreground opacity-70 enabled:hover:opacity-100 disabled:opacity-30 disabled:cursor-not-allowed rounded transition-opacity","aria-label":"Add item",children:e.jsx(L.Plus,{size:16})})]})]})}const es={danger:{container:"border-destructive bg-destructive/10",icon:"text-destructive",title:"text-destructive",description:"text-destructive/80",button:"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus:ring-destructive",details:"bg-destructive/5 border-destructive/20 text-destructive"},warning:{container:"border-yellow-600 bg-yellow-600/10",icon:"text-yellow-600",title:"text-yellow-600",description:"text-yellow-600/80",button:"bg-yellow-600 text-white hover:bg-yellow-600/90 focus:ring-yellow-600",details:"bg-yellow-600/5 border-yellow-600/20 text-yellow-600"},info:{container:"border-blue-600 bg-blue-600/10",icon:"text-blue-600",title:"text-blue-600",description:"text-blue-600/80",button:"bg-blue-600 text-white hover:bg-blue-600/90 focus:ring-blue-600",details:"bg-blue-600/5 border-blue-600/20 text-blue-600"}},ts={danger:e.jsx(re.ExclamationTriangle,{size:24}),warning:e.jsx(re.ExclamationTriangle,{size:24}),info:e.jsx(re.InfoCircled,{size:24})};function rs({id:r,variant:a="danger",showRetry:t=!0,fallbackMessage:o,fallback:s,onRetry:n,onError:i,className:d,children:c,inDevEnv:m=!1}){return e.jsx(ss,{id:r,variant:a,showRetry:t,fallbackMessage:o,fallback:s,onRetry:n,onError:i,className:d,inDevEnv:m,children:c})}class ss extends l.Component{constructor(t){super(t);we(this,"handleRetry",()=>{var t,o;this.setState({hasError:!1,error:void 0,errorInfo:void 0}),(o=(t=this.props).onRetry)==null||o.call(t)});this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,o){var s,n;this.setState({error:t,errorInfo:o}),(n=(s=this.props).onError)==null||n.call(s,t,o),this.props.inDevEnv&&(console.error("ErrorBoundary caught an error:",t),console.error("Error info:",o))}render(){var m;const{id:t,variant:o="danger",showRetry:s=!0,fallbackMessage:n="Something went wrong",fallback:i,className:d,inDevEnv:c}=this.props;if(this.state.hasError){if(i)return i;const f=es[o],u=ts[o];return e.jsxs("div",{id:t,"data-variant":o,"data-has-error":this.state.hasError,className:w.join("rounded-lg border p-6 text-center",f.container,d),role:"alert","aria-live":"assertive",children:[e.jsx("div",{className:w.join("mb-4 flex justify-center",f.icon),children:u}),e.jsx("h3",{className:w.join("text-lg font-semibold mb-2",f.title),children:"Oops! Something went wrong"}),e.jsx("p",{className:w.join("text-sm mb-4",f.description),children:n}),c&&this.state.error&&e.jsxs("details",{className:"mt-4 text-left",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium mb-2",children:"Error Details (Development Only)"}),e.jsxs("div",{className:w.join("rounded border p-3 text-xs font-mono whitespace-pre-wrap overflow-auto max-h-40",f.details),children:[e.jsx("div",{className:"font-bold mb-1",children:"Error:"}),e.jsx("div",{className:"mb-2",children:this.state.error.toString()}),((m=this.state.errorInfo)==null?void 0:m.componentStack)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-bold mb-1",children:"Component Stack:"}),e.jsx("div",{children:this.state.errorInfo.componentStack})]})]})]}),s&&e.jsx("button",{type:"button",onClick:this.handleRetry,className:w.join("inline-flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-colors","focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-transparent",f.button),"aria-label":"Try again",children:"Try Again"})]})}return this.props.children}}const ns={link:"text-primary hover:text-primary-foreground hover:bg-primary/10 aria-current:text-primary-foreground aria-current:bg-primary",outline:"border border-primary text-primary hover:bg-primary hover:text-primary-foreground aria-current:bg-primary aria-current:text-primary-foreground aria-current:border-primary",filled:"bg-secondary text-secondary-foreground hover:bg-primary hover:text-primary-foreground aria-current:bg-primary aria-current:text-primary-foreground"},as={sm:"px-2 py-1 text-sm min-w-[32px] min-h-8",md:"px-2 py-1 text-base min-w-[40px] min-h-10"};function os({page:r,pageCount:a=5,maxVisiblePages:t=5,showFirstLast:o=!0,onPageChange:s,size:n="md",variant:i="link",className:d,ref:c,buttonsClassName:m,...f}){const u=a===1/0,x=l.useCallback(()=>{if(u)return[];const k=a,S=Math.min(t,k);if(k<=S)return Array.from({length:k},(N,E)=>E+1);const M=Math.floor(S/2);let v=Math.max(1,r-M),D=Math.min(k,v+S-1);return D-v+1<S&&(v=Math.max(1,D-S+1),D=Math.min(k,v+S-1)),Array.from({length:D-v+1},(N,E)=>v+E)},[u,t,r,a])(),b=r>1,y=u||r<a,p=o&&!u,C=o&&!u,g=k=>{k>=1&&(u||k<=a)&&s(k)},j=l.useCallback(()=>{const k=w.join("flex items-center justify-center min-w-fit","disabled:opacity-50 disabled:cursor-not-allowed",as[n],"rounded-md");return w.join(k,ns[i],m)},[i,n,m]);return e.jsxs("nav",{ref:c,className:w.join("flex items-center justify-center gap-1",d),role:"navigation","aria-label":"Pagination","data-page":r,"data-page-count":u?"infinite":a,...f,children:[p&&e.jsxs("button",{onClick:()=>g(1),className:j(),disabled:r===1,"aria-label":"Go to first page",children:[e.jsx(L.ChevronDoubleLeft,{size:n==="sm"?12:15}),e.jsx("span",{className:"ml-1",children:"First"})]}),e.jsxs("button",{onClick:()=>g(r-1),className:j(),disabled:!b,"aria-label":"Go to previous page",children:[e.jsx(L.ChevronLeft,{size:n==="sm"?12:15}),e.jsx("span",{className:"ml-1",children:"Previous"})]}),!u&&x.map(k=>e.jsx("button",{onClick:()=>g(k),className:w.join(j(),"aspect-square"),"aria-label":`Go to page ${k}`,"aria-current":k===r?!0:void 0,children:k},k)),e.jsxs("button",{onClick:()=>g(r+1),className:j(),disabled:!y,"aria-label":"Go to next page",children:[e.jsx("span",{className:"mr-1",children:"Next"}),e.jsx(L.ChevronRight,{size:n==="sm"?12:15})]}),C&&e.jsxs("button",{onClick:()=>g(a),className:j(),disabled:r===a,"aria-label":"Go to last page",children:[e.jsx("span",{className:"mr-1",children:"Last"}),e.jsx(L.ChevronDoubleRight,{size:n==="sm"?12:15})]})]})}function ls(r){const[a,t]=l.useState(!1),[o,s]=l.useState(!1);return l.useEffect(()=>{r?(s(!0),setTimeout(()=>t(!0),10)):(t(!1),setTimeout(()=>s(!1),300))},[r]),{show:a,shouldRender:o}}function is(r,a){l.useEffect(()=>{const t=o=>{o.key==="Escape"&&r&&a()};return document.addEventListener("keydown",t),r&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",t),document.body.style.overflow="auto"}},[r,a])}function cs(r,a){const t=l.useRef(null),o=l.useCallback(()=>{const s=document.getElementById(r);if(!s)return;const n=s.querySelectorAll('[data-panel-action="true"]');if(n.length>0){n[0].focus();return}const i=s.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(i.length>0){const d=Array.from(i).filter(c=>!(c instanceof HTMLButtonElement&&c.getAttribute("data-panel-close-button")==="true"));if(d.length>0){d[0].focus();return}i[0].focus();return}s.focus()},[r]);l.useEffect(()=>(a&&(t.current=document.activeElement,o()),()=>{document.body.style.overflow="auto",t.current instanceof HTMLElement&&t.current.focus()}),[a,o])}function ds({ref:r,id:a,isOpen:t,onClose:o,title:s,children:n,footer:i,className:d,overlayClassName:c,hideCloseButton:m=!1,disableCloseOnOverlayClick:f=!1,ariaLabelledBy:u,ariaDescribedBy:h}){const x=l.useId(),b=a||`panel-${x}`,y=a?`${a}-title`:`panel-title-${x}`,{show:p,shouldRender:C}=ls(t);if(cs(b,C),is(C,o),!C)return null;const g=()=>s?l.isValidElement(s)?e.jsx("div",{children:s}):e.jsx("h2",{className:"text-2xl font-semibold",id:y,children:s}):null,j=()=>{if(!i)return null;if(l.isValidElement(i)){const k=i,S=k.props.className||"";return l.cloneElement(k,{className:w.join("px-6 py-4",S)})}return e.jsx("div",{className:"px-6 py-4",children:i})};return e.jsx(e.Fragment,{children:ye.createPortal(e.jsxs("div",{"aria-labelledby":u??s?y:void 0,"aria-describedby":h,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-[100] overflow-hidden","data-panel-open":t,children:[e.jsx("div",{className:w.join("fixed inset-0 bg-black/40 transition-opacity",p?"opacity-100":"opacity-0",c),onClick:()=>{f||o()}}),e.jsx("div",{className:"fixed inset-y-0 right-0 flex max-w-full",children:e.jsx("div",{id:b,ref:r,tabIndex:-1,className:w.join("relative h-full max-w-md transform shadow-xl bg-popover text-popover-foreground transition-transform ease-in-out border-l border-border",p?"translate-x-0":"translate-x-full",d),children:e.jsxs("div",{className:"flex h-full flex-col",children:[s&&e.jsx("div",{className:"px-6 pt-6",children:g()}),!m&&e.jsx("button",{type:"button",onClick:o,"data-panel-close-button":"true","aria-label":"Close panel",className:"rounded-md p-0.5 top-3 right-3 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0",children:e.jsx(re.X,{size:18})}),e.jsx("div",{className:w.join("flex-1 overflow-y-auto px-6 pb-6",s?"pt-6":"pt-10"),children:n}),j()]})})})]}),document.body)})}const us={thin:{horizontal:"h-px",vertical:"w-px"},medium:{horizontal:"h-0.5",vertical:"w-0.5"},thick:{horizontal:"h-1",vertical:"w-1"},"extra-thick":{horizontal:"h-2",vertical:"w-2"}},fs={horizontal:"w-full",vertical:"min-h-4 h-full"};function xs({orientation:r="horizontal",decorative:a=!1,thickness:t="thin",className:o,...s}){const n=w.join("shrink-0 bg-border",fs[r],us[t][r],o);return e.jsx("div",{...s,className:n,role:a?"presentation":"separator","aria-orientation":a?void 0:r,"aria-hidden":a,"data-orientation":r,"data-thickness":t})}const Ie={shape:{rectangle:"rounded-md min-h-1",circle:"rounded-full aspect-square min-h-1",text:"rounded-sm min-h-1 h-4"},lineSpacing:{xs:"space-y-1",sm:"space-y-2",md:"space-y-3",lg:"space-y-4",xl:"space-y-6"}};function ms({shape:r="rectangle",lineSpacing:a="sm",className:t,lines:o=1,animate:s=!0,ref:n,...i}){const d=w.join("bg-muted/70",s&&"animate-pulse",Ie.shape[r],t);return o>1?e.jsx("div",{ref:n,className:Ie.lineSpacing[a],role:"presentation","aria-hidden":"true","data-testid":"skeleton-container","data-lines":o,"data-shape":r,"data-animate":s,...i,children:Array.from({length:o},(c,m)=>e.jsx("div",{className:w.join(d,m===o-1&&"w-3/4"),role:"presentation","aria-hidden":"true","data-testid":"skeleton-line","data-line-index":m},m))}):e.jsx("div",{ref:n,className:d,role:"presentation","aria-hidden":"true","data-testid":"skeleton","data-shape":r,"data-animate":s,...i})}function hs({id:r,value:a,defaultValue:t=0,onValueChange:o,min:s=0,max:n=100,step:i=1,disabled:d=!1,trackClassName:c,rangeClassName:m,thumbClassName:f,className:u,ref:h,ariaLabel:x,ariaLabelledBy:b,...y}){const[p,C]=l.useState(t),g=a!==void 0,j=g?a:p,k=l.useRef(null),S=l.useRef(!1),M=l.useRef(0),v=l.useCallback(A=>{const F=Math.max(s,Math.min(n,A)),R=Math.round(F/i)*i;g||C(R),o==null||o(R)},[s,n,i,g,o]),D=l.useCallback((A,F=!1)=>{var Y;const R=(Y=k.current)==null?void 0:Y.getBoundingClientRect();if(!R)return j;let G=A.clientX;F&&(G=G-M.current);const P=Math.max(0,Math.min(1,(G-R.left)/R.width));return s+(n-s)*P},[s,n,j]),N=l.useCallback(A=>{if(d||A.target!==A.currentTarget)return;const F=D(A);v(F)},[d,D,v]),E=l.useCallback(A=>{var Y;if(d)return;A.stopPropagation(),S.current=!0;const F=(Y=k.current)==null?void 0:Y.getBoundingClientRect(),R=A.currentTarget.getBoundingClientRect();if(F&&R){const B=R.left+R.width/2;M.current=A.clientX-B}A.currentTarget.setPointerCapture(A.pointerId);const G=B=>{if(!S.current)return;const _=D(B,!0);v(_)},P=B=>{if(B.pointerId===A.pointerId){S.current=!1,M.current=0;try{A.currentTarget.releasePointerCapture(B.pointerId)}catch{}document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",P)}};document.addEventListener("pointermove",G),document.addEventListener("pointerup",P)},[d,D,v]),I=l.useCallback(A=>{if(d)return;let F=j;switch(A.key){case"ArrowRight":case"ArrowUp":F=j+i;break;case"ArrowLeft":case"ArrowDown":F=j-i;break;case"Home":F=s;break;case"End":F=n;break;case"PageUp":F=j+i*10;break;case"PageDown":F=j-i*10;break;default:return}A.preventDefault(),v(F)},[d,j,i,s,n,v]),z=n===s?0:(j-s)/(n-s)*100;return e.jsx("div",{id:r,ref:h,className:w.join("relative flex items-center w-full touch-none select-none",d&&"opacity-50 cursor-not-allowed",u),"data-disabled":d,"data-value":j,"data-min":s,"data-max":n,"data-step":i,...y,children:e.jsxs("div",{ref:k,className:w.join("relative h-1.5 w-full rounded-full bg-muted-foreground cursor-pointer",d&&"cursor-not-allowed",c),onPointerDown:N,children:[e.jsx("div",{className:w.join("absolute h-full rounded-full pointer-events-none",!S.current&&"transition-all",m),style:{width:`${z}%`}}),e.jsx("div",{className:w.join("absolute size-5 -top-2 rounded-full shadow-md cursor-grab",d&&"cursor-not-allowed",!d&&"cursor-grab focus:outline-none focus:ring-2",S.current?"cursor-grabbing scale-110":"transition-all",f),style:{left:`calc(${z}% - 10px)`},tabIndex:d?-1:0,role:"slider","aria-valuemin":s,"aria-valuemax":n,"aria-valuenow":j,"aria-label":x,"aria-labelledby":b,"aria-disabled":d,onKeyDown:I,onPointerDown:E})]})})}function ps({data:r,initialSort:a={key:null,direction:null}}){const[t,o]=l.useState(a),[s,n]=l.useState();return{sortedData:l.useMemo(()=>!t.key||!t.direction?r:[...r].sort((c,m)=>{if(s){const x=s(c,m);return t.direction==="desc"?-x:x}const f=c[t.key],u=m[t.key];if(f===u)return 0;let h=0;return typeof f=="string"&&typeof u=="string"?h=f.localeCompare(u):typeof f=="number"&&typeof u=="number"?h=f-u:f instanceof Date&&u instanceof Date?h=f.getTime()-u.getTime():h=String(f).localeCompare(String(u)),t.direction==="desc"?-h:h}),[r,t,s]),sortConfig:t,handleSort:(c,m)=>{n(()=>m),o(f=>{if(f.key===c){const u=f.direction==="asc"?"desc":f.direction==="desc"?null:"asc";return{key:u?c:null,direction:u}}else return{key:c,direction:"asc"}})}}}function bs({initialSelected:r=[]}={}){const[a,t]=l.useState(new Set(r));return{selectedRows:a,isRowSelected:f=>a.has(f),selectRow:f=>{t(u=>new Set([...u,f]))},deselectRow:f=>{t(u=>{const h=new Set(u);return h.delete(f),h})},selectAll:f=>{t(new Set(f))},deselectAll:()=>{t(new Set)},isAllSelected:f=>f.length>0&&f.every(u=>a.has(u)),isPartiallySelected:f=>{const u=f.filter(h=>a.has(h)).length;return u>0&&u<f.length}}}const gs={sm:{container:"text-sm",table:"w-full border-collapse",header:"border-b border-border",headerCell:"px-3 py-2.5 font-medium",sortButton:"inline-flex items-center gap-1 hover:text-accent transition-colors",cell:"px-3 py-2 text-sm",selectedRow:"bg-accent/10 hover:bg-accent/20",checkbox:"pl-5 pr-2 text-left w-3",checkboxSize:12},md:{container:"text-base",table:"w-full border-collapse",header:"border-b-2 border-border",headerCell:"px-4 py-3 font-semibold",sortButton:"inline-flex items-center gap-2 hover:text-accent transition-colors",cell:"px-4 py-3",selectedRow:"bg-accent/10 hover:bg-accent/20",checkbox:"pl-6 pr-3 py-3 text-left w-6",checkboxSize:16},lg:{container:"text-lg",table:"w-full border-collapse",header:"border-b-2 border-border",headerCell:"px-6 py-4 font-bold",sortButton:"inline-flex items-center gap-2 hover:text-accent transition-colors",cell:"px-6 py-4",selectedRow:"bg-accent/10 hover:bg-accent/20",checkbox:"pl-6 pr-3 py-4 text-left w-8",checkboxSize:18}};function vs({id:r,className:a,ref:t,size:o="md",data:s,columns:n,selectable:i=!1,getRowId:d=(g,j)=>j,initialSelected:c=[],onSelectionChange:m,showHeader:f=!0,striped:u=!1,hoverable:h=!0,emptyState:x,loading:b=!1,loadingContent:y,caption:p,...C}){const g=gs[o],{sortedData:j,sortConfig:k,handleSort:S}=ps({data:s,initialSort:{key:null,direction:null}}),{selectedRows:M,isRowSelected:v,selectRow:D,deselectRow:N,selectAll:E,deselectAll:I,isAllSelected:z,isPartiallySelected:A}=bs({initialSelected:c}),F=s.map((B,_)=>d(B,_));l.useEffect(()=>{m&&m(Array.from(M))},[M,m]);const R=()=>{z(F)?I():E(F)},G=(B,_)=>_.accessor?typeof _.accessor=="function"?_.accessor(B):B[_.accessor]:B[_.key],P=(B,_)=>{const X=G(B,_);return _.cell?_.cell(B,X):e.jsx(e.Fragment,{children:X})},Y=B=>{switch(B){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}};return b?e.jsx("div",{id:r,ref:t,className:w.join("flex items-center justify-center p-8",g.container,a),...C,children:y||e.jsx("div",{children:"Loading..."})}):s.length===0?e.jsx("div",{id:r,ref:t,className:w.join("flex items-center justify-center p-8",g.container,a),...C,children:x||e.jsx("div",{className:"text-muted-foreground",children:"No data available"})}):e.jsx("div",{id:r,ref:t,className:w.join("overflow-x-auto border border-border rounded-lg",g.container,a),"data-testid":"table-container","data-size":o,"data-selectable":i,...C,children:e.jsxs("table",{className:g.table,role:"table",children:[p&&e.jsx("caption",{className:"sr-only",children:p}),e.jsxs("colgroup",{children:[i&&e.jsx("col",{style:{width:"1%"}}),n.map(B=>e.jsx("col",{style:B.width?{width:B.width}:{},className:B.columnClassName},B.key))]}),f&&e.jsx("thead",{className:g.header,role:"rowgroup",children:e.jsxs("tr",{role:"row",children:[i&&e.jsx("th",{className:g.checkbox,role:"columnheader","aria-label":"Select all rows",children:e.jsx(ie,{size:g.checkboxSize,checked:z(F),indeterminate:A(F),onCheckedChange:R,"aria-label":"Select all rows",className:"align-middle"})}),n.map(B=>{const _=k.key===B.key?k.direction:null;return e.jsx("th",{className:w.join(g.headerCell,Y(B.align),B.headerClassName),role:"columnheader","aria-sort":k.key===B.key?k.direction==="asc"?"ascending":k.direction==="desc"?"descending":"none":B.sortable?"none":void 0,children:B.sortable?e.jsxs("button",{className:g.sortButton,onClick:()=>S(B.key,B.sortFunction),"aria-label":`Sort by ${B.header}`,children:[B.header,e.jsxs("div",{className:"flex flex-col items-center -space-y-1",children:[e.jsx(L.ChevronUp,{size:g.checkboxSize-4,className:_==="asc"?"text-accent":"opacity-40"}),e.jsx(L.ChevronDown,{size:g.checkboxSize-4,className:_==="desc"?"text-accent":"opacity-40"})]})]}):B.header},B.key)})]})}),e.jsx("tbody",{role:"rowgroup",children:j.map((B,_)=>{const X=d(B,_),te=v(X),K=_===j.length-1;return e.jsxs("tr",{className:w.join("transition-all",!K&&"border-b border-border",h&&"hover:bg-accent/15",u&&_%2===1&&"bg-accent/25",te&&g.selectedRow),role:"row","aria-selected":i?te:void 0,"data-testid":"table-row","data-row-id":X,"data-selected":te,children:[i&&e.jsx("td",{className:g.checkbox,role:"cell",children:e.jsx(ie,{size:g.checkboxSize,checked:te,onCheckedChange:T=>{T?D(X):N(X)},"aria-label":`Select row ${_+1}`})}),n.map(T=>e.jsx("td",{className:w.join(g.cell,Y(T.align),T.cellClassName),role:"cell",children:P(B,T)},T.key))]},X)})})]})})}const ys=({defaultValue:r,value:a,onValueChange:t}={})=>{const[o,s]=l.useState(r||""),n=a!==void 0,i=n?a:o,d=l.useCallback(c=>{n||s(c),t==null||t(c)},[n,t]);return{value:i,onValueChange:d}},Ae={width:{fit:"w-fit",full:"w-full *:flex-1"},variant:{underline:"border-b border-border",pills:"",bordered:"border border-border rounded-lg p-1"}},js={underline:"border-b-2 border-transparent data-[state=active]:border-accent data-[state=active]:text-accent hover:text-accent/80",pills:"rounded-md data-[state=active]:bg-accent data-[state=active]:text-accent-foreground hover:bg-accent/30",bordered:"rounded data-[state=active]:bg-accent data-[state=active]:text-accent-foreground hover:bg-accent/30"};function Ze({children:r,className:a,id:t,ref:o}){const{tabsWidth:s,variant:n}=J.useTabsContext();return e.jsx("div",{className:"overflow-x-auto hide-scroll-bars",children:e.jsx("div",{id:t,ref:o,role:"tablist",className:w.join("flex",Ae.width[s],Ae.variant[n],a),"data-tabs-width":s,"data-variant":n,children:r})})}function Ye({value:r,disabled:a=!1,className:t,children:o,onClick:s,id:n,ref:i}){const{selectedValue:d,onValueChange:c,variant:m,triggersClassName:f}=J.useTabsContext(),u=l.useRef(null),h=d===r,x=()=>{const p=u.current;p&&p.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},b=p=>{a||(c(r),x(),s==null||s(p))};return e.jsx("button",{id:n,ref:je.mergeRefs(u,i),role:"tab",type:"button","aria-selected":h,"aria-controls":`tabs-content-${r}`,"data-state":h?"active":"inactive","data-value":r,disabled:a,className:w.join("inline-flex items-center justify-center whitespace-nowrap px-3 py-2 text-sm ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",h?"font-medium":"font-light",js[m],f,t),onClick:b,children:o})}function ws({defaultValue:r,value:a,onValueChange:t,tabsWidth:o="fit",variant:s="underline",className:n,tabsList:i,children:d,ref:c,id:m,triggersClassName:f,contentClassName:u}){const{value:h,onValueChange:x}=ys({defaultValue:r,value:a,onValueChange:t}),b={selectedValue:h,onValueChange:x,tabsWidth:o,variant:s,triggersClassName:f,contentClassName:u};return e.jsx(J.TabsContext.Provider,{value:b,children:e.jsxs("div",{id:m,ref:c,className:n,"data-tabs-width":o,"data-variant":s,children:[i&&e.jsx(Ze,{children:i.map(y=>e.jsx(Ye,{value:y.value,children:y.label},y.value))}),d]})})}function ks({value:r,className:a,children:t,ref:o}){const{selectedValue:s,contentClassName:n}=J.useTabsContext(),i=s===r;return i?e.jsx("div",{ref:o,role:"tabpanel",id:`tabs-content-${r}`,"aria-labelledby":`tabs-trigger-${r}`,"data-state":i?"active":"inactive","data-value":r,className:w.join("mt-4 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",n,a),tabIndex:0,children:t}):null}const Cs={sm:{container:"h-5 min-w-9 w-9",thumb:"h-4 w-4",translate:"translate-x-4"},md:{container:"h-6 min-w-11 w-11",thumb:"h-5 w-5",translate:"translate-x-5"},lg:{container:"h-7 min-w-13 w-13",thumb:"h-6 w-6",translate:"translate-x-6"}},Ns={default:{unchecked:"bg-muted-foreground",checked:"bg-primary"},success:{unchecked:"bg-muted-foreground",checked:"bg-success"},destructive:{unchecked:"bg-muted-foreground",checked:"bg-destructive"}},$e={variant:"default",size:"md"};function Ds({ref:r,id:a,size:t=$e.size,variant:o=$e.variant,checked:s,onCheckedChange:n,disabled:i=!1,className:d,thumbClassName:c,backgroundClassNames:m,...f}){const u=l.useId(),h=l.useMemo(()=>a||`toggle-${u}`,[a,u]),[x,b]=l.useState(s);l.useEffect(()=>{b(s)},[s]);const y=()=>{if(!i){const S=!x;s===void 0&&b(S),n==null||n(S)}},p=S=>{(S.key===" "||S.key==="Enter")&&(S.preventDefault(),y())},C=Cs[t],g=Ns[o],j=w.join("relative inline-flex items-center rounded-full transition-all ease-in-out","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",C.container,x?(m==null?void 0:m.checked)||g.checked:(m==null?void 0:m.unchecked)||g.unchecked,i&&"opacity-50 cursor-not-allowed",!i&&"cursor-pointer",d),k=w.join("absolute left-0.5 top-1/2 -translate-y-1/2 rounded-full bg-white shadow-sm transition-transform ease-in-out",C.thumb,x&&C.translate,c);return e.jsxs("button",{ref:r,id:h,type:"button",role:"switch",tabIndex:0,"aria-checked":x,"aria-disabled":i,disabled:i,onClick:y,onKeyDown:p,className:j,...f,children:[e.jsx("span",{className:k}),e.jsx("span",{className:"sr-only",children:x?"Enabled":"Disabled"})]})}exports.ActionModal=J.ActionModal;exports.Button=J.Button;exports.LoadingDots=J.LoadingDots;exports.Modal=J.Modal;exports.Toast=J.Toast;exports.Accordion=Je;exports.AccordionItem=fe;exports.AuthForm=yt;exports.Avatar=Rt;exports.Badge=Gt;exports.Calendar=Kt;exports.Callout=Yt;exports.Card=Qt;exports.Carousel=Jt;exports.Checkbox=ie;exports.Clickable=Ot;exports.Code=rr;exports.CodeBlock=Cr;exports.CopyButton=Nr;exports.Disclosure=Dr;exports.Drawer=Ar;exports.DropdownMenu=_r;exports.DropdownMenuFactories=Zr;exports.DynamicList=Or;exports.ErrorBoundary=rs;exports.Form=_e;exports.FormFactories=Me;exports.HelpIcon=Te;exports.Input=Re;exports.Label=se;exports.Pagination=os;exports.Panel=ds;exports.Popover=Pe;exports.RadioGroup=We;exports.RadioGroupItem=xe;exports.RadioInput=Ge;exports.ScrollArea=Le;exports.Select=Ve;exports.Separator=xs;exports.Skeleton=ms;exports.Slider=hs;exports.Table=vs;exports.Tabs=ws;exports.TabsContent=ks;exports.TabsList=Ze;exports.TabsTrigger=Ye;exports.Textarea=Be;exports.Toggle=Ds;exports.Tooltip=ze;
3
3
  //# sourceMappingURL=components.cjs.js.map