import{i as e}from"./chunk-aKtaBQYM.js";import{Ft as t,vt as n}from"./mui-BgU4WrXF.js";import{n as r}from"./MenuItem-BNgF7Xqv.js";import{r as i,t as a}from"./ReportFilter-CtusU-vs.js";import{t as o}from"./TableHead-DZPVxfXH.js";import{K as s,St as c,gt as l,lt as u,pt as d,vt as f,w as p,wt as m,xt as h}from"./index-bel1r0Sr.js";import{t as g}from"./ReportsMenu-CwjT__h7.js";import{t as _}from"./ColumnSelect-CwYQdTe9.js";import{t as v}from"./TableShimmer-CBuxG-nx.js";var y=e(t(),1),b=n(),x=[[`actionTime`,`positionServerTime`],[`address`,`positionAddress`],[`userId`,`settingsUser`],[`actionType`,`sharedActionType`],[`objectType`,`sharedQbjectType`],[`objectId`,`deviceIdentifier`]],S=new Map(x),C=()=>{let{classes:e}=i(),t=d(),[n,C]=l(`auditColumns`,[`actionTime`,`userId`,`actionType`,`objectType`]),[w,T]=(0,y.useState)([]),[E,D]=(0,y.useState)(!1),O=u(async({from:e,to:t})=>{D(!0);try{T(await(await p(`/api/audit?${new URLSearchParams({from:e,to:t}).toString()}`)).json())}finally{D(!1)}},[]);return(0,b.jsxs)(r,{menu:(0,b.jsx)(g,{}),breadcrumbs:[`reportTitle`,`reportAudit`],children:[(0,b.jsx)(`div`,{className:e.header,children:(0,b.jsx)(a,{onShow:O,deviceType:`none`,loading:E,children:(0,b.jsx)(_,{columns:n,setColumns:C,columnsArray:x})})}),(0,b.jsxs)(m,{children:[(0,b.jsx)(o,{children:(0,b.jsx)(f,{children:n.map(e=>(0,b.jsx)(h,{children:t(S.get(e))},e))})}),(0,b.jsx)(c,{children:E?(0,b.jsx)(v,{columns:n.length}):w.map(e=>(0,b.jsx)(f,{children:n.map(t=>(0,b.jsx)(h,{children:t===`actionTime`?s(e[t],`minutes`):e[t]},t))},e.id))})]})]})};export{C as default};