import{b as e,d as a,P as t,j as o,a as n}from"./DvCYfmwJ.js";import{c as l,u as s,P as d,b as i}from"./bONHYI4V.js";import{g as u,M as r,C as p,o as c,w as m,N as v,j as f,r as b,m as y,K as h,p as C,b as _,Q as g,q as B,P as q}from"./nMEF9Rpo.js";const[O,$]=l("CollapsibleRoot");var k=u({__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(o,{expose:n,emit:l}){const s=o,d=e(s,"open",l,{defaultValue:s.defaultOpen,passive:void 0===s.open}),{disabled:i,unmountOnHide:u}=r(s);return $({contentId:"",disabled:i,open:d,unmountOnHide:u,onOpenToggle:()=>{i.value||(d.value=!d.value)}}),n({open:d}),a(),(e,a)=>(c(),p(f(t),{as:e.as,"as-child":s.asChild,"data-state":f(d)?"open":"closed","data-disabled":f(i)?"":void 0},{default:m(()=>[v(e.$slots,"default",{open:f(d)})]),_:3},8,["as","as-child","data-state","data-disabled"]))}}),w=u({inheritAttrs:!1,__name:"CollapsibleContent",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["contentFound"],setup(e,{emit:n}){const l=e,i=n,u=O();u.contentId||=s(void 0,"reka-collapsible-content");const r=b(),{forwardRef:$,currentElement:k}=a(),w=b(0),x=b(0),H=y(()=>u.open.value),N=b(H.value),j=b();h(()=>[H.value,r.value?.present],async()=>{await q();const e=k.value;if(!e)return;j.value=j.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const a=e.getBoundingClientRect();x.value=a.height,w.value=a.width,N.value||(e.style.transitionDuration=j.value.transitionDuration,e.style.animationName=j.value.animationName)},{immediate:!0});const D=y(()=>N.value&&u.open.value);return C(()=>{requestAnimationFrame(()=>{N.value=!1})}),o(k,"beforematch",e=>{requestAnimationFrame(()=>{u.onOpenToggle(),i("contentFound")})}),(e,a)=>(c(),p(f(d),{ref_key:"presentRef",ref:r,present:e.forceMount||f(u).open.value,"force-mount":!0},{default:m(({present:a})=>[_(f(t),g(e.$attrs,{id:f(u).contentId,ref:f($),"as-child":l.asChild,as:e.as,hidden:a?void 0:f(u).unmountOnHide.value?"":"until-found","data-state":D.value?void 0:f(u).open.value?"open":"closed","data-disabled":f(u).disabled?.value?"":void 0,style:{"--reka-collapsible-content-height":`${x.value}px`,"--reka-collapsible-content-width":`${w.value}px`}}),{default:m(()=>[!f(u).unmountOnHide.value||a?v(e.$slots,"default",{key:0}):B("v-if",!0)]),_:2},1040,["id","as-child","as","hidden","data-state","data-disabled","style"])]),_:3},8,["present"]))}}),x=u({__name:"CollapsibleTrigger",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(e){const o=e;a();const n=O();return(e,a)=>(c(),p(f(t),{type:"button"===e.as?"button":void 0,as:e.as,"as-child":o.asChild,"aria-controls":f(n).contentId,"aria-expanded":f(n).open.value,"data-state":f(n).open.value?"open":"closed","data-disabled":f(n).disabled?.value?"":void 0,disabled:f(n).disabled?.value,onClick:f(n).onOpenToggle},{default:m(()=>[v(e.$slots,"default")]),_:3},8,["type","as","as-child","aria-controls","aria-expanded","data-state","data-disabled","disabled","onClick"]))}});const H=n("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),N=u({__name:"Collapsible",props:{defaultOpen:{type:Boolean},open:{type:Boolean},disabled:{type:Boolean},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["update:open"],setup(e,{emit:a}){const t=i(e,a);return(e,a)=>(c(),p(f(k),g({"data-slot":"collapsible"},f(t)),{default:m(({open:a})=>[v(e.$slots,"default",{open:a})]),_:3},16))}}),j=u({__name:"CollapsibleContent",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(e){const a=e;return(e,t)=>(c(),p(f(w),g({"data-slot":"collapsible-content"},a),{default:m(()=>[v(e.$slots,"default")]),_:3},16))}}),D=u({__name:"CollapsibleTrigger",props:{asChild:{type:Boolean},as:{}},setup(e){const a=e;return(e,t)=>(c(),p(f(x),g({"data-slot":"collapsible-trigger"},a),{default:m(()=>[v(e.$slots,"default")]),_:3},16))}});export{H as C,D as _,j as a,N as b};
