import{a as e,b as a,j as r,E as o,P as n,f as t,d as s,u as i,h as l,c as d,A as c}from"./ui-vendor-CJlQk0Tq.js";import{r as p,R as u}from"./react-vendor-f6QdChhz.js";import{K as f,aq as m}from"./index-CUIxi1yy.js";var b="Collapsible",[h,x]=e(b),[v,w]=h(b),j=p.forwardRef((e,t)=>{const{__scopeCollapsible:s,open:i,defaultOpen:l,disabled:d,onOpenChange:c,...u}=e,[f=!1,m]=a({prop:i,defaultProp:l,onChange:c});return r.jsx(v,{scope:s,disabled:d,contentId:o(),open:f,onOpenToggle:p.useCallback(()=>m(e=>!e),[m]),children:r.jsx(n.div,{"data-state":C(f),"data-disabled":d?"":void 0,...u,ref:t})})});j.displayName=b;var g="CollapsibleTrigger",y=p.forwardRef((e,a)=>{const{__scopeCollapsible:o,...s}=e,i=w(g,o);return r.jsx(n.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":C(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...s,ref:a,onClick:t(e.onClick,i.onOpenToggle)})});y.displayName=g;var A="CollapsibleContent",_=p.forwardRef((e,a)=>{const{forceMount:o,...n}=e,t=w(A,e.__scopeCollapsible);return r.jsx(s,{present:o||t.open,children:({present:e})=>r.jsx(N,{...n,ref:a,present:e})})});_.displayName=A;var N=p.forwardRef((e,a)=>{const{__scopeCollapsible:o,present:t,children:s,...d}=e,c=w(A,o),[u,f]=p.useState(t),m=p.useRef(null),b=i(a,m),h=p.useRef(0),x=h.current,v=p.useRef(0),j=v.current,g=c.open||u,y=p.useRef(g),_=p.useRef();return p.useEffect(()=>{const e=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(e)},[]),l(()=>{const e=m.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const a=e.getBoundingClientRect();h.current=a.height,v.current=a.width,y.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),f(t)}},[c.open,t]),r.jsx(n.div,{"data-state":C(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!g,...d,ref:b,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":j?`${j}px`:void 0,...e.style},children:g&&s})});function C(e){return e?"open":"closed"}var R=j,I=y,k=_,D="Accordion",O=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[P,E,T]=d(D),[V,H]=e(D,[T,x]),K=x(),S=u.forwardRef((e,a)=>{const{type:o,...n}=e,t=n,s=n;return r.jsx(P.Provider,{scope:e.__scopeAccordion,children:"multiple"===o?r.jsx($,{...s,ref:a}):r.jsx(U,{...t,ref:a})})});S.displayName=D;var[q,z]=V(D),[F,L]=V(D,{collapsible:!1}),U=u.forwardRef((e,o)=>{const{value:n,defaultValue:t,onValueChange:s=()=>{},collapsible:i=!1,...l}=e,[d,c]=a({prop:n,defaultProp:t,onChange:s});return r.jsx(q,{scope:e.__scopeAccordion,value:d?[d]:[],onItemOpen:c,onItemClose:u.useCallback(()=>i&&c(""),[i,c]),children:r.jsx(F,{scope:e.__scopeAccordion,collapsible:i,children:r.jsx(G,{...l,ref:o})})})}),$=u.forwardRef((e,o)=>{const{value:n,defaultValue:t,onValueChange:s=()=>{},...i}=e,[l=[],d]=a({prop:n,defaultProp:t,onChange:s}),c=u.useCallback(e=>d((a=[])=>[...a,e]),[d]),p=u.useCallback(e=>d((a=[])=>a.filter(a=>a!==e)),[d]);return r.jsx(q,{scope:e.__scopeAccordion,value:l,onItemOpen:c,onItemClose:p,children:r.jsx(F,{scope:e.__scopeAccordion,collapsible:!0,children:r.jsx(G,{...i,ref:o})})})}),[B,M]=V(D),G=u.forwardRef((e,a)=>{const{__scopeAccordion:o,disabled:s,dir:l,orientation:d="vertical",...p}=e,f=u.useRef(null),m=i(f,a),b=E(o),h="ltr"===c(l),x=t(e.onKeyDown,e=>{var a;if(!O.includes(e.key))return;const r=e.target,o=b().filter(e=>{var a;return!(null==(a=e.ref.current)?void 0:a.disabled)}),n=o.findIndex(e=>e.ref.current===r),t=o.length;if(-1===n)return;e.preventDefault();let s=n;const i=t-1,l=()=>{s=n+1,s>i&&(s=0)},c=()=>{s=n-1,s<0&&(s=i)};switch(e.key){case"Home":s=0;break;case"End":s=i;break;case"ArrowRight":"horizontal"===d&&(h?l():c());break;case"ArrowDown":"vertical"===d&&l();break;case"ArrowLeft":"horizontal"===d&&(h?c():l());break;case"ArrowUp":"vertical"===d&&c()}null==(a=o[s%t].ref.current)||a.focus()});return r.jsx(B,{scope:o,disabled:s,direction:l,orientation:d,children:r.jsx(P.Slot,{scope:o,children:r.jsx(n.div,{...p,"data-orientation":d,ref:m,onKeyDown:s?void 0:x})})})}),J="AccordionItem",[Q,W]=V(J),X=u.forwardRef((e,a)=>{const{__scopeAccordion:n,value:t,...s}=e,i=M(J,n),l=z(J,n),d=K(n),c=o(),p=t&&l.value.includes(t)||!1,u=i.disabled||e.disabled;return r.jsx(Q,{scope:n,open:p,disabled:u,triggerId:c,children:r.jsx(R,{"data-orientation":i.orientation,"data-state":ne(p),...d,...s,ref:a,disabled:u,open:p,onOpenChange:e=>{e?l.onItemOpen(t):l.onItemClose(t)}})})});X.displayName=J;var Y="AccordionHeader",Z=u.forwardRef((e,a)=>{const{__scopeAccordion:o,...t}=e,s=M(D,o),i=W(Y,o);return r.jsx(n.h3,{"data-orientation":s.orientation,"data-state":ne(i.open),"data-disabled":i.disabled?"":void 0,...t,ref:a})});Z.displayName=Y;var ee="AccordionTrigger",ae=u.forwardRef((e,a)=>{const{__scopeAccordion:o,...n}=e,t=M(D,o),s=W(ee,o),i=L(ee,o),l=K(o);return r.jsx(P.ItemSlot,{scope:o,children:r.jsx(I,{"aria-disabled":s.open&&!i.collapsible||void 0,"data-orientation":t.orientation,id:s.triggerId,...l,...n,ref:a})})});ae.displayName=ee;var re="AccordionContent",oe=u.forwardRef((e,a)=>{const{__scopeAccordion:o,...n}=e,t=M(D,o),s=W(re,o),i=K(o);return r.jsx(k,{role:"region","aria-labelledby":s.triggerId,"data-orientation":t.orientation,...i,...n,ref:a,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function ne(e){return e?"open":"closed"}oe.displayName=re;var te=X,se=Z,ie=ae,le=oe;const de=S,ce=p.forwardRef(({className:e,...a},o)=>r.jsx(te,{ref:o,className:f("border-b",e),...a}));ce.displayName="AccordionItem";const pe=p.forwardRef(({className:e,children:a,...o},n)=>r.jsx(se,{className:"flex",children:r.jsxs(ie,{ref:n,className:f("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...o,children:[a,r.jsx(m,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));pe.displayName=ie.displayName;const ue=p.forwardRef(({className:e,children:a,...o},n)=>r.jsx(le,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...o,children:r.jsx("div",{className:f("pb-4 pt-0",e),children:a})}));ue.displayName=le.displayName;export{de as A,ce as a,pe as b,ue as c};