import{dK as B,r as o,R as d,j as e,bC as c,b7 as C,dL as A,bA as E,dM as I,bt as u,dN as L}from"./index-Y-QvttbJ.js";import{B as z}from"./ButtonGroup-CHbmdfp0.js";function P({...r}){const{size:p="medium",color:i="primary",menu:a=[],children:s=null,variant:m="contained",onClick:x=B,menuButtonProps:f={},...h}=r,[j,l]=o.useState(!1),n=o.useRef(null),g=Array.isArray(a)?a.map((t,k)=>o.isValidElement(t)?t:o.createElement(d,{...t,key:k})):a,y=()=>{l(t=>!t)},M=t=>{n.current&&n.current.contains(t.target)||l(!1)},b=t=>{t.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(v,{variant:m,size:p,color:i,ref:n,...h,children:[typeof s=="function"?s():e.jsx(c,{onClick:x,color:i,children:s}),e.jsx(c,{onClick:y,color:i,...f,"aria-label":"more functions",children:e.jsx(C,{})})]}),e.jsx(w,{open:j,anchorEl:n.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(A,{children:e.jsx(E,{onClickAway:M,children:e.jsx(I,{onClick:b,children:g})})})})]})}P.Item=d;const v=u(z)`
  > .MuiButtonBase-root:last-of-type {
    min-width: 2em;
    padding-left: 0;
    padding-right: 0;
  }
`,w=u(L)`
  z-index: ${r=>r.theme.zIndex.tooltip};
  .MuiList-root {
    padding: 4px 0;
  }
  .MuiListItem-root {
    padding-top: 4px;
    padding-bottom: 4px;
  }
`;export{P as v};
