1import{V as ae,Y as ie,Z as V,_ as W,g as O,r as m,v as I,d as y,j as e,$ as G,A as F,m as C,T as k,o as Y,f as re,a0 as oe,a1 as le,b as X,a2 as de,t as ce,u as Z,h as P,X as xe,q as H,a3 as me}from"./index-BhQSl23U.js";import{A as he}from"./arrow-left-D24Wrm9i.js";import{u as ue,g as fe,m as L}from"./userIdUtils-rSr8VfOi.js";function be(t,d){const o=ae(t);return isNaN(d)?ie(t,NaN):(o.setDate(o.getDate()+d),o)}function J(t,d){const o=V(t),s=V(d);return+o==+s}function pe(t){return J(t,W(t))}function ge(t,d){return be(t,-1)}function we(t){return J(t,ge(W(t)))}function ye(t){if(!t)return"";const d=new Date(t);return pe(d)?Y(d,"HH:mm"):we(d)?"Yesterday":Y(d,"MMM d")}function je({currentUser:t,conversations:d,onSelectConversation:o}){const s=O(),[f,p]=m.useState(null),h=I({mutationFn:async c=>{const g=await y.entities.Message.filter({conversation_id:c},"-sent_at",200);await Promise.all(g.map(x=>y.entities.Message.delete(x.id)))},onSuccess:()=>{s.invalidateQueries({queryKey:["all-messages",t==null?void 0:t.id]}),p(null)}});return d.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-6 text-center gap-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-[#1A1A1A] border border-white/5 flex items-center justify-center",children:e.jsx(G,{className:"w-7 h-7 text-[#333]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-semibold",children:"No conversations yet"}),e.jsx("p",{className:"text-sm text-[#555] mt-1",children:"Tap the compose icon to start chatting"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 pt-3 space-y-2 pb-6",children:e.jsx(F,{children:d.map((c,g)=>e.jsxs(C.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:g*.03},className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>o(c),className:"flex-1 text-left flex items-center gap-3 p-3 rounded-2xl bg-black/40 backdrop-blur-sm border border-white/8 hover:border-[#C9A96E]/25 hover:bg-black/50 transition-all min-w-0",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#C9A96E]/30 to-[#6B4F2A]/20 border border-[#C9A96E]/15 flex items-center justify-center",children:e.jsx("span",{className:"text-lg font-bold text-[#C9A96E]",children:(c.otherName||"?")[0].toUpperCase()})}),c.unreadCount>0&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 min-w-[18px] h-[18px] px-1 rounded-full bg-[#C9A96E] text-[#0D0D0D] text-[9px] font-black flex items-center justify-center",children:c.unreadCount>9?"9+":c.unreadCount})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2 mb-0.5",children:[e.jsx("p",{className:`text-[15px] truncate ${c.unreadCount>0?"font-bold text-white":"font-semibold text-[#BBB]"}`,children:c.otherName||"Member"}),e.jsx("span",{className:"text-[10px] text-[#555] shrink-0",children:ye(c.lastMessageTime)})]}),e.jsx("p",{className:`text-[12px] truncate ${c.unreadCount>0?"text-[#AAA]":"text-[#555]"}`,children:c.lastMessage||"â¦"})]})]}),e.jsx("button",{onClick:()=>p(c.conversationId),className:"w-9 h-9 rounded-xl bg-black/40 backdrop-blur-sm border border-white/8 flex items-center justify-center text-[#444] hover:text-red-400 hover:border-red-500/20 transition-colors shrink-0",children:e.jsx(k,{className:"w-3.5 h-3.5"})})]},c.conversationId))})}),f&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 px-6",children:e.jsxs("div",{className:"bg-[#1C1C1C] border border-white/10 rounded-2xl p-6 w-full max-w-xs text-center",children:[e.jsx(k,{className:"w-8 h-8 text-red-400 mx-auto mb-3"}),e.jsx("p",{className:"text-white font-semibold mb-1",children:"Delete conversation?"}),e.jsx("p",{className:"text-[#666] text-sm mb-5",children:"All messages will be permanently removed."}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>p(null),className:"flex-1 py-2.5 rounded-xl border border-white/10 text-[#888] text-sm hover:bg-white/5 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>h.mutate(f),disabled:h.isPending,className:"flex-1 py-2.5 rounded-xl bg-red-500/20 border border-red-500/30 text-red-400 text-sm hover:bg-red-500/30 transition-colors disabled:opacity-50",children:h.isPending?"Deletingâ¦":"Delete"})]})]})})]})}function ve({currentUser:t,conversation:d,messagesHook:o,onBack:s}){var R,$,Q;const f=O(),p=re(),[h,c]=m.useState(""),[g,x]=m.useState(!1),[N,r]=m.useState(!1),[l,n]=m.useState(null),u=m.useRef(null),j=m.useRef(null),a=d.conversationId,b=d.otherUserId||((R=d.otherUser)==null?void 0:R.id),w=d.otherName||(($=d.otherUser)==null?void 0:$.username)||"Member",_=()=>{b&&p(`/users/${b}`)},{getConversationMessages:ee,markConversationRead:te,sendMessage:E}=o,A=ee(a);m.useEffect(()=>{te(a)},[a,A.length]),m.useEffect(()=>{var i;(i=u.current)==null||i.scrollIntoView({behavior:"smooth"})},[A.length]),m.useEffect(()=>{var i;(i=j.current)==null||i.focus()},[]);const K=async()=>{const i=h.trim();!i||E.isPending||(c(""),E.mutate({recipient_id:b,content:i},{onError:()=>{c(i),ce.error("Failed to send message. Please try again.",{style:{background:"#1A1A1A",border:"1px solid rgba(255,80,80,0.3)",color:"#F5F0E8"}})}}))},B=I({mutationFn:i=>y.entities.Message.delete(i),onSuccess:()=>{f.invalidateQueries({queryKey:["all-messages",t==null?void 0:t.id]}),n(null)}}),T=I({mutationFn:async()=>{const i=await y.entities.Message.filter({conversation_id:a},"-sent_at",200);await Promise.all(i.map(M=>y.entities.Message.delete(M.id)))},onSuccess:()=>{f.invalidateQueries({queryKey:["all-messages",t==null?void 0:t.id]}),s()}});return e.jsxs("div",{className:"min-h-screen flex flex-col",children:[e.jsxs("div",{className:"px-4 pt-12 pb-3 border-b border-white/8 flex items-center gap-3 shrink-0 relative bg-[#121212]/85 backdrop-blur-md sticky top-0 z-20",children:[e.jsx("button",{onClick:s,className:"w-9 h-9 rounded-xl bg-[#1A1A1A] border border-white/8 flex items-center justify-center text-[#C9A96E] hover:border-[#C9A96E]/30 transition-colors shrink-0",children:e.jsx(he,{className:"w-4 h-4"})}),e.jsxs("button",{onClick:_,disabled:!b,className:"flex items-center gap-2.5 flex-1 min-w-0 text-left disabled:cursor-default group",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-[#C9A96E]/30 to-[#8B6F47]/30 border border-[#C9A96E]/20 flex items-center justify-center shrink-0 group-hover:border-[#C9A96E]/50 transition-colors",children:e.jsx("span",{className:"text-sm font-bold text-[#C9A96E]",children:(Q=w[0])==null?void 0:Q.toUpperCase()})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[15px] font-semibold text-white truncate group-hover:text-[#C9A96E] transition-colors",children:w}),b&&e.jsx("p",{className:"text-[10px] text-[#555] group-hover:text-[#888] transition-colors",children:"View profile"})]})]}),e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("button",{onClick:()=>x(i=>!i),className:"w-9 h-9 rounded-xl bg-[#1A1A1A] border border-white/8 flex items-center justify-center text-[#888] hover:text-white transition-colors",children:e.jsx(oe,{className:"w-4 h-4"})}),g&&e.jsx("div",{className:"absolute right-0 top-11 bg-[#1C1C1C] border border-white/10 rounded-xl shadow-xl z-50 min-w-[180px] overflow-hidden",children:e.jsxs("button",{onClick:()=>{x(!1),r(!0)},className:"flex items-center gap-2.5 w-full px-4 py-3 text-sm text-red-400 hover:bg-red-500/10 transition-colors",children:[e.jsx(k,{className:"w-4 h-4"}),"Delete conversation"]})})]})]}),N&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 px-6",children:e.jsxs("div",{className:"bg-[#1C1C1C] border border-white/10 rounded-2xl p-6 w-full max-w-xs text-center",children:[e.jsx(k,{className:"w-8 h-8 text-red-400 mx-auto mb-3"}),e.jsx("p",{className:"text-white font-semibold mb-1",children:"Delete conversation?"}),e.jsx("p",{className:"text-[#666] text-sm mb-5",children:"All messages will be permanently removed."}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>r(!1),className:"flex-1 py-2.5 rounded-xl border border-white/10 text-[#888] text-sm hover:bg-white/5 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{r(!1),T.mutate()},disabled:T.isPending,className:"flex-1 py-2.5 rounded-xl bg-red-500/20 border border-red-500/30 text-red-400 text-sm hover:bg-red-500/30 transition-colors disabled:opacity-50",children:T.isPending?"Deletingâ¦":"Delete"})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-2.5",onClick:()=>{x(!1),n(null)},children:[A.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-[#1A1A1A] border border-white/5 flex items-center justify-center text-xl",children:"ð¬"}),e.jsx("p",{className:"text-sm text-[#666]",children:"Start the conversation"})]}),e.jsx(F,{children:A.map((i,M)=>{const D=i.sender_id===t.id,z=l===i.id,S=new Date(i.sent_at),U=A[M-1],se=!U||new Date(U.sent_at).toDateString()!==S.toDateString(),ne=(()=>{const v=new Date,q=new Date(v);return q.setDate(v.getDate()-1),S.toDateString()===v.toDateString()?"Today":S.toDateString()===q.toDateString()?"Yesterday":S.toLocaleDateString([],{weekday:"long",month:"short",day:"numeric"})})();return e.jsxs(le.Fragment,{children:[se&&e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx("div",{className:"flex-1 h-px bg-white/8"}),e.jsx("span",{className:"text-[10px] text-[#444] shrink-0",children:ne}),e.jsx("div",{className:"flex-1 h-px bg-white/8"})]}),e.jsxs(C.div,{initial:{opacity:0,y:8}
1,animate:{opacity:1,y:0},transition:{delay:Math.min(M*.015,.3)},className:`flex flex-col ${D?"items-end":"items-start"}`,children:[e.jsxs("button",{onClick:()=>n(z?null:i.id),className:`max-w-[80%] rounded-2xl px-4 py-2.5 text-left transition-all ${D?"bg-[#C9A96E]/15 border border-[#C9A96E]/30 text-white hover:bg-[#C9A96E]/20":"bg-[#1E1E1E] border border-white/8 text-[#F5F0E8] hover:bg-[#252525]"}`,children:[e.jsx("p",{className:"text-sm leading-relaxed break-words",children:i.content}),e.jsxs("p",{className:`text-[10px] mt-1 ${D?"text-[#C9A96E]/50":"text-[#555]"}`,children:[(()=>{const v=new Date(i.sent_at);return new Date().toDateString()===v.toDateString()?v.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):v.toLocaleDateString([],{month:"short",day:"numeric"})+" "+v.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})(),D&&e.jsx("span",{className:"ml-1.5",children:i.is_read?"ââ":"â"})]})]}),z&&D&&e.jsxs(C.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},onClick:()=>B.mutate(i.id),disabled:B.isPending,className:"mt-1 flex items-center gap-1 text-[11px] text-red-400 hover:text-red-300 px-2 py-0.5 rounded-lg hover:bg-red-500/10 transition-colors",children:[e.jsx(k,{className:"w-3 h-3"}),"Delete"]})]},i.id)]},i.id)})}),e.jsx("div",{ref:u})]}),e.jsx("div",{className:"px-4 py-3 border-t border-white/8 shrink-0 bg-[#121212]/85 backdrop-blur-md",children:e.jsxs("div",{className:"flex gap-2 items-end",children:[e.jsx("input",{ref:j,value:h,onChange:i=>c(i.target.value),onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),K())},placeholder:"Type a messageâ¦",className:"flex-1 bg-[#1A1A1A] border border-white/8 rounded-2xl px-4 py-3 text-white placeholder:text-[#444] text-sm focus:outline-none focus:border-[#C9A96E]/30 transition-colors resize-none"}),e.jsx("button",{onClick:K,disabled:!h.trim()||E.isPending,className:"w-11 h-11 rounded-2xl bg-[#C9A96E] flex items-center justify-center text-[#0D0D0D] hover:bg-[#B8975D] disabled:opacity-40 disabled:cursor-not-allowed transition-all shrink-0",children:E.isPending?e.jsx(X,{className:"w-4 h-4 animate-spin"}):e.jsx(de,{className:"w-4 h-4"})})]})})]})}function Ne({isOpen:t,onClose:d,onSelectUser:o}){const{user:s}=Z(),[f,p]=m.useState(""),{data:h=[],isLoading:c}=P({queryKey:["friendships",s==null?void 0:s.id],queryFn:()=>y.entities.Friendship.filter({$or:[{user_a_id:s==null?void 0:s.id},{user_b_id:s==null?void 0:s.id}]},"",100),enabled:!!(s!=null&&s.id),staleTime:3e4}),g=m.useMemo(()=>h.map(a=>a.user_a_id===(s==null?void 0:s.id)?a.user_b_id:a.user_a_id),[h,s==null?void 0:s.id]),{data:x=[],isLoading:N}=P({queryKey:["friend-profiles-chat",g.join(",")],queryFn:async()=>g.length===0?[]:(await Promise.all(g.map(b=>y.entities.PublicProfile.filter({user_id:b},"",1)))).flat().filter(Boolean),enabled:g.length>0,staleTime:3e4}),r=c||N,l=m.useMemo(()=>x.filter(a=>a.user_id!==(s==null?void 0:s.id)).filter(a=>{var b,w;return!f||((b=a.username)==null?void 0:b.toLowerCase().includes(f.toLowerCase()))||((w=a.full_name)==null?void 0:w.toLowerCase().includes(f.toLowerCase()))}).slice(0,20),[x,f,s==null?void 0:s.id]),n=m.useMemo(()=>l.map(a=>a.user_id),[l]),u=ue(n),j=a=>{const b=L(s.id,a.user_id);o({conversationId:b,otherUser:{id:a.user_id,username:a.username||null,full_name:a.full_name||null},otherName:a.full_name||a.username,otherUserId:a.user_id}),d()};return t?e.jsx(F,{children:e.jsx(C.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 z-50 flex items-end",children:e.jsxs(C.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},className:"w-full bg-[#0D0D0D] rounded-t-3xl border-t border-white/5 max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"px-4 py-4 border-b border-white/5 flex items-center justify-between shrink-0",children:[e.jsx("h2",{className:"text-base font-semibold text-white",children:"New Message"}),e.jsx("button",{onClick:d,className:"w-8 h-8 rounded-lg bg-[#1A1A1A] border border-white/5 flex items-center justify-center text-[#999] hover:text-[#C9A96E] hover:border-[#C9A96E]/20 transition-colors",children:e.jsx(xe,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"px-4 py-3 border-b border-white/5 shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsx(H,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[#666]"}),e.jsx("input",{autoFocus:!0,placeholder:"Searchâ¦",value:f,onChange:a=>p(a.target.value),className:"w-full pl-10 pr-4 h-10 rounded-lg bg-[#1A1A1A] border border-white/8 text-white placeholder:text-[#666] text-sm focus:outline-none focus:border-[#C9A96E]/30 transition-colors"})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:r?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(X,{className:"w-5 h-5 text-[#C9A96E] animate-spin"})}):l.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#1A1A1A] border border-white/5 flex items-center justify-center",children:e.jsx(H,{className:"w-5 h-5 text-[#444]"})}),e.jsx("p",{className:"text-xs text-[#666]",children:f?"No friends found":h.length===0?"Add friends to start chatting":"No friends found"})]}):e.jsx("div",{className:"px-4 py-3 space-y-1.5",children:e.jsx(F,{children:l.map((a,b)=>{const w=fe(u[a.user_id]),_=w.icon==="green";return e.jsxs(C.button,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:10},transition:{delay:b*.02},onClick:()=>j(a),className:`w-full text-left flex items-center gap-3 p-2.5 rounded-lg transition-all border ${_?"bg-[#1A1A1A] border-[#C9A96E]/10 hover:border-[#C9A96E]/20":"bg-[#161616] border-white/5 hover:border-white/10"}`,children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-[#C9A96E]/30 to-[#8B6F47]/30 border border-[#C9A96E]/15 flex items-center justify-center text-xs font-semibold text-[#C9A96E]",children:(a.full_name||a.username||"U")[0].toUpperCase()}),_&&e.jsx("span",{className:"absolute bottom-0 right-0 w-2.5 h-2.5 bg-green-500 rounded-full border border-[#161616]"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold text-white truncate",children:a.full_name||a.username}),e.jsx("p",{className:`text-[11px] truncate mt-0.5 font-medium ${_?"text-green-400":"text-[#666]"}`,children:w.label})]})]},a.user_id)})})})})]})})}):null}function Ce(t,{enabled:d=!0}={}){const o=O(),{data:s=[]}=P({queryKey:["all-messages",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const[r,l]=await Promise.all([y.entities.Message.filter({sender_id:t.id},"-sent_at",50),y.entities.Message.filter({recipient_id:t.id},"-sent_at",50)]);return[...r||[],...l||[]]},enabled:!!(t!=null&&t.id)&&d,staleTime:30*1e3,gcTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1});m.useEffect(()=>t!=null&&t.id?y.entities.Message.subscribe(()=>{o.invalidateQueries({queryKey:["all-messages",t.id]}),o.invalidateQueries({queryKey:["unread-count",t.id]})}):void 0,[t==null?void 0:t.id,o]);const f=r=>s.filter(l=>l.conversation_id===r).sort((l,n)=>new Date(l.sent_at)-new Date(n.sent_at)),p=m.useMemo(()=>s.filter(r=>r.recipient_id===(t==null?void 0:t.id)&&!r.is_read).length,[s,t==null?void 0:t.id]),h=m.useMemo(()=>{const r=new Set;return s.forEach(l=>{const n=l.sender_id===(t==null?void 0:t.id)?l.recipient_id:l.sender_id;n&&r.add(n)}),[...r]},[s,t==null?void 0:t.id]),{data:c={}}=P({queryKey:["conv-profiles",h.sort().join(",")],queryFn:async()=>
1{if(!h.length)return{};const r=await Promise.all(h.map(n=>y.entities.PublicProfile.filter({user_id:n},"",1).then(u=>u==null?void 0:u[0]))),l={};for(const n of r)n!=null&&n.user_id&&(l[n.user_id]=n);return l},enabled:h.length>0,staleTime:300*1e3,refetchOnWindowFocus:!1}),g=m.useMemo(()=>{const r=new Map;return[...s].sort((n,u)=>new Date(n.sent_at)-new Date(u.sent_at)).forEach(n=>{const u=n.sender_id===(t==null?void 0:t.id)?n.recipient_id:n.sender_id,j=L(t==null?void 0:t.id,u),a=c[u],b=(a==null?void 0:a.username)||"Member",w=r.get(j)||{conversationId:j,otherUserId:u,otherName:b,lastMessage:"",lastMessageTime:n.sent_at,unreadCount:0};w.otherName=b,w.lastMessage=n.content,w.lastMessageTime=n.sent_at,r.set(j,w)}),s.forEach(n=>{if(n.recipient_id===(t==null?void 0:t.id)&&!n.is_read){const u=L(t==null?void 0:t.id,n.sender_id);if(r.has(u)){const j=r.get(u);j.unreadCount=(j.unreadCount||0)+1}}}),Array.from(r.values()).sort((n,u)=>new Date(u.lastMessageTime)-new Date(n.lastMessageTime))},[s,t==null?void 0:t.id,c]),x=I({mutationFn:async({recipient_id:r,content:l})=>(await y.functions.invoke("sendMessage",{recipient_id:r,content:l})).data,onSuccess:()=>{o.invalidateQueries({queryKey:["all-messages",t==null?void 0:t.id]})}});return{messages:s,conversations:g,unreadCount:p,getConversationMessages:f,sendMessage:x,markConversationRead:async r=>{const l=s.filter(n=>n.conversation_id===r&&n.recipient_id===(t==null?void 0:t.id)&&!n.is_read);l.length!==0&&(await Promise.all(l.map(n=>y.entities.Message.update(n.id,{is_read:!0}))),o.invalidateQueries({queryKey:["all-messages",t==null?void 0:t.id]}),o.invalidateQueries({queryKey:["unread-count",t==null?void 0:t.id]}))}}}function ke(){const{user:t}=Z(),d=me(),[o,s]=m.useState(null),[f,p]=m.useState(!1),h=Ce(t),{conversations:c}=h;return m.useEffect(()=>{const x=(o==null?void 0:o.conversationId)||null;return window.__activeChatConversationId=x,window.dispatchEvent(new CustomEvent("activeChatChanged",{detail:x})),()=>{window.__activeChatConversationId=null,window.dispatchEvent(new CustomEvent("activeChatChanged",{detail:null}))}},[o==null?void 0:o.conversationId]),m.useEffect(()=>{var n;const x=(n=d.state)==null?void 0:n.openConversation;if(x!=null&&x.conversationId&&(x!=null&&x.otherUserId)){s(x),window.history.replaceState({},"");return}const N=window.__pendingOpenConversationId,r=window.__pendingOpenSenderId,l=window.__pendingOpenSenderName;N&&r&&(window.__pendingOpenConversationId=null,window.__pendingOpenSenderId=null,window.__pendingOpenSenderName=null,s({conversationId:N,otherUserId:r,otherName:l||"Member"}))},[]),e.jsxs("div",{className:"min-h-screen pb-24 relative",children:[e.jsx("div",{className:"fixed inset-0 bg-cover bg-center bg-no-repeat -z-10",style:{backgroundImage:"url(https://media.base44.com/images/public/69b5fe0c79b48a9af649bbd9/e024dad43_Cigarloungeeleganceandwarmth.png)"}}),e.jsx("div",{className:"fixed inset-0 bg-[#121212]/90 -z-10"}),e.jsx("div",{className:"max-w-lg mx-auto",children:o?e.jsx(ve,{conversation:o,currentUser:t,messagesHook:h,onBack:()=>s(null)}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sticky top-0 z-30 bg-[#0D0808]/85 backdrop-blur-md border-b border-white/5 px-4 pb-3 flex items-center justify-between",style:{paddingTop:"calc(3rem + env(safe-area-inset-top, 0px))"},children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-[#C9A96E] tracking-[0.3em] uppercase font-medium",children:"Inbox"}),e.jsx("h1",{className:"text-lg font-bold text-[#F5F0E8]",style:{fontFamily:"Playfair Display, serif"},children:"Messages"})]}),e.jsx("button",{onClick:()=>p(!0),className:"w-9 h-9 rounded-xl bg-[#1A1A1A] border border-[#C9A96E]/20 flex items-center justify-center text-[#C9A96E] hover:bg-[#C9A96E]/10 transition-colors",children:e.jsx(G,{className:"w-4 h-4"})})]}),e.jsx(je,{currentUser:t,conversations:c,onSelectConversation:s})]})}),f&&e.jsx(Ne,{isOpen:f,onClose:()=>p(!1),onSelectUser:x=>{s(x),p(!1)}})]})}export{ke 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.