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