PageSourceSearch

https://www.novadub.ai/assets/admin.tickets-4Ig3rTSR.js

js novadub.ai collected 2026-10-05 12:20:43 UTC 21,681 bytes, 1 lines download raw bytes

1import{j as e}from"./framer-HErKpzqr.js";import{o as B,s as j,e as P,w as pe,b as Me,d as Oe,n as we,r as u}from"./forms-CZQ5ZoC7.js";import{q as w,H as Ee,I as De,w as q,x as K,y as Q,z as G,a3 as m,i as J,o as y,v as I}from"./index-goAf1m_s.js";import{u as Ve}from"./useDebounce-3GwZl4Aa.js";import{b as X,a as je,u as fe}from"./query-CwEQM3uK.js";import{g as We}from"./detail_GET.schema-e4tlud7p.js";import{B as ye}from"./Badge-CWnYTWdJ.js";import{aw as He,b2 as qe,d as Ke,X as Z,W as he,F as Qe,br as Ge,S as Je,T as Ze,cl as Xe,aZ as Ye}from"./icons-D7akwedy.js";import"./react-vendor-CaTDaD8A.js";import"./radix-ui-Bj1QnQJd.js";const et=B({limit:pe.number().int().positive().optional().default(20),offset:pe.number().int().min(0).optional().default(0),status:P(["all","open","in_progress","waiting_user","resolved","closed"]).optional().default("all"),priority:P(["all","low","normal","high","urgent"]).optional().default("all"),search:j().optional().nullable()}),tt=async(a,i)=>{const h=et.parse(a),p=new URLSearchParams;Object.entries(h).forEach(([_,v])=>{v!=null&&v!=="all"&&p.append(_,String(v))});const c=p.toString(),g=`/_api/admin/tickets/list${c?`?${c}`:""}`,f=await fetch(g,{method:"GET",...i,headers:{"Content-Type":"application/json"}}),U=await f.text();if(!f.ok){const _=w.parse(U);throw new Error(_.error)}return w.parse(U)},st=B({name:j().min(1).max(255),url:j().url(),type:j().min(1),size:we().min(1)}),at=B({ticketId:j().uuid(),message:j().max(5e3).optional().default(""),isInternal:Oe().optional().default(!1),newStatus:P(["open","in_progress","waiting_user","resolved","closed"]).optional(),attachments:Me(st).max(10).optional()}).refine(a=>a.message.trim().length>0||a.attachments&&a.attachments.length>0,{message:"Message or attachments required"}),nt=async(a,i)=>{const h=at.parse(a),p=await fetch("/_api/admin/tickets/reply",{method:"POST",...i,headers:{"Content-Type":"application/json"},body:w.stringify(h)}),c=await p.text();if(!p.ok){const g=w.parse(c);throw new Error(g.error)}return w.parse(c)},rt=B({ticketId:j().uuid(),status:P(["open","in_progress","waiting_user","resolved","closed"]),priority:P(["low","normal","high","urgent"]).optional()}),it=async(a,i)=>{const h=rt.parse(a),p=await fetch("/_api/admin/tickets/update-status",{method:"POST",...i,headers:{"Content-Type":"application/json"},body:w.stringify(h)}),c=await p.text();if(!p.ok){const g=w.parse(c);throw new Error(g.error)}return w.parse(c)},ve=50*1024*1024,lt=B({ticketId:j().uuid(),fileName:j().min(1).max(255),fileType:j().min(1),fileSize:we().min(1).max(ve)}),ct=async(a,i)=>{const h=lt.parse(a),p=await fetch("/_api/admin/tickets/upload-attachment",{method:"POST",...i,headers:{"Content-Type":"application/json"},body:w.stringify(h)}),c=await p.text();if(!p.ok){const g=w.parse(c);throw new Error(g.error)}return w.parse(c)},O=["admin","tickets"],Y=a=>[...O,"detail",a],ot=a=>je({queryKey:[...O,"list",a],queryFn:()=>tt(a),placeholderData:i=>i}),dt=a=>je({queryKey:Y(a||""),queryFn:()=>We({ticketId:a}),enabled:!!a,refetchInterval:15e3}),pt=()=>{const a=fe();return X({mutationFn:i=>nt(i),onSuccess:(i,h)=>{a.invalidateQueries({queryKey:Y(h.ticketId)}),a.invalidateQueries({queryKey:O})}})},ht=()=>{const a=fe();return X({mutationFn:i=>it(i),onSuccess:(i,h)=>{a.invalidateQueries({queryKey:Y(h.ticketId)}),a.invalidateQueries({queryKey:O})}})},mt=()=>X({mutationFn:a=>ct(a)}),ut="_container_10gwp_1",gt="_header_10gwp_7",_t="_headerIcon_10gwp_13",xt="_title_10gwp_19",wt="_description_10gwp_26",jt="_statsGrid_10gwp_34",ft="_statCard_10gwp_52",yt="_active_10gwp_70",vt="_statLabel_10gwp_75",Nt="_statValue_10gwp_81",bt="_open_10gwp_87",St="_inProgress_10gwp_91",Ct="_waitingUser_10gwp_95",It="_resolved_10gwp_99",At="_closed_10gwp_103",Tt="_filterBar_10gwp_108",kt="_searchInputWrapper_10gwp_115",Pt="_searchIcon_10gwp_121",Bt="_searchInput_10gwp_115",Ut="_selectTrigger_10gwp_135",Lt="_tableContainer_10gwp_140",zt="_ticketsTable_10gwp_148",Rt="_subjectCell_10gwp_181",Ft="_subjectText_10gwp_185",$t="_categoryText_10gwp_194",Mt="_userCell_10gwp_201",Ot="_userName_10gwp_205",Et="_userEmail_10gwp_214",Dt="_dateCell_10gwp_223",Vt="_messageCount_10gwp_229",Wt="_centeredCell_10gwp_240",Ht="_errorState_10gwp_245",qt="_emptyState_10gwp_246",Kt="_pagination_10gwp_256",Qt="_paginationButtons_10gwp_264",Gt="_ticketDetailOverlay_10gwp_270",Jt="_fadeIn_10gwp_1",Zt="_ticketDetailDrawer_10gwp_290",Xt="_slideIn_10gwp_1",Yt="_drawerHeader_10gwp_310",es="_drawerHeaderContent_10gwp_319",ts="_drawerTitle_10gwp_324",ss="_drawerMeta_10gwp_332",as="_closeButton_10gwp_339",ns="_ticketInfo_10gwp_355",rs="_infoItem_10gwp_364",is="_infoLabel_10gwp_370",ls="_infoValue_10gwp_378",cs="_messagesArea_10gwp_384",os="_messageBubble_10gwp_394",ds="_user_10gwp_201",ps="_admin_10gwp_408",hs="_internal_10gwp_416",ms="_messageHeader_10gwp_424",us="_messageSender_10gwp_442",gs="_messageTime_10gwp_446",_s="_internalBadge_10gwp_450",xs="_messageContent_10gwp_461",ws="_replyArea_10gwp_469",js="_replyOptions_10gwp_478",fs="_checkboxLabel_10gwp_485",ys="_replyInputWrapper_10gwp_500",vs="_replyInput_10gwp_500",Ns="_sendButton_10gwp_528",bs="_statusSelectWrapper_10gwp_533",Ss="_statusSelect_10gwp_533",Cs="_priorityBadge_10gwp_544",Is="_low_10gwp_555",As="_normal_10gwp_560",Ts="_high_10gwp_565",ks="_urgent_10gwp_570",Ps="_skeletonRow_10gwp_576",Bs="_hasNewResponse_10gwp_581",Us="_attachmentSection_10gwp_600",Ls="_attachmentButton_10gwp_606",zs="_pendingAttachments_10gwp_626",Rs="_pendingAttachment_10gwp_626",Fs="_pendingAttachmentUploading_10gwp_646",$s="_pendingAttachmentPreview_10gwp_650",Ms="_pendingAttachmentInfo_10gwp_657",Os="_pendingAttachmentName_10gwp_663",Es="_pendingAttachmentSize_10gwp_671",Ds="_removePendingAttachment_10gwp_676",Vs="_messageAttachments_10gwp_695",Ws="_attachmentImagePreview_10gwp_702",Hs="_attachmentFile_10gwp_714",qs="_attachmentFileName_10gwp_733",Ks="_attachmentFileSize_10gwp_740",Qs="_lightboxOverlay_10gwp_746",Gs="_lightboxImage_10gwp_757",Js="_lightboxClose_10gwp_764",t={container:ut,header:gt,headerIcon:_t,title:xt,description:wt,
1statsGrid:jt,statCard:ft,active:yt,statLabel:vt,statValue:Nt,open:bt,inProgress:St,waitingUser:Ct,resolved:It,closed:At,filterBar:Tt,searchInputWrapper:kt,searchIcon:Pt,searchInput:Bt,selectTrigger:Ut,tableContainer:Lt,ticketsTable:zt,subjectCell:Rt,subjectText:Ft,categoryText:$t,userCell:Mt,userName:Ot,userEmail:Et,dateCell:Dt,messageCount:Vt,centeredCell:Wt,errorState:Ht,emptyState:qt,pagination:Kt,paginationButtons:Qt,ticketDetailOverlay:Gt,fadeIn:Jt,ticketDetailDrawer:Zt,slideIn:Xt,drawerHeader:Yt,drawerHeaderContent:es,drawerTitle:ts,drawerMeta:ss,closeButton:as,ticketInfo:ns,infoItem:rs,infoLabel:is,infoValue:ls,messagesArea:cs,messageBubble:os,user:ds,admin:ps,internal:hs,messageHeader:ms,messageSender:us,messageTime:gs,internalBadge:_s,messageContent:xs,replyArea:ws,replyOptions:js,checkboxLabel:fs,replyInputWrapper:ys,replyInput:vs,sendButton:Ns,statusSelectWrapper:bs,statusSelect:Ss,priorityBadge:Cs,low:Is,normal:As,high:Ts,urgent:ks,skeletonRow:Ps,hasNewResponse:Bs,attachmentSection:Us,attachmentButton:Ls,pendingAttachments:zs,pendingAttachment:Rs,pendingAttachmentUploading:Fs,pendingAttachmentPreview:$s,pendingAttachmentInfo:Ms,pendingAttachmentName:Os,pendingAttachmentSize:Es,removePendingAttachment:Ds,messageAttachments:Vs,attachmentImagePreview:Ws,attachmentFile:Hs,attachmentFileName:qs,attachmentFileSize:Ks,lightboxOverlay:Qs,lightboxImage:Gs,lightboxClose:Js},me=a=>a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`,ue=a=>a.startsWith("image/"),M=15,ge=({status:a})=>{const i={open:{variant:"default",text:"Open"},in_progress:{variant:"warning",text:"In Progress"},waiting_user:{variant:"outline",text:"Waiting User"},resolved:{variant:"success",text:"Resolved"},closed:{variant:"destructive",text:"Closed"}},{variant:h,text:p}=i[a]||{variant:"default",text:a};return e.jsx(ye,{variant:h,children:p})},_e=({priority:a})=>e.jsx("span",{className:`${t.priorityBadge} ${t[a]}`,children:a}),Ne=a=>a?new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",xe=a=>{if(!a)return"-";const i=new Date(a),p=new Date().getTime()-i.getTime(),c=Math.floor(p/6e4),g=Math.floor(p/36e5),f=Math.floor(p/864e5);return c<1?"Just now":c<60?`${c}m ago`:g<24?`${g}h ago`:f<7?`${f}d ago`:Ne(a)},la=()=>{var ie,le,ce,oe,de;const[a,i]=u.useState(0),[h,p]=u.useState(""),[c,g]=u.useState("open"),[f,U]=u.useState("all"),[_,v]=u.useState(null),[L,z]=u.useState(""),[A,R]=u.useState(!1),[F,$]=u.useState(""),[x,N]=u.useState([]),[ee,E]=u.useState(null),[te,se]=u.useState(!1),D=u.useRef(null),ae=u.useRef(null),be=mt(),Se=Ve(h,500),Ce={limit:M,offset:a*M,search:Se||void 0,status:c,priority:f},{data:l,isFetching:Ie,error:Ae}=ot(Ce),{data:V,isLoading:Te}=dt(_),d=V==null?void 0:V.ticket,W=pt(),ke=ht(),T=l?Math.ceil(l.totalCount/M):0;u.useEffect(()=>{d&&F===""&&$(d.status)},[d]),u.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"})},[d==null?void 0:d.messages]);const Pe=()=>i(s=>Math.max(s-1,0)),Be=()=>i(s=>T>0?Math.min(s+1,T-1):0),Ue=s=>{v(s.id),$(""),z(""),R(!1)},ne=()=>{v(null),$(""),z(""),R(!1),x.forEach(s=>{s.preview&&URL.revokeObjectURL(s.preview)}),N([])},Le=s=>{const n=s.target.files;if(!n||n.length===0)return;const r=[];Array.from(n).forEach(o=>{if(o.size>ve){I.error(`File "${o.name}" is too large. Max size is 50MB.`);return}if(x.length+r.length>=10){I.error("Maximum 10 attachments per message");return}let S;ue(o.type)&&(S=URL.createObjectURL(o)),r.push({file:o,preview:S,uploading:!1,progress:0})}),r.length>0&&N(o=>[...o,...r]),s.target.value=""},ze=s=>{N(n=>{const r=[...n],o=r.splice(s,1)[0];return o!=null&&o.preview&&URL.revokeObjectURL(o.preview),r})},Re=async()=>{if(!_||x.length===0)return[];se(!0);const s=[];for(let n=0;n<x.length;n++){const r=x[n];if(r.uploaded){s.push(r.uploaded);continue}try{N(H=>{const b=[...H];return b[n]={...b[n],uploading:!0},b});const{uploadUrl:o,publicUrl:S}=await be.mutateAsync({ticketId:_,fileName:r.file.name,fileType:r.file.type||"application/octet-stream",fileSize:r.file.size});await fetch(o,{method:"PUT",body:r.file,headers:{"Content-Type":r.file.type||"application/octet-stream"}});
1const C={name:r.file.name,url:S,type:r.file.type||"application/octet-stream",size:r.file.size};s.push(C),N(H=>{const b=[...H];return b[n]={...b[n],uploading:!1,uploaded:C},b})}catch(o){throw console.error("Upload error:",o),N(S=>{const C=[...S];return C[n]={...C[n],uploading:!1,error:"Upload failed"},C}),o}}return se(!1),s},re=async()=>{if(!_)return;const s=L.trim().length>0,n=x.length>0;if(!(!s&&!n))try{let r=[];n&&(r=await Re()),await W.mutateAsync({ticketId:_,message:L.trim(),isInternal:A,newStatus:F!==(d==null?void 0:d.status)?F:void 0,attachments:r.length>0?r:void 0}),I.success(A?"Internal note added successfully":"Reply sent to user"),z(""),R(!1),x.forEach(o=>{o.preview&&URL.revokeObjectURL(o.preview)}),N([])}catch{I.error("Failed to send reply")}},Fe=async s=>{if(_)try{await ke.mutateAsync({ticketId:_,status:s}),I.success(`Ticket status changed to ${s.replace("_"," ")}`),$(s)}catch{I.error("Failed to update status")}},k=s=>{g(s),i(0)},$e=()=>Ie&&!l?Array.from({length:M}).map((s,n)=>e.jsxs("tr",{className:t.skeletonRow,children:[e.jsx("td",{children:e.jsx(y,{style:{height:"2.5rem"}})}),e.jsx("td",{children:e.jsx(y,{style:{height:"1.5rem",width:"100px"}})}),e.jsx("td",{children:e.jsx(y,{style:{height:"1.25rem",width:"80px"}})}),e.jsx("td",{children:e.jsx(y,{style:{height:"1.25rem",width:"80px"}})}),e.jsx("td",{children:e.jsx(y,{style:{height:"1.25rem",width:"100px"}})}),e.jsx("td",{children:e.jsx(y,{style:{height:"1.25rem",width:"50px"}})})]},n)):Ae?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:t.centeredCell,children:e.jsxs("div",{className:t.errorState,children:[e.jsx(Ze,{size:24}),e.jsx("p",{children:"Failed to load tickets."})]})})}):(l==null?void 0:l.tickets.length)===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:t.centeredCell,children:e.jsxs("div",{className:t.emptyState,children:[e.jsx(Xe,{size:24}),e.jsx("p",{children:"No tickets found."})]})})}):l==null?void 0:l.tickets.map(s=>e.jsxs("tr",{onClick:()=>Ue(s),className:s.lastMessageBy==="user"&&s.status!=="closed"?t.hasNewResponse:"",children:[e.jsxs("td",{className:t.subjectCell,children:[e.jsx("span",{className:t.subjectText,children:s.subject}),e.jsx("span",{className:t.categoryText,children:s.category})]}),e.jsxs("td",{className:t.userCell,children:[e.jsx("span",{className:t.userName,children:s.userName}),e.jsx("span",{className:t.userEmail,children:s.userEmail})]}),e.jsx("td",{children:e.jsx(ge,{status:s.status})}),e.jsx("td",{children:e.jsx(_e,{priority:s.priority})}),e.jsx("td",{className:t.dateCell,children:xe(s.lastMessageAt||s.updatedAt)}),e.jsx("td",{children:e.jsxs("span",{className:t.messageCount,children:[e.jsx(Ye,{size:12}),s.messageCount]})})]},s.id));return e.jsxs(e.Fragment,{children:[e.jsxs(Ee,{children:[e.jsx("title",{children:"Support Tickets - Admin"}),e.jsx("meta",{name:"description",content:"Manage support tickets from users."})]}),e.jsxs("div",{className:t.container,children:[e.jsxs("header",{className:t.header,children:[e.jsx("div",{className:t.headerIcon,children:"🎫"}),e.jsxs("div",{children:[e.jsx("h1",{className:t.title,children:"Support Tickets"}),e.jsx("p",{className:t.description,children:"View and respond to user support requests."})]})]}),e.jsxs("div",{className:t.statsGrid,children:[e.jsxs("div",{className:`${t.statCard} ${t.open} ${c==="open"?t.active:""}`,onClick:()=>k("open"),children:[e.jsx("span",{className:t.statLabel,children:"Open"}),e.jsx("span",{className:t.statValue,children:((ie=l==null?void 0:l.stats)==null?void 0:ie.open)??0})]}),e.jsxs("div",{className:`${t.statCard} ${t.inProgress} ${c==="in_progress"?t.active:""}`,onClick:()=>k("in_progress"),children:[e.jsx("span",{className:t.statLabel,children:"In Progress"}),e.jsx("span",{className:t.statValue,children:((le=l==null?void 0:l.stats)==null?void 0:le.inProgress)??0})]}),e.jsxs("div",{className:`${t.statCard} ${t.waitingUser} ${c==="waiting_user"?t.active:""}`,onClick:()=>k("waiting_user"),children:[e.jsx("span",{className:t.statLabel,children:"Waiting User"}),e.jsx("span",{className:t.statValue,children:((ce=l==null?void 0:l.stats)==null?void 0:ce.waitingUser)??0})]}),e.jsxs("div",{className:`${t.statCard} ${t.resolved} ${c==="resolved"?t.active:""}`,onClick:()=>
1k("resolved"),children:[e.jsx("span",{className:t.statLabel,children:"Resolved"}),e.jsx("span",{className:t.statValue,children:((oe=l==null?void 0:l.stats)==null?void 0:oe.resolved)??0})]}),e.jsxs("div",{className:`${t.statCard} ${t.closed} ${c==="closed"?t.active:""}`,onClick:()=>k("closed"),children:[e.jsx("span",{className:t.statLabel,children:"Closed"}),e.jsx("span",{className:t.statValue,children:((de=l==null?void 0:l.stats)==null?void 0:de.closed)??0})]})]}),e.jsxs("div",{className:t.filterBar,children:[e.jsxs("div",{className:t.searchInputWrapper,children:[e.jsx(He,{className:t.searchIcon,size:18}),e.jsx(De,{type:"text",placeholder:"Search by subject or user...",value:h,onChange:s=>p(s.target.value),className:t.searchInput})]}),e.jsxs(q,{value:c,onValueChange:s=>{g(s),i(0)},children:[e.jsx(K,{className:t.selectTrigger,children:e.jsx(Q,{placeholder:"All Statuses"})}),e.jsxs(G,{children:[e.jsx(m,{value:"all",children:"All Statuses"}),e.jsx(m,{value:"open",children:"Open"}),e.jsx(m,{value:"in_progress",children:"In Progress"}),e.jsx(m,{value:"waiting_user",children:"Waiting User"}),e.jsx(m,{value:"resolved",children:"Resolved"}),e.jsx(m,{value:"closed",children:"Closed"})]})]}),e.jsxs(q,{value:f,onValueChange:s=>{U(s),i(0)},children:[e.jsx(K,{className:t.selectTrigger,children:e.jsx(Q,{placeholder:"All Priorities"})}),e.jsxs(G,{children:[e.jsx(m,{value:"all",children:"All Priorities"}),e.jsx(m,{value:"low",children:"Low"}),e.jsx(m,{value:"normal",children:"Normal"}),e.jsx(m,{value:"high",children:"High"}),e.jsx(m,{value:"urgent",children:"Urgent"})]})]})]}),e.jsx("div",{className:t.tableContainer,children:e.jsxs("table",{className:t.ticketsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Subject"}),e.jsx("th",{children:"User"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Priority"}),e.jsx("th",{children:"Last Activity"}),e.jsx("th",{children:"Messages"})]})}),e.jsx("tbody",{children:$e()})]})}),e.jsxs("div",{className:t.pagination,children:[e.jsxs("span",{children:["Page ",a+1," of ",T>0?T:1]}),e.jsxs("div",{className:t.paginationButtons,children:[e.jsxs(J,{onClick:Pe,disabled:a===0,variant:"outline",size:"sm",children:[e.jsx(qe,{size:16}),"Previous"]}),e.jsxs(J,{onClick:Be,disabled:a>=T-1,variant:"outline",size:"sm",children:["Next",e.jsx(Ke,{size:16})]})]})]})]}),ee&&e.jsxs("div",{className:t.lightboxOverlay,onClick:()=>E(null),children:[e.jsx("img",{src:ee,alt:"Full size preview",className:t.lightboxImage}),e.jsx("button",{className:t.lightboxClose,onClick:()=>E(null),children:e.jsx(Z,{size:24})})]}),_&&e.jsx("div",{className:t.ticketDetailOverlay,onClick:ne,children:e.jsx("div",{className:t.ticketDetailDrawer,onClick:s=>s.stopPropagation(),children:Te?e.jsxs("div",{style:{padding:"var(--spacing-6)"},children:[e.jsx(y,{style:{height:"2rem",marginBottom:"var(--spacing-4)"}}),e.jsx(y,{style:{height:"1rem",width:"60%"}})]}):d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:t.drawerHeader,children:[e.jsxs("div",{className:t.drawerHeaderContent,children:[e.jsx("h2",{className:t.drawerTitle,children:d.subject}),e.jsxs("div",{className:t.drawerMeta,children:[e.jsx(ge,{status:d.status}),e.jsx(_e,{priority:d.priority}),e.jsx(ye,{variant:"outline",children:d.category})]})]}),e.jsx("button",{className:t.closeButton,onClick:ne,children:e.jsx(Z,{size:20})})]}),e.jsxs("div",{className:t.ticketInfo,children:[e.jsxs("div",{className:t.infoItem,children:[e.jsx("span",{className:t.infoLabel,children:"User"}),e.jsx("span",{className:t.infoValue,children:d.userName||d.userEmail})]}),e.jsxs("div",{className:t.infoItem,children:[e.jsx("span",{className:t.infoLabel,children:"Created"}),e.jsx("span",{className:t.infoValue,children:Ne(d.createdAt)})]}),e.jsxs("div",{className:t.infoItem,children:[e.jsx("span",{className:t.infoLabel,children:"Status"}),e.jsx("div",{className:t.statusSelectWrapper,children:e.jsxs(q,{value:F||d.status,onValueChange:Fe,children:[e.jsx(K,{className:t.statusSelect,children:e.jsx(Q,{})}),e.jsxs(G,{children:[e.jsx(m,{value:"open",children:"Open"}),e.jsx(m,{value:"in_progress",children:"In Progress"}),e.jsx(m,{value:"waiting_user",children:"Waiting User"}),e.jsx(m,{value:"resolved",children:"Resolved"}),e.jsx(m,{value:"closed",children:"Closed"})]})]})})]})]}),e.jsxs("div",{className:t.messagesArea,children:[d.messages.map(s=>{let n=null;if(s.attachments)if(typeof s.attachments=="string")try{n=JSON.parse(s.attachments)}catch{n=null}else Array.isArray(s.attachments)&&(n=s.attachments);return e.jsxs("div",{className:`${t.messageBubble} ${s.isInternal?t.internal:s.senderType==="user"?t.user:t.admin}`,children:[e.jsxs("div",{className:t.messageHeader,children:[e.jsx("span",{className:t.messageSender,children:s.senderType==="user"?d.userName||"User":"Support Team"}),s.isInternal&&e.jsx("span",{className:t.internalBadge,children:"Internal"}),e.jsx("span",{className:t.messageTime,children:xe(s.createdAt)})]}),s.message&&e.jsx("div",{className:t.messageContent,children:s.message}),n&&n.length>0&&e.jsx("div",{className:t.messageAttachments,children:n.map((r,o)=>ue(r.type)?e.jsx("img",{src:r.url,alt:r.name,className:t.attachmentImagePreview,onClick:()=>E(r.url)},o):e.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:t.attachmentFile,children:[e.jsx(he,{size:16}),e.jsx("span",{className:t.attachmentFileName,children:r.name}),e.jsxs("span",{className:t.attachmentFileSize,children:["(",me(r.size),")"]}),e.jsx(Qe,{size:14})]},o))})]},s.id)}),e.jsx("div",{ref:D})]}),d.status!=="closed"&&e.jsxs("div",{className:t.replyArea,children:[e.jsxs("div",{className:t.replyOptions,children:[e.jsxs("label",{className:t.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:A,onChange:s=>R(s.target.checked)}),"Internal note (not visible to user)"]}),e.jsxs("button",{type:"button",className:t.attachmentButton,onClick:()=>{var s;return(s=ae.current)==null?void 0:s.click()},disabled:x.length>=10,children:[e.jsx(Ge,{size:16}),"Attach file"]}),e.jsx("input",{ref:ae,type:"file",multiple:!0,style:{display:"none"},onChange:Le})]}),x.length>0&&e.jsx("div",{className:t.pendingAttachments,children:x.map((s,n)=>e.jsxs("div",{className:`${t.pendingAttachment} ${s.uploading?t.pendingAttachmentUploading:""}`,children:[s.preview?e.jsx("img",{src:s.preview,alt:s.file.name,className:t.pendingAttachmentPreview}):e.jsx(he,{size:24}),e.jsxs("div",{className:t.pendingAttachmentInfo,children:[e.jsx("span",{className:t.pendingAttachmentName,children:s.file.name}),e.jsx("span",{className:t.pendingAttachmentSize,children:me(s.file.size)})]}),!s.uploading&&e.jsx("button",{type:"button",className:t.removePendingAttachment,onClick:()=>ze(n),children:e.jsx(Z,{size:12})})]},n))}),e.jsx("div",{className:t.replyInputWrapper,children:e.jsx("textarea",{className:t.replyInput,placeholder:A?"Add internal note...":"Type your reply...",value:L,onChange:s=>
1z(s.target.value),onKeyDown:s=>{s.key==="Enter"&&s.metaKey&&re()}})}),e.jsxs(J,{className:t.sendButton,onClick:re,disabled:!L.trim()&&x.length===0||W.isPending||te,children:[e.jsx(Je,{size:16}),te?"Uploading...":W.isPending?"Sending...":A?"Add Note":"Send Reply"]})]})]}):null})})]})};export{la as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.