@fabio.caffarello/react-design-system 1.21.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -174,7 +174,7 @@ React keys must be passed directly to JSX without using spread:
174
174
  *
175
175
  * This source code is licensed under the ISC license.
176
176
  * See the LICENSE file in the root directory of this source tree.
177
- */const bc=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],we=le("x",bc),gc=xe("motion-safe:animate-spin",{variants:{size:{sm:"h-4 w-4",md:"h-5 w-5",lg:"h-8 w-8"},variant:{primary:"text-fg-brand",secondary:"text-fg-brand-secondary",neutral:"text-fg-secondary"}},defaultVariants:{size:"md",variant:"primary"}}),gs=l.memo(function(i){var c=i,{size:t="md",variant:r="primary",label:s,className:a=""}=c,o=O(c,["size","variant","label","className"]);return n.jsxs("div",P(T({className:w("inline-flex","items-center",a),role:"status","aria-label":s||"Loading","aria-live":"polite"},o),{children:[n.jsx(fa,{className:w(gc({size:t,variant:r})),"aria-hidden":"true"}),s&&n.jsx("span",{className:w(E("sm","ml"),re("bodySmall"),"text-fg-secondary","sr-only"),children:s})]}))});gs.displayName="Spinner";const xc=xe(w("inline-flex","items-center","justify-center",ce("button").split(" ")[2]||"font-medium",J("md"),"transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed"),{variants:{variant:{primary:w("bg-surface-brand-strong","text-fg-inverse","hover:opacity-90","focus:ring-line-brand"),secondary:w("bg-surface-secondary","text-fg-inverse","hover:opacity-90","focus:ring-line-secondary"),error:w("bg-error","text-fg-inverse","hover:opacity-90","focus:ring-error"),outline:w("border-2","border-line-default","bg-transparent","text-fg-primary","hover:bg-surface-hover","focus:ring-line-focus"),ghost:w("bg-transparent","text-fg-primary","hover:bg-surface-hover","focus:ring-line-focus"),iconOnly:w("bg-transparent","text-fg-primary","hover:bg-surface-hover","focus:ring-line-focus","p-0")},size:{sm:w(E("md","px"),E("1.5","py"),re("bodySmall"),E("1.5","gap")),md:w(E("base","px"),E("sm","py"),re("body"),E("sm","gap")),lg:w(E("lg","px"),E("md","py"),re("bodyLarge"),E("2.5","gap"))}},compoundVariants:[{variant:"iconOnly",size:"sm",class:w("h-8","w-8","p-0")},{variant:"iconOnly",size:"md",class:w("h-10","w-10","p-0")},{variant:"iconOnly",size:"lg",class:w("h-12","w-12","p-0")}],defaultVariants:{variant:"primary",size:"md"}});function $n({children:e,position:t}){return e?n.jsx("span",{className:`inline-flex items-center ${t==="left"?"mr-0":"ml-0"}`,children:e}):null}const Z=l.memo(l.forwardRef(function(k,v){var b=k,{variant:t="primary",size:r="md",isLoading:s=!1,loadingText:a,loadingIcon:o,leftIcon:i,rightIcon:c,fullWidth:u=!1,as:d="button",className:f="",disabled:p=!1,children:m,"aria-label":h}=b,x=O(b,["variant","size","isLoading","loadingText","loadingIcon","leftIcon","rightIcon","fullWidth","as","className","disabled","children","aria-label"]);const j=l.useMemo(()=>w(xc({variant:t,size:r}),u&&"w-full",f),[t,r,u,f]),C=l.useMemo(()=>t==="iconOnly"||!m&&(i||c),[t,m,i,c]),g=l.useMemo(()=>C&&!h&&!m?"Button":h,[C,h,m]),y=l.useMemo(()=>t==="error"?"primary":t==="primary"||t==="secondary"?"neutral":"primary",[t]),N=l.useMemo(()=>r==="sm"?"sm":r==="lg"?"lg":"md",[r]),_=l.useMemo(()=>o||n.jsx(gs,{size:N,variant:y}),[o,N,y]),S=d==="button"&&!x.type?"button":void 0,M=T(T({className:j,disabled:p||s,"aria-busy":s,"aria-label":g,"aria-disabled":p||s},S?{type:S}:{}),x);return n.jsx(d,P(T({ref:v},M),{children:s?n.jsxs(n.Fragment,{children:[_,a&&n.jsx("span",{className:"ml-2",children:a}),!a&&m&&n.jsx("span",{className:"ml-2 opacity-0",children:m})]}):n.jsxs(n.Fragment,{children:[i&&n.jsx($n,{position:"left",children:i}),m,c&&n.jsx($n,{position:"right",children:c})]})}))}));Z.displayName="Button";const vc=l.memo(function({error:t,success:r,helperText:s,errorId:a,helperId:o}){const i=l.useMemo(()=>w(E("xs","mt"),ce("caption"),t&&"text-fg-error",r&&"text-fg-success",!t&&!r&&"text-fg-secondary"),[t,r]),c=l.useMemo(()=>s||(t?"Error":r?"Success":""),[s,t,r]);return n.jsx("div",{id:a||o,className:i,role:t||r?"alert":void 0,children:c})}),ke=l.memo(l.forwardRef(function(C,j){var g=C,{id:t,label:r,error:s=!1,success:a=!1,helperText:o,size:i="md",variant:c="outlined",leftIcon:u,rightIcon:d,showClearButton:f=!1,onClear:p,className:m="",disabled:h=!1,type:x="text",value:v,onChange:k}=g,b=O(g,["id","label","error","success","helperText","size","variant","leftIcon","rightIcon","showClearButton","onClear","className","disabled","type","value","onChange"]);const y=l.useMemo(()=>t||`input-${Math.random().toString(36).substr(2,9)}`,[t]),N=l.useMemo(()=>s?`${y}-error`:void 0,[s,y]),_=l.useMemo(()=>o?`${y}-helper`:void 0,[o,y]),[S,M]=l.useState(!1),F=l.useMemo(()=>x==="password",[x]),A=l.useMemo(()=>F&&S?"text":x,[F,S,x]),R=l.useMemo(()=>s?"error":a?"success":"default",[s,a]),I=l.useMemo(()=>v!=null&&v!=="",[v]),L=l.useMemo(()=>f&&I&&!h,[f,I,h]),z=l.useMemo(()=>"focus:border-line-focus",[]),Y=l.useMemo(()=>"focus:border-error",[]),q=l.useMemo(()=>"focus:border-success",[]),W=l.useMemo(()=>z.replace("focus:border-","focus:ring-"),[z]),ae=l.useCallback(V=>V==="error"?Y.replace("focus:border-","focus:ring-"):q.replace("focus:border-","focus:ring-"),[Y,q]),se=xe(w("w-full",J("md"),"transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed"),{variants:{variant:{default:w("border-0","border-b-2","border-line-default","focus:border-line-focus"),outlined:w("border","border-line-default","focus:border-line-focus"),filled:w("bg-surface-muted","border-0","focus:bg-surface-base","focus:ring-2",W)},size:{sm:w("h-8",re("bodySmall"),E("md","px")),md:w("h-10",re("body"),E("base","px")),lg:w("h-12",re("bodyLarge"),E("lg","px"))},state:{default:"",error:w("border-error","focus:border-error",ae("error")),success:w("border-success","focus:border-success",ae("success"))}},defaultVariants:{variant:"outlined",size:"md",state:"default"}}),D=l.useMemo(()=>w(se({variant:c,size:i,state:R}),u&&(i==="sm"?"pl-9":i==="lg"?"pl-12":"pl-10"),(d||L||F)&&(i==="sm"?"pr-9":i==="lg"?"pr-12":"pr-10"),m),[c,i,R,u,d,L,F,m]),B=l.useMemo(()=>w("block",ce("label"),E("xs","mb"),h&&"opacity-50"),[h]),X=l.useMemo(()=>i==="sm"?"h-4 w-4":i==="lg"?"h-5 w-5":"h-4 w-4",[i]),Q=l.useMemo(()=>i==="sm"?"top-2":i==="lg"?"top-3.5":"top-2.5",[i]),H=l.useCallback(V=>{var ne;if(V.stopPropagation(),p)p();else if(k){const oe=(ne=V.currentTarget.closest(".relative"))==null?void 0:ne.querySelector("input");if(oe){const ie={target:oe,currentTarget:oe,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:2,isTrusted:!1,nativeEvent:new Event("change"),preventDefault:()=>{},stopPropagation:()=>{},persist:()=>{},timeStamp:Date.now()};Object.defineProperty(ie.target,"value",{value:"",writable:!0}),Object.defineProperty(ie.currentTarget,"value",{value:"",writable:!0}),k(ie)}}},[p,k]),U=l.useCallback(()=>{M(V=>!V)},[]);return n.jsxs("div",{className:"w-full",children:[r&&n.jsx("label",{htmlFor:y,className:B,children:r}),n.jsxs("div",{className:"relative",children:[u&&n.jsx("div",{className:`absolute left-3 ${Q} text-fg-secondary opacity-60 pointer-events-none`,children:n.jsx("div",{className:X,children:u})}),n.jsx("input",T({id:y,ref:j,type:A,className:D,disabled:h,value:v,onChange:k,"aria-invalid":s,"aria-required":b.required,"aria-describedby":N||_,suppressHydrationWarning:!0},b)),n.jsxs("div",{className:"absolute right-3 top-0 bottom-0 flex items-center gap-1",children:[L&&n.jsx(Z,{variant:"ghost",size:"sm",onClick:H,className:"h-auto p-1","aria-label":"Clear input",children:n.jsx(we,{className:X})}),F&&n.jsx(Z,{variant:"ghost",size:"sm",onClick:U,className:"h-auto p-1","aria-label":S?"Hide password":"Show password",children:S?n.jsx(ql,{className:X}):n.jsx(Kl,{className:X})}),d&&!L&&!F&&n.jsx("div",{className:`text-fg-secondary opacity-60 pointer-events-none ${X}`,children:d})]})]}),(s||a||o)&&n.jsx(vc,{error:s,success:a,helperText:o,errorId:N,helperId:_})]})}));ke.displayName="Input";function ma({href:e,active:t}){const r=l.useMemo(()=>t!==void 0?t:!1,[t]),s=l.useMemo(()=>{try{const a=typeof require!="undefined"?require("next/link"):null;return a==null?void 0:a.default}catch(a){return}},[]);return{isActive:r,NextLink:s}}const yc=xe(w("inline-flex","items-center","transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed","disabled:pointer-events-none","no-underline"),{variants:{variant:{default:w("text-fg-primary","hover:opacity-80","focus-visible:opacity-100","focus:ring-line-brand"),underline:w("text-fg-primary","hover:opacity-80","focus-visible:opacity-100","border-b-2","border-transparent","hover:border-current","focus:ring-line-brand"),background:w("text-fg-primary","hover:bg-surface-hover","rounded-md",J("md"),"focus:ring-line-brand")},size:{sm:w(E("sm","px"),E("xs","py"),re("bodySmall")),md:w(E("base","px"),E("sm","py"),re("body")),lg:w(E("lg","px"),E("md","py"),re("bodyLarge"))}},defaultVariants:{variant:"default",size:"md"},compoundVariants:[{variant:"underline",size:"sm",class:E("0.5","pb")},{variant:"underline",size:"md",class:E("xs","pb")},{variant:"underline",size:"lg",class:E("1.5","pb")},{variant:"background",size:"sm",class:E("xs","px")},{variant:"background",size:"md",class:E("sm","px")},{variant:"background",size:"lg",class:E("base","px")}]});function xs(m){var h=m,{href:e,children:t,active:r,disabled:s=!1,variant:a="default",size:o="md",as:i,className:c,"aria-label":u,onClick:d,onKeyDown:f}=h,p=O(h,["href","children","active","disabled","variant","size","as","className","aria-label","onClick","onKeyDown"]);const x=l.useMemo(()=>r!==void 0?r:!1,[r]),{NextLink:v}=ma({href:e,active:x}),k=i||v||"a",b=l.useMemo(()=>{if(!x)return"";switch(a){case"underline":return w("border-b-2","border-line-brand","text-fg-brand-emphasis");case"background":return w("bg-surface-brand-muted","text-fg-brand-emphasis");case"default":default:return w("text-fg-brand-emphasis","font-semibold")}},[x,a]),j=l.useCallback(y=>{if(s){y.preventDefault(),y.stopPropagation();return}d==null||d(y)},[s,d]),C=l.useCallback(y=>{if(s){(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation());return}f==null||f(y)},[s,f]),g=l.useMemo(()=>{const y=T({className:w(yc({variant:a,size:o}),b,s&&"opacity-50 cursor-not-allowed pointer-events-none",c),"aria-current":x?"page":void 0,"aria-disabled":s?!0:void 0,"aria-label":u,tabIndex:s?-1:void 0,onClick:j,onKeyDown:C,"data-active":x,"data-disabled":s},p);return v&&!i?P(T({},y),{href:s?void 0:e}):P(T({},y),{href:s?void 0:e})},[a,o,b,s,c,x,u,j,C,e,v,i,p]);return n.jsx(k,P(T({},g),{children:t}))}const wc=xe(w("inline-flex","items-center","justify-center",Fe("label"),J("md"),"border"),{variants:{variant:{success:"",warning:"",error:"",info:"",neutral:"",primary:"",secondary:""},size:{sm:w(E("1.5","px"),E("0.5","py"),re("caption")),md:w(E("sm","px"),E("xs","py"),re("caption")),lg:w(E("sm","px"),E("xs","py"),re("bodySmall"))},style:{solid:"",outline:""}},compoundVariants:[{variant:"success",style:"solid",class:w("bg-success-bg","text-success-dark","border-success")},{variant:"warning",style:"solid",class:w("bg-warning-bg","text-warning-dark","border-warning")},{variant:"error",style:"solid",class:w("bg-error-bg","text-error-dark","border-error")},{variant:"info",style:"solid",class:w("bg-info-bg","text-info-dark","border-info")},{variant:"neutral",style:"solid",class:w("bg-surface-muted","text-fg-primary","border-line-default")},{variant:"primary",style:"solid",class:w("bg-surface-brand-subtle","text-fg-brand-emphasis","border-line-brand")},{variant:"secondary",style:"solid",class:w("bg-pink-300","text-fg-brand-secondary-emphasis","border-line-secondary")},{variant:"success",style:"outline",class:w("bg-transparent","border-success","text-fg-success")},{variant:"warning",style:"outline",class:w("bg-transparent","border-warning","text-fg-warning")},{variant:"error",style:"outline",class:w("bg-transparent","border-error","text-fg-error")},{variant:"info",style:"outline",class:w("bg-transparent","border-info","text-fg-info")},{variant:"neutral",style:"outline",class:w("bg-transparent","border-line-default","text-fg-secondary")},{variant:"primary",style:"outline",class:w("bg-transparent","border-line-brand","text-fg-brand")},{variant:"secondary",style:"outline",class:w("bg-transparent","border-line-secondary","text-fg-brand-secondary")}],defaultVariants:{variant:"neutral",size:"md",style:"solid"}}),pa=l.memo(l.forwardRef(function(d,u){var f=d,{variant:t="neutral",size:r="md",style:s="solid",className:a="",children:o,"aria-label":i}=f,c=O(f,["variant","size","style","className","children","aria-label"]);const p=l.useMemo(()=>w(wc({variant:t,size:r,style:s}),a),[t,r,s,a]),m=l.useMemo(()=>{if(i)return i;if(typeof o=="string")return o;if(typeof o=="object"&&o!==null&&"props"in o){const h=o.props;if(h!=null&&h.children&&typeof h.children=="string")return h.children}},[i,o]);return n.jsx("span",P(T({ref:u,role:"status","aria-label":m,className:p},c),{children:o}))}));pa.displayName="Badge";const kc=l.memo(function({error:t,success:r,helperText:s,errorId:a,helperId:o}){const i=l.useMemo(()=>w(E("xs","mt"),ce("caption"),t&&"text-fg-error",r&&"text-fg-success",!t&&!r&&"text-fg-secondary"),[t,r]),c=l.useMemo(()=>s||(t?"Error":r?"Success":""),[s,t,r]);return n.jsx("div",{id:a||o,className:i,role:t||r?"alert":void 0,children:c})}),jr=l.memo(l.forwardRef(function(x,h){var v=x,{options:t=[],optionGroups:r,placeholder:s,label:a,error:o=!1,success:i=!1,helperText:c,size:u="md",className:d="",disabled:f=!1,id:p}=v,m=O(v,["options","optionGroups","placeholder","label","error","success","helperText","size","className","disabled","id"]);const k=l.useMemo(()=>p||`select-${Math.random().toString(36).substr(2,9)}`,[p]),b=l.useMemo(()=>o?`${k}-error`:void 0,[o,k]),j=l.useMemo(()=>c?`${k}-helper`:void 0,[c,k]),C=l.useMemo(()=>"focus:border-line-focus",[]),g=l.useMemo(()=>"focus:border-error",[]),y=l.useMemo(()=>"focus:border-success",[]),N=l.useCallback(A=>A==="error"?g.replace("focus:border-","focus:ring-"):A==="success"?y.replace("focus:border-","focus:ring-"):C.replace("focus:border-","focus:ring-"),[g,y,C]),_=xe(w("block","w-full",J("md"),"border","bg-surface-base","transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed"),{variants:{size:{sm:w("h-8",re("bodySmall"),E("md","px")),md:w("h-10",re("body"),E("base","px")),lg:w("h-12",re("bodyLarge"),E("lg","px"))},state:{default:w("border-line-default",N()),error:w("border-error",N("error")),success:w("border-success",N("success"))}},defaultVariants:{size:"md",state:"default"}}),S=l.useMemo(()=>o?"error":i?"success":"default",[o,i]),M=l.useMemo(()=>w(_({size:u,state:S}),d),[u,S,d]),F=l.useMemo(()=>w("block",ce("label"),E("xs","mb"),f&&"opacity-50"),[f]);return n.jsxs("div",{className:"w-full",children:[a&&n.jsx("label",{htmlFor:k,className:F,children:a}),n.jsxs("select",P(T({id:k,ref:h,className:M,disabled:f,"aria-invalid":o,"aria-required":m.required,"aria-describedby":b||j},m),{children:[s&&n.jsx("option",{value:"",disabled:!0,children:s}),r&&r.length>0?r.map((A,R)=>n.jsx("optgroup",{label:A.label,children:(A.options||[]).map(I=>n.jsx("option",{value:I.value,disabled:I.disabled,children:I.label},I.value))},R)):(t||[]).map(A=>n.jsx("option",{value:A.value,disabled:A.disabled,children:A.label},A.value))]})),(o||i||c)&&n.jsx(kc,{error:o,success:i,helperText:c,errorId:b,helperId:j})]})}));jr.displayName="Select";const ha=l.memo(l.forwardRef(function(i,o){var c=i,{error:t=!1,resize:r="vertical",className:s=""}=c,a=O(c,["error","resize","className"]);const u=l.useMemo(()=>"focus:border-line-focus",[]),d=l.useMemo(()=>"focus:border-error",[]),f=l.useMemo(()=>t?d.replace("focus:border-","focus:ring-"):u.replace("focus:border-","focus:ring-"),[t,d,u]),p=l.useMemo(()=>({none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"}),[]),m=l.useMemo(()=>w("block","w-full",J("md"),E("base","px"),E("md","py"),"border",re("body"),"focus:outline-none","focus:ring-2","focus:ring-offset-2",p[r],w(t?"border-error":"border-line-default",f),s),[r,p,t,f,s]),h=l.useMemo(()=>t&&a.id?`${a.id}-error`:void 0,[t,a.id]);return n.jsx("textarea",T({ref:o,className:m,"aria-invalid":t,"aria-describedby":h},a))}));ha.displayName="Textarea";const Mt=l.memo(l.forwardRef(function(i,o){var c=i,{variant:t="default",className:r="",children:s}=c,a=O(c,["variant","className","children"]);const u=l.useMemo(()=>w("block",re("label"),Fe("label"),"text-fg-primary"),[]),d=l.useMemo(()=>({default:"",required:w("after:content-['*']",`after:${E("0.5","ml")}`,"after:text-fg-error"),optional:w("after:content-['(optional)']","after:ml-1","after:text-fg-tertiary","after:font-normal")}),[]),f=l.useMemo(()=>w(u,d[t],r),[u,d,t,r]);return n.jsx("label",P(T({ref:o,className:f},a),{children:s}))}));Mt.displayName="Label";function ba(a){var o=a,{message:e,id:t,className:r=""}=o,s=O(o,["message","id","className"]);const i=[E("xs","mt"),re("bodySmall"),"text-fg-error","flex","items-center",E("xs","gap")],c=w(...i,r);return n.jsxs("div",P(T({role:"alert",id:t,className:c,"aria-live":"polite"},s),{children:[n.jsx(bs,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),n.jsx("span",{children:e})]}))}class Ie{static createWidth(t){const s={none:{px:0,tailwind:"border-0"},thin:{px:1,tailwind:"border"},base:{px:1,tailwind:"border"},medium:{px:2,tailwind:"border-2"},thick:{px:4,tailwind:"border-4"}}[t];return{value:s.px,px:`${s.px}px`,tailwind:s.tailwind}}static create(t,r="solid"){return{width:this.createWidth(t),style:r,description:`${t} ${r} border`}}}Ie.create("none"),Ie.create("thin"),Ie.create("base"),Ie.create("medium"),Ie.create("thick"),Ie.create("thin","dashed"),Ie.create("base","dashed"),Ie.create("thin","dotted"),Ie.create("base","dotted");function jc(e){return Ie.createWidth(e).tailwind}function Ut(u){var d=u,{content:e,children:t,position:r="top",delay:s=200,className:a="","aria-label":o,preservePositioning:i=!1}=d,c=O(d,["content","children","position","delay","className","aria-label","preservePositioning"]);const[f,p]=l.useState(!1),m=l.useRef(null),h=l.useRef(null),x=l.useRef(null),v=`tooltip-${Math.random().toString(36).substr(2,9)}`,k=()=>{const F=setTimeout(()=>{p(!0)},s);m.current=F},b=()=>{m.current&&(clearTimeout(m.current),m.current=null),p(!1)},j=()=>{p(!0)},C=()=>{p(!1)},g=F=>{var A;F.key==="Escape"&&(p(!1),(A=x.current)==null||A.blur())};l.useEffect(()=>()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),l.useEffect(()=>{if(!f)return;const F=A=>{h.current&&!h.current.contains(A.target)&&x.current&&!x.current.contains(A.target)&&p(!1)};return document.addEventListener("mousedown",F),()=>{document.removeEventListener("mousedown",F)}},[f]);const y=F=>({top:"border-t-surface-inverse",bottom:"border-b-surface-inverse",left:"border-l-surface-inverse",right:"border-r-surface-inverse"})[F],N=xe(w("absolute",ue("tooltip"),E("sm","px"),E("xs","py"),re("caption"),"text-fg-inverse","bg-surface-inverse",J("md"),"shadow-lg","whitespace-nowrap"),{variants:{position:{top:w("bottom-full","left-1/2","transform","-translate-x-1/2",E("sm","mb")),bottom:w("top-full","left-1/2","transform","-translate-x-1/2",E("sm","mt")),left:w("right-full","top-1/2","transform","-translate-y-1/2",E("sm","mr")),right:w("left-full","top-1/2","transform","-translate-y-1/2",E("sm","ml"))}},defaultVariants:{position:"top"}}),_=xe(w("absolute","w-0","h-0",jc("thick"),"border-transparent"),{variants:{position:{top:w("top-full","left-1/2","transform","-translate-x-1/2",y("top")),bottom:w("bottom-full","left-1/2","transform","-translate-x-1/2",y("bottom")),left:w("left-full","top-1/2","transform","-translate-y-1/2",y("left")),right:w("right-full","top-1/2","transform","-translate-y-1/2",y("right"))}},defaultVariants:{position:"top"}}),S=l.isValidElement(t)?(()=>{const F=t,A=F.props,R=A.ref;return l.cloneElement(F,{ref:I=>{x.current=I,typeof R=="function"?R(I):R&&typeof R=="object"&&"current"in R&&(R.current=I)},"aria-describedby":f?v:A["aria-describedby"],onMouseEnter:I=>{var L;k(),(L=A.onMouseEnter)==null||L.call(A,I)},onMouseLeave:I=>{var L;b(),(L=A.onMouseLeave)==null||L.call(A,I)},onFocus:I=>{var L;j(),(L=A.onFocus)==null||L.call(A,I)},onBlur:I=>{var L;C(),(L=A.onBlur)==null||L.call(A,I)},onKeyDown:I=>{var L;g(I),(L=A.onKeyDown)==null||L.call(A,I)}})})():t,M=w(i?"static":"relative","inline-block",a);return n.jsxs("div",P(T({className:M},c),{children:[S,f&&n.jsxs("div",{ref:h,id:v,className:w(N({position:r})),role:"tooltip","aria-live":"polite",children:[e,n.jsx("div",{className:w(_({position:r})),"aria-hidden":"true"})]})]}))}function ga(c){var u=c,{variant:e="text",width:t,height:r,lines:s=1,className:a="","aria-label":o}=u,i=O(u,["variant","width","height","lines","className","aria-label"]);const d=["motion-safe:animate-pulse","bg-surface-muted",J("sm")],f={text:"h-4",card:"h-32",list:"h-12",circle:"rounded-full"},p=w(...d,f[e],a),m={};t&&(m.width=t),r&&(m.height=r);const h=o||`Loading ${e} content`;return e==="text"&&s>1?n.jsx("div",P(T({className:E("sm","space-y"),role:"status","aria-busy":"true","aria-label":h},i),{children:Array.from({length:s}).map((x,v)=>n.jsx("div",{className:p,style:v===s-1?{width:"75%"}:m,"aria-hidden":"true"},v))})):n.jsx("div",T({className:p,style:m,role:"status","aria-busy":"true","aria-label":h},i))}function Nc({defaultOpen:e=!0,open:t,onOpenChange:r,storageKey:s}){const a=l.useCallback(()=>{if(s&&typeof window!="undefined"){const f=localStorage.getItem(s);if(f!==null)return f==="true"}return e},[e,s]),[o,i]=l.useState(a),c=t!==void 0?t:o;l.useEffect(()=>{s&&typeof window!="undefined"&&t===void 0&&localStorage.setItem(s,String(o))},[o,s,t]);const u=l.useCallback(f=>{t===void 0&&i(f),r==null||r(f)},[t,r]),d=l.useCallback(()=>{u(!c)},[c,u]);return{isOpen:c,toggle:d,setOpen:u}}function xa(f){var p=f,{children:e,trigger:t,defaultOpen:r=!0,open:s,onOpenChange:a,disabled:o=!1,duration:i=200,storageKey:c,className:u=""}=p,d=O(p,["children","trigger","defaultOpen","open","onOpenChange","disabled","duration","storageKey","className"]);const{isOpen:m,toggle:h}=Nc({defaultOpen:r,open:s,onOpenChange:a,storageKey:c}),x=l.useRef(null),[v,k]=l.useState(m?"auto":0);l.useEffect(()=>{x.current&&k(m?x.current.scrollHeight:0)},[m,e]),l.useEffect(()=>{if(!m||!x.current)return;const j=new ResizeObserver(()=>{x.current&&m&&k(x.current.scrollHeight)});return j.observe(x.current),()=>{j.disconnect()}},[m]);const b=`collapsible-content-${Math.random().toString(36).substr(2,9)}`;return n.jsxs("div",P(T({className:u},d),{children:[n.jsx("button",{type:"button",onClick:h,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o||h())},disabled:o,"aria-expanded":m,"aria-controls":b,"aria-disabled":o,className:w("w-full","text-left","focus:outline-none","focus:ring-2","focus:ring-line-brand","focus:ring-offset-2",J("md")),children:t}),n.jsx("div",{id:b,ref:x,style:{height:typeof v=="number"?`${v}px`:v,overflow:"hidden",transition:`height ${i}ms ease-in-out`},"aria-hidden":!m,children:n.jsx("div",{children:e})})]}))}const Nr=l.memo(l.forwardRef(function(f,d){var p=f,{id:t,label:r,error:s=!1,helperText:a,className:o="",disabled:i=!1,indeterminate:c=!1}=p,u=O(p,["id","label","error","helperText","className","disabled","indeterminate"]);const m=l.useMemo(()=>t||`checkbox-${Math.random().toString(36).substr(2,9)}`,[t]),h=l.useMemo(()=>s?`${m}-error`:void 0,[s,m]),x=l.useMemo(()=>a?`${m}-helper`:void 0,[a,m]),v=l.useMemo(()=>"focus:border-line-focus",[]),k=l.useMemo(()=>"focus:border-error",[]),b=l.useMemo(()=>s?k.replace("focus:border-","focus:ring-"):v.replace("focus:border-","focus:ring-"),[s,k,v]),j=l.useMemo(()=>w("h-4","w-4",J("sm"),"border","border-line-default","text-fg-brand","focus:ring-2",b,"focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed","cursor-pointer",s&&"border-error",o),[b,s,o]),C=l.useMemo(()=>w(ce("label"),E("sm","ml"),i?"opacity-50 cursor-not-allowed":"cursor-pointer"),[i]),g=l.useRef(null),y=l.useCallback(N=>{g.current=N,typeof d=="function"?d(N):d&&(d.current=N),N&&(N.indeterminate=c)},[d,c]);return l.useEffect(()=>{g.current&&(g.current.indeterminate=c)},[c]),n.jsxs("div",{className:w("flex","flex-col",E("sm","my")),children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("input",T({type:"checkbox",id:m,ref:y,className:j,disabled:i,"aria-invalid":s,"aria-describedby":h||x||void 0,"aria-label":r?void 0:"Checkbox"},u)),r&&n.jsx("label",{htmlFor:m,className:C,children:r})]}),(s||a)&&n.jsx("div",{id:h||x,className:w(E("xs","mt"),ce("caption"),s?"text-fg-error":"text-fg-secondary"),role:s?"alert":void 0,children:s?a||"This field has an error":a})]})}));Nr.displayName="Checkbox";const va=l.memo(l.forwardRef(function(d,u){var f=d,{id:t,label:r,error:s=!1,helperText:a,className:o="",disabled:i=!1}=f,c=O(f,["id","label","error","helperText","className","disabled"]);const p=l.useMemo(()=>t||`radio-${Math.random().toString(36).substr(2,9)}`,[t]),m=l.useMemo(()=>s?`${p}-error`:void 0,[s,p]),h=l.useMemo(()=>a?`${p}-helper`:void 0,[a,p]),x=l.useMemo(()=>"focus:border-line-focus",[]),v=l.useMemo(()=>"focus:border-error",[]),k=l.useMemo(()=>s?v.replace("focus:border-","focus:ring-"):x.replace("focus:border-","focus:ring-"),[s,v,x]),b=l.useMemo(()=>w("h-4","w-4","border","border-line-default","text-fg-brand","focus:ring-2",k,"focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed","cursor-pointer",s&&"border-error",o),[k,s,o]),j=l.useMemo(()=>w(ce("label"),E("sm","ml"),i?"opacity-50 cursor-not-allowed":"cursor-pointer"),[i]);return n.jsxs("div",{className:w("flex","flex-col",E("sm","my")),children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("input",T({type:"radio",id:p,ref:u,className:b,disabled:i,"aria-invalid":s,"aria-describedby":m||h||void 0,"aria-label":r?void 0:"Radio button"},c)),r&&n.jsx("label",{htmlFor:p,className:j,children:r})]}),(s||a)&&n.jsx("div",{id:m||h,className:w(E("xs","mt"),ce("caption"),s?"text-fg-error":"text-fg-secondary"),role:s?"alert":void 0,children:s?a||"This field has an error":a})]})}));va.displayName="Radio";class ft{static create(t){return{none:{value:"none",tailwind:"shadow-none",description:"No shadow"},sm:{value:"0 1px 2px 0 rgb(0 0 0 / 0.05)",tailwind:"shadow-sm",description:"Small shadow for subtle elevation"},md:{value:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",tailwind:"shadow-md",description:"Medium shadow for cards and elevated elements"},lg:{value:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",tailwind:"shadow-lg",description:"Large shadow for modals and dropdowns"},xl:{value:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",tailwind:"shadow-xl",description:"Extra large shadow for prominent modals"},"2xl":{value:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",tailwind:"shadow-2xl",description:"2X large shadow for maximum elevation"},inner:{value:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",tailwind:"shadow-inner",description:"Inner shadow for inset elements"}}[t]}}const Sc={none:ft.create("none"),sm:ft.create("sm"),md:ft.create("md"),lg:ft.create("lg"),xl:ft.create("xl"),"2xl":ft.create("2xl"),inner:ft.create("inner")};function Se(e){return Sc[e].tailwind}const Ot={track:{sm:{w:"w-9",h:"h-5"},md:{w:"w-11",h:"h-6"},lg:{w:"w-14",h:"h-7"}},thumb:{sm:{w:"w-4",h:"h-4"},md:{w:"w-5",h:"h-5"},lg:{w:"w-6",h:"h-6"}},translate:{sm:"translate-x-4",md:"translate-x-5",lg:"translate-x-7"}};function Cc(e){return{track:`${Ot.track[e].w} ${Ot.track[e].h}`,thumb:`${Ot.thumb[e].w} ${Ot.thumb[e].h}`,translate:Ot.translate[e]}}const $c=xe("w-full",{variants:{size:{sm:"h-1",md:"h-2",lg:"h-3"},variant:{primary:"bg-surface-muted",secondary:"bg-surface-muted",success:"bg-success-bg-emphasis",error:"bg-error-bg-emphasis",warning:"bg-warning-bg-emphasis",info:"bg-info-bg-emphasis"}},defaultVariants:{size:"md",variant:"primary"}}),En=xe("transition-all",{variants:{variant:{primary:"bg-surface-brand",secondary:"bg-surface-secondary",success:"bg-success",error:"bg-error",warning:"bg-warning",info:"bg-info"}},defaultVariants:{variant:"primary"}}),vs=l.forwardRef(function(p,f){var m=p,{value:t,max:r=100,variant:s="primary",size:a="md",showLabel:o=!1,label:i,"aria-label":c,className:u=""}=m,d=O(m,["value","max","variant","size","showLabel","label","aria-label","className"]);const h=t===void 0,x=h?void 0:Math.min(Math.max(t/r*100,0),100),v=c||(h?"Loading in progress":`Progress: ${x==null?void 0:x.toFixed(0)}%`);return n.jsxs("div",P(T({ref:f,className:w("w-full",u)},d),{children:[o&&(i||!h)&&n.jsxs("div",{className:w("flex","items-center","justify-between",E("xs","mb")),children:[i&&n.jsx("span",{className:w(re("bodySmall"),Fe("label"),"text-fg-primary"),children:i}),!h&&x!==void 0&&n.jsxs("span",{className:w(re("bodySmall"),"text-fg-secondary"),children:[x.toFixed(0),"%"]})]}),n.jsx("div",{role:"progressbar","aria-valuemin":h?void 0:0,"aria-valuemax":h?void 0:r,"aria-valuenow":h?void 0:t,"aria-label":v,"aria-busy":h,className:w("relative","w-full","overflow-hidden",$c({size:a,variant:s}),J("full")),children:h?n.jsx("div",{className:w("absolute","top-0","left-0","bottom-0",En({variant:s}),J("full"),"motion-reduce:animate-none"),style:{width:"30%",animation:"progress-indeterminate 1.5s ease-in-out infinite"}}):n.jsx("div",{className:w("h-full",En({variant:s}),J("full"),"transition-all","duration-300","ease-out"),style:{width:`${x}%`},"aria-hidden":"true"})})]}))});vs.displayName="Progress";const ya=l.memo(l.forwardRef(function(m,p){var h=m,{size:t="md",label:r,description:s,error:a=!1,className:o="",disabled:i=!1,checked:c,onChange:u,id:d}=h,f=O(h,["size","label","description","error","className","disabled","checked","onChange","id"]);const x=l.useMemo(()=>d||`switch-${Math.random().toString(36).substr(2,9)}`,[d]),v=l.useMemo(()=>r?`${x}-label`:void 0,[r,x]),k=l.useMemo(()=>s?`${x}-description`:void 0,[s,x]),b=l.useMemo(()=>Cc(t),[t]),j=l.useMemo(()=>"focus:border-line-focus".replace("focus:border-","focus:ring-"),[]),C=l.useMemo(()=>w("relative","inline-flex","shrink-0","cursor-pointer","rounded-full","border-2","border-transparent",he("base"),"focus:outline-none","focus:ring-2",j,"focus:ring-offset-2",b.track,c?"bg-surface-brand":"bg-surface-muted",a&&!c&&"border-error",i&&"opacity-50 cursor-not-allowed",o),[j,b.track,c,a,i,o]),g=l.useMemo(()=>w("pointer-events-none","inline-block","rounded-full","bg-surface-base","shadow","transform",he("base"),b.thumb,c?b.translate:"translate-x-0"),[b.thumb,b.translate,c]);return n.jsxs("div",{className:w("flex","items-start",E("md","gap")),children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("button",{type:"button",className:C,role:"switch","aria-checked":c,"aria-labelledby":v,"aria-describedby":k,disabled:i,onClick:l.useCallback(y=>{if(!i&&u){const N=P(T({},y),{target:P(T({},y.target),{checked:!c}),currentTarget:P(T({},y.currentTarget),{checked:!c})});u(N)}},[i,u,c]),onKeyDown:l.useCallback(y=>{if((y.key==="Enter"||y.key===" ")&&!i&&u){y.preventDefault();const N=P(T({},y),{target:P(T({},y.target),{checked:!c}),currentTarget:P(T({},y.currentTarget),{checked:!c})});u(N)}},[i,u,c]),children:n.jsx("span",{className:g})}),n.jsx("input",T({ref:p,type:"checkbox",id:x,checked:c,onChange:u,disabled:i,className:"sr-only","aria-hidden":"true"},f))]}),(r||s)&&n.jsxs("div",{className:"flex-1",children:[r&&n.jsx("label",{id:v,htmlFor:x,className:w("block",re("bodySmall"),Fe("label"),a?"text-fg-error":"text-fg-primary",i?"opacity-50":"cursor-pointer"),children:r}),s&&n.jsx("p",{id:k,className:w(E("xs","mt"),re("bodySmall"),a?"text-fg-error":"text-fg-secondary"),children:s})]})]})}));ya.displayName="Switch";const ys=l.memo(function(o){var i=o,{orientation:t="horizontal",variant:r="solid",className:s=""}=i,a=O(i,["orientation","variant","className"]);const c=l.useMemo(()=>{const u=["border-0","border-line-default"],d={horizontal:"w-full border-t",vertical:"h-full border-l self-stretch"},f={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted"};return w(...u,d[t],f[r],s)},[t,r,s]);return t==="vertical"?n.jsx("div",T({className:c,role:"separator","aria-orientation":"vertical"},a)):n.jsx("hr",T({className:c,role:"separator","aria-orientation":"horizontal"},a))});ys.displayName="Separator";const wa=l.forwardRef(function(b,k){var j=b,{value:t,defaultValue:r,min:s=0,max:a=100,step:o=1,variant:i="single",size:c="md",disabled:u=!1,showValue:d=!1,marks:f=[],onChange:p,onValueChange:m,label:h,className:x=""}=j,v=O(j,["value","defaultValue","min","max","step","variant","size","disabled","showValue","marks","onChange","onValueChange","label","className"]);const C=l.useRef(null),[g,y]=l.useState(r||(i==="range"?[s,a]:s)),[N,_]=l.useState(!1),[S,M]=l.useState(null),F=t!==void 0,A=F?t:g,R=H=>(H-s)/(a-s)*100,I=H=>{if(!C.current)return s;const U=C.current.getBoundingClientRect(),V=Math.max(0,Math.min(1,(H-U.left)/U.width)),ne=s+V*(a-s);return Math.round(ne/o)*o},L=(H,U="min")=>{if(u)return;H.preventDefault(),_(!0),M(U);const V=oe=>{if(!C.current)return;const ie=I(oe.clientX);z(ie,U)},ne=()=>{_(!1),M(null),document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",ne)};document.addEventListener("mousemove",V),document.addEventListener("mouseup",ne)},z=(H,U="min")=>{const V=Math.max(s,Math.min(a,H));if(i==="range"){const[ne,oe]=Array.isArray(A)?A:[s,a];let ie;U==="min"?ie=[Math.min(V,oe),oe]:ie=[ne,Math.max(V,ne)],F||y(ie),p==null||p(ie),m==null||m(ie)}else F||y(V),p==null||p(V),m==null||m(V)},Y=H=>{if(u||N)return;const U=I(H.clientX);z(U)},q=()=>"focus:ring-line-brand ring-offset-2",W=xe(w("relative","cursor-pointer"),{variants:{size:{sm:"h-1",md:"h-2",lg:"h-3"},disabled:{true:"opacity-50 cursor-not-allowed",false:""}},defaultVariants:{size:"md",disabled:!1}}),ae=xe(w("absolute","bg-surface-brand","rounded-full","border-2","border-white","shadow-md","cursor-grab","active:cursor-grabbing",he("base"),"-translate-x-1/2","-translate-y-1/2","top-1/2"),{variants:{size:{sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5"},active:{true:q(),false:""}},defaultVariants:{size:"md",active:!1}}),se=typeof A=="number"?A:A[0],D=Array.isArray(A)?A[0]:s,B=Array.isArray(A)?A[1]:se,X=R(D),Q=R(B);return n.jsxs("div",P(T({ref:k,className:w("w-full",x)},v),{children:[h&&n.jsxs("label",{className:w("block",re("bodySmall"),Fe("label"),"text-fg-primary",E("sm","mb")),children:[h,d&&n.jsx("span",{className:w(E("sm","ml"),"text-fg-secondary"),children:i==="range"?`${D} - ${B}`:se})]}),n.jsxs("div",{ref:C,className:w(W({size:c,disabled:u}),"bg-surface-muted",J("full")),onClick:Y,role:i==="range"?void 0:"slider","aria-valuemin":i==="range"?void 0:s,"aria-valuemax":i==="range"?void 0:a,"aria-valuenow":i==="range"?void 0:se,"aria-disabled":i==="range"?void 0:u,"aria-label":i==="range"?void 0:h,children:[n.jsx("div",{className:w("absolute",W({size:c}),"bg-surface-brand",J("full"),he("base")),style:{left:`${X}%`,width:`${Q-X}%`}}),f.map(H=>{const U=R(H);return n.jsx("div",{className:w("absolute","w-1","h-1","bg-line-strong",J("full"),"-translate-x-1/2"),style:{left:`${U}%`,top:"50%",transform:"translate(-50%, -50%)"}},H)}),i==="range"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:w(ae({size:c,active:S==="min"})),style:{left:`${X}%`},onMouseDown:H=>L(H,"min"),role:"slider","aria-valuemin":s,"aria-valuemax":B,"aria-valuenow":D}),n.jsx("div",{className:w(ae({size:c,active:S==="max"})),style:{left:`${Q}%`},onMouseDown:H=>L(H,"max"),role:"slider","aria-valuemin":D,"aria-valuemax":a,"aria-valuenow":B})]}):n.jsx("div",{className:w(ae({size:c,active:N})),style:{left:`${Q}%`},onMouseDown:H=>L(H)}),d&&!h&&n.jsx("div",{className:"absolute -top-6 left-0 right-0 flex justify-center",children:n.jsx("span",{className:w(re("caption"),"text-fg-secondary","bg-surface-overlay",E("sm","px"),E("xs","py"),J("md"),"shadow"),children:i==="range"?`${D} - ${B}`:se})})]})]}))});wa.displayName="Slider";const Ec=xe(w("inline-flex","items-center","font-medium",J("full"),E("xs","gap")),{variants:{variant:{default:w("bg-surface-muted","text-fg-primary","border","border-line-default"),outlined:w("bg-transparent","text-fg-primary","border","border-line-default"),filled:w("bg-surface-brand-strong","text-fg-inverse","border","border-transparent")},size:{sm:w(E("xs","px"),E("xs","py"),re("caption")),md:w(E("sm","px"),E("xs","py"),re("bodySmall")),lg:w(E("md","px"),E("sm","py"),re("body"))},selected:{true:w("bg-surface-brand-strong","text-fg-inverse","border","border-line-brand"),false:""},disabled:{true:"opacity-50 cursor-not-allowed",false:""}},compoundVariants:[{selected:!0,variant:"default",class:""},{selected:!0,variant:"outlined",class:""},{selected:!0,variant:"filled",class:""}],defaultVariants:{variant:"default",size:"md",selected:!1,disabled:!1}}),ws=l.forwardRef(function(h,m){var x=h,{children:t,variant:r="default",size:s="md",onRemove:a,selected:o=!1,disabled:i=!1,className:c="","aria-label":u,onClick:d,tabIndex:f}=x,p=O(x,["children","variant","size","onRemove","selected","disabled","className","aria-label","onClick","tabIndex"]);const v=d!==void 0||o!==!1&&o!==void 0,k=o?"option":v?"button":void 0,j=(()=>{if(u)return u;if(typeof t=="string")return t;if(typeof t=="object"&&t!==null&&"props"in t){const y=t.props;if(y!=null&&y.children&&typeof y.children=="string")return y.children}})(),C=k==="button"&&!j,g=y=>{i||(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),d&&d())};return n.jsxs("div",P(T({ref:m,className:w(Ec({variant:r,size:s,selected:o,disabled:i}),a&&E("xs","pr"),v&&!i&&"cursor-pointer focus:outline-none focus:ring-2 focus:ring-line-focus focus:ring-offset-2",c),role:k,"aria-selected":o?!0:void 0,"aria-disabled":i,"aria-label":C?"Chip":u||(k==="button"?j:void 0),tabIndex:f!==void 0?f:v&&!i?0:void 0,onClick:i?void 0:d,onKeyDown:g},p),{children:[n.jsx("span",{children:t}),a&&!i&&n.jsx("button",{type:"button",onClick:y=>{y.stopPropagation(),a()},className:w(E("xs","ml"),"hover:bg-tint-hover",J("full"),E("xs","p"),"transition-colors","focus:outline-none","focus:ring-2","focus:ring-line-focus","focus:ring-offset-1"),"aria-label":`Remove ${j||"chip"}`,children:n.jsx(we,{className:"h-3 w-3","aria-hidden":"true"})})]}))});ws.displayName="Chip";const ur=l.forwardRef(function(f,d){var p=f,{src:t,alt:r,fallback:s,size:a="md",variant:o="circle","aria-label":i,className:c=""}=p,u=O(p,["src","alt","fallback","size","variant","aria-label","className"]);const[m,h]=l.useState(!1),[x,v]=l.useState(!1),k={xs:"h-6 w-6 text-xs",sm:"h-8 w-8 text-sm",md:"h-10 w-10 text-base",lg:"h-12 w-12 text-lg",xl:"h-16 w-16 text-xl"},b={circle:"rounded-full",square:"rounded-none",rounded:"rounded-md"},j=!t||m,C=typeof s=="string"?s.toUpperCase().slice(0,2):s,g=i||r||"User avatar";return n.jsxs("div",P(T({ref:d,className:w("relative","inline-flex","items-center","justify-center","shrink-0","font-medium","overflow-hidden",k[a],b[o],"bg-surface-muted","text-fg-primary",c),role:"img","aria-label":g},u),{children:[!j&&t&&n.jsx("img",{src:t,alt:r||"",className:w("w-full","h-full","object-cover",o==="circle"?"rounded-full":o==="square"?"rounded-none":"rounded-md",x?"opacity-100":"opacity-0","transition-opacity","duration-200"),onLoad:()=>v(!0),onError:()=>{h(!0),v(!1)},"aria-hidden":"true"}),j&&n.jsx("span",{className:w("flex","items-center","justify-center","w-full","h-full",o==="circle"?"rounded-full":o==="square"?"rounded-none":"rounded-md"),"aria-hidden":"true",children:C||"?"})]}))});ur.displayName="Avatar";function Mc(c){var u=c,{children:e,max:t=3,size:r="md",variant:s="circle",spacing:a="md",className:o=""}=u,i=O(u,["children","max","size","variant","spacing","className"]);const d={none:"",sm:"-space-x-1",md:"-space-x-2",lg:"-space-x-3"},f=l.Children.toArray(e).filter(Boolean),p=f.slice(0,t),m=f.length-t;return n.jsxs("div",P(T({className:w("flex","items-center",d[a],o),role:"group","aria-label":`${f.length} avatars`},i),{children:[p.map((h,x)=>{let v=h;if(l.isValidElement(h)&&h.type===ur){const k=h.props;v=l.cloneElement(h,{size:k.size||r,variant:k.variant||s})}return n.jsx("div",{className:"ring-2 ring-surface-base",style:{zIndex:f.length-x},children:v},x)}),m>0&&n.jsx(ur,{size:r,variant:s,fallback:`+${m}`,"aria-label":`${m} more avatars`,className:"ring-2 ring-surface-base",style:{zIndex:0}})]}))}const fr=l.memo(function(d){var f=d,{variant:t="default",padding:r="medium",className:s="",onClick:a,"aria-label":o,"aria-labelledby":i,children:c}=f,u=O(f,["variant","padding","className","onClick","aria-label","aria-labelledby","children"]);const p=xe(w("bg-surface-base",J("lg"),"border","border-line-default","shadow-sm"),{variants:{variant:{default:"",hover:w("hover:shadow-md","transition-shadow","cursor-pointer"),selected:w("border-line-brand","shadow-md")},padding:{none:"",small:E("xs","p"),medium:E("base","p"),large:E("lg","p")}},defaultVariants:{variant:"default",padding:"medium"}}),m=l.useMemo(()=>a!==void 0||t==="hover",[a,t]),h=m?"button":void 0,x=m?0:void 0,v=w(p({variant:t,padding:r}),s),k=l.useCallback(b=>{m&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),a==null||a())},[m,a]);return n.jsx("div",P(T({className:v,role:h,tabIndex:x,onClick:a,onKeyDown:k,"aria-label":o,"aria-labelledby":i},u),{children:c}))});fr.displayName="Card";const Sr=l.createContext(void 0);function ks(){const e=l.useContext(Sr);if(e===void 0)throw new Error("useFormContext must be used within a Form component with react-hook-form integration");return e}function Tc(){return l.useContext(Sr)}function ka({form:e,loading:t=!1,children:r}){const s={form:e,loading:t};return n.jsx(Sr.Provider,{value:s,children:r})}function Ac(c){var u=c,{children:e,onSubmit:t,loading:r=!1,error:s=null,success:a=null,className:o=""}=u,i=O(u,["children","onSubmit","loading","error","success","className"]);const d=w(E("lg","gap"),"flex","flex-col",o);if("form"in i&&i.form!==void 0){const v=i,{form:b,onSubmit:j,onSubmitError:C}=v,g=O(v,["form","onSubmit","onSubmitError"]),y=b.handleSubmit(N=>rr(null,null,function*(){try{yield j(N)}catch(_){C==null||C(_)}}),N=>{C==null||C(N)});return n.jsx(ka,{form:b,loading:r,children:n.jsxs("form",P(T({className:d,onSubmit:y,noValidate:!0},g),{children:[e,s&&n.jsx("div",{role:"alert",className:w(E("md","p"),ve("sm"),"text-error-dark","bg-error-bg","border","border-error",J("md")),children:s}),a&&n.jsx("div",{role:"alert",className:w(E("md","p"),ve("sm"),"text-success-dark","bg-success-bg","border","border-success",J("md")),children:a})]}))})}const p=i.onSubmit||t,k=i,{onSubmit:m}=k,h=O(k,["onSubmit"]),x=b=>{b.preventDefault(),p&&!r&&p(b)};return n.jsxs("form",P(T({className:d,onSubmit:x,noValidate:!0},h),{children:[e,s&&n.jsx("div",{role:"alert",className:w(E("md","p"),ve("sm"),"text-error-dark","bg-error-bg","border","border-error",J("md")),children:s}),a&&n.jsx("div",{role:"alert",className:w(E("md","p"),ve("sm"),"text-success-dark","bg-success-bg","border","border-success",J("md")),children:a})]}))}function Rc({name:e,label:t,children:r,rules:s,className:a=""}){var m;const{form:o}=ks();if(!o)throw new Error("FormField must be used within a Form component with react-hook-form integration");const{register:i,formState:{errors:c},watch:u}=o,d=i(e,s),f=(m=c[e])==null?void 0:m.message,p=u(e);return n.jsxs("div",{className:w("flex","flex-col",E("sm","gap"),a),children:[t&&n.jsx(Mt,{htmlFor:e,className:w("block",ve("sm"),Et("medium"),"text-fg-primary"),children:t}),r({name:e,register:h=>i(h,s),error:f,value:p,onChange:d.onChange,onBlur:d.onBlur}),f&&n.jsx(ba,{message:f})]})}var Ic=e=>e.type==="checkbox",Dc=e=>e instanceof Date,He=e=>e==null;const Lc=e=>typeof e=="object";var qe=e=>!He(e)&&!Array.isArray(e)&&Lc(e)&&!Dc(e),Fc=e=>{const t=e.constructor&&e.constructor.prototype;return qe(t)&&t.hasOwnProperty("isPrototypeOf")},ja=typeof window!="undefined"&&typeof window.HTMLElement!="undefined"&&typeof document!="undefined";function mt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList!="undefined"&&e instanceof FileList;if(ja&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(qe(e)&&Fc(e)))return e;const s=r?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(s[a]=mt(e[a]));return s}var js=e=>/^\w*$/.test(e),_e=e=>e===void 0,Na=e=>Array.isArray(e)?e.filter(Boolean):[],Ns=e=>Na(e.replace(/["|']|\]/g,"").split(/\.|\[/)),De=(e,t,r)=>{if(!t||!qe(e))return r;const s=(js(t)?[t]:Ns(t)).reduce((a,o)=>He(a)?a:a[o],e);return _e(s)||s===e?_e(e[t])?r:e[t]:s},Sa=e=>typeof e=="boolean",_c=e=>typeof e=="function",mr=(e,t,r)=>{let s=-1;const a=js(t)?[t]:Ns(t),o=a.length,i=o-1;for(;++s<o;){const c=a[s];let u=r;if(s!==i){const d=e[c];u=qe(d)||Array.isArray(d)?d:isNaN(+a[s+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;e[c]=u,e=e[c]}};const Ct={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},We={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ca=l.createContext(null);Ca.displayName="HookFormControlContext";const Pc=()=>l.useContext(Ca),zc=typeof window!="undefined"?l.useLayoutEffect:l.useEffect;var Xe=e=>typeof e=="string";const Oc=l.createContext(null);Oc.displayName="HookFormContext";var Vc=(e,t,r,s,a)=>t?P(T({},r[e]),{types:P(T({},r[e]&&r[e].types?r[e].types:{}),{[s]:a||!0})}):{},Le=e=>Array.isArray(e)?e:[e],pr=e=>qe(e)&&!Object.keys(e).length,Wc=e=>e.type==="file",Hc=e=>{if(!ja)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Bc=e=>e.type==="radio";function Uc(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=_e(e)?s++:e[t[s++]];return e}function qc(e){for(const t in e)if(e.hasOwnProperty(t)&&!_e(e[t]))return!1;return!0}function $a(e,t){const r=Array.isArray(t)?t:js(t)?[t]:Ns(t),s=r.length===1?e:Uc(e,r),a=r.length-1,o=r[a];return s&&delete s[o],a!==0&&(qe(s)&&pr(s)||Array.isArray(s)&&qc(s))&&$a(e,r.slice(0,-1)),e}var Ea=e=>e instanceof RegExp,ir=e=>({isOnSubmit:!e||e===Ct.onSubmit,isOnBlur:e===Ct.onBlur,isOnChange:e===Ct.onChange,isOnAll:e===Ct.all,isOnTouch:e===Ct.onTouched}),Gc=(e,t,r)=>t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length)));const os=(e,t,r,s)=>{for(const o of Object.keys(e)){const i=De(e,o);if(i){const a=i,{_f:c}=a,u=O(a,["_f"]);if(c){if(c.refs&&c.refs[0]&&t(c.refs[0],o))return!0;if(c.ref&&t(c.ref,c.name))return!0;if(os(u,t))break}else if(qe(u)&&os(u,t))break}}};var Kc=(e,t,r)=>{const s=Le(De(e,r));return mr(s,"root",t[r]),mr(e,r,s),e};function Mn(e,t,r="validate"){if(Xe(e)||Array.isArray(e)&&e.every(Xe)||Sa(e)&&!e)return{type:r,message:Xe(e)?e:"",ref:t}}var Nt=e=>qe(e)&&!Ea(e)?e:{value:e,message:""},Yc=(e,t,r,s,a,o)=>rr(null,null,function*(){const{ref:i,refs:c,required:u,maxLength:d,minLength:f,min:p,max:m,pattern:h,validate:x,name:v,valueAsNumber:k,mount:b}=e._f,j=De(r,v);if(!b||t.has(v))return{};const C=c?c[0]:i,g=M=>{a&&C.reportValidity&&(C.setCustomValidity(Sa(M)?"":M||""),C.reportValidity())},y={};Bc(i),Ic(i);const N=(k||Wc(i))&&_e(i.value)&&_e(j)||Hc(i)&&i.value===""||j===""||Array.isArray(j)&&!j.length,_=Vc.bind(null,v,s,y),S=(M,F,A,R=We.maxLength,I=We.minLength)=>{const L=M?F:A;y[v]=T({type:M?R:I,message:L,ref:i},_(M?R:I,L))};if(!Array.isArray(j)||!j.length){const{value:M,message:F}=Xe(u)?{value:!!u,message:u}:Nt(u);if(M&&(y[v]=T({type:We.required,message:F,ref:C},_(We.required,F)),!s))return g(F),y}if(!N&&(!He(p)||!He(m))){let M,F;const A=Nt(m),R=Nt(p);if(!He(j)&&!isNaN(j)){const I=i.valueAsNumber||j&&+j;He(A.value)||(M=I>A.value),He(R.value)||(F=I<R.value)}else{const I=i.valueAsDate||new Date(j),L=q=>new Date(new Date().toDateString()+" "+q),z=i.type=="time",Y=i.type=="week";Xe(A.value)&&j&&(M=z?L(j)>L(A.value):Y?j>A.value:I>new Date(A.value)),Xe(R.value)&&j&&(F=z?L(j)<L(R.value):Y?j<R.value:I<new Date(R.value))}if((M||F)&&(S(!!M,A.message,R.message,We.max,We.min),!s))return g(y[v].message),y}if((d||f)&&!N&&(Xe(j)||Array.isArray(j))){const M=Nt(d),F=Nt(f),A=!He(M.value)&&j.length>+M.value,R=!He(F.value)&&j.length<+F.value;if((A||R)&&(S(A,M.message,F.message),!s))return g(y[v].message),y}if(h&&!N&&Xe(j)){const{value:M,message:F}=Nt(h);if(Ea(M)&&!j.match(M)&&(y[v]=T({type:We.pattern,message:F,ref:i},_(We.pattern,F)),!s))return g(F),y}if(x){if(_c(x)){const M=yield x(j,r),F=Mn(M,C);if(F&&(y[v]=T(T({},F),_(We.validate,F.message)),!s))return g(F.message),y}else if(qe(x)){let M={};for(const F in x){if(!pr(M)&&!s)break;const A=Mn(yield x[F](j,r),C,F);A&&(M=T(T({},A),_(F,A.message)),g(A.message),s&&(y[v]=M))}if(!pr(M)&&(y[v]=T({ref:C},M),!s))return y}}return g(!0),y}),Ye=()=>{if(typeof crypto!="undefined"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance=="undefined"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},Kr=(e,t,r={})=>r.shouldFocus||_e(r.shouldFocus)?r.focusName||`${e}.${_e(r.focusIndex)?t:r.focusIndex}.`:"",Yr=(e,t)=>[...e,...Le(t)],Xr=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Jr(e,t,r){return[...e.slice(0,t),...Le(r),...e.slice(t)]}var Zr=(e,t,r)=>Array.isArray(e)?(_e(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Qr=(e,t)=>[...Le(t),...Le(e)];function Xc(e,t){let r=0;const s=[...e];for(const a of t)s.splice(a-r,1),r++;return Na(s).length?s:[]}var es=(e,t)=>_e(t)?[]:Xc(e,Le(t).sort((r,s)=>r-s)),ts=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Tn=(e,t,r)=>(e[t]=r,e);function Jc(e){const t=Pc(),{control:r=t,name:s,keyName:a="id",shouldUnregister:o,rules:i}=e,[c,u]=l.useState(r._getFieldArray(s)),d=l.useRef(r._getFieldArray(s).map(Ye)),f=l.useRef(!1);r._names.array.add(s),l.useMemo(()=>i&&c.length>=0&&r.register(s,i),[r,s,c.length,i]),zc(()=>r._subjects.array.subscribe({next:({values:g,name:y})=>{if(y===s||!y){const N=De(g,s);Array.isArray(N)&&(u(N),d.current=N.map(Ye))}}}).unsubscribe,[r,s]);const p=l.useCallback(g=>{f.current=!0,r._setFieldArray(s,g)},[r,s]),m=(g,y)=>{const N=Le(mt(g)),_=Yr(r._getFieldArray(s),N);r._names.focus=Kr(s,_.length-1,y),d.current=Yr(d.current,N.map(Ye)),p(_),u(_),r._setFieldArray(s,_,Yr,{argA:Xr(g)})},h=(g,y)=>{const N=Le(mt(g)),_=Qr(r._getFieldArray(s),N);r._names.focus=Kr(s,0,y),d.current=Qr(d.current,N.map(Ye)),p(_),u(_),r._setFieldArray(s,_,Qr,{argA:Xr(g)})},x=g=>{const y=es(r._getFieldArray(s),g);d.current=es(d.current,g),p(y),u(y),!Array.isArray(De(r._fields,s))&&mr(r._fields,s,void 0),r._setFieldArray(s,y,es,{argA:g})},v=(g,y,N)=>{const _=Le(mt(y)),S=Jr(r._getFieldArray(s),g,_);r._names.focus=Kr(s,g,N),d.current=Jr(d.current,g,_.map(Ye)),p(S),u(S),r._setFieldArray(s,S,Jr,{argA:g,argB:Xr(y)})},k=(g,y)=>{const N=r._getFieldArray(s);ts(N,g,y),ts(d.current,g,y),p(N),u(N),r._setFieldArray(s,N,ts,{argA:g,argB:y},!1)},b=(g,y)=>{const N=r._getFieldArray(s);Zr(N,g,y),Zr(d.current,g,y),p(N),u(N),r._setFieldArray(s,N,Zr,{argA:g,argB:y},!1)},j=(g,y)=>{const N=mt(y),_=Tn(r._getFieldArray(s),g,N);d.current=[..._].map((S,M)=>!S||M===g?Ye():d.current[M]),p(_),u([..._]),r._setFieldArray(s,_,Tn,{argA:g,argB:N},!0,!1)},C=g=>{const y=Le(mt(g));d.current=y.map(Ye),p([...y]),u([...y]),r._setFieldArray(s,[...y],N=>N,{},!0,!1)};return l.useEffect(()=>{if(r._state.action=!1,Gc(s,r._names)&&r._subjects.state.next(T({},r._formState)),f.current&&(!ir(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!ir(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([s]).then(g=>{r._updateIsValidating([s]);const y=De(g.errors,s),N=De(r._formState.errors,s);(N?!y&&N.type||y&&(N.type!==y.type||N.message!==y.message):y&&y.type)&&(y?mr(r._formState.errors,s,y):$a(r._formState.errors,s),r._subjects.state.next({errors:r._formState.errors}))});else{const g=De(r._fields,s);g&&g._f&&!(ir(r._options.reValidateMode).isOnSubmit&&ir(r._options.mode).isOnSubmit)&&Yc(g,r._names.disabled,r._formValues,r._options.criteriaMode===Ct.all,r._options.shouldUseNativeValidation).then(y=>!pr(y)&&r._subjects.state.next({errors:Kc(r._formState.errors,y,s)}))}r._subjects.state.next({name:s,values:mt(r._formValues)}),r._names.focus&&os(r._fields,(g,y)=>{if(r._names.focus&&y.startsWith(r._names.focus)&&g.focus)return g.focus(),1}),r._names.focus="",r._setValid(),f.current=!1},[c,s,r]),l.useEffect(()=>(!De(r._formValues,s)&&r._setFieldArray(s),()=>{const g=(y,N)=>{const _=De(r._fields,y);_&&_._f&&(_._f.mount=N)};r._options.shouldUnregister||o?r.unregister(s):g(s,!1)}),[s,r,a,o]),{swap:l.useCallback(k,[p,s,r]),move:l.useCallback(b,[p,s,r]),prepend:l.useCallback(h,[p,s,r]),append:l.useCallback(m,[p,s,r]),remove:l.useCallback(x,[p,s,r]),insert:l.useCallback(v,[p,s,r]),update:l.useCallback(j,[p,s,r]),replace:l.useCallback(C,[p,s,r]),fields:l.useMemo(()=>c.map((g,y)=>P(T({},g),{[a]:d.current[y]||Ye()})),[c,a])}}function Zc(e){const{form:t}=ks();if(!t)throw new Error("useFormFieldArray must be used within a Form component with react-hook-form integration");return Jc(P(T({},e),{control:t.control}))}function Ma(a){var o=a,{items:e,separator:t="/",className:r=""}=o,s=O(o,["items","separator","className"]);const i=["flex","items-center",E("sm","space-x"),re("bodySmall")],c=w(...i,r);return n.jsx("nav",P(T({"aria-label":"Breadcrumb",className:c},s),{children:n.jsx("ol",{className:w("flex","items-center",E("sm","space-x")),children:e.map((u,d)=>{const f=d===e.length-1;return n.jsxs("li",{className:"flex items-center",children:[d>0&&n.jsx("span",{className:w(E("sm","mx"),"text-fg-tertiary"),"aria-hidden":"true",children:t}),f?n.jsx("span",{className:w("text-fg-primary",Fe("label")),"aria-current":"page",children:u.label}):u.href?n.jsx("a",{href:u.href,className:w("inline-flex","items-center",E("xs","px"),E("xs","pt"),"border-b-2","border-transparent",re("bodySmall"),Fe("label"),"transition-colors","text-fg-secondary","hover:border-line-emphasis","hover:text-fg-primary"),children:u.label}):n.jsx("span",{className:"text-fg-secondary",children:u.label})]},d)})})}))}function Ta(u){var d=u,{currentPage:e,totalPages:t,onPageChange:r,totalItems:s,itemsPerPage:a,showPageInfo:o=!0,className:i=""}=d,c=O(d,["currentPage","totalPages","onPageChange","totalItems","itemsPerPage","showPageInfo","className"]);const f=()=>{e>1&&r(e-1)},p=()=>{e<t&&r(e+1)},m=b=>{b>=1&&b<=t&&b!==e&&r(b)},h=()=>{const b=[];if(t<=5)for(let C=1;C<=t;C++)b.push(C);else if(e<=3){for(let C=1;C<=4;C++)b.push(C);b.push("ellipsis"),b.push(t)}else if(e>=t-2){b.push(1),b.push("ellipsis");for(let C=t-3;C<=t;C++)b.push(C)}else{b.push(1),b.push("ellipsis");for(let C=e-1;C<=e+1;C++)b.push(C);b.push("ellipsis"),b.push(t)}return b},x=s&&a?(e-1)*a+1:void 0,v=s&&a?Math.min(e*a,s):void 0,k=w("flex","items-center","justify-between",E("base","px"),E("md","py"),i);return n.jsxs("nav",P(T({className:k,"aria-label":"Pagination"},c),{children:[n.jsxs("div",{className:w("flex","items-center",E("sm","gap")),children:[n.jsx(Z,{variant:"secondary",onClick:f,disabled:e===1,size:"sm",children:"Previous"}),n.jsx("div",{className:w("flex","items-center",E("xs","gap")),children:h().map((b,j)=>{if(b==="ellipsis")return n.jsx("span",{className:w(E("sm","px"),"text-fg-tertiary"),children:"..."},`ellipsis-${j}`);const C=b,g=C===e;return n.jsx(Z,{variant:g?"primary":"ghost",onClick:()=>m(C),size:"sm","aria-current":g?"page":void 0,"aria-label":`Go to page ${C}`,children:C},C)})}),n.jsx(Z,{variant:"secondary",onClick:p,disabled:e===t,size:"sm",children:"Next"})]}),o&&s&&a&&n.jsxs("div",{className:w(ve("sm"),"text-fg-primary"),children:["Showing ",x," to ",v," of ",s," results"]})]}))}function Aa(u){var d=u,{title:e,message:t,actionLabel:r,onAction:s,illustration:a,variant:o="default",className:i=""}=d,c=O(d,["title","message","actionLabel","onAction","illustration","variant","className"]);const f=w("flex","flex-col","items-center","justify-center","text-center",E("xl","py"),E("base","px"),i),p=o==="withAction"||r&&s,m=o==="withIllustration"||a;return n.jsxs("div",P(T({className:f,role:"status","aria-live":"polite","aria-label":`${e}. ${t}`},c),{children:[m&&a&&n.jsx("div",{className:w(E("base","mb")),"aria-hidden":"true",children:a}),n.jsx(Be,{as:"h3",className:w(re("h4"),Et("semibold"),"text-fg-primary",E("sm","mb")),children:e}),n.jsx(Be,{as:"p",className:w(re("bodySmall"),"text-fg-secondary",E("md","mb"),"max-w-sm"),children:t}),p&&r&&s&&n.jsx(Z,{variant:"primary",onClick:s,children:r})]}))}function Ra(c){var u=c,{trigger:e,items:t,align:r="right",variant:s="default",className:a="","aria-label":o}=u,i=O(u,["trigger","items","align","variant","className","aria-label"]);const[d,f]=l.useState(!1),[p,m]=l.useState(-1),h=l.useRef(null),x=l.useRef(null),v=l.useRef(null),k=l.useRef([]),b=`dropdown-menu-${Math.random().toString(36).substr(2,9)}`,j=`dropdown-trigger-${Math.random().toString(36).substr(2,9)}`;l.useEffect(()=>{const S=M=>{h.current&&!h.current.contains(M.target)&&(f(!1),m(-1))};return d&&(document.addEventListener("mousedown",S),setTimeout(()=>{var F;const M=t.findIndex(A=>!A.disabled);M>=0&&(m(M),(F=k.current[M])==null||F.focus())},0)),()=>{document.removeEventListener("mousedown",S)}},[d,t]),l.useEffect(()=>{if(!d)return;const S=F=>{var I,L,z,Y;const A=t.map((q,W)=>({item:q,index:W})).filter(({item:q})=>!q.disabled),R=A.findIndex(({index:q})=>q===p);switch(F.key){case"ArrowDown":{F.preventDefault();const q=R<A.length-1?A[R+1].index:A[0].index;m(q),(I=k.current[q])==null||I.focus();break}case"ArrowUp":{F.preventDefault();const q=R>0?A[R-1].index:A[A.length-1].index;m(q),(L=k.current[q])==null||L.focus();break}case"Home":{F.preventDefault();const q=A[0].index;m(q),(z=k.current[q])==null||z.focus();break}case"End":{F.preventDefault();const q=A[A.length-1].index;m(q),(Y=k.current[q])==null||Y.focus();break}case"Enter":case" ":F.preventDefault(),p>=0&&!t[p].disabled&&C(t[p]);break;case"Escape":F.preventDefault(),f(!1),m(-1),setTimeout(()=>{var q;(q=x.current)==null||q.focus()},0);break}},M=v.current;if(M){const F=S;return M.addEventListener("keydown",F),()=>{M.removeEventListener("keydown",F)}}},[d,p,t]);const C=S=>{S.disabled||(S.onClick(),f(!1),m(-1),setTimeout(()=>{var M;(M=x.current)==null||M.focus()},0))},g=()=>{f(!d),m(-1)},y=S=>{(S.key==="Enter"||S.key===" "||S.key==="ArrowDown")&&(S.preventDefault(),f(!0))},N=r==="right"?"right-0":"left-0",_=l.isValidElement(e)?l.cloneElement(e,{onClick:S=>{g(),e.props.onClick&&e.props.onClick(S)},onKeyDown:S=>{y(S),e.props.onKeyDown&&e.props.onKeyDown(S)},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":o||e.props["aria-label"]||"Open menu",id:j,ref:S=>{x.current=S,typeof e.ref=="function"?e.ref(S):e.ref&&(e.ref.current=S)}}):n.jsx("div",{ref:x,onClick:g,onKeyDown:y,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":o||"Open menu",id:j,children:e});return n.jsxs("div",P(T({className:w("relative","inline-block",a),ref:h},i),{children:[_,d&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:w("fixed","inset-0","z-10"),onClick:()=>{f(!1),m(-1)},"aria-hidden":"true"}),n.jsx("div",{ref:v,id:b,className:w("absolute","z-20",E("sm","mt"),"w-48",J("md"),Se("lg"),"bg-surface-overlay","ring-1","ring-line-strong","ring-opacity-5",N),role:"menu","aria-orientation":"vertical","aria-labelledby":j,"aria-activedescendant":p>=0?`${b}-item-${p}`:void 0,children:n.jsx("div",{className:w(E("xs","py")),role:"none",children:t.map((S,M)=>{const F=w("block",E("base","px"),E("xs","py"),re("bodySmall"),"w-full","text-left","focus:outline-none",S.disabled?w("text-fg-disabled","cursor-not-allowed","opacity-50"):S.variant==="danger"?w("text-error-dark","hover:bg-error-bg-emphasis","focus:bg-error-bg-emphasis"):w("text-fg-primary","hover:bg-surface-hover","focus:bg-surface-hover"));return n.jsx("button",{id:`${b}-item-${M}`,ref:A=>{k.current[M]=A},type:"button",className:F,onClick:()=>C(S),disabled:S.disabled,role:"menuitem","aria-disabled":S.disabled,tabIndex:S.disabled?-1:p===M?0:-1,children:S.label},M)})})})]})]}))}const Ia=l.createContext(void 0);function Da(){const e=l.useContext(Ia);if(!e)throw new Error("DatePicker components must be used within a DatePicker component");return e}function is({children:e,mode:t="single",value:r,defaultValue:s,onValueChange:a,minDate:o,maxDate:i,disabledDates:c,locale:u}){const d=()=>{if(r!==void 0)return null;if(s){if(t==="single"&&s instanceof Date)return s;if(t==="range"&&typeof s=="object"&&"start"in s)return null}return null},f=()=>r!==void 0?null:s&&t==="range"&&typeof s=="object"&&"start"in s?s:{start:null,end:null},[p,m]=l.useState(d()),[h,x]=l.useState(f()),v=t==="single"?r instanceof Date?r:p:null,k=t==="range"?r&&typeof r=="object"&&"start"in r?r:h:null,C={selectedDate:v,selectedRange:k,mode:t,onDateChange:g=>{t==="single"&&(r===void 0&&m(g),a==null||a(g))},onRangeChange:g=>{t==="range"&&(r===void 0&&x(g),a==null||a(g))},minDate:o,maxDate:i,disabledDates:c,locale:u};return n.jsx(Ia.Provider,{value:C,children:e})}function Vt(e,t="yyyy-MM-dd"){const r=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return t.replace("yyyy",String(r)).replace("MM",s).replace("dd",a).replace("MM/dd/yyyy",`${s}/${a}/${r}`).replace("dd/MM/yyyy",`${a}/${s}/${r}`)}function An(e){if(!e)return null;const t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(t){const[,a,o,i]=t,c=new Date(parseInt(a),parseInt(o)-1,parseInt(i));if(!isNaN(c.getTime()))return c}const r=e.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);if(r){const[,a,o,i]=r,c=new Date(parseInt(i),parseInt(a)-1,parseInt(o));if(!isNaN(c.getTime()))return c}const s=e.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);if(s){const[,a,o,i]=s,c=new Date(parseInt(i),parseInt(o)-1,parseInt(a));if(!isNaN(c.getTime()))return c}return null}function Ss(c){var u=c,{placeholder:e="Select date",format:t="yyyy-MM-dd",showCalendarButton:r=!0,"aria-label":s,onFocus:a,className:o=""}=u,i=O(u,["placeholder","format","showCalendarButton","aria-label","onFocus","className"]);const{selectedDate:d,selectedRange:f,mode:p,onDateChange:m}=Da(),[h,x]=l.useState(""),[v,k]=l.useState(!1),b=l.useRef(null);l.useEffect(()=>{p==="single"&&d?x(Vt(d,t)):p==="range"&&f?f.start&&f.end?x(`${Vt(f.start,t)} - ${Vt(f.end,t)}`):f.start?x(Vt(f.start,t)):x(""):x("")},[d,f,p,t]);const j=y=>{const N=y.target.value;if(x(N),p==="single"){const _=An(N);m(_)}},C=()=>{if(k(!1),h&&p==="single"){const y=An(h);y&&x(Vt(y,t))}},g=()=>{var y;(y=b.current)==null||y.focus()};return n.jsx("div",P(T({className:`relative ${o}`},i),{children:n.jsx(ke,{ref:b,type:"text",value:h,onChange:j,onFocus:()=>{k(!0),a==null||a()},onBlur:C,placeholder:e,"aria-label":s||e,rightIcon:r?n.jsx(Z,{variant:"iconOnly",size:"sm",onClick:g,"aria-label":"Open calendar",type:"button",children:n.jsx(Tl,{className:"h-4 w-4"})}):void 0})}))}function Qc(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function ed(e){return new Date(e.getFullYear(),e.getMonth(),1).getDay()}function pt(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Wt(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function td(e,t,r){if(!t||!r)return!1;const s=e.getTime();return s>=t.getTime()&&s<=r.getTime()}function Rn(e,t,r,s){return!!(t&&e<t||r&&e>r||s!=null&&s.some(a=>pt(e,a)))}const rd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],sd=["January","February","March","April","May","June","July","August","September","October","November","December"];function Cs(a){var o=a,{month:e,onMonthChange:t,className:r=""}=o,s=O(o,["month","onMonthChange","className"]);const{selectedDate:i,selectedRange:c,mode:u,onDateChange:d,onRangeChange:f,minDate:p,maxDate:m,disabledDates:h}=Da(),[x,v]=l.useState(e||i||(c==null?void 0:c.start)||new Date),k=l.useRef(null),[b,j]=l.useState(()=>{const R=new Date,I=e||i||(c==null?void 0:c.start)||R;return i&&Wt(i,I)?i:Wt(R,I)?R:new Date(I.getFullYear(),I.getMonth(),1)});l.useEffect(()=>{e&&v(e)},[e]),l.useEffect(()=>{if(!k.current)return;const R=k.current.querySelector(`[data-date="${b.toISOString()}"]`);R&&R.focus()},[b]);const C=(()=>{if(Wt(b,x))return b;const R=new Date;return Wt(R,x)?R:new Date(x.getFullYear(),x.getMonth(),1)})(),g=Qc(x),y=ed(x),N=[];for(let R=0;R<y;R++)N.push(null);for(let R=1;R<=g;R++)N.push(new Date(x.getFullYear(),x.getMonth(),R));const _=R=>{if(!Rn(R,p,m,h)){if(u==="single")d(R);else if(u==="range"){const I=c||{start:null,end:null};!I.start||I.start&&I.end?f({start:R,end:null}):I.start&&!I.end&&(R<I.start?f({start:R,end:I.start}):f({start:I.start,end:R}))}}},S=()=>{const R=new Date(x.getFullYear(),x.getMonth()-1,1);v(R),t==null||t(R)},M=()=>{const R=new Date(x.getFullYear(),x.getMonth()+1,1);v(R),t==null||t(R)},F=(R,I)=>{let L=null;switch(R.key){case"ArrowLeft":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),I.getDate()-1);break;case"ArrowRight":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),I.getDate()+1);break;case"ArrowUp":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),I.getDate()-7);break;case"ArrowDown":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),I.getDate()+7);break;case"Home":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),1);break;case"End":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth()+1,0);break;case"Enter":case" ":R.preventDefault(),_(I);return}L&&(Wt(L,x)||v(new Date(L.getFullYear(),L.getMonth(),1)),j(L))},A=[];for(let R=0;R<N.length;R+=7)A.push(N.slice(R,R+7));return n.jsxs("div",P(T({ref:k,className:`p-4 ${r}`},s),{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx(Z,{variant:"iconOnly",size:"sm",onClick:S,"aria-label":"Previous month",children:n.jsx(Bt,{className:"h-4 w-4"})}),n.jsxs("div",{className:"text-sm font-semibold",children:[sd[x.getMonth()]," ",x.getFullYear()]}),n.jsx(Z,{variant:"iconOnly",size:"sm",onClick:M,"aria-label":"Next month",children:n.jsx(ht,{className:"h-4 w-4"})})]}),n.jsxs("div",{role:"grid","aria-label":"Calendar",children:[n.jsx("div",{role:"row",className:"grid grid-cols-7 gap-1 mb-2",children:rd.map(R=>n.jsx("div",{role:"columnheader",className:"text-center text-xs font-medium text-fg-tertiary py-1",children:R},R))}),A.map((R,I)=>n.jsx("div",{role:"row",className:"grid grid-cols-7 gap-1",children:R.map((L,z)=>{if(!L)return n.jsx("div",{role:"gridcell",className:"aspect-square"},`empty-${I}-${z}`);const Y=u==="single"?pt(L,i):pt(L,(c==null?void 0:c.start)||null)||pt(L,(c==null?void 0:c.end)||null),q=u==="range"&&c?td(L,c.start,c.end):!1,W=Rn(L,p,m,h),ae=pt(L,new Date),se=pt(L,b),D=pt(L,C);return n.jsx("button",{role:"gridcell",type:"button","data-date":L.toISOString(),tabIndex:D?0:-1,onClick:()=>_(L),onKeyDown:B=>F(B,L),className:`
177
+ */const bc=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],we=le("x",bc),gc=xe("motion-safe:animate-spin",{variants:{size:{sm:"h-4 w-4",md:"h-5 w-5",lg:"h-8 w-8"},variant:{primary:"text-fg-brand",secondary:"text-fg-brand-secondary",neutral:"text-fg-secondary"}},defaultVariants:{size:"md",variant:"primary"}}),gs=l.memo(function(i){var c=i,{size:t="md",variant:r="primary",label:s,className:a=""}=c,o=O(c,["size","variant","label","className"]);return n.jsxs("div",P(T({className:w("inline-flex","items-center",a),role:"status","aria-label":s||"Loading","aria-live":"polite"},o),{children:[n.jsx(fa,{className:w(gc({size:t,variant:r})),"aria-hidden":"true"}),s&&n.jsx("span",{className:w(E("sm","ml"),re("bodySmall"),"text-fg-secondary","sr-only"),children:s})]}))});gs.displayName="Spinner";const xc=xe(w("inline-flex","items-center","justify-center",ce("button").split(" ")[2]||"font-medium",J("md"),"transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed"),{variants:{variant:{primary:w("bg-surface-brand-strong","text-fg-inverse","hover:opacity-90","focus:ring-line-brand"),secondary:w("bg-surface-secondary","text-fg-inverse","hover:opacity-90","focus:ring-line-secondary"),error:w("bg-error","text-fg-inverse","hover:opacity-90","focus:ring-error"),outline:w("border-2","border-line-default","bg-transparent","text-fg-primary","hover:bg-surface-hover","focus:ring-line-focus"),ghost:w("bg-transparent","text-fg-primary","hover:bg-surface-hover","focus:ring-line-focus"),iconOnly:w("bg-transparent","text-fg-primary","hover:bg-surface-hover","focus:ring-line-focus","p-0")},size:{sm:w(E("md","px"),E("1.5","py"),re("bodySmall"),E("1.5","gap")),md:w(E("base","px"),E("sm","py"),re("body"),E("sm","gap")),lg:w(E("lg","px"),E("md","py"),re("bodyLarge"),E("2.5","gap"))}},compoundVariants:[{variant:"iconOnly",size:"sm",class:w("h-8","w-8","p-0")},{variant:"iconOnly",size:"md",class:w("h-10","w-10","p-0")},{variant:"iconOnly",size:"lg",class:w("h-12","w-12","p-0")}],defaultVariants:{variant:"primary",size:"md"}});function $n({children:e,position:t}){return e?n.jsx("span",{className:`inline-flex items-center ${t==="left"?"mr-0":"ml-0"}`,children:e}):null}const Z=l.memo(l.forwardRef(function(k,v){var b=k,{variant:t="primary",size:r="md",isLoading:s=!1,loadingText:a,loadingIcon:o,leftIcon:i,rightIcon:c,fullWidth:u=!1,as:d="button",className:f="",disabled:p=!1,children:m,"aria-label":h}=b,x=O(b,["variant","size","isLoading","loadingText","loadingIcon","leftIcon","rightIcon","fullWidth","as","className","disabled","children","aria-label"]);const j=l.useMemo(()=>w(xc({variant:t,size:r}),u&&"w-full",f),[t,r,u,f]),C=l.useMemo(()=>t==="iconOnly"||!m&&(i||c),[t,m,i,c]),g=l.useMemo(()=>C&&!h&&!m?"Button":h,[C,h,m]),y=l.useMemo(()=>t==="error"?"primary":t==="primary"||t==="secondary"?"neutral":"primary",[t]),N=l.useMemo(()=>r==="sm"?"sm":r==="lg"?"lg":"md",[r]),_=l.useMemo(()=>o||n.jsx(gs,{size:N,variant:y}),[o,N,y]),S=d==="button"&&!x.type?"button":void 0,M=T(T({className:j,disabled:p||s,"aria-busy":s,"aria-label":g,"aria-disabled":p||s},S?{type:S}:{}),x);return n.jsx(d,P(T({ref:v},M),{children:s?n.jsxs(n.Fragment,{children:[_,a&&n.jsx("span",{className:"ml-2",children:a}),!a&&m&&n.jsx("span",{className:"ml-2 opacity-0",children:m})]}):n.jsxs(n.Fragment,{children:[i&&n.jsx($n,{position:"left",children:i}),m,c&&n.jsx($n,{position:"right",children:c})]})}))}));Z.displayName="Button";const vc=l.memo(function({error:t,success:r,helperText:s,errorId:a,helperId:o}){const i=l.useMemo(()=>w(E("xs","mt"),ce("caption"),t&&"text-fg-error",r&&"text-fg-success",!t&&!r&&"text-fg-secondary"),[t,r]),c=l.useMemo(()=>s||(t?"Error":r?"Success":""),[s,t,r]);return n.jsx("div",{id:a||o,className:i,role:t||r?"alert":void 0,children:c})}),ke=l.memo(l.forwardRef(function(C,j){var g=C,{id:t,label:r,error:s=!1,success:a=!1,helperText:o,size:i="md",variant:c="outlined",leftIcon:u,rightIcon:d,showClearButton:f=!1,onClear:p,className:m="",disabled:h=!1,type:x="text",value:v,onChange:k}=g,b=O(g,["id","label","error","success","helperText","size","variant","leftIcon","rightIcon","showClearButton","onClear","className","disabled","type","value","onChange"]);const y=l.useMemo(()=>t||`input-${Math.random().toString(36).substr(2,9)}`,[t]),N=l.useMemo(()=>s?`${y}-error`:void 0,[s,y]),_=l.useMemo(()=>o?`${y}-helper`:void 0,[o,y]),[S,M]=l.useState(!1),F=l.useMemo(()=>x==="password",[x]),A=l.useMemo(()=>F&&S?"text":x,[F,S,x]),R=l.useMemo(()=>s?"error":a?"success":"default",[s,a]),I=l.useMemo(()=>v!=null&&v!=="",[v]),L=l.useMemo(()=>f&&I&&!h,[f,I,h]),z=l.useMemo(()=>"focus:border-line-focus",[]),Y=l.useMemo(()=>"focus:border-error",[]),q=l.useMemo(()=>"focus:border-success",[]),W=l.useMemo(()=>z.replace("focus:border-","focus:ring-"),[z]),ae=l.useCallback(V=>V==="error"?Y.replace("focus:border-","focus:ring-"):q.replace("focus:border-","focus:ring-"),[Y,q]),se=xe(w("w-full",J("md"),"transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed"),{variants:{variant:{default:w("border-0","border-b-2","border-line-default","focus:border-line-focus"),outlined:w("border","border-line-default","focus:border-line-focus"),filled:w("bg-surface-muted","border-0","focus:bg-surface-base","focus:ring-2",W)},size:{sm:w("h-8",re("bodySmall"),E("md","px")),md:w("h-10",re("body"),E("base","px")),lg:w("h-12",re("bodyLarge"),E("lg","px"))},state:{default:"",error:w("border-error","focus:border-error",ae("error")),success:w("border-success","focus:border-success",ae("success"))}},defaultVariants:{variant:"outlined",size:"md",state:"default"}}),D=l.useMemo(()=>w(se({variant:c,size:i,state:R}),u&&(i==="sm"?"pl-9":i==="lg"?"pl-12":"pl-10"),(d||L||F)&&(i==="sm"?"pr-9":i==="lg"?"pr-12":"pr-10"),m),[c,i,R,u,d,L,F,m]),B=l.useMemo(()=>w("block",ce("label"),E("xs","mb"),h&&"opacity-50"),[h]),X=l.useMemo(()=>i==="sm"?"h-4 w-4":i==="lg"?"h-5 w-5":"h-4 w-4",[i]),Q=l.useMemo(()=>i==="sm"?"top-2":i==="lg"?"top-3.5":"top-2.5",[i]),H=l.useCallback(V=>{var ne;if(V.stopPropagation(),p)p();else if(k){const oe=(ne=V.currentTarget.closest(".relative"))==null?void 0:ne.querySelector("input");if(oe){const ie={target:oe,currentTarget:oe,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:2,isTrusted:!1,nativeEvent:new Event("change"),preventDefault:()=>{},stopPropagation:()=>{},persist:()=>{},timeStamp:Date.now()};Object.defineProperty(ie.target,"value",{value:"",writable:!0}),Object.defineProperty(ie.currentTarget,"value",{value:"",writable:!0}),k(ie)}}},[p,k]),U=l.useCallback(()=>{M(V=>!V)},[]);return n.jsxs("div",{className:"w-full",children:[r&&n.jsx("label",{htmlFor:y,className:B,children:r}),n.jsxs("div",{className:"relative",children:[u&&n.jsx("div",{className:`absolute left-3 ${Q} text-fg-secondary opacity-60 pointer-events-none`,children:n.jsx("div",{className:X,children:u})}),n.jsx("input",T({id:y,ref:j,type:A,className:D,disabled:h,value:v,onChange:k,"aria-invalid":s,"aria-required":b.required,"aria-describedby":N||_,suppressHydrationWarning:!0},b)),n.jsxs("div",{className:"absolute right-3 top-0 bottom-0 flex items-center gap-1",children:[L&&n.jsx(Z,{variant:"ghost",size:"sm",onClick:H,className:"h-auto p-1","aria-label":"Clear input",children:n.jsx(we,{className:X})}),F&&n.jsx(Z,{variant:"ghost",size:"sm",onClick:U,className:"h-auto p-1","aria-label":S?"Hide password":"Show password",children:S?n.jsx(ql,{className:X}):n.jsx(Kl,{className:X})}),d&&!L&&!F&&n.jsx("div",{className:`text-fg-secondary opacity-60 pointer-events-none ${X}`,children:d})]})]}),(s||a||o)&&n.jsx(vc,{error:s,success:a,helperText:o,errorId:N,helperId:_})]})}));ke.displayName="Input";function ma({href:e,active:t}){const r=l.useMemo(()=>t!==void 0?t:!1,[t]),s=l.useMemo(()=>{try{const a=typeof require!="undefined"?require("next/link"):null;return a==null?void 0:a.default}catch(a){return}},[]);return{isActive:r,NextLink:s}}const yc=xe(w("inline-flex","items-center","transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed","disabled:pointer-events-none","no-underline"),{variants:{variant:{default:w("text-fg-primary","hover:opacity-80","focus-visible:opacity-100","focus:ring-line-brand"),underline:w("text-fg-primary","hover:opacity-80","focus-visible:opacity-100","border-b-2","border-transparent","hover:border-current","focus:ring-line-brand"),background:w("text-fg-primary","hover:bg-surface-hover","rounded-md",J("md"),"focus:ring-line-brand")},size:{sm:w(E("sm","px"),E("xs","py"),re("bodySmall")),md:w(E("base","px"),E("sm","py"),re("body")),lg:w(E("lg","px"),E("md","py"),re("bodyLarge"))}},defaultVariants:{variant:"default",size:"md"},compoundVariants:[{variant:"underline",size:"sm",class:E("0.5","pb")},{variant:"underline",size:"md",class:E("xs","pb")},{variant:"underline",size:"lg",class:E("1.5","pb")},{variant:"background",size:"sm",class:E("xs","px")},{variant:"background",size:"md",class:E("sm","px")},{variant:"background",size:"lg",class:E("base","px")}]});function xs(m){var h=m,{href:e,children:t,active:r,disabled:s=!1,variant:a="default",size:o="md",as:i,className:c,"aria-label":u,onClick:d,onKeyDown:f}=h,p=O(h,["href","children","active","disabled","variant","size","as","className","aria-label","onClick","onKeyDown"]);const x=l.useMemo(()=>r!==void 0?r:!1,[r]),{NextLink:v}=ma({href:e,active:x}),k=i||v||"a",b=l.useMemo(()=>{if(!x)return"";switch(a){case"underline":return w("border-b-2","border-line-brand","text-fg-brand-emphasis");case"background":return w("bg-surface-brand-muted","text-fg-brand-emphasis");case"default":default:return w("text-fg-brand-emphasis","font-semibold")}},[x,a]),j=l.useCallback(y=>{if(s){y.preventDefault(),y.stopPropagation();return}d==null||d(y)},[s,d]),C=l.useCallback(y=>{if(s){(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation());return}f==null||f(y)},[s,f]),g=l.useMemo(()=>{const y=T({className:w(yc({variant:a,size:o}),b,s&&"opacity-50 cursor-not-allowed pointer-events-none",c),"aria-current":x?"page":void 0,"aria-disabled":s?!0:void 0,"aria-label":u,tabIndex:s?-1:void 0,onClick:j,onKeyDown:C,"data-active":x,"data-disabled":s},p);return v&&!i?P(T({},y),{href:s?void 0:e}):P(T({},y),{href:s?void 0:e})},[a,o,b,s,c,x,u,j,C,e,v,i,p]);return n.jsx(k,P(T({},g),{children:t}))}const wc=xe(w("inline-flex","items-center","justify-center",Fe("label"),J("md"),"border"),{variants:{variant:{success:"",warning:"",error:"",info:"",neutral:"",primary:"",secondary:""},size:{sm:w(E("1.5","px"),E("0.5","py"),re("caption")),md:w(E("sm","px"),E("xs","py"),re("caption")),lg:w(E("sm","px"),E("xs","py"),re("bodySmall"))},style:{solid:"",outline:""}},compoundVariants:[{variant:"success",style:"solid",class:w("bg-success-bg","text-success-dark","border-success")},{variant:"warning",style:"solid",class:w("bg-warning-bg","text-warning-dark","border-warning")},{variant:"error",style:"solid",class:w("bg-error-bg","text-error-dark","border-error")},{variant:"info",style:"solid",class:w("bg-info-bg","text-info-dark","border-info")},{variant:"neutral",style:"solid",class:w("bg-surface-muted","text-fg-primary","border-line-default")},{variant:"primary",style:"solid",class:w("bg-surface-brand-subtle","text-fg-brand-emphasis","border-line-brand")},{variant:"secondary",style:"solid",class:w("bg-pink-300","text-fg-brand-secondary-emphasis","border-line-secondary")},{variant:"success",style:"outline",class:w("bg-transparent","border-success","text-fg-success")},{variant:"warning",style:"outline",class:w("bg-transparent","border-warning","text-fg-warning")},{variant:"error",style:"outline",class:w("bg-transparent","border-error","text-fg-error")},{variant:"info",style:"outline",class:w("bg-transparent","border-info","text-fg-info")},{variant:"neutral",style:"outline",class:w("bg-transparent","border-line-default","text-fg-secondary")},{variant:"primary",style:"outline",class:w("bg-transparent","border-line-brand","text-fg-brand")},{variant:"secondary",style:"outline",class:w("bg-transparent","border-line-secondary","text-fg-brand-secondary")}],defaultVariants:{variant:"neutral",size:"md",style:"solid"}}),pa=l.memo(l.forwardRef(function(d,u){var f=d,{variant:t="neutral",size:r="md",style:s="solid",className:a="",children:o,"aria-label":i}=f,c=O(f,["variant","size","style","className","children","aria-label"]);const p=l.useMemo(()=>w(wc({variant:t,size:r,style:s}),a),[t,r,s,a]),m=l.useMemo(()=>{if(i)return i;if(typeof o=="string")return o;if(typeof o=="object"&&o!==null&&"props"in o){const h=o.props;if(h!=null&&h.children&&typeof h.children=="string")return h.children}},[i,o]);return n.jsx("span",P(T({ref:u,role:"status","aria-label":m,className:p},c),{children:o}))}));pa.displayName="Badge";const kc=l.memo(function({error:t,success:r,helperText:s,errorId:a,helperId:o}){const i=l.useMemo(()=>w(E("xs","mt"),ce("caption"),t&&"text-fg-error",r&&"text-fg-success",!t&&!r&&"text-fg-secondary"),[t,r]),c=l.useMemo(()=>s||(t?"Error":r?"Success":""),[s,t,r]);return n.jsx("div",{id:a||o,className:i,role:t||r?"alert":void 0,children:c})}),jr=l.memo(l.forwardRef(function(x,h){var v=x,{options:t=[],optionGroups:r,placeholder:s,label:a,error:o=!1,success:i=!1,helperText:c,size:u="md",className:d="",disabled:f=!1,id:p}=v,m=O(v,["options","optionGroups","placeholder","label","error","success","helperText","size","className","disabled","id"]);const k=l.useMemo(()=>p||`select-${Math.random().toString(36).substr(2,9)}`,[p]),b=l.useMemo(()=>o?`${k}-error`:void 0,[o,k]),j=l.useMemo(()=>c?`${k}-helper`:void 0,[c,k]),C=l.useMemo(()=>"focus:border-line-focus",[]),g=l.useMemo(()=>"focus:border-error",[]),y=l.useMemo(()=>"focus:border-success",[]),N=l.useCallback(A=>A==="error"?g.replace("focus:border-","focus:ring-"):A==="success"?y.replace("focus:border-","focus:ring-"):C.replace("focus:border-","focus:ring-"),[g,y,C]),_=xe(w("block","w-full",J("md"),"border","bg-surface-base","transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed"),{variants:{size:{sm:w("h-8",re("bodySmall"),E("md","px")),md:w("h-10",re("body"),E("base","px")),lg:w("h-12",re("bodyLarge"),E("lg","px"))},state:{default:w("border-line-default",N()),error:w("border-error",N("error")),success:w("border-success",N("success"))}},defaultVariants:{size:"md",state:"default"}}),S=l.useMemo(()=>o?"error":i?"success":"default",[o,i]),M=l.useMemo(()=>w(_({size:u,state:S}),d),[u,S,d]),F=l.useMemo(()=>w("block",ce("label"),E("xs","mb"),f&&"opacity-50"),[f]);return n.jsxs("div",{className:"w-full",children:[a&&n.jsx("label",{htmlFor:k,className:F,children:a}),n.jsxs("select",P(T({id:k,ref:h,className:M,disabled:f,"aria-invalid":o,"aria-required":m.required,"aria-describedby":b||j},m),{children:[s&&n.jsx("option",{value:"",disabled:!0,children:s}),r&&r.length>0?r.map((A,R)=>n.jsx("optgroup",{label:A.label,children:(A.options||[]).map(I=>n.jsx("option",{value:I.value,disabled:I.disabled,children:I.label},I.value))},R)):(t||[]).map(A=>n.jsx("option",{value:A.value,disabled:A.disabled,children:A.label},A.value))]})),(o||i||c)&&n.jsx(kc,{error:o,success:i,helperText:c,errorId:b,helperId:j})]})}));jr.displayName="Select";const ha=l.memo(l.forwardRef(function(i,o){var c=i,{error:t=!1,resize:r="vertical",className:s=""}=c,a=O(c,["error","resize","className"]);const u=l.useMemo(()=>"focus:border-line-focus",[]),d=l.useMemo(()=>"focus:border-error",[]),f=l.useMemo(()=>t?d.replace("focus:border-","focus:ring-"):u.replace("focus:border-","focus:ring-"),[t,d,u]),p=l.useMemo(()=>({none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"}),[]),m=l.useMemo(()=>w("block","w-full",J("md"),E("base","px"),E("md","py"),"border",re("body"),"focus:outline-none","focus:ring-2","focus:ring-offset-2",p[r],w(t?"border-error":"border-line-default",f),s),[r,p,t,f,s]),h=l.useMemo(()=>t&&a.id?`${a.id}-error`:void 0,[t,a.id]);return n.jsx("textarea",T({ref:o,className:m,"aria-invalid":t,"aria-describedby":h},a))}));ha.displayName="Textarea";const Mt=l.memo(l.forwardRef(function(i,o){var c=i,{variant:t="default",className:r="",children:s}=c,a=O(c,["variant","className","children"]);const u=l.useMemo(()=>w("block",re("label"),Fe("label"),"text-fg-primary"),[]),d=l.useMemo(()=>({default:"",required:w("after:content-['*']",`after:${E("0.5","ml")}`,"after:text-fg-error"),optional:w("after:content-['(optional)']","after:ml-1","after:text-fg-tertiary","after:font-normal")}),[]),f=l.useMemo(()=>w(u,d[t],r),[u,d,t,r]);return n.jsx("label",P(T({ref:o,className:f},a),{children:s}))}));Mt.displayName="Label";function ba(a){var o=a,{message:e,id:t,className:r=""}=o,s=O(o,["message","id","className"]);const i=[E("xs","mt"),re("bodySmall"),"text-fg-error","flex","items-center",E("xs","gap")],c=w(...i,r);return n.jsxs("div",P(T({role:"alert",id:t,className:c,"aria-live":"polite"},s),{children:[n.jsx(bs,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),n.jsx("span",{children:e})]}))}class Ie{static createWidth(t){const s={none:{px:0,tailwind:"border-0"},thin:{px:1,tailwind:"border"},base:{px:1,tailwind:"border"},medium:{px:2,tailwind:"border-2"},thick:{px:4,tailwind:"border-4"}}[t];return{value:s.px,px:`${s.px}px`,tailwind:s.tailwind}}static create(t,r="solid"){return{width:this.createWidth(t),style:r,description:`${t} ${r} border`}}}Ie.create("none"),Ie.create("thin"),Ie.create("base"),Ie.create("medium"),Ie.create("thick"),Ie.create("thin","dashed"),Ie.create("base","dashed"),Ie.create("thin","dotted"),Ie.create("base","dotted");function jc(e){return Ie.createWidth(e).tailwind}function Ut(u){var d=u,{content:e,children:t,position:r="top",delay:s=200,className:a="","aria-label":o,preservePositioning:i=!1}=d,c=O(d,["content","children","position","delay","className","aria-label","preservePositioning"]);const[f,p]=l.useState(!1),m=l.useRef(null),h=l.useRef(null),x=l.useRef(null),v=`tooltip-${Math.random().toString(36).substr(2,9)}`,k=()=>{const F=setTimeout(()=>{p(!0)},s);m.current=F},b=()=>{m.current&&(clearTimeout(m.current),m.current=null),p(!1)},j=()=>{p(!0)},C=()=>{p(!1)},g=F=>{var A;F.key==="Escape"&&(p(!1),(A=x.current)==null||A.blur())};l.useEffect(()=>()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),l.useEffect(()=>{if(!f)return;const F=A=>{h.current&&!h.current.contains(A.target)&&x.current&&!x.current.contains(A.target)&&p(!1)};return document.addEventListener("mousedown",F),()=>{document.removeEventListener("mousedown",F)}},[f]);const y=F=>({top:"border-t-surface-inverse",bottom:"border-b-surface-inverse",left:"border-l-surface-inverse",right:"border-r-surface-inverse"})[F],N=xe(w("absolute",ue("tooltip"),E("sm","px"),E("xs","py"),re("caption"),"text-fg-inverse","bg-surface-inverse",J("md"),"shadow-lg","whitespace-nowrap"),{variants:{position:{top:w("bottom-full","left-1/2","transform","-translate-x-1/2",E("sm","mb")),bottom:w("top-full","left-1/2","transform","-translate-x-1/2",E("sm","mt")),left:w("right-full","top-1/2","transform","-translate-y-1/2",E("sm","mr")),right:w("left-full","top-1/2","transform","-translate-y-1/2",E("sm","ml"))}},defaultVariants:{position:"top"}}),_=xe(w("absolute","w-0","h-0",jc("thick"),"border-transparent"),{variants:{position:{top:w("top-full","left-1/2","transform","-translate-x-1/2",y("top")),bottom:w("bottom-full","left-1/2","transform","-translate-x-1/2",y("bottom")),left:w("left-full","top-1/2","transform","-translate-y-1/2",y("left")),right:w("right-full","top-1/2","transform","-translate-y-1/2",y("right"))}},defaultVariants:{position:"top"}}),S=l.isValidElement(t)?(()=>{const F=t,A=F.props,R=A.ref;return l.cloneElement(F,{ref:I=>{x.current=I,typeof R=="function"?R(I):R&&typeof R=="object"&&"current"in R&&(R.current=I)},"aria-describedby":f?v:A["aria-describedby"],onMouseEnter:I=>{var L;k(),(L=A.onMouseEnter)==null||L.call(A,I)},onMouseLeave:I=>{var L;b(),(L=A.onMouseLeave)==null||L.call(A,I)},onFocus:I=>{var L;j(),(L=A.onFocus)==null||L.call(A,I)},onBlur:I=>{var L;C(),(L=A.onBlur)==null||L.call(A,I)},onKeyDown:I=>{var L;g(I),(L=A.onKeyDown)==null||L.call(A,I)}})})():t,M=w(i?"static":"relative","inline-block",a);return n.jsxs("div",P(T({className:M},c),{children:[S,f&&n.jsxs("div",{ref:h,id:v,className:w(N({position:r})),role:"tooltip","aria-live":"polite",children:[e,n.jsx("div",{className:w(_({position:r})),"aria-hidden":"true"})]})]}))}function ga(c){var u=c,{variant:e="text",width:t,height:r,lines:s=1,className:a="","aria-label":o}=u,i=O(u,["variant","width","height","lines","className","aria-label"]);const d=["motion-safe:animate-pulse","bg-surface-muted",J("sm")],f={text:"h-4",card:"h-32",list:"h-12",circle:"rounded-full"},p=w(...d,f[e],a),m={};t&&(m.width=t),r&&(m.height=r);const h=o||`Loading ${e} content`;return e==="text"&&s>1?n.jsx("div",P(T({className:E("sm","space-y"),role:"status","aria-busy":"true","aria-label":h},i),{children:Array.from({length:s}).map((x,v)=>n.jsx("div",{className:p,style:v===s-1?{width:"75%"}:m,"aria-hidden":"true"},v))})):n.jsx("div",T({className:p,style:m,role:"status","aria-busy":"true","aria-label":h},i))}function Nc({defaultOpen:e=!0,open:t,onOpenChange:r,storageKey:s}){const a=l.useCallback(()=>{if(s&&typeof window!="undefined"){const f=localStorage.getItem(s);if(f!==null)return f==="true"}return e},[e,s]),[o,i]=l.useState(a),c=t!==void 0?t:o;l.useEffect(()=>{s&&typeof window!="undefined"&&t===void 0&&localStorage.setItem(s,String(o))},[o,s,t]);const u=l.useCallback(f=>{t===void 0&&i(f),r==null||r(f)},[t,r]),d=l.useCallback(()=>{u(!c)},[c,u]);return{isOpen:c,toggle:d,setOpen:u}}function xa(f){var p=f,{children:e,trigger:t,defaultOpen:r=!0,open:s,onOpenChange:a,disabled:o=!1,duration:i=200,storageKey:c,className:u=""}=p,d=O(p,["children","trigger","defaultOpen","open","onOpenChange","disabled","duration","storageKey","className"]);const{isOpen:m,toggle:h}=Nc({defaultOpen:r,open:s,onOpenChange:a,storageKey:c}),x=l.useRef(null),[v,k]=l.useState(m?"auto":0);l.useEffect(()=>{x.current&&k(m?x.current.scrollHeight:0)},[m,e]),l.useEffect(()=>{if(!m||!x.current)return;const j=new ResizeObserver(()=>{x.current&&m&&k(x.current.scrollHeight)});return j.observe(x.current),()=>{j.disconnect()}},[m]);const b=`collapsible-content-${Math.random().toString(36).substr(2,9)}`;return n.jsxs("div",P(T({className:u},d),{children:[n.jsx("button",{type:"button",onClick:h,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o||h())},disabled:o,"aria-expanded":m,"aria-controls":b,"aria-disabled":o,className:w("w-full","text-left","focus:outline-none","focus:ring-2","focus:ring-line-brand","focus:ring-offset-2",J("md")),children:t}),n.jsx("div",{id:b,ref:x,style:{height:typeof v=="number"?`${v}px`:v,overflow:"hidden",transition:`height ${i}ms ease-in-out`},"aria-hidden":!m,children:n.jsx("div",{children:e})})]}))}const Nr=l.memo(l.forwardRef(function(f,d){var p=f,{id:t,label:r,error:s=!1,helperText:a,className:o="",disabled:i=!1,indeterminate:c=!1}=p,u=O(p,["id","label","error","helperText","className","disabled","indeterminate"]);const m=l.useMemo(()=>t||`checkbox-${Math.random().toString(36).substr(2,9)}`,[t]),h=l.useMemo(()=>s?`${m}-error`:void 0,[s,m]),x=l.useMemo(()=>a?`${m}-helper`:void 0,[a,m]),v=l.useMemo(()=>"focus:border-line-focus",[]),k=l.useMemo(()=>"focus:border-error",[]),b=l.useMemo(()=>s?k.replace("focus:border-","focus:ring-"):v.replace("focus:border-","focus:ring-"),[s,k,v]),j=l.useMemo(()=>w("h-4","w-4",J("sm"),"border","border-line-default","text-fg-brand","focus:ring-2",b,"focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed","cursor-pointer",s&&"border-error",o),[b,s,o]),C=l.useMemo(()=>w(ce("label"),E("sm","ml"),i?"opacity-50 cursor-not-allowed":"cursor-pointer"),[i]),g=l.useRef(null),y=l.useCallback(N=>{g.current=N,typeof d=="function"?d(N):d&&(d.current=N),N&&(N.indeterminate=c)},[d,c]);return l.useEffect(()=>{g.current&&(g.current.indeterminate=c)},[c]),n.jsxs("div",{className:w("flex","flex-col",E("sm","my")),children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("input",T({type:"checkbox",id:m,ref:y,className:j,disabled:i,"aria-invalid":s,"aria-describedby":h||x||void 0,"aria-label":r?void 0:"Checkbox"},u)),r&&n.jsx("label",{htmlFor:m,className:C,children:r})]}),(s||a)&&n.jsx("div",{id:h||x,className:w(E("xs","mt"),ce("caption"),s?"text-fg-error":"text-fg-secondary"),role:s?"alert":void 0,children:s?a||"This field has an error":a})]})}));Nr.displayName="Checkbox";const va=l.memo(l.forwardRef(function(d,u){var f=d,{id:t,label:r,error:s=!1,helperText:a,className:o="",disabled:i=!1}=f,c=O(f,["id","label","error","helperText","className","disabled"]);const p=l.useMemo(()=>t||`radio-${Math.random().toString(36).substr(2,9)}`,[t]),m=l.useMemo(()=>s?`${p}-error`:void 0,[s,p]),h=l.useMemo(()=>a?`${p}-helper`:void 0,[a,p]),x=l.useMemo(()=>"focus:border-line-focus",[]),v=l.useMemo(()=>"focus:border-error",[]),k=l.useMemo(()=>s?v.replace("focus:border-","focus:ring-"):x.replace("focus:border-","focus:ring-"),[s,v,x]),b=l.useMemo(()=>w("h-4","w-4","border","border-line-default","text-fg-brand","focus:ring-2",k,"focus:ring-offset-2","disabled:opacity-50","disabled:cursor-not-allowed","cursor-pointer",s&&"border-error",o),[k,s,o]),j=l.useMemo(()=>w(ce("label"),E("sm","ml"),i?"opacity-50 cursor-not-allowed":"cursor-pointer"),[i]);return n.jsxs("div",{className:w("flex","flex-col",E("sm","my")),children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("input",T({type:"radio",id:p,ref:u,className:b,disabled:i,"aria-invalid":s,"aria-describedby":m||h||void 0,"aria-label":r?void 0:"Radio button"},c)),r&&n.jsx("label",{htmlFor:p,className:j,children:r})]}),(s||a)&&n.jsx("div",{id:m||h,className:w(E("xs","mt"),ce("caption"),s?"text-fg-error":"text-fg-secondary"),role:s?"alert":void 0,children:s?a||"This field has an error":a})]})}));va.displayName="Radio";class ft{static create(t){return{none:{value:"none",tailwind:"shadow-none",description:"No shadow"},sm:{value:"0 1px 2px 0 rgb(0 0 0 / 0.05)",tailwind:"shadow-sm",description:"Small shadow for subtle elevation"},md:{value:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",tailwind:"shadow-md",description:"Medium shadow for cards and elevated elements"},lg:{value:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",tailwind:"shadow-lg",description:"Large shadow for modals and dropdowns"},xl:{value:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",tailwind:"shadow-xl",description:"Extra large shadow for prominent modals"},"2xl":{value:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",tailwind:"shadow-2xl",description:"2X large shadow for maximum elevation"},inner:{value:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",tailwind:"shadow-inner",description:"Inner shadow for inset elements"}}[t]}}const Sc={none:ft.create("none"),sm:ft.create("sm"),md:ft.create("md"),lg:ft.create("lg"),xl:ft.create("xl"),"2xl":ft.create("2xl"),inner:ft.create("inner")};function Se(e){return Sc[e].tailwind}const Ot={track:{sm:{w:"w-9",h:"h-5"},md:{w:"w-11",h:"h-6"},lg:{w:"w-14",h:"h-7"}},thumb:{sm:{w:"w-4",h:"h-4"},md:{w:"w-5",h:"h-5"},lg:{w:"w-6",h:"h-6"}},translate:{sm:"translate-x-4",md:"translate-x-5",lg:"translate-x-7"}};function Cc(e){return{track:`${Ot.track[e].w} ${Ot.track[e].h}`,thumb:`${Ot.thumb[e].w} ${Ot.thumb[e].h}`,translate:Ot.translate[e]}}const $c=xe("w-full",{variants:{size:{sm:"h-1",md:"h-2",lg:"h-3"},variant:{primary:"bg-surface-muted",secondary:"bg-surface-muted",success:"bg-success-bg-emphasis",error:"bg-error-bg-emphasis",warning:"bg-warning-bg-emphasis",info:"bg-info-bg-emphasis"}},defaultVariants:{size:"md",variant:"primary"}}),En=xe("transition-all",{variants:{variant:{primary:"bg-surface-brand",secondary:"bg-surface-secondary",success:"bg-success",error:"bg-error",warning:"bg-warning",info:"bg-info"}},defaultVariants:{variant:"primary"}}),vs=l.forwardRef(function(p,f){var m=p,{value:t,max:r=100,variant:s="primary",size:a="md",showLabel:o=!1,label:i,"aria-label":c,className:u=""}=m,d=O(m,["value","max","variant","size","showLabel","label","aria-label","className"]);const h=t===void 0,x=h?void 0:Math.min(Math.max(t/r*100,0),100),v=c||(h?"Loading in progress":`Progress: ${x==null?void 0:x.toFixed(0)}%`);return n.jsxs("div",P(T({ref:f,className:w("w-full",u)},d),{children:[o&&(i||!h)&&n.jsxs("div",{className:w("flex","items-center","justify-between",E("xs","mb")),children:[i&&n.jsx("span",{className:w(re("bodySmall"),Fe("label"),"text-fg-primary"),children:i}),!h&&x!==void 0&&n.jsxs("span",{className:w(re("bodySmall"),"text-fg-secondary"),children:[x.toFixed(0),"%"]})]}),n.jsx("div",{role:"progressbar","aria-valuemin":h?void 0:0,"aria-valuemax":h?void 0:r,"aria-valuenow":h?void 0:t,"aria-label":v,"aria-busy":h,className:w("relative","w-full","overflow-hidden",$c({size:a,variant:s}),J("full")),children:h?n.jsx("div",{className:w("absolute","top-0","left-0","bottom-0",En({variant:s}),J("full"),"motion-reduce:animate-none"),style:{width:"30%",animation:"progress-indeterminate 1.5s ease-in-out infinite"}}):n.jsx("div",{className:w("h-full",En({variant:s}),J("full"),"transition-all","duration-300","ease-out"),style:{width:`${x}%`},"aria-hidden":"true"})})]}))});vs.displayName="Progress";const ya=l.memo(l.forwardRef(function(m,p){var h=m,{size:t="md",label:r,description:s,error:a=!1,className:o="",disabled:i=!1,checked:c,onChange:u,id:d}=h,f=O(h,["size","label","description","error","className","disabled","checked","onChange","id"]);const x=l.useMemo(()=>d||`switch-${Math.random().toString(36).substr(2,9)}`,[d]),v=l.useMemo(()=>r?`${x}-label`:void 0,[r,x]),k=l.useMemo(()=>s?`${x}-description`:void 0,[s,x]),b=l.useMemo(()=>Cc(t),[t]),j=l.useMemo(()=>"focus:border-line-focus".replace("focus:border-","focus:ring-"),[]),C=l.useMemo(()=>w("relative","inline-flex","shrink-0","cursor-pointer","rounded-full","border-2","border-transparent",he("base"),"focus:outline-none","focus:ring-2",j,"focus:ring-offset-2",b.track,c?"bg-surface-brand":"bg-surface-muted",a&&!c&&"border-error",i&&"opacity-50 cursor-not-allowed",o),[j,b.track,c,a,i,o]),g=l.useMemo(()=>w("pointer-events-none","inline-block","rounded-full","bg-surface-base","shadow","transform",he("base"),b.thumb,c?b.translate:"translate-x-0"),[b.thumb,b.translate,c]);return n.jsxs("div",{className:w("flex","items-start",E("md","gap")),children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("button",{type:"button",className:C,role:"switch","aria-checked":c,"aria-labelledby":v,"aria-describedby":k,disabled:i,onClick:l.useCallback(y=>{if(!i&&u){const N=P(T({},y),{target:P(T({},y.target),{checked:!c}),currentTarget:P(T({},y.currentTarget),{checked:!c})});u(N)}},[i,u,c]),onKeyDown:l.useCallback(y=>{if((y.key==="Enter"||y.key===" ")&&!i&&u){y.preventDefault();const N=P(T({},y),{target:P(T({},y.target),{checked:!c}),currentTarget:P(T({},y.currentTarget),{checked:!c})});u(N)}},[i,u,c]),children:n.jsx("span",{className:g})}),n.jsx("input",T({ref:p,type:"checkbox",id:x,checked:c,onChange:u,disabled:i,className:"sr-only","aria-hidden":"true",tabIndex:-1},f))]}),(r||s)&&n.jsxs("div",{className:"flex-1",children:[r&&n.jsx("label",{id:v,htmlFor:x,className:w("block",re("bodySmall"),Fe("label"),a?"text-fg-error":"text-fg-primary",i?"opacity-50":"cursor-pointer"),children:r}),s&&n.jsx("p",{id:k,className:w(E("xs","mt"),re("bodySmall"),a?"text-fg-error":"text-fg-secondary"),children:s})]})]})}));ya.displayName="Switch";const ys=l.memo(function(o){var i=o,{orientation:t="horizontal",variant:r="solid",className:s=""}=i,a=O(i,["orientation","variant","className"]);const c=l.useMemo(()=>{const u=["border-0","border-line-default"],d={horizontal:"w-full border-t",vertical:"h-full border-l self-stretch"},f={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted"};return w(...u,d[t],f[r],s)},[t,r,s]);return t==="vertical"?n.jsx("div",T({className:c,role:"separator","aria-orientation":"vertical"},a)):n.jsx("hr",T({className:c,role:"separator","aria-orientation":"horizontal"},a))});ys.displayName="Separator";const wa=l.forwardRef(function(b,k){var j=b,{value:t,defaultValue:r,min:s=0,max:a=100,step:o=1,variant:i="single",size:c="md",disabled:u=!1,showValue:d=!1,marks:f=[],onChange:p,onValueChange:m,label:h,className:x=""}=j,v=O(j,["value","defaultValue","min","max","step","variant","size","disabled","showValue","marks","onChange","onValueChange","label","className"]);const C=l.useRef(null),[g,y]=l.useState(r||(i==="range"?[s,a]:s)),[N,_]=l.useState(!1),[S,M]=l.useState(null),F=t!==void 0,A=F?t:g,R=H=>(H-s)/(a-s)*100,I=H=>{if(!C.current)return s;const U=C.current.getBoundingClientRect(),V=Math.max(0,Math.min(1,(H-U.left)/U.width)),ne=s+V*(a-s);return Math.round(ne/o)*o},L=(H,U="min")=>{if(u)return;H.preventDefault(),_(!0),M(U);const V=oe=>{if(!C.current)return;const ie=I(oe.clientX);z(ie,U)},ne=()=>{_(!1),M(null),document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",ne)};document.addEventListener("mousemove",V),document.addEventListener("mouseup",ne)},z=(H,U="min")=>{const V=Math.max(s,Math.min(a,H));if(i==="range"){const[ne,oe]=Array.isArray(A)?A:[s,a];let ie;U==="min"?ie=[Math.min(V,oe),oe]:ie=[ne,Math.max(V,ne)],F||y(ie),p==null||p(ie),m==null||m(ie)}else F||y(V),p==null||p(V),m==null||m(V)},Y=H=>{if(u||N)return;const U=I(H.clientX);z(U)},q=()=>"focus:ring-line-brand ring-offset-2",W=xe(w("relative","cursor-pointer"),{variants:{size:{sm:"h-1",md:"h-2",lg:"h-3"},disabled:{true:"opacity-50 cursor-not-allowed",false:""}},defaultVariants:{size:"md",disabled:!1}}),ae=xe(w("absolute","bg-surface-brand","rounded-full","border-2","border-white","shadow-md","cursor-grab","active:cursor-grabbing",he("base"),"-translate-x-1/2","-translate-y-1/2","top-1/2"),{variants:{size:{sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5"},active:{true:q(),false:""}},defaultVariants:{size:"md",active:!1}}),se=typeof A=="number"?A:A[0],D=Array.isArray(A)?A[0]:s,B=Array.isArray(A)?A[1]:se,X=R(D),Q=R(B);return n.jsxs("div",P(T({ref:k,className:w("w-full",x)},v),{children:[h&&n.jsxs("label",{className:w("block",re("bodySmall"),Fe("label"),"text-fg-primary",E("sm","mb")),children:[h,d&&n.jsx("span",{className:w(E("sm","ml"),"text-fg-secondary"),children:i==="range"?`${D} - ${B}`:se})]}),n.jsxs("div",{ref:C,className:w(W({size:c,disabled:u}),"bg-surface-muted",J("full")),onClick:Y,role:i==="range"?void 0:"slider","aria-valuemin":i==="range"?void 0:s,"aria-valuemax":i==="range"?void 0:a,"aria-valuenow":i==="range"?void 0:se,"aria-disabled":i==="range"?void 0:u,"aria-label":i==="range"?void 0:h,children:[n.jsx("div",{className:w("absolute",W({size:c}),"bg-surface-brand",J("full"),he("base")),style:{left:`${X}%`,width:`${Q-X}%`}}),f.map(H=>{const U=R(H);return n.jsx("div",{className:w("absolute","w-1","h-1","bg-line-strong",J("full"),"-translate-x-1/2"),style:{left:`${U}%`,top:"50%",transform:"translate(-50%, -50%)"}},H)}),i==="range"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:w(ae({size:c,active:S==="min"})),style:{left:`${X}%`},onMouseDown:H=>L(H,"min"),role:"slider","aria-valuemin":s,"aria-valuemax":B,"aria-valuenow":D}),n.jsx("div",{className:w(ae({size:c,active:S==="max"})),style:{left:`${Q}%`},onMouseDown:H=>L(H,"max"),role:"slider","aria-valuemin":D,"aria-valuemax":a,"aria-valuenow":B})]}):n.jsx("div",{className:w(ae({size:c,active:N})),style:{left:`${Q}%`},onMouseDown:H=>L(H)}),d&&!h&&n.jsx("div",{className:"absolute -top-6 left-0 right-0 flex justify-center",children:n.jsx("span",{className:w(re("caption"),"text-fg-secondary","bg-surface-overlay",E("sm","px"),E("xs","py"),J("md"),"shadow"),children:i==="range"?`${D} - ${B}`:se})})]})]}))});wa.displayName="Slider";const Ec=xe(w("inline-flex","items-center","font-medium",J("full"),E("xs","gap")),{variants:{variant:{default:w("bg-surface-muted","text-fg-primary","border","border-line-default"),outlined:w("bg-transparent","text-fg-primary","border","border-line-default"),filled:w("bg-surface-brand-strong","text-fg-inverse","border","border-transparent")},size:{sm:w(E("xs","px"),E("xs","py"),re("caption")),md:w(E("sm","px"),E("xs","py"),re("bodySmall")),lg:w(E("md","px"),E("sm","py"),re("body"))},selected:{true:w("bg-surface-brand-strong","text-fg-inverse","border","border-line-brand"),false:""},disabled:{true:"opacity-50 cursor-not-allowed",false:""}},compoundVariants:[{selected:!0,variant:"default",class:""},{selected:!0,variant:"outlined",class:""},{selected:!0,variant:"filled",class:""}],defaultVariants:{variant:"default",size:"md",selected:!1,disabled:!1}}),ws=l.forwardRef(function(h,m){var x=h,{children:t,variant:r="default",size:s="md",onRemove:a,selected:o=!1,disabled:i=!1,className:c="","aria-label":u,onClick:d,tabIndex:f}=x,p=O(x,["children","variant","size","onRemove","selected","disabled","className","aria-label","onClick","tabIndex"]);const v=d!==void 0||o!==!1&&o!==void 0,k=o?"option":v?"button":void 0,j=(()=>{if(u)return u;if(typeof t=="string")return t;if(typeof t=="object"&&t!==null&&"props"in t){const y=t.props;if(y!=null&&y.children&&typeof y.children=="string")return y.children}})(),C=k==="button"&&!j,g=y=>{i||(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),d&&d())};return n.jsxs("div",P(T({ref:m,className:w(Ec({variant:r,size:s,selected:o,disabled:i}),a&&E("xs","pr"),v&&!i&&"cursor-pointer focus:outline-none focus:ring-2 focus:ring-line-focus focus:ring-offset-2",c),role:k,"aria-selected":o?!0:void 0,"aria-disabled":i,"aria-label":C?"Chip":u||(k==="button"?j:void 0),tabIndex:f!==void 0?f:v&&!i?0:void 0,onClick:i?void 0:d,onKeyDown:g},p),{children:[n.jsx("span",{children:t}),a&&!i&&n.jsx("button",{type:"button",onClick:y=>{y.stopPropagation(),a()},className:w(E("xs","ml"),"hover:bg-tint-hover",J("full"),E("xs","p"),"transition-colors","focus:outline-none","focus:ring-2","focus:ring-line-focus","focus:ring-offset-1"),"aria-label":`Remove ${j||"chip"}`,children:n.jsx(we,{className:"h-3 w-3","aria-hidden":"true"})})]}))});ws.displayName="Chip";const ur=l.forwardRef(function(f,d){var p=f,{src:t,alt:r,fallback:s,size:a="md",variant:o="circle","aria-label":i,className:c=""}=p,u=O(p,["src","alt","fallback","size","variant","aria-label","className"]);const[m,h]=l.useState(!1),[x,v]=l.useState(!1),k={xs:"h-6 w-6 text-xs",sm:"h-8 w-8 text-sm",md:"h-10 w-10 text-base",lg:"h-12 w-12 text-lg",xl:"h-16 w-16 text-xl"},b={circle:"rounded-full",square:"rounded-none",rounded:"rounded-md"},j=!t||m,C=typeof s=="string"?s.toUpperCase().slice(0,2):s,g=i||r||"User avatar";return n.jsxs("div",P(T({ref:d,className:w("relative","inline-flex","items-center","justify-center","shrink-0","font-medium","overflow-hidden",k[a],b[o],"bg-surface-muted","text-fg-primary",c),role:"img","aria-label":g},u),{children:[!j&&t&&n.jsx("img",{src:t,alt:r||"",className:w("w-full","h-full","object-cover",o==="circle"?"rounded-full":o==="square"?"rounded-none":"rounded-md",x?"opacity-100":"opacity-0","transition-opacity","duration-200"),onLoad:()=>v(!0),onError:()=>{h(!0),v(!1)},"aria-hidden":"true"}),j&&n.jsx("span",{className:w("flex","items-center","justify-center","w-full","h-full",o==="circle"?"rounded-full":o==="square"?"rounded-none":"rounded-md"),"aria-hidden":"true",children:C||"?"})]}))});ur.displayName="Avatar";function Mc(c){var u=c,{children:e,max:t=3,size:r="md",variant:s="circle",spacing:a="md",className:o=""}=u,i=O(u,["children","max","size","variant","spacing","className"]);const d={none:"",sm:"-space-x-1",md:"-space-x-2",lg:"-space-x-3"},f=l.Children.toArray(e).filter(Boolean),p=f.slice(0,t),m=f.length-t;return n.jsxs("div",P(T({className:w("flex","items-center",d[a],o),role:"group","aria-label":`${f.length} avatars`},i),{children:[p.map((h,x)=>{let v=h;if(l.isValidElement(h)&&h.type===ur){const k=h.props;v=l.cloneElement(h,{size:k.size||r,variant:k.variant||s})}return n.jsx("div",{className:"ring-2 ring-surface-base",style:{zIndex:f.length-x},children:v},x)}),m>0&&n.jsx(ur,{size:r,variant:s,fallback:`+${m}`,"aria-label":`${m} more avatars`,className:"ring-2 ring-surface-base",style:{zIndex:0}})]}))}const fr=l.memo(function(d){var f=d,{variant:t="default",padding:r="medium",className:s="",onClick:a,"aria-label":o,"aria-labelledby":i,children:c}=f,u=O(f,["variant","padding","className","onClick","aria-label","aria-labelledby","children"]);const p=xe(w("bg-surface-base",J("lg"),"border","border-line-default","shadow-sm"),{variants:{variant:{default:"",hover:w("hover:shadow-md","transition-shadow","cursor-pointer"),selected:w("border-line-brand","shadow-md")},padding:{none:"",small:E("xs","p"),medium:E("base","p"),large:E("lg","p")}},defaultVariants:{variant:"default",padding:"medium"}}),m=l.useMemo(()=>a!==void 0||t==="hover",[a,t]),h=m?"button":void 0,x=m?0:void 0,v=w(p({variant:t,padding:r}),s),k=l.useCallback(b=>{m&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),a==null||a())},[m,a]);return n.jsx("div",P(T({className:v,role:h,tabIndex:x,onClick:a,onKeyDown:k,"aria-label":o,"aria-labelledby":i},u),{children:c}))});fr.displayName="Card";const Sr=l.createContext(void 0);function ks(){const e=l.useContext(Sr);if(e===void 0)throw new Error("useFormContext must be used within a Form component with react-hook-form integration");return e}function Tc(){return l.useContext(Sr)}function ka({form:e,loading:t=!1,children:r}){const s={form:e,loading:t};return n.jsx(Sr.Provider,{value:s,children:r})}function Ac(c){var u=c,{children:e,onSubmit:t,loading:r=!1,error:s=null,success:a=null,className:o=""}=u,i=O(u,["children","onSubmit","loading","error","success","className"]);const d=w(E("lg","gap"),"flex","flex-col",o);if("form"in i&&i.form!==void 0){const v=i,{form:b,onSubmit:j,onSubmitError:C}=v,g=O(v,["form","onSubmit","onSubmitError"]),y=b.handleSubmit(N=>rr(null,null,function*(){try{yield j(N)}catch(_){C==null||C(_)}}),N=>{C==null||C(N)});return n.jsx(ka,{form:b,loading:r,children:n.jsxs("form",P(T({className:d,onSubmit:y,noValidate:!0},g),{children:[e,s&&n.jsx("div",{role:"alert",className:w(E("md","p"),ve("sm"),"text-error-dark","bg-error-bg","border","border-error",J("md")),children:s}),a&&n.jsx("div",{role:"alert",className:w(E("md","p"),ve("sm"),"text-success-dark","bg-success-bg","border","border-success",J("md")),children:a})]}))})}const p=i.onSubmit||t,k=i,{onSubmit:m}=k,h=O(k,["onSubmit"]),x=b=>{b.preventDefault(),p&&!r&&p(b)};return n.jsxs("form",P(T({className:d,onSubmit:x,noValidate:!0},h),{children:[e,s&&n.jsx("div",{role:"alert",className:w(E("md","p"),ve("sm"),"text-error-dark","bg-error-bg","border","border-error",J("md")),children:s}),a&&n.jsx("div",{role:"alert",className:w(E("md","p"),ve("sm"),"text-success-dark","bg-success-bg","border","border-success",J("md")),children:a})]}))}function Rc({name:e,label:t,children:r,rules:s,className:a=""}){var m;const{form:o}=ks();if(!o)throw new Error("FormField must be used within a Form component with react-hook-form integration");const{register:i,formState:{errors:c},watch:u}=o,d=i(e,s),f=(m=c[e])==null?void 0:m.message,p=u(e);return n.jsxs("div",{className:w("flex","flex-col",E("sm","gap"),a),children:[t&&n.jsx(Mt,{htmlFor:e,className:w("block",ve("sm"),Et("medium"),"text-fg-primary"),children:t}),r({name:e,register:h=>i(h,s),error:f,value:p,onChange:d.onChange,onBlur:d.onBlur}),f&&n.jsx(ba,{message:f})]})}var Ic=e=>e.type==="checkbox",Dc=e=>e instanceof Date,He=e=>e==null;const Lc=e=>typeof e=="object";var qe=e=>!He(e)&&!Array.isArray(e)&&Lc(e)&&!Dc(e),Fc=e=>{const t=e.constructor&&e.constructor.prototype;return qe(t)&&t.hasOwnProperty("isPrototypeOf")},ja=typeof window!="undefined"&&typeof window.HTMLElement!="undefined"&&typeof document!="undefined";function mt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList!="undefined"&&e instanceof FileList;if(ja&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(qe(e)&&Fc(e)))return e;const s=r?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(s[a]=mt(e[a]));return s}var js=e=>/^\w*$/.test(e),_e=e=>e===void 0,Na=e=>Array.isArray(e)?e.filter(Boolean):[],Ns=e=>Na(e.replace(/["|']|\]/g,"").split(/\.|\[/)),De=(e,t,r)=>{if(!t||!qe(e))return r;const s=(js(t)?[t]:Ns(t)).reduce((a,o)=>He(a)?a:a[o],e);return _e(s)||s===e?_e(e[t])?r:e[t]:s},Sa=e=>typeof e=="boolean",_c=e=>typeof e=="function",mr=(e,t,r)=>{let s=-1;const a=js(t)?[t]:Ns(t),o=a.length,i=o-1;for(;++s<o;){const c=a[s];let u=r;if(s!==i){const d=e[c];u=qe(d)||Array.isArray(d)?d:isNaN(+a[s+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;e[c]=u,e=e[c]}};const Ct={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},We={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ca=l.createContext(null);Ca.displayName="HookFormControlContext";const Pc=()=>l.useContext(Ca),zc=typeof window!="undefined"?l.useLayoutEffect:l.useEffect;var Xe=e=>typeof e=="string";const Oc=l.createContext(null);Oc.displayName="HookFormContext";var Vc=(e,t,r,s,a)=>t?P(T({},r[e]),{types:P(T({},r[e]&&r[e].types?r[e].types:{}),{[s]:a||!0})}):{},Le=e=>Array.isArray(e)?e:[e],pr=e=>qe(e)&&!Object.keys(e).length,Wc=e=>e.type==="file",Hc=e=>{if(!ja)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Bc=e=>e.type==="radio";function Uc(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=_e(e)?s++:e[t[s++]];return e}function qc(e){for(const t in e)if(e.hasOwnProperty(t)&&!_e(e[t]))return!1;return!0}function $a(e,t){const r=Array.isArray(t)?t:js(t)?[t]:Ns(t),s=r.length===1?e:Uc(e,r),a=r.length-1,o=r[a];return s&&delete s[o],a!==0&&(qe(s)&&pr(s)||Array.isArray(s)&&qc(s))&&$a(e,r.slice(0,-1)),e}var Ea=e=>e instanceof RegExp,ir=e=>({isOnSubmit:!e||e===Ct.onSubmit,isOnBlur:e===Ct.onBlur,isOnChange:e===Ct.onChange,isOnAll:e===Ct.all,isOnTouch:e===Ct.onTouched}),Gc=(e,t,r)=>t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length)));const os=(e,t,r,s)=>{for(const o of Object.keys(e)){const i=De(e,o);if(i){const a=i,{_f:c}=a,u=O(a,["_f"]);if(c){if(c.refs&&c.refs[0]&&t(c.refs[0],o))return!0;if(c.ref&&t(c.ref,c.name))return!0;if(os(u,t))break}else if(qe(u)&&os(u,t))break}}};var Kc=(e,t,r)=>{const s=Le(De(e,r));return mr(s,"root",t[r]),mr(e,r,s),e};function Mn(e,t,r="validate"){if(Xe(e)||Array.isArray(e)&&e.every(Xe)||Sa(e)&&!e)return{type:r,message:Xe(e)?e:"",ref:t}}var Nt=e=>qe(e)&&!Ea(e)?e:{value:e,message:""},Yc=(e,t,r,s,a,o)=>rr(null,null,function*(){const{ref:i,refs:c,required:u,maxLength:d,minLength:f,min:p,max:m,pattern:h,validate:x,name:v,valueAsNumber:k,mount:b}=e._f,j=De(r,v);if(!b||t.has(v))return{};const C=c?c[0]:i,g=M=>{a&&C.reportValidity&&(C.setCustomValidity(Sa(M)?"":M||""),C.reportValidity())},y={};Bc(i),Ic(i);const N=(k||Wc(i))&&_e(i.value)&&_e(j)||Hc(i)&&i.value===""||j===""||Array.isArray(j)&&!j.length,_=Vc.bind(null,v,s,y),S=(M,F,A,R=We.maxLength,I=We.minLength)=>{const L=M?F:A;y[v]=T({type:M?R:I,message:L,ref:i},_(M?R:I,L))};if(!Array.isArray(j)||!j.length){const{value:M,message:F}=Xe(u)?{value:!!u,message:u}:Nt(u);if(M&&(y[v]=T({type:We.required,message:F,ref:C},_(We.required,F)),!s))return g(F),y}if(!N&&(!He(p)||!He(m))){let M,F;const A=Nt(m),R=Nt(p);if(!He(j)&&!isNaN(j)){const I=i.valueAsNumber||j&&+j;He(A.value)||(M=I>A.value),He(R.value)||(F=I<R.value)}else{const I=i.valueAsDate||new Date(j),L=q=>new Date(new Date().toDateString()+" "+q),z=i.type=="time",Y=i.type=="week";Xe(A.value)&&j&&(M=z?L(j)>L(A.value):Y?j>A.value:I>new Date(A.value)),Xe(R.value)&&j&&(F=z?L(j)<L(R.value):Y?j<R.value:I<new Date(R.value))}if((M||F)&&(S(!!M,A.message,R.message,We.max,We.min),!s))return g(y[v].message),y}if((d||f)&&!N&&(Xe(j)||Array.isArray(j))){const M=Nt(d),F=Nt(f),A=!He(M.value)&&j.length>+M.value,R=!He(F.value)&&j.length<+F.value;if((A||R)&&(S(A,M.message,F.message),!s))return g(y[v].message),y}if(h&&!N&&Xe(j)){const{value:M,message:F}=Nt(h);if(Ea(M)&&!j.match(M)&&(y[v]=T({type:We.pattern,message:F,ref:i},_(We.pattern,F)),!s))return g(F),y}if(x){if(_c(x)){const M=yield x(j,r),F=Mn(M,C);if(F&&(y[v]=T(T({},F),_(We.validate,F.message)),!s))return g(F.message),y}else if(qe(x)){let M={};for(const F in x){if(!pr(M)&&!s)break;const A=Mn(yield x[F](j,r),C,F);A&&(M=T(T({},A),_(F,A.message)),g(A.message),s&&(y[v]=M))}if(!pr(M)&&(y[v]=T({ref:C},M),!s))return y}}return g(!0),y}),Ye=()=>{if(typeof crypto!="undefined"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance=="undefined"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},Kr=(e,t,r={})=>r.shouldFocus||_e(r.shouldFocus)?r.focusName||`${e}.${_e(r.focusIndex)?t:r.focusIndex}.`:"",Yr=(e,t)=>[...e,...Le(t)],Xr=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Jr(e,t,r){return[...e.slice(0,t),...Le(r),...e.slice(t)]}var Zr=(e,t,r)=>Array.isArray(e)?(_e(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Qr=(e,t)=>[...Le(t),...Le(e)];function Xc(e,t){let r=0;const s=[...e];for(const a of t)s.splice(a-r,1),r++;return Na(s).length?s:[]}var es=(e,t)=>_e(t)?[]:Xc(e,Le(t).sort((r,s)=>r-s)),ts=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Tn=(e,t,r)=>(e[t]=r,e);function Jc(e){const t=Pc(),{control:r=t,name:s,keyName:a="id",shouldUnregister:o,rules:i}=e,[c,u]=l.useState(r._getFieldArray(s)),d=l.useRef(r._getFieldArray(s).map(Ye)),f=l.useRef(!1);r._names.array.add(s),l.useMemo(()=>i&&c.length>=0&&r.register(s,i),[r,s,c.length,i]),zc(()=>r._subjects.array.subscribe({next:({values:g,name:y})=>{if(y===s||!y){const N=De(g,s);Array.isArray(N)&&(u(N),d.current=N.map(Ye))}}}).unsubscribe,[r,s]);const p=l.useCallback(g=>{f.current=!0,r._setFieldArray(s,g)},[r,s]),m=(g,y)=>{const N=Le(mt(g)),_=Yr(r._getFieldArray(s),N);r._names.focus=Kr(s,_.length-1,y),d.current=Yr(d.current,N.map(Ye)),p(_),u(_),r._setFieldArray(s,_,Yr,{argA:Xr(g)})},h=(g,y)=>{const N=Le(mt(g)),_=Qr(r._getFieldArray(s),N);r._names.focus=Kr(s,0,y),d.current=Qr(d.current,N.map(Ye)),p(_),u(_),r._setFieldArray(s,_,Qr,{argA:Xr(g)})},x=g=>{const y=es(r._getFieldArray(s),g);d.current=es(d.current,g),p(y),u(y),!Array.isArray(De(r._fields,s))&&mr(r._fields,s,void 0),r._setFieldArray(s,y,es,{argA:g})},v=(g,y,N)=>{const _=Le(mt(y)),S=Jr(r._getFieldArray(s),g,_);r._names.focus=Kr(s,g,N),d.current=Jr(d.current,g,_.map(Ye)),p(S),u(S),r._setFieldArray(s,S,Jr,{argA:g,argB:Xr(y)})},k=(g,y)=>{const N=r._getFieldArray(s);ts(N,g,y),ts(d.current,g,y),p(N),u(N),r._setFieldArray(s,N,ts,{argA:g,argB:y},!1)},b=(g,y)=>{const N=r._getFieldArray(s);Zr(N,g,y),Zr(d.current,g,y),p(N),u(N),r._setFieldArray(s,N,Zr,{argA:g,argB:y},!1)},j=(g,y)=>{const N=mt(y),_=Tn(r._getFieldArray(s),g,N);d.current=[..._].map((S,M)=>!S||M===g?Ye():d.current[M]),p(_),u([..._]),r._setFieldArray(s,_,Tn,{argA:g,argB:N},!0,!1)},C=g=>{const y=Le(mt(g));d.current=y.map(Ye),p([...y]),u([...y]),r._setFieldArray(s,[...y],N=>N,{},!0,!1)};return l.useEffect(()=>{if(r._state.action=!1,Gc(s,r._names)&&r._subjects.state.next(T({},r._formState)),f.current&&(!ir(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!ir(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([s]).then(g=>{r._updateIsValidating([s]);const y=De(g.errors,s),N=De(r._formState.errors,s);(N?!y&&N.type||y&&(N.type!==y.type||N.message!==y.message):y&&y.type)&&(y?mr(r._formState.errors,s,y):$a(r._formState.errors,s),r._subjects.state.next({errors:r._formState.errors}))});else{const g=De(r._fields,s);g&&g._f&&!(ir(r._options.reValidateMode).isOnSubmit&&ir(r._options.mode).isOnSubmit)&&Yc(g,r._names.disabled,r._formValues,r._options.criteriaMode===Ct.all,r._options.shouldUseNativeValidation).then(y=>!pr(y)&&r._subjects.state.next({errors:Kc(r._formState.errors,y,s)}))}r._subjects.state.next({name:s,values:mt(r._formValues)}),r._names.focus&&os(r._fields,(g,y)=>{if(r._names.focus&&y.startsWith(r._names.focus)&&g.focus)return g.focus(),1}),r._names.focus="",r._setValid(),f.current=!1},[c,s,r]),l.useEffect(()=>(!De(r._formValues,s)&&r._setFieldArray(s),()=>{const g=(y,N)=>{const _=De(r._fields,y);_&&_._f&&(_._f.mount=N)};r._options.shouldUnregister||o?r.unregister(s):g(s,!1)}),[s,r,a,o]),{swap:l.useCallback(k,[p,s,r]),move:l.useCallback(b,[p,s,r]),prepend:l.useCallback(h,[p,s,r]),append:l.useCallback(m,[p,s,r]),remove:l.useCallback(x,[p,s,r]),insert:l.useCallback(v,[p,s,r]),update:l.useCallback(j,[p,s,r]),replace:l.useCallback(C,[p,s,r]),fields:l.useMemo(()=>c.map((g,y)=>P(T({},g),{[a]:d.current[y]||Ye()})),[c,a])}}function Zc(e){const{form:t}=ks();if(!t)throw new Error("useFormFieldArray must be used within a Form component with react-hook-form integration");return Jc(P(T({},e),{control:t.control}))}function Ma(a){var o=a,{items:e,separator:t="/",className:r=""}=o,s=O(o,["items","separator","className"]);const i=["flex","items-center",E("sm","space-x"),re("bodySmall")],c=w(...i,r);return n.jsx("nav",P(T({"aria-label":"Breadcrumb",className:c},s),{children:n.jsx("ol",{className:w("flex","items-center",E("sm","space-x")),children:e.map((u,d)=>{const f=d===e.length-1;return n.jsxs("li",{className:"flex items-center",children:[d>0&&n.jsx("span",{className:w(E("sm","mx"),"text-fg-tertiary"),"aria-hidden":"true",children:t}),f?n.jsx("span",{className:w("text-fg-primary",Fe("label")),"aria-current":"page",children:u.label}):u.href?n.jsx("a",{href:u.href,className:w("inline-flex","items-center",E("xs","px"),E("xs","pt"),"border-b-2","border-transparent",re("bodySmall"),Fe("label"),"transition-colors","text-fg-secondary","hover:border-line-emphasis","hover:text-fg-primary"),children:u.label}):n.jsx("span",{className:"text-fg-secondary",children:u.label})]},d)})})}))}function Ta(u){var d=u,{currentPage:e,totalPages:t,onPageChange:r,totalItems:s,itemsPerPage:a,showPageInfo:o=!0,className:i=""}=d,c=O(d,["currentPage","totalPages","onPageChange","totalItems","itemsPerPage","showPageInfo","className"]);const f=()=>{e>1&&r(e-1)},p=()=>{e<t&&r(e+1)},m=b=>{b>=1&&b<=t&&b!==e&&r(b)},h=()=>{const b=[];if(t<=5)for(let C=1;C<=t;C++)b.push(C);else if(e<=3){for(let C=1;C<=4;C++)b.push(C);b.push("ellipsis"),b.push(t)}else if(e>=t-2){b.push(1),b.push("ellipsis");for(let C=t-3;C<=t;C++)b.push(C)}else{b.push(1),b.push("ellipsis");for(let C=e-1;C<=e+1;C++)b.push(C);b.push("ellipsis"),b.push(t)}return b},x=s&&a?(e-1)*a+1:void 0,v=s&&a?Math.min(e*a,s):void 0,k=w("flex","items-center","justify-between",E("base","px"),E("md","py"),i);return n.jsxs("nav",P(T({className:k,"aria-label":"Pagination"},c),{children:[n.jsxs("div",{className:w("flex","items-center",E("sm","gap")),children:[n.jsx(Z,{variant:"secondary",onClick:f,disabled:e===1,size:"sm",children:"Previous"}),n.jsx("div",{className:w("flex","items-center",E("xs","gap")),children:h().map((b,j)=>{if(b==="ellipsis")return n.jsx("span",{className:w(E("sm","px"),"text-fg-tertiary"),children:"..."},`ellipsis-${j}`);const C=b,g=C===e;return n.jsx(Z,{variant:g?"primary":"ghost",onClick:()=>m(C),size:"sm","aria-current":g?"page":void 0,"aria-label":`Go to page ${C}`,children:C},C)})}),n.jsx(Z,{variant:"secondary",onClick:p,disabled:e===t,size:"sm",children:"Next"})]}),o&&s&&a&&n.jsxs("div",{className:w(ve("sm"),"text-fg-primary"),children:["Showing ",x," to ",v," of ",s," results"]})]}))}function Aa(u){var d=u,{title:e,message:t,actionLabel:r,onAction:s,illustration:a,variant:o="default",className:i=""}=d,c=O(d,["title","message","actionLabel","onAction","illustration","variant","className"]);const f=w("flex","flex-col","items-center","justify-center","text-center",E("xl","py"),E("base","px"),i),p=o==="withAction"||r&&s,m=o==="withIllustration"||a;return n.jsxs("div",P(T({className:f,role:"status","aria-live":"polite","aria-label":`${e}. ${t}`},c),{children:[m&&a&&n.jsx("div",{className:w(E("base","mb")),"aria-hidden":"true",children:a}),n.jsx(Be,{as:"h3",className:w(re("h4"),Et("semibold"),"text-fg-primary",E("sm","mb")),children:e}),n.jsx(Be,{as:"p",className:w(re("bodySmall"),"text-fg-secondary",E("md","mb"),"max-w-sm"),children:t}),p&&r&&s&&n.jsx(Z,{variant:"primary",onClick:s,children:r})]}))}function Ra(c){var u=c,{trigger:e,items:t,align:r="right",variant:s="default",className:a="","aria-label":o}=u,i=O(u,["trigger","items","align","variant","className","aria-label"]);const[d,f]=l.useState(!1),[p,m]=l.useState(-1),h=l.useRef(null),x=l.useRef(null),v=l.useRef(null),k=l.useRef([]),b=`dropdown-menu-${Math.random().toString(36).substr(2,9)}`,j=`dropdown-trigger-${Math.random().toString(36).substr(2,9)}`;l.useEffect(()=>{const S=M=>{h.current&&!h.current.contains(M.target)&&(f(!1),m(-1))};return d&&(document.addEventListener("mousedown",S),setTimeout(()=>{var F;const M=t.findIndex(A=>!A.disabled);M>=0&&(m(M),(F=k.current[M])==null||F.focus())},0)),()=>{document.removeEventListener("mousedown",S)}},[d,t]),l.useEffect(()=>{if(!d)return;const S=F=>{var I,L,z,Y;const A=t.map((q,W)=>({item:q,index:W})).filter(({item:q})=>!q.disabled),R=A.findIndex(({index:q})=>q===p);switch(F.key){case"ArrowDown":{F.preventDefault();const q=R<A.length-1?A[R+1].index:A[0].index;m(q),(I=k.current[q])==null||I.focus();break}case"ArrowUp":{F.preventDefault();const q=R>0?A[R-1].index:A[A.length-1].index;m(q),(L=k.current[q])==null||L.focus();break}case"Home":{F.preventDefault();const q=A[0].index;m(q),(z=k.current[q])==null||z.focus();break}case"End":{F.preventDefault();const q=A[A.length-1].index;m(q),(Y=k.current[q])==null||Y.focus();break}case"Enter":case" ":F.preventDefault(),p>=0&&!t[p].disabled&&C(t[p]);break;case"Escape":F.preventDefault(),f(!1),m(-1),setTimeout(()=>{var q;(q=x.current)==null||q.focus()},0);break}},M=v.current;if(M){const F=S;return M.addEventListener("keydown",F),()=>{M.removeEventListener("keydown",F)}}},[d,p,t]);const C=S=>{S.disabled||(S.onClick(),f(!1),m(-1),setTimeout(()=>{var M;(M=x.current)==null||M.focus()},0))},g=()=>{f(!d),m(-1)},y=S=>{(S.key==="Enter"||S.key===" "||S.key==="ArrowDown")&&(S.preventDefault(),f(!0))},N=r==="right"?"right-0":"left-0",_=l.isValidElement(e)?l.cloneElement(e,{onClick:S=>{g(),e.props.onClick&&e.props.onClick(S)},onKeyDown:S=>{y(S),e.props.onKeyDown&&e.props.onKeyDown(S)},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":o||e.props["aria-label"]||"Open menu",id:j,ref:S=>{x.current=S,typeof e.ref=="function"?e.ref(S):e.ref&&(e.ref.current=S)}}):n.jsx("div",{ref:x,onClick:g,onKeyDown:y,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":o||"Open menu",id:j,children:e});return n.jsxs("div",P(T({className:w("relative","inline-block",a),ref:h},i),{children:[_,d&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:w("fixed","inset-0","z-10"),onClick:()=>{f(!1),m(-1)},"aria-hidden":"true"}),n.jsx("div",{ref:v,id:b,className:w("absolute","z-20",E("sm","mt"),"w-48",J("md"),Se("lg"),"bg-surface-overlay","ring-1","ring-line-strong","ring-opacity-5",N),role:"menu","aria-orientation":"vertical","aria-labelledby":j,"aria-activedescendant":p>=0?`${b}-item-${p}`:void 0,children:n.jsx("div",{className:w(E("xs","py")),role:"none",children:t.map((S,M)=>{const F=w("block",E("base","px"),E("xs","py"),re("bodySmall"),"w-full","text-left","focus:outline-none",S.disabled?w("text-fg-disabled","cursor-not-allowed","opacity-50"):S.variant==="danger"?w("text-error-dark","hover:bg-error-bg-emphasis","focus:bg-error-bg-emphasis"):w("text-fg-primary","hover:bg-surface-hover","focus:bg-surface-hover"));return n.jsx("button",{id:`${b}-item-${M}`,ref:A=>{k.current[M]=A},type:"button",className:F,onClick:()=>C(S),disabled:S.disabled,role:"menuitem","aria-disabled":S.disabled,tabIndex:S.disabled?-1:p===M?0:-1,children:S.label},M)})})})]})]}))}const Ia=l.createContext(void 0);function Da(){const e=l.useContext(Ia);if(!e)throw new Error("DatePicker components must be used within a DatePicker component");return e}function is({children:e,mode:t="single",value:r,defaultValue:s,onValueChange:a,minDate:o,maxDate:i,disabledDates:c,locale:u}){const d=()=>{if(r!==void 0)return null;if(s){if(t==="single"&&s instanceof Date)return s;if(t==="range"&&typeof s=="object"&&"start"in s)return null}return null},f=()=>r!==void 0?null:s&&t==="range"&&typeof s=="object"&&"start"in s?s:{start:null,end:null},[p,m]=l.useState(d()),[h,x]=l.useState(f()),v=t==="single"?r instanceof Date?r:p:null,k=t==="range"?r&&typeof r=="object"&&"start"in r?r:h:null,C={selectedDate:v,selectedRange:k,mode:t,onDateChange:g=>{t==="single"&&(r===void 0&&m(g),a==null||a(g))},onRangeChange:g=>{t==="range"&&(r===void 0&&x(g),a==null||a(g))},minDate:o,maxDate:i,disabledDates:c,locale:u};return n.jsx(Ia.Provider,{value:C,children:e})}function Vt(e,t="yyyy-MM-dd"){const r=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return t.replace("yyyy",String(r)).replace("MM",s).replace("dd",a).replace("MM/dd/yyyy",`${s}/${a}/${r}`).replace("dd/MM/yyyy",`${a}/${s}/${r}`)}function An(e){if(!e)return null;const t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(t){const[,a,o,i]=t,c=new Date(parseInt(a),parseInt(o)-1,parseInt(i));if(!isNaN(c.getTime()))return c}const r=e.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);if(r){const[,a,o,i]=r,c=new Date(parseInt(i),parseInt(a)-1,parseInt(o));if(!isNaN(c.getTime()))return c}const s=e.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);if(s){const[,a,o,i]=s,c=new Date(parseInt(i),parseInt(o)-1,parseInt(a));if(!isNaN(c.getTime()))return c}return null}function Ss(c){var u=c,{placeholder:e="Select date",format:t="yyyy-MM-dd",showCalendarButton:r=!0,"aria-label":s,onFocus:a,className:o=""}=u,i=O(u,["placeholder","format","showCalendarButton","aria-label","onFocus","className"]);const{selectedDate:d,selectedRange:f,mode:p,onDateChange:m}=Da(),[h,x]=l.useState(""),[v,k]=l.useState(!1),b=l.useRef(null);l.useEffect(()=>{p==="single"&&d?x(Vt(d,t)):p==="range"&&f?f.start&&f.end?x(`${Vt(f.start,t)} - ${Vt(f.end,t)}`):f.start?x(Vt(f.start,t)):x(""):x("")},[d,f,p,t]);const j=y=>{const N=y.target.value;if(x(N),p==="single"){const _=An(N);m(_)}},C=()=>{if(k(!1),h&&p==="single"){const y=An(h);y&&x(Vt(y,t))}},g=()=>{var y;(y=b.current)==null||y.focus()};return n.jsx("div",P(T({className:`relative ${o}`},i),{children:n.jsx(ke,{ref:b,type:"text",value:h,onChange:j,onFocus:()=>{k(!0),a==null||a()},onBlur:C,placeholder:e,"aria-label":s||e,rightIcon:r?n.jsx(Z,{variant:"iconOnly",size:"sm",onClick:g,"aria-label":"Open calendar",type:"button",children:n.jsx(Tl,{className:"h-4 w-4"})}):void 0})}))}function Qc(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function ed(e){return new Date(e.getFullYear(),e.getMonth(),1).getDay()}function pt(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Wt(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function td(e,t,r){if(!t||!r)return!1;const s=e.getTime();return s>=t.getTime()&&s<=r.getTime()}function Rn(e,t,r,s){return!!(t&&e<t||r&&e>r||s!=null&&s.some(a=>pt(e,a)))}const rd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],sd=["January","February","March","April","May","June","July","August","September","October","November","December"];function Cs(a){var o=a,{month:e,onMonthChange:t,className:r=""}=o,s=O(o,["month","onMonthChange","className"]);const{selectedDate:i,selectedRange:c,mode:u,onDateChange:d,onRangeChange:f,minDate:p,maxDate:m,disabledDates:h}=Da(),[x,v]=l.useState(e||i||(c==null?void 0:c.start)||new Date),k=l.useRef(null),[b,j]=l.useState(()=>{const R=new Date,I=e||i||(c==null?void 0:c.start)||R;return i&&Wt(i,I)?i:Wt(R,I)?R:new Date(I.getFullYear(),I.getMonth(),1)});l.useEffect(()=>{e&&v(e)},[e]),l.useEffect(()=>{if(!k.current)return;const R=k.current.querySelector(`[data-date="${b.toISOString()}"]`);R&&R.focus()},[b]);const C=(()=>{if(Wt(b,x))return b;const R=new Date;return Wt(R,x)?R:new Date(x.getFullYear(),x.getMonth(),1)})(),g=Qc(x),y=ed(x),N=[];for(let R=0;R<y;R++)N.push(null);for(let R=1;R<=g;R++)N.push(new Date(x.getFullYear(),x.getMonth(),R));const _=R=>{if(!Rn(R,p,m,h)){if(u==="single")d(R);else if(u==="range"){const I=c||{start:null,end:null};!I.start||I.start&&I.end?f({start:R,end:null}):I.start&&!I.end&&(R<I.start?f({start:R,end:I.start}):f({start:I.start,end:R}))}}},S=()=>{const R=new Date(x.getFullYear(),x.getMonth()-1,1);v(R),t==null||t(R)},M=()=>{const R=new Date(x.getFullYear(),x.getMonth()+1,1);v(R),t==null||t(R)},F=(R,I)=>{let L=null;switch(R.key){case"ArrowLeft":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),I.getDate()-1);break;case"ArrowRight":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),I.getDate()+1);break;case"ArrowUp":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),I.getDate()-7);break;case"ArrowDown":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),I.getDate()+7);break;case"Home":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth(),1);break;case"End":R.preventDefault(),L=new Date(I.getFullYear(),I.getMonth()+1,0);break;case"Enter":case" ":R.preventDefault(),_(I);return}L&&(Wt(L,x)||v(new Date(L.getFullYear(),L.getMonth(),1)),j(L))},A=[];for(let R=0;R<N.length;R+=7)A.push(N.slice(R,R+7));return n.jsxs("div",P(T({ref:k,className:`p-4 ${r}`},s),{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx(Z,{variant:"iconOnly",size:"sm",onClick:S,"aria-label":"Previous month",children:n.jsx(Bt,{className:"h-4 w-4"})}),n.jsxs("div",{className:"text-sm font-semibold",children:[sd[x.getMonth()]," ",x.getFullYear()]}),n.jsx(Z,{variant:"iconOnly",size:"sm",onClick:M,"aria-label":"Next month",children:n.jsx(ht,{className:"h-4 w-4"})})]}),n.jsxs("div",{role:"grid","aria-label":"Calendar",children:[n.jsx("div",{role:"row",className:"grid grid-cols-7 gap-1 mb-2",children:rd.map(R=>n.jsx("div",{role:"columnheader",className:"text-center text-xs font-medium text-fg-tertiary py-1",children:R},R))}),A.map((R,I)=>n.jsx("div",{role:"row",className:"grid grid-cols-7 gap-1",children:R.map((L,z)=>{if(!L)return n.jsx("div",{role:"gridcell",className:"aspect-square"},`empty-${I}-${z}`);const Y=u==="single"?pt(L,i):pt(L,(c==null?void 0:c.start)||null)||pt(L,(c==null?void 0:c.end)||null),q=u==="range"&&c?td(L,c.start,c.end):!1,W=Rn(L,p,m,h),ae=pt(L,new Date),se=pt(L,b),D=pt(L,C);return n.jsx("button",{role:"gridcell",type:"button","data-date":L.toISOString(),tabIndex:D?0:-1,onClick:()=>_(L),onKeyDown:B=>F(B,L),className:`
178
178
  aspect-square
179
179
  text-sm
180
180
  ${J("md")}
@@ -234,7 +234,7 @@ React keys must be passed directly to JSX without using spread:
234
234
  hover:bg-surface-hover
235
235
  border-b
236
236
  border-line-default
237
- `,onClick:u?f:d,children:u?"Deselect All":"Select All"}),t.map((v,k)=>n.jsx($s,{option:v,isHighlighted:k===r,onSelect:s},v.value))]})});return typeof window!="undefined"?Ue.createPortal(x,document.body):null});Ar.displayName="AutocompleteList";const Oa=l.forwardRef(function({options:t,value:r,defaultValue:s,onChange:a,onSelect:o,placeholder:i="Type to search...",loading:c=!1,disabled:u=!1,emptyMessage:d="No options found",debounceMs:f=300,filterOptions:p,className:m="",inputClassName:h="",size:x="md"},v){const[k,b]=l.useState(typeof s=="string"?s:""),[j,C]=l.useState(!1),[g,y]=l.useState(-1),[N,_]=l.useState(""),S=l.useRef(null),M=l.useRef(null),F=l.useRef(null),A=l.useRef(null),R=r!==void 0,I=R?r:k,z=N.trim()?p?p(t,N):t.filter(D=>D.label.toLowerCase().includes(N.toLowerCase())):t,Y=z.length>0,q=D=>{const B=D.target.value;_(B),R||b(B),a==null||a(B),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{C(!0),y(-1)},f)},W=D=>{var B;D.disabled||(R||b(D.value),_(D.label),C(!1),y(-1),a==null||a(D.value),o==null||o(D),(B=M.current)==null||B.focus())},ae=D=>{if(!j||z.length===0){(D.key==="ArrowDown"||D.key==="Enter")&&C(!0);return}switch(D.key){case"ArrowDown":D.preventDefault(),y(B=>B<z.length-1?B+1:0);break;case"ArrowUp":D.preventDefault(),y(B=>B>0?B-1:z.length-1);break;case"Enter":D.preventDefault(),g>=0&&g<z.length&&W(z[g]);break;case"Escape":D.preventDefault(),C(!1),y(-1);break}};l.useEffect(()=>{if(!j)return;const D=B=>{S.current&&!S.current.contains(B.target)&&(C(!1),y(-1))};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[j]),l.useEffect(()=>{if(g>=0&&F.current){const D=F.current.querySelectorAll('[role="option"]');D[g]&&typeof D[g].scrollIntoView=="function"&&D[g].scrollIntoView({block:"nearest",behavior:"smooth"})}},[g]),l.useEffect(()=>{if(I){const D=t.find(B=>B.value===I);_(D?D.label:I)}else _("")},[I,t]);const se=j&&(Y||c||d);return n.jsxs("div",{ref:S,className:`relative ${m}`,children:[n.jsx(ke,{ref:M||v,value:N,onChange:q,onKeyDown:ae,onFocus:()=>C(!0),placeholder:i,disabled:u,size:x,rightIcon:c?n.jsx(fa,{className:"h-4 w-4 animate-spin"}):n.jsx(hs,{className:`h-4 w-4 transition-transform ${j?"rotate-180":""}`}),className:h}),se&&n.jsx(Ar,{ref:F,options:z,highlightedIndex:g,onSelect:W,loading:c,emptyMessage:d,containerRef:S})]})});Oa.displayName="Autocomplete";const Va=l.forwardRef(function({options:t,value:r,defaultValue:s=[],onChange:a,onSelect:o,placeholder:i="Select options...",loading:c=!1,disabled:u=!1,emptyMessage:d="No options found",maxSelected:f,showSelectAll:p=!1,className:m="",inputClassName:h="",size:x="md"},v){const[k,b]=l.useState(s),[j,C]=l.useState(!1),[g,y]=l.useState(-1),[N,_]=l.useState(""),S=l.useRef(null),M=l.useRef(null),F=l.useRef(null),A=r!==void 0,R=A?r:k,I=t.filter(H=>R.includes(H.value)),z=(()=>{let H=t;return N.trim()&&(H=t.filter(U=>U.label.toLowerCase().includes(N.toLowerCase()))),H})(),Y=z.length>0,q=H=>{const U=H.target.value;_(U),C(!0),y(-1)},W=H=>{if(H.disabled||f&&R.length>=f&&!R.includes(H.value))return;const U=R.includes(H.value)?R.filter(V=>V!==H.value):[...R,H.value];A||b(U),a==null||a(U),o==null||o(t.filter(V=>U.includes(V.value))),_("")},ae=()=>{const H=z.filter(V=>!V.disabled).map(V=>V.value),U=[...new Set([...R,...H])];A||b(U),a==null||a(U),o==null||o(t.filter(V=>U.includes(V.value)))},se=()=>{const H=z.map(V=>V.value),U=R.filter(V=>!H.includes(V));A||b(U),a==null||a(U),o==null||o(t.filter(V=>U.includes(V.value)))},D=H=>{const U=R.filter(V=>V!==H);A||b(U),a==null||a(U),o==null||o(t.filter(V=>U.includes(V.value)))},B=H=>{if(!j||z.length===0){(H.key==="ArrowDown"||H.key==="Enter")&&C(!0),H.key==="Backspace"&&N===""&&R.length>0&&D(R[R.length-1]);return}switch(H.key){case"ArrowDown":H.preventDefault(),y(U=>U<z.length-1?U+1:0);break;case"ArrowUp":H.preventDefault(),y(U=>U>0?U-1:z.length-1);break;case"Enter":H.preventDefault(),g>=0&&g<z.length&&W(z[g]);break;case"Escape":H.preventDefault(),C(!1),y(-1);break}};l.useEffect(()=>{if(!j)return;const H=U=>{S.current&&!S.current.contains(U.target)&&(C(!1),y(-1),_(""))};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[j]);const X=z.filter(H=>!H.disabled).every(H=>R.includes(H.value)),Q=j&&(Y||c||d);return n.jsxs("div",{ref:S,className:w("relative",m),children:[n.jsxs("div",{className:w("flex","flex-wrap",E("sm","gap"),E("sm","p"),"border","border-line-default",J("md"),"min-h-10","focus-within:outline-none","focus-within:ring-2","focus-within:ring-offset-2","focus-within:border-line-brand","focus-within:ring-line-brand"),children:[I.map(H=>n.jsx(ws,{onRemove:()=>D(H.value),size:x==="sm"?"sm":x==="lg"?"lg":"md",children:H.label},H.value)),n.jsx("input",{ref:H=>{typeof v=="function"?v(H):v&&(v.current=H),M.current=H},type:"text",value:N,onChange:q,onKeyDown:B,onFocus:()=>C(!0),placeholder:R.length===0?i:"",disabled:u,className:w("flex-1","min-w-32","outline-none","bg-transparent",h)})]}),Q&&n.jsx(Ar,{ref:F,options:z.map(H=>P(T({},H),{icon:R.includes(H.value)?n.jsx(ns,{className:w("h-4","w-4","text-fg-brand")}):H.icon})),highlightedIndex:g,onSelect:W,loading:c,emptyMessage:d,containerRef:S,showSelectAll:p&&z.length>0,allSelected:X,onSelectAll:ae,onDeselectAll:se})]})});Va.displayName="MultiSelect";function id({value:e,defaultValue:t=0,max:r=5,size:s="md",variant:a="filled",readOnly:o=!1,allowHalf:i=!1,showValue:c=!1,onChange:u,onHover:d,className:f="",icon:p,emptyIcon:m}){const[h,x]=l.useState(t),[v,k]=l.useState(null),b=e!==void 0,j=v!=null?v:b?e:h,C={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},g=S=>{o||(b||x(S),u==null||u(S))},y=S=>{o||(k(S),d==null||d(S))},N=()=>{o||k(null)},_=S=>{const M=S+1,F=i&&j>=M-.5&&j<M,A=j>=M,R=w(C[s],he("base"),!o&&"cursor-pointer",A||F?"text-fg-warning":"text-fg-disabled"),I=p||n.jsx(jt,{className:R,fill:A?"currentColor":"none"}),L=m||n.jsx(jt,{className:R,fill:"none"});return n.jsx("span",{className:"relative inline-block",onClick:()=>g(M),onMouseEnter:()=>y(M),onMouseLeave:N,role:o?void 0:"button",tabIndex:o?void 0:0,"aria-label":`Rate ${M} out of ${r}`,onKeyDown:z=>{!o&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),g(M))},children:F?n.jsxs("span",{className:"relative inline-block",children:[n.jsx("span",{className:"absolute inset-0 overflow-hidden",style:{width:"50%"},children:a==="filled"?n.jsx(jt,{className:R,fill:"currentColor"}):I}),a==="filled"?n.jsx(jt,{className:R,fill:"none"}):L]}):A?a==="filled"?n.jsx(jt,{className:R,fill:"currentColor"}):I:a==="filled"?n.jsx(jt,{className:R,fill:"none"}):L},S)};return n.jsxs("div",{className:w("inline-flex","items-center",E("xs","gap"),f),children:[n.jsx("div",{className:w("flex","items-center"),role:o?"img":void 0,"aria-label":o?`Rating: ${j} out of ${r}`:void 0,children:Array.from({length:r},(S,M)=>_(M))}),c&&n.jsxs("span",{className:w(E("sm","ml"),ve("sm"),"text-fg-secondary"),children:[j.toFixed(i?1:0),"/",r]})]})}function ld({accept:e,multiple:t=!1,maxSize:r,maxFiles:s,onFilesChange:a,onFileRemove:o,showPreview:i=!0,showProgress:c=!1,disabled:u=!1,className:d="",label:f,description:p}){const[m,h]=l.useState([]),[x,v]=l.useState(!1),k=l.useRef(null),b=A=>{if(A===0)return"0 Bytes";const R=1024,I=["Bytes","KB","MB","GB"],L=Math.floor(Math.log(A)/Math.log(R));return Math.round(A/Math.pow(R,L)*100)/100+" "+I[L]},j=A=>r&&A.size>r?`File size exceeds ${b(r)}`:null,C=A=>{const R=Array.from(A),I=[];return R.forEach(L=>{const z=j(L),Y=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,q={file:L,id:Y,error:z,progress:c?0:void 0};if(i&&L.type.startsWith("image/")){const W=new FileReader;W.onload=ae=>{h(se=>se.map(D=>{var B;return D.id===Y?P(T({},D),{preview:(B=ae.target)==null?void 0:B.result}):D}))},W.readAsDataURL(L)}I.push(q)}),I},g=A=>{const R=t?[...m,...A]:A,I=s?R.slice(0,s):R;h(I),a==null||a(I)},y=A=>{if(A.preventDefault(),v(!1),u)return;const R=A.dataTransfer.files;if(R.length>0){const I=C(R);g(I)}},N=A=>{A.preventDefault(),u||v(!0)},_=A=>{A.preventDefault(),v(!1)},S=A=>{if(A.target.files&&A.target.files.length>0){const R=C(A.target.files);g(R)}k.current&&(k.current.value="")},M=A=>{const R=m.filter(I=>I.id!==A);h(R),a==null||a(R),o==null||o(A)},F=()=>{var A;u||(A=k.current)==null||A.click()};return n.jsxs("div",{className:w(E("lg","gap"),"flex","flex-col",d),children:[(f||p)&&n.jsxs("div",{children:[f&&n.jsx("label",{className:w("block",ve("sm"),Et("medium"),"text-fg-primary",E("xs","mb")),children:f}),p&&n.jsx("p",{className:w(ve("sm"),"text-fg-secondary"),children:p})]}),n.jsxs("div",{onDrop:y,onDragOver:N,onDragLeave:_,onClick:F,className:w("relative","border-2","border-dashed",x?"border-line-brand":"border-line-default",J("lg"),E("lg","p"),"text-center","cursor-pointer",he("base"),"focus:border-line-focus",u?"opacity-50 cursor-not-allowed":w("hover:border-line-strong","focus:outline-none","focus:ring-2","focus:ring-offset-2")),role:"button",tabIndex:u?-1:0,"aria-label":"Upload files","aria-disabled":u,children:[n.jsx("input",{ref:k,type:"file",accept:e,multiple:t,onChange:S,disabled:u,className:"hidden"}),n.jsxs("div",{className:w("flex","flex-col","items-center",E("sm","gap")),children:[n.jsx(hc,{className:w("h-8","w-8",x?"text-fg-brand":"text-fg-secondary")}),n.jsxs("div",{children:[n.jsx("span",{className:w(ve("sm"),Et("medium"),"text-fg-primary"),children:x?"Drop files here":"Click to upload or drag and drop"}),e&&n.jsxs("p",{className:w(ve("xs"),"text-fg-secondary",E("xs","mt")),children:["Accepted: ",e]}),r&&n.jsxs("p",{className:w(ve("xs"),"text-fg-secondary"),children:["Max size: ",b(r)]})]})]})]}),m.length>0&&n.jsx("div",{className:w("flex","flex-col",E("sm","gap")),children:m.map(A=>n.jsxs("div",{className:w("flex","items-center",E("md","gap"),E("base","p"),"border","border-line-default",J("md"),A.error?"bg-error-bg":"bg-surface-muted"),children:[i&&A.preview?n.jsx("img",{src:A.preview,alt:A.file.name,className:w("w-12","h-12","object-cover",J("md"))}):n.jsx(Xl,{className:w("h-8","w-8","text-fg-secondary")}),n.jsxs("div",{className:w("flex-1","min-w-0"),children:[n.jsx("p",{className:w(ve("sm"),Et("medium"),"text-fg-primary","truncate"),children:A.file.name}),n.jsx("p",{className:w(ve("xs"),"text-fg-secondary"),children:b(A.file.size)}),A.error&&n.jsxs("div",{className:w("flex","items-center",E("xs","gap"),E("xs","mt")),children:[n.jsx(bs,{className:w("h-3","w-3","text-fg-error")}),n.jsx("span",{className:w(ve("xs"),"text-fg-error"),children:A.error})]}),c&&A.progress!==void 0&&n.jsx("div",{className:w(E("sm","mt")),children:n.jsx(vs,{value:A.progress,size:"sm"})})]}),!A.error&&!c&&n.jsx(dr,{className:w("h-5","w-5","text-fg-success")}),n.jsx(Z,{variant:"ghost",size:"sm",onClick:R=>{R.stopPropagation(),M(A.id)},className:"h-auto p-1","aria-label":`Remove ${A.file.name}`,children:n.jsx(we,{className:"h-4 w-4"})})]},A.id))})]})}function Es({trigger:e,children:t,open:r,defaultOpen:s=!1,onOpenChange:a,placement:o="bottom",showCloseButton:i=!1,title:c,closeOnClickOutside:u=!0,closeOnEscape:d=!0,className:f="",triggerClassName:p="",contentClassName:m=""}){const[h,x]=l.useState(s),v=l.useRef(null),k=l.useRef(null),[b,j]=l.useState({top:0,left:0}),C=r!==void 0,g=C?r:h,y=l.useCallback(()=>{if(!v.current||!k.current)return;const M=v.current.getBoundingClientRect(),F=k.current.getBoundingClientRect(),A=window.scrollY,R=window.scrollX;let I=0,L=0;o.startsWith("top")?(I=M.top+A-F.height-8,o==="top-start"?L=M.left+R:o==="top-end"?L=M.right+R-F.width:L=M.left+R+(M.width-F.width)/2):o.startsWith("bottom")?(I=M.bottom+A+8,o==="bottom-start"?L=M.left+R:o==="bottom-end"?L=M.right+R-F.width:L=M.left+R+(M.width-F.width)/2):o.startsWith("left")?(L=M.left+R-F.width-8,o==="left-start"?I=M.top+A:o==="left-end"?I=M.bottom+A-F.height:I=M.top+A+(M.height-F.height)/2):o.startsWith("right")&&(L=M.right+R+8,o==="right-start"?I=M.top+A:o==="right-end"?I=M.bottom+A-F.height:I=M.top+A+(M.height-F.height)/2);const z=8;I=Math.max(z,Math.min(I,window.innerHeight+A-F.height-z)),L=Math.max(z,Math.min(L,window.innerWidth+R-F.width-z)),j({top:I,left:L})},[o]);l.useEffect(()=>{if(g){y();const M=()=>y(),F=()=>y();return window.addEventListener("resize",M),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",F,!0)}}},[g,o,y]),l.useEffect(()=>{g&&k.current&&setTimeout(y,0)},[g,y]);const N=l.useCallback(M=>{C||x(M),a==null||a(M)},[C,a]),_=l.useCallback(()=>{N(!1)},[N]);l.useEffect(()=>{if(g&&d){const M=F=>{F.key==="Escape"&&_()};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)}},[g,d,_]),l.useEffect(()=>{if(g&&u){const M=F=>{k.current&&v.current&&!k.current.contains(F.target)&&!v.current.contains(F.target)&&_()};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)}},[g,u,_]);const S=g?n.jsxs("div",{ref:k,className:`
237
+ `,onClick:u?f:d,children:u?"Deselect All":"Select All"}),t.map((v,k)=>n.jsx($s,{option:v,isHighlighted:k===r,onSelect:s},v.value))]})});return typeof window!="undefined"?Ue.createPortal(x,document.body):null});Ar.displayName="AutocompleteList";const Oa=l.forwardRef(function({options:t,value:r,defaultValue:s,onChange:a,onSelect:o,placeholder:i="Type to search...",loading:c=!1,disabled:u=!1,emptyMessage:d="No options found",debounceMs:f=300,filterOptions:p,className:m="",inputClassName:h="",size:x="md"},v){const[k,b]=l.useState(typeof s=="string"?s:""),[j,C]=l.useState(!1),[g,y]=l.useState(-1),[N,_]=l.useState(""),S=l.useRef(null),M=l.useRef(null),F=l.useRef(null),A=l.useRef(null),R=r!==void 0,I=R?r:k,z=N.trim()?p?p(t,N):t.filter(D=>D.label.toLowerCase().includes(N.toLowerCase())):t,Y=z.length>0,q=D=>{const B=D.target.value;_(B),R||b(B),a==null||a(B),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{C(!0),y(-1)},f)},W=D=>{var B;D.disabled||(R||b(D.value),_(D.label),C(!1),y(-1),a==null||a(D.value),o==null||o(D),(B=M.current)==null||B.focus())},ae=D=>{if(!j||z.length===0){(D.key==="ArrowDown"||D.key==="Enter")&&C(!0);return}switch(D.key){case"ArrowDown":D.preventDefault(),y(B=>B<z.length-1?B+1:0);break;case"ArrowUp":D.preventDefault(),y(B=>B>0?B-1:z.length-1);break;case"Enter":D.preventDefault(),g>=0&&g<z.length&&W(z[g]);break;case"Escape":D.preventDefault(),C(!1),y(-1);break}};l.useEffect(()=>{if(!j)return;const D=B=>{S.current&&!S.current.contains(B.target)&&(C(!1),y(-1))};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[j]),l.useEffect(()=>{if(g>=0&&F.current){const D=F.current.querySelectorAll('[role="option"]');D[g]&&typeof D[g].scrollIntoView=="function"&&D[g].scrollIntoView({block:"nearest",behavior:"smooth"})}},[g]),l.useEffect(()=>{if(I){const D=t.find(B=>B.value===I);_(D?D.label:I)}else _("")},[I,t]);const se=j&&(Y||c||d);return n.jsxs("div",{ref:S,className:`relative ${m}`,children:[n.jsx(ke,{ref:M||v,value:N,onChange:q,onKeyDown:ae,onFocus:()=>C(!0),placeholder:i,disabled:u,size:x,rightIcon:c?n.jsx(fa,{className:"h-4 w-4 animate-spin"}):n.jsx(hs,{className:`h-4 w-4 transition-transform ${j?"rotate-180":""}`}),className:h}),se&&n.jsx(Ar,{ref:F,options:z,highlightedIndex:g,onSelect:W,loading:c,emptyMessage:d,containerRef:S})]})});Oa.displayName="Autocomplete";const Va=l.forwardRef(function({options:t,value:r,defaultValue:s=[],onChange:a,onSelect:o,placeholder:i="Select options...",loading:c=!1,disabled:u=!1,emptyMessage:d="No options found",maxSelected:f,showSelectAll:p=!1,className:m="",inputClassName:h="",size:x="md"},v){const[k,b]=l.useState(s),[j,C]=l.useState(!1),[g,y]=l.useState(-1),[N,_]=l.useState(""),S=l.useRef(null),M=l.useRef(null),F=l.useRef(null),A=r!==void 0,R=A?r:k,I=t.filter(H=>R.includes(H.value)),z=(()=>{let H=t;return N.trim()&&(H=t.filter(U=>U.label.toLowerCase().includes(N.toLowerCase()))),H})(),Y=z.length>0,q=H=>{const U=H.target.value;_(U),C(!0),y(-1)},W=H=>{if(H.disabled||f&&R.length>=f&&!R.includes(H.value))return;const U=R.includes(H.value)?R.filter(V=>V!==H.value):[...R,H.value];A||b(U),a==null||a(U),o==null||o(t.filter(V=>U.includes(V.value))),_("")},ae=()=>{const H=z.filter(V=>!V.disabled).map(V=>V.value),U=[...new Set([...R,...H])];A||b(U),a==null||a(U),o==null||o(t.filter(V=>U.includes(V.value)))},se=()=>{const H=z.map(V=>V.value),U=R.filter(V=>!H.includes(V));A||b(U),a==null||a(U),o==null||o(t.filter(V=>U.includes(V.value)))},D=H=>{const U=R.filter(V=>V!==H);A||b(U),a==null||a(U),o==null||o(t.filter(V=>U.includes(V.value)))},B=H=>{if(!j||z.length===0){(H.key==="ArrowDown"||H.key==="Enter")&&C(!0),H.key==="Backspace"&&N===""&&R.length>0&&D(R[R.length-1]);return}switch(H.key){case"ArrowDown":H.preventDefault(),y(U=>U<z.length-1?U+1:0);break;case"ArrowUp":H.preventDefault(),y(U=>U>0?U-1:z.length-1);break;case"Enter":H.preventDefault(),g>=0&&g<z.length&&W(z[g]);break;case"Escape":H.preventDefault(),C(!1),y(-1);break}};l.useEffect(()=>{if(!j)return;const H=U=>{S.current&&!S.current.contains(U.target)&&(C(!1),y(-1),_(""))};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[j]);const X=z.filter(H=>!H.disabled).every(H=>R.includes(H.value)),Q=j&&(Y||c||d);return n.jsxs("div",{ref:S,className:w("relative",m),children:[n.jsxs("div",{className:w("flex","flex-wrap",E("sm","gap"),E("sm","p"),"border","border-line-default",J("md"),"min-h-10","focus-within:outline-none","focus-within:ring-2","focus-within:ring-offset-2","focus-within:border-line-brand","focus-within:ring-line-brand"),children:[I.map(H=>n.jsx(ws,{onRemove:()=>D(H.value),size:x==="sm"?"sm":x==="lg"?"lg":"md",children:H.label},H.value)),n.jsx("input",{ref:H=>{typeof v=="function"?v(H):v&&(v.current=H),M.current=H},type:"text",value:N,onChange:q,onKeyDown:B,onFocus:()=>C(!0),placeholder:R.length===0?i:"",disabled:u,className:w("flex-1","min-w-32","outline-none","bg-transparent",h)})]}),Q&&n.jsx(Ar,{ref:F,options:z.map(H=>P(T({},H),{icon:R.includes(H.value)?n.jsx(ns,{className:w("h-4","w-4","text-fg-brand")}):H.icon})),highlightedIndex:g,onSelect:W,loading:c,emptyMessage:d,containerRef:S,showSelectAll:p&&z.length>0,allSelected:X,onSelectAll:ae,onDeselectAll:se})]})});Va.displayName="MultiSelect";function id({value:e,defaultValue:t=0,max:r=5,size:s="md",variant:a="filled",readOnly:o=!1,allowHalf:i=!1,showValue:c=!1,onChange:u,onHover:d,className:f="",icon:p,emptyIcon:m}){const[h,x]=l.useState(t),[v,k]=l.useState(null),b=e!==void 0,j=v!=null?v:b?e:h,C={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},g=S=>{o||(b||x(S),u==null||u(S))},y=S=>{o||(k(S),d==null||d(S))},N=()=>{o||k(null)},_=S=>{const M=S+1,F=i&&j>=M-.5&&j<M,A=j>=M,R=w(C[s],he("base"),!o&&"cursor-pointer",A||F?"text-fg-warning":"text-fg-disabled"),I=p||n.jsx(jt,{className:R,fill:A?"currentColor":"none"}),L=m||n.jsx(jt,{className:R,fill:"none"});return n.jsx("span",{className:"relative inline-block",onClick:()=>g(M),onMouseEnter:()=>y(M),onMouseLeave:N,role:o?void 0:"button",tabIndex:o?void 0:0,"aria-label":o?void 0:`Rate ${M} out of ${r}`,onKeyDown:z=>{!o&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),g(M))},children:F?n.jsxs("span",{className:"relative inline-block",children:[n.jsx("span",{className:"absolute inset-0 overflow-hidden",style:{width:"50%"},children:a==="filled"?n.jsx(jt,{className:R,fill:"currentColor"}):I}),a==="filled"?n.jsx(jt,{className:R,fill:"none"}):L]}):A?a==="filled"?n.jsx(jt,{className:R,fill:"currentColor"}):I:a==="filled"?n.jsx(jt,{className:R,fill:"none"}):L},S)};return n.jsxs("div",{className:w("inline-flex","items-center",E("xs","gap"),f),children:[n.jsx("div",{className:w("flex","items-center"),role:o?"img":void 0,"aria-label":o?`Rating: ${j} out of ${r}`:void 0,children:Array.from({length:r},(S,M)=>_(M))}),c&&n.jsxs("span",{className:w(E("sm","ml"),ve("sm"),"text-fg-secondary"),children:[j.toFixed(i?1:0),"/",r]})]})}function ld({accept:e,multiple:t=!1,maxSize:r,maxFiles:s,onFilesChange:a,onFileRemove:o,showPreview:i=!0,showProgress:c=!1,disabled:u=!1,className:d="",label:f,description:p}){const[m,h]=l.useState([]),[x,v]=l.useState(!1),k=l.useRef(null),b=A=>{if(A===0)return"0 Bytes";const R=1024,I=["Bytes","KB","MB","GB"],L=Math.floor(Math.log(A)/Math.log(R));return Math.round(A/Math.pow(R,L)*100)/100+" "+I[L]},j=A=>r&&A.size>r?`File size exceeds ${b(r)}`:null,C=A=>{const R=Array.from(A),I=[];return R.forEach(L=>{const z=j(L),Y=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,q={file:L,id:Y,error:z,progress:c?0:void 0};if(i&&L.type.startsWith("image/")){const W=new FileReader;W.onload=ae=>{h(se=>se.map(D=>{var B;return D.id===Y?P(T({},D),{preview:(B=ae.target)==null?void 0:B.result}):D}))},W.readAsDataURL(L)}I.push(q)}),I},g=A=>{const R=t?[...m,...A]:A,I=s?R.slice(0,s):R;h(I),a==null||a(I)},y=A=>{if(A.preventDefault(),v(!1),u)return;const R=A.dataTransfer.files;if(R.length>0){const I=C(R);g(I)}},N=A=>{A.preventDefault(),u||v(!0)},_=A=>{A.preventDefault(),v(!1)},S=A=>{if(A.target.files&&A.target.files.length>0){const R=C(A.target.files);g(R)}k.current&&(k.current.value="")},M=A=>{const R=m.filter(I=>I.id!==A);h(R),a==null||a(R),o==null||o(A)},F=()=>{var A;u||(A=k.current)==null||A.click()};return n.jsxs("div",{className:w(E("lg","gap"),"flex","flex-col",d),children:[(f||p)&&n.jsxs("div",{children:[f&&n.jsx("label",{className:w("block",ve("sm"),Et("medium"),"text-fg-primary",E("xs","mb")),children:f}),p&&n.jsx("p",{className:w(ve("sm"),"text-fg-secondary"),children:p})]}),n.jsxs("div",{onDrop:y,onDragOver:N,onDragLeave:_,onClick:F,className:w("relative","border-2","border-dashed",x?"border-line-brand":"border-line-default",J("lg"),E("lg","p"),"text-center","cursor-pointer",he("base"),"focus:border-line-focus",u?"opacity-50 cursor-not-allowed":w("hover:border-line-strong","focus:outline-none","focus:ring-2","focus:ring-offset-2")),role:"button",tabIndex:u?-1:0,"aria-label":"Upload files","aria-disabled":u,children:[n.jsx("input",{ref:k,type:"file",accept:e,multiple:t,onChange:S,disabled:u,className:"hidden"}),n.jsxs("div",{className:w("flex","flex-col","items-center",E("sm","gap")),children:[n.jsx(hc,{className:w("h-8","w-8",x?"text-fg-brand":"text-fg-secondary")}),n.jsxs("div",{children:[n.jsx("span",{className:w(ve("sm"),Et("medium"),"text-fg-primary"),children:x?"Drop files here":"Click to upload or drag and drop"}),e&&n.jsxs("p",{className:w(ve("xs"),"text-fg-secondary",E("xs","mt")),children:["Accepted: ",e]}),r&&n.jsxs("p",{className:w(ve("xs"),"text-fg-secondary"),children:["Max size: ",b(r)]})]})]})]}),m.length>0&&n.jsx("div",{className:w("flex","flex-col",E("sm","gap")),children:m.map(A=>n.jsxs("div",{className:w("flex","items-center",E("md","gap"),E("base","p"),"border","border-line-default",J("md"),A.error?"bg-error-bg":"bg-surface-muted"),children:[i&&A.preview?n.jsx("img",{src:A.preview,alt:A.file.name,className:w("w-12","h-12","object-cover",J("md"))}):n.jsx(Xl,{className:w("h-8","w-8","text-fg-secondary")}),n.jsxs("div",{className:w("flex-1","min-w-0"),children:[n.jsx("p",{className:w(ve("sm"),Et("medium"),"text-fg-primary","truncate"),children:A.file.name}),n.jsx("p",{className:w(ve("xs"),"text-fg-secondary"),children:b(A.file.size)}),A.error&&n.jsxs("div",{className:w("flex","items-center",E("xs","gap"),E("xs","mt")),children:[n.jsx(bs,{className:w("h-3","w-3","text-fg-error")}),n.jsx("span",{className:w(ve("xs"),"text-fg-error"),children:A.error})]}),c&&A.progress!==void 0&&n.jsx("div",{className:w(E("sm","mt")),children:n.jsx(vs,{value:A.progress,size:"sm"})})]}),!A.error&&!c&&n.jsx(dr,{className:w("h-5","w-5","text-fg-success")}),n.jsx(Z,{variant:"ghost",size:"sm",onClick:R=>{R.stopPropagation(),M(A.id)},className:"h-auto p-1","aria-label":`Remove ${A.file.name}`,children:n.jsx(we,{className:"h-4 w-4"})})]},A.id))})]})}function Es({trigger:e,children:t,open:r,defaultOpen:s=!1,onOpenChange:a,placement:o="bottom",showCloseButton:i=!1,title:c,closeOnClickOutside:u=!0,closeOnEscape:d=!0,className:f="",triggerClassName:p="",contentClassName:m=""}){const[h,x]=l.useState(s),v=l.useRef(null),k=l.useRef(null),[b,j]=l.useState({top:0,left:0}),C=r!==void 0,g=C?r:h,y=l.useCallback(()=>{if(!v.current||!k.current)return;const M=v.current.getBoundingClientRect(),F=k.current.getBoundingClientRect(),A=window.scrollY,R=window.scrollX;let I=0,L=0;o.startsWith("top")?(I=M.top+A-F.height-8,o==="top-start"?L=M.left+R:o==="top-end"?L=M.right+R-F.width:L=M.left+R+(M.width-F.width)/2):o.startsWith("bottom")?(I=M.bottom+A+8,o==="bottom-start"?L=M.left+R:o==="bottom-end"?L=M.right+R-F.width:L=M.left+R+(M.width-F.width)/2):o.startsWith("left")?(L=M.left+R-F.width-8,o==="left-start"?I=M.top+A:o==="left-end"?I=M.bottom+A-F.height:I=M.top+A+(M.height-F.height)/2):o.startsWith("right")&&(L=M.right+R+8,o==="right-start"?I=M.top+A:o==="right-end"?I=M.bottom+A-F.height:I=M.top+A+(M.height-F.height)/2);const z=8;I=Math.max(z,Math.min(I,window.innerHeight+A-F.height-z)),L=Math.max(z,Math.min(L,window.innerWidth+R-F.width-z)),j({top:I,left:L})},[o]);l.useEffect(()=>{if(g){y();const M=()=>y(),F=()=>y();return window.addEventListener("resize",M),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",F,!0)}}},[g,o,y]),l.useEffect(()=>{g&&k.current&&setTimeout(y,0)},[g,y]);const N=l.useCallback(M=>{C||x(M),a==null||a(M)},[C,a]),_=l.useCallback(()=>{N(!1)},[N]);l.useEffect(()=>{if(g&&d){const M=F=>{F.key==="Escape"&&_()};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)}},[g,d,_]),l.useEffect(()=>{if(g&&u){const M=F=>{k.current&&v.current&&!k.current.contains(F.target)&&!v.current.contains(F.target)&&_()};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)}},[g,u,_]);const S=g?n.jsxs("div",{ref:k,className:`
238
238
  absolute
239
239
  ${ue("popover")}
240
240
  bg-surface-overlay