import{d as q,aj as T,al as A,ak as F,af as B,c as f,o as v,w as p,ag as m,m as e,ai as O,v as c,g,j as H,aQ as D,aO as E,aY as I,a as R,ah as x,l as $,b3 as M,ao as V,aq as j,ar as S,as as z,at as w,E as L}from"./Dk4AzF7j.js";import{h as Q}from"./D7D5X_-3.js";const[N,U]=T("CollapsibleRoot");var Y=q({__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(i,{expose:u,emit:a}){const o=i,l=A(o,"open",a,{defaultValue:o.defaultOpen,passive:o.open===void 0}),{disabled:r,unmountOnHide:d}=F(o);return U({contentId:"",disabled:r,open:l,unmountOnHide:d,onOpenToggle:()=>{r.value||(l.value=!l.value)}}),u({open:l}),B(),(n,_)=>(v(),f(e(O),{as:n.as,"as-child":o.asChild,"data-state":e(l)?"open":"closed","data-disabled":e(r)?"":void 0},{default:p(()=>[m(n.$slots,"default",{open:e(l)})]),_:3},8,["as","as-child","data-state","data-disabled"]))}}),G=Y,J=q({inheritAttrs:!1,__name:"CollapsibleContent",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["contentFound"],setup(i,{emit:u}){const a=i,o=u,t=N();t.contentId||=Q(void 0,"reka-collapsible-content");const l=c(),{forwardRef:r,currentElement:d}=B(),n=c(0),_=c(0),b=g(()=>t.open.value),y=c(b.value),h=c();H(()=>[b.value,l.value?.present],async()=>{await D();const s=d.value;if(!s)return;h.value=h.value||{transitionDuration:s.style.transitionDuration,animationName:s.style.animationName},s.style.transitionDuration="0s",s.style.animationName="none";const C=s.getBoundingClientRect();_.value=C.height,n.value=C.width,y.value||(s.style.transitionDuration=h.value.transitionDuration,s.style.animationName=h.value.animationName)},{immediate:!0});const P=g(()=>y.value&&t.open.value);return E(()=>{requestAnimationFrame(()=>{y.value=!1})}),I(d,"beforematch",s=>{requestAnimationFrame(()=>{t.onOpenToggle(),o("contentFound")})}),(s,C)=>(v(),f(e(M),{ref_key:"presentRef",ref:l,present:s.forceMount||e(t).open.value,"force-mount":!0},{default:p(({present:k})=>[R(e(O),x(s.$attrs,{id:e(t).contentId,ref:e(r),"as-child":a.asChild,as:s.as,hidden:k?void 0:e(t).unmountOnHide.value?"":"until-found","data-state":P.value?void 0:e(t).open.value?"open":"closed","data-disabled":e(t).disabled?.value?"":void 0,style:{"--reka-collapsible-content-height":`${_.value}px`,"--reka-collapsible-content-width":`${n.value}px`}}),{default:p(()=>[!e(t).unmountOnHide.value||k?m(s.$slots,"default",{key:0}):$("v-if",!0)]),_:2},1040,["id","as-child","as","hidden","data-state","data-disabled","style"])]),_:3},8,["present"]))}}),K=J,W=q({__name:"CollapsibleTrigger",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(i){const u=i;B();const a=N();return(o,t)=>(v(),f(e(O),{type:o.as==="button"?"button":void 0,as:o.as,"as-child":u.asChild,"aria-controls":e(a).contentId,"aria-expanded":e(a).open.value,"data-state":e(a).open.value?"open":"closed","data-disabled":e(a).disabled?.value?"":void 0,disabled:e(a).disabled?.value,onClick:e(a).onOpenToggle},{default:p(()=>[m(o.$slots,"default")]),_:3},8,["type","as","as-child","aria-controls","aria-expanded","data-state","data-disabled","disabled","onClick"]))}}),X=W;const Z={slots:{root:"",content:"data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] overflow-hidden"}},te={__name:"UCollapsible",props:{as:{type:null,required:!1},class:{type:null,required:!1},ui:{type:null,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:["update:open"],setup(i,{emit:u}){const a=i,o=u,t=V(),l=j(),r=S(z(a,"as","defaultOpen","open","disabled","unmountOnHide"),o),d=g(()=>w({extend:w(Z),...l.ui?.collapsible||{}})());return(n,_)=>(v(),f(e(G),x(e(r),{class:d.value.root({class:[a.ui?.root,a.class]})}),{default:p(({open:b})=>[t.default?(v(),f(e(X),{key:0,"as-child":""},{default:p(()=>[m(n.$slots,"default",{open:b})]),_:2},1024)):$("",!0),R(e(K),{class:L(d.value.content({class:a.ui?.content}))},{default:p(()=>[m(n.$slots,"content")]),_:3},8,["class"])]),_:3},16,["class"]))}};export{te as _};
