import{aP as A,ar as h,b as g,aQ as j,j as t,G as p,ah as _,ao as f,aR as T,y as N,i as x,r as I,H as m,aG as y}from"./index-n-59FgrC.js";var V=1/0;function D(e,a){return A(h(e,a),V)}const w="_comment_ef7yj_1",G="_copy_ef7yj_9",O="_message_ef7yj_47",b="_author_ef7yj_64",k="_action_ef7yj_72",v="_edit_ef7yj_79",J="_time_ef7yj_86",u={comment:w,copy:G,message:O,author:b,action:k,edit:v,time:J},C=({activity:e,description:a,actions:r})=>{var i;const{t:d}=g(),{formatDate:o}=j();return t.jsxs(p,{gap:14,align:"center",children:[t.jsxs(p,{gap:4,children:[t.jsx("p",{className:u.author,children:(i=e.Author)==null?void 0:i.Name}),e.Updated&&t.jsx("p",{className:u.edit,children:d("activities.edit")}),a&&t.jsxs("p",{className:u.action,children:[a.action," ",t.jsx("b",{children:a.predicate})]})]}),t.jsx("p",{className:u.time,children:e.Timestamp&&o(e.Timestamp,{useTimezone:!0,format:"longWithTime"})}),a&&a.type&&t.jsx(_,{color:"gray.5",size:"sm",radius:"sm",children:a.type}),r]})},F=(e,a)=>{const{data:r,isLoading:d}=f.useGetActivitiesQuery({taskId:e,types:a}),{data:o,isLoading:i}=T.useGetByIdQuery({ids:N(D(r,n=>n.Type===y.IActivityType.AssignTask?[n.AuthorId,n.Json.Changes.map(s=>[...Array.isArray(s.OldValue)?s.OldValue:[s.OldValue],...Array.isArray(s.NewValue)?s.NewValue:[s.NewValue]])]:[n.AuthorId]).filter(x))});return{data:I.useMemo(()=>{const n=s=>(Array.isArray(s)?s:s?[s]:[]).map(l=>m(o,["Id",l])).filter(Boolean);return(r==null?void 0:r.map(s=>({...s,Author:m(o,["Id",s.AuthorId]),...s.Type===y.IActivityType.AssignTask?{Json:{...s.Json,Changes:s.Json.Changes.map(c=>({...c,OldValue:n(c.OldValue),NewValue:n(c.NewValue)}))}}:{}})))||[]},[r,o]),isLoading:d||i}};export{C as A,u as s,F as u};
