@usechat/react-native 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,459 +1,463 @@
1
1
  'use client'
2
- var Me={isInitialized:!1,projectId:null,error:null},Is=M=>{Me={isInitialized:!0,projectId:M,error:null}},Oe=M=>{Me={isInitialized:!1,projectId:null,error:M}};var tr=()=>({...Me}),qe=()=>{if(Me.error)throw new Error(`UseChat SDK initialization failed: ${Me.error}
2
+ var ke={isInitialized:!1,projectId:null,error:null},Ys=C=>{ke={isInitialized:!0,projectId:C,error:null}},Je=C=>{ke={isInitialized:!1,projectId:null,error:C}};var Un=()=>({...ke}),St=()=>{if(ke.error)throw new Error(`UseChat SDK initialization failed: ${ke.error}
3
3
 
4
4
  Please call initChat() with a valid project ID before using any UseChat components or hooks.
5
5
 
6
6
  Example:
7
7
  import { initChat } from '@usechat/react-native';
8
- await initChat({ projectId: 'your-project-id' });`);if(!Me.isInitialized)throw new Error(`UseChat SDK is not initialized.
8
+ await initChat({ projectId: 'your-project-id' });`);if(!ke.isInitialized)throw new Error(`UseChat SDK is not initialized.
9
9
 
10
10
  Please call initChat() with a valid project ID before using any UseChat components or hooks.
11
11
 
12
12
  Example:
13
13
  import { initChat } from '@usechat/react-native';
14
- await initChat({ projectId: 'your-project-id' });`)},or=()=>(qe(),Me.projectId),sr=()=>Me.isInitialized&&!Me.error;var rr=async M=>{let{projectId:T,apiUrl:R="http://localhost:3000/api/chat/init",debug:C=!1}=M;if(!T){let S="Project ID is required";throw Oe(S),new Error(S)}try{C&&console.log(`[UseChat SDK] Validating projectId: ${T}`);let S=await fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:T})});if(C&&console.log(`[Chat SDK] Response status: ${S.status}, ok: ${S.ok}`),!S.ok){let P=`HTTP ${S.status}: ${S.statusText}`;try{let B=await S.json();P=B.error||B.message||P}catch{try{let E=await S.text();E&&(P=`Server error: ${E}`)}catch{P=`Failed to initialize chat (HTTP ${S.status})`}}throw Oe(P),new Error(P)}let A;try{let P=await S.text();if(C&&console.log(`[Chat SDK] Response text: ${P}`),!P){let B="Server returned empty response";throw Oe(B),new Error(B)}A=JSON.parse(P)}catch(P){C&&console.error("[Chat SDK] JSON parse error:",P);let B="Server returned invalid JSON response";throw Oe(B),new Error(B)}if(!A||typeof A!="object"){let P="Server returned invalid response format";throw Oe(P),new Error(P)}let I=A;return C&&console.log(`[UseChat SDK] Successfully initialized with projectId: ${T}`),Is(T),I}catch(S){C&&console.error("[Chat SDK] Init error:",S);let A;throw S instanceof TypeError&&S.message.includes("fetch")?A="Network error: Unable to connect to server. Please check your internet connection.":S instanceof Error?A=S.message:A="Failed to initialize chat: Unknown error",A.includes("Project ID is required")||Oe(A),new Error(A)}};import As,{useState as Vo,useRef as zs,useCallback as $e}from"react";import{View as He,StyleSheet as Sr}from"react-native";import{createContext as nr,useContext as ar}from"react";import{StyleSheet as ir}from"react-native";import{KeyboardProvider as Mr,KeyboardAvoidingView as Cr}from"react-native-keyboard-controller";var vs=nr(null),Rr=({children:M,config:T={}})=>{let R={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...T};return<vs.Provider value={{config:R}}>
15
- <Mr>
16
- <Cr behavior={R.keyboardBehavior}style={[Tr.keyboardContainer]}keyboardVerticalOffset={R.keyboardVerticalOffset}>
17
- {}
18
- {M}
19
- </Cr>
20
- </Mr>
21
- </vs.Provider>},Ao=Rr,St=()=>{let M=ar(vs);if(!M)throw new Error("useChatConfig must be used within a ChatProvider");return M.config},Tr=ir.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});import{useState as zo,useCallback as wt}from"react";var It=(M={})=>{let{uploader:T,maxAttachments:R=10,maxFileSize:C=10*1024*1024,allowedTypes:S=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:P}=M,[B,E]=zo([]),[v,V]=zo(!1),[D,z]=zo(0),L=wt(N=>{if(B.length>=R){console.warn(`Maximum ${R} attachments allowed`);return}if(N.data?.size&&N.data.size>C){console.warn(`File size exceeds ${C/(1024*1024)}MB limit`);return}if(N.data?.type&&!S.some(ie=>ie.endsWith("/*")?N.data.type.startsWith(ie.slice(0,-1)):N.data.type===ie)){console.warn(`File type ${N.data.type} not allowed`);return}let j={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};E(J=>[...J,j]),A&&A(j)},[B.length,R,C,S,A]),k=wt(N=>{E(j=>j.filter(J=>J.id!==N)),I&&I(N)},[I]),O=wt(()=>{E([])},[]),F=wt(async N=>{try{let j;switch(N){case"image":j={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":j={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":j={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":j={type:"contact",data:{id:"contact-1",name:"John Doe",phoneNumbers:["+1234567890"],emails:["john@example.com"]}};break;default:throw new Error(`Unsupported attachment type: ${N}`)}let J={id:`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:N,data:j.data,fileName:j.data.fileName||j.data.name,fileSize:j.data.fileSize||j.data.size,mimeType:j.data.mimeType,uploadStatus:"pending",uploadProgress:0};L(J)}catch(j){console.error("Error opening picker:",j)}},[L]),H=wt(async()=>{if(!T)return console.warn("No uploader provided, skipping upload"),B;if(B.length===0)return[];V(!0),z(0);try{let N=B.map(async(Y,X)=>{try{E(Z=>Z.map(W=>W.id===Y.id?{...W,uploadStatus:"uploading",uploadProgress:0}:W));let le=setInterval(()=>{E(Z=>Z.map(W=>W.id===Y.id?{...W,uploadProgress:Math.min((W.uploadProgress??0)+10,90)}:W))},100),me=await T.upload(Y.data);clearInterval(le);let re={...Y,uploadStatus:"completed",uploadProgress:100,data:{...Y.data,url:me.url,metadata:me.metadata}};return E(Z=>Z.map(W=>W.id===Y.id?re:W)),re}catch(le){return console.error(`Error uploading attachment ${Y.id}:`,le),E(me=>me.map(re=>re.id===Y.id?{...re,uploadStatus:"failed",uploadProgress:0}:re)),{...Y,uploadStatus:"failed",uploadProgress:0}}}),j=await Promise.all(N),ie=j.filter(Y=>Y.uploadStatus==="completed").length/j.length*100;return z(ie),P&&P(j),j}catch(N){return console.error("Error uploading attachments:",N),B}finally{V(!1)}},[B,T,P]);return{attachments:B,openPicker:F,addAttachment:L,removeAttachment:k,clearAttachments:O,uploadAttachments:H,isUploading:v,uploadProgress:D}};import{useState as Bo,useCallback as Fe}from"react";var Ps=(M={})=>{let{onSend:T,onFocus:R,initialValue:C="",maxLength:S=1e3}=M,[A,I]=Bo(C),[P,B]=Bo(40),[E,v]=Bo(!1),V=Fe(H=>{H.length<=S&&I(H)},[S]),D=Fe(H=>{if(!A.trim()&&(!H||H.length===0))return;let N=A.trim();T&&T(N,H),I(""),B(40)},[A,T]),z=Fe(()=>{v(!0),R&&R()},[R]),L=Fe(()=>{v(!1)},[]),k=Fe(H=>{B(Math.max(40,Math.min(H,120)))},[]),O=Fe(()=>{I(""),B(40)},[]),F=Fe(H=>{I(H)},[]);return{message:A,composerHeight:P,isFocused:E,handleTextChange:V,handleSend:D,handleFocus:z,handleBlur:L,handleContentSizeChange:k,clearMessage:O,setMessage:F}};var wr=({messages:M,components:T={},renderProps:R={},onMessageSend:C,onReactionAdd:S,onReactionRemove:A,onMessageDelete:I,onActionPress:P,attachmentUploader:B,maxAttachments:E=10,maxFileSize:v=10*1024*1024,allowedFileTypes:V=["image/*","application/pdf","text/*"],enableReactionDetails:D,enableMessageActions:z=!0,enableScrollToBottom:L,enableTypingIndicator:k,isTyping:O=!1,typingUserName:F,isLoading:H=!1,loadingComponent:N})=>{let j=St(),[J,ie]=Vo(!1),Y=T.MessageList||Ie,X=T.MessageInput||we,le=D??j.enableReactionDetails??!0,me=z??j.enableMessageActions??!0,re=L??j.enableScrollToBottom??!0,Z=k??j.enableTypingIndicator??!0,[W,ce]=Vo(null),ye=zs(null),[he,ne]=Vo(M||[]),ge=zs((M||[]).length+1);As.useEffect(()=>{M&&(ne(M),ge.current=M.length+1)},[M]),As.useEffect(()=>{if(W&&ye.current){let U=setTimeout(()=>{ye.current?.focus()},150);return()=>clearTimeout(U)}},[W]);let xe=It({uploader:B,maxAttachments:E,maxFileSize:v,allowedTypes:V}),ee=Ps({onSend:(U,$)=>{if(W){let G={id:W.id,text:W.text,senderName:W.senderName,senderId:W.senderId,isMe:W.isMe,timestamp:W.timestamp,type:W.type==="image"?"image":"text",imageData:W.imageData};if($&&$.length>0){let K=$[0],te={id:ge.current++,text:U.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:G,attachments:$,type:K.type==="image"?"image":"text",...K.type==="image"&&K.data&&{imageData:{uri:K.data.uri||"",width:K.data.width||300,height:K.data.height||200,fileName:K.fileName||"image.jpg",fileSize:K.fileSize||0}}};ne(fe=>[...fe,te]),C&&C(te)}else{let K={id:ge.current++,text:U.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:G};ne(te=>[...te,K]),C&&C(K)}ce(null)}else if($&&$.length>0){let G=$[0],K={id:ge.current++,text:U.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",attachments:$,type:G.type==="image"?"image":"text",...G.type==="image"&&G.data&&{imageData:{uri:G.data.uri||"",width:G.data.width||300,height:G.data.height||200,fileName:G.fileName||"image.jpg",fileSize:G.fileSize||0}}};ne(te=>[...te,K]),C&&C(K)}else{let G={id:ge.current++,text:U.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};ne(K=>[...K,G]),C&&C(G)}xe.clearAttachments()},onFocus:()=>{}}),Se=$e((U,$)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",U,"and emoji:",$),ne(G=>G.map(K=>K.id===U?K.reactions?.find(fe=>fe.emoji===$)?{...K,reactions:K.reactions?.map(fe=>fe.emoji===$?{...fe,count:fe.count+1,users:[...fe.users,"currentUser"]}:fe)}:{...K,reactions:[...K.reactions||[],{emoji:$,count:1,users:["currentUser"]}]}:K)),S&&S(U,$)},[S]),vo=$e((U,$)=>{ne(G=>G.map(K=>K.id===U?{...K,reactions:K.reactions?.map(te=>te.emoji===$?{...te,count:Math.max(0,te.count-1),users:te.users.filter(fe=>fe!=="currentUser")}:te).filter(te=>te.count>0)}:K)),A&&A(U,$)},[A]),Po=$e(U=>{ne($=>$.map(G=>G.id===U?{...G,deleted:!0,text:"",reactions:void 0}:G)),I&&I(U)},[I]),oe=$e(()=>{ce(null)},[]),de=$e(U=>{ce(U),setTimeout(()=>{ye.current?.focus()},100)},[]),Tt=$e(U=>{if(J)return;let{layout:$}=U.nativeEvent;$.height<=0||ie(!0)},[J]);if(H)return<He style={Ne.container}>
22
- {N||<He style={Ne.loadingContainer}>
14
+ await initChat({ projectId: 'your-project-id' });`)},Kn=()=>(St(),ke.projectId),qn=()=>ke.isInitialized&&!ke.error;var $n=async C=>{let{projectId:T,apiUrl:R="http://localhost:3000/api/chat/init",debug:M=!1}=C;if(!T){let S="Project ID is required";throw Je(S),new Error(S)}try{M&&console.log(`[UseChat SDK] Validating projectId: ${T}`);let S=await fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:T})});if(M&&console.log(`[Chat SDK] Response status: ${S.status}, ok: ${S.ok}`),!S.ok){let P=`HTTP ${S.status}: ${S.statusText}`;try{let z=await S.json();P=z.error||z.message||P}catch{try{let E=await S.text();E&&(P=`Server error: ${E}`)}catch{P=`Failed to initialize chat (HTTP ${S.status})`}}throw Je(P),new Error(P)}let A;try{let P=await S.text();if(M&&console.log(`[Chat SDK] Response text: ${P}`),!P){let z="Server returned empty response";throw Je(z),new Error(z)}A=JSON.parse(P)}catch(P){M&&console.error("[Chat SDK] JSON parse error:",P);let z="Server returned invalid JSON response";throw Je(z),new Error(z)}if(!A||typeof A!="object"){let P="Server returned invalid response format";throw Je(P),new Error(P)}let I=A;return M&&console.log(`[UseChat SDK] Successfully initialized with projectId: ${T}`),Ys(T),I}catch(S){M&&console.error("[Chat SDK] Init error:",S);let A;throw S instanceof TypeError&&S.message.includes("fetch")?A="Network error: Unable to connect to server. Please check your internet connection.":S instanceof Error?A=S.message:A="Failed to initialize chat: Unknown error",A.includes("Project ID is required")||Je(A),new Error(A)}};import Qs,{useState as Qo,useRef as en,useCallback as wt}from"react";import{View as Ze,StyleSheet as Sa}from"react-native";import{createContext as Xn,useContext as Zn}from"react";import{StyleSheet as Qn}from"react-native";import{KeyboardProvider as Ca,KeyboardAvoidingView as Ma}from"react-native-keyboard-controller";import{createContext as _n,useContext as _s,useState as Jn,useCallback as Gs}from"react";var Yn={"input.placeholder":"Type a message...","search.placeholder":"Search chats...","status.online":"Online","status.offline":"Offline","status.typing":"typing...","message.deleted":"This message was deleted","message.sending":"Sending...","message.sent":"Sent","message.delivered":"Delivered","message.read":"Read","message.failed":"Failed to send","action.reply":"Reply","action.copy":"Copy","action.delete":"Delete","action.cancel":"Cancel","action.send":"Send","action.clear":"Clear","action.clearAll":"Clear All","attachment.add":"Add attachment","attachment.remove":"Remove","attachment.clear":"Clear","attachment.attachments":"Attachments:","accessibility.back":"Go back","accessibility.send":"Send message","accessibility.attach":"Add attachment","accessibility.emoji":"Add emoji","accessibility.videoCall":"Start video call","accessibility.voiceCall":"Start voice call","accessibility.info":"Chat info","accessibility.search":"Search chats","accessibility.typing":"Someone is typing","error.fileTooLarge":"File is too large","error.invalidFileType":"Invalid file type","error.maxAttachments":"Maximum attachments reached","error.networkError":"Network error occurred","time.justNow":"Just now","time.minutesAgo":"{{count}} min ago","time.hoursAgo":"{{count}}h ago","time.daysAgo":"{{count}}d ago","time.weeksAgo":"{{count}}w ago","time.monthsAgo":"{{count}}mo ago","time.yearsAgo":"{{count}}y ago"},Gn={"input.placeholder":"Napisz wiadomo\u015B\u0107...","search.placeholder":"Szukaj czat\xF3w...","status.online":"Online","status.offline":"Offline","status.typing":"pisze...","message.deleted":"Ta wiadomo\u015B\u0107 zosta\u0142a usuni\u0119ta","message.sending":"Wysy\u0142anie...","message.sent":"Wys\u0142ano","message.delivered":"Dostarczono","message.read":"Przeczytano","message.failed":"Nie uda\u0142o si\u0119 wys\u0142a\u0107","action.reply":"Odpowiedz","action.copy":"Kopiuj","action.delete":"Usu\u0144","action.cancel":"Anuluj","action.send":"Wy\u015Blij","action.clear":"Wyczy\u015B\u0107","action.clearAll":"Wyczy\u015B\u0107 wszystko","attachment.add":"Dodaj za\u0142\u0105cznik","attachment.remove":"Usu\u0144","attachment.clear":"Wyczy\u015B\u0107","attachment.attachments":"Za\u0142\u0105czniki:","accessibility.back":"Wr\xF3\u0107","accessibility.send":"Wy\u015Blij wiadomo\u015B\u0107","accessibility.attach":"Dodaj za\u0142\u0105cznik","accessibility.emoji":"Dodaj emoji","accessibility.videoCall":"Rozpocznij wideorozmow\u0119","accessibility.voiceCall":"Rozpocznij rozmow\u0119 g\u0142osow\u0105","accessibility.info":"Informacje o czacie","accessibility.search":"Szukaj czat\xF3w","accessibility.typing":"Kto\u015B pisze","error.fileTooLarge":"Plik jest za du\u017Cy","error.invalidFileType":"Nieprawid\u0142owy typ pliku","error.maxAttachments":"Osi\u0105gni\u0119to maksymaln\u0105 liczb\u0119 za\u0142\u0105cznik\xF3w","error.networkError":"Wyst\u0105pi\u0142 b\u0142\u0105d sieci","time.justNow":"W\u0142a\u015Bnie teraz","time.minutesAgo":"{{count}} min temu","time.hoursAgo":"{{count}}h temu","time.daysAgo":"{{count}}d temu","time.weeksAgo":"{{count}}t temu","time.monthsAgo":"{{count}}mies temu","time.yearsAgo":"{{count}}l temu"},So={en:Yn,pl:Gn},Ot=C=>So[C]||So.en,wo=C=>C==="en"||C==="pl";var _o=_n(void 0),Io=({children:C,locale:T="en",fallbackLocale:R="en"})=>{let[M,S]=Jn(T),A=Gs((z,E={})=>{let k=Ot(M)[z];return!k&&M!==R&&(k=Ot(R)[z]),k?k.replace(/\{\{(\w+)\}\}/g,(D,V)=>E[V]?.toString()||D):(console.warn(`Translation missing for key: ${z} in locale: ${M}`),z)},[M,R]),I=Gs(z=>{wo(z)?S(z):(console.warn(`Unsupported locale: ${z}. Falling back to 'en'`),S("en"))},[]),P={t:A,locale:M,setLocale:I};return<_o.Provider value={P}>
15
+ {C}
16
+ </_o.Provider>},Js=()=>{let C=_s(_o);if(!C)throw new Error("useTranslation must be used within an I18nProvider");return C},Pe=()=>{let C=_s(_o);return C?C.t:T=>T};var Xs=Xn(null),Ra=({children:C,config:T={},locale:R="en"})=>{let M={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...T};return<Io locale={R}>
17
+ <Xs.Provider value={{config:M}}>
18
+ <Ca>
19
+ <Ma behavior={M.keyboardBehavior}style={[Ta.keyboardContainer]}keyboardVerticalOffset={M.keyboardVerticalOffset}>
20
+ {}
21
+ {C}
22
+ </Ma>
23
+ </Ca>
24
+ </Xs.Provider>
25
+ </Io>},Jo=Ra,Ft=()=>{let C=Zn(Xs);if(!C)throw new Error("useChatConfig must be used within a ChatProvider");return C.config},Ta=Qn.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});import{useState as Xo,useCallback as Ht}from"react";var Nt=(C={})=>{let{uploader:T,maxAttachments:R=10,maxFileSize:M=10*1024*1024,allowedTypes:S=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:P}=C,[z,E]=Xo([]),[v,k]=Xo(!1),[D,V]=Xo(0),B=Ht(N=>{if(z.length>=R){console.warn(`Maximum ${R} attachments allowed`);return}if(N.data?.size&&N.data.size>M){console.warn(`File size exceeds ${M/(1024*1024)}MB limit`);return}if(N.data?.type&&!S.some(re=>re.endsWith("/*")?N.data.type.startsWith(re.slice(0,-1)):N.data.type===re)){console.warn(`File type ${N.data.type} not allowed`);return}let O={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};E(_=>[..._,O]),A&&A(O)},[z.length,R,M,S,A]),L=Ht(N=>{E(O=>O.filter(_=>_.id!==N)),I&&I(N)},[I]),F=Ht(()=>{E([])},[]),j=Ht(async N=>{try{let O;switch(N){case"image":O={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":O={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":O={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":O={type:"contact",data:{id:"contact-1",name:"John Doe",phoneNumbers:["+1234567890"],emails:["john@example.com"]}};break;default:throw new Error(`Unsupported attachment type: ${N}`)}let _={id:`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:N,data:O.data,fileName:O.data.fileName||O.data.name,fileSize:O.data.fileSize||O.data.size,mimeType:O.data.mimeType,uploadStatus:"pending",uploadProgress:0};B(_)}catch(O){console.error("Error opening picker:",O)}},[B]),H=Ht(async()=>{if(!T)return console.warn("No uploader provided, skipping upload"),z;if(z.length===0)return[];k(!0),V(0);try{let N=z.map(async(J,Ce)=>{try{E(we=>we.map(W=>W.id===J.id?{...W,uploadStatus:"uploading",uploadProgress:0}:W));let Z=setInterval(()=>{E(we=>we.map(W=>W.id===J.id?{...W,uploadProgress:Math.min((W.uploadProgress??0)+10,90)}:W))},100),ae=await T.upload(J.data);clearInterval(Z);let oe={...J,uploadStatus:"completed",uploadProgress:100,data:{...J.data,url:ae.url,metadata:ae.metadata}};return E(we=>we.map(W=>W.id===J.id?oe:W)),oe}catch(Z){return console.error(`Error uploading attachment ${J.id}:`,Z),E(ae=>ae.map(oe=>oe.id===J.id?{...oe,uploadStatus:"failed",uploadProgress:0}:oe)),{...J,uploadStatus:"failed",uploadProgress:0}}}),O=await Promise.all(N),re=O.filter(J=>J.uploadStatus==="completed").length/O.length*100;return V(re),P&&P(O),O}catch(N){return console.error("Error uploading attachments:",N),z}finally{k(!1)}},[z,T,P]);return{attachments:z,openPicker:j,addAttachment:B,removeAttachment:L,clearAttachments:F,uploadAttachments:H,isUploading:v,uploadProgress:D}};import{useState as Zo,useCallback as Xe}from"react";var Zs=(C={})=>{let{onSend:T,onFocus:R,initialValue:M="",maxLength:S=1e3}=C,[A,I]=Zo(M),[P,z]=Zo(40),[E,v]=Zo(!1),k=Xe(H=>{H.length<=S&&I(H)},[S]),D=Xe(H=>{if(!A.trim()&&(!H||H.length===0))return;let N=A.trim();T&&T(N,H),I(""),z(40)},[A,T]),V=Xe(()=>{v(!0),R&&R()},[R]),B=Xe(()=>{v(!1)},[]),L=Xe(H=>{z(Math.max(40,Math.min(H,120)))},[]),F=Xe(()=>{I(""),z(40)},[]),j=Xe(H=>{I(H)},[]);return{message:A,composerHeight:P,isFocused:E,handleTextChange:k,handleSend:D,handleFocus:V,handleBlur:B,handleContentSizeChange:L,clearMessage:F,setMessage:j}};var wa=({messages:C,components:T={},renderProps:R={},onMessageSend:M,onReactionAdd:S,onReactionRemove:A,onMessageDelete:I,onActionPress:P,attachmentUploader:z,maxAttachments:E=10,maxFileSize:v=10*1024*1024,allowedFileTypes:k=["image/*","application/pdf","text/*"],enableReactionDetails:D,enableMessageActions:V=!0,enableScrollToBottom:B,enableTypingIndicator:L,isTyping:F=!1,typingUserName:j,isLoading:H=!1,loadingComponent:N})=>{let O=Ft(),[_,re]=Qo(!1),J=T.MessageList||Oe,Ce=T.MessageInput||Ee,Z=D??O.enableReactionDetails??!0,ae=V??O.enableMessageActions??!0,oe=B??O.enableScrollToBottom??!0,we=L??O.enableTypingIndicator??!0,[W,Ie]=Qo(null),Me=en(null),[Ge,Q]=Qo(C||[]),ve=en((C||[]).length+1);Qs.useEffect(()=>{C&&(Q(C),ve.current=C.length+1)},[C]),Qs.useEffect(()=>{if(W&&Me.current){let U=setTimeout(()=>{Me.current?.focus()},150);return()=>clearTimeout(U)}},[W]);let ze=Nt({uploader:z,maxAttachments:E,maxFileSize:v,allowedTypes:k}),ee=Zs({onSend:(U,$)=>{if(W){let Y={id:W.id,text:W.text,senderName:W.senderName,senderId:W.senderId,isMe:W.isMe,timestamp:W.timestamp,type:W.type==="image"?"image":"text",imageData:W.imageData};if($&&$.length>0){let K=$[0],te={id:ve.current++,text:U.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:Y,attachments:$,type:K.type==="image"?"image":"text",...K.type==="image"&&K.data&&{imageData:{uri:K.data.uri||"",width:K.data.width||300,height:K.data.height||200,fileName:K.fileName||"image.jpg",fileSize:K.fileSize||0}}};Q(Ve=>[...Ve,te]),M&&M(te)}else{let K={id:ve.current++,text:U.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:Y};Q(te=>[...te,K]),M&&M(K)}Ie(null)}else if($&&$.length>0){let Y=$[0],K={id:ve.current++,text:U.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",attachments:$,type:Y.type==="image"?"image":"text",...Y.type==="image"&&Y.data&&{imageData:{uri:Y.data.uri||"",width:Y.data.width||300,height:Y.data.height||200,fileName:Y.fileName||"image.jpg",fileSize:Y.fileSize||0}}};Q(te=>[...te,K]),M&&M(K)}else{let Y={id:ve.current++,text:U.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};Q(K=>[...K,Y]),M&&M(Y)}ze.clearAttachments()},onFocus:()=>{}}),Tt=wt((U,$)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",U,"and emoji:",$),Q(Y=>Y.map(K=>K.id===U?K.reactions?.find(Ve=>Ve.emoji===$)?{...K,reactions:K.reactions?.map(Ve=>Ve.emoji===$?{...Ve,count:Ve.count+1,users:[...Ve.users,"currentUser"]}:Ve)}:{...K,reactions:[...K.reactions||[],{emoji:$,count:1,users:["currentUser"]}]}:K)),S&&S(U,$)},[S]),_e=wt((U,$)=>{Q(Y=>Y.map(K=>K.id===U?{...K,reactions:K.reactions?.map(te=>te.emoji===$?{...te,count:Math.max(0,te.count-1),users:te.users.filter(Ve=>Ve!=="currentUser")}:te).filter(te=>te.count>0)}:K)),A&&A(U,$)},[A]),Go=wt(U=>{Q($=>$.map(Y=>Y.id===U?{...Y,deleted:!0,text:"",reactions:void 0}:Y)),I&&I(U)},[I]),se=wt(()=>{Ie(null)},[]),Te=wt(U=>{Ie(U),setTimeout(()=>{Me.current?.focus()},100)},[]),Et=wt(U=>{if(_)return;let{layout:$}=U.nativeEvent;$.height<=0||re(!0)},[_]);if(H)return<Ze style={Qe.container}>
26
+ {N||<Ze style={Qe.loadingContainer}>
23
27
  {}
24
- </He>}
25
- </He>;if(!J)return<He style={Ne.container}>
26
- <He style={Ne.chatContainer}onLayout={Tt}>
27
- <He style={Ne.loadingContainer}>{N}</He>
28
- </He>
29
- </He>;let ws=R.renderInput;return<He style={Ne.container}>
30
- <He style={Ne.fill}>
31
- <Y messages={he}isTyping={Z?O:!1}typingUserName={F}showScrollToBottom={re}isReplyActive={!!W}enableMessageActions={me}enableReactionDetails={le}onReactionAdd={Se}onReactionRemove={vo}onMessageDelete={Po}onReplyMessage={de}onActionPress={(U,$)=>{U==="reply"?de($):P?.(U,$)}}/>
28
+ </Ze>}
29
+ </Ze>;if(!_)return<Ze style={Qe.container}>
30
+ <Ze style={Qe.chatContainer}onLayout={Et}>
31
+ <Ze style={Qe.loadingContainer}>{N}</Ze>
32
+ </Ze>
33
+ </Ze>;let $s=R.renderInput;return<Ze style={Qe.container}>
34
+ <Ze style={Qe.fill}>
35
+ <J messages={Ge}isTyping={we?F:!1}typingUserName={j}showScrollToBottom={oe}isReplyActive={!!W}enableMessageActions={ae}enableReactionDetails={Z}onReactionAdd={Tt}onReactionRemove={_e}onMessageDelete={Go}onReplyMessage={Te}onActionPress={(U,$)=>{U==="reply"?Te($):P?.(U,$)}}/>
32
36
 
33
- {ws?ws({value:ee.message,onChangeText:ee.handleTextChange,onSend:ee.handleSend,onFocus:ee.handleFocus,height:ee.composerHeight,onContentSizeChange:ee.handleContentSizeChange,replyToMessage:W,onCancelReply:oe,attachments:xe.attachments,onAttachmentAdd:xe.addAttachment,onAttachmentRemove:xe.removeAttachment,onAttachmentUpload:xe.uploadAttachments}):<X ref={ye}value={ee.message}onChangeText={ee.handleTextChange}onSend={ee.handleSend}onFocus={ee.handleFocus}height={ee.composerHeight}onContentSizeChange={ee.handleContentSizeChange}replyToMessage={W}onCancelReply={oe}onAttachmentSend={(U,$)=>{let G=U.type==="image",K={id:ge.current++,text:$?.trim()||"",isMe:!0,timestamp:new Date().toISOString(),status:"sent",type:G?"image":"text",...G&&U.data&&{imageData:{uri:U.data.uri||"",width:U.data.width||300,height:U.data.height||200,fileName:U.data.fileName||U.data.name||"image.jpg",fileSize:U.data.fileSize||U.data.size||0}}};ne(te=>[...te,K]),C&&C(K),ee.handleTextChange("")}}/>}
37
+ {$s?$s({value:ee.message,onChangeText:ee.handleTextChange,onSend:ee.handleSend,onFocus:ee.handleFocus,height:ee.composerHeight,onContentSizeChange:ee.handleContentSizeChange,replyToMessage:W,onCancelReply:se,attachments:ze.attachments,onAttachmentAdd:ze.addAttachment,onAttachmentRemove:ze.removeAttachment,onAttachmentUpload:ze.uploadAttachments}):<Ce ref={Me}value={ee.message}onChangeText={ee.handleTextChange}onSend={ee.handleSend}onFocus={ee.handleFocus}height={ee.composerHeight}onContentSizeChange={ee.handleContentSizeChange}replyToMessage={W}onCancelReply={se}onAttachmentSend={(U,$)=>{let Y=U.type==="image",K={id:ve.current++,text:$?.trim()||"",isMe:!0,timestamp:new Date().toISOString(),status:"sent",type:Y?"image":"text",...Y&&U.data&&{imageData:{uri:U.data.uri||"",width:U.data.width||300,height:U.data.height||200,fileName:U.data.fileName||U.data.name||"image.jpg",fileSize:U.data.fileSize||U.data.size||0}}};Q(te=>[...te,K]),M&&M(K),ee.handleTextChange("")}}/>}
34
38
 
35
39
  {}
36
- </He>
40
+ </Ze>
37
41
 
38
42
  {}
39
- </He>},Ne=Sr.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),Do=wr;import{View as Pe,Text as Lo,TouchableOpacity as Ut}from"react-native";import{ArrowLeft as Br,Info as Vr,Phone as Dr,Video as Lr}from"lucide-react-native";import{useContext as Ar}from"react";import{createContext as Ir,useMemo as vr}from"react";var vt={colors:{primary:"#3B82F6",secondary:"#34B7F1",background:"#FFFFFF",surface:"#F7F8FA",surfaceSecondary:"#F3F4F6",text:"#111827",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",success:"#10B981",error:"#EF4444",warning:"#F59E0B",unread:"#EBF8FF",online:"#10B981",messageBubble:{sent:"#3B82F6",received:"#E5E7EB",sentText:"#FFFFFF",receivedText:"#111827"},gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"},blue:{50:"#EBF8FF",500:"#3B82F6",600:"#2563EB"},green:{500:"#10B981"}},spacing:{xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},borderRadius:{sm:4,md:8,lg:12,xl:16,full:9999},typography:{fontFamily:"System",fontSize:{xs:12,sm:14,base:16,lg:18,xl:20,xxl:24},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:16,normal:20,relaxed:24}}};var ko=Ir(vt),Pr=(M,T)=>({colors:{...M.colors,...T.colors},spacing:{...M.spacing,...T.spacing},borderRadius:{...M.borderRadius,...T.borderRadius},typography:{...M.typography,...T.typography}}),Bs=({children:M,theme:T})=>{let R=vr(()=>T?Pr(vt,T):vt,[T]);return<ko.Provider value={R}>{M}</ko.Provider>};var q=()=>{let M=Ar(ko);if(!M)throw new Error("useTheme must be used within a ThemeProvider");return M};var Er=({name:M="George Alan",isOnline:T=!0,onBack:R=()=>{},onVideoCall:C=()=>{},onVoiceCall:S=()=>{},onInfo:A=()=>{}})=>{let I=q();return<Pe style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderBottomWidth:1,borderBottomColor:I.colors.borderLight,backgroundColor:I.colors.background,paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,zIndex:50}}>
40
- <Pe style={{flex:1,flexDirection:"row",alignItems:"center"}}>
41
- <Ut onPress={R}style={{marginRight:I.spacing.md}}>
42
- <Br size={24}color={I.colors.gray[700]}/>
43
- </Ut>
43
+ </Ze>},Qe=Sa.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),es=wa;import{View as Fe,Text as Cs,TouchableOpacity as Po}from"react-native";import{ArrowLeft as Va,Info as Ba,Phone as Da,Video as La}from"lucide-react-native";import{useContext as Aa}from"react";import{createContext as Ia,useMemo as va}from"react";var Wt={colors:{primary:"#3B82F6",secondary:"#34B7F1",background:"#FFFFFF",surface:"#F7F8FA",surfaceSecondary:"#F3F4F6",text:"#111827",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",success:"#10B981",error:"#EF4444",warning:"#F59E0B",unread:"#EBF8FF",online:"#10B981",messageBubble:{sent:"#3B82F6",received:"#E5E7EB",sentText:"#FFFFFF",receivedText:"#111827"},gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"},blue:{50:"#EBF8FF",500:"#3B82F6",600:"#2563EB"},green:{500:"#10B981"}},spacing:{xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},borderRadius:{sm:4,md:8,lg:12,xl:16,full:9999},typography:{fontFamily:"System",fontSize:{xs:12,sm:14,base:16,lg:18,xl:20,xxl:24},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:16,normal:20,relaxed:24}}};var ts=Ia(Wt),Pa=(C,T)=>({colors:{...C.colors,...T.colors},spacing:{...C.spacing,...T.spacing},borderRadius:{...C.borderRadius,...T.borderRadius},typography:{...C.typography,...T.typography}}),tn=({children:C,theme:T})=>{let R=va(()=>T?Pa(Wt,T):Wt,[T]);return<ts.Provider value={R}>{C}</ts.Provider>};var q=()=>{let C=Aa(ts);if(!C)throw new Error("useTheme must be used within a ThemeProvider");return C};var ja=({name:C="George Alan",isOnline:T=!0,onBack:R=()=>{},onVideoCall:M=()=>{},onVoiceCall:S=()=>{},onInfo:A=()=>{}})=>{let I=q(),P=Pe();return<Fe style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderBottomWidth:1,borderBottomColor:I.colors.borderLight,backgroundColor:I.colors.background,paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,zIndex:50}}>
44
+ <Fe style={{flex:1,flexDirection:"row",alignItems:"center"}}>
45
+ <Po onPress={R}style={{marginRight:I.spacing.md}}>
46
+ <Va size={24}color={I.colors.gray[700]}/>
47
+ </Po>
44
48
 
45
- <Pe style={{flex:1,flexDirection:"row",alignItems:"center"}}>
49
+ <Fe style={{flex:1,flexDirection:"row",alignItems:"center"}}>
46
50
  {}
47
- <Pe style={{position:"relative",marginRight:I.spacing.md}}>
48
- <Pe style={{height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:I.borderRadius.full,backgroundColor:I.colors.gray[200]}}>
49
- <Lo style={{fontSize:I.typography.fontSize.base,color:I.colors.text}}>
51
+ <Fe style={{position:"relative",marginRight:I.spacing.md}}>
52
+ <Fe style={{height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:I.borderRadius.full,backgroundColor:I.colors.gray[200]}}>
53
+ <Cs style={{fontSize:I.typography.fontSize.base,color:I.colors.text}}>
50
54
  👤
51
- </Lo>
52
- </Pe>
53
- {T&&<Pe style={{position:"absolute",bottom:-2,right:-2,height:12,width:12,borderRadius:I.borderRadius.full,borderWidth:1,borderColor:I.colors.background,backgroundColor:I.colors.online}}/>}
54
- </Pe>
55
+ </Cs>
56
+ </Fe>
57
+ {T&&<Fe style={{position:"absolute",bottom:-2,right:-2,height:12,width:12,borderRadius:I.borderRadius.full,borderWidth:1,borderColor:I.colors.background,backgroundColor:I.colors.online}}/>}
58
+ </Fe>
55
59
 
56
- <Pe style={{flex:1}}>
57
- <Lo style={{fontSize:I.typography.fontSize.lg,fontWeight:I.typography.fontWeight.semibold,color:I.colors.text}}>
58
- {M}
59
- </Lo>
60
- <Lo style={{fontSize:I.typography.fontSize.sm,color:I.colors.textSecondary}}>
61
- {T?"Online":"Offline"}
62
- </Lo>
63
- </Pe>
64
- </Pe>
65
- </Pe>
60
+ <Fe style={{flex:1}}>
61
+ <Cs style={{fontSize:I.typography.fontSize.lg,fontWeight:I.typography.fontWeight.semibold,color:I.colors.text}}>
62
+ {C}
63
+ </Cs>
64
+ <Cs style={{fontSize:I.typography.fontSize.sm,color:I.colors.textSecondary}}>
65
+ {P(T?"status.online":"status.offline")}
66
+ </Cs>
67
+ </Fe>
68
+ </Fe>
69
+ </Fe>
66
70
 
67
- <Pe style={{flexDirection:"row",alignItems:"center",gap:I.spacing.lg}}>
71
+ <Fe style={{flexDirection:"row",alignItems:"center",gap:I.spacing.lg}}>
68
72
  {}
69
- {C&&<Ut onPress={C}>
70
- <Lr size={24}color={I.colors.gray[700]}/>
71
- </Ut>}
72
- {S&&<Ut onPress={S}>
73
- <Dr size={24}color={I.colors.gray[700]}/>
74
- </Ut>}
75
- {A&&<Ut onPress={A}>
76
- <Vr size={24}color={I.colors.gray[700]}/>
77
- </Ut>}
78
- </Pe>
79
- </Pe>},Kt=Er;import{useRef as Xr}from"react";import{View as Bt,Text as Be,Pressable as Qr,TouchableOpacity as Zr}from"react-native";import Pt from"dayjs";import jr from"dayjs/plugin/isToday";import Or from"dayjs/plugin/isYesterday";Pt.extend(jr);Pt.extend(Or);var Fr=M=>{let T=Pt(M);return T.isToday()?"Today":T.isYesterday()?"Yesterday":T.format("ddd D MMMM")},Hr=M=>Pt(M).format("YYYY-MM-DD"),Vs=M=>{if(M.length===0)return[];let T=[],R=null;return M.forEach((C,S)=>{let A=Hr(C.timestamp);if(R!==A){let P=Fr(C.timestamp),B={id:`date-${A}`,listItemType:"date-separator",date:A,displayDate:P};T.push(B),R=A}let I={...C,listItemType:"message"};T.push(I)}),T},Eo=M=>Pt(M).format("HH:mm");import{View as Oo,Text as $t,Image as Nr}from"react-native";var Wr=({replyTo:M,isMyMessage:T})=>{let R=q(),C=(E,v=50)=>E.length<=v?E:E.substring(0,v)+"...",S=T?"rgba(255, 255, 255, 0.3)":R.colors.primary,A=T?"rgba(255, 255, 255, 0.8)":R.colors.primary,I=T?"rgba(255, 255, 255, 0.7)":R.colors.textSecondary,P=T?"rgba(255, 255, 255, 0.1)":R.colors.surfaceSecondary,B=M.type==="image"&&M.imageData;return<Oo style={{marginBottom:R.spacing.sm,borderRadius:R.borderRadius.md,padding:R.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:S}}>
80
- <$t style={{fontSize:R.typography.fontSize.xs,fontWeight:R.typography.fontWeight.medium,color:A,marginBottom:R.spacing.xs}}>
81
- {M.isMe?"You":M.senderName||"Sender"}
82
- </$t>
73
+ {M&&<Po onPress={M}>
74
+ <La size={24}color={I.colors.gray[700]}/>
75
+ </Po>}
76
+ {S&&<Po onPress={S}>
77
+ <Da size={24}color={I.colors.gray[700]}/>
78
+ </Po>}
79
+ {A&&<Po onPress={A}>
80
+ <Ba size={24}color={I.colors.gray[700]}/>
81
+ </Po>}
82
+ </Fe>
83
+ </Fe>},Ao=ja;import{useRef as Xa}from"react";import{View as $t,Text as Ne,Pressable as Za,TouchableOpacity as Qa}from"react-native";import Ut from"dayjs";import Ea from"dayjs/plugin/isToday";import Oa from"dayjs/plugin/isYesterday";Ut.extend(Ea);Ut.extend(Oa);var Fa=C=>{let T=Ut(C);return T.isToday()?"Today":T.isYesterday()?"Yesterday":T.format("ddd D MMMM")},Ha=C=>Ut(C).format("YYYY-MM-DD"),on=C=>{if(C.length===0)return[];let T=[],R=null;return C.forEach((M,S)=>{let A=Ha(M.timestamp);if(R!==A){let P=Fa(M.timestamp),z={id:`date-${A}`,listItemType:"date-separator",date:A,displayDate:P};T.push(z),R=A}let I={...M,listItemType:"message"};T.push(I)}),T},Ms=C=>Ut(C).format("HH:mm");import{View as Rs,Text as Vo,Image as Na}from"react-native";var Wa=({replyTo:C,isMyMessage:T})=>{let R=q(),M=(E,v=50)=>E.length<=v?E:E.substring(0,v)+"...",S=T?"rgba(255, 255, 255, 0.3)":R.colors.primary,A=T?"rgba(255, 255, 255, 0.8)":R.colors.primary,I=T?"rgba(255, 255, 255, 0.7)":R.colors.textSecondary,P=T?"rgba(255, 255, 255, 0.1)":R.colors.surfaceSecondary,z=C.type==="image"&&C.imageData;return<Rs style={{marginBottom:R.spacing.sm,borderRadius:R.borderRadius.md,padding:R.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:S}}>
84
+ <Vo style={{fontSize:R.typography.fontSize.xs,fontWeight:R.typography.fontWeight.medium,color:A,marginBottom:R.spacing.xs}}>
85
+ {C.isMe?"You":C.senderName||"Sender"}
86
+ </Vo>
83
87
 
84
- {B?<Oo style={{flexDirection:"row",alignItems:"center"}}>
85
- <Nr source={{uri:M.imageData.uri}}style={{width:40,height:40,borderRadius:R.borderRadius.sm,marginRight:R.spacing.sm}}resizeMode="cover"/>
86
- <Oo style={{flex:1}}>
87
- <$t style={{fontSize:R.typography.fontSize.xs,color:I,fontStyle:"italic",marginBottom:R.spacing.xs}}>
88
+ {z?<Rs style={{flexDirection:"row",alignItems:"center"}}>
89
+ <Na source={{uri:C.imageData.uri}}style={{width:40,height:40,borderRadius:R.borderRadius.sm,marginRight:R.spacing.sm}}resizeMode="cover"/>
90
+ <Rs style={{flex:1}}>
91
+ <Vo style={{fontSize:R.typography.fontSize.xs,color:I,fontStyle:"italic",marginBottom:R.spacing.xs}}>
88
92
  📷 Image
89
- </$t>
90
- {M.text&&M.text.trim()&&<$t style={{fontSize:R.typography.fontSize.sm,color:I,lineHeight:R.typography.lineHeight.tight}}>
91
- {C(M.text,30)}
92
- </$t>}
93
- </Oo>
94
- </Oo>:<$t style={{fontSize:R.typography.fontSize.sm,color:I,lineHeight:R.typography.lineHeight.tight}}>
95
- {C(M.text)}
96
- </$t>}
97
- </Oo>},Ye=Wr;import{useState as Ds,useCallback as At}from"react";import{View as Yt,Image as Ls,Pressable as Es,Modal as Ur,Dimensions as Kr,StyleSheet as qr,Text as $r}from"react-native";var{width:Fo,height:js}=Kr.get("window"),Yr=({imageData:M,isMe:T,onImagePress:R,onLongPress:C})=>{let S=q(),[A,I]=Ds(!1),[P,B]=Ds(!1),v=At(()=>{let O=Fo*.6,F=300;if(!M.width||!M.height)return{width:O,height:F};let H=M.width/M.height,N=O,j=N/H;return j>F&&(j=F,N=j*H),{width:Math.round(N),height:Math.round(j)}},[M.width,M.height])(),V=At(()=>{R?R():I(!0)},[R]),D=At(()=>{console.error("Failed to load image:",M.uri),B(!0)},[M.uri]),z=At(()=>{I(!1)},[]),k=At(()=>{if(!M.width||!M.height)return{width:Fo,height:js*.8};let O=M.width/M.height,F=Fo*.9,H=js*.8,N=F,j=N/O;return j>H&&(j=H,N=j*O),{width:Math.round(N),height:Math.round(j)}},[M.width,M.height])();return P?<Yt style={[Ae.errorContainer,{width:v.width,height:v.height,backgroundColor:T?S.colors.messageBubble.sent:S.colors.messageBubble.received,borderRadius:S.borderRadius.lg}]}>
98
- <$r style={[Ae.errorText,{color:T?S.colors.messageBubble.sentText:S.colors.messageBubble.receivedText,fontSize:S.typography.fontSize.sm}]}>
93
+ </Vo>
94
+ {C.text&&C.text.trim()&&<Vo style={{fontSize:R.typography.fontSize.sm,color:I,lineHeight:R.typography.lineHeight.tight}}>
95
+ {M(C.text,30)}
96
+ </Vo>}
97
+ </Rs>
98
+ </Rs>:<Vo style={{fontSize:R.typography.fontSize.sm,color:I,lineHeight:R.typography.lineHeight.tight}}>
99
+ {M(C.text)}
100
+ </Vo>}
101
+ </Rs>},It=Wa;import{useState as sn,useCallback as Kt}from"react";import{View as Bo,Image as Cn,Pressable as Mn,Modal as Ua,Dimensions as Ka,StyleSheet as qa,Text as $a}from"react-native";var{width:Ts,height:Rn}=Ka.get("window"),Ya=({imageData:C,isMe:T,onImagePress:R,onLongPress:M})=>{let S=q(),[A,I]=sn(!1),[P,z]=sn(!1),v=Kt(()=>{let F=Ts*.6,j=300;if(!C.width||!C.height)return{width:F,height:j};let H=C.width/C.height,N=F,O=N/H;return O>j&&(O=j,N=O*H),{width:Math.round(N),height:Math.round(O)}},[C.width,C.height])(),k=Kt(()=>{R?R():I(!0)},[R]),D=Kt(()=>{console.error("Failed to load image:",C.uri),z(!0)},[C.uri]),V=Kt(()=>{I(!1)},[]),L=Kt(()=>{if(!C.width||!C.height)return{width:Ts,height:Rn*.8};let F=C.width/C.height,j=Ts*.9,H=Rn*.8,N=j,O=N/F;return O>H&&(O=H,N=O*F),{width:Math.round(N),height:Math.round(O)}},[C.width,C.height])();return P?<Bo style={[He.errorContainer,{width:v.width,height:v.height,backgroundColor:T?S.colors.messageBubble.sent:S.colors.messageBubble.received,borderRadius:S.borderRadius.lg}]}>
102
+ <$a style={[He.errorText,{color:T?S.colors.messageBubble.sentText:S.colors.messageBubble.receivedText,fontSize:S.typography.fontSize.sm}]}>
99
103
  Failed to load image
100
- </$r>
101
- </Yt>:<>
102
- <Es onPress={V}onLongPress={C}delayLongPress={500}>
103
- <Yt style={[Ae.imageContainer,{borderRadius:S.borderRadius.lg,overflow:"hidden"}]}>
104
- <Ls source={{uri:M.uri}}style={[Ae.image,{width:v.width,height:v.height}]}resizeMode='cover'onError={D}/>
104
+ </$a>
105
+ </Bo>:<>
106
+ <Mn onPress={k}onLongPress={M}delayLongPress={500}>
107
+ <Bo style={[He.imageContainer,{borderRadius:S.borderRadius.lg,overflow:"hidden"}]}>
108
+ <Cn source={{uri:C.uri}}style={[He.image,{width:v.width,height:v.height}]}resizeMode='cover'onError={D}/>
105
109
 
106
110
  {}
107
- <Yt style={Ae.imageOverlay}/>
108
- </Yt>
109
- </Es>
111
+ <Bo style={He.imageOverlay}/>
112
+ </Bo>
113
+ </Mn>
110
114
 
111
115
  {}
112
- <Ur visible={A}transparent animationType='fade'onRequestClose={z}>
113
- <Es style={Ae.modalContainer}onPress={z}>
114
- <Yt style={Ae.modalContent}>
115
- <Ls source={{uri:M.uri}}style={[Ae.modalImage,{width:k.width,height:k.height,borderRadius:S.borderRadius.lg}]}resizeMode='contain'/>
116
- </Yt>
117
- </Es>
118
- </Ur>
119
- </>},Ae=qr.create({imageContainer:{position:"relative"},image:{backgroundColor:"#f0f0f0"},imageOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent"},errorContainer:{justifyContent:"center",alignItems:"center",borderWidth:1,borderColor:"#e0e0e0"},errorText:{textAlign:"center",fontWeight:"500"},modalContainer:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.9)",justifyContent:"center",alignItems:"center"},modalContent:{justifyContent:"center",alignItems:"center"},modalImage:{backgroundColor:"transparent"}}),Gt=Yr;import{View as _t,Text as Os,StyleSheet as Gr}from"react-native";import{Trash2 as _r}from"lucide-react-native";var Jr=({isMe:M,timestamp:T,senderName:R})=>{let C=q();return<_t style={[Ge.container,{alignSelf:M?"flex-end":"flex-start",maxWidth:"80%"}]}>
120
- <_t style={[Ge.messageBubble,{backgroundColor:C.colors.gray[100],borderColor:C.colors.gray[200]}]}>
121
- <_t style={Ge.content}>
122
- <_r size={16}color={C.colors.gray[500]}/>
123
- <Os style={[Ge.deletedText,{color:C.colors.gray[500]}]}>
124
- This message was deleted
125
- </Os>
126
- </_t>
127
- </_t>
128
- <_t style={[Ge.metadata,{alignSelf:M?"flex-end":"flex-start"}]}>
129
- <Os style={[Ge.timestamp,{color:C.colors.gray[400]}]}>
116
+ <Ua visible={A}transparent animationType='fade'onRequestClose={V}>
117
+ <Mn style={He.modalContainer}onPress={V}>
118
+ <Bo style={He.modalContent}>
119
+ <Cn source={{uri:C.uri}}style={[He.modalImage,{width:L.width,height:L.height,borderRadius:S.borderRadius.lg}]}resizeMode='contain'/>
120
+ </Bo>
121
+ </Mn>
122
+ </Ua>
123
+ </>},He=qa.create({imageContainer:{position:"relative"},image:{backgroundColor:"#f0f0f0"},imageOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent"},errorContainer:{justifyContent:"center",alignItems:"center",borderWidth:1,borderColor:"#e0e0e0"},errorText:{textAlign:"center",fontWeight:"500"},modalContainer:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.9)",justifyContent:"center",alignItems:"center"},modalContent:{justifyContent:"center",alignItems:"center"},modalImage:{backgroundColor:"transparent"}}),Do=Ya;import{View as Lo,Text as Tn,StyleSheet as Ga}from"react-native";import{Trash2 as _a}from"lucide-react-native";var Ja=({isMe:C,timestamp:T,senderName:R})=>{let M=q(),S=Pe();return<Lo style={[vt.container,{alignSelf:C?"flex-end":"flex-start",maxWidth:"80%"}]}>
124
+ <Lo style={[vt.messageBubble,{backgroundColor:M.colors.gray[100],borderColor:M.colors.gray[200]}]}>
125
+ <Lo style={vt.content}>
126
+ <_a size={16}color={M.colors.gray[500]}/>
127
+ <Tn style={[vt.deletedText,{color:M.colors.gray[500]}]}>
128
+ {S("message.deleted")}
129
+ </Tn>
130
+ </Lo>
131
+ </Lo>
132
+ <Lo style={[vt.metadata,{alignSelf:C?"flex-end":"flex-start"}]}>
133
+ <Tn style={[vt.timestamp,{color:M.colors.gray[400]}]}>
130
134
  {T}
131
- </Os>
132
- </_t>
133
- </_t>},Ge=Gr.create({container:{marginVertical:4,marginHorizontal:15},messageBubble:{borderRadius:18,paddingHorizontal:16,paddingVertical:12,borderWidth:1,borderStyle:"dashed"},content:{flexDirection:"row",alignItems:"center",justifyContent:"center"},deletedText:{fontSize:14,fontStyle:"italic",marginLeft:8},metadata:{marginTop:4,paddingHorizontal:4},timestamp:{fontSize:11}}),Jt=Jr;var en=({message:M,onLongPress:T,onReactionPress:R})=>{let C=q(),S=Xr(null),A=()=>{S.current?S.current.measureInWindow((B,E,v,V)=>{let D={x:Math.round(B),y:Math.round(E),width:Math.round(v),height:Math.round(V)};T?.(M,D)}):T?.(M)},I=()=>{M.reactions&&M.reactions.length>0&&R?.(M)},P=M.type==="image"&&M.imageData;return M.deleted?<Jt isMe={M.isMe}timestamp={Eo(M.timestamp)}senderName={M.senderName}/>:<Bt style={{marginBottom:C.spacing.md,alignItems:M.isMe?"flex-end":"flex-start",marginHorizontal:C.spacing.sm}}>
134
- <Qr ref={S}onLongPress={A}delayLongPress={500}style={{maxWidth:P?"75%":"80%",borderRadius:P?C.borderRadius.lg:C.borderRadius.xl,borderBottomRightRadius:M.isMe?4:P?C.borderRadius.lg:C.borderRadius.xl,borderBottomLeftRadius:M.isMe?P?C.borderRadius.lg:C.borderRadius.xl:4,paddingHorizontal:P?0:C.spacing.lg,paddingVertical:P?0:C.spacing.md,backgroundColor:P?"transparent":M.isMe?C.colors.messageBubble.sent:C.colors.messageBubble.received,overflow:"hidden"}}>
135
- {M.replyTo&&<Ye replyTo={M.replyTo}isMyMessage={M.isMe}/>}
135
+ </Tn>
136
+ </Lo>
137
+ </Lo>},vt=Ga.create({container:{marginVertical:4,marginHorizontal:15},messageBubble:{borderRadius:18,paddingHorizontal:16,paddingVertical:12,borderWidth:1,borderStyle:"dashed"},content:{flexDirection:"row",alignItems:"center",justifyContent:"center"},deletedText:{fontSize:14,fontStyle:"italic",marginLeft:8},metadata:{marginTop:4,paddingHorizontal:4},timestamp:{fontSize:11}}),Eo=Ja;var er=({message:C,onLongPress:T,onReactionPress:R})=>{let M=q(),S=Xa(null),A=()=>{S.current?S.current.measureInWindow((z,E,v,k)=>{let D={x:Math.round(z),y:Math.round(E),width:Math.round(v),height:Math.round(k)};T?.(C,D)}):T?.(C)},I=()=>{C.reactions&&C.reactions.length>0&&R?.(C)},P=C.type==="image"&&C.imageData;return C.deleted?<Eo isMe={C.isMe}timestamp={Ms(C.timestamp)}senderName={C.senderName}/>:<$t style={{marginBottom:M.spacing.md,alignItems:C.isMe?"flex-end":"flex-start",marginHorizontal:M.spacing.sm}}>
138
+ <Za ref={S}onLongPress={A}delayLongPress={500}style={{maxWidth:P?"75%":"80%",borderRadius:P?M.borderRadius.lg:M.borderRadius.xl,borderBottomRightRadius:C.isMe?4:P?M.borderRadius.lg:M.borderRadius.xl,borderBottomLeftRadius:C.isMe?P?M.borderRadius.lg:M.borderRadius.xl:4,paddingHorizontal:P?0:M.spacing.lg,paddingVertical:P?0:M.spacing.md,backgroundColor:P?"transparent":C.isMe?M.colors.messageBubble.sent:M.colors.messageBubble.received,overflow:"hidden"}}>
139
+ {C.replyTo&&<It replyTo={C.replyTo}isMyMessage={C.isMe}/>}
136
140
 
137
- {P?<Gt imageData={M.imageData}isMe={M.isMe}onLongPress={A}/>:<Be style={{fontSize:C.typography.fontSize.base,color:M.isMe?C.colors.messageBubble.sentText:C.colors.messageBubble.receivedText}}>
138
- {M.text}
139
- </Be>}
141
+ {P?<Do imageData={C.imageData}isMe={C.isMe}onLongPress={A}/>:<Ne style={{fontSize:M.typography.fontSize.base,color:C.isMe?M.colors.messageBubble.sentText:M.colors.messageBubble.receivedText}}>
142
+ {C.text}
143
+ </Ne>}
140
144
 
141
145
  {}
142
- {P&&M.text&&M.text.trim()&&<Bt style={{paddingHorizontal:C.spacing.lg,paddingVertical:C.spacing.md,backgroundColor:M.isMe?C.colors.messageBubble.sent:C.colors.messageBubble.received,borderRadius:C.borderRadius.lg,marginTop:C.spacing.xs}}>
143
- <Be style={{fontSize:C.typography.fontSize.base,color:M.isMe?C.colors.messageBubble.sentText:C.colors.messageBubble.receivedText}}>
144
- {M.text}
145
- </Be>
146
- </Bt>}
147
- </Qr>
146
+ {P&&C.text&&C.text.trim()&&<$t style={{paddingHorizontal:M.spacing.lg,paddingVertical:M.spacing.md,backgroundColor:C.isMe?M.colors.messageBubble.sent:M.colors.messageBubble.received,borderRadius:M.borderRadius.lg,marginTop:M.spacing.xs}}>
147
+ <Ne style={{fontSize:M.typography.fontSize.base,color:C.isMe?M.colors.messageBubble.sentText:M.colors.messageBubble.receivedText}}>
148
+ {C.text}
149
+ </Ne>
150
+ </$t>}
151
+ </Za>
148
152
 
149
153
  {}
150
- {M.reactions&&M.reactions.length>0&&<Zr onPress={I}style={{marginTop:C.spacing.xs,flexDirection:"row",alignItems:"center",backgroundColor:C.colors.background,borderRadius:C.borderRadius.full,justifyContent:M.isMe?"flex-end":"flex-start"}}>
151
- {M.reactions.map((B,E)=><Bt key={`${B.emoji}-${E}`}style={{flexDirection:"row",alignItems:"center",padding:C.spacing.xs}}>
152
- <Be style={{fontSize:C.typography.fontSize.sm}}>
153
- {B.emoji}
154
- </Be>
155
- {B.count>1&&<Be style={{fontSize:C.typography.fontSize.xs,color:C.colors.textSecondary,marginLeft:C.spacing.xs,fontWeight:C.typography.fontWeight.medium}}>
156
- {B.count}
157
- </Be>}
158
- </Bt>)}
159
- </Zr>}
154
+ {C.reactions&&C.reactions.length>0&&<Qa onPress={I}style={{marginTop:M.spacing.xs,flexDirection:"row",alignItems:"center",backgroundColor:M.colors.background,borderRadius:M.borderRadius.full,justifyContent:C.isMe?"flex-end":"flex-start"}}>
155
+ {C.reactions.map((z,E)=><$t key={`${z.emoji}-${E}`}style={{flexDirection:"row",alignItems:"center",padding:M.spacing.xs}}>
156
+ <Ne style={{fontSize:M.typography.fontSize.sm}}>
157
+ {z.emoji}
158
+ </Ne>
159
+ {z.count>1&&<Ne style={{fontSize:M.typography.fontSize.xs,color:M.colors.textSecondary,marginLeft:M.spacing.xs,fontWeight:M.typography.fontWeight.medium}}>
160
+ {z.count}
161
+ </Ne>}
162
+ </$t>)}
163
+ </Qa>}
160
164
 
161
- <Bt style={{marginHorizontal:C.spacing.sm,marginTop:C.spacing.xs,flexDirection:"row",alignItems:"center",justifyContent:M.isMe?"flex-end":"flex-start"}}>
162
- <Be style={{fontSize:C.typography.fontSize.xs,color:C.colors.textSecondary}}>
163
- {Eo(M.timestamp)}
164
- </Be>
165
- {M.isMe&&M.status&&<Bt style={{marginLeft:C.spacing.xs}}>
166
- {M.status==="sent"&&<Be style={{fontSize:C.typography.fontSize.xs,color:C.colors.gray[400]}}>
165
+ <$t style={{marginHorizontal:M.spacing.sm,marginTop:M.spacing.xs,flexDirection:"row",alignItems:"center",justifyContent:C.isMe?"flex-end":"flex-start"}}>
166
+ <Ne style={{fontSize:M.typography.fontSize.xs,color:M.colors.textSecondary}}>
167
+ {Ms(C.timestamp)}
168
+ </Ne>
169
+ {C.isMe&&C.status&&<$t style={{marginLeft:M.spacing.xs}}>
170
+ {C.status==="sent"&&<Ne style={{fontSize:M.typography.fontSize.xs,color:M.colors.gray[400]}}>
167
171
 
168
- </Be>}
169
- {M.status==="delivered"&&<Be style={{fontSize:C.typography.fontSize.xs,color:C.colors.gray[400]}}>
172
+ </Ne>}
173
+ {C.status==="delivered"&&<Ne style={{fontSize:M.typography.fontSize.xs,color:M.colors.gray[400]}}>
170
174
  ✓✓
171
- </Be>}
172
- {M.status==="read"&&<Be style={{fontSize:C.typography.fontSize.xs,color:C.colors.primary}}>
175
+ </Ne>}
176
+ {C.status==="read"&&<Ne style={{fontSize:M.typography.fontSize.xs,color:M.colors.primary}}>
173
177
  ✓✓
174
- </Be>}
175
- </Bt>}
176
- </Bt>
177
- </Bt>},Xt=en;import{View as Ce,Text as _e,TouchableOpacity as Mn,Image as Cn}from"react-native";import{X as Rn}from"lucide-react-native";var Tn=({replyToMessage:M,onCancel:T})=>{let R=q(),C=(I,P=50)=>I.length<=P?I:I.substring(0,P)+"...",S=!!M.replyTo,A=M.type==="image"&&M.imageData;return<Ce style={{borderBottomWidth:1,borderBottomColor:R.colors.border,backgroundColor:R.colors.surface,paddingHorizontal:R.spacing.lg,paddingVertical:R.spacing.md}}>
178
- <Ce style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between"}}>
179
- <Ce style={{flex:1,marginRight:R.spacing.md}}>
180
- <Ce style={{flexDirection:"row",alignItems:"center",marginBottom:R.spacing.xs}}>
181
- <Ce style={{width:4,backgroundColor:R.colors.primary,borderRadius:R.borderRadius.full,marginRight:R.spacing.md,height:S?48:32}}/>
182
- <Ce style={{flex:1}}>
183
- <_e style={{fontSize:R.typography.fontSize.xs,fontWeight:R.typography.fontWeight.medium,color:R.colors.primary,marginBottom:R.spacing.xs}}>
184
- Replying to {M.isMe?"yourself":M.senderName||"sender"}
178
+ </Ne>}
179
+ </$t>}
180
+ </$t>
181
+ </$t>},Oo=er;import{View as De,Text as Pt,TouchableOpacity as Cr,Image as Mr}from"react-native";import{X as Rr}from"lucide-react-native";var Tr=({replyToMessage:C,onCancel:T})=>{let R=q(),M=(I,P=50)=>I.length<=P?I:I.substring(0,P)+"...",S=!!C.replyTo,A=C.type==="image"&&C.imageData;return<De style={{borderBottomWidth:1,borderBottomColor:R.colors.border,backgroundColor:R.colors.surface,paddingHorizontal:R.spacing.lg,paddingVertical:R.spacing.md}}>
182
+ <De style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between"}}>
183
+ <De style={{flex:1,marginRight:R.spacing.md}}>
184
+ <De style={{flexDirection:"row",alignItems:"center",marginBottom:R.spacing.xs}}>
185
+ <De style={{width:4,backgroundColor:R.colors.primary,borderRadius:R.borderRadius.full,marginRight:R.spacing.md,height:S?48:32}}/>
186
+ <De style={{flex:1}}>
187
+ <Pt style={{fontSize:R.typography.fontSize.xs,fontWeight:R.typography.fontWeight.medium,color:R.colors.primary,marginBottom:R.spacing.xs}}>
188
+ Replying to {C.isMe?"yourself":C.senderName||"sender"}
185
189
  {S&&" (reply thread)"}
186
- </_e>
190
+ </Pt>
187
191
 
188
192
  {}
189
- {S&&<Ce style={{marginBottom:R.spacing.sm,padding:R.spacing.sm,backgroundColor:R.colors.surfaceSecondary,borderRadius:R.borderRadius.md,borderLeftWidth:2,borderLeftColor:R.colors.gray[300]}}>
190
- <_e style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,marginBottom:R.spacing.xs}}>
191
- Originally replying to: {M.replyTo.isMe?"yourself":M.replyTo.senderName||"sender"}
192
- </_e>
193
- <_e style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,lineHeight:R.typography.lineHeight.tight}}>
194
- {C(M.replyTo.text,40)}
195
- </_e>
196
- </Ce>}
193
+ {S&&<De style={{marginBottom:R.spacing.sm,padding:R.spacing.sm,backgroundColor:R.colors.surfaceSecondary,borderRadius:R.borderRadius.md,borderLeftWidth:2,borderLeftColor:R.colors.gray[300]}}>
194
+ <Pt style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,marginBottom:R.spacing.xs}}>
195
+ Originally replying to: {C.replyTo.isMe?"yourself":C.replyTo.senderName||"sender"}
196
+ </Pt>
197
+ <Pt style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,lineHeight:R.typography.lineHeight.tight}}>
198
+ {M(C.replyTo.text,40)}
199
+ </Pt>
200
+ </De>}
197
201
 
198
- {A?<Ce style={{flexDirection:"row",alignItems:"center"}}>
199
- <Cn source={{uri:M.imageData.uri}}style={{width:32,height:32,borderRadius:R.borderRadius.sm,marginRight:R.spacing.sm}}resizeMode="cover"/>
200
- <Ce style={{flex:1}}>
201
- <_e style={{fontSize:R.typography.fontSize.xs,color:R.colors.gray[600],fontStyle:"italic",marginBottom:R.spacing.xs}}>
202
+ {A?<De style={{flexDirection:"row",alignItems:"center"}}>
203
+ <Mr source={{uri:C.imageData.uri}}style={{width:32,height:32,borderRadius:R.borderRadius.sm,marginRight:R.spacing.sm}}resizeMode="cover"/>
204
+ <De style={{flex:1}}>
205
+ <Pt style={{fontSize:R.typography.fontSize.xs,color:R.colors.gray[600],fontStyle:"italic",marginBottom:R.spacing.xs}}>
202
206
  📷 Image
203
- </_e>
204
- {M.text&&M.text.trim()&&<_e style={{fontSize:R.typography.fontSize.sm,color:R.colors.gray[700],lineHeight:R.typography.lineHeight.tight}}>
205
- {C(M.text,40)}
206
- </_e>}
207
- </Ce>
208
- </Ce>:<_e style={{fontSize:R.typography.fontSize.sm,color:R.colors.gray[700],lineHeight:R.typography.lineHeight.tight}}>
209
- {C(M.text)}
210
- </_e>}
211
- </Ce>
212
- </Ce>
213
- </Ce>
207
+ </Pt>
208
+ {C.text&&C.text.trim()&&<Pt style={{fontSize:R.typography.fontSize.sm,color:R.colors.gray[700],lineHeight:R.typography.lineHeight.tight}}>
209
+ {M(C.text,40)}
210
+ </Pt>}
211
+ </De>
212
+ </De>:<Pt style={{fontSize:R.typography.fontSize.sm,color:R.colors.gray[700],lineHeight:R.typography.lineHeight.tight}}>
213
+ {M(C.text)}
214
+ </Pt>}
215
+ </De>
216
+ </De>
217
+ </De>
214
218
 
215
- <Mn onPress={T}style={{height:32,width:32,alignItems:"center",justifyContent:"center",borderRadius:R.borderRadius.full,backgroundColor:R.colors.gray[200]}}hitSlop={{top:8,bottom:8,left:8,right:8}}>
216
- <Rn size={16}color={R.colors.textSecondary}/>
217
- </Mn>
218
- </Ce>
219
- </Ce>},Vt=Tn;import{useRef as Ve,useState as Fs,useEffect as Wo}from"react";import{View as Dt,Text as Ze,TouchableOpacity as Qe,StyleSheet as Ho,Pressable as Pn,ScrollView as An,Dimensions as zn,Animated as ue,Image as Bn}from"react-native";import{Reply as Vn,Copy as Dn,Plus as Ln,Trash2 as En}from"lucide-react-native";import{useState as Sn,useEffect as wn}from"react";import In from"rn-emoji-keyboard";var vn=({visible:M,onClose:T,onEmojiSelected:R})=>{let[C,S]=Sn(!1);wn(()=>{S(!!M)},[M]);let A=P=>{console.log("Selected emoji:",P),R(P.emoji),S(!1),T()},I=()=>{S(!1),T()};return M?<In onEmojiSelected={A}open={C}onClose={I}enableSearchBar/>:null},Je=vn;var On=({visible:M,onPress:T,children:R})=>M?<Dt style={se.overlay}>
220
- <Qe style={se.backdrop}onPress={T}activeOpacity={1}/>
219
+ <Cr onPress={T}style={{height:32,width:32,alignItems:"center",justifyContent:"center",borderRadius:R.borderRadius.full,backgroundColor:R.colors.gray[200]}}hitSlop={{top:8,bottom:8,left:8,right:8}}>
220
+ <Rr size={16}color={R.colors.textSecondary}/>
221
+ </Cr>
222
+ </De>
223
+ </De>},Yt=Tr;import{useRef as We,useState as Sn,useEffect as Is}from"react";import{View as Gt,Text as Bt,TouchableOpacity as Vt,StyleSheet as Ss,Pressable as Pr,ScrollView as Ar,Dimensions as zr,Animated as Se,Image as Vr}from"react-native";import{Reply as Br,Copy as Dr,Plus as Lr,Trash2 as Er}from"lucide-react-native";import{useState as Sr,useEffect as wr}from"react";import Ir from"rn-emoji-keyboard";var vr=({visible:C,onClose:T,onEmojiSelected:R})=>{let[M,S]=Sr(!1);wr(()=>{S(!!C)},[C]);let A=P=>{console.log("Selected emoji:",P),R(P.emoji),S(!1),T()},I=()=>{S(!1),T()};return C?<Ir onEmojiSelected={A}open={M}onClose={I}enableSearchBar/>:null},At=vr;var Or=({visible:C,onPress:T,children:R})=>C?<Gt style={ne.overlay}>
224
+ <Vt style={ne.backdrop}onPress={T}activeOpacity={1}/>
221
225
  {R}
222
- </Dt>:null,{width:Xe,height:No}=zn.get("window"),Fn=({message:M,positions:T,messagePosition:R,containerRef:C,containerOffset:S,setContainerOffset:A})=>{let I=q(),P=Ve(new ue.Value(R.y)).current,B=Ve(new ue.Value(0)).current,E=Ve(!1),v=M.type==="image"&&M.imageData;return Wo(()=>{E.current=!1,C.current&&C.current.measureInWindow((V,D,z,L)=>{A({x:V,y:D});let k=R.y-D,O=T.messagePreviewTop-D;P.setValue(k),B.setValue(0),requestAnimationFrame(()=>{ue.parallel([ue.timing(P,{toValue:O,duration:250,useNativeDriver:!1}),ue.timing(B,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{E.current=!0})})})},[T.messagePreviewTop,R.y,C]),<ue.View style={{position:"absolute",top:P,left:R.x,width:R.width,height:M.replyTo?R.height+10:R.height,zIndex:1e3,opacity:B,maxWidth:v?"75%":"80%",borderRadius:v?I.borderRadius.lg:I.borderRadius.xl,paddingHorizontal:v?0:I.spacing.lg,paddingVertical:v?0:I.spacing.md,backgroundColor:v?"transparent":M.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,overflow:"hidden"}}>
223
- {M.replyTo&&<Ye replyTo={M.replyTo}isMyMessage={M.isMe}/>}
226
+ </Gt>:null,{width:zt,height:ws}=zr.get("window"),Fr=({message:C,positions:T,messagePosition:R,containerRef:M,containerOffset:S,setContainerOffset:A})=>{let I=q(),P=We(new Se.Value(R.y)).current,z=We(new Se.Value(0)).current,E=We(!1),v=C.type==="image"&&C.imageData;return Is(()=>{E.current=!1,M.current&&M.current.measureInWindow((k,D,V,B)=>{A({x:k,y:D});let L=R.y-D,F=T.messagePreviewTop-D;P.setValue(L),z.setValue(0),requestAnimationFrame(()=>{Se.parallel([Se.timing(P,{toValue:F,duration:250,useNativeDriver:!1}),Se.timing(z,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{E.current=!0})})})},[T.messagePreviewTop,R.y,M]),<Se.View style={{position:"absolute",top:P,left:R.x,width:R.width,height:C.replyTo?R.height+10:R.height,zIndex:1e3,opacity:z,maxWidth:v?"75%":"80%",borderRadius:v?I.borderRadius.lg:I.borderRadius.xl,paddingHorizontal:v?0:I.spacing.lg,paddingVertical:v?0:I.spacing.md,backgroundColor:v?"transparent":C.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,overflow:"hidden"}}>
227
+ {C.replyTo&&<It replyTo={C.replyTo}isMyMessage={C.isMe}/>}
224
228
 
225
- {v?<Dt>
226
- <Bn source={{uri:M.imageData.uri}}style={{width:R.width,height:R.height,borderRadius:I.borderRadius.lg}}resizeMode='cover'/>
229
+ {v?<Gt>
230
+ <Vr source={{uri:C.imageData.uri}}style={{width:R.width,height:R.height,borderRadius:I.borderRadius.lg}}resizeMode='cover'/>
227
231
  {}
228
- {M.text&&M.text.trim()&&<Dt style={{paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,backgroundColor:M.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,borderRadius:I.borderRadius.lg,marginTop:I.spacing.xs}}>
229
- <Ze style={{fontSize:I.typography.fontSize.base,color:M.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
230
- {M.text}
231
- </Ze>
232
- </Dt>}
233
- </Dt>:<Ze style={{fontSize:I.typography.fontSize.base,color:M.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
234
- {M.text}
235
- </Ze>}
236
- </ue.View>},Hn=({visible:M,onClose:T,isMyMessage:R,selectedMessage:C,messagePosition:S,onActionPress:A,onEmojiReact:I})=>{let[P,B]=Fs(!1),E=Ve(null),[v,V]=Fs({x:0,y:0}),D=Ve(new ue.Value(0)).current,z=Ve(new ue.Value(0)).current,L=Ve(!1),k=Ve(!1),O=X=>{A(X),T()},F=X=>{I?.(X),T()},H=()=>{B(!0)},N=()=>{B(!1)},j=X=>{I?.(X),B(!1),T()},J=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],Y=(()=>{if(!S)return{emojiBar:{top:No/2-200,left:Xe/2-160},actionMenu:{top:No/2+50,left:Xe/2-100}};let X=320,le=60,me=200,re=160,Z=20,W=8,ce,ye,he,ne,ge,xe=No/2,ee=le+W+S.height+W+re,Se=xe-ee/2;return ye=Se,ge=Se+le+W,ne=Se+le+W+S.height+W,ce=S.x,he=S.x,ce+X>Xe-Z&&(ce=Xe-X-Z),ce<Z&&(ce=Z),he+me>Xe-Z&&(he=Xe-me-Z),he<Z&&(he=Z),{emojiBar:{top:ye,left:ce},actionMenu:{top:ne,left:he},messagePreviewTop:ge,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return Wo(()=>{M&&S&&!k.current&&(D.setValue(0),z.setValue(0),setTimeout(()=>{ue.sequence([ue.timing(D,{toValue:1,duration:200,useNativeDriver:!1}),ue.timing(z,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{k.current=!0})},50))},[M,S,D,z]),Wo(()=>{M||(L.current=!1,k.current=!1,D.setValue(0),z.setValue(0))},[M,D,z]),M?<>
232
+ {C.text&&C.text.trim()&&<Gt style={{paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,backgroundColor:C.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,borderRadius:I.borderRadius.lg,marginTop:I.spacing.xs}}>
233
+ <Bt style={{fontSize:I.typography.fontSize.base,color:C.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
234
+ {C.text}
235
+ </Bt>
236
+ </Gt>}
237
+ </Gt>:<Bt style={{fontSize:I.typography.fontSize.base,color:C.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
238
+ {C.text}
239
+ </Bt>}
240
+ </Se.View>},Hr=({visible:C,onClose:T,isMyMessage:R,selectedMessage:M,messagePosition:S,onActionPress:A,onEmojiReact:I})=>{let P=Pe(),[z,E]=Sn(!1),v=We(null),[k,D]=Sn({x:0,y:0}),V=We(new Se.Value(0)).current,B=We(new Se.Value(0)).current,L=We(!1),F=We(!1),j=Z=>{A(Z),T()},H=Z=>{I?.(Z),T()},N=()=>{E(!0)},O=()=>{E(!1)},_=Z=>{I?.(Z),E(!1),T()},re=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],Ce=(()=>{if(!S)return{emojiBar:{top:ws/2-200,left:zt/2-160},actionMenu:{top:ws/2+50,left:zt/2-100}};let Z=320,ae=60,oe=200,we=160,W=20,Ie=8,Me,Ge,Q,ve,ze,ee=ws/2,Tt=ae+Ie+S.height+Ie+we,_e=ee-Tt/2;return Ge=_e,ze=_e+ae+Ie,ve=_e+ae+Ie+S.height+Ie,Me=S.x,Q=S.x,Me+Z>zt-W&&(Me=zt-Z-W),Me<W&&(Me=W),Q+oe>zt-W&&(Q=zt-oe-W),Q<W&&(Q=W),{emojiBar:{top:Ge,left:Me},actionMenu:{top:ve,left:Q},messagePreviewTop:ze,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return Is(()=>{C&&S&&!F.current&&(V.setValue(0),B.setValue(0),setTimeout(()=>{Se.sequence([Se.timing(V,{toValue:1,duration:200,useNativeDriver:!1}),Se.timing(B,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{F.current=!0})},50))},[C,S,V,B]),Is(()=>{C||(L.current=!1,F.current=!1,V.setValue(0),B.setValue(0))},[C,V,B]),C?<>
237
241
  {}
238
- <On visible={!0}onPress={T}>
239
- <Pn style={se.overlayPressable}onPress={T}/>
240
- </On>
242
+ <Or visible={!0}onPress={T}>
243
+ <Pr style={ne.overlayPressable}onPress={T}/>
244
+ </Or>
241
245
 
242
- <Dt ref={E}style={{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}>
246
+ <Gt ref={v}style={{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}>
243
247
  {}
244
- </Dt>
248
+ </Gt>
245
249
 
246
250
  {}
247
- {S&&C&&<Fn message={C}positions={Y}messagePosition={S}containerRef={E}containerOffset={v}setContainerOffset={V}/>}
251
+ {S&&M&&<Fr message={M}positions={Ce}messagePosition={S}containerRef={v}containerOffset={k}setContainerOffset={D}/>}
248
252
 
249
253
  {}
250
- <ue.View style={[se.emojiBar,{position:"absolute",top:Y.emojiBar.top-(v.y||0),left:Y.emojiBar.left,opacity:D,pointerEvents:"auto"}]}>
251
- <An horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={se.emojiContainer}>
252
- {J.map((X,le)=><Qe key={le}style={se.emojiButton}onPress={()=>F(X)}>
253
- <Ze style={se.emojiText}>{X}</Ze>
254
- </Qe>)}
255
- <Qe style={se.addEmojiButton}onPress={H}>
256
- <Ln size={20}color='#666'/>
257
- </Qe>
258
- </An>
259
- </ue.View>
254
+ <Se.View style={[ne.emojiBar,{position:"absolute",top:Ce.emojiBar.top-(k.y||0),left:Ce.emojiBar.left,opacity:V,pointerEvents:"auto"}]}>
255
+ <Ar horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={ne.emojiContainer}>
256
+ {re.map((Z,ae)=><Vt key={ae}style={ne.emojiButton}onPress={()=>H(Z)}>
257
+ <Bt style={ne.emojiText}>{Z}</Bt>
258
+ </Vt>)}
259
+ <Vt style={ne.addEmojiButton}onPress={N}>
260
+ <Lr size={20}color='#666'/>
261
+ </Vt>
262
+ </Ar>
263
+ </Se.View>
260
264
 
261
265
  {}
262
- <ue.View style={[se.actionMenu,{position:"absolute",top:Y.actionMenu.top-(v.y||0)+(C?.replyTo?10:0),left:Y.actionMenu.left,opacity:z,pointerEvents:"auto"}]}>
263
- <Dt style={se.actionItems}>
266
+ <Se.View style={[ne.actionMenu,{position:"absolute",top:Ce.actionMenu.top-(k.y||0)+(M?.replyTo?10:0),left:Ce.actionMenu.left,opacity:B,pointerEvents:"auto"}]}>
267
+ <Gt style={ne.actionItems}>
264
268
  {}
265
- <Qe style={se.actionRow}onPress={()=>O("reply")}>
266
- <Vn size={18}color='#333'/>
267
- <Ze style={se.actionLabel}>Reply</Ze>
268
- </Qe>
269
+ <Vt style={ne.actionRow}onPress={()=>j("reply")}>
270
+ <Br size={18}color='#333'/>
271
+ <Bt style={ne.actionLabel}>{P("action.reply")}</Bt>
272
+ </Vt>
269
273
 
270
274
  {}
271
- <Qe style={se.actionRow}onPress={()=>O("copy")}>
272
- <Dn size={18}color='#333'/>
273
- <Ze style={se.actionLabel}>Copy</Ze>
274
- </Qe>
275
+ <Vt style={ne.actionRow}onPress={()=>j("copy")}>
276
+ <Dr size={18}color='#333'/>
277
+ <Bt style={ne.actionLabel}>{P("action.copy")}</Bt>
278
+ </Vt>
275
279
 
276
280
  {}
277
- {R&&<Qe style={se.actionRow}onPress={()=>O("delete")}>
278
- <En size={18}color='#ff4444'/>
279
- <Ze style={[se.actionLabel,{color:"#ff4444"}]}>
280
- Delete
281
- </Ze>
282
- </Qe>}
283
- </Dt>
284
- </ue.View>
281
+ {R&&<Vt style={ne.actionRow}onPress={()=>j("delete")}>
282
+ <Er size={18}color='#ff4444'/>
283
+ <Bt style={[ne.actionLabel,{color:"#ff4444"}]}>
284
+ {P("action.delete")}
285
+ </Bt>
286
+ </Vt>}
287
+ </Gt>
288
+ </Se.View>
285
289
 
286
290
  {}
287
- <Je visible={P}onClose={N}onEmojiSelected={j}/>
288
- </>:null},se=Ho.create({spotlightOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},overlayPressable:{flex:1,backgroundColor:"transparent"},emojiBar:{backgroundColor:"white",borderRadius:25,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.25,shadowRadius:12,elevation:12,zIndex:1001,maxWidth:320},emojiContainer:{flexDirection:"row",alignItems:"center",paddingHorizontal:4},emojiButton:{width:36,height:36,borderRadius:18,backgroundColor:"#f8f9fa",justifyContent:"center",alignItems:"center",marginHorizontal:3},emojiText:{fontSize:18},addEmojiButton:{width:36,height:36,borderRadius:18,backgroundColor:"#f8f9fa",justifyContent:"center",alignItems:"center",marginHorizontal:3},actionMenu:{backgroundColor:"white",borderRadius:12,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.25,shadowRadius:12,elevation:12,zIndex:1001,minWidth:160,maxWidth:200},actionItems:{paddingVertical:4},actionRow:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,minHeight:44},actionLabel:{fontSize:15,color:"#333",marginLeft:12,fontWeight:"500"},hiddenEmojiInput:{position:"absolute",left:-9999,opacity:0,height:0,width:0},overlay:{...Ho.absoluteFillObject,zIndex:1e3},backdrop:{...Ho.absoluteFillObject,backgroundColor:"rgba(0, 0, 0, 0.8)"}}),Qt=Hn;import{useRef as Nn,useEffect as Wn,useState as Un}from"react";import{View as De,Text as Re,TouchableOpacity as Hs,ScrollView as Kn,StyleSheet as qn}from"react-native";import $n from"react-native-actions-sheet";var Yn=({visible:M,onClose:T,reactions:R,messageText:C,onAddReaction:S,onRemoveReaction:A})=>{let I=Nn(null),[P,B]=Un(!1);Wn(()=>{M?I.current?.show():I.current?.hide()},[M]);let v=(()=>{let F=[];return R.forEach(H=>{let N=[{id:"1",name:"You",avatar:"\u{1F464}"},{id:"2",name:"Anna",avatar:"\u{1F469}"},{id:"3",name:"Young Beetle",avatar:"\u{1F697}"},{id:"4",name:"Lele",avatar:"\u{1F3AD}"},{id:"5",name:"Needle",avatar:"\u{1F3E0}"}];for(let j=0;j<Math.min(H.count,N.length);j++)F.push({id:`${H.emoji}-${j}`,name:N[j].name,avatar:N[j].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),F})(),V=R.reduce((F,H)=>F+H.count,0),D=F=>{console.log("Remove reaction called with:",F),console.log("onRemoveReaction prop exists:",!!A),console.log("User is current user:",F.name==="You"),F.name==="You"&&A?(console.log("Calling onRemoveReaction with emoji:",F.emoji),A(F.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:F.name==="You",hasCallback:!!A})},z=()=>{I.current?.hide(),T(),setTimeout(()=>{B(!0)},300)},L=()=>{B(!1)},k=F=>{console.log("Selected emoji from picker:",F),S?.(F),B(!1),T()},O=()=>{I.current?.hide(),T()};return<>
289
- <$n ref={I}onClose={O}containerStyle={_.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
291
+ <At visible={z}onClose={O}onEmojiSelected={_}/>
292
+ </>:null},ne=Ss.create({spotlightOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},overlayPressable:{flex:1,backgroundColor:"transparent"},emojiBar:{backgroundColor:"white",borderRadius:25,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.25,shadowRadius:12,elevation:12,zIndex:1001,maxWidth:320},emojiContainer:{flexDirection:"row",alignItems:"center",paddingHorizontal:4},emojiButton:{width:36,height:36,borderRadius:18,backgroundColor:"#f8f9fa",justifyContent:"center",alignItems:"center",marginHorizontal:3},emojiText:{fontSize:18},addEmojiButton:{width:36,height:36,borderRadius:18,backgroundColor:"#f8f9fa",justifyContent:"center",alignItems:"center",marginHorizontal:3},actionMenu:{backgroundColor:"white",borderRadius:12,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.25,shadowRadius:12,elevation:12,zIndex:1001,minWidth:160,maxWidth:200},actionItems:{paddingVertical:4},actionRow:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,minHeight:44},actionLabel:{fontSize:15,color:"#333",marginLeft:12,fontWeight:"500"},hiddenEmojiInput:{position:"absolute",left:-9999,opacity:0,height:0,width:0},overlay:{...Ss.absoluteFillObject,zIndex:1e3},backdrop:{...Ss.absoluteFillObject,backgroundColor:"rgba(0, 0, 0, 0.8)"}}),Fo=Hr;import{useRef as Nr,useEffect as Wr,useState as Ur}from"react";import{View as Ue,Text as Le,TouchableOpacity as In,ScrollView as Kr,StyleSheet as qr}from"react-native";import $r from"react-native-actions-sheet";var Yr=({visible:C,onClose:T,reactions:R,messageText:M,onAddReaction:S,onRemoveReaction:A})=>{let I=Nr(null),[P,z]=Ur(!1);Wr(()=>{C?I.current?.show():I.current?.hide()},[C]);let v=(()=>{let j=[];return R.forEach(H=>{let N=[{id:"1",name:"You",avatar:"\u{1F464}"},{id:"2",name:"Anna",avatar:"\u{1F469}"},{id:"3",name:"Young Beetle",avatar:"\u{1F697}"},{id:"4",name:"Lele",avatar:"\u{1F3AD}"},{id:"5",name:"Needle",avatar:"\u{1F3E0}"}];for(let O=0;O<Math.min(H.count,N.length);O++)j.push({id:`${H.emoji}-${O}`,name:N[O].name,avatar:N[O].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),j})(),k=R.reduce((j,H)=>j+H.count,0),D=j=>{console.log("Remove reaction called with:",j),console.log("onRemoveReaction prop exists:",!!A),console.log("User is current user:",j.name==="You"),j.name==="You"&&A?(console.log("Calling onRemoveReaction with emoji:",j.emoji),A(j.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:j.name==="You",hasCallback:!!A})},V=()=>{I.current?.hide(),T(),setTimeout(()=>{z(!0)},300)},B=()=>{z(!1)},L=j=>{console.log("Selected emoji from picker:",j),S?.(j),z(!1),T()},F=()=>{I.current?.hide(),T()};return<>
293
+ <$r ref={I}onClose={F}containerStyle={G.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
290
294
  {}
291
- <De style={_.header}>
292
- <Re style={_.title}>{V} reactions</Re>
293
- <Hs onPress={O}style={_.closeButton}>
294
- <Re style={_.closeText}>✕</Re>
295
- </Hs>
296
- </De>
295
+ <Ue style={G.header}>
296
+ <Le style={G.title}>{k} reactions</Le>
297
+ <In onPress={F}style={G.closeButton}>
298
+ <Le style={G.closeText}>✕</Le>
299
+ </In>
300
+ </Ue>
297
301
 
298
302
  {}
299
- <De style={_.messagePreview}>
300
- <Re style={_.messageText}numberOfLines={2}>
301
- {C}
302
- </Re>
303
- </De>
303
+ <Ue style={G.messagePreview}>
304
+ <Le style={G.messageText}numberOfLines={2}>
305
+ {M}
306
+ </Le>
307
+ </Ue>
304
308
 
305
309
  {}
306
- <De style={_.reactionButtons}>
310
+ <Ue style={G.reactionButtons}>
307
311
  {}
308
312
 
309
- {R.map((F,H)=><De key={H}style={_.reactionButton}>
310
- <Re style={_.reactionEmoji}>{F.emoji}</Re>
311
- <Re style={_.reactionCount}>{F.count}</Re>
312
- </De>)}
313
- </De>
313
+ {R.map((j,H)=><Ue key={H}style={G.reactionButton}>
314
+ <Le style={G.reactionEmoji}>{j.emoji}</Le>
315
+ <Le style={G.reactionCount}>{j.count}</Le>
316
+ </Ue>)}
317
+ </Ue>
314
318
 
315
319
  {}
316
- <Kn style={_.userReactionsList}showsVerticalScrollIndicator={!1}>
317
- {v.map(F=>{let H=F.name==="You",N=H?Hs:De;return<N key={F.id}style={[_.userReactionItem,H&&_.tappableUserReactionItem]}onPress={H?()=>D(F):void 0}activeOpacity={H?.7:1}>
318
- <De style={_.userInfo}>
319
- <Re style={_.userAvatar}>{F.avatar}</Re>
320
- <De style={_.userDetails}>
321
- <Re style={_.userName}>{F.name}</Re>
322
- {H&&<Re style={_.removeText}>Tap to remove</Re>}
323
- </De>
324
- </De>
325
- <De style={_.userReactionEmoji}>
326
- <Re style={_.emojiText}>{F.emoji}</Re>
327
- </De>
320
+ <Kr style={G.userReactionsList}showsVerticalScrollIndicator={!1}>
321
+ {v.map(j=>{let H=j.name==="You",N=H?In:Ue;return<N key={j.id}style={[G.userReactionItem,H&&G.tappableUserReactionItem]}onPress={H?()=>D(j):void 0}activeOpacity={H?.7:1}>
322
+ <Ue style={G.userInfo}>
323
+ <Le style={G.userAvatar}>{j.avatar}</Le>
324
+ <Ue style={G.userDetails}>
325
+ <Le style={G.userName}>{j.name}</Le>
326
+ {H&&<Le style={G.removeText}>Tap to remove</Le>}
327
+ </Ue>
328
+ </Ue>
329
+ <Ue style={G.userReactionEmoji}>
330
+ <Le style={G.emojiText}>{j.emoji}</Le>
331
+ </Ue>
328
332
  </N>})}
329
- </Kn>
330
- </$n>
333
+ </Kr>
334
+ </$r>
331
335
 
332
336
  {}
333
- <Je visible={P}onClose={L}onEmojiSelected={k}/>
334
- </>},_=qn.create({container:{backgroundColor:"white",borderTopLeftRadius:20,borderTopRightRadius:20,paddingTop:20,paddingBottom:40,maxHeight:"70%"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:20,paddingBottom:15,borderBottomWidth:1,borderBottomColor:"#f0f0f0"},title:{fontSize:18,fontWeight:"600",color:"#333"},closeButton:{padding:5},closeText:{fontSize:18,color:"#666",fontWeight:"500"},messagePreview:{paddingHorizontal:20,paddingVertical:15,borderBottomWidth:1,borderBottomColor:"#f0f0f0"},messageText:{fontSize:14,color:"#666",lineHeight:20},reactionButtons:{flexDirection:"row",paddingHorizontal:20,paddingVertical:15,gap:10},addReactionButton:{flexDirection:"row",alignItems:"center",backgroundColor:"#f8f9fa",borderWidth:1,borderColor:"#e9ecef",borderRadius:20,paddingHorizontal:12,paddingVertical:8},addReactionIcon:{fontSize:16,marginRight:4},addReactionText:{fontSize:14,color:"#666",fontWeight:"500"},reactionButton:{flexDirection:"row",alignItems:"center",backgroundColor:"#28a745",borderRadius:20,paddingHorizontal:12,paddingVertical:8},reactionEmoji:{fontSize:16,marginRight:4},reactionCount:{fontSize:14,color:"white",fontWeight:"600"},userReactionsList:{paddingHorizontal:20,paddingTop:10},userReactionItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderBottomWidth:1,borderBottomColor:"#f8f9fa"},tappableUserReactionItem:{backgroundColor:"#f8f9fa",borderRadius:8,paddingHorizontal:8,marginVertical:2},userInfo:{flexDirection:"row",alignItems:"center",flex:1},userAvatar:{fontSize:24,marginRight:12},userDetails:{flex:1},userName:{fontSize:16,fontWeight:"500",color:"#333"},removeText:{fontSize:12,color:"#dc3545",marginTop:2,fontWeight:"500"},userReactionEmoji:{backgroundColor:"#f8f9fa",borderRadius:16,paddingHorizontal:8,paddingVertical:4},emojiText:{fontSize:16}}),Zt=Yn;import Gn,{forwardRef as _n,useImperativeHandle as Jn}from"react";import{View as Mo,Text as Ns,TouchableOpacity as Ws}from"react-native";import Xn from"react-native-actions-sheet";import{X as Qn}from"lucide-react-native";var We=_n(({onOptionSelect:M,options:T},R)=>{let C=Gn.useRef(null);Jn(R,()=>({show:()=>C.current?.show(),hide:()=>C.current?.hide()}));let S=A=>{M(A),C.current?.hide()};return<Xn ref={C}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
335
- <Mo style={{padding:20,width:"100%"}}>
337
+ <At visible={P}onClose={B}onEmojiSelected={L}/>
338
+ </>},G=qr.create({container:{backgroundColor:"white",borderTopLeftRadius:20,borderTopRightRadius:20,paddingTop:20,paddingBottom:40,maxHeight:"70%"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:20,paddingBottom:15,borderBottomWidth:1,borderBottomColor:"#f0f0f0"},title:{fontSize:18,fontWeight:"600",color:"#333"},closeButton:{padding:5},closeText:{fontSize:18,color:"#666",fontWeight:"500"},messagePreview:{paddingHorizontal:20,paddingVertical:15,borderBottomWidth:1,borderBottomColor:"#f0f0f0"},messageText:{fontSize:14,color:"#666",lineHeight:20},reactionButtons:{flexDirection:"row",paddingHorizontal:20,paddingVertical:15,gap:10},addReactionButton:{flexDirection:"row",alignItems:"center",backgroundColor:"#f8f9fa",borderWidth:1,borderColor:"#e9ecef",borderRadius:20,paddingHorizontal:12,paddingVertical:8},addReactionIcon:{fontSize:16,marginRight:4},addReactionText:{fontSize:14,color:"#666",fontWeight:"500"},reactionButton:{flexDirection:"row",alignItems:"center",backgroundColor:"#28a745",borderRadius:20,paddingHorizontal:12,paddingVertical:8},reactionEmoji:{fontSize:16,marginRight:4},reactionCount:{fontSize:14,color:"white",fontWeight:"600"},userReactionsList:{paddingHorizontal:20,paddingTop:10},userReactionItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderBottomWidth:1,borderBottomColor:"#f8f9fa"},tappableUserReactionItem:{backgroundColor:"#f8f9fa",borderRadius:8,paddingHorizontal:8,marginVertical:2},userInfo:{flexDirection:"row",alignItems:"center",flex:1},userAvatar:{fontSize:24,marginRight:12},userDetails:{flex:1},userName:{fontSize:16,fontWeight:"500",color:"#333"},removeText:{fontSize:12,color:"#dc3545",marginTop:2,fontWeight:"500"},userReactionEmoji:{backgroundColor:"#f8f9fa",borderRadius:16,paddingHorizontal:8,paddingVertical:4},emojiText:{fontSize:16}}),Ho=Yr;import Gr,{forwardRef as _r,useImperativeHandle as Jr}from"react";import{View as No,Text as Pn,TouchableOpacity as An}from"react-native";import Xr from"react-native-actions-sheet";import{X as Zr}from"lucide-react-native";var Ct=_r(({onOptionSelect:C,options:T},R)=>{let M=Gr.useRef(null);Jr(R,()=>({show:()=>M.current?.show(),hide:()=>M.current?.hide()}));let S=A=>{C(A),M.current?.hide()};return<Xr ref={M}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
339
+ <No style={{padding:20,width:"100%"}}>
336
340
 
337
341
  {}
338
- <Mo style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:20}}>
339
- <Ns style={{fontSize:18,fontWeight:"600",color:"#1F2937"}}>
342
+ <No style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:20}}>
343
+ <Pn style={{fontSize:18,fontWeight:"600",color:"#1F2937"}}>
340
344
  Share Content
341
- </Ns>
342
- <Ws onPress={()=>C.current?.hide()}>
343
- <Qn size={24}color="#6B7280"/>
344
- </Ws>
345
- </Mo>
345
+ </Pn>
346
+ <An onPress={()=>M.current?.hide()}>
347
+ <Zr size={24}color="#6B7280"/>
348
+ </An>
349
+ </No>
346
350
 
347
351
  {}
348
- <Mo style={{flexDirection:"row",flexWrap:"wrap",justifyContent:"space-between",paddingBottom:20}}>
349
- {T.map(A=>{let I=A.icon;return<Ws key={A.id}style={{width:"30%",aspectRatio:1,marginBottom:20,alignItems:"center",justifyContent:"center"}}onPress={()=>S(A.id)}>
350
- <Mo style={{width:60,height:60,borderRadius:30,backgroundColor:"#F3F4F6",alignItems:"center",justifyContent:"center",marginBottom:8}}>
352
+ <No style={{flexDirection:"row",flexWrap:"wrap",justifyContent:"space-between",paddingBottom:20}}>
353
+ {T.map(A=>{let I=A.icon;return<An key={A.id}style={{width:"30%",aspectRatio:1,marginBottom:20,alignItems:"center",justifyContent:"center"}}onPress={()=>S(A.id)}>
354
+ <No style={{width:60,height:60,borderRadius:30,backgroundColor:"#F3F4F6",alignItems:"center",justifyContent:"center",marginBottom:8}}>
351
355
  <I size={24}color={A.color}/>
352
- </Mo>
353
- <Ns style={{fontSize:12,color:"#6B7280",textAlign:"center",fontWeight:"500"}}>
356
+ </No>
357
+ <Pn style={{fontSize:12,color:"#6B7280",textAlign:"center",fontWeight:"500"}}>
354
358
  {A.label}
355
- </Ns>
356
- </Ws>})}
357
- </Mo>
358
- </Mo>
359
- </Xn>});We.displayName="AttachmentMenu";import{useEffect as Zn,useRef as ea}from"react";import{View as Uo,StyleSheet as ta,Animated as ke}from"react-native";var oa=({isVisible:M})=>{let T=ea(new ke.Value(0)).current;return Zn(()=>{if(!M){T.setValue(0);return}let R=ke.loop(ke.sequence([ke.timing(T,{toValue:1,duration:1200,useNativeDriver:!0}),ke.timing(T,{toValue:0,duration:1200,useNativeDriver:!0})]));return R.start(),()=>{R.stop()}},[M,T]),M?<Uo style={et.container}>
360
- <Uo style={et.bubble}>
361
- <Uo style={et.dotsContainer}>
362
- <ke.View style={[et.dot,{opacity:T.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
363
- <ke.View style={[et.dot,{opacity:T.interpolate({inputRange:[.33,.83,1.33],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[.33,.83,1.33],outputRange:[0,-4,0]})}]}]}/>
364
- <ke.View style={[et.dot,{opacity:T.interpolate({inputRange:[.66,1.16,1.66],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[.66,1.16,1.66],outputRange:[0,-4,0]})}]}]}/>
365
- </Uo>
366
- </Uo>
367
- </Uo>:null},et=ta.create({container:{paddingHorizontal:15,paddingVertical:5},bubble:{backgroundColor:"#fff",borderRadius:18,paddingHorizontal:12,paddingVertical:8,alignSelf:"flex-start",maxWidth:"80%"},senderNameContainer:{marginBottom:4},senderName:{fontSize:12,color:"#666",fontWeight:"500"},dotsContainer:{flexDirection:"row",alignItems:"center",justifyContent:"center"},dot:{width:6,height:6,borderRadius:3,backgroundColor:"#999",marginHorizontal:3}}),Mt=oa;import Ko from"react";import{Pressable as Ma,Animated as qo}from"react-native";import{ChevronDown as Ca}from"lucide-react-native";var Ra=({visible:M,onPress:T,isReplyActive:R=!1})=>{let C=q(),S=Ko.useRef(new qo.Value(0)).current,[A,I]=Ko.useState(!1);return Ko.useEffect(()=>{qo.timing(S,{toValue:M?1:0,duration:200,useNativeDriver:!0}).start(()=>{I(M)})},[M,S]),!M&&!A?null:<Ma onPress={T}hitSlop={{top:10,bottom:10,left:10,right:10}}>
368
- {({pressed:P})=><qo.View style={[{position:"absolute",bottom:40,right:C.spacing.lg,zIndex:9999,width:32,height:32,backgroundColor:C.colors.background,borderRadius:C.borderRadius.xl,justifyContent:"center",alignItems:"center",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:3.84,elevation:5,opacity:S,transform:P?[{scale:.95}]:[]}]}>
369
- <Ca size={20}color={C.colors.text}/>
370
- </qo.View>}
371
- </Ma>},Co=Ra;import{View as Us,Text as Ta}from"react-native";var Sa=({displayDate:M})=>{let T=q();return<Us style={{marginVertical:T.spacing.lg,alignItems:"center"}}>
372
- <Us style={{borderRadius:T.borderRadius.full,backgroundColor:T.colors.surfaceSecondary,paddingHorizontal:T.spacing.md,paddingVertical:T.spacing.xs}}>
373
- <Ta style={{fontSize:T.typography.fontSize.xs,color:T.colors.textSecondary,fontWeight:T.typography.fontWeight.medium}}>
374
- {M}
375
- </Ta>
376
- </Us>
377
- </Us>},Ro=Sa;import So,{forwardRef as ja,useRef as Oa,useImperativeHandle as Fa,useCallback as Ha}from"react";import{View as Go,TextInput as Na,TouchableOpacity as Ks,Platform as qs}from"react-native";import{Plus as Wa,Send as Ua,Mic as Ka}from"lucide-react-native";import{useRef as Ia,useCallback as Le}from"react";import{Alert as Q}from"react-native";import{Camera as va,Image as Pa,MapPin as Aa,User as za,FileText as Ba,BarChart3 as Va,Calendar as Da}from"lucide-react-native";var wa={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},$o=async(M,T={})=>{try{let R;try{R=await import("expo-image-manipulator")}catch(V){console.log("expo-image-manipulator not available, returning original image info:",V);let z=`image_${Date.now()}.jpg`;return{uri:M,width:1920,height:1920,fileName:z}}let C={...wa,...T};console.log("Starting image compression...",{uri:M,options:C});let S=await R.manipulateAsync(M,[],{});console.log("Original image info:",{width:S.width,height:S.height,uri:S.uri});let A=[];if(C.maxWidth||C.maxHeight){let{width:V,height:D}=S,z=V,L=D;if(C.maxWidth&&V>C.maxWidth){let k=C.maxWidth/V;z=C.maxWidth,L=D*k}if(C.maxHeight&&L>C.maxHeight){let k=C.maxHeight/L;L=C.maxHeight,z=z*k}(z!==V||L!==D)&&(A.push({resize:{width:Math.round(z),height:Math.round(L)}}),console.log("Resizing image:",{from:{width:V,height:D},to:{width:Math.round(z),height:Math.round(L)}}))}let I={compress:C.quality,format:C.format==="png"?R.SaveFormat?.PNG:R.SaveFormat?.JPEG};console.log("Applying compression with options:",I);let P=await R.manipulateAsync(M,A,I);console.log("Image compression completed:",{originalUri:M,compressedUri:P.uri,finalDimensions:{width:P.width,height:P.height}});let B=Date.now(),E=C.format==="png"?"png":"jpg",v=`compressed_image_${B}.${E}`;return{uri:P.uri,width:P.width,height:P.height,fileName:v}}catch(R){console.error("Error compressing image:",R);let C=R instanceof Error?R.message:"Unknown error";throw new Error(`Failed to compress image: ${C}`)}},Yo=(M,T)=>M>3e3||T>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:M>1920||T>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var ka=[{id:"photo",label:"Photo",icon:Pa,color:"#3B82F6"},{id:"camera",label:"Camera",icon:va,color:"#6B7280"},{id:"location",label:"Location",icon:Aa,color:"#10B981"},{id:"contact",label:"Contact",icon:za,color:"#6B7280"},{id:"document",label:"Document",icon:Ba,color:"#3B82F6"},{id:"poll",label:"Poll",icon:Va,color:"#F59E0B"},{id:"event",label:"Event",icon:Da,color:"#EF4444"}],To=M=>{let T=Ia(null),R=Le(async()=>{console.log("Photo selection initiated");try{let v;try{v=await import("expo-image-picker")}catch(z){console.log("expo-image-picker not available:",z),Q.alert("Feature Not Available","Photo selection requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting photo library permissions...");let{status:V}=await v.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",V),V!=="granted"){Q.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(z=>setTimeout(()=>z(void 0),300)),console.log("Launching image picker...");let D=await v.launchImageLibraryAsync({mediaTypes:"images",allowsEditing:!0,aspect:[4,3],quality:.8,allowsMultipleSelection:!1});if(console.log("Image picker result:",D),!D.canceled&&D.assets&&D.assets.length>0){let z=D.assets[0];console.log("Photo selected successfully:",z.uri);try{console.log("Starting image compression...");let L=Yo(z.width||1920,z.height||1920),k=await $o(z.uri,L);console.log("Image compression completed:",k),M?.({type:"image",data:{...k,originalFileSize:z.fileSize}})}catch(L){console.error("Image compression failed:",L),Q.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:z.uri,width:z.width,height:z.height,fileSize:z.fileSize,fileName:z.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),Q.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),C=Le(async()=>{console.log("Camera capture initiated");try{let v;try{v=await import("expo-image-picker")}catch(z){console.log("expo-image-picker not available:",z),Q.alert("Feature Not Available","Camera capture requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting camera permissions...");let{status:V}=await v.requestCameraPermissionsAsync();if(console.log("Camera permission status:",V),V!=="granted"){Q.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(z=>setTimeout(()=>z(void 0),300)),console.log("Launching camera...");let D=await v.launchCameraAsync({allowsEditing:!0,aspect:[4,3],quality:.8,mediaTypes:"images"});if(console.log("Camera result:",D),!D.canceled&&D.assets&&D.assets.length>0){let z=D.assets[0];console.log("Photo captured successfully:",z.uri);try{console.log("Starting camera image compression...");let L=Yo(z.width||1920,z.height||1920),k=await $o(z.uri,L);console.log("Camera image compression completed:",k),M?.({type:"image",data:{...k,originalFileSize:z.fileSize}})}catch(L){console.error("Camera image compression failed:",L),Q.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:z.uri,width:z.width,height:z.height,fileSize:z.fileSize,fileName:z.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),Q.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),S=Le(async()=>{console.log("Location sharing initiated");try{let v;try{v=await import("expo-location")}catch(k){console.log("expo-location not available:",k),Q.alert("Feature Not Available","Location sharing requires expo-location to be installed. Please install expo-location to use this feature.",[{text:"OK"}]);return}console.log("Requesting location permissions...");let{status:V}=await v.requestForegroundPermissionsAsync();if(console.log("Location permission status:",V),V!=="granted"){Q.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let D=await v.getCurrentPositionAsync({accuracy:v.Accuracy.High});console.log("Getting address from coordinates...");let z=await v.reverseGeocodeAsync({latitude:D.coords.latitude,longitude:D.coords.longitude}),L={coordinates:{latitude:D.coords.latitude,longitude:D.coords.longitude},address:z[0]||null,timestamp:D.timestamp};console.log("Location shared successfully:",L.coordinates),M?.({type:"location",data:L})}catch(v){console.error("Error in location sharing process:",v),Q.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),A=Le(async()=>{try{let v;try{v=await import("expo-contacts")}catch(D){console.log("expo-contacts not available:",D),Q.alert("Feature Not Available","Contact sharing requires expo-contacts to be installed. Please install expo-contacts to use this feature.",[{text:"OK"}]);return}let{status:V}=await v.requestPermissionsAsync();if(V!=="granted"){Q.alert("Permission needed","Please grant contacts access to share contacts.");return}Q.alert("Contact Sharing","Contact selection feature is coming soon! This would open a contact picker.",[{text:"OK",onPress:()=>console.log("Contact sharing acknowledged")}])}catch(v){console.error("Error accessing contacts:",v),Q.alert("Error","Failed to access contacts. Please try again.")}finally{T.current?.hide()}},[]),I=Le(async()=>{console.log("Document selection initiated");try{let v;try{v=await import("expo-document-picker")}catch(D){console.log("expo-document-picker not available:",D),Q.alert("Feature Not Available","Document selection requires expo-document-picker to be installed. Please install expo-document-picker to use this feature.",[{text:"OK"}]);return}console.log("Waiting for UI to stabilize..."),await new Promise(D=>setTimeout(()=>D(void 0),300)),console.log("Launching document picker...");let V=await v.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",V),!V.canceled&&V.assets&&V.assets.length>0){let D=V.assets[0];console.log("Document selected successfully:",D.name),M?.({type:"document",data:{uri:D.uri,name:D.name,size:D.size,mimeType:D.mimeType}})}else console.log("Document selection was canceled by user")}catch(v){console.error("Error in document selection process:",v),Q.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[M]),P=Le(()=>{Q.alert("Create Poll","Poll creation feature is coming soon! This would open a poll creation interface.",[{text:"OK",onPress:()=>console.log("Poll creation acknowledged")}])},[]),B=Le(()=>{Q.alert("Create Event","Event creation feature is coming soon! This would open an event creation interface.",[{text:"OK",onPress:()=>console.log("Event creation acknowledged")}])},[]),E=Le(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await R();break;case"camera":await C();break;case"location":await S();break;case"contact":await A();break;case"document":await I();break;case"poll":P();break;case"event":B();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(V){console.error(`Error handling ${v}:`,V),Q.alert("Error",`Failed to handle ${v}. Please try again.`)}},[R,C,S,A,I,P,B]);return{menuRef:T,handleOptionSelect:E,options:ka}};import Ee,{useRef as La,useCallback as pe,createContext as Ea,useContext as hd}from"react";var kt=(M={})=>{let{initialValue:T="",initialHeight:R=50,onValueChange:C,onHeightChange:S,onSend:A,onAttachmentSend:I,onReplyCancel:P,onFocus:B,onBlur:E,maxHeight:v=100,minHeight:V=50,maxLength:D=1e3,placeholder:z="Type a message..."}=M,L=La(null),[k,O]=Ee.useState(T),[F,H]=Ee.useState(R),[N,j]=Ee.useState(!1),[J,ie]=Ee.useState(null),[Y,X]=Ee.useState([]),le=Ee.useMemo(()=>({value:k,height:F,isFocused:N,replyToMessage:J,attachments:Y}),[k,F,N,J,Y]),me=pe(oe=>{O(oe),C?.(oe)},[C]),re=pe(oe=>{let de=Math.max(V,Math.min(v,oe));H(de),S?.(de)},[V,v,S]),Z=pe(()=>{j(!0),B?.()},[B]),W=pe(()=>{j(!1),E?.()},[E]),ce=pe(oe=>{let{height:de}=oe.nativeEvent.contentSize,Tt=Math.max(V,Math.min(v,de+16));re(Tt)},[V,v,re]),ye=pe(()=>{A&&(k||Y.length>0)&&(A(k,Y,J),O(T),X([]),ie(null),H(R))},[A,k,Y,J,T,R]),he=pe(oe=>{I?(I(oe,k),k&&O(T)):X(de=>[...de,{...oe,id:Date.now().toString()}])},[I,k,T]),ne=pe(oe=>{X(de=>[...de,oe])},[]),ge=pe(oe=>{X(de=>de.filter(Tt=>Tt.id!==oe))},[]),xe=pe(()=>{X([])},[]),ee=pe(()=>{ie(null),P?.()},[P]),Se=pe(()=>{L.current?.focus()},[]),vo=Ee.useMemo(()=>({setValue:me,setHeight:re,setFocus:j,setReplyToMessage:ie,addAttachment:ne,removeAttachment:ge,clearAttachments:xe,sendMessage:ye,cancelReply:ee,focusInput:Se,handleAttachmentSelected:he,handleContentSizeChange:ce,handleFocus:Z,handleBlur:W}),[me,re,j,ie,ne,ge,xe,ye,ee,Se,he,ce,Z,W]),Po=Ee.useMemo(()=>({textInputRef:L}),[]);return{state:le,actions:vo,refs:Po}},yd=Ea(null);var we=ja(({value:M,onChangeText:T,onSend:R,onFocus:C,height:S,onContentSizeChange:A,replyToMessage:I,onCancelReply:P,onAttachmentSend:B},E)=>{let v=q(),V=Oa(null);Fa(E,()=>({focus:()=>{V.current?.focus()}}));let{state:D,actions:z}=kt({initialValue:M,initialHeight:S,onValueChange:T,onHeightChange:A,onSend:R,onAttachmentSend:B,onReplyCancel:P,onFocus:C});So.useEffect(()=>{M!==D.value&&z.setValue(M)},[M,D.value,z]),So.useEffect(()=>{S!==D.height&&z.setHeight(S)},[S,D.height,z]),So.useEffect(()=>{I!==D.replyToMessage&&z.setReplyToMessage(I||null)},[I,D.replyToMessage,z]),So.useEffect(()=>{if(I&&V.current){let O=setTimeout(()=>{V.current?.focus()},100);return()=>clearTimeout(O)}},[I]);let L=Ha(O=>{if(console.log("Attachment selected:",O),B)B(O,M.trim()||void 0),M.trim()&&T("");else switch(O.type){case"image":console.log("Image attachment ready to send:",{uri:O.data.uri,dimensions:{width:O.data.width,height:O.data.height},fileName:O.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:O.data.name,size:O.data.size});break;case"location":console.log("Location attachment ready to send:",O.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",O.data);break;default:console.log("Other attachment ready to send:",O)}},[B,M,T]),k=To(L);return<>
378
- {I&&P&&<Vt replyToMessage={I}onCancel={P}/>}
379
- <Go style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
380
- <Go style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:S}}>
381
- <Ks style={{marginRight:v.spacing.md}}onPress={()=>k.menuRef.current?.show()}>
382
- <Wa size={24}color={v.colors.textSecondary}/>
383
- </Ks>
359
+ </Pn>
360
+ </An>})}
361
+ </No>
362
+ </No>
363
+ </Xr>});Ct.displayName="AttachmentMenu";import{useEffect as Qr,useRef as ei}from"react";import{View as Ps,StyleSheet as ti,Animated as Ke}from"react-native";var oi=({isVisible:C})=>{let T=ei(new Ke.Value(0)).current;return Qr(()=>{if(!C){T.setValue(0);return}let R=Ke.loop(Ke.sequence([Ke.timing(T,{toValue:1,duration:1200,useNativeDriver:!0}),Ke.timing(T,{toValue:0,duration:1200,useNativeDriver:!0})]));return R.start(),()=>{R.stop()}},[C,T]),C?<Ps style={kt.container}>
364
+ <Ps style={kt.bubble}>
365
+ <Ps style={kt.dotsContainer}>
366
+ <Ke.View style={[kt.dot,{opacity:T.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
367
+ <Ke.View style={[kt.dot,{opacity:T.interpolate({inputRange:[.33,.83,1.33],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[.33,.83,1.33],outputRange:[0,-4,0]})}]}]}/>
368
+ <Ke.View style={[kt.dot,{opacity:T.interpolate({inputRange:[.66,1.16,1.66],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[.66,1.16,1.66],outputRange:[0,-4,0]})}]}]}/>
369
+ </Ps>
370
+ </Ps>
371
+ </Ps>:null},kt=ti.create({container:{paddingHorizontal:15,paddingVertical:5},bubble:{backgroundColor:"#fff",borderRadius:18,paddingHorizontal:12,paddingVertical:8,alignSelf:"flex-start",maxWidth:"80%"},senderNameContainer:{marginBottom:4},senderName:{fontSize:12,color:"#666",fontWeight:"500"},dotsContainer:{flexDirection:"row",alignItems:"center",justifyContent:"center"},dot:{width:6,height:6,borderRadius:3,backgroundColor:"#999",marginHorizontal:3}}),Dt=oi;import As from"react";import{Pressable as Ci,Animated as zs}from"react-native";import{ChevronDown as Mi}from"lucide-react-native";var Ri=({visible:C,onPress:T,isReplyActive:R=!1})=>{let M=q(),S=As.useRef(new zs.Value(0)).current,[A,I]=As.useState(!1);return As.useEffect(()=>{zs.timing(S,{toValue:C?1:0,duration:200,useNativeDriver:!0}).start(()=>{I(C)})},[C,S]),!C&&!A?null:<Ci onPress={T}hitSlop={{top:10,bottom:10,left:10,right:10}}>
372
+ {({pressed:P})=><zs.View style={[{position:"absolute",bottom:40,right:M.spacing.lg,zIndex:9999,width:32,height:32,backgroundColor:M.colors.background,borderRadius:M.borderRadius.xl,justifyContent:"center",alignItems:"center",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:3.84,elevation:5,opacity:S,transform:P?[{scale:.95}]:[]}]}>
373
+ <Mi size={20}color={M.colors.text}/>
374
+ </zs.View>}
375
+ </Ci>},Wo=Ri;import{View as Vn,Text as Ti}from"react-native";var Si=({displayDate:C})=>{let T=q();return<Vn style={{marginVertical:T.spacing.lg,alignItems:"center"}}>
376
+ <Vn style={{borderRadius:T.borderRadius.full,backgroundColor:T.colors.surfaceSecondary,paddingHorizontal:T.spacing.md,paddingVertical:T.spacing.xs}}>
377
+ <Ti style={{fontSize:T.typography.fontSize.xs,color:T.colors.textSecondary,fontWeight:T.typography.fontWeight.medium}}>
378
+ {C}
379
+ </Ti>
380
+ </Vn>
381
+ </Vn>},Uo=Si;import qo,{forwardRef as Ei,useRef as Oi,useImperativeHandle as Fi,useCallback as Hi}from"react";import{View as Ds,TextInput as Ni,TouchableOpacity as Bn,Platform as kn}from"react-native";import{Plus as Wi,Send as Ui,Mic as Ki}from"lucide-react-native";import{useRef as Ii,useCallback as qe}from"react";import{Alert as X}from"react-native";import{Camera as vi,Image as Pi,MapPin as Ai,User as zi,FileText as Vi,BarChart3 as Bi,Calendar as ki}from"lucide-react-native";var wi={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},Vs=async(C,T={})=>{try{let R;try{R=await import("expo-image-manipulator")}catch(k){console.log("expo-image-manipulator not available, returning original image info:",k);let V=`image_${Date.now()}.jpg`;return{uri:C,width:1920,height:1920,fileName:V}}let M={...wi,...T};console.log("Starting image compression...",{uri:C,options:M});let S=await R.manipulateAsync(C,[],{});console.log("Original image info:",{width:S.width,height:S.height,uri:S.uri});let A=[];if(M.maxWidth||M.maxHeight){let{width:k,height:D}=S,V=k,B=D;if(M.maxWidth&&k>M.maxWidth){let L=M.maxWidth/k;V=M.maxWidth,B=D*L}if(M.maxHeight&&B>M.maxHeight){let L=M.maxHeight/B;B=M.maxHeight,V=V*L}(V!==k||B!==D)&&(A.push({resize:{width:Math.round(V),height:Math.round(B)}}),console.log("Resizing image:",{from:{width:k,height:D},to:{width:Math.round(V),height:Math.round(B)}}))}let I={compress:M.quality,format:M.format==="png"?R.SaveFormat?.PNG:R.SaveFormat?.JPEG};console.log("Applying compression with options:",I);let P=await R.manipulateAsync(C,A,I);console.log("Image compression completed:",{originalUri:C,compressedUri:P.uri,finalDimensions:{width:P.width,height:P.height}});let z=Date.now(),E=M.format==="png"?"png":"jpg",v=`compressed_image_${z}.${E}`;return{uri:P.uri,width:P.width,height:P.height,fileName:v}}catch(R){console.error("Error compressing image:",R);let M=R instanceof Error?R.message:"Unknown error";throw new Error(`Failed to compress image: ${M}`)}},Bs=(C,T)=>C>3e3||T>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:C>1920||T>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var Di=[{id:"photo",label:"Photo",icon:Pi,color:"#3B82F6"},{id:"camera",label:"Camera",icon:vi,color:"#6B7280"},{id:"location",label:"Location",icon:Ai,color:"#10B981"},{id:"contact",label:"Contact",icon:zi,color:"#6B7280"},{id:"document",label:"Document",icon:Vi,color:"#3B82F6"},{id:"poll",label:"Poll",icon:Bi,color:"#F59E0B"},{id:"event",label:"Event",icon:ki,color:"#EF4444"}],Ko=C=>{let T=Ii(null),R=qe(async()=>{console.log("Photo selection initiated");try{let v;try{v=await import("expo-image-picker")}catch(V){console.log("expo-image-picker not available:",V),X.alert("Feature Not Available","Photo selection requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting photo library permissions...");let{status:k}=await v.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",k),k!=="granted"){X.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(V=>setTimeout(()=>V(void 0),300)),console.log("Launching image picker...");let D=await v.launchImageLibraryAsync({mediaTypes:"images",allowsEditing:!0,aspect:[4,3],quality:.8,allowsMultipleSelection:!1});if(console.log("Image picker result:",D),!D.canceled&&D.assets&&D.assets.length>0){let V=D.assets[0];console.log("Photo selected successfully:",V.uri);try{console.log("Starting image compression...");let B=Bs(V.width||1920,V.height||1920),L=await Vs(V.uri,B);console.log("Image compression completed:",L),C?.({type:"image",data:{...L,originalFileSize:V.fileSize}})}catch(B){console.error("Image compression failed:",B),X.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),C?.({type:"image",data:{uri:V.uri,width:V.width,height:V.height,fileSize:V.fileSize,fileName:V.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),X.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),M=qe(async()=>{console.log("Camera capture initiated");try{let v;try{v=await import("expo-image-picker")}catch(V){console.log("expo-image-picker not available:",V),X.alert("Feature Not Available","Camera capture requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting camera permissions...");let{status:k}=await v.requestCameraPermissionsAsync();if(console.log("Camera permission status:",k),k!=="granted"){X.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(V=>setTimeout(()=>V(void 0),300)),console.log("Launching camera...");let D=await v.launchCameraAsync({allowsEditing:!0,aspect:[4,3],quality:.8,mediaTypes:"images"});if(console.log("Camera result:",D),!D.canceled&&D.assets&&D.assets.length>0){let V=D.assets[0];console.log("Photo captured successfully:",V.uri);try{console.log("Starting camera image compression...");let B=Bs(V.width||1920,V.height||1920),L=await Vs(V.uri,B);console.log("Camera image compression completed:",L),C?.({type:"image",data:{...L,originalFileSize:V.fileSize}})}catch(B){console.error("Camera image compression failed:",B),X.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),C?.({type:"image",data:{uri:V.uri,width:V.width,height:V.height,fileSize:V.fileSize,fileName:V.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),X.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),S=qe(async()=>{console.log("Location sharing initiated");try{let v;try{v=await import("expo-location")}catch(L){console.log("expo-location not available:",L),X.alert("Feature Not Available","Location sharing requires expo-location to be installed. Please install expo-location to use this feature.",[{text:"OK"}]);return}console.log("Requesting location permissions...");let{status:k}=await v.requestForegroundPermissionsAsync();if(console.log("Location permission status:",k),k!=="granted"){X.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let D=await v.getCurrentPositionAsync({accuracy:v.Accuracy.High});console.log("Getting address from coordinates...");let V=await v.reverseGeocodeAsync({latitude:D.coords.latitude,longitude:D.coords.longitude}),B={coordinates:{latitude:D.coords.latitude,longitude:D.coords.longitude},address:V[0]||null,timestamp:D.timestamp};console.log("Location shared successfully:",B.coordinates),C?.({type:"location",data:B})}catch(v){console.error("Error in location sharing process:",v),X.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),A=qe(async()=>{try{let v;try{v=await import("expo-contacts")}catch(D){console.log("expo-contacts not available:",D),X.alert("Feature Not Available","Contact sharing requires expo-contacts to be installed. Please install expo-contacts to use this feature.",[{text:"OK"}]);return}let{status:k}=await v.requestPermissionsAsync();if(k!=="granted"){X.alert("Permission needed","Please grant contacts access to share contacts.");return}X.alert("Contact Sharing","Contact selection feature is coming soon! This would open a contact picker.",[{text:"OK",onPress:()=>console.log("Contact sharing acknowledged")}])}catch(v){console.error("Error accessing contacts:",v),X.alert("Error","Failed to access contacts. Please try again.")}finally{T.current?.hide()}},[]),I=qe(async()=>{console.log("Document selection initiated");try{let v;try{v=await import("expo-document-picker")}catch(D){console.log("expo-document-picker not available:",D),X.alert("Feature Not Available","Document selection requires expo-document-picker to be installed. Please install expo-document-picker to use this feature.",[{text:"OK"}]);return}console.log("Waiting for UI to stabilize..."),await new Promise(D=>setTimeout(()=>D(void 0),300)),console.log("Launching document picker...");let k=await v.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",k),!k.canceled&&k.assets&&k.assets.length>0){let D=k.assets[0];console.log("Document selected successfully:",D.name),C?.({type:"document",data:{uri:D.uri,name:D.name,size:D.size,mimeType:D.mimeType}})}else console.log("Document selection was canceled by user")}catch(v){console.error("Error in document selection process:",v),X.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[C]),P=qe(()=>{X.alert("Create Poll","Poll creation feature is coming soon! This would open a poll creation interface.",[{text:"OK",onPress:()=>console.log("Poll creation acknowledged")}])},[]),z=qe(()=>{X.alert("Create Event","Event creation feature is coming soon! This would open an event creation interface.",[{text:"OK",onPress:()=>console.log("Event creation acknowledged")}])},[]),E=qe(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await R();break;case"camera":await M();break;case"location":await S();break;case"contact":await A();break;case"document":await I();break;case"poll":P();break;case"event":z();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(k){console.error(`Error handling ${v}:`,k),X.alert("Error",`Failed to handle ${v}. Please try again.`)}},[R,M,S,A,I,P,z]);return{menuRef:T,handleOptionSelect:E,options:Di}};import $e,{useRef as Li,useCallback as Ae,createContext as ji,useContext as Pu}from"react";var _t=(C={})=>{let{initialValue:T="",initialHeight:R=50,onValueChange:M,onHeightChange:S,onSend:A,onAttachmentSend:I,onReplyCancel:P,onFocus:z,onBlur:E,maxHeight:v=100,minHeight:k=50,maxLength:D=1e3,placeholder:V="Type a message..."}=C,B=Li(null),[L,F]=$e.useState(T),[j,H]=$e.useState(R),[N,O]=$e.useState(!1),[_,re]=$e.useState(null),[J,Ce]=$e.useState([]),Z=$e.useMemo(()=>({value:L,height:j,isFocused:N,replyToMessage:_,attachments:J}),[L,j,N,_,J]),ae=Ae(se=>{F(se),M?.(se)},[M]),oe=Ae(se=>{let Te=Math.max(k,Math.min(v,se));H(Te),S?.(Te)},[k,v,S]),we=Ae(()=>{O(!0),z?.()},[z]),W=Ae(()=>{O(!1),E?.()},[E]),Ie=Ae(se=>{let{height:Te}=se.nativeEvent.contentSize,Et=Math.max(k,Math.min(v,Te+16));oe(Et)},[k,v,oe]),Me=Ae(()=>{A&&(L||J.length>0)&&(A(L,J,_),F(T),Ce([]),re(null),H(R))},[A,L,J,_,T,R]),Ge=Ae(se=>{I?(I(se,L),L&&F(T)):Ce(Te=>[...Te,{...se,id:Date.now().toString()}])},[I,L,T]),Q=Ae(se=>{Ce(Te=>[...Te,se])},[]),ve=Ae(se=>{Ce(Te=>Te.filter(Et=>Et.id!==se))},[]),ze=Ae(()=>{Ce([])},[]),ee=Ae(()=>{re(null),P?.()},[P]),Tt=Ae(()=>{B.current?.focus()},[]),_e=$e.useMemo(()=>({setValue:ae,setHeight:oe,setFocus:O,setReplyToMessage:re,addAttachment:Q,removeAttachment:ve,clearAttachments:ze,sendMessage:Me,cancelReply:ee,focusInput:Tt,handleAttachmentSelected:Ge,handleContentSizeChange:Ie,handleFocus:we,handleBlur:W}),[ae,oe,O,re,Q,ve,ze,Me,ee,Tt,Ge,Ie,we,W]),Go=$e.useMemo(()=>({textInputRef:B}),[]);return{state:Z,actions:_e,refs:Go}},zu=ji(null);var Ee=Ei(({value:C,onChangeText:T,onSend:R,onFocus:M,height:S,onContentSizeChange:A,replyToMessage:I,onCancelReply:P,onAttachmentSend:z},E)=>{let v=q(),k=Pe(),D=Oi(null);Fi(E,()=>({focus:()=>{D.current?.focus()}}));let{state:V,actions:B}=_t({initialValue:C,initialHeight:S,onValueChange:T,onHeightChange:A,onSend:R,onAttachmentSend:z,onReplyCancel:P,onFocus:M});qo.useEffect(()=>{C!==V.value&&B.setValue(C)},[C,V.value,B]),qo.useEffect(()=>{S!==V.height&&B.setHeight(S)},[S,V.height,B]),qo.useEffect(()=>{I!==V.replyToMessage&&B.setReplyToMessage(I||null)},[I,V.replyToMessage,B]),qo.useEffect(()=>{if(I&&D.current){let j=setTimeout(()=>{D.current?.focus()},100);return()=>clearTimeout(j)}},[I]);let L=Hi(j=>{if(console.log("Attachment selected:",j),z)z(j,C.trim()||void 0),C.trim()&&T("");else switch(j.type){case"image":console.log("Image attachment ready to send:",{uri:j.data.uri,dimensions:{width:j.data.width,height:j.data.height},fileName:j.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:j.data.name,size:j.data.size});break;case"location":console.log("Location attachment ready to send:",j.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",j.data);break;default:console.log("Other attachment ready to send:",j)}},[z,C,T]),F=Ko(L);return<>
382
+ {I&&P&&<Yt replyToMessage={I}onCancel={P}/>}
383
+ <Ds style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
384
+ <Ds style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:S}}>
385
+ <Bn style={{marginRight:v.spacing.md}}onPress={()=>F.menuRef.current?.show()}>
386
+ <Wi size={24}color={v.colors.textSecondary}/>
387
+ </Bn>
384
388
 
385
- <Go style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:v.borderRadius.full,backgroundColor:v.colors.surfaceSecondary,paddingHorizontal:v.spacing.lg,paddingVertical:6}}>
386
- <Na ref={V}style={{flex:1,fontSize:v.typography.fontSize.base,maxHeight:70,minHeight:18,paddingTop:qs.OS==="ios"?6:3,paddingBottom:qs.OS==="ios"?6:3,color:v.colors.text}}value={M}onChangeText={T}placeholder='Type a message...'placeholderTextColor={v.colors.textMuted}multiline maxLength={1e3}onFocus={C}onContentSizeChange={z.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
387
- </Go>
389
+ <Ds style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:v.borderRadius.full,backgroundColor:v.colors.surfaceSecondary,paddingHorizontal:v.spacing.lg,paddingVertical:6}}>
390
+ <Ni ref={D}style={{flex:1,fontSize:v.typography.fontSize.base,maxHeight:70,minHeight:18,paddingTop:kn.OS==="ios"?6:3,paddingBottom:kn.OS==="ios"?6:3,color:v.colors.text}}value={C}onChangeText={T}placeholder={k("input.placeholder")}placeholderTextColor={v.colors.textMuted}multiline maxLength={1e3}onFocus={M}onContentSizeChange={B.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
391
+ </Ds>
388
392
 
389
- <Ks onPress={R}style={{marginLeft:v.spacing.md,height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:v.borderRadius.full,backgroundColor:M.trim()?v.colors.primary:v.colors.gray[300]}}disabled={!M.trim()}>
390
- {M.trim()?<Ua size={18}color='white'/>:<Ka size={18}color='white'/>}
391
- </Ks>
392
- </Go>
393
- </Go>
393
+ <Bn onPress={R}style={{marginLeft:v.spacing.md,height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:v.borderRadius.full,backgroundColor:C.trim()?v.colors.primary:v.colors.gray[300]}}disabled={!C.trim()}>
394
+ {C.trim()?<Ui size={18}color='white'/>:<Ki size={18}color='white'/>}
395
+ </Bn>
396
+ </Ds>
397
+ </Ds>
394
398
 
395
- <We ref={k.menuRef}onOptionSelect={k.handleOptionSelect}options={k.options}/>
396
- </>});we.displayName="MessageInput";import{View as Ad,TextInput as Bd,TouchableOpacity as Vd,Platform as Dd}from"react-native";import{Plus as Ld,Send as Ed,Mic as Od}from"lucide-react-native";import Ti,{forwardRef as Si}from"react";import Xa,{createContext as Qa,useContext as Za,useMemo as ei}from"react";import{useMemo as $a,useCallback as Ya}from"react";function Lt(M,T={}){let{initialNumToRender:R=20,maxToRenderPerBatch:C=10,windowSize:S=10}=T,A=$a(()=>Vs(M).reverse(),[M]),I=Ya(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:R,maxToRenderPerBatch:C,windowSize:S,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}import{useState as Ga,useCallback as Ue,useRef as $s}from"react";function _o(M={}){let{scrollThreshold:T=50,autoScrollToBottom:R=!0}=M,C=$s(null),[S,A]=Ga({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=$s(0),P=Ue(L=>{let{contentOffset:k,contentSize:O,layoutMeasurement:F}=L.nativeEvent,H=k.y,N=Math.abs(H)<T,j=Math.abs(H)>O.height-F.height-T;A({isNearBottom:N,isNearTop:j,showScrollToBottomButton:!N})},[T]),B=Ue(L=>{let k=L>I.current;return I.current=L,k},[]),E=Ue(()=>{},[]),v=Ue((L=!0)=>{C.current&&C.current.scrollToOffset({offset:0,animated:L})},[]),V=Ue((L,k=!0)=>{C.current&&C.current.scrollToOffset({offset:L,animated:k})},[]),D=Ue((L,k=!0)=>{C.current&&C.current.scrollToIndex({index:L,animated:k})},[]),z=Ue(L=>{B(L)&&R&&C.current&&setTimeout(()=>{v()},100)},[B,R,v]);return{flatListRef:C,scrollState:S,handleScroll:P,handleContentSizeChange:E,handleNewMessages:z,scrollToEnd:v,scrollToOffset:V,scrollToIndex:D}}import{useState as _a,useCallback as Jo}from"react";function Et(M={}){let{enableMessageActions:T=!0}=M,[R,C]=_a({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),S=Jo((P,B)=>{T&&C({actionSheetVisible:!0,selectedMessage:P,messagePosition:B})},[T]),A=Jo(()=>{C({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=Jo((P,B)=>{if(!R.selectedMessage)return;let{selectedMessage:E}=R;switch(P){case"reply":B?.onReply?.(E);break;case"copy":if(B?.onCopy)B.onCopy(E);else{let v=E.type==="image"&&E.imageData?E.text||"Image message":E.text;import("./clipboard-O4FPD4J6.mjs").then(({copyToClipboard:V})=>{V(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":B?.onDelete?.(E.id);break;default:B?.onCustomAction?.(P,E);break}A()},[R.selectedMessage,A]);return{actionState:R,handleMessageLongPress:S,handleActionSheetClose:A,handleActionPress:I}}import{useState as Ys,useCallback as jt}from"react";function Ot(M={}){let{enableReactionDetails:T=!0}=M,[R,C]=Ys({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[S,A]=Ys(null),I=jt(V=>{T&&V.reactions&&V.reactions.length>0&&(A(V),C({isReactionDetailsVisible:!0,selectedReactions:V.reactions,selectedMessageText:V.text}))},[T]),P=jt(()=>{C({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),B=jt((V,D)=>{S&&D?.(S.id,V),P()},[S,P]),E=jt((V,D)=>{S&&D?.(S.id,V),P()},[S,P]),v=jt((V,D)=>{S&&D?.(S.id,V)},[S]);return{reactionState:R,selectedMessage:S,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:B,handleRemoveReaction:E,handleEmojiReact:v}}import{useState as Ja,useCallback as Gs}from"react";function Xo(){let[M,T]=Ja({replyToMessage:null}),R=Gs(S=>{T({replyToMessage:S})},[]),C=Gs(()=>{T({replyToMessage:null})},[]);return{replyState:M,setReplyToMessage:R,clearReply:C}}var _s=Qa(null);function Ct(){let M=Za(_s);if(!M)throw new Error("useMessageListContext must be used within MessageListProvider");return M}function Ft({children:M,messages:T,config:R={},...C}){let S=Lt(T,R),A=_o(R),I=Et(R),P=Ot(R),B=Xo();Xa.useEffect(()=>{A.handleNewMessages(T.length)},[T.length,A.handleNewMessages]);let E=ei(()=>({messageList:S,scroll:A,actions:I,reactions:P,reply:B,config:R,callbacks:C}),[S,A,I,P,B,R,C]);return<_s.Provider value={E}>
397
- {M}
398
- </_s.Provider>}import{useCallback as wo}from"react";import{View as Mi,StyleSheet as Ci,FlatList as Ri}from"react-native";var je={Provider:Ft,Container:({children:M,style:T})=><Mi style={[Js.container,T]}>{M}</Mi>,Messages:({renderMessage:M,style:T})=>{let{messageList:R,scroll:C,actions:S,reactions:A,callbacks:I}=Ct(),P=wo(({item:E,index:v})=>M&&E.listItemType!=="date-separator"?M({message:E,index:v})||null:E.listItemType==="date-separator"?<Ro date={E.date}displayDate={E.displayDate}/>:<Xt message={E}onLongPress={S.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[S.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,M]),B=wo(E=>{C.handleScroll(E);let{isNearBottom:v,isNearTop:V}=C.scrollState;I.onScrollPositionChange?.(v,V),v&&I.onScrollToBottom?.(),V&&I.onScrollToTop?.()},[C.handleScroll,C.scrollState,I]);return<Ri ref={C.flatListRef}data={R.messageItems}renderItem={P}keyExtractor={R.keyExtractor}contentContainerStyle={[Js.contentContainer,T]}onContentSizeChange={C.handleContentSizeChange}onScroll={B}{...R.flatListProps}/>},TypingIndicator:({isVisible:M})=>M?<Mt isVisible={M}/>:null,ScrollButton:({visible:M,isReplyActive:T,onPress:R})=>{let{scroll:C}=Ct();return<Co visible={M??C.scrollState.showScrollToBottomButton}onPress={R??C.scrollToEnd}isReplyActive={T}/>},ActionSheet:()=>{let{actions:M,reactions:T,reply:R,callbacks:C,config:S}=Ct(),A=wo(P=>{M.handleActionPress(P,{onReply:B=>{R.setReplyToMessage(B),C.onReplyMessage?.(B)},onDelete:C.onMessageDelete,onCustomAction:C.onActionPress})},[M.handleActionPress,R.setReplyToMessage,C]),I=wo(P=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",P);let B=M.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",B?.id,"callbacks.onReactionAdd exists:",!!C.onReactionAdd),B&&C.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",B.id,"emoji:",P),C.onReactionAdd(B.id,P)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!B,"callback exists:",!!C.onReactionAdd)},[M.actionState.selectedMessage,C.onReactionAdd]);return S.enableMessageActions?<Qt visible={M.actionState.actionSheetVisible}onClose={M.handleActionSheetClose}isMyMessage={M.actionState.selectedMessage?.isMe||!1}selectedMessage={M.actionState.selectedMessage||void 0}messagePosition={M.actionState.messagePosition}onActionPress={A}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:M,callbacks:T,config:R}=Ct();return R.enableReactionDetails?<Zt visible={M.reactionState.isReactionDetailsVisible}onClose={M.handleReactionDetailsClose}reactions={M.reactionState.selectedReactions}messageText={M.reactionState.selectedMessageText}onRemoveReaction={C=>M.handleRemoveReaction(C,T.onReactionRemove)}/>:null}},Js=Ci.create({container:{flex:1},contentContainer:{paddingVertical:16}});var Ie=Si(({messages:M,isTyping:T,showScrollToBottom:R=!1,isReplyActive:C=!1,...S},A)=>{let I={scrollThreshold:S.scrollThreshold,autoScrollToBottom:S.autoScrollToBottom,enableMessageActions:S.enableMessageActions,enableReactionDetails:S.enableReactionDetails},P={onScrollToBottom:S.onScrollToBottom,onScrollToTop:S.onScrollToTop,onScrollPositionChange:S.onScrollPositionChange,onReactionAdd:S.onReactionAdd,onReactionRemove:S.onReactionRemove,onMessageDelete:S.onMessageDelete,onReplyMessage:S.onReplyMessage,onActionPress:S.onActionPress};return Ti.useImperativeHandle(A,()=>({scrollToEnd:(B=!0)=>{},scrollToOffset:(B,E=!0)=>{},scrollToIndex:(B,E=!0)=>{}}),[]),<Ft messages={M}config={I}{...P}>
399
- <je.Container>
400
- <je.Messages/>
401
- <je.TypingIndicator isVisible={T}/>
402
- <je.ScrollButton visible={R?void 0:!1}isReplyActive={C}/>
403
- <je.ActionSheet/>
404
- <je.ReactionDetails/>
405
- </je.Container>
406
- </Ft>});Ie.displayName="MessageList";import wi from"react";function ae(M){let T=wi.forwardRef((C,S)=>(qe(),<M{...C}ref={S}/>)),R=M.displayName||M.name||"Component";return T.displayName=`RequireAuth(${R})`,T}function be(M){return(...T)=>(qe(),M(...T))}import{FlatList as Di,RefreshControl as Li}from"react-native";import{View as Nt,Text as Io,TouchableOpacity as Bi}from"react-native";import{View as Qo,Image as Ii,Text as Pi}from"react-native";var Ai=({avatar:M,isOnline:T=!1,size:R="medium"})=>{let C=q(),S=()=>{switch(R){case"small":return{width:32,height:32};case"large":return{width:64,height:64};default:return{width:48,height:48}}},A=()=>{switch(R){case"small":return{width:12,height:12};case"large":return{width:24,height:24};default:return{width:16,height:16}}},I=S(),P=A(),E=(()=>{switch(R){case"small":return 14;case"large":return 28;default:return 20}})();return<Qo style={{position:"relative"}}>
407
- {M&&M.trim()!==""?<Ii source={{uri:M}}style={[I,{borderRadius:C.borderRadius.full}]}resizeMode="cover"/>:<Qo style={[I,{borderRadius:C.borderRadius.full,backgroundColor:C.colors.primary,justifyContent:"center",alignItems:"center"}]}>
408
- <Pi style={{color:C.colors.background,fontSize:E,fontWeight:"600"}}>
399
+ <Ct ref={F.menuRef}onOptionSelect={F.handleOptionSelect}options={F.options}/>
400
+ </>});Ee.displayName="MessageInput";import{View as Uu,TextInput as Ku,TouchableOpacity as $u,Platform as Yu}from"react-native";import{Plus as _u,Send as Ju,Mic as Xu}from"lucide-react-native";import Tl,{forwardRef as Sl}from"react";import Xi,{createContext as Zi,useContext as Qi,useMemo as el}from"react";import{useMemo as $i,useCallback as Yi}from"react";function Jt(C,T={}){let{initialNumToRender:R=20,maxToRenderPerBatch:M=10,windowSize:S=10}=T,A=$i(()=>on(C).reverse(),[C]),I=Yi(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:R,maxToRenderPerBatch:M,windowSize:S,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}import{useState as Gi,useCallback as Mt,useRef as Dn}from"react";function Ls(C={}){let{scrollThreshold:T=50,autoScrollToBottom:R=!0}=C,M=Dn(null),[S,A]=Gi({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=Dn(0),P=Mt(B=>{let{contentOffset:L,contentSize:F,layoutMeasurement:j}=B.nativeEvent,H=L.y,N=Math.abs(H)<T,O=Math.abs(H)>F.height-j.height-T;A({isNearBottom:N,isNearTop:O,showScrollToBottomButton:!N})},[T]),z=Mt(B=>{let L=B>I.current;return I.current=B,L},[]),E=Mt(()=>{},[]),v=Mt((B=!0)=>{M.current&&M.current.scrollToOffset({offset:0,animated:B})},[]),k=Mt((B,L=!0)=>{M.current&&M.current.scrollToOffset({offset:B,animated:L})},[]),D=Mt((B,L=!0)=>{M.current&&M.current.scrollToIndex({index:B,animated:L})},[]),V=Mt(B=>{z(B)&&R&&M.current&&setTimeout(()=>{v()},100)},[z,R,v]);return{flatListRef:M,scrollState:S,handleScroll:P,handleContentSizeChange:E,handleNewMessages:V,scrollToEnd:v,scrollToOffset:k,scrollToIndex:D}}import{useState as _i,useCallback as js}from"react";function Xt(C={}){let{enableMessageActions:T=!0}=C,[R,M]=_i({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),S=js((P,z)=>{T&&M({actionSheetVisible:!0,selectedMessage:P,messagePosition:z})},[T]),A=js(()=>{M({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=js((P,z)=>{if(!R.selectedMessage)return;let{selectedMessage:E}=R;switch(P){case"reply":z?.onReply?.(E);break;case"copy":if(z?.onCopy)z.onCopy(E);else{let v=E.type==="image"&&E.imageData?E.text||"Image message":E.text;import("./clipboard-O4FPD4J6.mjs").then(({copyToClipboard:k})=>{k(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":z?.onDelete?.(E.id);break;default:z?.onCustomAction?.(P,E);break}A()},[R.selectedMessage,A]);return{actionState:R,handleMessageLongPress:S,handleActionSheetClose:A,handleActionPress:I}}import{useState as Ln,useCallback as Zt}from"react";function Qt(C={}){let{enableReactionDetails:T=!0}=C,[R,M]=Ln({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[S,A]=Ln(null),I=Zt(k=>{T&&k.reactions&&k.reactions.length>0&&(A(k),M({isReactionDetailsVisible:!0,selectedReactions:k.reactions,selectedMessageText:k.text}))},[T]),P=Zt(()=>{M({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),z=Zt((k,D)=>{S&&D?.(S.id,k),P()},[S,P]),E=Zt((k,D)=>{S&&D?.(S.id,k),P()},[S,P]),v=Zt((k,D)=>{S&&D?.(S.id,k)},[S]);return{reactionState:R,selectedMessage:S,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:z,handleRemoveReaction:E,handleEmojiReact:v}}import{useState as Ji,useCallback as jn}from"react";function Es(){let[C,T]=Ji({replyToMessage:null}),R=jn(S=>{T({replyToMessage:S})},[]),M=jn(()=>{T({replyToMessage:null})},[]);return{replyState:C,setReplyToMessage:R,clearReply:M}}var En=Zi(null);function Lt(){let C=Qi(En);if(!C)throw new Error("useMessageListContext must be used within MessageListProvider");return C}function Co({children:C,messages:T,config:R={},...M}){let S=Jt(T,R),A=Ls(R),I=Xt(R),P=Qt(R),z=Es();Xi.useEffect(()=>{A.handleNewMessages(T.length)},[T.length,A.handleNewMessages]);let E=el(()=>({messageList:S,scroll:A,actions:I,reactions:P,reply:z,config:R,callbacks:M}),[S,A,I,P,z,R,M]);return<En.Provider value={E}>
401
+ {C}
402
+ </En.Provider>}import{useCallback as $o}from"react";import{View as Cl,StyleSheet as Ml,FlatList as Rl}from"react-native";var Ye={Provider:Co,Container:({children:C,style:T})=><Cl style={[On.container,T]}>{C}</Cl>,Messages:({renderMessage:C,style:T})=>{let{messageList:R,scroll:M,actions:S,reactions:A,callbacks:I}=Lt(),P=$o(({item:E,index:v})=>C&&E.listItemType!=="date-separator"?C({message:E,index:v})||null:E.listItemType==="date-separator"?<Uo date={E.date}displayDate={E.displayDate}/>:<Oo message={E}onLongPress={S.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[S.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,C]),z=$o(E=>{M.handleScroll(E);let{isNearBottom:v,isNearTop:k}=M.scrollState;I.onScrollPositionChange?.(v,k),v&&I.onScrollToBottom?.(),k&&I.onScrollToTop?.()},[M.handleScroll,M.scrollState,I]);return<Rl ref={M.flatListRef}data={R.messageItems}renderItem={P}keyExtractor={R.keyExtractor}contentContainerStyle={[On.contentContainer,T]}onContentSizeChange={M.handleContentSizeChange}onScroll={z}{...R.flatListProps}/>},TypingIndicator:({isVisible:C})=>C?<Dt isVisible={C}/>:null,ScrollButton:({visible:C,isReplyActive:T,onPress:R})=>{let{scroll:M}=Lt();return<Wo visible={C??M.scrollState.showScrollToBottomButton}onPress={R??M.scrollToEnd}isReplyActive={T}/>},ActionSheet:()=>{let{actions:C,reactions:T,reply:R,callbacks:M,config:S}=Lt(),A=$o(P=>{C.handleActionPress(P,{onReply:z=>{R.setReplyToMessage(z),M.onReplyMessage?.(z)},onDelete:M.onMessageDelete,onCustomAction:M.onActionPress})},[C.handleActionPress,R.setReplyToMessage,M]),I=$o(P=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",P);let z=C.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",z?.id,"callbacks.onReactionAdd exists:",!!M.onReactionAdd),z&&M.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",z.id,"emoji:",P),M.onReactionAdd(z.id,P)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!z,"callback exists:",!!M.onReactionAdd)},[C.actionState.selectedMessage,M.onReactionAdd]);return S.enableMessageActions?<Fo visible={C.actionState.actionSheetVisible}onClose={C.handleActionSheetClose}isMyMessage={C.actionState.selectedMessage?.isMe||!1}selectedMessage={C.actionState.selectedMessage||void 0}messagePosition={C.actionState.messagePosition}onActionPress={A}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:C,callbacks:T,config:R}=Lt();return R.enableReactionDetails?<Ho visible={C.reactionState.isReactionDetailsVisible}onClose={C.handleReactionDetailsClose}reactions={C.reactionState.selectedReactions}messageText={C.reactionState.selectedMessageText}onRemoveReaction={M=>C.handleRemoveReaction(M,T.onReactionRemove)}/>:null}},On=Ml.create({container:{flex:1},contentContainer:{paddingVertical:16}});var Oe=Sl(({messages:C,isTyping:T,showScrollToBottom:R=!1,isReplyActive:M=!1,...S},A)=>{let I={scrollThreshold:S.scrollThreshold,autoScrollToBottom:S.autoScrollToBottom,enableMessageActions:S.enableMessageActions,enableReactionDetails:S.enableReactionDetails},P={onScrollToBottom:S.onScrollToBottom,onScrollToTop:S.onScrollToTop,onScrollPositionChange:S.onScrollPositionChange,onReactionAdd:S.onReactionAdd,onReactionRemove:S.onReactionRemove,onMessageDelete:S.onMessageDelete,onReplyMessage:S.onReplyMessage,onActionPress:S.onActionPress};return Tl.useImperativeHandle(A,()=>({scrollToEnd:(z=!0)=>{},scrollToOffset:(z,E=!0)=>{},scrollToIndex:(z,E=!0)=>{}}),[]),<Co messages={C}config={I}{...P}>
403
+ <Ye.Container>
404
+ <Ye.Messages/>
405
+ <Ye.TypingIndicator isVisible={T}/>
406
+ <Ye.ScrollButton visible={R?void 0:!1}isReplyActive={M}/>
407
+ <Ye.ActionSheet/>
408
+ <Ye.ReactionDetails/>
409
+ </Ye.Container>
410
+ </Co>});Oe.displayName="MessageList";import wl from"react";function Re(C){let T=wl.forwardRef((M,S)=>(St(),<C{...M}ref={S}/>)),R=C.displayName||C.name||"Component";return T.displayName=`RequireAuth(${R})`,T}function Be(C){return(...T)=>(St(),C(...T))}import{FlatList as Dl,RefreshControl as Ll}from"react-native";import{View as Ro,Text as Yo,TouchableOpacity as Vl}from"react-native";import{View as Os,Image as Il,Text as Pl}from"react-native";var Al=({avatar:C,isOnline:T=!1,size:R="medium"})=>{let M=q(),S=()=>{switch(R){case"small":return{width:32,height:32};case"large":return{width:64,height:64};default:return{width:48,height:48}}},A=()=>{switch(R){case"small":return{width:12,height:12};case"large":return{width:24,height:24};default:return{width:16,height:16}}},I=S(),P=A(),E=(()=>{switch(R){case"small":return 14;case"large":return 28;default:return 20}})();return<Os style={{position:"relative"}}>
411
+ {C&&C.trim()!==""?<Il source={{uri:C}}style={[I,{borderRadius:M.borderRadius.full}]}resizeMode="cover"/>:<Os style={[I,{borderRadius:M.borderRadius.full,backgroundColor:M.colors.primary,justifyContent:"center",alignItems:"center"}]}>
412
+ <Pl style={{color:M.colors.background,fontSize:E,fontWeight:"600"}}>
409
413
  👤
410
- </Pi>
411
- </Qo>}
414
+ </Pl>
415
+ </Os>}
412
416
 
413
417
  {}
414
- {T&&<Qo style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:C.colors.online,borderRadius:C.borderRadius.full,borderWidth:2,borderColor:C.colors.background}]}/>}
415
- </Qo>},Ht=Ai;var Vi=({item:M,onPress:T})=>{let R=q(),C=M.unreadCount&&M.unreadCount>0;return<Bi style={{flexDirection:"row",alignItems:"center",paddingHorizontal:R.spacing.lg,paddingVertical:R.spacing.md,borderBottomWidth:1,borderBottomColor:R.colors.borderLight,backgroundColor:C?R.colors.unread:R.colors.background}}onPress={()=>T(M)}>
416
- <Nt style={{marginRight:R.spacing.md}}>
417
- <Ht avatar={M.avatar}isOnline={M.isOnline}size="medium"/>
418
- </Nt>
418
+ {T&&<Os style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:M.colors.online,borderRadius:M.borderRadius.full,borderWidth:2,borderColor:M.colors.background}]}/>}
419
+ </Os>},Mo=Al;var Bl=({item:C,onPress:T})=>{let R=q(),M=C.unreadCount&&C.unreadCount>0;return<Vl style={{flexDirection:"row",alignItems:"center",paddingHorizontal:R.spacing.lg,paddingVertical:R.spacing.md,borderBottomWidth:1,borderBottomColor:R.colors.borderLight,backgroundColor:M?R.colors.unread:R.colors.background}}onPress={()=>T(C)}>
420
+ <Ro style={{marginRight:R.spacing.md}}>
421
+ <Mo avatar={C.avatar}isOnline={C.isOnline}size="medium"/>
422
+ </Ro>
419
423
 
420
- <Nt style={{flex:1,marginRight:R.spacing.md}}>
424
+ <Ro style={{flex:1,marginRight:R.spacing.md}}>
421
425
  {}
422
- <Nt style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:R.spacing.xs}}>
423
- <Io style={{fontSize:R.typography.fontSize.base,flex:1,fontWeight:C?R.typography.fontWeight.bold:R.typography.fontWeight.semibold,color:R.colors.text}}>
424
- {M.name}
425
- </Io>
426
- <Io style={{fontSize:R.typography.fontSize.sm,marginLeft:R.spacing.sm,color:C?R.colors.gray[700]:R.colors.textSecondary,fontWeight:C?R.typography.fontWeight.medium:R.typography.fontWeight.normal}}>
427
- {M.time}
428
- </Io>
429
- </Nt>
426
+ <Ro style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:R.spacing.xs}}>
427
+ <Yo style={{fontSize:R.typography.fontSize.base,flex:1,fontWeight:M?R.typography.fontWeight.bold:R.typography.fontWeight.semibold,color:R.colors.text}}>
428
+ {C.name}
429
+ </Yo>
430
+ <Yo style={{fontSize:R.typography.fontSize.sm,marginLeft:R.spacing.sm,color:M?R.colors.gray[700]:R.colors.textSecondary,fontWeight:M?R.typography.fontWeight.medium:R.typography.fontWeight.normal}}>
431
+ {C.time}
432
+ </Yo>
433
+ </Ro>
430
434
 
431
435
  {}
432
- <Nt style={{flexDirection:"row",alignItems:"center"}}>
433
- <Io style={{fontSize:R.typography.fontSize.sm,flex:1,color:C?R.colors.gray[800]:R.colors.textSecondary,fontWeight:C?R.typography.fontWeight.medium:R.typography.fontWeight.normal}}numberOfLines={1}>
434
- {M.message}
435
- </Io>
436
- {M.unreadCount&&<Nt style={{width:20,height:20,backgroundColor:R.colors.primary,borderRadius:R.borderRadius.full,alignItems:"center",justifyContent:"center",marginLeft:R.spacing.sm}}>
437
- <Io style={{fontSize:R.typography.fontSize.xs,color:"white",fontWeight:R.typography.fontWeight.bold}}>
438
- {M.unreadCount}
439
- </Io>
440
- </Nt>}
441
- </Nt>
442
- </Nt>
443
- </Bi>},Wt=Vi;var Ei=({chats:M,onChatPress:T,onRefresh:R,refreshing:C=!1})=>{let S=({item:A})=><Wt item={A}onPress={T}/>;return<Di data={M}renderItem={S}keyExtractor={A=>A.id}showsVerticalScrollIndicator={!1}style={{flex:1}}refreshControl={R?<Li refreshing={C}onRefresh={R}tintColor="#007AFF"colors={["#007AFF"]}/>:void 0}/>},Zo=Ei;import{View as Oi,Text as Fi}from"react-native";var Hi=({title:M})=>{let T=q();return<Oi style={{backgroundColor:T.colors.background,paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.lg,borderBottomWidth:1,borderBottomColor:T.colors.borderLight}}>
444
- <Fi style={{fontSize:T.typography.fontSize.xxl,fontWeight:T.typography.fontWeight.bold,color:T.colors.text}}>
445
- {M}
446
- </Fi>
447
- </Oi>},es=Hi;import{View as Ms,TextInput as Ni,TouchableOpacity as Wi}from"react-native";import{Search as Ui,X as Ki}from"lucide-react-native";var qi=({value:M,onChangeText:T,onClear:R,placeholder:C="Search chats..."})=>{let S=q();return<Ms style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.md,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
448
- <Ms style={{position:"relative"}}>
449
- <Ms style={{position:"absolute",left:S.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
450
- <Ui size={20}color={S.colors.textMuted}/>
451
- </Ms>
436
+ <Ro style={{flexDirection:"row",alignItems:"center"}}>
437
+ <Yo style={{fontSize:R.typography.fontSize.sm,flex:1,color:M?R.colors.gray[800]:R.colors.textSecondary,fontWeight:M?R.typography.fontWeight.medium:R.typography.fontWeight.normal}}numberOfLines={1}>
438
+ {C.message}
439
+ </Yo>
440
+ {C.unreadCount&&<Ro style={{width:20,height:20,backgroundColor:R.colors.primary,borderRadius:R.borderRadius.full,alignItems:"center",justifyContent:"center",marginLeft:R.spacing.sm}}>
441
+ <Yo style={{fontSize:R.typography.fontSize.xs,color:"white",fontWeight:R.typography.fontWeight.bold}}>
442
+ {C.unreadCount}
443
+ </Yo>
444
+ </Ro>}
445
+ </Ro>
446
+ </Ro>
447
+ </Vl>},To=Bl;var jl=({chats:C,onChatPress:T,onRefresh:R,refreshing:M=!1})=>{let S=({item:A})=><To item={A}onPress={T}/>;return<Dl data={C}renderItem={S}keyExtractor={A=>A.id}showsVerticalScrollIndicator={!1}style={{flex:1}}refreshControl={R?<Ll refreshing={M}onRefresh={R}tintColor="#007AFF"colors={["#007AFF"]}/>:void 0}/>},Fs=jl;import{View as El,Text as Ol}from"react-native";var Fl=({title:C})=>{let T=q();return<El style={{backgroundColor:T.colors.background,paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.lg,borderBottomWidth:1,borderBottomColor:T.colors.borderLight}}>
448
+ <Ol style={{fontSize:T.typography.fontSize.xxl,fontWeight:T.typography.fontWeight.bold,color:T.colors.text}}>
449
+ {C}
450
+ </Ol>
451
+ </El>},Hs=Fl;import{View as Ns,TextInput as Hl,TouchableOpacity as Nl}from"react-native";import{Search as Wl,X as Ul}from"lucide-react-native";var Kl=({value:C,onChangeText:T,onClear:R,placeholder:M})=>{let S=q(),I=Pe()("search.placeholder");return<Ns style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.md,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
452
+ <Ns style={{position:"relative"}}>
453
+ <Ns style={{position:"absolute",left:S.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
454
+ <Wl size={20}color={S.colors.textMuted}/>
455
+ </Ns>
452
456
 
453
- <Ni value={M}onChangeText={T}placeholder={C}placeholderTextColor={S.colors.textMuted}style={{backgroundColor:S.colors.surfaceSecondary,borderRadius:S.borderRadius.full,paddingLeft:48,paddingRight:40,paddingVertical:S.spacing.md,color:S.colors.text,fontSize:S.typography.fontSize.base}}autoCapitalize="none"autoCorrect={!1}clearButtonMode="never"/>
457
+ <Hl value={C}onChangeText={T}placeholder={M||I}placeholderTextColor={S.colors.textMuted}style={{backgroundColor:S.colors.surfaceSecondary,borderRadius:S.borderRadius.full,paddingLeft:48,paddingRight:40,paddingVertical:S.spacing.md,color:S.colors.text,fontSize:S.typography.fontSize.base}}autoCapitalize="none"autoCorrect={!1}clearButtonMode="never"/>
454
458
 
455
- {M.length>0&&<Wi onPress={R}style={{position:"absolute",right:S.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
456
- <Ki size={20}color={S.colors.textMuted}/>
457
- </Wi>}
458
- </Ms>
459
- </Ms>},Cs=qi;import{useState as $i,useCallback as Rt}from"react";import Rs from"dayjs";var Ke=Rs(),Xs=Ke.subtract(1,"day"),Qs=Ke.subtract(2,"day"),Zs=Ke.subtract(3,"day"),Yi=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:Zs.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:Zs.hour(10).minute(31).toISOString(),reactions:[{emoji:"\u2764\uFE0F",count:1,users:["anna"]}]},{id:3,text:"Good too! What are we doing tonight?",isMe:!1,timestamp:Qs.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Qs.hour(14).minute(25).toISOString(),reactions:[{emoji:"\u{1F44D}",count:2,users:["anna","me"]},{emoji:"\u{1F3AC}",count:1,users:["anna"]}]},{id:5,text:"Good idea! I'll check the showtimes",isMe:!1,timestamp:Xs.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:Xs.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:Ke.hour(8).minute(30).toISOString(),senderName:"Anna",reactions:[{emoji:"\u{1F602}",count:1,users:["me"]},{emoji:"\u{1F3AD}",count:1,users:["anna"]}]},{id:8,text:"Sounds great! I'll check what's playing",isMe:!0,timestamp:Ke.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:Ke.hour(9).minute(10).toISOString(),senderName:"Anna",replyTo:{id:8,text:"Sounds great! I'll check what's playing",senderName:void 0,isMe:!0,type:"text"}},{id:10,text:"How about 7:00 PM? The show is at 8:00 PM",isMe:!0,timestamp:Ke.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],Ts=M=>{let T=Yi.map(v=>v.isMe?v:{...v,senderName:M||v.senderName}),[R,C]=$i(T),S=Rt((v,V)=>{if(console.log("sendMessage called with text:",v,"and replyTo:",V),!v.trim())return;let D={id:Date.now(),text:v.trim(),isMe:!0,timestamp:Rs().toISOString(),status:"sent",replyTo:V};C(z=>[...z,D]),setTimeout(()=>{C(z=>z.map(L=>L.id===D.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{C(z=>z.map(L=>L.id===D.id?{...L,status:"read"}:L))},3e3)},[]),A=Rt((v,V,D)=>{let z={id:Date.now(),text:V||"",isMe:!0,timestamp:Rs().toISOString(),status:"sent",type:"image",imageData:v,replyTo:D};C(L=>[...L,z]),setTimeout(()=>{C(L=>L.map(k=>k.id===z.id?{...k,status:"delivered"}:k))},1e3),setTimeout(()=>{C(L=>L.map(k=>k.id===z.id?{...k,status:"read"}:k))},3e3)},[]),I=Rt((v,V)=>{C(D=>D.map(z=>z.id===v?{...z,status:V}:z))},[]),P=Rt((v,V)=>{C(D=>D.map(z=>{if(z.id===v){let L=z.reactions||[],k=L.findIndex(O=>O.emoji===V);if(k>=0){let O=[...L];return O[k]={...O[k],count:O[k].count+1,users:[...O[k].users,"me"]},{...z,reactions:O}}else{let O={emoji:V,count:1,users:["me"]};return{...z,reactions:[...L,O]}}}return z}))},[]),B=Rt((v,V)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",V),C(D=>D.map(z=>{if(z.id===v){let L=z.reactions||[],k=L.findIndex(O=>O.emoji===V);if(k>=0){let O=L[k];if(O.count>1){let F=[...L];return F[k]={...O,count:O.count-1,users:O.users.filter(H=>H!=="me")},{...z,reactions:F}}else return{...z,reactions:L.filter(F=>F.emoji!==V)}}}return z}))},[]),E=Rt(v=>{console.log("deleteMessage called with messageId:",v),C(V=>{let D=V.map(z=>z.id===v?{...z,deleted:!0}:z);return console.log("Message marked as deleted:",v),D})},[]);return{messages:R,sendMessage:S,sendImageMessage:A,updateMessageStatus:I,addReaction:P,deleteMessage:E,removeReaction:B}};import{useState as er,useCallback as Te}from"react";var Ss=(M={})=>{qe();let[T,R]=er(M.initialMessages||[]),[C,S]=er(!1),A=Te((L,k)=>{let O={id:Date.now(),text:L,isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:k?{id:k.id,text:k.text,senderName:k.senderName,isMe:k.isMe}:void 0};R(F=>[O,...F])},[]),I=Te(L=>{R(k=>[L,...k])},[]),P=Te((L,k)=>{R(O=>O.map(F=>F.id===L?{...F,...k}:F))},[]),B=Te(L=>{R(k=>k.filter(O=>O.id!==L))},[]),E=Te((L,k)=>{R(O=>O.map(F=>{if(F.id!==L)return F;let H=F.reactions||[];if(H.find(j=>j.emoji===k))return{...F,reactions:H.map(j=>j.emoji===k?{...j,count:j.count+1,users:[...j.users,"current-user"]}:j)};{let j={emoji:k,count:1,users:["current-user"]};return{...F,reactions:[...H,j]}}}))},[]),v=Te((L,k)=>{R(O=>O.map(F=>{if(F.id!==L)return F;let H=F.reactions||[],N=H.find(j=>j.emoji===k);return N?N.count<=1?{...F,reactions:H.filter(j=>j.emoji!==k)}:{...F,reactions:H.map(j=>j.emoji===k?{...j,count:j.count-1,users:j.users.filter(J=>J!=="current-user")}:j)}:F}))},[]),V=Te(L=>{S(L)},[]),D=Te(()=>{R(M.initialMessages||[]),S(!1)},[M.initialMessages]),z=Te(L=>T.find(k=>k.id===L),[T]);return{messages:T,isTyping:C,sendMessage:A,addReaction:E,removeReaction:v,setMessages:R,addMessage:I,updateMessage:P,deleteMessage:B,setTyping:V,resetChat:D,getMessageById:z}};import{useState as Pm,useCallback as Am,useRef as zm,useEffect as Bm}from"react";var eg=ae(Do),tg=ae(Ao),og=be(St),rg=ae(Ie),ng=ae(we),ig=ae(Kt),cg=ae(Mt),ug=ae(Zo),mg=ae(Wt),gg=ae(es),pg=ae(Cs),yg=ae(Ht),xg=ae(We),Cg=ae(Bs),Rg=be(q),vg=be(Ss),Pg=be(Ts),Ag=be(Lt),zg=be(Et),Bg=be(Ot),Vg=be(It),kg=be(kt);export{xg as AttachmentMenu,eg as Chat,yg as ChatAvatar,gg as ChatHeader,mg as ChatItem,ug as ChatList,pg as ChatListSearchBar,tg as ChatProvider,ig as ChatScreenHeader,ng as MessageInput,rg as MessageList,Cg as ThemeProvider,cg as TypingIndicator,vt as defaultTheme,tr as getAuthState,or as getProjectId,rr as initChat,sr as isInitialized,Vg as useAttachments,og as useChatConfig,Pg as useChatMessages,vg as useChatSDK,zg as useMessageActions,kg as useMessageInput,Ag as useMessageList,Bg as useMessageReactions,Rg as useTheme};
459
+ {C.length>0&&<Nl onPress={R}style={{position:"absolute",right:S.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
460
+ <Ul size={20}color={S.colors.textMuted}/>
461
+ </Nl>}
462
+ </Ns>
463
+ </Ns>},Ws=Kl;import{useState as ql,useCallback as jt}from"react";import Us from"dayjs";var Rt=Us(),Fn=Rt.subtract(1,"day"),Hn=Rt.subtract(2,"day"),Nn=Rt.subtract(3,"day"),$l=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:Nn.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:Nn.hour(10).minute(31).toISOString(),reactions:[{emoji:"\u2764\uFE0F",count:1,users:["anna"]}]},{id:3,text:"Good too! What are we doing tonight?",isMe:!1,timestamp:Hn.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Hn.hour(14).minute(25).toISOString(),reactions:[{emoji:"\u{1F44D}",count:2,users:["anna","me"]},{emoji:"\u{1F3AC}",count:1,users:["anna"]}]},{id:5,text:"Good idea! I'll check the showtimes",isMe:!1,timestamp:Fn.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:Fn.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:Rt.hour(8).minute(30).toISOString(),senderName:"Anna",reactions:[{emoji:"\u{1F602}",count:1,users:["me"]},{emoji:"\u{1F3AD}",count:1,users:["anna"]}]},{id:8,text:"Sounds great! I'll check what's playing",isMe:!0,timestamp:Rt.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:Rt.hour(9).minute(10).toISOString(),senderName:"Anna",replyTo:{id:8,text:"Sounds great! I'll check what's playing",senderName:void 0,isMe:!0,type:"text"}},{id:10,text:"How about 7:00 PM? The show is at 8:00 PM",isMe:!0,timestamp:Rt.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],Ks=C=>{let T=$l.map(v=>v.isMe?v:{...v,senderName:C||v.senderName}),[R,M]=ql(T),S=jt((v,k)=>{if(console.log("sendMessage called with text:",v,"and replyTo:",k),!v.trim())return;let D={id:Date.now(),text:v.trim(),isMe:!0,timestamp:Us().toISOString(),status:"sent",replyTo:k};M(V=>[...V,D]),setTimeout(()=>{M(V=>V.map(B=>B.id===D.id?{...B,status:"delivered"}:B))},1e3),setTimeout(()=>{M(V=>V.map(B=>B.id===D.id?{...B,status:"read"}:B))},3e3)},[]),A=jt((v,k,D)=>{let V={id:Date.now(),text:k||"",isMe:!0,timestamp:Us().toISOString(),status:"sent",type:"image",imageData:v,replyTo:D};M(B=>[...B,V]),setTimeout(()=>{M(B=>B.map(L=>L.id===V.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{M(B=>B.map(L=>L.id===V.id?{...L,status:"read"}:L))},3e3)},[]),I=jt((v,k)=>{M(D=>D.map(V=>V.id===v?{...V,status:k}:V))},[]),P=jt((v,k)=>{M(D=>D.map(V=>{if(V.id===v){let B=V.reactions||[],L=B.findIndex(F=>F.emoji===k);if(L>=0){let F=[...B];return F[L]={...F[L],count:F[L].count+1,users:[...F[L].users,"me"]},{...V,reactions:F}}else{let F={emoji:k,count:1,users:["me"]};return{...V,reactions:[...B,F]}}}return V}))},[]),z=jt((v,k)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",k),M(D=>D.map(V=>{if(V.id===v){let B=V.reactions||[],L=B.findIndex(F=>F.emoji===k);if(L>=0){let F=B[L];if(F.count>1){let j=[...B];return j[L]={...F,count:F.count-1,users:F.users.filter(H=>H!=="me")},{...V,reactions:j}}else return{...V,reactions:B.filter(j=>j.emoji!==k)}}}return V}))},[]),E=jt(v=>{console.log("deleteMessage called with messageId:",v),M(k=>{let D=k.map(V=>V.id===v?{...V,deleted:!0}:V);return console.log("Message marked as deleted:",v),D})},[]);return{messages:R,sendMessage:S,sendImageMessage:A,updateMessageStatus:I,addReaction:P,deleteMessage:E,removeReaction:z}};import{useState as Wn,useCallback as je}from"react";var qs=(C={})=>{St();let[T,R]=Wn(C.initialMessages||[]),[M,S]=Wn(!1),A=je((B,L)=>{let F={id:Date.now(),text:B,isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:L?{id:L.id,text:L.text,senderName:L.senderName,isMe:L.isMe}:void 0};R(j=>[F,...j])},[]),I=je(B=>{R(L=>[B,...L])},[]),P=je((B,L)=>{R(F=>F.map(j=>j.id===B?{...j,...L}:j))},[]),z=je(B=>{R(L=>L.filter(F=>F.id!==B))},[]),E=je((B,L)=>{R(F=>F.map(j=>{if(j.id!==B)return j;let H=j.reactions||[];if(H.find(O=>O.emoji===L))return{...j,reactions:H.map(O=>O.emoji===L?{...O,count:O.count+1,users:[...O.users,"current-user"]}:O)};{let O={emoji:L,count:1,users:["current-user"]};return{...j,reactions:[...H,O]}}}))},[]),v=je((B,L)=>{R(F=>F.map(j=>{if(j.id!==B)return j;let H=j.reactions||[],N=H.find(O=>O.emoji===L);return N?N.count<=1?{...j,reactions:H.filter(O=>O.emoji!==L)}:{...j,reactions:H.map(O=>O.emoji===L?{...O,count:O.count-1,users:O.users.filter(_=>_!=="current-user")}:O)}:j}))},[]),k=je(B=>{S(B)},[]),D=je(()=>{R(C.initialMessages||[]),S(!1)},[C.initialMessages]),V=je(B=>T.find(L=>L.id===B),[T]);return{messages:T,isTyping:M,sendMessage:A,addReaction:E,removeReaction:v,setMessages:R,addMessage:I,updateMessage:P,deleteMessage:z,setTyping:k,resetChat:D,getMessageById:V}};import{useState as Wp,useCallback as Up,useRef as Kp,useEffect as qp}from"react";var gg=Re(es),hg=Re(Jo),fg=Be(Ft),xg=Re(Oe),bg=Re(Ee),Mg=Re(Ao),Tg=Re(Dt),wg=Re(Fs),Ig=Re(To),vg=Re(Hs),Pg=Re(Ws),Vg=Re(Mo),Bg=Re(Ct),Lg=Re(tn),jg=Be(q),Ng=Be(qs),Wg=Be(Ks),Ug=Be(Jt),Kg=Be(Xt),qg=Be(Qt),$g=Be(Nt),Gg=Be(_t);export{Bg as AttachmentMenu,gg as Chat,Vg as ChatAvatar,vg as ChatHeader,Ig as ChatItem,wg as ChatList,Pg as ChatListSearchBar,hg as ChatProvider,Mg as ChatScreenHeader,Io as I18nProvider,bg as MessageInput,xg as MessageList,Lg as ThemeProvider,Tg as TypingIndicator,Wt as defaultTheme,So as defaultTranslations,Un as getAuthState,Kn as getProjectId,Ot as getTranslation,$n as initChat,qn as isInitialized,wo as isSupportedLocale,$g as useAttachments,fg as useChatConfig,Wg as useChatMessages,Ng as useChatSDK,Kg as useMessageActions,Gg as useMessageInput,Ug as useMessageList,qg as useMessageReactions,jg as useTheme,Js as useTranslation,Pe as useTranslationFunction};