@usechat/react-native 1.0.4 → 1.0.6

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