import{j as a,ak as E,I as C,a$ as M,aR as P,a3 as T,M as b,aO as v,aP as z,am as A,W as u}from"./vendor-mui-core-CKKG_1TN.js";import{r as m}from"./vendor-react-CTtPmzVP.js";function B({actions:d=[],size:s="small",...f}){const[r,i]=m.useState(null),h=!!r,x=t=>{try{t.stopPropagation(),t.preventDefault()}catch{}i(t.currentTarget)},e=t=>{try{t.stopPropagation(),t.preventDefault()}catch{}i(null)};return a.jsxs(E,{...f,children:[a.jsx(C,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:x,size:s,children:a.jsx(M,{fontSize:s})}),a.jsx(P,{id:"actions-menu","data-cy":"actions-menu",anchorEl:r,keepMounted:!0,open:h,onClose:e,slotProps:{paper:{}},children:d.map((t,o)=>{if(typeof t=="function")return t({close:e});if(t.separator)return a.jsx(T,{},`separator-${o}`);const{icon:y,text:j,render:n,onClick:g,disabled:I=!1,tip:c,...k}=t,l=n&&typeof n=="function"?n({close:e}):m.createElement(b,{...k,disabled:I,dense:!0,onClick:async p=>{p.stopPropagation(),await g?.(p),e()},key:o,"data-cy":`actions-menu-${o}`},a.jsx(v,{style:{minWidth:24,marginRight:8},children:y}),a.jsx(z,{primary:j}));return c?a.jsx(A,{title:c,children:a.jsx("span",{children:l})}):l})})]})}B.propTypes={actions:u.array,size:u.oneOf(["small","medium","large"])};export{B as A};
