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