import{l as H,m as w,p as M,q as T,x as B,V as C,A as q,B as I,ap as K,d as W,o as p,J as c,c as A,h as N,M as u,N as z,D as s,w as $,f as j,E as G,G as J,L as f,K as O,F as Q}from"./index-D02r7Zsc.js";import{u as U}from"./useDefaults-DESCdb0p-CFLjYrdG.js";import{u as X}from"./useId-t29UARy6-BH5d2231.js";import{u as Y}from"./useShowHide-717t6y_D-BZTBbOpd.js";const le=H({inheritAttrs:!1,__name:"BCollapse",props:w({horizontal:{type:Boolean,default:!1},id:{default:void 0},isNav:{type:Boolean,default:!1},tag:{default:"div"},initialAnimation:{type:Boolean,default:!1},noAnimation:{type:Boolean,default:!1},noFade:{type:Boolean},lazy:{type:Boolean,default:!1},unmountLazy:{type:Boolean,default:!1},show:{type:Boolean,default:!1},transProps:{},visible:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:w(["hide","hide-prevented","hidden","show","show-prevented","shown","toggle","toggle-prevented","cancel","ok"],["update:modelValue"]),setup(v,{expose:F,emit:_}){const a=U(v,"BCollapse"),b=_,h=M(v,"modelValue"),t=X(()=>a.id,"collapse"),k=T("_element");let o=!1;const P=e=>{o=!0,requestAnimationFrame(()=>{a.horizontal?e.style.width=`${e.scrollWidth}px`:e.style.height=`${e.scrollHeight}px`})},V=e=>{o||(a.horizontal?e.style.width=`${e.scrollWidth}px`:e.style.height=`${e.scrollHeight}px`,e.offsetHeight)},x=e=>{requestAnimationFrame(()=>{a.horizontal?e.style.width="":e.style.height=""})},L=e=>{e.style.height="",e.style.width="",o=!1},R=e=>{e.style.height="",e.style.width="",o=!1},{showRef:l,renderRef:S,hide:i,show:n,toggle:r,isActive:m,computedNoAnimation:y,contentShowing:g,transitionProps:D}=Y(h,a,b,k,t,{transitionProps:{onBeforeLeave:V,onEnter:P,onLeave:x,onAfterEnter:L,onAfterLeave:R,enterToClass:"",leaveToClass:"",enterFromClass:"",leaveFromClass:"",enterActiveClass:"",leaveActiveClass:""}}),E=B(()=>({show:m.value,"navbar-collapse":a.isNav,"collapse-horizontal":a.horizontal})),d=B(()=>({toggle:r,show:n,hide:i,id:t.value,visible:l.value,active:m.value}));return F({hide:i,isNav:a.isNav,show:n,toggle:r,visible:C(l)}),q(K,{id:t,hide:i,show:n,toggle:r,visible:C(l),isNav:I(()=>a.isNav)}),(e,ee)=>(p(),W(Q,null,[c(e.$slots,"header",u(z(d.value))),s(S)||s(g)?(p(),A(O,f({key:0},s(D),{"enter-active-class":s(y)?"":"collapsing","leave-active-class":s(y)?"":"collapsing",appear:h.value||s(a).visible}),{default:$(()=>[j((p(),A(J(s(a).tag),f({id:s(t),ref:"_element",class:["collapse",E.value],"is-nav":s(a).isNav},e.$attrs),{default:$(()=>[s(g)?c(e.$slots,"default",u(f({key:0},d.value))):N("",!0)]),_:3},16,["id","class","is-nav"])),[[G,s(l)]])]),_:3},16,["enter-active-class","leave-active-class","appear"])):N("",!0),c(e.$slots,"footer",u(z(d.value)))],64))}});export{le as _};
