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