import{i as e}from"./chunk-aKtaBQYM.js";import{Ft as t,G as n,L as r,t as i,vt as a}from"./mui-BgU4WrXF.js";import{l as o,t as s}from"./IconButton-oialqkv3.js";import{t as c}from"./Menu-CRiQ3s6A.js";import{Dt as l,Tt as u,_t as d,m as f,p,pt as m,u as h}from"./index-bel1r0Sr.js";var g=e(t(),1),_=a(),v=r((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:r,onReload:i,customActions:a,readonly:b})=>{let x=n(),{classes:S}=y(),C=o(),w=m(),T=d(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)(l,{onClick:()=>M(e),children:e.title},e.key)),!b&&(0,_.jsxs)(_.Fragment,{children:[t&&(0,_.jsx)(l,{onClick:A,children:w(`sharedEdit`)}),(0,_.jsx)(l,{onClick:j,children:w(`sharedRemove`)})]})]})]}):(0,_.jsxs)(`div`,{className:S.row,children:[a&&a.map(e=>(0,_.jsx)(u,{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)(u,{title:w(`sharedEdit`),children:(0,_.jsx)(s,{size:`small`,onClick:A,children:(0,_.jsx)(f,{fontSize:`small`})})}),(0,_.jsx)(u,{title:w(`sharedRemove`),children:(0,_.jsx)(s,{size:`small`,onClick:j,children:(0,_.jsx)(p,{fontSize:`small`})})})]})]}),(0,_.jsx)(h,{style:{transform:`none`},open:O,endpoint:r,itemId:e,onResult:e=>{k(!1),e&&i()}})]})};export{b as t};