import{r as n}from"./react-vendor-DlVMRrtE.js";import{b as O,d as T,j as c,a1 as S,P as g,g as D,e as M,u as $,i as L}from"./ui-vendor-DUfjpZ4p.js";var f="Collapsible",[k,z]=O(f),[F,v]=k(f),j=n.forwardRef((e,s)=>{const{__scopeCollapsible:r,open:a,defaultOpen:t,disabled:l,onOpenChange:i,...C}=e,[p,d]=T({prop:a,defaultProp:t??!1,onChange:i,caller:f});return c.jsx(F,{scope:r,disabled:l,contentId:S(),open:p,onOpenToggle:n.useCallback(()=>d(b=>!b),[d]),children:c.jsx(g.div,{"data-state":R(p),"data-disabled":l?"":void 0,...C,ref:s})})});j.displayName=f;var w="CollapsibleTrigger",A=n.forwardRef((e,s)=>{const{__scopeCollapsible:r,...a}=e,t=v(w,r);return c.jsx(g.button,{type:"button","aria-controls":t.contentId,"aria-expanded":t.open||!1,"data-state":R(t.open),"data-disabled":t.disabled?"":void 0,disabled:t.disabled,...a,ref:s,onClick:D(e.onClick,t.onOpenToggle)})});A.displayName=w;var x="CollapsibleContent",I=n.forwardRef((e,s)=>{const{forceMount:r,...a}=e,t=v(x,e.__scopeCollapsible);return c.jsx(M,{present:r||t.open,children:({present:l})=>c.jsx(B,{...a,ref:s,present:l})})});I.displayName=x;var B=n.forwardRef((e,s)=>{const{__scopeCollapsible:r,present:a,children:t,...l}=e,i=v(x,r),[C,p]=n.useState(a),d=n.useRef(null),b=$(s,d),h=n.useRef(0),y=h.current,P=n.useRef(0),N=P.current,m=i.open||C,E=n.useRef(m),u=n.useRef(void 0);return n.useEffect(()=>{const o=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(o)},[]),L(()=>{const o=d.current;if(o){u.current=u.current||{transitionDuration:o.style.transitionDuration,animationName:o.style.animationName},o.style.transitionDuration="0s",o.style.animationName="none";const _=o.getBoundingClientRect();h.current=_.height,P.current=_.width,E.current||(o.style.transitionDuration=u.current.transitionDuration,o.style.animationName=u.current.animationName),p(a)}},[i.open,a]),c.jsx(g.div,{"data-state":R(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!m,...l,ref:b,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":N?`${N}px`:void 0,...e.style},children:m&&t})});function R(e){return e?"open":"closed"}var G=j;const J=G,K=A,Q=I;export{J as C,K as a,Q as b};
