import{as as C,ac as T,j as e,c as n,A as W,a$ as X,r as c,b0 as Y,aN as Z,y as _}from"./main-TIUJvpaR.js";const P={variants:{open:{height:"auto",visibility:"visible",transitionEnd:{overflow:"auto"}},closed:{height:0,overflow:"hidden",transitionEnd:{visibility:"hidden"}}},transition:{type:"tween",duration:.2}},ee=C.forwardRef(({variant:a="default",mode:h="single",children:b,className:t,isLazy:w,gap:N="space-y-10",size:y,...u},m)=>{const[p,r]=T(u.expandedValues,u.defaultExpandedValues||[],u.onExpandedChange),j=C.Children.count(b);return e.jsx("div",{className:n(a==="outline"&&N,t),ref:m,role:"presentation",children:e.jsx(W,{children:e.jsx(X,{children:C.Children.map(b,(o,d)=>c.isValidElement(o)?c.cloneElement(o,{key:o.key||d,value:o.props.value||d,isFirst:d===0,isLast:d===j-1,mode:h,variant:a,expandedValues:p,setExpandedValues:r,isLazy:w,size:y}):null)})})})});function se(a){var z;const{children:h,label:b,disabled:t,bodyClassName:w,className:N,bodyPadding:y="p-16",labelClassName:u,fontClassName:m,buttonPadding:p,startIcon:r,startIconColor:j="text-muted",description:o,descriptionClassName:d="text-xs text-muted",endAppend:g,chevronPosition:k="right",isFirst:D,mode:F,isLazy:H,size:V,variant:l,footerContent:K,onHeaderMouseEnter:O,onHeaderMouseLeave:U,onOpen:E,ref:q}=a,f=a.expandedValues||[],x=a.value||0,$=a.setExpandedValues||(()=>{}),B=c.useRef(null),i=!t&&f.includes(x),I=c.useRef(!1);i&&(I.current=!0);const s=Y(),A=c.useId(),G=`${A}-button`,J=`${A}-panel`,Q=v=>{switch(v.key){case"ArrowDown":s==null||s.focusNext();break;case"ArrowUp":s==null||s.focusPrevious();break;case"Home":s==null||s.focusFirst();break;case"End":s==null||s.focusLast();break}},S=()=>{const v=f.indexOf(x);if(v>-1){const L=[...f];L.splice(v,1),$(L);return}$(F==="single"?[x]:[...f,x]),E==null||E()},R=e.jsx("div",{children:e.jsx(Z,{"aria-hidden":"true",size:"md",className:n(t?"text-disabled":"text-muted",i&&"rotate-180 transition-transform")})});return e.jsxs("div",{"data-value":x,ref:q,className:n("transition-button",l==="default"&&"border-b",l==="outline"&&"rounded-panel border",l==="outline"&&i&&"border-divider-darker shadow",t&&"text-disabled",N),children:[e.jsxs("h3",{className:n("flex w-full items-center justify-between",t&&"pointer-events-none",D&&l==="default"&&"border-t",i&&l!=="minimal"&&V!=="lg"?"border-b":"border-b border-b-transparent",l==="outline"?i?"rounded-panel-t":"rounded-panel":void 0),onMouseEnter:O,onMouseLeave:U,children:[e.jsxs("button",{disabled:t,"aria-expanded":i,id:G,"aria-controls":J,type:"button",ref:B,onKeyDown:Q,onClick:()=>{t||S()},className:n("flex min-w-0 flex-auto items-center gap-12 text-left outline-none transition-button hover:bg-hover focus-visible:bg-primary/focus",p||"px-16 py-12"),children:[k==="left"&&R,r&&c.cloneElement(r,{size:((z=r.props)==null?void 0:z.size)??"md",className:n(r.props.className,t?"text-disabled":j)}),e.jsxs("div",{className:"flex-auto overflow-hidden overflow-ellipsis",children:[e.jsx("div",{className:n(m||(V==="lg"?"text-md font-semibold":"text-sm"),u),children:b}),o&&e.jsx("div",{className:d,children:o})]}),k==="right"&&R]}),g&&e.jsx("div",{className:"flex-shrink-0 px-4 text-sm text-muted",children:g})]}),e.jsxs(_.div,{"aria-labelledby":A,role:"region",variants:P.variants,transition:P.transition,initial:!1,animate:i?"open":"closed",children:[e.jsx("div",{className:n(y,w),children:!H||I?h:null}),K]})]})}export{ee as A,se as a};
