import{M as T,N as k,Q as _,R as V,ax as E,f as b,ay as z,X as L,W as B,r as C,V as $,l as P,az as A,$ as D,aA as S,p as I,x as H,z as M,S as j,a1 as K,aB as Q,aC as W}from"./index-BV0H45HW.js";import{C as X,c as w}from"./index-B7M1Z4gS.js";const[N,Y]=_("collapse"),O=Symbol(N),q={border:k,accordion:Boolean,modelValue:{type:[String,Number,Array],default:""}};var F=T({name:N,props:q,emits:["change","update:modelValue"],setup(n,{emit:c,slots:l}){const{linkChildren:v,children:p}=V(O),o=e=>{c("change",e),c("update:modelValue",e)},m=(e,s)=>{const{accordion:r,modelValue:u}=n;o(r?e===u?"":e:s?u.concat(e):u.filter(h=>h!==e))},t=(e={})=>{if(n.accordion)return;typeof e=="boolean"&&(e={expanded:e});const{expanded:s,skipDisabled:r}=e,h=p.filter(d=>d.disabled&&r?d.expanded.value:s??!d.expanded.value).map(d=>d.itemName.value);o(h)},i=e=>{const{accordion:s,modelValue:r}=n;return s?r===e:r.includes(e)};return E({toggleAll:t}),v({toggle:m,isExpanded:i}),()=>{var e;return b("div",{class:[Y(),{[z]:n.border}]},[(e=l.default)==null?void 0:e.call(l)])}}});const ne=L(F),[G,x]=_("collapse-item"),J=["icon","title","value","label","right-icon"],U=B({},w,{name:j,isLink:k,disabled:Boolean,readonly:Boolean,lazyRender:k});var Z=T({name:G,props:U,setup(n,{slots:c}){const l=C(),v=C(),{parent:p,index:o}=$(O);if(!p)return;const m=P(()=>{var a;return(a=n.name)!=null?a:o.value}),t=P(()=>p.isExpanded(m.value)),i=C(t.value),e=A(()=>i.value||!n.lazyRender),s=()=>{t.value?l.value&&(l.value.style.height=""):i.value=!1};D(t,(a,g)=>{if(g===null)return;a&&(i.value=!0),(a?K:Q)(()=>{if(!v.value||!l.value)return;const{offsetHeight:f}=v.value;if(f){const R=`${f}px`;l.value.style.height=a?"0":R,W(()=>{l.value&&(l.value.style.height=a?R:"0")})}else s()})});const r=(a=!t.value)=>{p.toggle(m.value,a)},u=()=>{!n.disabled&&!n.readonly&&r()},h=()=>{const{border:a,disabled:g,readonly:y}=n,f=S(n,Object.keys(w));return y&&(f.isLink=!1),(g||y)&&(f.clickable=!1),b(X,I({role:"button",class:x("title",{disabled:g,expanded:t.value,borderless:!a}),"aria-expanded":String(t.value),onClick:u},f),S(c,J))},d=e(()=>{var a;return H(b("div",{ref:l,class:x("wrapper"),onTransitionend:s},[b("div",{ref:v,class:x("content")},[(a=c.default)==null?void 0:a.call(c)])]),[[M,i.value]])});return E({toggle:r,expanded:t,itemName:m}),()=>b("div",{class:[x({border:o.value&&n.border})]},[h(),d()])}});const le=L(Z);export{ne as C,le as a};
