import{i as e}from"./chunk-aKtaBQYM.js";import{N as t,Vt as n,Y as r,t as i,wt as a}from"./mui-B6lh3XSP.js";import{l as o,t as s}from"./IconButton-BEBOUWhl.js";import{t as c}from"./Menu-H5c4_g_O.js";import{Ct as l,Ft as u,jt as d,m as f,p,u as m,yt as h}from"./index-KVuxnkWj.js";var g=e(n(),1),_=a(),v=t((0,_.jsx)(`path`,{d:`M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreVert`),y=i()(()=>({row:{display:`flex`}})),b=({itemId:e,editPath:t,endpoint:n,onReload:i,customActions:a,readonly:b})=>{let x=r(),{classes:S}=y(),C=o(),w=h(),T=l(x.breakpoints.down(`sm`)),[E,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(!1),A=()=>{C(`${t}/${e}`),D(null)},j=()=>{k(!0),D(null)},M=t=>{t.handler(e),D(null)};return(0,_.jsxs)(_.Fragment,{children:[T?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{size:`small`,onClick:e=>D(e.currentTarget),children:(0,_.jsx)(v,{fontSize:`small`})}),(0,_.jsxs)(c,{open:!!E,anchorEl:E,onClose:()=>D(null),children:[a&&a.map(e=>(0,_.jsx)(u,{onClick:()=>M(e),children:e.title},e.key)),!b&&(0,_.jsxs)(_.Fragment,{children:[t&&(0,_.jsx)(u,{onClick:A,children:w(`sharedEdit`)}),(0,_.jsx)(u,{onClick:j,children:w(`sharedRemove`)})]})]})]}):(0,_.jsxs)(`div`,{className:S.row,children:[a&&a.map(e=>(0,_.jsx)(d,{title:e.title,children:(0,_.jsx)(s,{size:`small`,onClick:()=>M(e),children:e.icon})},e.key)),!b&&(0,_.jsxs)(_.Fragment,{children:[t&&(0,_.jsx)(d,{title:w(`sharedEdit`),children:(0,_.jsx)(s,{size:`small`,onClick:A,children:(0,_.jsx)(f,{fontSize:`small`})})}),(0,_.jsx)(d,{title:w(`sharedRemove`),children:(0,_.jsx)(s,{size:`small`,onClick:j,children:(0,_.jsx)(p,{fontSize:`small`})})})]})]}),(0,_.jsx)(m,{style:{transform:`none`},open:O,endpoint:n,itemId:e,onResult:e=>{k(!1),e&&i()}})]})};export{b as t};