import{e as _,a7 as x,a9 as N,ab as T,aa as C,m as h,o as y,w as v,X as g,n as e,ac as q,ae as $,r as u,x as R,B as A,l as D,bC as F,b as I,a6 as M,C as H,aw as P,am as V}from"./BoB2h2qv.js";const[w,E]=T("CollapsibleRoot");var S=_({__name:"CollapsibleRoot",props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["update:open"],setup(l,{expose:i,emit:n}){const o=l,s=x(o,"open",n,{defaultValue:o.defaultOpen,passive:o.open===void 0}),{disabled:d,unmountOnHide:p}=N(o);return E({contentId:"",disabled:d,open:s,unmountOnHide:p,onOpenToggle:()=>{d.value||(s.value=!s.value)}}),i({open:s}),C(),(r,f)=>(y(),h(e(q),{as:r.as,"as-child":o.asChild,"data-state":e(s)?"open":"closed","data-disabled":e(d)?"":void 0},{default:v(()=>[g(r.$slots,"default",{open:e(s)})]),_:3},8,["as","as-child","data-state","data-disabled"]))}}),z=S,j=_({inheritAttrs:!1,__name:"CollapsibleContent",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["contentFound"],setup(l,{emit:i}){const n=l,o=i,t=w();t.contentId||=$(void 0,"reka-collapsible-content");const s=u(),{forwardRef:d,currentElement:p}=C(),r=u(0),f=u(0),B=R(()=>t.open.value),m=u(B.value),c=u();A(()=>[B.value,s.value?.present],async()=>{await V();const a=p.value;if(!a)return;c.value=c.value||{transitionDuration:a.style.transitionDuration,animationName:a.style.animationName},a.style.transitionDuration="0s",a.style.animationName="none";const b=a.getBoundingClientRect();f.value=b.height,r.value=b.width,m.value||(a.style.transitionDuration=c.value.transitionDuration,a.style.animationName=c.value.animationName)},{immediate:!0});const O=R(()=>m.value&&t.open.value);return D(()=>{requestAnimationFrame(()=>{m.value=!1})}),F(p,"beforematch",a=>{requestAnimationFrame(()=>{t.onOpenToggle(),o("contentFound")})}),(a,b)=>(y(),h(e(P),{ref_key:"presentRef",ref:s,present:a.forceMount||e(t).open.value,"force-mount":!0},{default:v(({present:k})=>[I(e(q),M(a.$attrs,{id:e(t).contentId,ref:e(d),"as-child":n.asChild,as:a.as,hidden:k?void 0:e(t).unmountOnHide.value?"":"until-found","data-state":O.value?void 0:e(t).open.value?"open":"closed","data-disabled":e(t).disabled?.value?"":void 0,style:{"--reka-collapsible-content-height":`${f.value}px`,"--reka-collapsible-content-width":`${r.value}px`}}),{default:v(()=>[!e(t).unmountOnHide.value||k?g(a.$slots,"default",{key:0}):H("v-if",!0)]),_:2},1040,["id","as-child","as","hidden","data-state","data-disabled","style"])]),_:3},8,["present"]))}}),G=j,L=_({__name:"CollapsibleTrigger",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(l){const i=l;C();const n=w();return(o,t)=>(y(),h(e(q),{type:o.as==="button"?"button":void 0,as:o.as,"as-child":i.asChild,"aria-controls":e(n).contentId,"aria-expanded":e(n).open.value,"data-state":e(n).open.value?"open":"closed","data-disabled":e(n).disabled?.value?"":void 0,disabled:e(n).disabled?.value,onClick:e(n).onOpenToggle},{default:v(()=>[g(o.$slots,"default")]),_:3},8,["type","as","as-child","aria-controls","aria-expanded","data-state","data-disabled","disabled","onClick"]))}}),J=L;export{z as C,G as a,J as b};
