@usechat/react-native 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,155 +1,145 @@
1
1
  'use client'
2
- "use strict";var Os=Object.create;var Ro=Object.defineProperty;var Fs=Object.getOwnPropertyDescriptor;var Hs=Object.getOwnPropertyNames;var Ns=Object.getPrototypeOf,Ws=Object.prototype.hasOwnProperty;var Us=(M,S)=>()=>(M&&(S=M(M=0)),S);var ns=(M,S)=>{for(var C in S)Ro(M,C,{get:S[C],enumerable:!0})},rs=(M,S,C,R)=>{if(S&&typeof S=="object"||typeof S=="function")for(let T of Hs(S))!Ws.call(M,T)&&T!==C&&Ro(M,T,{get:()=>S[T],enumerable:!(R=Fs(S,T))||R.enumerable});return M};var Q=(M,S,C)=>(C=M!=null?Os(Ns(M)):{},rs(S||!M||!M.__esModule?Ro(C,"default",{value:M,enumerable:!0}):C,M)),Ks=M=>rs(Ro({},"__esModule",{value:!0}),M);var As={};ns(As,{copyToClipboard:()=>An,isClipboardAvailable:()=>zn});var An,zn,zs=Us(()=>{"use strict";An=async M=>{console.log("copyToClipboard called with text:",M);try{try{let{setStringAsync:S}=await import("expo-clipboard");console.log("expo-clipboard imported successfully"),console.log("setStringAsync function:",S),await S(M),console.log("Text copied to clipboard successfully")}catch(S){throw console.error("Failed to import expo-clipboard:",S),new Error("expo-clipboard not available")}try{let S=await import("react-native-toast-message"),C=S.default||S;console.log("react-native-toast-message imported successfully"),C.show({type:"success",text1:"Copied to clipboard",text2:"Message copied successfully",position:"bottom",visibilityTime:2e3}),console.log("Toast shown successfully")}catch(S){console.log("Toast not available, but message copied to clipboard"),console.error("Toast import error:",S)}return!0}catch(S){console.error("Failed to copy to clipboard:",S);try{let C=await import("react-native-toast-message");(C.default||C).show({type:"error",text1:"Copy failed",text2:"Failed to copy message to clipboard",position:"bottom",visibilityTime:2e3})}catch(C){console.error("Copy failed: expo-clipboard not available"),console.error("Toast import error:",C)}return!1}},zn=async()=>{try{return await import("expo-clipboard"),!0}catch{return!1}}});var jn={};ns(jn,{AttachmentMenu:()=>It,Chat:()=>Ao,ChatAvatar:()=>Mo,ChatHeader:()=>Qo,ChatItem:()=>Co,ChatList:()=>Xo,ChatListSearchBar:()=>Zo,ChatProvider:()=>Po,ChatScreenHeader:()=>Vo,DateSeparator:()=>Qt,DeletedMessage:()=>Nt,EmojiPicker:()=>St,ImageMessage:()=>Ft,MessageActionSheet:()=>Kt,MessageInput:()=>ht,MessageInputCompound:()=>Jo,MessageInputProvider:()=>Go,MessageItem:()=>Wt,MessageList:()=>ft,MessageListCompound:()=>dt,MessageListProvider:()=>Lt,ReactionDetailsSheet:()=>$t,ReplyBubble:()=>Mt,ReplyPreview:()=>Rt,ScrollToBottomButton:()=>Xt,ThemeProvider:()=>ms,TypingIndicator:()=>Gt,defaultTheme:()=>jt,initChat:()=>js,useAttachments:()=>lo,useChatConfig:()=>io,useChatMessages:()=>es,useChatSDK:()=>ts,useMessageActions:()=>po,useMessageInput:()=>uo,useMessageInputContext:()=>lt,useMessageList:()=>mo,useMessageListContext:()=>zt,useMessageListScroll:()=>go,useMessageReactions:()=>ho,useMessageReply:()=>yo,useTheme:()=>K,useTypingIndicator:()=>os});module.exports=Ks(jn);var Io=require("react"),cs=require("react-native"),vo=require("react-native-keyboard-controller");var To=require("react"),Re=require("react-native");var ze={isInitialized:!1,isInitializing:!1,error:null,initData:null},as=M=>{ze={...ze,isInitializing:M,error:M?null:ze.error}},is=M=>{ze={isInitialized:!0,isInitializing:!1,error:null,initData:M}},Dt=M=>{ze={isInitialized:!1,isInitializing:!1,error:M,initData:null}};var Wo=()=>{if(ze.isInitializing)throw new Error("Chat SDK is initializing. Please wait...");if(ze.error)throw new Error(`Chat initialization failed: ${ze.error}. Please call initChat() with a valid project ID.`);if(!ze.isInitialized)throw new Error("Chat SDK is not initialized. Please call initChat() with a valid project ID before using chat components.")},So=()=>({isAuthorized:ze.isInitialized&&!ze.error,isInitialized:ze.isInitialized,isInitializing:ze.isInitializing,hasError:!!ze.error,error:ze.error,initData:ze.initData});function wo(M,S={}){let{fallback:C,showInitializingState:R=!0}=S;return function(A){let[I,z]=(0,To.useState)(So());if((0,To.useEffect)(()=>{let P=()=>{let v=So();z(v)};P();let E=setInterval(P,100);return()=>clearInterval(E)},[]),I.isInitializing&&R)return<Re.View style={We.container}>
3
- <Re.ActivityIndicator size="large"color="#007AFF"/>
4
- <Re.Text style={We.text}>Initializing chat...</Re.Text>
5
- </Re.View>;if(I.hasError)return<Re.View style={We.container}>
6
- <Re.Text style={We.errorTitle}>Chat Initialization Failed</Re.Text>
7
- <Re.Text style={We.errorText}>{I.error}</Re.Text>
8
- <Re.Text style={We.helpText}>
9
- Please call initChat() with a valid project ID before using chat components.
10
- </Re.Text>
11
- </Re.View>;if(!I.isInitialized)return<Re.View style={We.container}>
12
- <Re.Text style={We.errorTitle}>Chat Not Initialized</Re.Text>
13
- <Re.Text style={We.errorText}>
14
- Chat SDK has not been initialized. Please call initChat() first.
15
- </Re.Text>
16
- <Re.Text style={We.helpText}>
17
- Please call initChat() with a valid project ID.
18
- </Re.Text>
19
- </Re.View>;if(C){let P=C;return<P/>}try{return Wo(),<M{...A}/>}catch(P){return<Re.View style={We.container}>
20
- <Re.Text style={We.errorTitle}>Authorization Error</Re.Text>
21
- <Re.Text style={We.errorText}>
22
- {P instanceof Error?P.message:"Unknown error"}
23
- </Re.Text>
24
- </Re.View>}}}var We=Re.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center",padding:20,backgroundColor:"#f5f5f5"},text:{marginTop:10,fontSize:16,color:"#666",textAlign:"center"},errorTitle:{fontSize:18,fontWeight:"bold",color:"#d32f2f",marginBottom:10,textAlign:"center"},errorText:{fontSize:14,color:"#666",textAlign:"center",marginBottom:15,lineHeight:20},helpText:{fontSize:12,color:"#999",textAlign:"center",lineHeight:16,fontFamily:"monospace"}});function qs(M={}){let{licenseKey:S,attribution:C=!0,environment:R="production"}=M;return R==="development"?{isValid:!0,type:"free",requiresAttribution:!0,message:"Development mode - remember to include attribution in production"}:S?S.startsWith("usechat_")&&S.length>20?{isValid:!0,type:"commercial",requiresAttribution:!1,message:"Commercial license active"}:{isValid:!1,type:"invalid",requiresAttribution:!0,message:"Invalid license key format"}:C?{isValid:!0,type:"free",requiresAttribution:!0,message:"Free license - attribution required"}:{isValid:!1,type:"invalid",requiresAttribution:!0,message:"Commercial license required or attribution must be enabled"}}function $s(){return"Powered by UseChat SDK - https://usechat.dev"}function Ys(M){if(__DEV__){let S=M.isValid?"\u2705":"\u274C";console.log(`${S} UseChat SDK License: ${M.message}`),M.requiresAttribution&&console.log("\u{1F4DD} Attribution required:",$s()),M.isValid||console.warn("\u26A0\uFE0F License violation detected. Please visit https://usechat.dev/licensing for more information.")}}function ls(M){let S=qs(M);return __DEV__&&Ys(S),S}var ds=(0,Io.createContext)(null),_s=({children:M,config:S={}})=>{let C=ls(S),R={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...S};return<ds.Provider value={{config:R}}>
25
- <vo.KeyboardProvider>
26
- <vo.KeyboardAvoidingView behavior={R.keyboardBehavior}style={[Gs.keyboardContainer]}keyboardVerticalOffset={R.keyboardVerticalOffset}>
2
+ "use strict";var _s=Object.create;var So=Object.defineProperty;var Js=Object.getOwnPropertyDescriptor;var Xs=Object.getOwnPropertyNames;var Qs=Object.getPrototypeOf,Zs=Object.prototype.hasOwnProperty;var er=(M,T)=>()=>(M&&(T=M(M=0)),T);var ps=(M,T)=>{for(var C in T)So(M,C,{get:T[C],enumerable:!0})},hs=(M,T,C,R)=>{if(T&&typeof T=="object"||typeof T=="function")for(let S of Xs(T))!Zs.call(M,S)&&S!==C&&So(M,S,{get:()=>T[S],enumerable:!(R=Js(T,S))||R.enumerable});return M};var Q=(M,T,C)=>(C=M!=null?_s(Qs(M)):{},hs(T||!M||!M.__esModule?So(C,"default",{value:M,enumerable:!0}):C,M)),tr=M=>hs(So({},"__esModule",{value:!0}),M);var Fs={};ps(Fs,{copyToClipboard:()=>zr,isClipboardAvailable:()=>Br});var zr,Br,Ns=er(()=>{"use strict";zr=async M=>{console.log("copyToClipboard called with text:",M);try{try{let{setStringAsync:T}=await import("expo-clipboard");console.log("expo-clipboard imported successfully"),console.log("setStringAsync function:",T),await T(M),console.log("Text copied to clipboard successfully")}catch(T){throw console.error("Failed to import expo-clipboard:",T),new Error("expo-clipboard not available")}try{let T=await import("react-native-toast-message"),C=T.default||T;console.log("react-native-toast-message imported successfully"),C.show({type:"success",text1:"Copied to clipboard",text2:"Message copied successfully",position:"bottom",visibilityTime:2e3}),console.log("Toast shown successfully")}catch(T){console.log("Toast not available, but message copied to clipboard"),console.error("Toast import error:",T)}return!0}catch(T){console.error("Failed to copy to clipboard:",T);try{let C=await import("react-native-toast-message");(C.default||C).show({type:"error",text1:"Copy failed",text2:"Failed to copy message to clipboard",position:"bottom",visibilityTime:2e3})}catch(C){console.error("Copy failed: expo-clipboard not available"),console.error("Toast import error:",C)}return!1}},Br=async()=>{try{return await import("expo-clipboard"),!0}catch{return!1}}});var an={};ps(an,{AttachmentMenu:()=>Jr,Chat:()=>Or,ChatAvatar:()=>_r,ChatHeader:()=>Yr,ChatItem:()=>$r,ChatList:()=>qr,ChatListSearchBar:()=>Gr,ChatProvider:()=>Hr,ChatScreenHeader:()=>Ur,MessageInput:()=>Wr,MessageList:()=>Nr,ThemeProvider:()=>Xr,TypingIndicator:()=>Kr,defaultTheme:()=>It,getAuthState:()=>ys,getProjectId:()=>xs,initChat:()=>Ms,isInitialized:()=>bs,useAttachments:()=>rn,useChatConfig:()=>Fr,useChatMessages:()=>en,useChatSDK:()=>Zr,useMessageActions:()=>on,useMessageInput:()=>nn,useMessageList:()=>tn,useMessageReactions:()=>sn,useTheme:()=>Qr});module.exports=tr(an);var at={isInitialized:!1,projectId:null,error:null},fs=M=>{at={isInitialized:!0,projectId:M,error:null}},Ct=M=>{at={isInitialized:!1,projectId:null,error:M}};var ys=()=>({...at}),wt=()=>{if(at.error)throw new Error(`UseChat SDK initialization failed: ${at.error}
3
+
4
+ Please call initChat() with a valid project ID before using any UseChat components or hooks.
5
+
6
+ Example:
7
+ import { initChat } from '@usechat/react-native';
8
+ await initChat({ projectId: 'your-project-id' });`);if(!at.isInitialized)throw new Error(`UseChat SDK is not initialized.
9
+
10
+ Please call initChat() with a valid project ID before using any UseChat components or hooks.
11
+
12
+ Example:
13
+ import { initChat } from '@usechat/react-native';
14
+ await initChat({ projectId: 'your-project-id' });`)},xs=()=>(wt(),at.projectId),bs=()=>at.isInitialized&&!at.error;var Ms=async M=>{let{projectId:T,apiUrl:C="http://localhost:3000/api/chat/init",debug:R=!1}=M;if(!T){let S="Project ID is required";throw Ct(S),new Error(S)}try{R&&console.log(`[UseChat SDK] Validating projectId: ${T}`);let S=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:T})});if(R&&console.log(`[Chat SDK] Response status: ${S.status}, ok: ${S.ok}`),!S.ok){let P=`HTTP ${S.status}: ${S.statusText}`;try{let z=await S.json();P=z.error||z.message||P}catch{try{let j=await S.text();j&&(P=`Server error: ${j}`)}catch{P=`Failed to initialize chat (HTTP ${S.status})`}}throw Ct(P),new Error(P)}let A;try{let P=await S.text();if(R&&console.log(`[Chat SDK] Response text: ${P}`),!P){let z="Server returned empty response";throw Ct(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 Ct(z),new Error(z)}if(!A||typeof A!="object"){let P="Server returned invalid response format";throw Ct(P),new Error(P)}let I=A;return R&&console.log(`[UseChat SDK] Successfully initialized with projectId: ${T}`),fs(T),I}catch(S){R&&console.error("[Chat SDK] Init error:",S);let A;throw S instanceof TypeError&&S.message.includes("fetch")?A="Network error: Unable to connect to server. Please check your internet connection.":S instanceof Error?A=S.message:A="Failed to initialize chat: Unknown error",A.includes("Project ID is required")||Ct(A),new Error(A)}};var ve=Q(require("react")),st=require("react-native");var wo=require("react"),Cs=require("react-native"),Io=require("react-native-keyboard-controller"),Rs=(0,wo.createContext)(null),or=({children:M,config:T={}})=>{let C={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...T};return<Rs.Provider value={{config:C}}>
15
+ <Io.KeyboardProvider>
16
+ <Io.KeyboardAvoidingView behavior={C.keyboardBehavior}style={[sr.keyboardContainer]}keyboardVerticalOffset={C.keyboardVerticalOffset}>
27
17
  {}
28
18
  {M}
29
- </vo.KeyboardAvoidingView>
30
- </vo.KeyboardProvider>
31
- </ds.Provider>},Po=wo(_s),io=()=>{let M=(0,Io.useContext)(ds);if(!M)throw new Error("useChatConfig must be used within a ChatProvider");return M.config},Gs=cs.StyleSheet.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});var Pe=Q(require("react")),at=require("react-native");var rt=require("react"),lo=(M={})=>{let{uploader:S,maxAttachments:C=10,maxFileSize:R=10*1024*1024,allowedTypes:T=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:z}=M,[P,E]=(0,rt.useState)([]),[v,V]=(0,rt.useState)(!1),[D,B]=(0,rt.useState)(0),k=(0,rt.useCallback)(N=>{if(P.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(Oe=>Oe.endsWith("/*")?N.data.type.startsWith(Oe.slice(0,-1)):N.data.type===Oe)){console.warn(`File type ${N.data.type} not allowed`);return}let j={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};E(te=>[...te,j]),A&&A(j)},[P.length,C,R,T,A]),L=(0,rt.useCallback)(N=>{E(j=>j.filter(te=>te.id!==N)),I&&I(N)},[I]),O=(0,rt.useCallback)(()=>{E([])},[]),F=(0,rt.useCallback)(async N=>{try{let j;switch(N){case"image":j={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":j={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":j={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":j={type:"contact",data:{id:"contact-1",name:"John Doe",phoneNumbers:["+1234567890"],emails:["john@example.com"]}};break;default:throw new Error(`Unsupported attachment type: ${N}`)}let te={id:`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:N,data:j.data,fileName:j.data.fileName||j.data.name,fileSize:j.data.fileSize||j.data.size,mimeType:j.data.mimeType,uploadStatus:"pending",uploadProgress:0};k(te)}catch(j){console.error("Error opening picker:",j)}},[k]),H=(0,rt.useCallback)(async()=>{if(!S)return console.warn("No uploader provided, skipping upload"),P;if(P.length===0)return[];V(!0),B(0);try{let N=P.map(async(J,Me)=>{try{E(Ce=>Ce.map(U=>U.id===J.id?{...U,uploadStatus:"uploading",uploadProgress:0}:U));let Fe=setInterval(()=>{E(Ce=>Ce.map(U=>U.id===J.id?{...U,uploadProgress:Math.min((U.uploadProgress??0)+10,90)}:U))},100),Ye=await S.upload(J.data);clearInterval(Fe);let ke={...J,uploadStatus:"completed",uploadProgress:100,data:{...J.data,url:Ye.url,metadata:Ye.metadata}};return E(Ce=>Ce.map(U=>U.id===J.id?ke:U)),ke}catch(Fe){return console.error(`Error uploading attachment ${J.id}:`,Fe),E(Ye=>Ye.map(ke=>ke.id===J.id?{...ke,uploadStatus:"failed",uploadProgress:0}:ke)),{...J,uploadStatus:"failed",uploadProgress:0}}}),j=await Promise.all(N),Oe=j.filter(J=>J.uploadStatus==="completed").length/j.length*100;return B(Oe),z&&z(j),j}catch(N){return console.error("Error uploading attachments:",N),P}finally{V(!1)}},[P,S,z]);return{attachments:P,openPicker:F,addAttachment:k,removeAttachment:L,clearAttachments:O,uploadAttachments:H,isUploading:v,uploadProgress:D}};var Ge=require("react"),us=(M={})=>{let{onSend:S,onFocus:C,initialValue:R="",maxLength:T=1e3}=M,[A,I]=(0,Ge.useState)(R),[z,P]=(0,Ge.useState)(40),[E,v]=(0,Ge.useState)(!1),V=(0,Ge.useCallback)(H=>{H.length<=T&&I(H)},[T]),D=(0,Ge.useCallback)(H=>{if(!A.trim()&&(!H||H.length===0))return;let N=A.trim();S&&S(N,H),I(""),P(40)},[A,S]),B=(0,Ge.useCallback)(()=>{v(!0),C&&C()},[C]),k=(0,Ge.useCallback)(()=>{v(!1)},[]),L=(0,Ge.useCallback)(H=>{P(Math.max(40,Math.min(H,120)))},[]),O=(0,Ge.useCallback)(()=>{I(""),P(40)},[]),F=(0,Ge.useCallback)(H=>{I(H)},[]);return{message:A,composerHeight:z,isFocused:E,handleTextChange:V,handleSend:D,handleFocus:B,handleBlur:k,handleContentSizeChange:L,clearMessage:O,setMessage:F}};var Js=({messages:M,components:S={},renderProps:C={},onMessageSend:R,onReactionAdd:T,onReactionRemove:A,onMessageDelete:I,onActionPress:z,attachmentUploader:P,maxAttachments:E=10,maxFileSize:v=10*1024*1024,allowedFileTypes:V=["image/*","application/pdf","text/*"],enableReactionDetails:D,enableMessageActions:B=!0,enableScrollToBottom:k,enableTypingIndicator:L,isTyping:O=!1,typingUserName:F,isLoading:H=!1,loadingComponent:N})=>{let j=io(),[te,Oe]=(0,Pe.useState)(!1),J=S.MessageList||ft,Me=S.MessageInput||ht,Fe=D??j.enableReactionDetails??!0,Ye=B??j.enableMessageActions??!0,ke=k??j.enableScrollToBottom??!0,Ce=L??j.enableTypingIndicator??!0,[U,He]=(0,Pe.useState)(null),st=(0,Pe.useRef)(null),[Xe,Le]=(0,Pe.useState)(M||[]),_e=(0,Pe.useRef)((M||[]).length+1);Pe.default.useEffect(()=>{M&&(Le(M),_e.current=M.length+1)},[M]),Pe.default.useEffect(()=>{if(U&&st.current){let q=setTimeout(()=>{st.current?.focus()},150);return()=>clearTimeout(q)}},[U]);let nt=lo({uploader:P,maxAttachments:E,maxFileSize:v,allowedTypes:V}),we=us({onSend:(q,_)=>{if(U){let X={id:U.id,text:U.text,senderName:U.senderName,senderId:U.senderId,isMe:U.isMe,timestamp:U.timestamp,type:U.type==="image"?"image":"text",imageData:U.imageData};if(_&&_.length>0){let $=_[0],ve={id:_e.current++,text:q.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X,attachments:_,type:$.type==="image"?"image":"text",...$.type==="image"&&$.data&&{imageData:{uri:$.data.uri||"",width:$.data.width||300,height:$.data.height||200,fileName:$.fileName||"image.jpg",fileSize:$.fileSize||0}}};Le(Qe=>[...Qe,ve]),R&&R(ve)}else{let $={id:_e.current++,text:q.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X};Le(ve=>[...ve,$]),R&&R($)}He(null)}else if(_&&_.length>0){let X=_[0],$={id:_e.current++,text:q.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",attachments:_,type:X.type==="image"?"image":"text",...X.type==="image"&&X.data&&{imageData:{uri:X.data.uri||"",width:X.data.width||300,height:X.data.height||200,fileName:X.fileName||"image.jpg",fileSize:X.fileSize||0}}};Le(ve=>[...ve,$]),R&&R($)}else{let X={id:_e.current++,text:q.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};Le($=>[...$,X]),R&&R(X)}nt.clearAttachments()},onFocus:()=>{}}),pt=(0,Pe.useCallback)((q,_)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",q,"and emoji:",_),Le(X=>X.map($=>$.id===q?$.reactions?.find(Qe=>Qe.emoji===_)?{...$,reactions:$.reactions?.map(Qe=>Qe.emoji===_?{...Qe,count:Qe.count+1,users:[...Qe.users,"currentUser"]}:Qe)}:{...$,reactions:[...$.reactions||[],{emoji:_,count:1,users:["currentUser"]}]}:$)),T&&T(q,_)},[T]),Ho=(0,Pe.useCallback)((q,_)=>{Le(X=>X.map($=>$.id===q?{...$,reactions:$.reactions?.map(ve=>ve.emoji===_?{...ve,count:Math.max(0,ve.count-1),users:ve.users.filter(Qe=>Qe!=="currentUser")}:ve).filter(ve=>ve.count>0)}:$)),A&&A(q,_)},[A]),No=(0,Pe.useCallback)(q=>{Le(_=>_.map(X=>X.id===q?{...X,deleted:!0,text:"",reactions:void 0}:X)),I&&I(q)},[I]),Ae=(0,Pe.useCallback)(()=>{He(null)},[]),Ne=(0,Pe.useCallback)(q=>{He(q),setTimeout(()=>{st.current?.focus()},100)},[]),ao=(0,Pe.useCallback)(q=>{if(te)return;let{layout:_}=q.nativeEvent;_.height<=0||Oe(!0)},[te]);if(H)return<at.View style={Bt.container}>
32
- {N||<at.View style={Bt.loadingContainer}>
19
+ </Io.KeyboardAvoidingView>
20
+ </Io.KeyboardProvider>
21
+ </Rs.Provider>},Xo=or,qt=()=>{let M=(0,wo.useContext)(Rs);if(!M)throw new Error("useChatConfig must be used within a ChatProvider");return M.config},sr=Cs.StyleSheet.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});var ot=require("react"),$t=(M={})=>{let{uploader:T,maxAttachments:C=10,maxFileSize:R=10*1024*1024,allowedTypes:S=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:P}=M,[z,j]=(0,ot.useState)([]),[v,B]=(0,ot.useState)(!1),[V,D]=(0,ot.useState)(0),k=(0,ot.useCallback)(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&&!S.some(je=>je.endsWith("/*")?N.data.type.startsWith(je.slice(0,-1)):N.data.type===je)){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(te=>[...te,E]),A&&A(E)},[z.length,C,R,S,A]),L=(0,ot.useCallback)(N=>{j(E=>E.filter(te=>te.id!==N)),I&&I(N)},[I]),O=(0,ot.useCallback)(()=>{j([])},[]),H=(0,ot.useCallback)(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 te={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(te)}catch(E){console.error("Error opening picker:",E)}},[k]),F=(0,ot.useCallback)(async()=>{if(!T)return console.warn("No uploader provided, skipping upload"),z;if(z.length===0)return[];B(!0),D(0);try{let N=z.map(async(J,Me)=>{try{j(Ce=>Ce.map(U=>U.id===J.id?{...U,uploadStatus:"uploading",uploadProgress:0}:U));let Oe=setInterval(()=>{j(Ce=>Ce.map(U=>U.id===J.id?{...U,uploadProgress:Math.min((U.uploadProgress??0)+10,90)}:U))},100),qe=await T.upload(J.data);clearInterval(Oe);let Ve={...J,uploadStatus:"completed",uploadProgress:100,data:{...J.data,url:qe.url,metadata:qe.metadata}};return j(Ce=>Ce.map(U=>U.id===J.id?Ve:U)),Ve}catch(Oe){return console.error(`Error uploading attachment ${J.id}:`,Oe),j(qe=>qe.map(Ve=>Ve.id===J.id?{...Ve,uploadStatus:"failed",uploadProgress:0}:Ve)),{...J,uploadStatus:"failed",uploadProgress:0}}}),E=await Promise.all(N),je=E.filter(J=>J.uploadStatus==="completed").length/E.length*100;return D(je),P&&P(E),E}catch(N){return console.error("Error uploading attachments:",N),z}finally{B(!1)}},[z,T,P]);return{attachments:z,openPicker:H,addAttachment:k,removeAttachment:L,clearAttachments:O,uploadAttachments:F,isUploading:v,uploadProgress:V}};var Ye=require("react"),Ts=(M={})=>{let{onSend:T,onFocus:C,initialValue:R="",maxLength:S=1e3}=M,[A,I]=(0,Ye.useState)(R),[P,z]=(0,Ye.useState)(40),[j,v]=(0,Ye.useState)(!1),B=(0,Ye.useCallback)(F=>{F.length<=S&&I(F)},[S]),V=(0,Ye.useCallback)(F=>{if(!A.trim()&&(!F||F.length===0))return;let N=A.trim();T&&T(N,F),I(""),z(40)},[A,T]),D=(0,Ye.useCallback)(()=>{v(!0),C&&C()},[C]),k=(0,Ye.useCallback)(()=>{v(!1)},[]),L=(0,Ye.useCallback)(F=>{z(Math.max(40,Math.min(F,120)))},[]),O=(0,Ye.useCallback)(()=>{I(""),z(40)},[]),H=(0,Ye.useCallback)(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 rr=({messages:M,components:T={},renderProps:C={},onMessageSend:R,onReactionAdd:S,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=qt(),[te,je]=(0,ve.useState)(!1),J=T.MessageList||mt,Me=T.MessageInput||ut,Oe=V??E.enableReactionDetails??!0,qe=D??E.enableMessageActions??!0,Ve=k??E.enableScrollToBottom??!0,Ce=L??E.enableTypingIndicator??!0,[U,He]=(0,ve.useState)(null),et=(0,ve.useRef)(null),[_e,De]=(0,ve.useState)(M||[]),$e=(0,ve.useRef)((M||[]).length+1);ve.default.useEffect(()=>{M&&(De(M),$e.current=M.length+1)},[M]),ve.default.useEffect(()=>{if(U&&et.current){let K=setTimeout(()=>{et.current?.focus()},150);return()=>clearTimeout(K)}},[U]);let tt=$t({uploader:z,maxAttachments:j,maxFileSize:v,allowedTypes:B}),Se=Ts({onSend:(K,G)=>{if(U){let X={id:U.id,text:U.text,senderName:U.senderName,senderId:U.senderId,isMe:U.isMe,timestamp:U.timestamp,type:U.type==="image"?"image":"text",imageData:U.imageData};if(G&&G.length>0){let q=G[0],Ie={id:$e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X,attachments:G,type:q.type==="image"?"image":"text",...q.type==="image"&&q.data&&{imageData:{uri:q.data.uri||"",width:q.data.width||300,height:q.data.height||200,fileName:q.fileName||"image.jpg",fileSize:q.fileSize||0}}};De(Je=>[...Je,Ie]),R&&R(Ie)}else{let q={id:$e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X};De(Ie=>[...Ie,q]),R&&R(q)}He(null)}else if(G&&G.length>0){let X=G[0],q={id:$e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",attachments:G,type:X.type==="image"?"image":"text",...X.type==="image"&&X.data&&{imageData:{uri:X.data.uri||"",width:X.data.width||300,height:X.data.height||200,fileName:X.fileName||"image.jpg",fileSize:X.fileSize||0}}};De(Ie=>[...Ie,q]),R&&R(q)}else{let X={id:$e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};De(q=>[...q,X]),R&&R(X)}tt.clearAttachments()},onFocus:()=>{}}),dt=(0,ve.useCallback)((K,G)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",K,"and emoji:",G),De(X=>X.map(q=>q.id===K?q.reactions?.find(Je=>Je.emoji===G)?{...q,reactions:q.reactions?.map(Je=>Je.emoji===G?{...Je,count:Je.count+1,users:[...Je.users,"currentUser"]}:Je)}:{...q,reactions:[...q.reactions||[],{emoji:G,count:1,users:["currentUser"]}]}:q)),S&&S(K,G)},[S]),_o=(0,ve.useCallback)((K,G)=>{De(X=>X.map(q=>q.id===K?{...q,reactions:q.reactions?.map(Ie=>Ie.emoji===G?{...Ie,count:Math.max(0,Ie.count-1),users:Ie.users.filter(Je=>Je!=="currentUser")}:Ie).filter(Ie=>Ie.count>0)}:q)),A&&A(K,G)},[A]),Jo=(0,ve.useCallback)(K=>{De(G=>G.map(X=>X.id===K?{...X,deleted:!0,text:"",reactions:void 0}:X)),I&&I(K)},[I]),Pe=(0,ve.useCallback)(()=>{He(null)},[]),Fe=(0,ve.useCallback)(K=>{He(K),setTimeout(()=>{et.current?.focus()},100)},[]),Kt=(0,ve.useCallback)(K=>{if(te)return;let{layout:G}=K.nativeEvent;G.height<=0||je(!0)},[te]);if(F)return<st.View style={Rt.container}>
22
+ {N||<st.View style={Rt.loadingContainer}>
33
23
  {}
34
- </at.View>}
35
- </at.View>;if(!te)return<at.View style={Bt.container}>
36
- <at.View style={Bt.chatContainer}onLayout={ao}>
37
- <at.View style={Bt.loadingContainer}>{N}</at.View>
38
- </at.View>
39
- </at.View>;let ss=C.renderInput;return<at.View style={Bt.container}>
40
- <at.View style={Bt.fill}>
41
- <J messages={Xe}isTyping={Ce?O:!1}typingUserName={F}showScrollToBottom={ke}isReplyActive={!!U}enableMessageActions={Ye}enableReactionDetails={Fe}onReactionAdd={pt}onReactionRemove={Ho}onMessageDelete={No}onReplyMessage={Ne}onActionPress={(q,_)=>{q==="reply"?Ne(_):z?.(q,_)}}/>
24
+ </st.View>}
25
+ </st.View>;if(!te)return<st.View style={Rt.container}>
26
+ <st.View style={Rt.chatContainer}onLayout={Kt}>
27
+ <st.View style={Rt.loadingContainer}>{N}</st.View>
28
+ </st.View>
29
+ </st.View>;let gs=C.renderInput;return<st.View style={Rt.container}>
30
+ <st.View style={Rt.fill}>
31
+ <J messages={_e}isTyping={Ce?O:!1}typingUserName={H}showScrollToBottom={Ve}isReplyActive={!!U}enableMessageActions={qe}enableReactionDetails={Oe}onReactionAdd={dt}onReactionRemove={_o}onMessageDelete={Jo}onReplyMessage={Fe}onActionPress={(K,G)=>{K==="reply"?Fe(G):P?.(K,G)}}/>
42
32
 
43
- {ss?ss({value:we.message,onChangeText:we.handleTextChange,onSend:we.handleSend,onFocus:we.handleFocus,height:we.composerHeight,onContentSizeChange:we.handleContentSizeChange,replyToMessage:U,onCancelReply:Ae,attachments:nt.attachments,onAttachmentAdd:nt.addAttachment,onAttachmentRemove:nt.removeAttachment,onAttachmentUpload:nt.uploadAttachments}):<Me ref={st}value={we.message}onChangeText={we.handleTextChange}onSend={we.handleSend}onFocus={we.handleFocus}height={we.composerHeight}onContentSizeChange={we.handleContentSizeChange}replyToMessage={U}onCancelReply={Ae}onAttachmentSend={(q,_)=>{let X=q.type==="image",$={id:_e.current++,text:_?.trim()||"",isMe:!0,timestamp:new Date().toISOString(),status:"sent",type:X?"image":"text",...X&&q.data&&{imageData:{uri:q.data.uri||"",width:q.data.width||300,height:q.data.height||200,fileName:q.data.fileName||q.data.name||"image.jpg",fileSize:q.data.fileSize||q.data.size||0}}};Le(ve=>[...ve,$]),R&&R($),we.handleTextChange("")}}/>}
33
+ {gs?gs({value:Se.message,onChangeText:Se.handleTextChange,onSend:Se.handleSend,onFocus:Se.handleFocus,height:Se.composerHeight,onContentSizeChange:Se.handleContentSizeChange,replyToMessage:U,onCancelReply:Pe,attachments:tt.attachments,onAttachmentAdd:tt.addAttachment,onAttachmentRemove:tt.removeAttachment,onAttachmentUpload:tt.uploadAttachments}):<Me ref={et}value={Se.message}onChangeText={Se.handleTextChange}onSend={Se.handleSend}onFocus={Se.handleFocus}height={Se.composerHeight}onContentSizeChange={Se.handleContentSizeChange}replyToMessage={U}onCancelReply={Pe}onAttachmentSend={(K,G)=>{let X=K.type==="image",q={id:$e.current++,text:G?.trim()||"",isMe:!0,timestamp:new Date().toISOString(),status:"sent",type:X?"image":"text",...X&&K.data&&{imageData:{uri:K.data.uri||"",width:K.data.width||300,height:K.data.height||200,fileName:K.data.fileName||K.data.name||"image.jpg",fileSize:K.data.fileSize||K.data.size||0}}};De(Ie=>[...Ie,q]),R&&R(q),Se.handleTextChange("")}}/>}
44
34
 
45
35
  {}
46
- </at.View>
36
+ </st.View>
47
37
 
48
38
  {}
49
- </at.View>},Bt=at.StyleSheet.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),Ao=Js;var Ie=require("react-native"),yt=require("lucide-react-native");var gs=require("react");var zo=require("react");var jt={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 Uo=(0,zo.createContext)(jt),Xs=(M,S)=>({colors:{...M.colors,...S.colors},spacing:{...M.spacing,...S.spacing},borderRadius:{...M.borderRadius,...S.borderRadius},typography:{...M.typography,...S.typography}}),ms=({children:M,theme:S})=>{let C=(0,zo.useMemo)(()=>S?Xs(jt,S):jt,[S]);return<Uo.Provider value={C}>{M}</Uo.Provider>};var K=()=>{let M=(0,gs.useContext)(Uo);if(!M)throw new Error("useTheme must be used within a ThemeProvider");return M};var Qs=({name:M="George Alan",isOnline:S=!0,onBack:C=()=>{},onVideoCall:R=()=>{},onVoiceCall:T=()=>{},onInfo:A=()=>{}})=>{let I=K();return<Ie.View 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}}>
50
- <Ie.View style={{flex:1,flexDirection:"row",alignItems:"center"}}>
51
- <Ie.TouchableOpacity onPress={C}style={{marginRight:I.spacing.md}}>
52
- <yt.ArrowLeft size={24}color={I.colors.gray[700]}/>
53
- </Ie.TouchableOpacity>
39
+ </st.View>},Rt=st.StyleSheet.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),Qo=rr;var we=require("react-native"),gt=require("lucide-react-native");var ws=require("react");var vo=require("react");var It={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 Zo=(0,vo.createContext)(It),nr=(M,T)=>({colors:{...M.colors,...T.colors},spacing:{...M.spacing,...T.spacing},borderRadius:{...M.borderRadius,...T.borderRadius},typography:{...M.typography,...T.typography}}),Ss=({children:M,theme:T})=>{let C=(0,vo.useMemo)(()=>T?nr(It,T):It,[T]);return<Zo.Provider value={C}>{M}</Zo.Provider>};var $=()=>{let M=(0,ws.useContext)(Zo);if(!M)throw new Error("useTheme must be used within a ThemeProvider");return M};var ar=({name:M="George Alan",isOnline:T=!0,onBack:C=()=>{},onVideoCall:R=()=>{},onVoiceCall:S=()=>{},onInfo:A=()=>{}})=>{let I=$();return<we.View 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
+ <we.View style={{flex:1,flexDirection:"row",alignItems:"center"}}>
41
+ <we.TouchableOpacity onPress={C}style={{marginRight:I.spacing.md}}>
42
+ <gt.ArrowLeft size={24}color={I.colors.gray[700]}/>
43
+ </we.TouchableOpacity>
54
44
 
55
- <Ie.View style={{flex:1,flexDirection:"row",alignItems:"center"}}>
45
+ <we.View style={{flex:1,flexDirection:"row",alignItems:"center"}}>
56
46
  {}
57
- <Ie.View style={{position:"relative",marginRight:I.spacing.md}}>
58
- <Ie.View style={{height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:I.borderRadius.full,backgroundColor:I.colors.gray[200]}}>
59
- <Ie.Text style={{fontSize:I.typography.fontSize.base,color:I.colors.text}}>
47
+ <we.View style={{position:"relative",marginRight:I.spacing.md}}>
48
+ <we.View style={{height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:I.borderRadius.full,backgroundColor:I.colors.gray[200]}}>
49
+ <we.Text style={{fontSize:I.typography.fontSize.base,color:I.colors.text}}>
60
50
  👤
61
- </Ie.Text>
62
- </Ie.View>
63
- {S&&<Ie.View 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}}/>}
64
- </Ie.View>
51
+ </we.Text>
52
+ </we.View>
53
+ {T&&<we.View 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
+ </we.View>
65
55
 
66
- <Ie.View style={{flex:1}}>
67
- <Ie.Text style={{fontSize:I.typography.fontSize.lg,fontWeight:I.typography.fontWeight.semibold,color:I.colors.text}}>
56
+ <we.View style={{flex:1}}>
57
+ <we.Text style={{fontSize:I.typography.fontSize.lg,fontWeight:I.typography.fontWeight.semibold,color:I.colors.text}}>
68
58
  {M}
69
- </Ie.Text>
70
- <Ie.Text style={{fontSize:I.typography.fontSize.sm,color:I.colors.textSecondary}}>
71
- {S?"Online":"Offline"}
72
- </Ie.Text>
73
- </Ie.View>
74
- </Ie.View>
75
- </Ie.View>
59
+ </we.Text>
60
+ <we.Text style={{fontSize:I.typography.fontSize.sm,color:I.colors.textSecondary}}>
61
+ {T?"Online":"Offline"}
62
+ </we.Text>
63
+ </we.View>
64
+ </we.View>
65
+ </we.View>
76
66
 
77
- <Ie.View style={{flexDirection:"row",alignItems:"center",gap:I.spacing.lg}}>
67
+ <we.View style={{flexDirection:"row",alignItems:"center",gap:I.spacing.lg}}>
78
68
  {}
79
- {R&&<Ie.TouchableOpacity onPress={R}>
80
- <yt.Video size={24}color={I.colors.gray[700]}/>
81
- </Ie.TouchableOpacity>}
82
- {T&&<Ie.TouchableOpacity onPress={T}>
83
- <yt.Phone size={24}color={I.colors.gray[700]}/>
84
- </Ie.TouchableOpacity>}
85
- {A&&<Ie.TouchableOpacity onPress={A}>
86
- <yt.Info size={24}color={I.colors.gray[700]}/>
87
- </Ie.TouchableOpacity>}
88
- </Ie.View>
89
- </Ie.View>},Vo=Qs;var xs=require("react"),Te=require("react-native");var Ot=Q(require("dayjs")),ps=Q(require("dayjs/plugin/isToday")),hs=Q(require("dayjs/plugin/isYesterday"));Ot.default.extend(ps.default);Ot.default.extend(hs.default);var Zs=M=>{let S=(0,Ot.default)(M);return S.isToday()?"Today":S.isYesterday()?"Yesterday":S.format("ddd D MMMM")},en=M=>(0,Ot.default)(M).format("YYYY-MM-DD"),fs=M=>{if(M.length===0)return[];let S=[],C=null;return M.forEach((R,T)=>{let A=en(R.timestamp);if(C!==A){let z=Zs(R.timestamp),P={id:`date-${A}`,listItemType:"date-separator",date:A,displayDate:z};S.push(P),C=A}let I={...R,listItemType:"message"};S.push(I)}),S},Ko=M=>(0,Ot.default)(M).format("HH:mm");var Ze=require("react-native");var tn=({replyTo:M,isMyMessage:S})=>{let C=K(),R=(E,v=50)=>E.length<=v?E:E.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,z=S?"rgba(255, 255, 255, 0.1)":C.colors.surfaceSecondary,P=M.type==="image"&&M.imageData;return<Ze.View style={{marginBottom:C.spacing.sm,borderRadius:C.borderRadius.md,padding:C.spacing.sm,backgroundColor:z,borderLeftWidth:4,borderLeftColor:T}}>
90
- <Ze.Text style={{fontSize:C.typography.fontSize.xs,fontWeight:C.typography.fontWeight.medium,color:A,marginBottom:C.spacing.xs}}>
69
+ {R&&<we.TouchableOpacity onPress={R}>
70
+ <gt.Video size={24}color={I.colors.gray[700]}/>
71
+ </we.TouchableOpacity>}
72
+ {S&&<we.TouchableOpacity onPress={S}>
73
+ <gt.Phone size={24}color={I.colors.gray[700]}/>
74
+ </we.TouchableOpacity>}
75
+ {A&&<we.TouchableOpacity onPress={A}>
76
+ <gt.Info size={24}color={I.colors.gray[700]}/>
77
+ </we.TouchableOpacity>}
78
+ </we.View>
79
+ </we.View>},Po=ar;var Bs=require("react"),Te=require("react-native");var vt=Q(require("dayjs")),Is=Q(require("dayjs/plugin/isToday")),vs=Q(require("dayjs/plugin/isYesterday"));vt.default.extend(Is.default);vt.default.extend(vs.default);var ir=M=>{let T=(0,vt.default)(M);return T.isToday()?"Today":T.isYesterday()?"Yesterday":T.format("ddd D MMMM")},lr=M=>(0,vt.default)(M).format("YYYY-MM-DD"),Ps=M=>{if(M.length===0)return[];let T=[],C=null;return M.forEach((R,S)=>{let A=lr(R.timestamp);if(C!==A){let P=ir(R.timestamp),z={id:`date-${A}`,listItemType:"date-separator",date:A,displayDate:P};T.push(z),C=A}let I={...R,listItemType:"message"};T.push(I)}),T},es=M=>(0,vt.default)(M).format("HH:mm");var Xe=require("react-native");var cr=({replyTo:M,isMyMessage:T})=>{let C=$(),R=(j,v=50)=>j.length<=v?j:j.substring(0,v)+"...",S=T?"rgba(255, 255, 255, 0.3)":C.colors.primary,A=T?"rgba(255, 255, 255, 0.8)":C.colors.primary,I=T?"rgba(255, 255, 255, 0.7)":C.colors.textSecondary,P=T?"rgba(255, 255, 255, 0.1)":C.colors.surfaceSecondary,z=M.type==="image"&&M.imageData;return<Xe.View style={{marginBottom:C.spacing.sm,borderRadius:C.borderRadius.md,padding:C.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:S}}>
80
+ <Xe.Text style={{fontSize:C.typography.fontSize.xs,fontWeight:C.typography.fontWeight.medium,color:A,marginBottom:C.spacing.xs}}>
91
81
  {M.isMe?"You":M.senderName||"Sender"}
92
- </Ze.Text>
82
+ </Xe.Text>
93
83
 
94
- {P?<Ze.View style={{flexDirection:"row",alignItems:"center"}}>
95
- <Ze.Image source={{uri:M.imageData.uri}}style={{width:40,height:40,borderRadius:C.borderRadius.sm,marginRight:C.spacing.sm}}resizeMode="cover"/>
96
- <Ze.View style={{flex:1}}>
97
- <Ze.Text style={{fontSize:C.typography.fontSize.xs,color:I,fontStyle:"italic",marginBottom:C.spacing.xs}}>
84
+ {z?<Xe.View style={{flexDirection:"row",alignItems:"center"}}>
85
+ <Xe.Image source={{uri:M.imageData.uri}}style={{width:40,height:40,borderRadius:C.borderRadius.sm,marginRight:C.spacing.sm}}resizeMode="cover"/>
86
+ <Xe.View style={{flex:1}}>
87
+ <Xe.Text style={{fontSize:C.typography.fontSize.xs,color:I,fontStyle:"italic",marginBottom:C.spacing.xs}}>
98
88
  📷 Image
99
- </Ze.Text>
100
- {M.text&&M.text.trim()&&<Ze.Text style={{fontSize:C.typography.fontSize.sm,color:I,lineHeight:C.typography.lineHeight.tight}}>
89
+ </Xe.Text>
90
+ {M.text&&M.text.trim()&&<Xe.Text style={{fontSize:C.typography.fontSize.sm,color:I,lineHeight:C.typography.lineHeight.tight}}>
101
91
  {R(M.text,30)}
102
- </Ze.Text>}
103
- </Ze.View>
104
- </Ze.View>:<Ze.Text style={{fontSize:C.typography.fontSize.sm,color:I,lineHeight:C.typography.lineHeight.tight}}>
92
+ </Xe.Text>}
93
+ </Xe.View>
94
+ </Xe.View>:<Xe.Text style={{fontSize:C.typography.fontSize.sm,color:I,lineHeight:C.typography.lineHeight.tight}}>
105
95
  {R(M.text)}
106
- </Ze.Text>}
107
- </Ze.View>},Mt=tn;var ut=require("react"),Se=require("react-native");var{width:qo,height:ys}=Se.Dimensions.get("window"),on=({imageData:M,isMe:S,onImagePress:C,onLongPress:R})=>{let T=K(),[A,I]=(0,ut.useState)(!1),[z,P]=(0,ut.useState)(!1),v=(0,ut.useCallback)(()=>{let O=qo*.6,F=300;if(!M.width||!M.height)return{width:O,height:F};let H=M.width/M.height,N=O,j=N/H;return j>F&&(j=F,N=j*H),{width:Math.round(N),height:Math.round(j)}},[M.width,M.height])(),V=(0,ut.useCallback)(()=>{C?C():I(!0)},[C]),D=(0,ut.useCallback)(()=>{console.error("Failed to load image:",M.uri),P(!0)},[M.uri]),B=(0,ut.useCallback)(()=>{I(!1)},[]),L=(0,ut.useCallback)(()=>{if(!M.width||!M.height)return{width:qo,height:ys*.8};let O=M.width/M.height,F=qo*.9,H=ys*.8,N=F,j=N/O;return j>H&&(j=H,N=j*O),{width:Math.round(N),height:Math.round(j)}},[M.width,M.height])();return z?<Se.View style={[Ct.errorContainer,{width:v.width,height:v.height,backgroundColor:S?T.colors.messageBubble.sent:T.colors.messageBubble.received,borderRadius:T.borderRadius.lg}]}>
108
- <Se.Text style={[Ct.errorText,{color:S?T.colors.messageBubble.sentText:T.colors.messageBubble.receivedText,fontSize:T.typography.fontSize.sm}]}>
96
+ </Xe.Text>}
97
+ </Xe.View>},Pt=cr;var it=require("react"),Re=require("react-native");var{width:ts,height:As}=Re.Dimensions.get("window"),dr=({imageData:M,isMe:T,onImagePress:C,onLongPress:R})=>{let S=$(),[A,I]=(0,it.useState)(!1),[P,z]=(0,it.useState)(!1),v=(0,it.useCallback)(()=>{let O=ts*.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=(0,it.useCallback)(()=>{C?C():I(!0)},[C]),V=(0,it.useCallback)(()=>{console.error("Failed to load image:",M.uri),z(!0)},[M.uri]),D=(0,it.useCallback)(()=>{I(!1)},[]),L=(0,it.useCallback)(()=>{if(!M.width||!M.height)return{width:ts,height:As*.8};let O=M.width/M.height,H=ts*.9,F=As*.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?<Re.View style={[pt.errorContainer,{width:v.width,height:v.height,backgroundColor:T?S.colors.messageBubble.sent:S.colors.messageBubble.received,borderRadius:S.borderRadius.lg}]}>
98
+ <Re.Text style={[pt.errorText,{color:T?S.colors.messageBubble.sentText:S.colors.messageBubble.receivedText,fontSize:S.typography.fontSize.sm}]}>
109
99
  Failed to load image
110
- </Se.Text>
111
- </Se.View>:<>
112
- <Se.Pressable onPress={V}onLongPress={R}delayLongPress={500}>
113
- <Se.View style={[Ct.imageContainer,{borderRadius:T.borderRadius.lg,overflow:"hidden"}]}>
114
- <Se.Image source={{uri:M.uri}}style={[Ct.image,{width:v.width,height:v.height}]}resizeMode='cover'onError={D}/>
100
+ </Re.Text>
101
+ </Re.View>:<>
102
+ <Re.Pressable onPress={B}onLongPress={R}delayLongPress={500}>
103
+ <Re.View style={[pt.imageContainer,{borderRadius:S.borderRadius.lg,overflow:"hidden"}]}>
104
+ <Re.Image source={{uri:M.uri}}style={[pt.image,{width:v.width,height:v.height}]}resizeMode='cover'onError={V}/>
115
105
 
116
106
  {}
117
- <Se.View style={Ct.imageOverlay}/>
118
- </Se.View>
119
- </Se.Pressable>
107
+ <Re.View style={pt.imageOverlay}/>
108
+ </Re.View>
109
+ </Re.Pressable>
120
110
 
121
111
  {}
122
- <Se.Modal visible={A}transparent animationType='fade'onRequestClose={B}>
123
- <Se.Pressable style={Ct.modalContainer}onPress={B}>
124
- <Se.View style={Ct.modalContent}>
125
- <Se.Image source={{uri:M.uri}}style={[Ct.modalImage,{width:L.width,height:L.height,borderRadius:T.borderRadius.lg}]}resizeMode='contain'/>
126
- </Se.View>
127
- </Se.Pressable>
128
- </Se.Modal>
129
- </>},Ct=Se.StyleSheet.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"}}),Ft=on;var it=require("react-native"),bs=require("lucide-react-native");var sn=({isMe:M,timestamp:S,senderName:C})=>{let R=K();return<it.View style={[Ht.container,{alignSelf:M?"flex-end":"flex-start",maxWidth:"80%"}]}>
130
- <it.View style={[Ht.messageBubble,{backgroundColor:R.colors.gray[100],borderColor:R.colors.gray[200]}]}>
131
- <it.View style={Ht.content}>
132
- <bs.Trash2 size={16}color={R.colors.gray[500]}/>
133
- <it.Text style={[Ht.deletedText,{color:R.colors.gray[500]}]}>
112
+ <Re.Modal visible={A}transparent animationType='fade'onRequestClose={D}>
113
+ <Re.Pressable style={pt.modalContainer}onPress={D}>
114
+ <Re.View style={pt.modalContent}>
115
+ <Re.Image source={{uri:M.uri}}style={[pt.modalImage,{width:L.width,height:L.height,borderRadius:S.borderRadius.lg}]}resizeMode='contain'/>
116
+ </Re.View>
117
+ </Re.Pressable>
118
+ </Re.Modal>
119
+ </>},pt=Re.StyleSheet.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"}}),Ao=dr;var rt=require("react-native"),zs=require("lucide-react-native");var ur=({isMe:M,timestamp:T,senderName:C})=>{let R=$();return<rt.View style={[At.container,{alignSelf:M?"flex-end":"flex-start",maxWidth:"80%"}]}>
120
+ <rt.View style={[At.messageBubble,{backgroundColor:R.colors.gray[100],borderColor:R.colors.gray[200]}]}>
121
+ <rt.View style={At.content}>
122
+ <zs.Trash2 size={16}color={R.colors.gray[500]}/>
123
+ <rt.Text style={[At.deletedText,{color:R.colors.gray[500]}]}>
134
124
  This message was deleted
135
- </it.Text>
136
- </it.View>
137
- </it.View>
138
- <it.View style={[Ht.metadata,{alignSelf:M?"flex-end":"flex-start"}]}>
139
- <it.Text style={[Ht.timestamp,{color:R.colors.gray[400]}]}>
140
- {S}
141
- </it.Text>
142
- </it.View>
143
- </it.View>},Ht=it.StyleSheet.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}}),Nt=sn;var nn=({message:M,onLongPress:S,onReactionPress:C})=>{let R=K(),T=(0,xs.useRef)(null),A=()=>{T.current?T.current.measureInWindow((P,E,v,V)=>{let D={x:Math.round(P),y:Math.round(E),width:Math.round(v),height:Math.round(V)};S?.(M,D)}):S?.(M)},I=()=>{M.reactions&&M.reactions.length>0&&C?.(M)},z=M.type==="image"&&M.imageData;return M.deleted?<Nt isMe={M.isMe}timestamp={Ko(M.timestamp)}senderName={M.senderName}/>:<Te.View style={{marginBottom:R.spacing.md,alignItems:M.isMe?"flex-end":"flex-start",marginHorizontal:R.spacing.sm}}>
144
- <Te.Pressable ref={T}onLongPress={A}delayLongPress={500}style={{maxWidth:z?"75%":"80%",borderRadius:z?R.borderRadius.lg:R.borderRadius.xl,borderBottomRightRadius:M.isMe?4:z?R.borderRadius.lg:R.borderRadius.xl,borderBottomLeftRadius:M.isMe?z?R.borderRadius.lg:R.borderRadius.xl:4,paddingHorizontal:z?0:R.spacing.lg,paddingVertical:z?0:R.spacing.md,backgroundColor:z?"transparent":M.isMe?R.colors.messageBubble.sent:R.colors.messageBubble.received,overflow:"hidden"}}>
145
- {M.replyTo&&<Mt replyTo={M.replyTo}isMyMessage={M.isMe}/>}
125
+ </rt.Text>
126
+ </rt.View>
127
+ </rt.View>
128
+ <rt.View style={[At.metadata,{alignSelf:M?"flex-end":"flex-start"}]}>
129
+ <rt.Text style={[At.timestamp,{color:R.colors.gray[400]}]}>
130
+ {T}
131
+ </rt.Text>
132
+ </rt.View>
133
+ </rt.View>},At=rt.StyleSheet.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}}),Bo=ur;var mr=({message:M,onLongPress:T,onReactionPress:C})=>{let R=$(),S=(0,Bs.useRef)(null),A=()=>{S.current?S.current.measureInWindow((z,j,v,B)=>{let V={x:Math.round(z),y:Math.round(j),width:Math.round(v),height:Math.round(B)};T?.(M,V)}):T?.(M)},I=()=>{M.reactions&&M.reactions.length>0&&C?.(M)},P=M.type==="image"&&M.imageData;return M.deleted?<Bo isMe={M.isMe}timestamp={es(M.timestamp)}senderName={M.senderName}/>:<Te.View style={{marginBottom:R.spacing.md,alignItems:M.isMe?"flex-end":"flex-start",marginHorizontal:R.spacing.sm}}>
134
+ <Te.Pressable ref={S}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&&<Pt replyTo={M.replyTo}isMyMessage={M.isMe}/>}
146
136
 
147
- {z?<Ft imageData={M.imageData}isMe={M.isMe}onLongPress={A}/>:<Te.Text style={{fontSize:R.typography.fontSize.base,color:M.isMe?R.colors.messageBubble.sentText:R.colors.messageBubble.receivedText}}>
137
+ {P?<Ao imageData={M.imageData}isMe={M.isMe}onLongPress={A}/>:<Te.Text style={{fontSize:R.typography.fontSize.base,color:M.isMe?R.colors.messageBubble.sentText:R.colors.messageBubble.receivedText}}>
148
138
  {M.text}
149
139
  </Te.Text>}
150
140
 
151
141
  {}
152
- {z&&M.text&&M.text.trim()&&<Te.View 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}}>
142
+ {P&&M.text&&M.text.trim()&&<Te.View 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}}>
153
143
  <Te.Text style={{fontSize:R.typography.fontSize.base,color:M.isMe?R.colors.messageBubble.sentText:R.colors.messageBubble.receivedText}}>
154
144
  {M.text}
155
145
  </Te.Text>
@@ -158,19 +148,19 @@
158
148
 
159
149
  {}
160
150
  {M.reactions&&M.reactions.length>0&&<Te.TouchableOpacity 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"}}>
161
- {M.reactions.map((P,E)=><Te.View key={`${P.emoji}-${E}`}style={{flexDirection:"row",alignItems:"center",padding:R.spacing.xs}}>
151
+ {M.reactions.map((z,j)=><Te.View key={`${z.emoji}-${j}`}style={{flexDirection:"row",alignItems:"center",padding:R.spacing.xs}}>
162
152
  <Te.Text style={{fontSize:R.typography.fontSize.sm}}>
163
- {P.emoji}
153
+ {z.emoji}
164
154
  </Te.Text>
165
- {P.count>1&&<Te.Text style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,marginLeft:R.spacing.xs,fontWeight:R.typography.fontWeight.medium}}>
166
- {P.count}
155
+ {z.count>1&&<Te.Text style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,marginLeft:R.spacing.xs,fontWeight:R.typography.fontWeight.medium}}>
156
+ {z.count}
167
157
  </Te.Text>}
168
158
  </Te.View>)}
169
159
  </Te.TouchableOpacity>}
170
160
 
171
161
  <Te.View style={{marginHorizontal:R.spacing.sm,marginTop:R.spacing.xs,flexDirection:"row",alignItems:"center",justifyContent:M.isMe?"flex-end":"flex-start"}}>
172
162
  <Te.Text style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary}}>
173
- {Ko(M.timestamp)}
163
+ {es(M.timestamp)}
174
164
  </Te.Text>
175
165
  {M.isMe&&M.status&&<Te.View style={{marginLeft:R.spacing.xs}}>
176
166
  {M.status==="sent"&&<Te.Text style={{fontSize:R.typography.fontSize.xs,color:R.colors.gray[400]}}>
@@ -184,19 +174,19 @@
184
174
  </Te.Text>}
185
175
  </Te.View>}
186
176
  </Te.View>
187
- </Te.View>},Wt=nn;var Z=require("react-native"),Ms=require("lucide-react-native");var rn=({replyToMessage:M,onCancel:S})=>{let C=K(),R=(I,z=50)=>I.length<=z?I:I.substring(0,z)+"...",T=!!M.replyTo,A=M.type==="image"&&M.imageData;return<Z.View style={{borderBottomWidth:1,borderBottomColor:C.colors.border,backgroundColor:C.colors.surface,paddingHorizontal:C.spacing.lg,paddingVertical:C.spacing.md}}>
177
+ </Te.View>},Vo=mr;var Z=require("react-native"),Vs=require("lucide-react-native");var gr=({replyToMessage:M,onCancel:T})=>{let C=$(),R=(I,P=50)=>I.length<=P?I:I.substring(0,P)+"...",S=!!M.replyTo,A=M.type==="image"&&M.imageData;return<Z.View style={{borderBottomWidth:1,borderBottomColor:C.colors.border,backgroundColor:C.colors.surface,paddingHorizontal:C.spacing.lg,paddingVertical:C.spacing.md}}>
188
178
  <Z.View style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between"}}>
189
179
  <Z.View style={{flex:1,marginRight:C.spacing.md}}>
190
180
  <Z.View style={{flexDirection:"row",alignItems:"center",marginBottom:C.spacing.xs}}>
191
- <Z.View style={{width:4,backgroundColor:C.colors.primary,borderRadius:C.borderRadius.full,marginRight:C.spacing.md,height:T?48:32}}/>
181
+ <Z.View style={{width:4,backgroundColor:C.colors.primary,borderRadius:C.borderRadius.full,marginRight:C.spacing.md,height:S?48:32}}/>
192
182
  <Z.View style={{flex:1}}>
193
183
  <Z.Text style={{fontSize:C.typography.fontSize.xs,fontWeight:C.typography.fontWeight.medium,color:C.colors.primary,marginBottom:C.spacing.xs}}>
194
184
  Replying to {M.isMe?"yourself":M.senderName||"sender"}
195
- {T&&" (reply thread)"}
185
+ {S&&" (reply thread)"}
196
186
  </Z.Text>
197
187
 
198
188
  {}
199
- {T&&<Z.View style={{marginBottom:C.spacing.sm,padding:C.spacing.sm,backgroundColor:C.colors.surfaceSecondary,borderRadius:C.borderRadius.md,borderLeftWidth:2,borderLeftColor:C.colors.gray[300]}}>
189
+ {S&&<Z.View style={{marginBottom:C.spacing.sm,padding:C.spacing.sm,backgroundColor:C.colors.surfaceSecondary,borderRadius:C.borderRadius.md,borderLeftWidth:2,borderLeftColor:C.colors.gray[300]}}>
200
190
  <Z.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.textSecondary,marginBottom:C.spacing.xs}}>
201
191
  Originally replying to: {M.replyTo.isMe?"yourself":M.replyTo.senderName||"sender"}
202
192
  </Z.Text>
@@ -222,15 +212,15 @@
222
212
  </Z.View>
223
213
  </Z.View>
224
214
 
225
- <Z.TouchableOpacity 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}}>
226
- <Ms.X size={16}color={C.colors.textSecondary}/>
215
+ <Z.TouchableOpacity onPress={T}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
+ <Vs.X size={16}color={C.colors.textSecondary}/>
227
217
  </Z.TouchableOpacity>
228
218
  </Z.View>
229
- </Z.View>},Rt=rn;var De=require("react"),W=require("react-native"),Tt=require("lucide-react-native");var Do=require("react"),Cs=Q(require("rn-emoji-keyboard")),an=({visible:M,onClose:S,onEmojiSelected:C})=>{let[R,T]=(0,Do.useState)(!1);(0,Do.useEffect)(()=>{T(!!M)},[M]);let A=z=>{console.log("Selected emoji:",z),C(z.emoji),T(!1),S()},I=()=>{T(!1),S()};return M?<Cs.default onEmojiSelected={A}open={R}onClose={I}enableSearchBar/>:null},St=an;var Mn=({visible:M,onPress:S,children:C})=>M?<W.View style={Ve.overlay}>
230
- <W.TouchableOpacity style={Ve.backdrop}onPress={S}activeOpacity={1}/>
219
+ </Z.View>},Yt=gr;var ze=require("react"),W=require("react-native"),ht=require("lucide-react-native");var Do=require("react"),Ds=Q(require("rn-emoji-keyboard")),pr=({visible:M,onClose:T,onEmojiSelected:C})=>{let[R,S]=(0,Do.useState)(!1);(0,Do.useEffect)(()=>{S(!!M)},[M]);let A=P=>{console.log("Selected emoji:",P),C(P.emoji),S(!1),T()},I=()=>{S(!1),T()};return M?<Ds.default onEmojiSelected={A}open={R}onClose={I}enableSearchBar/>:null},Bt=pr;var Mr=({visible:M,onPress:T,children:C})=>M?<W.View style={Ae.overlay}>
220
+ <W.TouchableOpacity style={Ae.backdrop}onPress={T}activeOpacity={1}/>
231
221
  {C}
232
- </W.View>:null,{width:Ut,height:$o}=W.Dimensions.get("window"),Cn=({message:M,positions:S,messagePosition:C,containerRef:R,containerOffset:T,setContainerOffset:A})=>{let I=K(),z=(0,De.useRef)(new W.Animated.Value(C.y)).current,P=(0,De.useRef)(new W.Animated.Value(0)).current,E=(0,De.useRef)(!1),v=M.type==="image"&&M.imageData;return(0,De.useEffect)(()=>{E.current=!1,R.current&&R.current.measureInWindow((V,D,B,k)=>{A({x:V,y:D});let L=C.y-D,O=S.messagePreviewTop-D;z.setValue(L),P.setValue(0),requestAnimationFrame(()=>{W.Animated.parallel([W.Animated.timing(z,{toValue:O,duration:250,useNativeDriver:!1}),W.Animated.timing(P,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{E.current=!0})})})},[S.messagePreviewTop,C.y,R]),<W.Animated.View style={{position:"absolute",top:z,left:C.x,width:C.width,height:M.replyTo?C.height+10:C.height,zIndex:1e3,opacity:P,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"}}>
233
- {M.replyTo&&<Mt replyTo={M.replyTo}isMyMessage={M.isMe}/>}
222
+ </W.View>:null,{width:Vt,height:os}=W.Dimensions.get("window"),Cr=({message:M,positions:T,messagePosition:C,containerRef:R,containerOffset:S,setContainerOffset:A})=>{let I=$(),P=(0,ze.useRef)(new W.Animated.Value(C.y)).current,z=(0,ze.useRef)(new W.Animated.Value(0)).current,j=(0,ze.useRef)(!1),v=M.type==="image"&&M.imageData;return(0,ze.useEffect)(()=>{j.current=!1,R.current&&R.current.measureInWindow((B,V,D,k)=>{A({x:B,y:V});let L=C.y-V,O=T.messagePreviewTop-V;P.setValue(L),z.setValue(0),requestAnimationFrame(()=>{W.Animated.parallel([W.Animated.timing(P,{toValue:O,duration:250,useNativeDriver:!1}),W.Animated.timing(z,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{j.current=!0})})})},[T.messagePreviewTop,C.y,R]),<W.Animated.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&&<Pt replyTo={M.replyTo}isMyMessage={M.isMe}/>}
234
224
 
235
225
  {v?<W.View>
236
226
  <W.Image source={{uri:M.imageData.uri}}style={{width:C.width,height:C.height,borderRadius:I.borderRadius.lg}}resizeMode='cover'/>
@@ -243,50 +233,50 @@
243
233
  </W.View>:<W.Text style={{fontSize:I.typography.fontSize.base,color:M.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
244
234
  {M.text}
245
235
  </W.Text>}
246
- </W.Animated.View>},Rn=({visible:M,onClose:S,isMyMessage:C,selectedMessage:R,messagePosition:T,onActionPress:A,onEmojiReact:I})=>{let[z,P]=(0,De.useState)(!1),E=(0,De.useRef)(null),[v,V]=(0,De.useState)({x:0,y:0}),D=(0,De.useRef)(new W.Animated.Value(0)).current,B=(0,De.useRef)(new W.Animated.Value(0)).current,k=(0,De.useRef)(!1),L=(0,De.useRef)(!1),O=Me=>{A(Me),S()},F=Me=>{I?.(Me),S()},H=()=>{P(!0)},N=()=>{P(!1)},j=Me=>{I?.(Me),P(!1),S()},te=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],J=(()=>{if(!T)return{emojiBar:{top:$o/2-200,left:Ut/2-160},actionMenu:{top:$o/2+50,left:Ut/2-100}};let Me=320,Fe=60,Ye=200,ke=160,Ce=20,U=8,He,st,Xe,Le,_e,nt=$o/2,we=Fe+U+T.height+U+ke,pt=nt-we/2;return st=pt,_e=pt+Fe+U,Le=pt+Fe+U+T.height+U,He=T.x,Xe=T.x,He+Me>Ut-Ce&&(He=Ut-Me-Ce),He<Ce&&(He=Ce),Xe+Ye>Ut-Ce&&(Xe=Ut-Ye-Ce),Xe<Ce&&(Xe=Ce),{emojiBar:{top:st,left:He},actionMenu:{top:Le,left:Xe},messagePreviewTop:_e,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return(0,De.useEffect)(()=>{M&&T&&!L.current&&(D.setValue(0),B.setValue(0),setTimeout(()=>{W.Animated.sequence([W.Animated.timing(D,{toValue:1,duration:200,useNativeDriver:!1}),W.Animated.timing(B,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{L.current=!0})},50))},[M,T,D,B]),(0,De.useEffect)(()=>{M||(k.current=!1,L.current=!1,D.setValue(0),B.setValue(0))},[M,D,B]),M?<>
236
+ </W.Animated.View>},Rr=({visible:M,onClose:T,isMyMessage:C,selectedMessage:R,messagePosition:S,onActionPress:A,onEmojiReact:I})=>{let[P,z]=(0,ze.useState)(!1),j=(0,ze.useRef)(null),[v,B]=(0,ze.useState)({x:0,y:0}),V=(0,ze.useRef)(new W.Animated.Value(0)).current,D=(0,ze.useRef)(new W.Animated.Value(0)).current,k=(0,ze.useRef)(!1),L=(0,ze.useRef)(!1),O=Me=>{A(Me),T()},H=Me=>{I?.(Me),T()},F=()=>{z(!0)},N=()=>{z(!1)},E=Me=>{I?.(Me),z(!1),T()},te=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],J=(()=>{if(!S)return{emojiBar:{top:os/2-200,left:Vt/2-160},actionMenu:{top:os/2+50,left:Vt/2-100}};let Me=320,Oe=60,qe=200,Ve=160,Ce=20,U=8,He,et,_e,De,$e,tt=os/2,Se=Oe+U+S.height+U+Ve,dt=tt-Se/2;return et=dt,$e=dt+Oe+U,De=dt+Oe+U+S.height+U,He=S.x,_e=S.x,He+Me>Vt-Ce&&(He=Vt-Me-Ce),He<Ce&&(He=Ce),_e+qe>Vt-Ce&&(_e=Vt-qe-Ce),_e<Ce&&(_e=Ce),{emojiBar:{top:et,left:He},actionMenu:{top:De,left:_e},messagePreviewTop:$e,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return(0,ze.useEffect)(()=>{M&&S&&!L.current&&(V.setValue(0),D.setValue(0),setTimeout(()=>{W.Animated.sequence([W.Animated.timing(V,{toValue:1,duration:200,useNativeDriver:!1}),W.Animated.timing(D,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{L.current=!0})},50))},[M,S,V,D]),(0,ze.useEffect)(()=>{M||(k.current=!1,L.current=!1,V.setValue(0),D.setValue(0))},[M,V,D]),M?<>
247
237
  {}
248
- <Mn visible={!0}onPress={S}>
249
- <W.Pressable style={Ve.overlayPressable}onPress={S}/>
250
- </Mn>
238
+ <Mr visible={!0}onPress={T}>
239
+ <W.Pressable style={Ae.overlayPressable}onPress={T}/>
240
+ </Mr>
251
241
 
252
- <W.View ref={E}style={{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}>
242
+ <W.View ref={j}style={{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}>
253
243
  {}
254
244
  </W.View>
255
245
 
256
246
  {}
257
- {T&&R&&<Cn message={R}positions={J}messagePosition={T}containerRef={E}containerOffset={v}setContainerOffset={V}/>}
247
+ {S&&R&&<Cr message={R}positions={J}messagePosition={S}containerRef={j}containerOffset={v}setContainerOffset={B}/>}
258
248
 
259
249
  {}
260
- <W.Animated.View style={[Ve.emojiBar,{position:"absolute",top:J.emojiBar.top-(v.y||0),left:J.emojiBar.left,opacity:D,pointerEvents:"auto"}]}>
261
- <W.ScrollView horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={Ve.emojiContainer}>
262
- {te.map((Me,Fe)=><W.TouchableOpacity key={Fe}style={Ve.emojiButton}onPress={()=>F(Me)}>
263
- <W.Text style={Ve.emojiText}>{Me}</W.Text>
250
+ <W.Animated.View style={[Ae.emojiBar,{position:"absolute",top:J.emojiBar.top-(v.y||0),left:J.emojiBar.left,opacity:V,pointerEvents:"auto"}]}>
251
+ <W.ScrollView horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={Ae.emojiContainer}>
252
+ {te.map((Me,Oe)=><W.TouchableOpacity key={Oe}style={Ae.emojiButton}onPress={()=>H(Me)}>
253
+ <W.Text style={Ae.emojiText}>{Me}</W.Text>
264
254
  </W.TouchableOpacity>)}
265
- <W.TouchableOpacity style={Ve.addEmojiButton}onPress={H}>
266
- <Tt.Plus size={20}color='#666'/>
255
+ <W.TouchableOpacity style={Ae.addEmojiButton}onPress={F}>
256
+ <ht.Plus size={20}color='#666'/>
267
257
  </W.TouchableOpacity>
268
258
  </W.ScrollView>
269
259
  </W.Animated.View>
270
260
 
271
261
  {}
272
- <W.Animated.View style={[Ve.actionMenu,{position:"absolute",top:J.actionMenu.top-(v.y||0)+(R?.replyTo?10:0),left:J.actionMenu.left,opacity:B,pointerEvents:"auto"}]}>
273
- <W.View style={Ve.actionItems}>
262
+ <W.Animated.View style={[Ae.actionMenu,{position:"absolute",top:J.actionMenu.top-(v.y||0)+(R?.replyTo?10:0),left:J.actionMenu.left,opacity:D,pointerEvents:"auto"}]}>
263
+ <W.View style={Ae.actionItems}>
274
264
  {}
275
- <W.TouchableOpacity style={Ve.actionRow}onPress={()=>O("reply")}>
276
- <Tt.Reply size={18}color='#333'/>
277
- <W.Text style={Ve.actionLabel}>Reply</W.Text>
265
+ <W.TouchableOpacity style={Ae.actionRow}onPress={()=>O("reply")}>
266
+ <ht.Reply size={18}color='#333'/>
267
+ <W.Text style={Ae.actionLabel}>Reply</W.Text>
278
268
  </W.TouchableOpacity>
279
269
 
280
270
  {}
281
- <W.TouchableOpacity style={Ve.actionRow}onPress={()=>O("copy")}>
282
- <Tt.Copy size={18}color='#333'/>
283
- <W.Text style={Ve.actionLabel}>Copy</W.Text>
271
+ <W.TouchableOpacity style={Ae.actionRow}onPress={()=>O("copy")}>
272
+ <ht.Copy size={18}color='#333'/>
273
+ <W.Text style={Ae.actionLabel}>Copy</W.Text>
284
274
  </W.TouchableOpacity>
285
275
 
286
276
  {}
287
- {C&&<W.TouchableOpacity style={Ve.actionRow}onPress={()=>O("delete")}>
288
- <Tt.Trash2 size={18}color='#ff4444'/>
289
- <W.Text style={[Ve.actionLabel,{color:"#ff4444"}]}>
277
+ {C&&<W.TouchableOpacity style={Ae.actionRow}onPress={()=>O("delete")}>
278
+ <ht.Trash2 size={18}color='#ff4444'/>
279
+ <W.Text style={[Ae.actionLabel,{color:"#ff4444"}]}>
290
280
  Delete
291
281
  </W.Text>
292
282
  </W.TouchableOpacity>}
@@ -294,185 +284,177 @@
294
284
  </W.Animated.View>
295
285
 
296
286
  {}
297
- <St visible={z}onClose={N}onEmojiSelected={j}/>
298
- </>:null},Ve=W.StyleSheet.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:{...W.StyleSheet.absoluteFillObject,zIndex:1e3},backdrop:{...W.StyleSheet.absoluteFillObject,backgroundColor:"rgba(0, 0, 0, 0.8)"}}),Kt=Rn;var qt=require("react"),G=require("react-native"),Rs=Q(require("react-native-actions-sheet"));var Sn=({visible:M,onClose:S,reactions:C,messageText:R,onAddReaction:T,onRemoveReaction:A})=>{let I=(0,qt.useRef)(null),[z,P]=(0,qt.useState)(!1);(0,qt.useEffect)(()=>{M?I.current?.show():I.current?.hide()},[M]);let v=(()=>{let F=[];return C.forEach(H=>{let N=[{id:"1",name:"You",avatar:"\u{1F464}"},{id:"2",name:"Anna",avatar:"\u{1F469}"},{id:"3",name:"Young Beetle",avatar:"\u{1F697}"},{id:"4",name:"Lele",avatar:"\u{1F3AD}"},{id:"5",name:"Needle",avatar:"\u{1F3E0}"}];for(let j=0;j<Math.min(H.count,N.length);j++)F.push({id:`${H.emoji}-${j}`,name:N[j].name,avatar:N[j].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),F})(),V=C.reduce((F,H)=>F+H.count,0),D=F=>{console.log("Remove reaction called with:",F),console.log("onRemoveReaction prop exists:",!!A),console.log("User is current user:",F.name==="You"),F.name==="You"&&A?(console.log("Calling onRemoveReaction with emoji:",F.emoji),A(F.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:F.name==="You",hasCallback:!!A})},B=()=>{I.current?.hide(),S(),setTimeout(()=>{P(!0)},300)},k=()=>{P(!1)},L=F=>{console.log("Selected emoji from picker:",F),T?.(F),P(!1),S()},O=()=>{I.current?.hide(),S()};return<>
299
- <Rs.default ref={I}onClose={O}containerStyle={ee.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
287
+ <Bt visible={P}onClose={N}onEmojiSelected={E}/>
288
+ </>:null},Ae=W.StyleSheet.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:{...W.StyleSheet.absoluteFillObject,zIndex:1e3},backdrop:{...W.StyleSheet.absoluteFillObject,backgroundColor:"rgba(0, 0, 0, 0.8)"}}),Lo=Rr;var Dt=require("react"),_=require("react-native"),ks=Q(require("react-native-actions-sheet"));var Tr=({visible:M,onClose:T,reactions:C,messageText:R,onAddReaction:S,onRemoveReaction:A})=>{let I=(0,Dt.useRef)(null),[P,z]=(0,Dt.useState)(!1);(0,Dt.useEffect)(()=>{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(),T(),setTimeout(()=>{z(!0)},300)},k=()=>{z(!1)},L=H=>{console.log("Selected emoji from picker:",H),S?.(H),z(!1),T()},O=()=>{I.current?.hide(),T()};return<>
289
+ <ks.default ref={I}onClose={O}containerStyle={ee.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
300
290
  {}
301
- <G.View style={ee.header}>
302
- <G.Text style={ee.title}>{V} reactions</G.Text>
303
- <G.TouchableOpacity onPress={O}style={ee.closeButton}>
304
- <G.Text style={ee.closeText}>✕</G.Text>
305
- </G.TouchableOpacity>
306
- </G.View>
291
+ <_.View style={ee.header}>
292
+ <_.Text style={ee.title}>{B} reactions</_.Text>
293
+ <_.TouchableOpacity onPress={O}style={ee.closeButton}>
294
+ <_.Text style={ee.closeText}>✕</_.Text>
295
+ </_.TouchableOpacity>
296
+ </_.View>
307
297
 
308
298
  {}
309
- <G.View style={ee.messagePreview}>
310
- <G.Text style={ee.messageText}numberOfLines={2}>
299
+ <_.View style={ee.messagePreview}>
300
+ <_.Text style={ee.messageText}numberOfLines={2}>
311
301
  {R}
312
- </G.Text>
313
- </G.View>
302
+ </_.Text>
303
+ </_.View>
314
304
 
315
305
  {}
316
- <G.View style={ee.reactionButtons}>
306
+ <_.View style={ee.reactionButtons}>
317
307
  {}
318
308
 
319
- {C.map((F,H)=><G.View key={H}style={ee.reactionButton}>
320
- <G.Text style={ee.reactionEmoji}>{F.emoji}</G.Text>
321
- <G.Text style={ee.reactionCount}>{F.count}</G.Text>
322
- </G.View>)}
323
- </G.View>
309
+ {C.map((H,F)=><_.View key={F}style={ee.reactionButton}>
310
+ <_.Text style={ee.reactionEmoji}>{H.emoji}</_.Text>
311
+ <_.Text style={ee.reactionCount}>{H.count}</_.Text>
312
+ </_.View>)}
313
+ </_.View>
324
314
 
325
315
  {}
326
- <G.ScrollView style={ee.userReactionsList}showsVerticalScrollIndicator={!1}>
327
- {v.map(F=>{let H=F.name==="You",N=H?G.TouchableOpacity:G.View;return<N key={F.id}style={[ee.userReactionItem,H&&ee.tappableUserReactionItem]}onPress={H?()=>D(F):void 0}activeOpacity={H?.7:1}>
328
- <G.View style={ee.userInfo}>
329
- <G.Text style={ee.userAvatar}>{F.avatar}</G.Text>
330
- <G.View style={ee.userDetails}>
331
- <G.Text style={ee.userName}>{F.name}</G.Text>
332
- {H&&<G.Text style={ee.removeText}>Tap to remove</G.Text>}
333
- </G.View>
334
- </G.View>
335
- <G.View style={ee.userReactionEmoji}>
336
- <G.Text style={ee.emojiText}>{F.emoji}</G.Text>
337
- </G.View>
316
+ <_.ScrollView style={ee.userReactionsList}showsVerticalScrollIndicator={!1}>
317
+ {v.map(H=>{let F=H.name==="You",N=F?_.TouchableOpacity:_.View;return<N key={H.id}style={[ee.userReactionItem,F&&ee.tappableUserReactionItem]}onPress={F?()=>V(H):void 0}activeOpacity={F?.7:1}>
318
+ <_.View style={ee.userInfo}>
319
+ <_.Text style={ee.userAvatar}>{H.avatar}</_.Text>
320
+ <_.View style={ee.userDetails}>
321
+ <_.Text style={ee.userName}>{H.name}</_.Text>
322
+ {F&&<_.Text style={ee.removeText}>Tap to remove</_.Text>}
323
+ </_.View>
324
+ </_.View>
325
+ <_.View style={ee.userReactionEmoji}>
326
+ <_.Text style={ee.emojiText}>{H.emoji}</_.Text>
327
+ </_.View>
338
328
  </N>})}
339
- </G.ScrollView>
340
- </Rs.default>
329
+ </_.ScrollView>
330
+ </ks.default>
341
331
 
342
332
  {}
343
- <St visible={z}onClose={k}onEmojiSelected={L}/>
344
- </>},ee=G.StyleSheet.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}}),$t=Sn;var Yt=Q(require("react")),et=require("react-native"),Ss=Q(require("react-native-actions-sheet")),Ts=require("lucide-react-native"),It=(0,Yt.forwardRef)(({onOptionSelect:M,options:S},C)=>{let R=Yt.default.useRef(null);(0,Yt.useImperativeHandle)(C,()=>({show:()=>R.current?.show(),hide:()=>R.current?.hide()}));let T=A=>{M(A),R.current?.hide()};return<Ss.default ref={R}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
345
- <et.View style={{padding:20,width:"100%"}}>
333
+ <Bt visible={P}onClose={k}onEmojiSelected={L}/>
334
+ </>},ee=_.StyleSheet.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}}),Eo=Tr;var kt=Q(require("react")),Qe=require("react-native"),Ls=Q(require("react-native-actions-sheet")),Es=require("lucide-react-native"),Tt=(0,kt.forwardRef)(({onOptionSelect:M,options:T},C)=>{let R=kt.default.useRef(null);(0,kt.useImperativeHandle)(C,()=>({show:()=>R.current?.show(),hide:()=>R.current?.hide()}));let S=A=>{M(A),R.current?.hide()};return<Ls.default ref={R}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
335
+ <Qe.View style={{padding:20,width:"100%"}}>
346
336
 
347
337
  {}
348
- <et.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:20}}>
349
- <et.Text style={{fontSize:18,fontWeight:"600",color:"#1F2937"}}>
338
+ <Qe.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:20}}>
339
+ <Qe.Text style={{fontSize:18,fontWeight:"600",color:"#1F2937"}}>
350
340
  Share Content
351
- </et.Text>
352
- <et.TouchableOpacity onPress={()=>R.current?.hide()}>
353
- <Ts.X size={24}color="#6B7280"/>
354
- </et.TouchableOpacity>
355
- </et.View>
341
+ </Qe.Text>
342
+ <Qe.TouchableOpacity onPress={()=>R.current?.hide()}>
343
+ <Es.X size={24}color="#6B7280"/>
344
+ </Qe.TouchableOpacity>
345
+ </Qe.View>
356
346
 
357
347
  {}
358
- <et.View style={{flexDirection:"row",flexWrap:"wrap",justifyContent:"space-between",paddingBottom:20}}>
359
- {S.map(A=>{let I=A.icon;return<et.TouchableOpacity key={A.id}style={{width:"30%",aspectRatio:1,marginBottom:20,alignItems:"center",justifyContent:"center"}}onPress={()=>T(A.id)}>
360
- <et.View style={{width:60,height:60,borderRadius:30,backgroundColor:"#F3F4F6",alignItems:"center",justifyContent:"center",marginBottom:8}}>
348
+ <Qe.View style={{flexDirection:"row",flexWrap:"wrap",justifyContent:"space-between",paddingBottom:20}}>
349
+ {T.map(A=>{let I=A.icon;return<Qe.TouchableOpacity key={A.id}style={{width:"30%",aspectRatio:1,marginBottom:20,alignItems:"center",justifyContent:"center"}}onPress={()=>S(A.id)}>
350
+ <Qe.View style={{width:60,height:60,borderRadius:30,backgroundColor:"#F3F4F6",alignItems:"center",justifyContent:"center",marginBottom:8}}>
361
351
  <I size={24}color={A.color}/>
362
- </et.View>
363
- <et.Text style={{fontSize:12,color:"#6B7280",textAlign:"center",fontWeight:"500"}}>
352
+ </Qe.View>
353
+ <Qe.Text style={{fontSize:12,color:"#6B7280",textAlign:"center",fontWeight:"500"}}>
364
354
  {A.label}
365
- </et.Text>
366
- </et.TouchableOpacity>})}
367
- </et.View>
368
- </et.View>
369
- </Ss.default>});It.displayName="AttachmentMenu";var Bo=require("react"),Ee=require("react-native"),Tn=({isVisible:M})=>{let S=(0,Bo.useRef)(new Ee.Animated.Value(0)).current;return(0,Bo.useEffect)(()=>{if(!M){S.setValue(0);return}let C=Ee.Animated.loop(Ee.Animated.sequence([Ee.Animated.timing(S,{toValue:1,duration:1200,useNativeDriver:!0}),Ee.Animated.timing(S,{toValue:0,duration:1200,useNativeDriver:!0})]));return C.start(),()=>{C.stop()}},[M,S]),M?<Ee.View style={_t.container}>
370
- <Ee.View style={_t.bubble}>
371
- <Ee.View style={_t.dotsContainer}>
372
- <Ee.Animated.View style={[_t.dot,{opacity:S.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:S.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
373
- <Ee.Animated.View style={[_t.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]})}]}]}/>
374
- <Ee.Animated.View style={[_t.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]})}]}]}/>
375
- </Ee.View>
376
- </Ee.View>
377
- </Ee.View>:null},_t=Ee.StyleSheet.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}}),Gt=Tn;var ko=Q(require("react")),Jt=require("react-native"),ws=require("lucide-react-native");var wn=({visible:M,onPress:S,isReplyActive:C=!1})=>{let R=K(),T=ko.default.useRef(new Jt.Animated.Value(0)).current,[A,I]=ko.default.useState(!1);return ko.default.useEffect(()=>{Jt.Animated.timing(T,{toValue:M?1:0,duration:200,useNativeDriver:!0}).start(()=>{I(M)})},[M,T]),!M&&!A?null:<Jt.Pressable onPress={S}hitSlop={{top:10,bottom:10,left:10,right:10}}>
378
- {({pressed:z})=><Jt.Animated.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:z?[{scale:.95}]:[]}]}>
379
- <ws.ChevronDown size={20}color={R.colors.text}/>
380
- </Jt.Animated.View>}
381
- </Jt.Pressable>},Xt=wn;var co=require("react-native");var In=({displayDate:M})=>{let S=K();return<co.View style={{marginVertical:S.spacing.lg,alignItems:"center"}}>
382
- <co.View style={{borderRadius:S.borderRadius.full,backgroundColor:S.colors.surfaceSecondary,paddingHorizontal:S.spacing.md,paddingVertical:S.spacing.xs}}>
383
- <co.Text style={{fontSize:S.typography.fontSize.xs,color:S.colors.textSecondary,fontWeight:S.typography.fontWeight.medium}}>
355
+ </Qe.Text>
356
+ </Qe.TouchableOpacity>})}
357
+ </Qe.View>
358
+ </Qe.View>
359
+ </Ls.default>});Tt.displayName="AttachmentMenu";var jo=require("react"),ke=require("react-native"),Sr=({isVisible:M})=>{let T=(0,jo.useRef)(new ke.Animated.Value(0)).current;return(0,jo.useEffect)(()=>{if(!M){T.setValue(0);return}let C=ke.Animated.loop(ke.Animated.sequence([ke.Animated.timing(T,{toValue:1,duration:1200,useNativeDriver:!0}),ke.Animated.timing(T,{toValue:0,duration:1200,useNativeDriver:!0})]));return C.start(),()=>{C.stop()}},[M,T]),M?<ke.View style={Lt.container}>
360
+ <ke.View style={Lt.bubble}>
361
+ <ke.View style={Lt.dotsContainer}>
362
+ <ke.Animated.View style={[Lt.dot,{opacity:T.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
363
+ <ke.Animated.View style={[Lt.dot,{opacity:T.interpolate({inputRange:[.33,.83,1.33],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[.33,.83,1.33],outputRange:[0,-4,0]})}]}]}/>
364
+ <ke.Animated.View style={[Lt.dot,{opacity:T.interpolate({inputRange:[.66,1.16,1.66],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[.66,1.16,1.66],outputRange:[0,-4,0]})}]}]}/>
365
+ </ke.View>
366
+ </ke.View>
367
+ </ke.View>:null},Lt=ke.StyleSheet.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}}),Et=Sr;var Oo=Q(require("react")),jt=require("react-native"),js=require("lucide-react-native");var wr=({visible:M,onPress:T,isReplyActive:C=!1})=>{let R=$(),S=Oo.default.useRef(new jt.Animated.Value(0)).current,[A,I]=Oo.default.useState(!1);return Oo.default.useEffect(()=>{jt.Animated.timing(S,{toValue:M?1:0,duration:200,useNativeDriver:!0}).start(()=>{I(M)})},[M,S]),!M&&!A?null:<jt.Pressable onPress={T}hitSlop={{top:10,bottom:10,left:10,right:10}}>
368
+ {({pressed:P})=><jt.Animated.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:S,transform:P?[{scale:.95}]:[]}]}>
369
+ <js.ChevronDown size={20}color={R.colors.text}/>
370
+ </jt.Animated.View>}
371
+ </jt.Pressable>},Ho=wr;var Gt=require("react-native");var Ir=({displayDate:M})=>{let T=$();return<Gt.View style={{marginVertical:T.spacing.lg,alignItems:"center"}}>
372
+ <Gt.View style={{borderRadius:T.borderRadius.full,backgroundColor:T.colors.surfaceSecondary,paddingHorizontal:T.spacing.md,paddingVertical:T.spacing.xs}}>
373
+ <Gt.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.textSecondary,fontWeight:T.typography.fontWeight.medium}}>
384
374
  {M}
385
- </co.Text>
386
- </co.View>
387
- </co.View>},Qt=In;var Ue=Q(require("react")),Je=require("react-native"),to=require("lucide-react-native");var tt=require("react"),Be=require("react-native"),je=require("lucide-react-native"),vt=Q(require("expo-image-picker")),Is=Q(require("expo-document-picker")),Pt=Q(require("expo-location")),vs=Q(require("expo-contacts"));var Zt=Q(require("expo-image-manipulator")),vn={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},Yo=async(M,S={})=>{try{let C={...vn,...S};console.log("Starting image compression...",{uri:M,options:C});let R=await Zt.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:V}=R,D=v,B=V;if(C.maxWidth&&v>C.maxWidth){let k=C.maxWidth/v;D=C.maxWidth,B=V*k}if(C.maxHeight&&B>C.maxHeight){let k=C.maxHeight/B;B=C.maxHeight,D=D*k}(D!==v||B!==V)&&(T.push({resize:{width:Math.round(D),height:Math.round(B)}}),console.log("Resizing image:",{from:{width:v,height:V},to:{width:Math.round(D),height:Math.round(B)}}))}let A={compress:C.quality,format:C.format==="png"?Zt.SaveFormat.PNG:Zt.SaveFormat.JPEG};console.log("Applying compression with options:",A);let I=await Zt.manipulateAsync(M,T,A);console.log("Image compression completed:",{originalUri:M,compressedUri:I.uri,finalDimensions:{width:I.width,height:I.height}});let z=Date.now(),P=C.format==="png"?"png":"jpg",E=`compressed_image_${z}.${P}`;return{uri:I.uri,width:I.width,height:I.height,fileName:E}}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}`)}},_o=(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 Pn=[{id:"photo",label:"Photo",icon:je.Image,color:"#3B82F6"},{id:"camera",label:"Camera",icon:je.Camera,color:"#6B7280"},{id:"location",label:"Location",icon:je.MapPin,color:"#10B981"},{id:"contact",label:"Contact",icon:je.User,color:"#6B7280"},{id:"document",label:"Document",icon:je.FileText,color:"#3B82F6"},{id:"poll",label:"Poll",icon:je.BarChart3,color:"#F59E0B"},{id:"event",label:"Event",icon:je.Calendar,color:"#EF4444"}],eo=M=>{let S=(0,tt.useRef)(null),C=(0,tt.useCallback)(async()=>{console.log("Photo selection initiated");try{console.log("Requesting photo library permissions...");let{status:v}=await vt.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",v),v!=="granted"){Be.Alert.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(D=>setTimeout(()=>D(void 0),300)),console.log("Launching image picker...");let V=await vt.launchImageLibraryAsync({mediaTypes:"images",allowsEditing:!0,aspect:[4,3],quality:.8,allowsMultipleSelection:!1});if(console.log("Image picker result:",V),!V.canceled&&V.assets&&V.assets.length>0){let D=V.assets[0];console.log("Photo selected successfully:",D.uri);try{console.log("Starting image compression...");let B=_o(D.width||1920,D.height||1920),k=await Yo(D.uri,B);console.log("Image compression completed:",k),M?.({type:"image",data:{...k,originalFileSize:D.fileSize}})}catch(B){console.error("Image compression failed:",B),Be.Alert.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:D.uri,width:D.width,height:D.height,fileSize:D.fileSize,fileName:D.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),Be.Alert.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),R=(0,tt.useCallback)(async()=>{console.log("Camera capture initiated");try{console.log("Requesting camera permissions...");let{status:v}=await vt.requestCameraPermissionsAsync();if(console.log("Camera permission status:",v),v!=="granted"){Be.Alert.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(D=>setTimeout(()=>D(void 0),300)),console.log("Launching camera...");let V=await vt.launchCameraAsync({allowsEditing:!0,aspect:[4,3],quality:.8,mediaTypes:"images"});if(console.log("Camera result:",V),!V.canceled&&V.assets&&V.assets.length>0){let D=V.assets[0];console.log("Photo captured successfully:",D.uri);try{console.log("Starting camera image compression...");let B=_o(D.width||1920,D.height||1920),k=await Yo(D.uri,B);console.log("Camera image compression completed:",k),M?.({type:"image",data:{...k,originalFileSize:D.fileSize}})}catch(B){console.error("Camera image compression failed:",B),Be.Alert.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:D.uri,width:D.width,height:D.height,fileSize:D.fileSize,fileName:D.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),Be.Alert.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),T=(0,tt.useCallback)(async()=>{console.log("Location sharing initiated");try{console.log("Requesting location permissions...");let{status:v}=await Pt.requestForegroundPermissionsAsync();if(console.log("Location permission status:",v),v!=="granted"){Be.Alert.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let V=await Pt.getCurrentPositionAsync({accuracy:Pt.Accuracy.High});console.log("Getting address from coordinates...");let D=await Pt.reverseGeocodeAsync({latitude:V.coords.latitude,longitude:V.coords.longitude}),B={coordinates:{latitude:V.coords.latitude,longitude:V.coords.longitude},address:D[0]||null,timestamp:V.timestamp};console.log("Location shared successfully:",B.coordinates),M?.({type:"location",data:B})}catch(v){console.error("Error in location sharing process:",v),Be.Alert.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),A=(0,tt.useCallback)(async()=>{try{let{status:v}=await vs.requestPermissionsAsync();if(v!=="granted"){Be.Alert.alert("Permission needed","Please grant contacts access to share contacts.");return}Be.Alert.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),Be.Alert.alert("Error","Failed to access contacts. Please try again.")}finally{S.current?.hide()}},[]),I=(0,tt.useCallback)(async()=>{console.log("Document selection initiated");try{console.log("Waiting for UI to stabilize..."),await new Promise(V=>setTimeout(()=>V(void 0),300)),console.log("Launching document picker...");let v=await Is.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",v),!v.canceled&&v.assets&&v.assets.length>0){let V=v.assets[0];console.log("Document selected successfully:",V.name),M?.({type:"document",data:{uri:V.uri,name:V.name,size:V.size,mimeType:V.mimeType}})}else console.log("Document selection was canceled by user")}catch(v){console.error("Error in document selection process:",v),Be.Alert.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[M]),z=(0,tt.useCallback)(()=>{Be.Alert.alert("Create Poll","Poll creation feature is coming soon! This would open a poll creation interface.",[{text:"OK",onPress:()=>console.log("Poll creation acknowledged")}])},[]),P=(0,tt.useCallback)(()=>{Be.Alert.alert("Create Event","Event creation feature is coming soon! This would open an event creation interface.",[{text:"OK",onPress:()=>console.log("Event creation acknowledged")}])},[]),E=(0,tt.useCallback)(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":z();break;case"event":P();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(V){console.error(`Error handling ${v}:`,V),Be.Alert.alert("Error",`Failed to handle ${v}. Please try again.`)}},[C,R,T,A,I,z,P]);return{menuRef:S,handleOptionSelect:E,options:Pn}};var Y=Q(require("react")),uo=(M={})=>{let{initialValue:S="",initialHeight:C=50,onValueChange:R,onHeightChange:T,onSend:A,onAttachmentSend:I,onReplyCancel:z,onFocus:P,onBlur:E,maxHeight:v=100,minHeight:V=50,maxLength:D=1e3,placeholder:B="Type a message..."}=M,k=(0,Y.useRef)(null),[L,O]=Y.default.useState(S),[F,H]=Y.default.useState(C),[N,j]=Y.default.useState(!1),[te,Oe]=Y.default.useState(null),[J,Me]=Y.default.useState([]),Fe=Y.default.useMemo(()=>({value:L,height:F,isFocused:N,replyToMessage:te,attachments:J}),[L,F,N,te,J]),Ye=(0,Y.useCallback)(Ae=>{O(Ae),R?.(Ae)},[R]),ke=(0,Y.useCallback)(Ae=>{let Ne=Math.max(V,Math.min(v,Ae));H(Ne),T?.(Ne)},[V,v,T]),Ce=(0,Y.useCallback)(()=>{j(!0),P?.()},[P]),U=(0,Y.useCallback)(()=>{j(!1),E?.()},[E]),He=(0,Y.useCallback)(Ae=>{let{height:Ne}=Ae.nativeEvent.contentSize,ao=Math.max(V,Math.min(v,Ne+16));ke(ao)},[V,v,ke]),st=(0,Y.useCallback)(()=>{A&&(L||J.length>0)&&(A(L,J,te),O(S),Me([]),Oe(null),H(C))},[A,L,J,te,S,C]),Xe=(0,Y.useCallback)(Ae=>{I?(I(Ae,L),L&&O(S)):Me(Ne=>[...Ne,{...Ae,id:Date.now().toString()}])},[I,L,S]),Le=(0,Y.useCallback)(Ae=>{Me(Ne=>[...Ne,Ae])},[]),_e=(0,Y.useCallback)(Ae=>{Me(Ne=>Ne.filter(ao=>ao.id!==Ae))},[]),nt=(0,Y.useCallback)(()=>{Me([])},[]),we=(0,Y.useCallback)(()=>{Oe(null),z?.()},[z]),pt=(0,Y.useCallback)(()=>{k.current?.focus()},[]),Ho=Y.default.useMemo(()=>({setValue:Ye,setHeight:ke,setFocus:j,setReplyToMessage:Oe,addAttachment:Le,removeAttachment:_e,clearAttachments:nt,sendMessage:st,cancelReply:we,focusInput:pt,handleAttachmentSelected:Xe,handleContentSizeChange:He,handleFocus:Ce,handleBlur:U}),[Ye,ke,j,Oe,Le,_e,nt,st,we,pt,Xe,He,Ce,U]),No=Y.default.useMemo(()=>({textInputRef:k}),[]);return{state:Fe,actions:Ho,refs:No}},Ps=(0,Y.createContext)(null),lt=()=>{let M=(0,Y.useContext)(Ps);if(!M)throw new Error("useMessageInputContext must be used within MessageInputProvider");return M},Go=({children:M,value:S})=><Ps.Provider value={S}>
388
- {M}
389
- </Ps.Provider>;var ht=(0,Ue.forwardRef)(({value:M,onChangeText:S,onSend:C,onFocus:R,height:T,onContentSizeChange:A,replyToMessage:I,onCancelReply:z,onAttachmentSend:P},E)=>{let v=K(),V=(0,Ue.useRef)(null);(0,Ue.useImperativeHandle)(E,()=>({focus:()=>{V.current?.focus()}}));let{state:D,actions:B}=uo({initialValue:M,initialHeight:T,onValueChange:S,onHeightChange:A,onSend:C,onAttachmentSend:P,onReplyCancel:z,onFocus:R});Ue.default.useEffect(()=>{M!==D.value&&B.setValue(M)},[M,D.value,B]),Ue.default.useEffect(()=>{T!==D.height&&B.setHeight(T)},[T,D.height,B]),Ue.default.useEffect(()=>{I!==D.replyToMessage&&B.setReplyToMessage(I||null)},[I,D.replyToMessage,B]),Ue.default.useEffect(()=>{if(I&&V.current){let O=setTimeout(()=>{V.current?.focus()},100);return()=>clearTimeout(O)}},[I]);let k=(0,Ue.useCallback)(O=>{if(console.log("Attachment selected:",O),P)P(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)}},[P,M,S]),L=eo(k);return<>
390
- {I&&z&&<Rt replyToMessage={I}onCancel={z}/>}
391
- <Je.View style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
392
- <Je.View style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:T}}>
393
- <Je.TouchableOpacity style={{marginRight:v.spacing.md}}onPress={()=>L.menuRef.current?.show()}>
394
- <to.Plus size={24}color={v.colors.textSecondary}/>
395
- </Je.TouchableOpacity>
375
+ </Gt.Text>
376
+ </Gt.View>
377
+ </Gt.View>},Fo=Ir;var Ne=Q(require("react")),Ge=require("react-native"),Ht=require("lucide-react-native");var Ze=require("react"),Be=require("react-native"),Le=require("lucide-react-native"),ft=Q(require("expo-image-picker")),Os=Q(require("expo-document-picker")),yt=Q(require("expo-location")),Hs=Q(require("expo-contacts"));var Ot=Q(require("expo-image-manipulator")),vr={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},ss=async(M,T={})=>{try{let C={...vr,...T};console.log("Starting image compression...",{uri:M,options:C});let R=await Ot.manipulateAsync(M,[],{});console.log("Original image info:",{width:R.width,height:R.height,uri:R.uri});let S=[];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)&&(S.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"?Ot.SaveFormat.PNG:Ot.SaveFormat.JPEG};console.log("Applying compression with options:",A);let I=await Ot.manipulateAsync(M,S,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}`)}},rs=(M,T)=>M>3e3||T>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:M>1920||T>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var Pr=[{id:"photo",label:"Photo",icon:Le.Image,color:"#3B82F6"},{id:"camera",label:"Camera",icon:Le.Camera,color:"#6B7280"},{id:"location",label:"Location",icon:Le.MapPin,color:"#10B981"},{id:"contact",label:"Contact",icon:Le.User,color:"#6B7280"},{id:"document",label:"Document",icon:Le.FileText,color:"#3B82F6"},{id:"poll",label:"Poll",icon:Le.BarChart3,color:"#F59E0B"},{id:"event",label:"Event",icon:Le.Calendar,color:"#EF4444"}],No=M=>{let T=(0,Ze.useRef)(null),C=(0,Ze.useCallback)(async()=>{console.log("Photo selection initiated");try{console.log("Requesting photo library permissions...");let{status:v}=await ft.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",v),v!=="granted"){Be.Alert.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 ft.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=rs(V.width||1920,V.height||1920),k=await ss(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),Be.Alert.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),Be.Alert.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),R=(0,Ze.useCallback)(async()=>{console.log("Camera capture initiated");try{console.log("Requesting camera permissions...");let{status:v}=await ft.requestCameraPermissionsAsync();if(console.log("Camera permission status:",v),v!=="granted"){Be.Alert.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 ft.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=rs(V.width||1920,V.height||1920),k=await ss(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),Be.Alert.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),Be.Alert.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),S=(0,Ze.useCallback)(async()=>{console.log("Location sharing initiated");try{console.log("Requesting location permissions...");let{status:v}=await yt.requestForegroundPermissionsAsync();if(console.log("Location permission status:",v),v!=="granted"){Be.Alert.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let B=await yt.getCurrentPositionAsync({accuracy:yt.Accuracy.High});console.log("Getting address from coordinates...");let V=await yt.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),Be.Alert.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),A=(0,Ze.useCallback)(async()=>{try{let{status:v}=await Hs.requestPermissionsAsync();if(v!=="granted"){Be.Alert.alert("Permission needed","Please grant contacts access to share contacts.");return}Be.Alert.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),Be.Alert.alert("Error","Failed to access contacts. Please try again.")}finally{T.current?.hide()}},[]),I=(0,Ze.useCallback)(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 Os.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),Be.Alert.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[M]),P=(0,Ze.useCallback)(()=>{Be.Alert.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=(0,Ze.useCallback)(()=>{Be.Alert.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=(0,Ze.useCallback)(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await C();break;case"camera":await R();break;case"location":await S();break;case"contact":await A();break;case"document":await I();break;case"poll":P();break;case"event":z();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(B){console.error(`Error handling ${v}:`,B),Be.Alert.alert("Error",`Failed to handle ${v}. Please try again.`)}},[C,R,S,A,I,P,z]);return{menuRef:T,handleOptionSelect:j,options:Pr}};var Y=Q(require("react")),_t=(M={})=>{let{initialValue:T="",initialHeight:C=50,onValueChange:R,onHeightChange:S,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=(0,Y.useRef)(null),[L,O]=Y.default.useState(T),[H,F]=Y.default.useState(C),[N,E]=Y.default.useState(!1),[te,je]=Y.default.useState(null),[J,Me]=Y.default.useState([]),Oe=Y.default.useMemo(()=>({value:L,height:H,isFocused:N,replyToMessage:te,attachments:J}),[L,H,N,te,J]),qe=(0,Y.useCallback)(Pe=>{O(Pe),R?.(Pe)},[R]),Ve=(0,Y.useCallback)(Pe=>{let Fe=Math.max(B,Math.min(v,Pe));F(Fe),S?.(Fe)},[B,v,S]),Ce=(0,Y.useCallback)(()=>{E(!0),z?.()},[z]),U=(0,Y.useCallback)(()=>{E(!1),j?.()},[j]),He=(0,Y.useCallback)(Pe=>{let{height:Fe}=Pe.nativeEvent.contentSize,Kt=Math.max(B,Math.min(v,Fe+16));Ve(Kt)},[B,v,Ve]),et=(0,Y.useCallback)(()=>{A&&(L||J.length>0)&&(A(L,J,te),O(T),Me([]),je(null),F(C))},[A,L,J,te,T,C]),_e=(0,Y.useCallback)(Pe=>{I?(I(Pe,L),L&&O(T)):Me(Fe=>[...Fe,{...Pe,id:Date.now().toString()}])},[I,L,T]),De=(0,Y.useCallback)(Pe=>{Me(Fe=>[...Fe,Pe])},[]),$e=(0,Y.useCallback)(Pe=>{Me(Fe=>Fe.filter(Kt=>Kt.id!==Pe))},[]),tt=(0,Y.useCallback)(()=>{Me([])},[]),Se=(0,Y.useCallback)(()=>{je(null),P?.()},[P]),dt=(0,Y.useCallback)(()=>{k.current?.focus()},[]),_o=Y.default.useMemo(()=>({setValue:qe,setHeight:Ve,setFocus:E,setReplyToMessage:je,addAttachment:De,removeAttachment:$e,clearAttachments:tt,sendMessage:et,cancelReply:Se,focusInput:dt,handleAttachmentSelected:_e,handleContentSizeChange:He,handleFocus:Ce,handleBlur:U}),[qe,Ve,E,je,De,$e,tt,et,Se,dt,_e,He,Ce,U]),Jo=Y.default.useMemo(()=>({textInputRef:k}),[]);return{state:Oe,actions:_o,refs:Jo}},Fa=(0,Y.createContext)(null);var ut=(0,Ne.forwardRef)(({value:M,onChangeText:T,onSend:C,onFocus:R,height:S,onContentSizeChange:A,replyToMessage:I,onCancelReply:P,onAttachmentSend:z},j)=>{let v=$(),B=(0,Ne.useRef)(null);(0,Ne.useImperativeHandle)(j,()=>({focus:()=>{B.current?.focus()}}));let{state:V,actions:D}=_t({initialValue:M,initialHeight:S,onValueChange:T,onHeightChange:A,onSend:C,onAttachmentSend:z,onReplyCancel:P,onFocus:R});Ne.default.useEffect(()=>{M!==V.value&&D.setValue(M)},[M,V.value,D]),Ne.default.useEffect(()=>{S!==V.height&&D.setHeight(S)},[S,V.height,D]),Ne.default.useEffect(()=>{I!==V.replyToMessage&&D.setReplyToMessage(I||null)},[I,V.replyToMessage,D]),Ne.default.useEffect(()=>{if(I&&B.current){let O=setTimeout(()=>{B.current?.focus()},100);return()=>clearTimeout(O)}},[I]);let k=(0,Ne.useCallback)(O=>{if(console.log("Attachment selected:",O),z)z(O,M.trim()||void 0),M.trim()&&T("");else switch(O.type){case"image":console.log("Image attachment ready to send:",{uri:O.data.uri,dimensions:{width:O.data.width,height:O.data.height},fileName:O.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:O.data.name,size:O.data.size});break;case"location":console.log("Location attachment ready to send:",O.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",O.data);break;default:console.log("Other attachment ready to send:",O)}},[z,M,T]),L=No(k);return<>
378
+ {I&&P&&<Yt replyToMessage={I}onCancel={P}/>}
379
+ <Ge.View style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
380
+ <Ge.View style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:S}}>
381
+ <Ge.TouchableOpacity style={{marginRight:v.spacing.md}}onPress={()=>L.menuRef.current?.show()}>
382
+ <Ht.Plus size={24}color={v.colors.textSecondary}/>
383
+ </Ge.TouchableOpacity>
396
384
 
397
- <Je.View style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:v.borderRadius.full,backgroundColor:v.colors.surfaceSecondary,paddingHorizontal:v.spacing.lg,paddingVertical:6}}>
398
- <Je.TextInput ref={V}style={{flex:1,fontSize:v.typography.fontSize.base,maxHeight:70,minHeight:18,paddingTop:Je.Platform.OS==="ios"?6:3,paddingBottom:Je.Platform.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={B.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
399
- </Je.View>
385
+ <Ge.View style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:v.borderRadius.full,backgroundColor:v.colors.surfaceSecondary,paddingHorizontal:v.spacing.lg,paddingVertical:6}}>
386
+ <Ge.TextInput ref={B}style={{flex:1,fontSize:v.typography.fontSize.base,maxHeight:70,minHeight:18,paddingTop:Ge.Platform.OS==="ios"?6:3,paddingBottom:Ge.Platform.OS==="ios"?6:3,color:v.colors.text}}value={M}onChangeText={T}placeholder='Type a message...'placeholderTextColor={v.colors.textMuted}multiline maxLength={1e3}onFocus={R}onContentSizeChange={D.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
387
+ </Ge.View>
400
388
 
401
- <Je.TouchableOpacity 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()}>
402
- {M.trim()?<to.Send size={18}color='white'/>:<to.Mic size={18}color='white'/>}
403
- </Je.TouchableOpacity>
404
- </Je.View>
405
- </Je.View>
389
+ <Ge.TouchableOpacity 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()?<Ht.Send size={18}color='white'/>:<Ht.Mic size={18}color='white'/>}
391
+ </Ge.TouchableOpacity>
392
+ </Ge.View>
393
+ </Ge.View>
406
394
 
407
- <It ref={L.menuRef}onOptionSelect={L.handleOptionSelect}options={L.options}/>
408
- </>});ht.displayName="MessageInput";var ct=require("react-native"),oo=require("lucide-react-native");var Jo={Container:({children:M,render:S})=>{let C=lt();return S?S(C):<>{M}</>},ReplyPreview:({render:M})=>{let{state:S,actions:C}=lt();return S.replyToMessage?M?M({state:S,actions:C}):<Rt replyToMessage={S.replyToMessage}onCancel={C.cancelReply}/>:null},TextArea:({render:M})=>{let{state:S,actions:C,refs:R}=lt(),T=K();return M?M({state:S,actions:C,refs:R}):<ct.View style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:T.borderRadius.full,backgroundColor:T.colors.surfaceSecondary,paddingHorizontal:T.spacing.lg,paddingVertical:6}}>
409
- <ct.TextInput ref={R.textInputRef}style={{flex:1,fontSize:T.typography.fontSize.base,maxHeight:70,minHeight:18,paddingTop:ct.Platform.OS==="ios"?6:3,paddingBottom:ct.Platform.OS==="ios"?6:3,color:T.colors.text}}value={S.value}onChangeText={C.setValue}placeholder='Type a message...'placeholderTextColor={T.colors.textMuted}multiline maxLength={1e3}onFocus={C.handleFocus}onBlur={C.handleBlur}onContentSizeChange={C.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
410
- </ct.View>},AttachmentButton:({render:M})=>{let{actions:S}=lt(),C=K(),R=eo(S.handleAttachmentSelected);return M?M({actions:S,attachmentMenu:R}):<ct.TouchableOpacity style={{marginRight:C.spacing.md}}onPress={()=>R.menuRef.current?.show()}>
411
- <oo.Plus size={24}color={C.colors.textSecondary}/>
412
- </ct.TouchableOpacity>},SendButton:({render:M})=>{let{state:S,actions:C}=lt(),R=K();return M?M({state:S,actions:C}):<ct.TouchableOpacity onPress={C.sendMessage}style={{marginLeft:R.spacing.md,height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:R.borderRadius.full,backgroundColor:S.value&&S.value.toString().trim()||S.attachments.length>0?R.colors.primary:R.colors.gray[300]}}disabled={!S.value&&S.attachments.length===0}>
413
- {S.value&&S.value.toString().trim()||S.attachments.length>0?<oo.Send size={18}color='white'/>:<oo.Mic size={18}color='white'/>}
414
- </ct.TouchableOpacity>},AttachmentMenu:({render:M})=>{let{actions:S}=lt(),C=eo(S.handleAttachmentSelected);return M?M({actions:S,attachmentMenu:C}):<It ref={C.menuRef}onOptionSelect={C.handleOptionSelect}options={C.options}/>}};var Eo=Q(require("react"));var At=Q(require("react"));var Lo=require("react");function mo(M,S={}){let{initialNumToRender:C=20,maxToRenderPerBatch:R=10,windowSize:T=10}=S,A=(0,Lo.useMemo)(()=>fs(M).reverse(),[M]),I=(0,Lo.useCallback)(z=>z.listItemType==="date-separator"?z.id:z.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:C,maxToRenderPerBatch:R,windowSize:T,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}var Ke=require("react");function go(M={}){let{scrollThreshold:S=50,autoScrollToBottom:C=!0}=M,R=(0,Ke.useRef)(null),[T,A]=(0,Ke.useState)({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=(0,Ke.useRef)(0),z=(0,Ke.useCallback)(k=>{let{contentOffset:L,contentSize:O,layoutMeasurement:F}=k.nativeEvent,H=L.y,N=Math.abs(H)<S,j=Math.abs(H)>O.height-F.height-S;A({isNearBottom:N,isNearTop:j,showScrollToBottomButton:!N})},[S]),P=(0,Ke.useCallback)(k=>{let L=k>I.current;return I.current=k,L},[]),E=(0,Ke.useCallback)(()=>{},[]),v=(0,Ke.useCallback)((k=!0)=>{R.current&&R.current.scrollToOffset({offset:0,animated:k})},[]),V=(0,Ke.useCallback)((k,L=!0)=>{R.current&&R.current.scrollToOffset({offset:k,animated:L})},[]),D=(0,Ke.useCallback)((k,L=!0)=>{R.current&&R.current.scrollToIndex({index:k,animated:L})},[]),B=(0,Ke.useCallback)(k=>{P(k)&&C&&R.current&&setTimeout(()=>{v()},100)},[P,C,v]);return{flatListRef:R,scrollState:T,handleScroll:z,handleContentSizeChange:E,handleNewMessages:B,scrollToEnd:v,scrollToOffset:V,scrollToIndex:D}}var so=require("react");function po(M={}){let{enableMessageActions:S=!0}=M,[C,R]=(0,so.useState)({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),T=(0,so.useCallback)((z,P)=>{S&&R({actionSheetVisible:!0,selectedMessage:z,messagePosition:P})},[S]),A=(0,so.useCallback)(()=>{R({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=(0,so.useCallback)((z,P)=>{if(!C.selectedMessage)return;let{selectedMessage:E}=C;switch(z){case"reply":P?.onReply?.(E);break;case"copy":if(P?.onCopy)P.onCopy(E);else{let v=E.type==="image"&&E.imageData?E.text||"Image message":E.text;Promise.resolve().then(()=>(zs(),As)).then(({copyToClipboard:V})=>{V(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":P?.onDelete?.(E.id);break;default:P?.onCustomAction?.(z,E);break}A()},[C.selectedMessage,A]);return{actionState:C,handleMessageLongPress:T,handleActionSheetClose:A,handleActionPress:I}}var mt=require("react");function ho(M={}){let{enableReactionDetails:S=!0}=M,[C,R]=(0,mt.useState)({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[T,A]=(0,mt.useState)(null),I=(0,mt.useCallback)(V=>{S&&V.reactions&&V.reactions.length>0&&(A(V),R({isReactionDetailsVisible:!0,selectedReactions:V.reactions,selectedMessageText:V.text}))},[S]),z=(0,mt.useCallback)(()=>{R({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),P=(0,mt.useCallback)((V,D)=>{T&&D?.(T.id,V),z()},[T,z]),E=(0,mt.useCallback)((V,D)=>{T&&D?.(T.id,V),z()},[T,z]),v=(0,mt.useCallback)((V,D)=>{T&&D?.(T.id,V)},[T]);return{reactionState:C,selectedMessage:T,handleReactionPress:I,handleReactionDetailsClose:z,handleAddReaction:P,handleRemoveReaction:E,handleEmojiReact:v}}var fo=require("react");function yo(){let[M,S]=(0,fo.useState)({replyToMessage:null}),C=(0,fo.useCallback)(T=>{S({replyToMessage:T})},[]),R=(0,fo.useCallback)(()=>{S({replyToMessage:null})},[]);return{replyState:M,setReplyToMessage:C,clearReply:R}}var Vs=(0,At.createContext)(null);function zt(){let M=(0,At.useContext)(Vs);if(!M)throw new Error("useMessageListContext must be used within MessageListProvider");return M}function Lt({children:M,messages:S,config:C={},...R}){let T=mo(S,C),A=go(C),I=po(C),z=ho(C),P=yo();At.default.useEffect(()=>{A.handleNewMessages(S.length)},[S.length,A.handleNewMessages]);let E=(0,At.useMemo)(()=>({messageList:T,scroll:A,actions:I,reactions:z,reply:P,config:C,callbacks:R}),[T,A,I,z,P,C,R]);return<Vs.Provider value={E}>
395
+ <Tt ref={L.menuRef}onOptionSelect={L.handleOptionSelect}options={L.options}/>
396
+ </>});ut.displayName="MessageInput";var Wo=require("react-native"),ns=require("lucide-react-native");var Ko=Q(require("react"));var xt=Q(require("react"));var Uo=require("react");function Jt(M,T={}){let{initialNumToRender:C=20,maxToRenderPerBatch:R=10,windowSize:S=10}=T,A=(0,Uo.useMemo)(()=>Ps(M).reverse(),[M]),I=(0,Uo.useCallback)(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:C,maxToRenderPerBatch:R,windowSize:S,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}var We=require("react");function as(M={}){let{scrollThreshold:T=50,autoScrollToBottom:C=!0}=M,R=(0,We.useRef)(null),[S,A]=(0,We.useState)({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=(0,We.useRef)(0),P=(0,We.useCallback)(k=>{let{contentOffset:L,contentSize:O,layoutMeasurement:H}=k.nativeEvent,F=L.y,N=Math.abs(F)<T,E=Math.abs(F)>O.height-H.height-T;A({isNearBottom:N,isNearTop:E,showScrollToBottomButton:!N})},[T]),z=(0,We.useCallback)(k=>{let L=k>I.current;return I.current=k,L},[]),j=(0,We.useCallback)(()=>{},[]),v=(0,We.useCallback)((k=!0)=>{R.current&&R.current.scrollToOffset({offset:0,animated:k})},[]),B=(0,We.useCallback)((k,L=!0)=>{R.current&&R.current.scrollToOffset({offset:k,animated:L})},[]),V=(0,We.useCallback)((k,L=!0)=>{R.current&&R.current.scrollToIndex({index:k,animated:L})},[]),D=(0,We.useCallback)(k=>{z(k)&&C&&R.current&&setTimeout(()=>{v()},100)},[z,C,v]);return{flatListRef:R,scrollState:S,handleScroll:P,handleContentSizeChange:j,handleNewMessages:D,scrollToEnd:v,scrollToOffset:B,scrollToIndex:V}}var Ft=require("react");function Xt(M={}){let{enableMessageActions:T=!0}=M,[C,R]=(0,Ft.useState)({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),S=(0,Ft.useCallback)((P,z)=>{T&&R({actionSheetVisible:!0,selectedMessage:P,messagePosition:z})},[T]),A=(0,Ft.useCallback)(()=>{R({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=(0,Ft.useCallback)((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;Promise.resolve().then(()=>(Ns(),Fs)).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:S,handleActionSheetClose:A,handleActionPress:I}}var lt=require("react");function Qt(M={}){let{enableReactionDetails:T=!0}=M,[C,R]=(0,lt.useState)({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[S,A]=(0,lt.useState)(null),I=(0,lt.useCallback)(B=>{T&&B.reactions&&B.reactions.length>0&&(A(B),R({isReactionDetailsVisible:!0,selectedReactions:B.reactions,selectedMessageText:B.text}))},[T]),P=(0,lt.useCallback)(()=>{R({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),z=(0,lt.useCallback)((B,V)=>{S&&V?.(S.id,B),P()},[S,P]),j=(0,lt.useCallback)((B,V)=>{S&&V?.(S.id,B),P()},[S,P]),v=(0,lt.useCallback)((B,V)=>{S&&V?.(S.id,B)},[S]);return{reactionState:C,selectedMessage:S,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:z,handleRemoveReaction:j,handleEmojiReact:v}}var Zt=require("react");function is(){let[M,T]=(0,Zt.useState)({replyToMessage:null}),C=(0,Zt.useCallback)(S=>{T({replyToMessage:S})},[]),R=(0,Zt.useCallback)(()=>{T({replyToMessage:null})},[]);return{replyState:M,setReplyToMessage:C,clearReply:R}}var Ws=(0,xt.createContext)(null);function Nt(){let M=(0,xt.useContext)(Ws);if(!M)throw new Error("useMessageListContext must be used within MessageListProvider");return M}function Mo({children:M,messages:T,config:C={},...R}){let S=Jt(T,C),A=as(C),I=Xt(C),P=Qt(C),z=is();xt.default.useEffect(()=>{A.handleNewMessages(T.length)},[T.length,A.handleNewMessages]);let j=(0,xt.useMemo)(()=>({messageList:S,scroll:A,actions:I,reactions:P,reply:z,config:C,callbacks:R}),[S,A,I,P,z,C,R]);return<Ws.Provider value={j}>
415
397
  {M}
416
- </Vs.Provider>}var bo=require("react"),no=require("react-native");var dt={Provider:Lt,Container:({children:M,style:S})=><no.View style={[Ds.container,S]}>{M}</no.View>,Messages:({renderMessage:M,style:S})=>{let{messageList:C,scroll:R,actions:T,reactions:A,callbacks:I}=zt(),z=(0,bo.useCallback)(({item:E,index:v})=>M&&E.listItemType!=="date-separator"?M({message:E,index:v})||null:E.listItemType==="date-separator"?<Qt date={E.date}displayDate={E.displayDate}/>:<Wt message={E}onLongPress={T.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[T.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,M]),P=(0,bo.useCallback)(E=>{R.handleScroll(E);let{isNearBottom:v,isNearTop:V}=R.scrollState;I.onScrollPositionChange?.(v,V),v&&I.onScrollToBottom?.(),V&&I.onScrollToTop?.()},[R.handleScroll,R.scrollState,I]);return<no.FlatList ref={R.flatListRef}data={C.messageItems}renderItem={z}keyExtractor={C.keyExtractor}contentContainerStyle={[Ds.contentContainer,S]}onContentSizeChange={R.handleContentSizeChange}onScroll={P}{...C.flatListProps}/>},TypingIndicator:({isVisible:M})=>M?<Gt isVisible={M}/>:null,ScrollButton:({visible:M,isReplyActive:S,onPress:C})=>{let{scroll:R}=zt();return<Xt visible={M??R.scrollState.showScrollToBottomButton}onPress={C??R.scrollToEnd}isReplyActive={S}/>},ActionSheet:()=>{let{actions:M,reactions:S,reply:C,callbacks:R,config:T}=zt(),A=(0,bo.useCallback)(z=>{M.handleActionPress(z,{onReply:P=>{C.setReplyToMessage(P),R.onReplyMessage?.(P)},onDelete:R.onMessageDelete,onCustomAction:R.onActionPress})},[M.handleActionPress,C.setReplyToMessage,R]),I=(0,bo.useCallback)(z=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",z);let P=M.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",P?.id,"callbacks.onReactionAdd exists:",!!R.onReactionAdd),P&&R.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",P.id,"emoji:",z),R.onReactionAdd(P.id,z)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!P,"callback exists:",!!R.onReactionAdd)},[M.actionState.selectedMessage,R.onReactionAdd]);return T.enableMessageActions?<Kt 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}=zt();return C.enableReactionDetails?<$t visible={M.reactionState.isReactionDetailsVisible}onClose={M.handleReactionDetailsClose}reactions={M.reactionState.selectedReactions}messageText={M.reactionState.selectedMessageText}onRemoveReaction={R=>M.handleRemoveReaction(R,S.onReactionRemove)}/>:null}},Ds=no.StyleSheet.create({container:{flex:1},contentContainer:{paddingVertical:16}});var ft=(0,Eo.forwardRef)(({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},z={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 Eo.default.useImperativeHandle(A,()=>({scrollToEnd:(P=!0)=>{},scrollToOffset:(P,E=!0)=>{},scrollToIndex:(P,E=!0)=>{}}),[]),<Lt messages={M}config={I}{...z}>
417
- <dt.Container>
418
- <dt.Messages/>
419
- <dt.TypingIndicator isVisible={S}/>
420
- <dt.ScrollButton visible={C?void 0:!1}isReplyActive={R}/>
421
- <dt.ActionSheet/>
422
- <dt.ReactionDetails/>
423
- </dt.Container>
424
- </Lt>});ft.displayName="MessageList";var Bs=require("react-native");var qe=require("react-native");var ro=require("react-native");var Vn=({avatar:M,isOnline:S=!1,size:C="medium"})=>{let R=K(),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}}},z=T(),P=I();return<ro.View style={{position:"relative"}}>
398
+ </Ws.Provider>}var Co=require("react"),Wt=require("react-native");var bt={Provider:Mo,Container:({children:M,style:T})=><Wt.View style={[Us.container,T]}>{M}</Wt.View>,Messages:({renderMessage:M,style:T})=>{let{messageList:C,scroll:R,actions:S,reactions:A,callbacks:I}=Nt(),P=(0,Co.useCallback)(({item:j,index:v})=>M&&j.listItemType!=="date-separator"?M({message:j,index:v})||null:j.listItemType==="date-separator"?<Fo date={j.date}displayDate={j.displayDate}/>:<Vo message={j}onLongPress={S.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[S.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,M]),z=(0,Co.useCallback)(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<Wt.FlatList ref={R.flatListRef}data={C.messageItems}renderItem={P}keyExtractor={C.keyExtractor}contentContainerStyle={[Us.contentContainer,T]}onContentSizeChange={R.handleContentSizeChange}onScroll={z}{...C.flatListProps}/>},TypingIndicator:({isVisible:M})=>M?<Et isVisible={M}/>:null,ScrollButton:({visible:M,isReplyActive:T,onPress:C})=>{let{scroll:R}=Nt();return<Ho visible={M??R.scrollState.showScrollToBottomButton}onPress={C??R.scrollToEnd}isReplyActive={T}/>},ActionSheet:()=>{let{actions:M,reactions:T,reply:C,callbacks:R,config:S}=Nt(),A=(0,Co.useCallback)(P=>{M.handleActionPress(P,{onReply:z=>{C.setReplyToMessage(z),R.onReplyMessage?.(z)},onDelete:R.onMessageDelete,onCustomAction:R.onActionPress})},[M.handleActionPress,C.setReplyToMessage,R]),I=(0,Co.useCallback)(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 S.enableMessageActions?<Lo visible={M.actionState.actionSheetVisible}onClose={M.handleActionSheetClose}isMyMessage={M.actionState.selectedMessage?.isMe||!1}selectedMessage={M.actionState.selectedMessage||void 0}messagePosition={M.actionState.messagePosition}onActionPress={A}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:M,callbacks:T,config:C}=Nt();return C.enableReactionDetails?<Eo visible={M.reactionState.isReactionDetailsVisible}onClose={M.handleReactionDetailsClose}reactions={M.reactionState.selectedReactions}messageText={M.reactionState.selectedMessageText}onRemoveReaction={R=>M.handleRemoveReaction(R,T.onReactionRemove)}/>:null}},Us=Wt.StyleSheet.create({container:{flex:1},contentContainer:{paddingVertical:16}});var mt=(0,Ko.forwardRef)(({messages:M,isTyping:T,showScrollToBottom:C=!1,isReplyActive:R=!1,...S},A)=>{let I={scrollThreshold:S.scrollThreshold,autoScrollToBottom:S.autoScrollToBottom,enableMessageActions:S.enableMessageActions,enableReactionDetails:S.enableReactionDetails},P={onScrollToBottom:S.onScrollToBottom,onScrollToTop:S.onScrollToTop,onScrollPositionChange:S.onScrollPositionChange,onReactionAdd:S.onReactionAdd,onReactionRemove:S.onReactionRemove,onMessageDelete:S.onMessageDelete,onReplyMessage:S.onReplyMessage,onActionPress:S.onActionPress};return Ko.default.useImperativeHandle(A,()=>({scrollToEnd:(z=!0)=>{},scrollToOffset:(z,j=!0)=>{},scrollToIndex:(z,j=!0)=>{}}),[]),<Mo messages={M}config={I}{...P}>
399
+ <bt.Container>
400
+ <bt.Messages/>
401
+ <bt.TypingIndicator isVisible={T}/>
402
+ <bt.ScrollButton visible={C?void 0:!1}isReplyActive={R}/>
403
+ <bt.ActionSheet/>
404
+ <bt.ReactionDetails/>
405
+ </bt.Container>
406
+ </Mo>});mt.displayName="MessageList";var Ks=Q(require("react"));function Ee(M){let T=Ks.default.forwardRef((R,S)=>(wt(),<M{...R}ref={S}/>)),C=M.displayName||M.name||"Component";return T.displayName=`RequireAuth(${C})`,T}function nt(M){return(...T)=>(wt(),M(...T))}var qs=require("react-native");var Ue=require("react-native");var Ut=require("react-native");var Vr=({avatar:M,isOnline:T=!1,size:C="medium"})=>{let R=$(),S=()=>{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=S(),z=I();return<Ut.View style={{position:"relative"}}>
425
407
  {}
426
- <ro.View style={[z,{borderRadius:R.borderRadius.full,backgroundColor:R.colors.gray[200],alignItems:"center",justifyContent:"center"}]}>
427
- <ro.Text style={{fontSize:A(),color:R.colors.text}}>
408
+ <Ut.View style={[P,{borderRadius:R.borderRadius.full,backgroundColor:R.colors.gray[200],alignItems:"center",justifyContent:"center"}]}>
409
+ <Ut.Text style={{fontSize:A(),color:R.colors.text}}>
428
410
  {M}
429
- </ro.Text>
430
- </ro.View>
411
+ </Ut.Text>
412
+ </Ut.View>
431
413
 
432
414
  {}
433
- {S&&<ro.View style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:R.colors.online,borderRadius:R.borderRadius.full,borderWidth:2,borderColor:R.colors.background}]}/>}
434
- </ro.View>},Mo=Vn;var Dn=({item:M,onPress:S})=>{let C=K(),R=M.unreadCount&&M.unreadCount>0;return<qe.TouchableOpacity 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)}>
435
- <qe.View style={{marginRight:C.spacing.md}}>
436
- <Mo avatar={M.avatar}isOnline={M.isOnline}size="medium"/>
437
- </qe.View>
415
+ {T&&<Ut.View style={[z,{position:"absolute",bottom:-2,right:-2,backgroundColor:R.colors.online,borderRadius:R.borderRadius.full,borderWidth:2,borderColor:R.colors.background}]}/>}
416
+ </Ut.View>},Ro=Vr;var Dr=({item:M,onPress:T})=>{let C=$(),R=M.unreadCount&&M.unreadCount>0;return<Ue.TouchableOpacity 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={()=>T(M)}>
417
+ <Ue.View style={{marginRight:C.spacing.md}}>
418
+ <Ro avatar={M.avatar}isOnline={M.isOnline}size="medium"/>
419
+ </Ue.View>
438
420
 
439
- <qe.View style={{flex:1,marginRight:C.spacing.md}}>
421
+ <Ue.View style={{flex:1,marginRight:C.spacing.md}}>
440
422
  {}
441
- <qe.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:C.spacing.xs}}>
442
- <qe.Text style={{fontSize:C.typography.fontSize.base,flex:1,fontWeight:R?C.typography.fontWeight.bold:C.typography.fontWeight.semibold,color:C.colors.text}}>
423
+ <Ue.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:C.spacing.xs}}>
424
+ <Ue.Text style={{fontSize:C.typography.fontSize.base,flex:1,fontWeight:R?C.typography.fontWeight.bold:C.typography.fontWeight.semibold,color:C.colors.text}}>
443
425
  {M.name}
444
- </qe.Text>
445
- <qe.Text 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
+ </Ue.Text>
427
+ <Ue.Text 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}}>
446
428
  {M.time}
447
- </qe.Text>
448
- </qe.View>
429
+ </Ue.Text>
430
+ </Ue.View>
449
431
 
450
432
  {}
451
- <qe.View style={{flexDirection:"row",alignItems:"center"}}>
452
- <qe.Text 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
+ <Ue.View style={{flexDirection:"row",alignItems:"center"}}>
434
+ <Ue.Text 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}>
453
435
  {M.message}
454
- </qe.Text>
455
- {M.unreadCount&&<qe.View style={{width:20,height:20,backgroundColor:C.colors.primary,borderRadius:C.borderRadius.full,alignItems:"center",justifyContent:"center",marginLeft:C.spacing.sm}}>
456
- <qe.Text style={{fontSize:C.typography.fontSize.xs,color:"white",fontWeight:C.typography.fontWeight.bold}}>
436
+ </Ue.Text>
437
+ {M.unreadCount&&<Ue.View style={{width:20,height:20,backgroundColor:C.colors.primary,borderRadius:C.borderRadius.full,alignItems:"center",justifyContent:"center",marginLeft:C.spacing.sm}}>
438
+ <Ue.Text style={{fontSize:C.typography.fontSize.xs,color:"white",fontWeight:C.typography.fontWeight.bold}}>
457
439
  {M.unreadCount}
458
- </qe.Text>
459
- </qe.View>}
460
- </qe.View>
461
- </qe.View>
462
- </qe.TouchableOpacity>},Co=Dn;var Bn=({chats:M,onChatPress:S})=>{let C=({item:R})=><Co item={R}onPress={S}/>;return<Bs.FlatList data={M}renderItem={C}keyExtractor={R=>R.id}showsVerticalScrollIndicator={!1}style={{flex:1}}/>},Xo=wo(Bn);var jo=require("react-native");var kn=({title:M})=>{let S=K();return<jo.View style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.lg,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
463
- <jo.Text style={{fontSize:S.typography.fontSize.xxl,fontWeight:S.typography.fontWeight.bold,color:S.colors.text}}>
440
+ </Ue.Text>
441
+ </Ue.View>}
442
+ </Ue.View>
443
+ </Ue.View>
444
+ </Ue.TouchableOpacity>},To=Dr;var kr=({chats:M,onChatPress:T})=>{let C=({item:R})=><To item={R}onPress={T}/>;return<qs.FlatList data={M}renderItem={C}keyExtractor={R=>R.id}showsVerticalScrollIndicator={!1}style={{flex:1}}/>},ls=kr;var qo=require("react-native");var Lr=({title:M})=>{let T=$();return<qo.View style={{backgroundColor:T.colors.background,paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.lg,borderBottomWidth:1,borderBottomColor:T.colors.borderLight}}>
445
+ <qo.Text style={{fontSize:T.typography.fontSize.xxl,fontWeight:T.typography.fontWeight.bold,color:T.colors.text}}>
464
446
  {M}
465
- </jo.Text>
466
- </jo.View>},Qo=kn;var Vt=require("react-native"),Oo=require("lucide-react-native");var Ln=({value:M,onChangeText:S,onClear:C,placeholder:R="Search chats..."})=>{let T=K();return<Vt.View style={{backgroundColor:T.colors.background,paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.md,borderBottomWidth:1,borderBottomColor:T.colors.borderLight}}>
467
- <Vt.View style={{position:"relative"}}>
468
- <Vt.View style={{position:"absolute",left:T.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
469
- <Oo.Search size={20}color={T.colors.textMuted}/>
470
- </Vt.View>
447
+ </qo.Text>
448
+ </qo.View>},cs=Lr;var Mt=require("react-native"),$o=require("lucide-react-native");var Er=({value:M,onChangeText:T,onClear:C,placeholder:R="Search chats..."})=>{let S=$();return<Mt.View style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.md,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
449
+ <Mt.View style={{position:"relative"}}>
450
+ <Mt.View style={{position:"absolute",left:S.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
451
+ <$o.Search size={20}color={S.colors.textMuted}/>
452
+ </Mt.View>
471
453
 
472
- <Vt.TextInput 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
+ <Mt.TextInput value={M}onChangeText={T}placeholder={R}placeholderTextColor={S.colors.textMuted}style={{backgroundColor:S.colors.surfaceSecondary,borderRadius:S.borderRadius.full,paddingLeft:48,paddingRight:40,paddingVertical:S.spacing.md,color:S.colors.text,fontSize:S.typography.fontSize.base}}autoCapitalize="none"autoCorrect={!1}clearButtonMode="never"/>
473
455
 
474
- {M.length>0&&<Vt.TouchableOpacity onPress={C}style={{position:"absolute",right:T.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
475
- <Oo.X size={20}color={T.colors.textMuted}/>
476
- </Vt.TouchableOpacity>}
477
- </Vt.View>
478
- </Vt.View>},Zo=Ln;var gt=require("react"),Fo=Q(require("dayjs")),Et=(0,Fo.default)(),ks=Et.subtract(1,"day"),Ls=Et.subtract(2,"day"),Es=Et.subtract(3,"day"),En=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:Es.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:Es.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:Ls.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Ls.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:ks.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:ks.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:Et.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:Et.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:Et.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:Et.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],es=M=>{let S=En.map(v=>v.isMe?v:{...v,senderName:M||v.senderName}),[C,R]=(0,gt.useState)(S),T=(0,gt.useCallback)((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:(0,Fo.default)().toISOString(),status:"sent",replyTo:V};R(B=>[...B,D]),setTimeout(()=>{R(B=>B.map(k=>k.id===D.id?{...k,status:"delivered"}:k))},1e3),setTimeout(()=>{R(B=>B.map(k=>k.id===D.id?{...k,status:"read"}:k))},3e3)},[]),A=(0,gt.useCallback)((v,V,D)=>{let B={id:Date.now(),text:V||"",isMe:!0,timestamp:(0,Fo.default)().toISOString(),status:"sent",type:"image",imageData:v,replyTo:D};R(k=>[...k,B]),setTimeout(()=>{R(k=>k.map(L=>L.id===B.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{R(k=>k.map(L=>L.id===B.id?{...L,status:"read"}:L))},3e3)},[]),I=(0,gt.useCallback)((v,V)=>{R(D=>D.map(B=>B.id===v?{...B,status:V}:B))},[]),z=(0,gt.useCallback)((v,V)=>{R(D=>D.map(B=>{if(B.id===v){let k=B.reactions||[],L=k.findIndex(O=>O.emoji===V);if(L>=0){let O=[...k];return O[L]={...O[L],count:O[L].count+1,users:[...O[L].users,"me"]},{...B,reactions:O}}else{let O={emoji:V,count:1,users:["me"]};return{...B,reactions:[...k,O]}}}return B}))},[]),P=(0,gt.useCallback)((v,V)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",V),R(D=>D.map(B=>{if(B.id===v){let k=B.reactions||[],L=k.findIndex(O=>O.emoji===V);if(L>=0){let O=k[L];if(O.count>1){let F=[...k];return F[L]={...O,count:O.count-1,users:O.users.filter(H=>H!=="me")},{...B,reactions:F}}else return{...B,reactions:k.filter(F=>F.emoji!==V)}}}return B}))},[]),E=(0,gt.useCallback)(v=>{console.log("deleteMessage called with messageId:",v),R(V=>{let D=V.map(B=>B.id===v?{...B,deleted:!0}:B);return console.log("Message marked as deleted:",v),D})},[]);return{messages:C,sendMessage:T,sendImageMessage:A,updateMessageStatus:I,addReaction:z,deleteMessage:E,removeReaction:P}};var $e=require("react"),ts=(M={})=>{let[S,C]=(0,$e.useState)(M.initialMessages||[]),[R,T]=(0,$e.useState)(!1),A=(0,$e.useCallback)((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(F=>[O,...F])},[]),I=(0,$e.useCallback)(k=>{C(L=>[k,...L])},[]),z=(0,$e.useCallback)((k,L)=>{C(O=>O.map(F=>F.id===k?{...F,...L}:F))},[]),P=(0,$e.useCallback)(k=>{C(L=>L.filter(O=>O.id!==k))},[]),E=(0,$e.useCallback)((k,L)=>{C(O=>O.map(F=>{if(F.id!==k)return F;let H=F.reactions||[];if(H.find(j=>j.emoji===L))return{...F,reactions:H.map(j=>j.emoji===L?{...j,count:j.count+1,users:[...j.users,"current-user"]}:j)};{let j={emoji:L,count:1,users:["current-user"]};return{...F,reactions:[...H,j]}}}))},[]),v=(0,$e.useCallback)((k,L)=>{C(O=>O.map(F=>{if(F.id!==k)return F;let H=F.reactions||[],N=H.find(j=>j.emoji===L);return N?N.count<=1?{...F,reactions:H.filter(j=>j.emoji!==L)}:{...F,reactions:H.map(j=>j.emoji===L?{...j,count:j.count-1,users:j.users.filter(te=>te!=="current-user")}:j)}:F}))},[]),V=(0,$e.useCallback)(k=>{T(k)},[]),D=(0,$e.useCallback)(()=>{C(M.initialMessages||[]),T(!1)},[M.initialMessages]),B=(0,$e.useCallback)(k=>S.find(L=>L.id===k),[S]);return{messages:S,isTyping:R,sendMessage:A,addReaction:E,removeReaction:v,setMessages:C,addMessage:I,updateMessage:z,deleteMessage:P,setTyping:V,resetChat:D,getMessageById:B}};var ot=require("react"),os=(M={})=>{let{typingTimeout:S=3e3,onTypingStart:C,onTypingStop:R}=M,[T,A]=(0,ot.useState)(!1),[I,z]=(0,ot.useState)([]),P=(0,ot.useRef)(null),E=(0,ot.useCallback)(()=>{T||(A(!0),C&&C()),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{A(!1),R&&R()},S)},[T,S,C,R]),v=(0,ot.useCallback)(()=>{A(!1),P.current&&(clearTimeout(P.current),P.current=null),R&&R()},[R]),V=(0,ot.useCallback)(D=>{z(D)},[]);return(0,ot.useEffect)(()=>()=>{P.current&&clearTimeout(P.current)},[]),{isTyping:T,typingUsers:I,startTyping:E,stopTyping:v,setTypingUsers:V}};var js=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 Dt(T),new Error(T)}as(!0);try{R&&console.log(`[Chat SDK] Initializing with projectId: ${S}, apiUrl: ${C}`);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 z=`HTTP ${T.status}: ${T.statusText}`;try{let P=await T.json();z=P.error||P.message||z}catch{try{let E=await T.text();E&&(z=`Server error: ${E}`)}catch{z=`Failed to initialize chat (HTTP ${T.status})`}}throw Dt(z),new Error(z)}let A;try{let z=await T.text();if(R&&console.log(`[Chat SDK] Response text: ${z}`),!z){let P="Server returned empty response";throw Dt(P),new Error(P)}A=JSON.parse(z)}catch(z){R&&console.error("[Chat SDK] JSON parse error:",z);let P="Server returned invalid JSON response";throw Dt(P),new Error(P)}if(!A||typeof A!="object"){let z="Server returned invalid response format";throw Dt(z),new Error(z)}let I=A;return is(I),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")||Dt(A),new Error(A)}};0&&(module.exports={AttachmentMenu,Chat,ChatAvatar,ChatHeader,ChatItem,ChatList,ChatListSearchBar,ChatProvider,ChatScreenHeader,DateSeparator,DeletedMessage,EmojiPicker,ImageMessage,MessageActionSheet,MessageInput,MessageInputCompound,MessageInputProvider,MessageItem,MessageList,MessageListCompound,MessageListProvider,ReactionDetailsSheet,ReplyBubble,ReplyPreview,ScrollToBottomButton,ThemeProvider,TypingIndicator,defaultTheme,initChat,useAttachments,useChatConfig,useChatMessages,useChatSDK,useMessageActions,useMessageInput,useMessageInputContext,useMessageList,useMessageListContext,useMessageListScroll,useMessageReactions,useMessageReply,useTheme,useTypingIndicator});
456
+ {M.length>0&&<Mt.TouchableOpacity onPress={C}style={{position:"absolute",right:S.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
457
+ <$o.X size={20}color={S.colors.textMuted}/>
458
+ </Mt.TouchableOpacity>}
459
+ </Mt.View>
460
+ </Mt.View>},ds=Er;var ct=require("react"),Yo=Q(require("dayjs")),St=(0,Yo.default)(),$s=St.subtract(1,"day"),Ys=St.subtract(2,"day"),Gs=St.subtract(3,"day"),jr=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:Gs.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:Gs.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:Ys.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Ys.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:$s.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:$s.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:St.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:St.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:St.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:St.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],us=M=>{let T=jr.map(v=>v.isMe?v:{...v,senderName:M||v.senderName}),[C,R]=(0,ct.useState)(T),S=(0,ct.useCallback)((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:(0,Yo.default)().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=(0,ct.useCallback)((v,B,V)=>{let D={id:Date.now(),text:B||"",isMe:!0,timestamp:(0,Yo.default)().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=(0,ct.useCallback)((v,B)=>{R(V=>V.map(D=>D.id===v?{...D,status:B}:D))},[]),P=(0,ct.useCallback)((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=(0,ct.useCallback)((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=(0,ct.useCallback)(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:S,sendImageMessage:A,updateMessageStatus:I,addReaction:P,deleteMessage:j,removeReaction:z}};var Ke=require("react");var ms=(M={})=>{wt();let[T,C]=(0,Ke.useState)(M.initialMessages||[]),[R,S]=(0,Ke.useState)(!1),A=(0,Ke.useCallback)((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=(0,Ke.useCallback)(k=>{C(L=>[k,...L])},[]),P=(0,Ke.useCallback)((k,L)=>{C(O=>O.map(H=>H.id===k?{...H,...L}:H))},[]),z=(0,Ke.useCallback)(k=>{C(L=>L.filter(O=>O.id!==k))},[]),j=(0,Ke.useCallback)((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=(0,Ke.useCallback)((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(te=>te!=="current-user")}:E)}:H}))},[]),B=(0,Ke.useCallback)(k=>{S(k)},[]),V=(0,Ke.useCallback)(()=>{C(M.initialMessages||[]),S(!1)},[M.initialMessages]),D=(0,Ke.useCallback)(k=>T.find(L=>L.id===k),[T]);return{messages:T,isTyping:R,sendMessage:A,addReaction:j,removeReaction:v,setMessages:C,addMessage:I,updateMessage:P,deleteMessage:z,setTyping:B,resetChat:V,getMessageById:D}};var Go=require("react");var Or=Ee(Qo),Hr=Ee(Xo),Fr=nt(qt),Nr=Ee(mt),Wr=Ee(ut),Ur=Ee(Po),Kr=Ee(Et),qr=Ee(ls),$r=Ee(To),Yr=Ee(cs),Gr=Ee(ds),_r=Ee(Ro),Jr=Ee(Tt),Xr=Ee(Ss),Qr=nt($),Zr=nt(ms),en=nt(us),tn=nt(Jt),on=nt(Xt),sn=nt(Qt),rn=nt($t),nn=nt(_t);0&&(module.exports={AttachmentMenu,Chat,ChatAvatar,ChatHeader,ChatItem,ChatList,ChatListSearchBar,ChatProvider,ChatScreenHeader,MessageInput,MessageList,ThemeProvider,TypingIndicator,defaultTheme,getAuthState,getProjectId,initChat,isInitialized,useAttachments,useChatConfig,useChatMessages,useChatSDK,useMessageActions,useMessageInput,useMessageList,useMessageReactions,useTheme});