![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/public_html/_next/static/chunks/ |
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[100],{50100:(e,t,s)=>{s.r(t),s.d(t,{default:()=>y});var a=s(37876),r=s(14232),n=s(10553),l=s(67421),i=s(23042),o=s(13075),d=s(87958),c=s(6916),m=s(96488),x=s(97685),g=s(87818),u=s.n(g),h=s(94594),p=s(62334);let y=e=>{var t;let{registrationId:s,onClose:g}=e;console.log("[PrivateChat] \uD83D\uDE80 Component mounted with registrationId:",s);let{data:y}=(0,n.useSession)(),{ws:f,connected:b}=(0,d.h)(),[v,j]=(0,r.useState)(null),[w,N]=(0,r.useState)(""),[k,S]=(0,r.useState)(!1),[C,E]=(0,r.useState)(""),[L,I]=(0,r.useState)(!1),[D,P]=(0,r.useState)(new Set),[M,T]=(0,r.useState)(!1),[A,U]=(0,r.useState)(!1),[F,O]=(0,r.useState)(null),[W,z]=(0,r.useState)(null),[B,R]=(0,r.useState)(!1),V=(0,r.useRef)(null);(0,r.useRef)(null);let G=(0,r.useRef)(null),[H,J]=(0,r.useState)(null),[Y,_]=(0,r.useState)(null),[K,q]=(0,r.useState)(!1),[X,Q]=(0,r.useState)(null),Z=(0,r.useRef)(null),[$,ee]=(0,r.useState)(null);(0,r.useEffect)(()=>{"Notification"in window&&"default"===Notification.permission&&Notification.requestPermission().then(e=>{console.log("[PrivateChat] Notification permission:",e)})},[]),(0,r.useEffect)(()=>{if(!f)return;let e=e=>{try{let r=JSON.parse(e.data);switch(console.log("Private chat WebSocket message received:",r),r.type){case"PRIVATE_MESSAGE":if(r.data.registrationId===s){var t;let e=r.data.message.sender.id===(null==y||null==(t=y.user)?void 0:t.id),s=null==v?void 0:v.messages.some(e=>e.id===r.data.message.id);e||s||j(e=>e?{...e,messages:[...e.messages,r.data.message]}:null),!e&&document.hidden&&((0,x.oR)(e=>{var t;return(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)("div",{className:"w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center",children:(0,a.jsx)("span",{className:"text-white text-sm font-bold",children:(null==(t=r.data.message.sender.name)?void 0:t.charAt(0))||"U"})})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("p",{className:"font-medium text-gray-900",children:["\uD83D\uDCAC ",r.data.message.sender.name||"User"]}),(0,a.jsx)("p",{className:"text-sm text-gray-600 truncate max-w-48",children:r.data.message.content})]})]})},{duration:4e3,position:"top-right",style:{maxWidth:"350px"}}),"granted"===Notification.permission&&new Notification("New message from ".concat(r.data.message.sender.name||"User"),{body:r.data.message.content,icon:"/icons/apple-touch-icon-180x180.png"}),console.log("[PrivateChat] \uD83D\uDD14 Notification shown for message from ".concat(r.data.message.sender.name)))}break;case"TYPING":r.data.registrationId===s&&P(e=>{let t=new Set(e);return r.data.isTyping?t.add(r.data.userName):t.delete(r.data.userName),t});break;case"webrtc-offer":Q({senderId:r.senderId,signal:r.data.signal});break;case"webrtc-answer":Z.current&&Z.current.signal(r.data.signal);break;case"webrtc-ice-candidate":Z.current&&Z.current.signal(r.data.candidate);break;case"webrtc-end-call":eo()}}catch(e){console.error("Error parsing private chat WebSocket message:",e)}};return f.addEventListener("message",e),()=>f.removeEventListener("message",e)},[f,s,null==y||null==(t=y.user)?void 0:t.id]);let et=async()=>{try{S(!0);let e=await fetch("/api/chat/private/".concat(s,"/messages"),{method:"GET",credentials:"same-origin"});if(!e.ok)throw Error("Failed to fetch chat");let t=await e.json();j(t),en()}catch(e){E("Failed to load chat")}finally{S(!1)}};(0,r.useEffect)(()=>{console.log("[PrivateChat] \uD83D\uDD04 registrationId effect triggered:",s),s&&(console.log("[PrivateChat] \uD83D\uDCDE Fetching chat for registration:",s),et())},[s]);let es=(0,r.useCallback)(e=>{var t;if(f&&b&&(null==y||null==(t=y.user)?void 0:t.name)){I(e);try{f.send(JSON.stringify({type:"TYPING",data:{registrationId:s,userName:y.user.name,isTyping:e}}))}catch(e){console.error("Failed to send typing status:",e)}G.current&&clearTimeout(G.current),e&&(G.current=setTimeout(()=>{es(!1)},3e3))}},[f,b,s]),ea=async()=>{if(!w.trim()||!v||!(null==y?void 0:y.user))return;let e=w.trim();N(""),es(!1);let t={id:"temp-".concat(Date.now()),content:e,type:"TEXT",createdAt:new Date().toISOString(),sender:{id:y.user.id,name:y.user.name||"Unknown",email:y.user.email||"",role:y.user.role||"USER"}};j(e=>e?{...e,messages:[...e.messages,t]}:null);try{let a=await fetch("/api/chat/private/".concat(s,"/messages"),{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})});if(!a.ok){let e="Failed to send message";try{let t=await a.json();t&&(t.error||t.message)&&(e=t.error||t.message)}catch(t){try{let t=await a.text();t&&(e=t)}catch(e){}}throw console.error("Send message error:",e),Error(e)}let r=await a.json();j(e=>e?{...e,messages:e.messages.map(e=>e.id===t.id?r:e)}:null)}catch(e){console.error("Error sending private message:",e),j(e=>e?{...e,messages:e.messages.filter(e=>e.id!==t.id)}:null),E(e instanceof Error&&"string"==typeof e.message&&e.message.toLowerCase().includes("message limit")?"You’ve reached the message limit. Please wait for an admin to reply before sending more messages.":e instanceof Error?e.message:"Failed to send message. Please try again.")}},er=async()=>{if(!F||!v||!y)return;R(!0);let e=new FormData;e.append("file",F),e.append("userId",y.user.id),e.append("registrationId",s);try{let t=await fetch("/api/user/upload",{method:"POST",credentials:"same-origin",body:e});if(!t.ok){let e;try{e=await t.json(),console.error("Upload error response:",e)}catch(t){console.error("Failed to parse error response:",t),e={}}throw console.error("Response status:",t.status),console.error("Response status text:",t.statusText),console.error("Response headers:",Object.fromEntries(t.headers.entries())),Error(e.message||e.error||"File upload failed (".concat(t.status,": ").concat(t.statusText,")"))}let s=await t.json(),a={id:"temp-doc-".concat(Date.now()),content:"Shared a document: ".concat(s.name),type:"DOCUMENT",fileUrl:s.url,fileName:s.name,mimeType:s.type,createdAt:new Date().toISOString(),sender:{id:y.user.id,name:y.user.name||"Unknown",email:y.user.email||"",role:y.user.role||"USER"}};j(e=>e?{...e,messages:[...e.messages,a]}:null),T(!1),O(null)}catch(e){console.error("File upload error:",e),E(e.message)}finally{R(!1)}},en=()=>{V.current&&V.current.scrollIntoView({behavior:"smooth"})};(0,r.useEffect)(()=>{en()},[null==v?void 0:v.messages]);let el=(e,t,s)=>{let a=new(u())({initiator:s,trickle:!0,stream:t});return a.on("signal",t=>{let a=s?"webrtc-offer":"webrtc-answer";(null==f?void 0:f.readyState)===WebSocket.OPEN&&f.send(JSON.stringify({type:a,data:{recipientId:e,signal:t}}))}),a.on("stream",e=>{_(e)}),a.on("icecandidate",t=>{(null==f?void 0:f.readyState)===WebSocket.OPEN&&f.send(JSON.stringify({type:"webrtc-ice-candidate",data:{recipientId:e,candidate:t}}))}),a.on("close",()=>eo()),a.on("error",e=>{console.error("Peer error:",e),eo()}),a},ei=async()=>{if(X&&f){q(!0);try{let e=await navigator.mediaDevices.getUserMedia({video:!0,audio:!0});J(e),Z.current=el(X.senderId,e,!1),Z.current.signal(X.signal),Q(null)}catch(e){console.error("Failed to get user media for answering call",e),q(!1)}}},eo=()=>{Z.current&&(Z.current.destroy(),Z.current=null),H&&(H.getTracks().forEach(e=>e.stop()),J(null)),_(null),q(!1),Q(null)};return k?(0,a.jsx)("div",{className:"text-center p-8",children:"Loading chat..."}):C?(0,a.jsx)("div",{className:"text-center p-8 text-red-500",children:C}):v?X?(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50",children:(0,a.jsxs)("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-lg shadow-xl text-center",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold mb-4 text-gray-900 dark:text-white",children:"Incoming Call"}),(0,a.jsx)("p",{className:"mb-6 text-gray-700 dark:text-gray-300",children:"You have an incoming video call."}),(0,a.jsxs)("div",{className:"flex justify-center space-x-4",children:[(0,a.jsx)("button",{onClick:ei,className:"bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-6 rounded-full transition-colors",children:"Accept"}),(0,a.jsx)("button",{onClick:()=>Q(null),className:"bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-6 rounded-full transition-colors",children:"Decline"})]})]})}):(0,a.jsxs)("div",{className:"fixed inset-0 bg-black bg-opacity-60 flex items-center justify-center z-50 p-4 font-sans",children:[(0,a.jsxs)(l.P.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-gray-50 dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-2xl h-[70vh] flex flex-col",children:[(0,a.jsxs)("div",{className:"bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700 p-4 flex items-center justify-between rounded-t-lg flex-shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-green-500 to-teal-600 text-white flex items-center justify-center text-lg font-bold flex-shrink-0",children:v.registration.firstName.charAt(0).toUpperCase()}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-200 truncate",children:[v.registration.firstName," ",v.registration.lastName]}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:v.registration.email})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"w-2.5 h-2.5 rounded-full ".concat(b?"bg-green-500":"bg-red-500"),title:b?"Connected":"Disconnected"}),(0,a.jsx)("button",{onClick:g,className:"p-1 rounded-full text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[0===v.messages.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center text-gray-500 dark:text-gray-400",children:[(0,a.jsx)("div",{className:"w-20 h-20 bg-gray-200 dark:bg-gray-700 rounded-full flex items-center justify-center mb-4",children:(0,a.jsx)("svg",{className:"w-10 h-10",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),(0,a.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No messages yet"}),(0,a.jsx)("p",{children:"Start the conversation by sending a message!"})]}):v.messages.map((e,t)=>{var s,r;let n=e.sender.id===(null==y||null==(s=y.user)?void 0:s.id),l=null==v?void 0:v.messages[t-1],i=!n&&(!l||l.sender.id!==e.sender.id),d=!l||l.sender.id!==e.sender.id,c=(null==(r=e.sender)?void 0:r.name)||"Unknown User",m=(0,o.GP)(new Date(e.createdAt),"HH:mm");return(0,a.jsxs)("div",{className:"flex items-start gap-3 ".concat(d?"mt-4":"mt-1"),children:[(0,a.jsx)("div",{className:"w-10 flex-shrink-0",children:i&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(h.A,{user:e.sender,size:"sm",showStatus:!0,clickable:!0,onClick:()=>ee({userId:e.sender.id,isOpen:(null==$?void 0:$.userId)!==e.sender.id||!(null==$?void 0:$.isOpen)})}),(null==$?void 0:$.userId)===e.sender.id&&(null==$?void 0:$.isOpen)&&(0,a.jsx)(p.A,{userId:e.sender.id,isOpen:!0,onClose:()=>ee(null),position:"right"})]})}),(0,a.jsxs)("div",{className:"max-w-lg ".concat(n?"ml-auto":""),children:[d&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1 ".concat(n?"justify-end":"justify-start"),children:[(0,a.jsx)("p",{className:"text-xs font-medium ".concat(n?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400"),children:n?"You":(0,a.jsxs)("span",{className:"flex items-center gap-1",children:["ADMIN"===e.sender.role?"⚖️ ":"",c,e.sender.title&&(0,a.jsxs)("span",{className:"text-gray-500 dark:text-gray-400",children:["• ",e.sender.title]})]})}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:m})]}),(0,a.jsx)("div",{className:"px-4 py-2 rounded-2xl inline-block shadow-sm ".concat(n?"bg-gradient-to-r from-blue-600 to-blue-700 text-white rounded-br-none":"bg-white text-gray-800 border border-gray-200 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-200 rounded-bl-none"),children:"FILE"===e.type||"IMAGE"===e.type||"VIDEO"===e.type||"AUDIO"===e.type?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm",children:e.content}),"IMAGE"===e.type&&e.fileUrl?(0,a.jsxs)("div",{className:"relative rounded-lg overflow-hidden cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>z({url:e.fileUrl,type:e.mimeType,name:e.fileName}),children:[(0,a.jsx)("img",{src:e.fileUrl,alt:e.fileName,className:"max-w-full max-h-64 object-contain rounded-lg shadow-md",onError:e=>{e.currentTarget.style.display="none",e.currentTarget.nextElementSibling.style.display="block"}}),(0,a.jsx)("div",{className:"bg-gray-100 dark:bg-gray-600 rounded-lg p-3",style:{display:"none"},children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e.fileName}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:[e.fileSize?"".concat((e.fileSize/1024).toFixed(1)," KB"):""," • Image"]})]}),(0,a.jsx)("span",{className:"text-blue-500 hover:text-blue-700 text-sm font-medium",children:"View"})]})}),(0,a.jsx)("div",{className:"absolute inset-0 bg-black bg-opacity-0 hover:bg-opacity-10 transition-all duration-200 flex items-center justify-center",children:(0,a.jsx)("div",{className:"bg-black bg-opacity-50 text-white px-3 py-1 rounded-full text-sm opacity-0 group-hover:opacity-100 transition-opacity",children:"Click to enlarge"})})]}):(0,a.jsx)("div",{className:"bg-gray-100 dark:bg-gray-600 rounded-lg p-3",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e.fileName}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:[e.fileSize?"".concat((e.fileSize/1024).toFixed(1)," KB"):""," • ",e.type]})]}),(0,a.jsx)("button",{onClick:()=>z({url:e.fileUrl,type:e.mimeType,name:e.fileName}),className:"text-blue-500 hover:text-blue-700 text-sm font-medium",children:"View"})]})})]}):(0,a.jsx)("p",{className:"text-sm",children:e.content})}),e.id.startsWith("temp-")&&(0,a.jsxs)("p",{className:"text-xs text-right text-gray-400 mt-1 flex items-center justify-end gap-1",children:[(0,a.jsx)("div",{className:"w-3 h-3 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin"}),"Sending..."]})]})]},e.id)}),D.size>0&&(0,a.jsx)("div",{className:"flex justify-start",children:(0,a.jsx)("div",{className:"bg-white dark:bg-gray-700 rounded-2xl px-4 py-2 rounded-bl-none shadow",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("div",{className:"flex space-x-1",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce"}),(0,a.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,a.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),(0,a.jsxs)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[Array.from(D).join(", ")," is typing..."]})]})})}),(0,a.jsx)("div",{ref:V})]}),(0,a.jsx)("div",{className:"p-4 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700",children:C&&"string"==typeof C&&C.toLowerCase().includes("message limit")?(0,a.jsx)("div",{className:"w-full flex items-center justify-center py-6",children:(0,a.jsx)("span",{className:"text-gray-500 text-base font-medium",children:"Waiting for lawyer response…"})}):(0,a.jsxs)("div",{className:"flex items-center bg-gray-100 dark:bg-gray-800 rounded-lg px-2 py-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,a.jsx)("button",{onClick:()=>T(!0),className:"p-2 rounded-full text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",title:"Attach File",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),(null==y?void 0:y.user.role)==="ADMIN"&&v.registration.documents&&v.registration.documents.length>0&&(0,a.jsx)("button",{onClick:()=>U(!0),className:"p-2 rounded-full text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",title:"Share Document",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})})]}),(0,a.jsx)("input",{type:"text",value:w,onChange:e=>{N(e.target.value),L||es(!0)},onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ea())},placeholder:"Type a message...",className:"flex-1 bg-transparent border-none focus:ring-0 text-sm px-3 text-gray-900 dark:text-gray-200 placeholder-gray-500 dark:placeholder-gray-400"}),(0,a.jsx)("button",{onClick:ea,disabled:!w.trim(),className:"p-2 rounded-full text-white bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed transition-colors",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{d:"M10.894 2.553a1 1 0 00-1.788 0l-7 14a1 1 0 001.169 1.409l5-1.429A1 1 0 009 15.571V11a1 1 0 112 0v4.571a1 1 0 00.725.962l5 1.428a1 1 0 001.17-1.408l-7-14z"})})})]})})]}),(0,a.jsx)(i.N,{children:W&&(0,a.jsx)(l.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black bg-opacity-75 z-[60] flex items-center justify-center p-4",onClick:()=>z(null),children:(0,a.jsxs)(l.P.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.9,opacity:0},className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-7xl max-h-[90vh] w-full overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white truncate",children:W.name}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("a",{href:W.url,download:W.name,className:"p-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Download",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,a.jsx)("button",{onClick:()=>z(null),className:"p-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Close",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,a.jsx)("div",{className:"p-4 max-h-[80vh] overflow-y-auto",children:(0,a.jsx)(c.A,{url:W.url,type:W.type,name:W.name})})]})})}),(0,a.jsx)(i.N,{children:M&&(0,a.jsx)(l.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black bg-opacity-50 z-[60] flex items-center justify-center p-4",onClick:()=>T(!1),children:(0,a.jsxs)(l.P.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 w-full max-w-md",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Upload File"}),(0,a.jsx)("button",{onClick:()=>T(!1),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,a.jsx)(m.A,{onFileSelect:O,onRemoveFile:()=>O(null),selectedFile:F,uploading:B,className:"mb-4"}),F&&(0,a.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,a.jsx)("button",{onClick:()=>{T(!1),O(null)},className:"px-4 py-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200",children:"Cancel"}),(0,a.jsx)("button",{onClick:er,disabled:B,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:B?"Uploading...":"Send File"})]})]})})})]}):(0,a.jsx)("div",{className:"text-center p-8",children:"Chat not found."})}}}]);