import{j as s}from"./vendor-mui-69397583.js";import{r as c}from"./vendor-react-ece1c85f.js";import{Z as h}from"./index-c62ac197.js";import{A as f}from"./AdaptableCard-df7695d6.js";import{o as p}from"./DigitalSignature-fff42e33.js";import{f as v}from"./DateDifference-e47d2393.js";const u=({documentId:r})=>{const[a,x]=c.useState([]),[l,o]=c.useState(!0);return c.useEffect(()=>{if(!r)return;(async()=>{var i,d,m,n;try{o(!0);const e=await p(r);(d=(i=e==null?void 0:e.data)==null?void 0:i.data)!=null&&d.$values&&x(((n=(m=e==null?void 0:e.data)==null?void 0:m.data)==null?void 0:n.$values)??[])}catch(e){console.error("Failed to load activity logs",e)}finally{o(!1)}})()},[r]),s.jsx(f,{className:"shadow-sm rounded-lg activity-card-header",children:s.jsx("div",{className:"p-4",children:s.jsxs("div",{className:"relative pl-4",children:[l&&s.jsx("p",{className:"text-white text-sm",children:"Loading activity..."}),!l&&a.length===0&&s.jsx("p",{className:"text-white text-sm",children:"No activity found."}),s.jsx("div",{className:"space-y-3",children:a==null?void 0:a.map(t=>{var i;return s.jsxs("div",{className:"ticket-activity",children:[s.jsx("div",{className:"t-activity absolute -left-4 top-0 w-3 h-3 rounded-full bg-custom-500 ring-2 ring-white"}),s.jsxs("div",{className:"pl-2",children:[s.jsxs("div",{className:"text-sm text-white",children:[s.jsx("span",{className:"font-bold",children:!(t!=null&&t.partyName)&&(t==null?void 0:t.createdByUserName)})," ",t==null?void 0:t.details]}),s.jsxs("div",{className:"text-xs text-white mt-1",children:[v(t==null?void 0:t.timestamp)," (",(i=h.utc(t==null?void 0:t.timestamp))==null?void 0:i.local().format("DD MMM YY h:mm A"),")"]})]})]},t.id)})})]})})})},L=u;export{L as A};
