import{i as e}from"./chunk-aKtaBQYM.js";import{Vt as t,wt as n}from"./mui-B6lh3XSP.js";import{n as r}from"./MenuItem-HQNtf0LG.js";import{r as i,t as a}from"./ReportFilter-DWQ_hjet.js";import{t as o}from"./TableHead-_KJlbpnj.js";import{At as s,Dt as c,Ot as l,Q as u,St as d,ht as f,w as p,wt as m,yt as h}from"./index-KVuxnkWj.js";import{t as g}from"./ReportsMenu-XWwKkI0p.js";import{t as _}from"./ColumnSelect-BAx72xpb.js";import{t as v}from"./TableShimmer-f7Cf4NTV.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=h(),[n,C]=d(`auditColumns`,[`actionTime`,`userId`,`actionType`,`objectType`]),[w,T]=(0,y.useState)([]),[E,D]=(0,y.useState)(!1),O=f(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)(s,{children:[(0,b.jsx)(o,{children:(0,b.jsx)(m,{children:n.map(e=>(0,b.jsx)(c,{children:t(S.get(e))},e))})}),(0,b.jsx)(l,{children:E?(0,b.jsx)(v,{columns:n.length}):w.map(e=>(0,b.jsx)(m,{children:n.map(t=>(0,b.jsx)(c,{children:t===`actionTime`?u(e[t],`minutes`):e[t]},t))},e.id))})]})]})};export{C as default};