(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58346],{14577:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},35484:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},54722:(e,s,t)=>{Promise.resolve().then(t.bind(t,96218))},75796:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]])},96218:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>p});var a=t(95155),i=t(35484),n=t(11012),l=t(14577),c=t(92571),r=t(31966),d=t(75796),x=t(65738),h=t(73321),o=t(12115),m=t(1550),u=t(64233),j=t(89239),f=t(42763);function p(){(0,m.si)("Inbox",{hideActions:!0});let{id:e}=(0,h.useParams)(),s=(0,h.useRouter)(),[t,p]=(0,o.useState)(null),[y,k]=(0,o.useState)(!0),[N,v]=(0,o.useState)(!1),b=(0,o.useCallback)(async()=>{let s=await fetch("/api/inbox");if(s.ok){let t=((await s.json()).messages||[]).find(s=>s.id===e);p(t||null),t&&!t.read&&await fetch(`/api/inbox/${t.id}`,{method:"PATCH"})}k(!1)},[e]);(0,o.useEffect)(()=>{b()},[b]);let g=async()=>{await fetch(`/api/inbox/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({read:!1})}),s.push("/inbox")},w=async()=>{await fetch(`/api/inbox/${e}`,{method:"DELETE"}),s.push("/inbox")};return y?(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)(c.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):t?(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:()=>s.push("/inbox"),children:[(0,a.jsx)(r.A,{className:"h-4 w-4 mr-1"}),"Back"]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:g,children:[(0,a.jsx)(d.A,{className:"h-4 w-4 mr-1"}),"Mark unread"]}),(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>v(!0),children:[(0,a.jsx)(x.A,{className:"h-4 w-4 mr-1"}),"Delete"]})]})]}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[function(e){switch(e){case"error":return(0,a.jsx)(i.A,{className:"h-5 w-5 text-destructive shrink-0"});case"warning":return(0,a.jsx)(n.A,{className:"h-5 w-5 text-yellow-500 shrink-0"});default:return(0,a.jsx)(l.A,{className:"h-5 w-5 text-blue-500 shrink-0"})}}(t.priority),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-lg font-semibold",children:t.title}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-xs text-muted-foreground",children:[t.jobName&&(0,a.jsx)("span",{children:t.jobName}),(0,a.jsx)("span",{children:new Date(t.createdAt).toLocaleString()})]})]})]}),(0,a.jsx)("div",{className:"border-t pt-4",children:(0,a.jsx)(u.Y,{content:t.body,variant:"full"})}),(0,a.jsx)(f.lG,{open:N,onOpenChange:()=>v(!1),children:(0,a.jsxs)(f.Cf,{children:[(0,a.jsx)(f.c7,{children:(0,a.jsx)(f.L3,{children:"Delete Message"})}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this message? This cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(j.$,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),(0,a.jsx)(j.$,{variant:"destructive",onClick:w,children:"Delete"})]})]})})]}):(0,a.jsxs)("div",{className:"flex-1 p-4",children:[(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",onClick:()=>s.push("/inbox"),children:[(0,a.jsx)(r.A,{className:"h-4 w-4 mr-1"}),"Back"]}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-8 text-center",children:"Message not found."})]})}}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=54722)),_N_E=e.O()}]);