@usechat/react-native 1.0.16 → 1.0.17

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,46 +1,46 @@
1
1
  'use client'
2
- "use strict";var ea=Object.create;var So=Object.defineProperty;var ta=Object.getOwnPropertyDescriptor;var oa=Object.getOwnPropertyNames;var sa=Object.getPrototypeOf,aa=Object.prototype.hasOwnProperty;var na=(M,R)=>()=>(M&&(R=M(M=0)),R);var fs=(M,R)=>{for(var T in R)So(M,T,{get:R[T],enumerable:!0})},ys=(M,R,T,C)=>{if(R&&typeof R=="object"||typeof R=="function")for(let S of oa(R))!aa.call(M,S)&&S!==T&&So(M,S,{get:()=>R[S],enumerable:!(C=ta(R,S))||C.enumerable});return M};var $=(M,R,T)=>(T=M!=null?ea(sa(M)):{},ys(R||!M||!M.__esModule?So(T,"default",{value:M,enumerable:!0}):T,M)),ra=M=>ys(So({},"__esModule",{value:!0}),M);var qs={};fs(qs,{copyToClipboard:()=>Ba,isClipboardAvailable:()=>Da});var Ba,Da,Ys=na(()=>{"use strict";Ba=async M=>{console.log("copyToClipboard called with text:",M);try{try{let{setStringAsync:R}=await import("expo-clipboard");console.log("expo-clipboard imported successfully"),console.log("setStringAsync function:",R),await R(M),console.log("Text copied to clipboard successfully")}catch(R){throw console.error("Failed to import expo-clipboard:",R),new Error("expo-clipboard not available")}try{let R=await import("react-native-toast-message"),T=R.default||R;console.log("react-native-toast-message imported successfully"),T.show({type:"success",text1:"Copied to clipboard",text2:"Message copied successfully",position:"bottom",visibilityTime:2e3}),console.log("Toast shown successfully")}catch(R){console.log("Toast not available, but message copied to clipboard"),console.error("Toast import error:",R)}return!0}catch(R){console.error("Failed to copy to clipboard:",R);try{let T=await import("react-native-toast-message");(T.default||T).show({type:"error",text1:"Copy failed",text2:"Failed to copy message to clipboard",position:"bottom",visibilityTime:2e3})}catch(T){console.error("Copy failed: expo-clipboard not available"),console.error("Toast import error:",T)}return!1}},Da=async()=>{try{return await import("expo-clipboard"),!0}catch{return!1}}});var dn={};fs(dn,{AttachmentMenu:()=>Za,Chat:()=>Ha,ChatAvatar:()=>Xa,ChatHeader:()=>_a,ChatItem:()=>Ga,ChatList:()=>$a,ChatListSearchBar:()=>Ja,ChatProvider:()=>Na,ChatScreenHeader:()=>qa,I18nProvider:()=>$t,MessageInput:()=>Ka,MessageList:()=>Ua,ThemeProvider:()=>Qa,TypingIndicator:()=>Ya,defaultTheme:()=>At,defaultTranslations:()=>qt,getAuthState:()=>Ms,getProjectId:()=>Ts,getTranslation:()=>Pt,initChat:()=>Rs,isInitialized:()=>Cs,isSupportedLocale:()=>Yt,useAttachments:()=>rn,useChatConfig:()=>Wa,useChatMessages:()=>on,useChatSDK:()=>tn,useDateFormatter:()=>cn,useMessageActions:()=>an,useMessageInput:()=>ln,useMessageList:()=>sn,useMessageReactions:()=>nn,useTheme:()=>en,useTranslation:()=>Qo,useTranslationFunction:()=>ke});module.exports=ra(dn);var lt={isInitialized:!1,projectId:null,error:null},xs=M=>{lt={isInitialized:!0,projectId:M,error:null}},bs=M=>{lt={isInitialized:!1,projectId:null,error:M}};var Ms=()=>({...lt}),vt=()=>{if(lt.error)throw new Error(`UseChat SDK initialization failed: ${lt.error}
2
+ "use strict";var da=Object.create;var Bo=Object.defineProperty;var ua=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var pa=Object.getPrototypeOf,ga=Object.prototype.hasOwnProperty;var ha=(C,S)=>()=>(C&&(S=C(C=0)),S);var vs=(C,S)=>{for(var T in S)Bo(C,T,{get:S[T],enumerable:!0})},Ps=(C,S,T,M)=>{if(S&&typeof S=="object"||typeof S=="function")for(let R of ma(S))!ga.call(C,R)&&R!==T&&Bo(C,R,{get:()=>S[R],enumerable:!(M=ua(S,R))||M.enumerable});return C};var Y=(C,S,T)=>(T=C!=null?da(pa(C)):{},Ps(S||!C||!C.__esModule?Bo(T,"default",{value:C,enumerable:!0}):T,C)),fa=C=>Ps(Bo({},"__esModule",{value:!0}),C);var ta={};vs(ta,{copyToClipboard:()=>Ka,isClipboardAvailable:()=>$a});var Ka,$a,oa=ha(()=>{"use strict";Ka=async C=>{console.log("copyToClipboard called with text:",C);try{try{let{setStringAsync:S}=await import("expo-clipboard");console.log("expo-clipboard imported successfully"),console.log("setStringAsync function:",S),await S(C),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"),T=S.default||S;console.log("react-native-toast-message imported successfully"),T.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 T=await import("react-native-toast-message");(T.default||T).show({type:"error",text1:"Copy failed",text2:"Failed to copy message to clipboard",position:"bottom",visibilityTime:2e3})}catch(T){console.error("Copy failed: expo-clipboard not available"),console.error("Toast import error:",T)}return!1}},$a=async()=>{try{return await import("expo-clipboard"),!0}catch{return!1}}});var Rn={};vs(Rn,{AttachmentMenu:()=>pn,Chat:()=>en,ChatAvatar:()=>mn,ChatHeader:()=>dn,ChatItem:()=>cn,ChatList:()=>ln,ChatListSearchBar:()=>un,ChatProvider:()=>tn,ChatScreenHeader:()=>nn,I18nProvider:()=>Xt,MessageInput:()=>an,MessageList:()=>sn,ThemeProvider:()=>gn,TypingIndicator:()=>rn,defaultTheme:()=>Dt,defaultTranslations:()=>Gt,getAuthState:()=>Ds,getInitStatus:()=>Eo,getProjectId:()=>Vs,getTranslation:()=>zt,initChat:()=>Bs,isInitialized:()=>Lo,isInitializing:()=>jo,isSupportedLocale:()=>Jt,useAttachments:()=>Tn,useChatConfig:()=>on,useChatMessages:()=>yn,useChatSDK:()=>fn,useDateFormatter:()=>Sn,useMessageActions:()=>bn,useMessageInput:()=>Mn,useMessageList:()=>xn,useMessageReactions:()=>Cn,useTheme:()=>hn,useTranslation:()=>ds,useTranslationFunction:()=>ke});module.exports=fa(Rn);var Ge={status:"idle",projectId:null,error:null},As=()=>{Ge={status:"pending",projectId:null,error:null}},zs=C=>{Ge={status:"success",projectId:C,error:null}},ko=C=>{Ge={status:"error",projectId:null,error:C}};var Ds=()=>({...Ge}),At=()=>{if(Ge.status==="error")throw new Error(`UseChat SDK: Invalid Project ID
3
3
 
4
- Please call initChat() with a valid project ID before using any UseChat components or hooks.
4
+ ${Ge.error}
5
5
 
6
- Example:
7
- import { initChat } from '@usechat/react-native';
8
- await initChat({ projectId: 'your-project-id' });`);if(!lt.isInitialized)throw new Error(`UseChat SDK is not initialized.
6
+ Please check your project ID in the UseChat dashboard: https://app.usechat.dev`);if(Ge.status==="idle")throw new Error(`UseChat SDK is not initialized.
9
7
 
10
- Please call initChat() with a valid project ID before using any UseChat components or hooks.
8
+ Please call initChat() with your project ID before using any UseChat components.
11
9
 
12
10
  Example:
13
11
  import { initChat } from '@usechat/react-native';
14
- await initChat({ projectId: 'your-project-id' });`)},Ts=()=>(vt(),lt.projectId),Cs=()=>lt.isInitialized&&!lt.error;var Rs=async M=>{let{projectId:R,debug:T=!1}=M;if(!R){let C="Project ID is required";throw bs(C),new Error(C)}return T&&console.log(`[UseChat SDK] Initializing with projectId: ${R}`),xs(R),T&&console.log(`[UseChat SDK] Successfully initialized with projectId: ${R}`),{success:!0,message:"Chat SDK initialized",projectId:R,activatedAt:new Date().toISOString()}};var Pe=$(require("react")),rt=require("react-native");var wo=require("react"),Ss=require("react-native"),Io=require("react-native-keyboard-controller");var at=require("react");var ia={"input.placeholder":"Type a message...","search.placeholder":"Search chats...","status.online":"Online","status.offline":"Offline","status.typing":"typing...","message.deleted":"This message was deleted","message.sending":"Sending...","message.sent":"Sent","message.delivered":"Delivered","message.read":"Read","message.failed":"Failed to send","action.reply":"Reply","action.copy":"Copy","action.delete":"Delete","action.cancel":"Cancel","action.send":"Send","action.clear":"Clear","action.clearAll":"Clear All","attachment.add":"Add attachment","attachment.remove":"Remove","attachment.clear":"Clear","attachment.attachments":"Attachments:","accessibility.back":"Go back","accessibility.send":"Send message","accessibility.attach":"Add attachment","accessibility.emoji":"Add emoji","accessibility.videoCall":"Start video call","accessibility.voiceCall":"Start voice call","accessibility.info":"Chat info","accessibility.search":"Search chats","accessibility.typing":"Someone is typing","error.fileTooLarge":"File is too large","error.invalidFileType":"Invalid file type","error.maxAttachments":"Maximum attachments reached","error.networkError":"Network error occurred","time.justNow":"Just now","time.minutesAgo":"{{count}} min ago","time.hoursAgo":"{{count}}h ago","time.daysAgo":"{{count}}d ago","time.weeksAgo":"{{count}}w ago","time.monthsAgo":"{{count}}mo ago","time.yearsAgo":"{{count}}y ago","date.today":"Today","date.yesterday":"Yesterday","date.todayWithTime":"Today {{time}}","date.yesterdayWithTime":"Yesterday {{time}}"},la={"input.placeholder":"Napisz wiadomo\u015B\u0107...","search.placeholder":"Szukaj czat\xF3w...","status.online":"Online","status.offline":"Offline","status.typing":"pisze...","message.deleted":"Ta wiadomo\u015B\u0107 zosta\u0142a usuni\u0119ta","message.sending":"Wysy\u0142anie...","message.sent":"Wys\u0142ano","message.delivered":"Dostarczono","message.read":"Przeczytano","message.failed":"Nie uda\u0142o si\u0119 wys\u0142a\u0107","action.reply":"Odpowiedz","action.copy":"Kopiuj","action.delete":"Usu\u0144","action.cancel":"Anuluj","action.send":"Wy\u015Blij","action.clear":"Wyczy\u015B\u0107","action.clearAll":"Wyczy\u015B\u0107 wszystko","attachment.add":"Dodaj za\u0142\u0105cznik","attachment.remove":"Usu\u0144","attachment.clear":"Wyczy\u015B\u0107","attachment.attachments":"Za\u0142\u0105czniki:","accessibility.back":"Wr\xF3\u0107","accessibility.send":"Wy\u015Blij wiadomo\u015B\u0107","accessibility.attach":"Dodaj za\u0142\u0105cznik","accessibility.emoji":"Dodaj emoji","accessibility.videoCall":"Rozpocznij wideorozmow\u0119","accessibility.voiceCall":"Rozpocznij rozmow\u0119 g\u0142osow\u0105","accessibility.info":"Informacje o czacie","accessibility.search":"Szukaj czat\xF3w","accessibility.typing":"Kto\u015B pisze","error.fileTooLarge":"Plik jest za du\u017Cy","error.invalidFileType":"Nieprawid\u0142owy typ pliku","error.maxAttachments":"Osi\u0105gni\u0119to maksymaln\u0105 liczb\u0119 za\u0142\u0105cznik\xF3w","error.networkError":"Wyst\u0105pi\u0142 b\u0142\u0105d sieci","time.justNow":"W\u0142a\u015Bnie teraz","time.minutesAgo":"{{count}} min temu","time.hoursAgo":"{{count}}h temu","time.daysAgo":"{{count}}d temu","time.weeksAgo":"{{count}}t temu","time.monthsAgo":"{{count}}mies temu","time.yearsAgo":"{{count}}l temu","date.today":"Dzisiaj","date.yesterday":"Wczoraj","date.todayWithTime":"Dzisiaj {{time}}","date.yesterdayWithTime":"Wczoraj {{time}}"},qt={en:ia,pl:la},Pt=M=>qt[M]||qt.en,Yt=M=>M==="en"||M==="pl";var Zo=(0,at.createContext)(void 0),$t=({children:M,locale:R="en",fallbackLocale:T="en"})=>{let[C,S]=(0,at.useState)(R),V=(0,at.useCallback)((D,E={})=>{let B=Pt(C)[D];return!B&&C!==T&&(B=Pt(T)[D]),B?B.replace(/\{\{(\w+)\}\}/g,(k,A)=>E[A]?.toString()||k):(console.warn(`Translation missing for key: ${D} in locale: ${C}`),D)},[C,T]),I=(0,at.useCallback)(D=>{Yt(D)?S(D):(console.warn(`Unsupported locale: ${D}. Falling back to 'en'`),S("en"))},[]),P={t:V,locale:C,setLocale:I};return<Zo.Provider value={P}>
15
- {M}
16
- </Zo.Provider>},Qo=()=>{let M=(0,at.useContext)(Zo);if(!M)throw new Error("useTranslation must be used within an I18nProvider");return M},ke=()=>{let M=(0,at.useContext)(Zo);return M?M.t:R=>R};var ws=(0,wo.createContext)(null),ca=({children:M,config:R={},locale:T="en"})=>{let C={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...R};return<$t locale={T}>
17
- <ws.Provider value={{config:C}}>
18
- <Io.KeyboardProvider>
19
- <Io.KeyboardAvoidingView behavior={C.keyboardBehavior}style={[da.keyboardContainer]}keyboardVerticalOffset={C.keyboardVerticalOffset}>
12
+
13
+ // In your app entry point (_layout.tsx or App.tsx):
14
+ await initChat({ projectId: 'your-project-id' });`);return Ge.status==="pending"?"pending":"ready"},Vs=()=>{if(At()==="pending")throw new Error("SDK is still initializing");return Ge.projectId},Lo=()=>Ge.status==="success",jo=()=>Ge.status==="pending",Eo=()=>Ge.status;var ya="https://usechat.dev/api/validate-project",_t=null,Bs=async C=>{let{projectId:S,apiUrl:T=ya,debug:M=!1}=C;if(Lo())return M&&console.log(`[UseChat SDK] Already initialized with projectId: ${S}`),{success:!0,message:"Chat SDK already initialized",projectId:S,activatedAt:new Date().toISOString()};if(jo()&&_t)return M&&console.log("[UseChat SDK] Initialization already in progress..."),_t;if(!S||typeof S!="string"||S.trim()===""){let R="Project ID is required";throw ko(R),new Error(`[UseChat SDK] ${R}`)}return As(),M&&console.log(`[UseChat SDK] Initializing with projectId: ${S}`),_t=(async()=>{try{let R=await fetch(`${T}?projectId=${S}`,{method:"GET",headers:{"Content-Type":"application/json"}}),A=await R.json();if(!R.ok){let I=A.error||`Project ID "${S}" not found. Please check your project ID.`;throw ko(I),new Error(`[UseChat SDK] ${I}`)}return zs(S),M&&console.log(`[UseChat SDK] Successfully initialized with project: ${A.name}`),{success:!0,message:`Chat SDK initialized with project: ${A.name}`,projectId:S,projectName:A.name,activatedAt:new Date().toISOString()}}catch(R){if(R instanceof Error&&R.message.startsWith("[UseChat SDK]"))throw R;let A="Failed to initialize SDK. Please check your network connection.";throw ko(A),new Error(`[UseChat SDK] ${A}`)}finally{_t=null}})(),_t};var Pe=Y(require("react")),it=require("react-native");var Fo=require("react"),ks=require("react-native"),Oo=require("react-native-keyboard-controller");var nt=require("react");var xa={"input.placeholder":"Type a message...","search.placeholder":"Search chats...","status.online":"Online","status.offline":"Offline","status.typing":"typing...","message.deleted":"This message was deleted","message.sending":"Sending...","message.sent":"Sent","message.delivered":"Delivered","message.read":"Read","message.failed":"Failed to send","action.reply":"Reply","action.copy":"Copy","action.delete":"Delete","action.cancel":"Cancel","action.send":"Send","action.clear":"Clear","action.clearAll":"Clear All","attachment.add":"Add attachment","attachment.remove":"Remove","attachment.clear":"Clear","attachment.attachments":"Attachments:","accessibility.back":"Go back","accessibility.send":"Send message","accessibility.attach":"Add attachment","accessibility.emoji":"Add emoji","accessibility.videoCall":"Start video call","accessibility.voiceCall":"Start voice call","accessibility.info":"Chat info","accessibility.search":"Search chats","accessibility.typing":"Someone is typing","error.fileTooLarge":"File is too large","error.invalidFileType":"Invalid file type","error.maxAttachments":"Maximum attachments reached","error.networkError":"Network error occurred","time.justNow":"Just now","time.minutesAgo":"{{count}} min ago","time.hoursAgo":"{{count}}h ago","time.daysAgo":"{{count}}d ago","time.weeksAgo":"{{count}}w ago","time.monthsAgo":"{{count}}mo ago","time.yearsAgo":"{{count}}y ago","date.today":"Today","date.yesterday":"Yesterday","date.todayWithTime":"Today {{time}}","date.yesterdayWithTime":"Yesterday {{time}}"},ba={"input.placeholder":"Napisz wiadomo\u015B\u0107...","search.placeholder":"Szukaj czat\xF3w...","status.online":"Online","status.offline":"Offline","status.typing":"pisze...","message.deleted":"Ta wiadomo\u015B\u0107 zosta\u0142a usuni\u0119ta","message.sending":"Wysy\u0142anie...","message.sent":"Wys\u0142ano","message.delivered":"Dostarczono","message.read":"Przeczytano","message.failed":"Nie uda\u0142o si\u0119 wys\u0142a\u0107","action.reply":"Odpowiedz","action.copy":"Kopiuj","action.delete":"Usu\u0144","action.cancel":"Anuluj","action.send":"Wy\u015Blij","action.clear":"Wyczy\u015B\u0107","action.clearAll":"Wyczy\u015B\u0107 wszystko","attachment.add":"Dodaj za\u0142\u0105cznik","attachment.remove":"Usu\u0144","attachment.clear":"Wyczy\u015B\u0107","attachment.attachments":"Za\u0142\u0105czniki:","accessibility.back":"Wr\xF3\u0107","accessibility.send":"Wy\u015Blij wiadomo\u015B\u0107","accessibility.attach":"Dodaj za\u0142\u0105cznik","accessibility.emoji":"Dodaj emoji","accessibility.videoCall":"Rozpocznij wideorozmow\u0119","accessibility.voiceCall":"Rozpocznij rozmow\u0119 g\u0142osow\u0105","accessibility.info":"Informacje o czacie","accessibility.search":"Szukaj czat\xF3w","accessibility.typing":"Kto\u015B pisze","error.fileTooLarge":"Plik jest za du\u017Cy","error.invalidFileType":"Nieprawid\u0142owy typ pliku","error.maxAttachments":"Osi\u0105gni\u0119to maksymaln\u0105 liczb\u0119 za\u0142\u0105cznik\xF3w","error.networkError":"Wyst\u0105pi\u0142 b\u0142\u0105d sieci","time.justNow":"W\u0142a\u015Bnie teraz","time.minutesAgo":"{{count}} min temu","time.hoursAgo":"{{count}}h temu","time.daysAgo":"{{count}}d temu","time.weeksAgo":"{{count}}t temu","time.monthsAgo":"{{count}}mies temu","time.yearsAgo":"{{count}}l temu","date.today":"Dzisiaj","date.yesterday":"Wczoraj","date.todayWithTime":"Dzisiaj {{time}}","date.yesterdayWithTime":"Wczoraj {{time}}"},Gt={en:xa,pl:ba},zt=C=>Gt[C]||Gt.en,Jt=C=>C==="en"||C==="pl";var cs=(0,nt.createContext)(void 0),Xt=({children:C,locale:S="en",fallbackLocale:T="en"})=>{let[M,R]=(0,nt.useState)(S),A=(0,nt.useCallback)((V,E={})=>{let B=zt(M)[V];return!B&&M!==T&&(B=zt(T)[V]),B?B.replace(/\{\{(\w+)\}\}/g,(k,z)=>E[z]?.toString()||k):(console.warn(`Translation missing for key: ${V} in locale: ${M}`),V)},[M,T]),I=(0,nt.useCallback)(V=>{Jt(V)?R(V):(console.warn(`Unsupported locale: ${V}. Falling back to 'en'`),R("en"))},[]),P={t:A,locale:M,setLocale:I};return<cs.Provider value={P}>
15
+ {C}
16
+ </cs.Provider>},ds=()=>{let C=(0,nt.useContext)(cs);if(!C)throw new Error("useTranslation must be used within an I18nProvider");return C},ke=()=>{let C=(0,nt.useContext)(cs);return C?C.t:S=>S};var Ls=(0,Fo.createContext)(null),Ca=({children:C,config:S={},locale:T="en"})=>{let M={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...S};return<Xt locale={T}>
17
+ <Ls.Provider value={{config:M}}>
18
+ <Oo.KeyboardProvider>
19
+ <Oo.KeyboardAvoidingView behavior={M.keyboardBehavior}style={[Ta.keyboardContainer]}keyboardVerticalOffset={M.keyboardVerticalOffset}>
20
20
  {}
21
- {M}
22
- </Io.KeyboardAvoidingView>
23
- </Io.KeyboardProvider>
24
- </ws.Provider>
25
- </$t>},es=ca,Gt=()=>{let M=(0,wo.useContext)(ws);if(!M)throw new Error("useChatConfig must be used within a ChatProvider");return M.config},da=Ss.StyleSheet.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});var nt=require("react"),_t=(M={})=>{let{uploader:R,maxAttachments:T=10,maxFileSize:C=10*1024*1024,allowedTypes:S=["image/*","application/pdf","text/*"],onAttachmentAdd:V,onAttachmentRemove:I,onAttachmentUpload:P}=M,[D,E]=(0,nt.useState)([]),[v,B]=(0,nt.useState)(!1),[k,A]=(0,nt.useState)(0),z=(0,nt.useCallback)(N=>{if(D.length>=T){console.warn(`Maximum ${T} attachments allowed`);return}if(N.data?.size&&N.data.size>C){console.warn(`File size exceeds ${C/(1024*1024)}MB limit`);return}if(N.data?.type&&!S.some(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 F={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};E(te=>[...te,F]),V&&V(F)},[D.length,T,C,S,V]),L=(0,nt.useCallback)(N=>{E(F=>F.filter(te=>te.id!==N)),I&&I(N)},[I]),O=(0,nt.useCallback)(()=>{E([])},[]),j=(0,nt.useCallback)(async N=>{try{let F;switch(N){case"image":F={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":F={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":F={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":F={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:F.data,fileName:F.data.fileName||F.data.name,fileSize:F.data.fileSize||F.data.size,mimeType:F.data.mimeType,uploadStatus:"pending",uploadProgress:0};z(te)}catch(F){console.error("Error opening picker:",F)}},[z]),H=(0,nt.useCallback)(async()=>{if(!R)return console.warn("No uploader provided, skipping upload"),D;if(D.length===0)return[];B(!0),A(0);try{let N=D.map(async(Me,Ee)=>{try{E(Ye=>Ye.map(U=>U.id===Me.id?{...U,uploadStatus:"uploading",uploadProgress:0}:U));let Te=setInterval(()=>{E(Ye=>Ye.map(U=>U.id===Me.id?{...U,uploadProgress:Math.min((U.uploadProgress??0)+10,90)}:U))},100),De=await R.upload(Me.data);clearInterval(Te);let Ae={...Me,uploadStatus:"completed",uploadProgress:100,data:{...Me.data,url:De.url,metadata:De.metadata}};return E(Ye=>Ye.map(U=>U.id===Me.id?Ae:U)),Ae}catch(Te){return console.error(`Error uploading attachment ${Me.id}:`,Te),E(De=>De.map(Ae=>Ae.id===Me.id?{...Ae,uploadStatus:"failed",uploadProgress:0}:Ae)),{...Me,uploadStatus:"failed",uploadProgress:0}}}),F=await Promise.all(N),je=F.filter(Me=>Me.uploadStatus==="completed").length/F.length*100;return A(je),P&&P(F),F}catch(N){return console.error("Error uploading attachments:",N),D}finally{B(!1)}},[D,R,P]);return{attachments:D,openPicker:j,addAttachment:z,removeAttachment:L,clearAttachments:O,uploadAttachments:H,isUploading:v,uploadProgress:k}};var _e=require("react"),Is=(M={})=>{let{onSend:R,onFocus:T,initialValue:C="",maxLength:S=1e3}=M,[V,I]=(0,_e.useState)(C),[P,D]=(0,_e.useState)(40),[E,v]=(0,_e.useState)(!1),B=(0,_e.useCallback)(H=>{H.length<=S&&I(H)},[S]),k=(0,_e.useCallback)(H=>{if(!V.trim()&&(!H||H.length===0))return;let N=V.trim();R&&R(N,H),I(""),D(40)},[V,R]),A=(0,_e.useCallback)(()=>{v(!0),T&&T()},[T]),z=(0,_e.useCallback)(()=>{v(!1)},[]),L=(0,_e.useCallback)(H=>{D(Math.max(40,Math.min(H,120)))},[]),O=(0,_e.useCallback)(()=>{I(""),D(40)},[]),j=(0,_e.useCallback)(H=>{I(H)},[]);return{message:V,composerHeight:P,isFocused:E,handleTextChange:B,handleSend:k,handleFocus:A,handleBlur:z,handleContentSizeChange:L,clearMessage:O,setMessage:j}};var ua=({messages:M,components:R={},renderProps:T={},onMessageSend:C,onReactionAdd:S,onReactionRemove:V,onMessageDelete:I,onActionPress:P,attachmentUploader:D,maxAttachments:E=10,maxFileSize:v=10*1024*1024,allowedFileTypes:B=["image/*","application/pdf","text/*"],enableReactionDetails:k,enableMessageActions:A=!0,enableScrollToBottom:z,enableTypingIndicator:L,isTyping:O=!1,typingUserName:j,isLoading:H=!1,loadingComponent:N})=>{let F=Gt(),[te,je]=(0,Pe.useState)(!1),Me=R.MessageList||pt,Ee=R.MessageInput||mt,Te=k??F.enableReactionDetails??!0,De=A??F.enableMessageActions??!0,Ae=z??F.enableScrollToBottom??!0,Ye=L??F.enableTypingIndicator??!0,[U,$e]=(0,Pe.useState)(null),Fe=(0,Pe.useRef)(null),[Tt,Ce]=(0,Pe.useState)(M||[]),Ge=(0,Pe.useRef)((M||[]).length+1);Pe.default.useEffect(()=>{M&&(Ce(M),Ge.current=M.length+1)},[M]),Pe.default.useEffect(()=>{if(U&&Fe.current){let K=setTimeout(()=>{Fe.current?.focus()},150);return()=>clearTimeout(K)}},[U]);let Xe=_t({uploader:D,maxAttachments:E,maxFileSize:v,allowedTypes:B}),we=Is({onSend:(K,_)=>{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 q=_[0],ve={id:Ge.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X,attachments:_,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}}};Ce(Ze=>[...Ze,ve]),C&&C(ve)}else{let q={id:Ge.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X};Ce(ve=>[...ve,q]),C&&C(q)}$e(null)}else if(_&&_.length>0){let X=_[0],q={id:Ge.current++,text:K.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}}};Ce(ve=>[...ve,q]),C&&C(q)}else{let X={id:Ge.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};Ce(q=>[...q,X]),C&&C(X)}Xe.clearAttachments()},onFocus:()=>{}}),It=(0,Pe.useCallback)((K,_)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",K,"and emoji:",_),Ce(X=>X.map(q=>q.id===K?q.reactions?.find(Ze=>Ze.emoji===_)?{...q,reactions:q.reactions?.map(Ze=>Ze.emoji===_?{...Ze,count:Ze.count+1,users:[...Ze.users,"currentUser"]}:Ze)}:{...q,reactions:[...q.reactions||[],{emoji:_,count:1,users:["currentUser"]}]}:q)),S&&S(K,_)},[S]),Ct=(0,Pe.useCallback)((K,_)=>{Ce(X=>X.map(q=>q.id===K?{...q,reactions:q.reactions?.map(ve=>ve.emoji===_?{...ve,count:Math.max(0,ve.count-1),users:ve.users.filter(Ze=>Ze!=="currentUser")}:ve).filter(ve=>ve.count>0)}:q)),V&&V(K,_)},[V]),Xo=(0,Pe.useCallback)(K=>{Ce(_=>_.map(X=>X.id===K?{...X,deleted:!0,text:"",reactions:void 0}:X)),I&&I(K)},[I]),ze=(0,Pe.useCallback)(()=>{$e(null)},[]),Ne=(0,Pe.useCallback)(K=>{$e(K),setTimeout(()=>{Fe.current?.focus()},100)},[]),Kt=(0,Pe.useCallback)(K=>{if(te)return;let{layout:_}=K.nativeEvent;_.height<=0||je(!0)},[te]);if(H)return<rt.View style={Rt.container}>
26
- {N||<rt.View style={Rt.loadingContainer}>
21
+ {C}
22
+ </Oo.KeyboardAvoidingView>
23
+ </Oo.KeyboardProvider>
24
+ </Ls.Provider>
25
+ </Xt>},us=Ca,Zt=()=>{let C=(0,Fo.useContext)(Ls);if(!C)throw new Error("useChatConfig must be used within a ChatProvider");return C.config},Ta=ks.StyleSheet.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});var rt=require("react"),Qt=(C={})=>{let{uploader:S,maxAttachments:T=10,maxFileSize:M=10*1024*1024,allowedTypes:R=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:P}=C,[V,E]=(0,rt.useState)([]),[v,B]=(0,rt.useState)(!1),[k,z]=(0,rt.useState)(0),D=(0,rt.useCallback)(N=>{if(V.length>=T){console.warn(`Maximum ${T} attachments allowed`);return}if(N.data?.size&&N.data.size>M){console.warn(`File size exceeds ${M/(1024*1024)}MB limit`);return}if(N.data?.type&&!R.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 F={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};E(te=>[...te,F]),A&&A(F)},[V.length,T,M,R,A]),L=(0,rt.useCallback)(N=>{E(F=>F.filter(te=>te.id!==N)),I&&I(N)},[I]),O=(0,rt.useCallback)(()=>{E([])},[]),j=(0,rt.useCallback)(async N=>{try{let F;switch(N){case"image":F={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":F={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":F={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":F={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:F.data,fileName:F.data.fileName||F.data.name,fileSize:F.data.fileSize||F.data.size,mimeType:F.data.mimeType,uploadStatus:"pending",uploadProgress:0};D(te)}catch(F){console.error("Error opening picker:",F)}},[D]),H=(0,rt.useCallback)(async()=>{if(!S)return console.warn("No uploader provided, skipping upload"),V;if(V.length===0)return[];B(!0),z(0);try{let N=V.map(async(Ce,Ee)=>{try{E(qe=>qe.map(U=>U.id===Ce.id?{...U,uploadStatus:"uploading",uploadProgress:0}:U));let Te=setInterval(()=>{E(qe=>qe.map(U=>U.id===Ce.id?{...U,uploadProgress:Math.min((U.uploadProgress??0)+10,90)}:U))},100),Be=await S.upload(Ce.data);clearInterval(Te);let Ae={...Ce,uploadStatus:"completed",uploadProgress:100,data:{...Ce.data,url:Be.url,metadata:Be.metadata}};return E(qe=>qe.map(U=>U.id===Ce.id?Ae:U)),Ae}catch(Te){return console.error(`Error uploading attachment ${Ce.id}:`,Te),E(Be=>Be.map(Ae=>Ae.id===Ce.id?{...Ae,uploadStatus:"failed",uploadProgress:0}:Ae)),{...Ce,uploadStatus:"failed",uploadProgress:0}}}),F=await Promise.all(N),je=F.filter(Ce=>Ce.uploadStatus==="completed").length/F.length*100;return z(je),P&&P(F),F}catch(N){return console.error("Error uploading attachments:",N),V}finally{B(!1)}},[V,S,P]);return{attachments:V,openPicker:j,addAttachment:D,removeAttachment:L,clearAttachments:O,uploadAttachments:H,isUploading:v,uploadProgress:k}};var Je=require("react"),js=(C={})=>{let{onSend:S,onFocus:T,initialValue:M="",maxLength:R=1e3}=C,[A,I]=(0,Je.useState)(M),[P,V]=(0,Je.useState)(40),[E,v]=(0,Je.useState)(!1),B=(0,Je.useCallback)(H=>{H.length<=R&&I(H)},[R]),k=(0,Je.useCallback)(H=>{if(!A.trim()&&(!H||H.length===0))return;let N=A.trim();S&&S(N,H),I(""),V(40)},[A,S]),z=(0,Je.useCallback)(()=>{v(!0),T&&T()},[T]),D=(0,Je.useCallback)(()=>{v(!1)},[]),L=(0,Je.useCallback)(H=>{V(Math.max(40,Math.min(H,120)))},[]),O=(0,Je.useCallback)(()=>{I(""),V(40)},[]),j=(0,Je.useCallback)(H=>{I(H)},[]);return{message:A,composerHeight:P,isFocused:E,handleTextChange:B,handleSend:k,handleFocus:z,handleBlur:D,handleContentSizeChange:L,clearMessage:O,setMessage:j}};var Ma=({messages:C,components:S={},renderProps:T={},onMessageSend:M,onReactionAdd:R,onReactionRemove:A,onMessageDelete:I,onActionPress:P,attachmentUploader:V,maxAttachments:E=10,maxFileSize:v=10*1024*1024,allowedFileTypes:B=["image/*","application/pdf","text/*"],enableReactionDetails:k,enableMessageActions:z=!0,enableScrollToBottom:D,enableTypingIndicator:L,isTyping:O=!1,typingUserName:j,isLoading:H=!1,loadingComponent:N})=>{let F=Zt(),[te,je]=(0,Pe.useState)(!1),Ce=S.MessageList||pt,Ee=S.MessageInput||mt,Te=k??F.enableReactionDetails??!0,Be=z??F.enableMessageActions??!0,Ae=D??F.enableScrollToBottom??!0,qe=L??F.enableTypingIndicator??!0,[U,Ye]=(0,Pe.useState)(null),Fe=(0,Pe.useRef)(null),[Mt,Me]=(0,Pe.useState)(C||[]),_e=(0,Pe.useRef)((C||[]).length+1);Pe.default.useEffect(()=>{C&&(Me(C),_e.current=C.length+1)},[C]),Pe.default.useEffect(()=>{if(U&&Fe.current){let K=setTimeout(()=>{Fe.current?.focus()},150);return()=>clearTimeout(K)}},[U]);let Ze=Qt({uploader:V,maxAttachments:E,maxFileSize:v,allowedTypes:B}),we=js({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 $=G[0],ve={id:_e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X,attachments:G,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}}};Me(Qe=>[...Qe,ve]),M&&M(ve)}else{let $={id:_e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X};Me(ve=>[...ve,$]),M&&M($)}Ye(null)}else if(G&&G.length>0){let X=G[0],$={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}}};Me(ve=>[...ve,$]),M&&M($)}else{let X={id:_e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};Me($=>[...$,X]),M&&M(X)}Ze.clearAttachments()},onFocus:()=>{}}),Pt=(0,Pe.useCallback)((K,G)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",K,"and emoji:",G),Me(X=>X.map($=>$.id===K?$.reactions?.find(Qe=>Qe.emoji===G)?{...$,reactions:$.reactions?.map(Qe=>Qe.emoji===G?{...Qe,count:Qe.count+1,users:[...Qe.users,"currentUser"]}:Qe)}:{...$,reactions:[...$.reactions||[],{emoji:G,count:1,users:["currentUser"]}]}:$)),R&&R(K,G)},[R]),St=(0,Pe.useCallback)((K,G)=>{Me(X=>X.map($=>$.id===K?{...$,reactions:$.reactions?.map(ve=>ve.emoji===G?{...ve,count:Math.max(0,ve.count-1),users:ve.users.filter(Qe=>Qe!=="currentUser")}:ve).filter(ve=>ve.count>0)}:$)),A&&A(K,G)},[A]),ls=(0,Pe.useCallback)(K=>{Me(G=>G.map(X=>X.id===K?{...X,deleted:!0,text:"",reactions:void 0}:X)),I&&I(K)},[I]),ze=(0,Pe.useCallback)(()=>{Ye(null)},[]),Ne=(0,Pe.useCallback)(K=>{Ye(K),setTimeout(()=>{Fe.current?.focus()},100)},[]),Yt=(0,Pe.useCallback)(K=>{if(te)return;let{layout:G}=K.nativeEvent;G.height<=0||je(!0)},[te]);if(H)return<it.View style={Rt.container}>
26
+ {N||<it.View style={Rt.loadingContainer}>
27
27
  {}
28
- </rt.View>}
29
- </rt.View>;if(!te)return<rt.View style={Rt.container}>
30
- <rt.View style={Rt.chatContainer}onLayout={Kt}>
31
- <rt.View style={Rt.loadingContainer}>{N}</rt.View>
32
- </rt.View>
33
- </rt.View>;let hs=T.renderInput;return<rt.View style={Rt.container}>
34
- <rt.View style={Rt.fill}>
35
- <Me messages={Tt}isTyping={Ye?O:!1}typingUserName={j}showScrollToBottom={Ae}isReplyActive={!!U}enableMessageActions={De}enableReactionDetails={Te}onReactionAdd={It}onReactionRemove={Ct}onMessageDelete={Xo}onReplyMessage={Ne}onActionPress={(K,_)=>{K==="reply"?Ne(_):P?.(K,_)}}/>
28
+ </it.View>}
29
+ </it.View>;if(!te)return<it.View style={Rt.container}>
30
+ <it.View style={Rt.chatContainer}onLayout={Yt}>
31
+ <it.View style={Rt.loadingContainer}>{N}</it.View>
32
+ </it.View>
33
+ </it.View>;let Is=T.renderInput;return<it.View style={Rt.container}>
34
+ <it.View style={Rt.fill}>
35
+ <Ce messages={Mt}isTyping={qe?O:!1}typingUserName={j}showScrollToBottom={Ae}isReplyActive={!!U}enableMessageActions={Be}enableReactionDetails={Te}onReactionAdd={Pt}onReactionRemove={St}onMessageDelete={ls}onReplyMessage={Ne}onActionPress={(K,G)=>{K==="reply"?Ne(G):P?.(K,G)}}/>
36
36
 
37
- {hs?hs({value:we.message,onChangeText:we.handleTextChange,onSend:we.handleSend,onFocus:we.handleFocus,height:we.composerHeight,onContentSizeChange:we.handleContentSizeChange,replyToMessage:U,onCancelReply:ze,attachments:Xe.attachments,onAttachmentAdd:Xe.addAttachment,onAttachmentRemove:Xe.removeAttachment,onAttachmentUpload:Xe.uploadAttachments}):<Ee ref={Fe}value={we.message}onChangeText={we.handleTextChange}onSend={we.handleSend}onFocus={we.handleFocus}height={we.composerHeight}onContentSizeChange={we.handleContentSizeChange}replyToMessage={U}onCancelReply={ze}onAttachmentSend={(K,_)=>{let X=K.type==="image",q={id:Ge.current++,text:_?.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}}};Ce(ve=>[...ve,q]),C&&C(q),we.handleTextChange("")}}/>}
37
+ {Is?Is({value:we.message,onChangeText:we.handleTextChange,onSend:we.handleSend,onFocus:we.handleFocus,height:we.composerHeight,onContentSizeChange:we.handleContentSizeChange,replyToMessage:U,onCancelReply:ze,attachments:Ze.attachments,onAttachmentAdd:Ze.addAttachment,onAttachmentRemove:Ze.removeAttachment,onAttachmentUpload:Ze.uploadAttachments}):<Ee ref={Fe}value={we.message}onChangeText={we.handleTextChange}onSend={we.handleSend}onFocus={we.handleFocus}height={we.composerHeight}onContentSizeChange={we.handleContentSizeChange}replyToMessage={U}onCancelReply={ze}onAttachmentSend={(K,G)=>{let X=K.type==="image",$={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}}};Me(ve=>[...ve,$]),M&&M($),we.handleTextChange("")}}/>}
38
38
 
39
39
  {}
40
- </rt.View>
40
+ </it.View>
41
41
 
42
42
  {}
43
- </rt.View>},Rt=rt.StyleSheet.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),ts=ua;var Ie=require("react-native"),gt=require("lucide-react-native");var Ps=require("react");var vo=require("react");var At={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 os=(0,vo.createContext)(At),ma=(M,R)=>({colors:{...M.colors,...R.colors},spacing:{...M.spacing,...R.spacing},borderRadius:{...M.borderRadius,...R.borderRadius},typography:{...M.typography,...R.typography}}),vs=({children:M,theme:R})=>{let T=(0,vo.useMemo)(()=>R?ma(At,R):At,[R]);return<os.Provider value={T}>{M}</os.Provider>};var Y=()=>{let M=(0,Ps.useContext)(os);if(!M)throw new Error("useTheme must be used within a ThemeProvider");return M};var pa=({name:M="George Alan",isOnline:R=!0,onBack:T=()=>{},onVideoCall:C=()=>{},onVoiceCall:S=()=>{},onInfo:V=()=>{}})=>{let I=Y(),P=ke();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}}>
43
+ </it.View>},Rt=it.StyleSheet.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),ms=Ma;var Ie=require("react-native"),gt=require("lucide-react-native");var Fs=require("react");var Ho=require("react");var Dt={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 ps=(0,Ho.createContext)(Dt),Sa=(C,S)=>({colors:{...C.colors,...S.colors},spacing:{...C.spacing,...S.spacing},borderRadius:{...C.borderRadius,...S.borderRadius},typography:{...C.typography,...S.typography}}),Es=({children:C,theme:S})=>{let T=(0,Ho.useMemo)(()=>S?Sa(Dt,S):Dt,[S]);return<ps.Provider value={T}>{C}</ps.Provider>};var q=()=>{let C=(0,Fs.useContext)(ps);if(!C)throw new Error("useTheme must be used within a ThemeProvider");return C};var Ra=({name:C="George Alan",isOnline:S=!0,onBack:T=()=>{},onVideoCall:M,onVoiceCall:R,onInfo:A})=>{let I=q(),P=ke();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}}>
44
44
  <Ie.View style={{flex:1,flexDirection:"row",alignItems:"center"}}>
45
45
  <Ie.TouchableOpacity onPress={T}style={{marginRight:I.spacing.md}}>
46
46
  <gt.ArrowLeft size={24}color={I.colors.gray[700]}/>
@@ -54,15 +54,15 @@ await initChat({ projectId: 'your-project-id' });`)},Ts=()=>(vt(),lt.projectId),
54
54
  👤
55
55
  </Ie.Text>
56
56
  </Ie.View>
57
- {R&&<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}}/>}
57
+ {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}}/>}
58
58
  </Ie.View>
59
59
 
60
60
  <Ie.View style={{flex:1}}>
61
61
  <Ie.Text style={{fontSize:I.typography.fontSize.lg,fontWeight:I.typography.fontWeight.semibold,color:I.colors.text}}>
62
- {M}
62
+ {C}
63
63
  </Ie.Text>
64
64
  <Ie.Text style={{fontSize:I.typography.fontSize.sm,color:I.colors.textSecondary}}>
65
- {P(R?"status.online":"status.offline")}
65
+ {P(S?"status.online":"status.offline")}
66
66
  </Ie.Text>
67
67
  </Ie.View>
68
68
  </Ie.View>
@@ -70,217 +70,217 @@ await initChat({ projectId: 'your-project-id' });`)},Ts=()=>(vt(),lt.projectId),
70
70
 
71
71
  <Ie.View style={{flexDirection:"row",alignItems:"center",gap:I.spacing.lg}}>
72
72
  {}
73
- {C&&<Ie.TouchableOpacity onPress={C}>
73
+ {M&&<Ie.TouchableOpacity onPress={M}>
74
74
  <gt.Video size={24}color={I.colors.gray[700]}/>
75
75
  </Ie.TouchableOpacity>}
76
- {S&&<Ie.TouchableOpacity onPress={S}>
76
+ {R&&<Ie.TouchableOpacity onPress={R}>
77
77
  <gt.Phone size={24}color={I.colors.gray[700]}/>
78
78
  </Ie.TouchableOpacity>}
79
- {V&&<Ie.TouchableOpacity onPress={V}>
79
+ {A&&<Ie.TouchableOpacity onPress={A}>
80
80
  <gt.Info size={24}color={I.colors.gray[700]}/>
81
81
  </Ie.TouchableOpacity>}
82
82
  </Ie.View>
83
- </Ie.View>},Po=pa;var Fs=require("react"),Se=require("react-native");var Qe=$(require("dayjs")),As=$(require("dayjs/plugin/isToday")),zs=$(require("dayjs/plugin/isYesterday")),Vs=$(require("dayjs/plugin/relativeTime")),Bs=$(require("dayjs/plugin/localizedFormat")),Jn=require("dayjs/locale/pl"),Xn=require("dayjs/locale/en");Qe.default.extend(As.default);Qe.default.extend(zs.default);Qe.default.extend(Vs.default);Qe.default.extend(Bs.default);var ga=(M,R="en")=>{let T=(0,Qe.default)(M).locale(R);return T.isToday()?R==="pl"?"Dzisiaj":"Today":T.isYesterday()?R==="pl"?"Wczoraj":"Yesterday":T.format("ddd D MMMM")},Ds=(M,R,T="en")=>{let C=(0,Qe.default)(M).locale(T);return C.isToday()?R("date.today"):C.isYesterday()?R("date.yesterday"):C.format("ddd D MMMM")},ha=M=>(0,Qe.default)(M).format("YYYY-MM-DD"),Ao=(M,R="en")=>{if(M.length===0)return[];let T=[],C=null;return M.forEach((S,V)=>{let I=ha(S.timestamp);if(C!==I){let D=ga(S.timestamp,R),E={id:`date-${I}`,listItemType:"date-separator",date:I,displayDate:D};T.push(E),C=I}let P={...S,listItemType:"message"};T.push(P)}),T},Jt=(M,R="en")=>(0,Qe.default)(M).locale(R).format("HH:mm"),ks=(M,R="en")=>(0,Qe.default)(M).locale(R).fromNow();var Ls=(M,R,T="en")=>{let C=(0,Qe.default)(M).locale(T);return C.isToday()?R("date.todayWithTime",{time:C.format("HH:mm")}):C.isYesterday()?R("date.yesterdayWithTime",{time:C.format("HH:mm")}):C.format("DD MMM YYYY HH:mm")};var et=require("react-native");var fa=({replyTo:M,isMyMessage:R})=>{let T=Y(),C=(E,v=50)=>E.length<=v?E:E.substring(0,v)+"...",S=R?"rgba(255, 255, 255, 0.3)":T.colors.primary,V=R?"rgba(255, 255, 255, 0.8)":T.colors.primary,I=R?"rgba(255, 255, 255, 0.7)":T.colors.textSecondary,P=R?"rgba(255, 255, 255, 0.1)":T.colors.surfaceSecondary,D=M.type==="image"&&M.imageData;return<et.View style={{marginBottom:T.spacing.sm,borderRadius:T.borderRadius.md,padding:T.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:S}}>
84
- <et.Text style={{fontSize:T.typography.fontSize.xs,fontWeight:T.typography.fontWeight.medium,color:V,marginBottom:T.spacing.xs}}>
85
- {M.isMe?"You":M.senderName||"Sender"}
86
- </et.Text>
83
+ </Ie.View>},No=Ra;var _s=require("react"),Re=require("react-native");var et=Y(require("dayjs")),Os=Y(require("dayjs/plugin/isToday")),Hs=Y(require("dayjs/plugin/isYesterday")),Ns=Y(require("dayjs/plugin/relativeTime")),Ws=Y(require("dayjs/plugin/localizedFormat")),dr=require("dayjs/locale/pl"),ur=require("dayjs/locale/en");et.default.extend(Os.default);et.default.extend(Hs.default);et.default.extend(Ns.default);et.default.extend(Ws.default);var wa=(C,S="en")=>{let T=(0,et.default)(C).locale(S);return T.isToday()?S==="pl"?"Dzisiaj":"Today":T.isYesterday()?S==="pl"?"Wczoraj":"Yesterday":T.format("ddd D MMMM")},Us=(C,S,T="en")=>{let M=(0,et.default)(C).locale(T);return M.isToday()?S("date.today"):M.isYesterday()?S("date.yesterday"):M.format("ddd D MMMM")},Ia=C=>(0,et.default)(C).format("YYYY-MM-DD"),Wo=(C,S="en")=>{if(C.length===0)return[];let T=[],M=null;return C.forEach((R,A)=>{let I=Ia(R.timestamp);if(M!==I){let V=wa(R.timestamp,S),E={id:`date-${I}`,listItemType:"date-separator",date:I,displayDate:V};T.push(E),M=I}let P={...R,listItemType:"message"};T.push(P)}),T},eo=(C,S="en")=>(0,et.default)(C).locale(S).format("HH:mm"),Ks=(C,S="en")=>(0,et.default)(C).locale(S).fromNow();var $s=(C,S,T="en")=>{let M=(0,et.default)(C).locale(T);return M.isToday()?S("date.todayWithTime",{time:M.format("HH:mm")}):M.isYesterday()?S("date.yesterdayWithTime",{time:M.format("HH:mm")}):M.format("DD MMM YYYY HH:mm")};var tt=require("react-native");var va=({replyTo:C,isMyMessage:S})=>{let T=q(),M=(E,v=50)=>E.length<=v?E:E.substring(0,v)+"...",R=S?"rgba(255, 255, 255, 0.3)":T.colors.primary,A=S?"rgba(255, 255, 255, 0.8)":T.colors.primary,I=S?"rgba(255, 255, 255, 0.7)":T.colors.textSecondary,P=S?"rgba(255, 255, 255, 0.1)":T.colors.surfaceSecondary,V=C.type==="image"&&C.imageData;return<tt.View style={{marginBottom:T.spacing.sm,borderRadius:T.borderRadius.md,padding:T.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:R}}>
84
+ <tt.Text style={{fontSize:T.typography.fontSize.xs,fontWeight:T.typography.fontWeight.medium,color:A,marginBottom:T.spacing.xs}}>
85
+ {C.isMe?"You":C.senderName||"Sender"}
86
+ </tt.Text>
87
87
 
88
- {D?<et.View style={{flexDirection:"row",alignItems:"center"}}>
89
- <et.Image source={{uri:M.imageData.uri}}style={{width:40,height:40,borderRadius:T.borderRadius.sm,marginRight:T.spacing.sm}}resizeMode="cover"/>
90
- <et.View style={{flex:1}}>
91
- <et.Text style={{fontSize:T.typography.fontSize.xs,color:I,fontStyle:"italic",marginBottom:T.spacing.xs}}>
88
+ {V?<tt.View style={{flexDirection:"row",alignItems:"center"}}>
89
+ <tt.Image source={{uri:C.imageData.uri}}style={{width:40,height:40,borderRadius:T.borderRadius.sm,marginRight:T.spacing.sm}}resizeMode="cover"/>
90
+ <tt.View style={{flex:1}}>
91
+ <tt.Text style={{fontSize:T.typography.fontSize.xs,color:I,fontStyle:"italic",marginBottom:T.spacing.xs}}>
92
92
  📷 Image
93
- </et.Text>
94
- {M.text&&M.text.trim()&&<et.Text style={{fontSize:T.typography.fontSize.sm,color:I,lineHeight:T.typography.lineHeight.tight}}>
95
- {C(M.text,30)}
96
- </et.Text>}
97
- </et.View>
98
- </et.View>:<et.Text style={{fontSize:T.typography.fontSize.sm,color:I,lineHeight:T.typography.lineHeight.tight}}>
99
- {C(M.text)}
100
- </et.Text>}
101
- </et.View>},Vt=fa;var ct=require("react"),Re=require("react-native");var{width:ss,height:js}=Re.Dimensions.get("window"),ya=({imageData:M,isMe:R,onImagePress:T,onLongPress:C})=>{let S=Y(),[V,I]=(0,ct.useState)(!1),[P,D]=(0,ct.useState)(!1),v=(0,ct.useCallback)(()=>{let O=ss*.6,j=300;if(!M.width||!M.height)return{width:O,height:j};let H=M.width/M.height,N=O,F=N/H;return F>j&&(F=j,N=F*H),{width:Math.round(N),height:Math.round(F)}},[M.width,M.height])(),B=(0,ct.useCallback)(()=>{T?T():I(!0)},[T]),k=(0,ct.useCallback)(()=>{console.error("Failed to load image:",M.uri),D(!0)},[M.uri]),A=(0,ct.useCallback)(()=>{I(!1)},[]),L=(0,ct.useCallback)(()=>{if(!M.width||!M.height)return{width:ss,height:js*.8};let O=M.width/M.height,j=ss*.9,H=js*.8,N=j,F=N/O;return F>H&&(F=H,N=F*O),{width:Math.round(N),height:Math.round(F)}},[M.width,M.height])();return P?<Re.View style={[ht.errorContainer,{width:v.width,height:v.height,backgroundColor:R?S.colors.messageBubble.sent:S.colors.messageBubble.received,borderRadius:S.borderRadius.lg}]}>
102
- <Re.Text style={[ht.errorText,{color:R?S.colors.messageBubble.sentText:S.colors.messageBubble.receivedText,fontSize:S.typography.fontSize.sm}]}>
93
+ </tt.Text>
94
+ {C.text&&C.text.trim()&&<tt.Text style={{fontSize:T.typography.fontSize.sm,color:I,lineHeight:T.typography.lineHeight.tight}}>
95
+ {M(C.text,30)}
96
+ </tt.Text>}
97
+ </tt.View>
98
+ </tt.View>:<tt.Text style={{fontSize:T.typography.fontSize.sm,color:I,lineHeight:T.typography.lineHeight.tight}}>
99
+ {M(C.text)}
100
+ </tt.Text>}
101
+ </tt.View>},Vt=va;var ct=require("react"),Se=require("react-native");var{width:gs,height:qs}=Se.Dimensions.get("window"),Pa=({imageData:C,isMe:S,onImagePress:T,onLongPress:M})=>{let R=q(),[A,I]=(0,ct.useState)(!1),[P,V]=(0,ct.useState)(!1),v=(0,ct.useCallback)(()=>{let O=gs*.6,j=300;if(!C.width||!C.height)return{width:O,height:j};let H=C.width/C.height,N=O,F=N/H;return F>j&&(F=j,N=F*H),{width:Math.round(N),height:Math.round(F)}},[C.width,C.height])(),B=(0,ct.useCallback)(()=>{T?T():I(!0)},[T]),k=(0,ct.useCallback)(()=>{console.error("Failed to load image:",C.uri),V(!0)},[C.uri]),z=(0,ct.useCallback)(()=>{I(!1)},[]),L=(0,ct.useCallback)(()=>{if(!C.width||!C.height)return{width:gs,height:qs*.8};let O=C.width/C.height,j=gs*.9,H=qs*.8,N=j,F=N/O;return F>H&&(F=H,N=F*O),{width:Math.round(N),height:Math.round(F)}},[C.width,C.height])();return P?<Se.View style={[ht.errorContainer,{width:v.width,height:v.height,backgroundColor:S?R.colors.messageBubble.sent:R.colors.messageBubble.received,borderRadius:R.borderRadius.lg}]}>
102
+ <Se.Text style={[ht.errorText,{color:S?R.colors.messageBubble.sentText:R.colors.messageBubble.receivedText,fontSize:R.typography.fontSize.sm}]}>
103
103
  Failed to load image
104
- </Re.Text>
105
- </Re.View>:<>
106
- <Re.Pressable onPress={B}onLongPress={C}delayLongPress={500}>
107
- <Re.View style={[ht.imageContainer,{borderRadius:S.borderRadius.lg,overflow:"hidden"}]}>
108
- <Re.Image source={{uri:M.uri}}style={[ht.image,{width:v.width,height:v.height}]}resizeMode='cover'onError={k}/>
104
+ </Se.Text>
105
+ </Se.View>:<>
106
+ <Se.Pressable onPress={B}onLongPress={M}delayLongPress={500}>
107
+ <Se.View style={[ht.imageContainer,{borderRadius:R.borderRadius.lg,overflow:"hidden"}]}>
108
+ <Se.Image source={{uri:C.uri}}style={[ht.image,{width:v.width,height:v.height}]}resizeMode='cover'onError={k}/>
109
109
 
110
110
  {}
111
- <Re.View style={ht.imageOverlay}/>
112
- </Re.View>
113
- </Re.Pressable>
111
+ <Se.View style={ht.imageOverlay}/>
112
+ </Se.View>
113
+ </Se.Pressable>
114
114
 
115
115
  {}
116
- <Re.Modal visible={V}transparent animationType='fade'onRequestClose={A}>
117
- <Re.Pressable style={ht.modalContainer}onPress={A}>
118
- <Re.View style={ht.modalContent}>
119
- <Re.Image source={{uri:M.uri}}style={[ht.modalImage,{width:L.width,height:L.height,borderRadius:S.borderRadius.lg}]}resizeMode='contain'/>
120
- </Re.View>
121
- </Re.Pressable>
122
- </Re.Modal>
123
- </>},ht=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"}}),Vo=ya;var it=require("react-native"),Es=require("lucide-react-native");var xa=({isMe:M,timestamp:R,senderName:T})=>{let C=Y(),S=ke();return<it.View style={[Bt.container,{alignSelf:M?"flex-end":"flex-start",maxWidth:"80%"}]}>
124
- <it.View style={[Bt.messageBubble,{backgroundColor:C.colors.gray[100],borderColor:C.colors.gray[200]}]}>
125
- <it.View style={Bt.content}>
126
- <Es.Trash2 size={16}color={C.colors.gray[500]}/>
127
- <it.Text style={[Bt.deletedText,{color:C.colors.gray[500]}]}>
128
- {S("message.deleted")}
129
- </it.Text>
130
- </it.View>
131
- </it.View>
132
- <it.View style={[Bt.metadata,{alignSelf:M?"flex-end":"flex-start"}]}>
133
- <it.Text style={[Bt.timestamp,{color:C.colors.gray[400]}]}>
134
- {R}
135
- </it.Text>
136
- </it.View>
137
- </it.View>},Bt=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}}),Bo=xa;var ba=({message:M,onLongPress:R,onReactionPress:T})=>{let C=Y(),S=(0,Fs.useRef)(null),V=()=>{S.current?S.current.measureInWindow((D,E,v,B)=>{let k={x:Math.round(D),y:Math.round(E),width:Math.round(v),height:Math.round(B)};R?.(M,k)}):R?.(M)},I=()=>{M.reactions&&M.reactions.length>0&&T?.(M)},P=M.type==="image"&&M.imageData;return M.deleted?<Bo isMe={M.isMe}timestamp={Jt(M.timestamp)}senderName={M.senderName}/>:<Se.View style={{marginBottom:C.spacing.md,alignItems:M.isMe?"flex-end":"flex-start",marginHorizontal:C.spacing.sm}}>
138
- <Se.Pressable ref={S}onLongPress={V}delayLongPress={500}style={{maxWidth:P?"75%":"80%",borderRadius:P?C.borderRadius.lg:C.borderRadius.xl,borderBottomRightRadius:M.isMe?4:P?C.borderRadius.lg:C.borderRadius.xl,borderBottomLeftRadius:M.isMe?P?C.borderRadius.lg:C.borderRadius.xl:4,paddingHorizontal:P?0:C.spacing.lg,paddingVertical:P?0:C.spacing.md,backgroundColor:P?"transparent":M.isMe?C.colors.messageBubble.sent:C.colors.messageBubble.received,overflow:"hidden"}}>
139
- {M.replyTo&&<Vt replyTo={M.replyTo}isMyMessage={M.isMe}/>}
116
+ <Se.Modal visible={A}transparent animationType='fade'onRequestClose={z}>
117
+ <Se.Pressable style={ht.modalContainer}onPress={z}>
118
+ <Se.View style={ht.modalContent}>
119
+ <Se.Image source={{uri:C.uri}}style={[ht.modalImage,{width:L.width,height:L.height,borderRadius:R.borderRadius.lg}]}resizeMode='contain'/>
120
+ </Se.View>
121
+ </Se.Pressable>
122
+ </Se.Modal>
123
+ </>},ht=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"}}),Uo=Pa;var lt=require("react-native"),Ys=require("lucide-react-native");var Aa=({isMe:C,timestamp:S,senderName:T})=>{let M=q(),R=ke();return<lt.View style={[Bt.container,{alignSelf:C?"flex-end":"flex-start",maxWidth:"80%"}]}>
124
+ <lt.View style={[Bt.messageBubble,{backgroundColor:M.colors.gray[100],borderColor:M.colors.gray[200]}]}>
125
+ <lt.View style={Bt.content}>
126
+ <Ys.Trash2 size={16}color={M.colors.gray[500]}/>
127
+ <lt.Text style={[Bt.deletedText,{color:M.colors.gray[500]}]}>
128
+ {R("message.deleted")}
129
+ </lt.Text>
130
+ </lt.View>
131
+ </lt.View>
132
+ <lt.View style={[Bt.metadata,{alignSelf:C?"flex-end":"flex-start"}]}>
133
+ <lt.Text style={[Bt.timestamp,{color:M.colors.gray[400]}]}>
134
+ {S}
135
+ </lt.Text>
136
+ </lt.View>
137
+ </lt.View>},Bt=lt.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}}),Ko=Aa;var za=({message:C,onLongPress:S,onReactionPress:T})=>{let M=q(),R=(0,_s.useRef)(null),A=()=>{R.current?R.current.measureInWindow((V,E,v,B)=>{let k={x:Math.round(V),y:Math.round(E),width:Math.round(v),height:Math.round(B)};S?.(C,k)}):S?.(C)},I=()=>{C.reactions&&C.reactions.length>0&&T?.(C)},P=C.type==="image"&&C.imageData;return C.deleted?<Ko isMe={C.isMe}timestamp={eo(C.timestamp)}senderName={C.senderName}/>:<Re.View style={{marginBottom:M.spacing.md,alignItems:C.isMe?"flex-end":"flex-start",marginHorizontal:M.spacing.sm}}>
138
+ <Re.Pressable ref={R}onLongPress={A}delayLongPress={500}style={{maxWidth:P?"75%":"80%",borderRadius:P?M.borderRadius.lg:M.borderRadius.xl,borderBottomRightRadius:C.isMe?4:P?M.borderRadius.lg:M.borderRadius.xl,borderBottomLeftRadius:C.isMe?P?M.borderRadius.lg:M.borderRadius.xl:4,paddingHorizontal:P?0:M.spacing.lg,paddingVertical:P?0:M.spacing.md,backgroundColor:P?"transparent":C.isMe?M.colors.messageBubble.sent:M.colors.messageBubble.received,overflow:"hidden"}}>
139
+ {C.replyTo&&<Vt replyTo={C.replyTo}isMyMessage={C.isMe}/>}
140
140
 
141
- {P?<Vo imageData={M.imageData}isMe={M.isMe}onLongPress={V}/>:<Se.Text style={{fontSize:C.typography.fontSize.base,color:M.isMe?C.colors.messageBubble.sentText:C.colors.messageBubble.receivedText}}>
142
- {M.text}
143
- </Se.Text>}
141
+ {P?<Uo imageData={C.imageData}isMe={C.isMe}onLongPress={A}/>:<Re.Text style={{fontSize:M.typography.fontSize.base,color:C.isMe?M.colors.messageBubble.sentText:M.colors.messageBubble.receivedText}}>
142
+ {C.text}
143
+ </Re.Text>}
144
144
 
145
145
  {}
146
- {P&&M.text&&M.text.trim()&&<Se.View style={{paddingHorizontal:C.spacing.lg,paddingVertical:C.spacing.md,backgroundColor:M.isMe?C.colors.messageBubble.sent:C.colors.messageBubble.received,borderRadius:C.borderRadius.lg,marginTop:C.spacing.xs}}>
147
- <Se.Text style={{fontSize:C.typography.fontSize.base,color:M.isMe?C.colors.messageBubble.sentText:C.colors.messageBubble.receivedText}}>
148
- {M.text}
149
- </Se.Text>
150
- </Se.View>}
151
- </Se.Pressable>
146
+ {P&&C.text&&C.text.trim()&&<Re.View style={{paddingHorizontal:M.spacing.lg,paddingVertical:M.spacing.md,backgroundColor:C.isMe?M.colors.messageBubble.sent:M.colors.messageBubble.received,borderRadius:M.borderRadius.lg,marginTop:M.spacing.xs}}>
147
+ <Re.Text style={{fontSize:M.typography.fontSize.base,color:C.isMe?M.colors.messageBubble.sentText:M.colors.messageBubble.receivedText}}>
148
+ {C.text}
149
+ </Re.Text>
150
+ </Re.View>}
151
+ </Re.Pressable>
152
152
 
153
153
  {}
154
- {M.reactions&&M.reactions.length>0&&<Se.TouchableOpacity onPress={I}style={{marginTop:C.spacing.xs,flexDirection:"row",alignItems:"center",backgroundColor:C.colors.background,borderRadius:C.borderRadius.full,justifyContent:M.isMe?"flex-end":"flex-start"}}>
155
- {M.reactions.map((D,E)=><Se.View key={`${D.emoji}-${E}`}style={{flexDirection:"row",alignItems:"center",padding:C.spacing.xs}}>
156
- <Se.Text style={{fontSize:C.typography.fontSize.sm}}>
157
- {D.emoji}
158
- </Se.Text>
159
- {D.count>1&&<Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.textSecondary,marginLeft:C.spacing.xs,fontWeight:C.typography.fontWeight.medium}}>
160
- {D.count}
161
- </Se.Text>}
162
- </Se.View>)}
163
- </Se.TouchableOpacity>}
154
+ {C.reactions&&C.reactions.length>0&&<Re.TouchableOpacity onPress={I}style={{marginTop:M.spacing.xs,flexDirection:"row",alignItems:"center",backgroundColor:M.colors.background,borderRadius:M.borderRadius.full,justifyContent:C.isMe?"flex-end":"flex-start"}}>
155
+ {C.reactions.map((V,E)=><Re.View key={`${V.emoji}-${E}`}style={{flexDirection:"row",alignItems:"center",padding:M.spacing.xs}}>
156
+ <Re.Text style={{fontSize:M.typography.fontSize.sm}}>
157
+ {V.emoji}
158
+ </Re.Text>
159
+ {V.count>1&&<Re.Text style={{fontSize:M.typography.fontSize.xs,color:M.colors.textSecondary,marginLeft:M.spacing.xs,fontWeight:M.typography.fontWeight.medium}}>
160
+ {V.count}
161
+ </Re.Text>}
162
+ </Re.View>)}
163
+ </Re.TouchableOpacity>}
164
164
 
165
- <Se.View style={{marginHorizontal:C.spacing.sm,marginTop:C.spacing.xs,flexDirection:"row",alignItems:"center",justifyContent:M.isMe?"flex-end":"flex-start"}}>
166
- <Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.textSecondary}}>
167
- {Jt(M.timestamp)}
168
- </Se.Text>
169
- {M.isMe&&M.status&&<Se.View style={{marginLeft:C.spacing.xs}}>
170
- {M.status==="sent"&&<Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.gray[400]}}>
165
+ <Re.View style={{marginHorizontal:M.spacing.sm,marginTop:M.spacing.xs,flexDirection:"row",alignItems:"center",justifyContent:C.isMe?"flex-end":"flex-start"}}>
166
+ <Re.Text style={{fontSize:M.typography.fontSize.xs,color:M.colors.textSecondary}}>
167
+ {eo(C.timestamp)}
168
+ </Re.Text>
169
+ {C.isMe&&C.status&&<Re.View style={{marginLeft:M.spacing.xs}}>
170
+ {C.status==="sent"&&<Re.Text style={{fontSize:M.typography.fontSize.xs,color:M.colors.gray[400]}}>
171
171
 
172
- </Se.Text>}
173
- {M.status==="delivered"&&<Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.gray[400]}}>
172
+ </Re.Text>}
173
+ {C.status==="delivered"&&<Re.Text style={{fontSize:M.typography.fontSize.xs,color:M.colors.gray[400]}}>
174
174
  ✓✓
175
- </Se.Text>}
176
- {M.status==="read"&&<Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.primary}}>
175
+ </Re.Text>}
176
+ {C.status==="read"&&<Re.Text style={{fontSize:M.typography.fontSize.xs,color:M.colors.primary}}>
177
177
  ✓✓
178
- </Se.Text>}
179
- </Se.View>}
180
- </Se.View>
181
- </Se.View>},Do=ba;var Z=require("react-native"),Os=require("lucide-react-native");var Ma=({replyToMessage:M,onCancel:R})=>{let T=Y(),C=(I,P=50)=>I.length<=P?I:I.substring(0,P)+"...",S=!!M.replyTo,V=M.type==="image"&&M.imageData;return<Z.View style={{borderBottomWidth:1,borderBottomColor:T.colors.border,backgroundColor:T.colors.surface,paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.md}}>
178
+ </Re.Text>}
179
+ </Re.View>}
180
+ </Re.View>
181
+ </Re.View>},$o=za;var Z=require("react-native"),Gs=require("lucide-react-native");var Da=({replyToMessage:C,onCancel:S})=>{let T=q(),M=(I,P=50)=>I.length<=P?I:I.substring(0,P)+"...",R=!!C.replyTo,A=C.type==="image"&&C.imageData;return<Z.View style={{borderBottomWidth:1,borderBottomColor:T.colors.border,backgroundColor:T.colors.surface,paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.md}}>
182
182
  <Z.View style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between"}}>
183
183
  <Z.View style={{flex:1,marginRight:T.spacing.md}}>
184
184
  <Z.View style={{flexDirection:"row",alignItems:"center",marginBottom:T.spacing.xs}}>
185
- <Z.View style={{width:4,backgroundColor:T.colors.primary,borderRadius:T.borderRadius.full,marginRight:T.spacing.md,height:S?48:32}}/>
185
+ <Z.View style={{width:4,backgroundColor:T.colors.primary,borderRadius:T.borderRadius.full,marginRight:T.spacing.md,height:R?48:32}}/>
186
186
  <Z.View style={{flex:1}}>
187
187
  <Z.Text style={{fontSize:T.typography.fontSize.xs,fontWeight:T.typography.fontWeight.medium,color:T.colors.primary,marginBottom:T.spacing.xs}}>
188
- Replying to {M.isMe?"yourself":M.senderName||"sender"}
189
- {S&&" (reply thread)"}
188
+ Replying to {C.isMe?"yourself":C.senderName||"sender"}
189
+ {R&&" (reply thread)"}
190
190
  </Z.Text>
191
191
 
192
192
  {}
193
- {S&&<Z.View style={{marginBottom:T.spacing.sm,padding:T.spacing.sm,backgroundColor:T.colors.surfaceSecondary,borderRadius:T.borderRadius.md,borderLeftWidth:2,borderLeftColor:T.colors.gray[300]}}>
193
+ {R&&<Z.View style={{marginBottom:T.spacing.sm,padding:T.spacing.sm,backgroundColor:T.colors.surfaceSecondary,borderRadius:T.borderRadius.md,borderLeftWidth:2,borderLeftColor:T.colors.gray[300]}}>
194
194
  <Z.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.textSecondary,marginBottom:T.spacing.xs}}>
195
- Originally replying to: {M.replyTo.isMe?"yourself":M.replyTo.senderName||"sender"}
195
+ Originally replying to: {C.replyTo.isMe?"yourself":C.replyTo.senderName||"sender"}
196
196
  </Z.Text>
197
197
  <Z.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.textSecondary,lineHeight:T.typography.lineHeight.tight}}>
198
- {C(M.replyTo.text,40)}
198
+ {M(C.replyTo.text,40)}
199
199
  </Z.Text>
200
200
  </Z.View>}
201
201
 
202
- {V?<Z.View style={{flexDirection:"row",alignItems:"center"}}>
203
- <Z.Image source={{uri:M.imageData.uri}}style={{width:32,height:32,borderRadius:T.borderRadius.sm,marginRight:T.spacing.sm}}resizeMode="cover"/>
202
+ {A?<Z.View style={{flexDirection:"row",alignItems:"center"}}>
203
+ <Z.Image source={{uri:C.imageData.uri}}style={{width:32,height:32,borderRadius:T.borderRadius.sm,marginRight:T.spacing.sm}}resizeMode="cover"/>
204
204
  <Z.View style={{flex:1}}>
205
205
  <Z.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.gray[600],fontStyle:"italic",marginBottom:T.spacing.xs}}>
206
206
  📷 Image
207
207
  </Z.Text>
208
- {M.text&&M.text.trim()&&<Z.Text style={{fontSize:T.typography.fontSize.sm,color:T.colors.gray[700],lineHeight:T.typography.lineHeight.tight}}>
209
- {C(M.text,40)}
208
+ {C.text&&C.text.trim()&&<Z.Text style={{fontSize:T.typography.fontSize.sm,color:T.colors.gray[700],lineHeight:T.typography.lineHeight.tight}}>
209
+ {M(C.text,40)}
210
210
  </Z.Text>}
211
211
  </Z.View>
212
212
  </Z.View>:<Z.Text style={{fontSize:T.typography.fontSize.sm,color:T.colors.gray[700],lineHeight:T.typography.lineHeight.tight}}>
213
- {C(M.text)}
213
+ {M(C.text)}
214
214
  </Z.Text>}
215
215
  </Z.View>
216
216
  </Z.View>
217
217
  </Z.View>
218
218
 
219
- <Z.TouchableOpacity onPress={R}style={{height:32,width:32,alignItems:"center",justifyContent:"center",borderRadius:T.borderRadius.full,backgroundColor:T.colors.gray[200]}}hitSlop={{top:8,bottom:8,left:8,right:8}}>
220
- <Os.X size={16}color={T.colors.textSecondary}/>
219
+ <Z.TouchableOpacity onPress={S}style={{height:32,width:32,alignItems:"center",justifyContent:"center",borderRadius:T.borderRadius.full,backgroundColor:T.colors.gray[200]}}hitSlop={{top:8,bottom:8,left:8,right:8}}>
220
+ <Gs.X size={16}color={T.colors.textSecondary}/>
221
221
  </Z.TouchableOpacity>
222
222
  </Z.View>
223
- </Z.View>},Xt=Ma;var Be=require("react"),W=require("react-native"),ft=require("lucide-react-native");var ko=require("react"),Hs=$(require("rn-emoji-keyboard")),Ta=({visible:M,onClose:R,onEmojiSelected:T})=>{let[C,S]=(0,ko.useState)(!1);(0,ko.useEffect)(()=>{S(!!M)},[M]);let V=P=>{console.log("Selected emoji:",P),T(P.emoji),S(!1),R()},I=()=>{S(!1),R()};return M?<Hs.default onEmojiSelected={V}open={C}onClose={I}enableSearchBar/>:null},Dt=Ta;var Ca=({visible:M,onPress:R,children:T})=>M?<W.View style={Ve.overlay}>
224
- <W.TouchableOpacity style={Ve.backdrop}onPress={R}activeOpacity={1}/>
223
+ </Z.View>},Co=Da;var Ve=require("react"),W=require("react-native"),ft=require("lucide-react-native");var qo=require("react"),Js=Y(require("rn-emoji-keyboard")),Va=({visible:C,onClose:S,onEmojiSelected:T})=>{let[M,R]=(0,qo.useState)(!1);(0,qo.useEffect)(()=>{R(!!C)},[C]);let A=P=>{console.log("Selected emoji:",P),T(P.emoji),R(!1),S()},I=()=>{R(!1),S()};return C?<Js.default onEmojiSelected={A}open={M}onClose={I}enableSearchBar/>:null},Lt=Va;var Ba=({visible:C,onPress:S,children:T})=>C?<W.View style={De.overlay}>
224
+ <W.TouchableOpacity style={De.backdrop}onPress={S}activeOpacity={1}/>
225
225
  {T}
226
- </W.View>:null,{width:kt,height:as}=W.Dimensions.get("window"),Ra=({message:M,positions:R,messagePosition:T,containerRef:C,containerOffset:S,setContainerOffset:V})=>{let I=Y(),P=(0,Be.useRef)(new W.Animated.Value(T.y)).current,D=(0,Be.useRef)(new W.Animated.Value(0)).current,E=(0,Be.useRef)(!1),v=M.type==="image"&&M.imageData;return(0,Be.useEffect)(()=>{E.current=!1,C.current&&C.current.measureInWindow((B,k,A,z)=>{V({x:B,y:k});let L=T.y-k,O=R.messagePreviewTop-k;P.setValue(L),D.setValue(0),requestAnimationFrame(()=>{W.Animated.parallel([W.Animated.timing(P,{toValue:O,duration:250,useNativeDriver:!1}),W.Animated.timing(D,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{E.current=!0})})})},[R.messagePreviewTop,T.y,C]),<W.Animated.View style={{position:"absolute",top:P,left:T.x,width:T.width,height:M.replyTo?T.height+10:T.height,zIndex:1e3,opacity:D,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"}}>
227
- {M.replyTo&&<Vt replyTo={M.replyTo}isMyMessage={M.isMe}/>}
226
+ </W.View>:null,{width:jt,height:hs}=W.Dimensions.get("window"),La=({message:C,positions:S,messagePosition:T,containerRef:M,containerOffset:R,setContainerOffset:A})=>{let I=q(),P=(0,Ve.useRef)(new W.Animated.Value(T.y)).current,V=(0,Ve.useRef)(new W.Animated.Value(0)).current,E=(0,Ve.useRef)(!1),v=C.type==="image"&&C.imageData;return(0,Ve.useEffect)(()=>{E.current=!1,M.current&&M.current.measureInWindow((B,k,z,D)=>{A({x:B,y:k});let L=T.y-k,O=S.messagePreviewTop-k;P.setValue(L),V.setValue(0),requestAnimationFrame(()=>{W.Animated.parallel([W.Animated.timing(P,{toValue:O,duration:250,useNativeDriver:!1}),W.Animated.timing(V,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{E.current=!0})})})},[S.messagePreviewTop,T.y,M]),<W.Animated.View style={{position:"absolute",top:P,left:T.x,width:T.width,height:C.replyTo?T.height+10:T.height,zIndex:1e3,opacity:V,maxWidth:v?"75%":"80%",borderRadius:v?I.borderRadius.lg:I.borderRadius.xl,paddingHorizontal:v?0:I.spacing.lg,paddingVertical:v?0:I.spacing.md,backgroundColor:v?"transparent":C.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,overflow:"hidden"}}>
227
+ {C.replyTo&&<Vt replyTo={C.replyTo}isMyMessage={C.isMe}/>}
228
228
 
229
229
  {v?<W.View>
230
- <W.Image source={{uri:M.imageData.uri}}style={{width:T.width,height:T.height,borderRadius:I.borderRadius.lg}}resizeMode='cover'/>
230
+ <W.Image source={{uri:C.imageData.uri}}style={{width:T.width,height:T.height,borderRadius:I.borderRadius.lg}}resizeMode='cover'/>
231
231
  {}
232
- {M.text&&M.text.trim()&&<W.View style={{paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,backgroundColor:M.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,borderRadius:I.borderRadius.lg,marginTop:I.spacing.xs}}>
233
- <W.Text style={{fontSize:I.typography.fontSize.base,color:M.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
234
- {M.text}
232
+ {C.text&&C.text.trim()&&<W.View style={{paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,backgroundColor:C.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,borderRadius:I.borderRadius.lg,marginTop:I.spacing.xs}}>
233
+ <W.Text style={{fontSize:I.typography.fontSize.base,color:C.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
234
+ {C.text}
235
235
  </W.Text>
236
236
  </W.View>}
237
- </W.View>:<W.Text style={{fontSize:I.typography.fontSize.base,color:M.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
238
- {M.text}
237
+ </W.View>:<W.Text style={{fontSize:I.typography.fontSize.base,color:C.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
238
+ {C.text}
239
239
  </W.Text>}
240
- </W.Animated.View>},Sa=({visible:M,onClose:R,isMyMessage:T,selectedMessage:C,messagePosition:S,onActionPress:V,onEmojiReact:I})=>{let P=ke(),[D,E]=(0,Be.useState)(!1),v=(0,Be.useRef)(null),[B,k]=(0,Be.useState)({x:0,y:0}),A=(0,Be.useRef)(new W.Animated.Value(0)).current,z=(0,Be.useRef)(new W.Animated.Value(0)).current,L=(0,Be.useRef)(!1),O=(0,Be.useRef)(!1),j=Te=>{V(Te),R()},H=Te=>{I?.(Te),R()},N=()=>{E(!0)},F=()=>{E(!1)},te=Te=>{I?.(Te),E(!1),R()},je=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],Ee=(()=>{if(!S)return{emojiBar:{top:as/2-200,left:kt/2-160},actionMenu:{top:as/2+50,left:kt/2-100}};let Te=320,De=60,Ae=200,Ye=160,U=20,$e=8,Fe,Tt,Ce,Ge,Xe,we=as/2,It=De+$e+S.height+$e+Ye,Ct=we-It/2;return Tt=Ct,Xe=Ct+De+$e,Ge=Ct+De+$e+S.height+$e,Fe=S.x,Ce=S.x,Fe+Te>kt-U&&(Fe=kt-Te-U),Fe<U&&(Fe=U),Ce+Ae>kt-U&&(Ce=kt-Ae-U),Ce<U&&(Ce=U),{emojiBar:{top:Tt,left:Fe},actionMenu:{top:Ge,left:Ce},messagePreviewTop:Xe,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return(0,Be.useEffect)(()=>{M&&S&&!O.current&&(A.setValue(0),z.setValue(0),setTimeout(()=>{W.Animated.sequence([W.Animated.timing(A,{toValue:1,duration:200,useNativeDriver:!1}),W.Animated.timing(z,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{O.current=!0})},50))},[M,S,A,z]),(0,Be.useEffect)(()=>{M||(L.current=!1,O.current=!1,A.setValue(0),z.setValue(0))},[M,A,z]),M?<>
240
+ </W.Animated.View>},ja=({visible:C,onClose:S,isMyMessage:T,selectedMessage:M,messagePosition:R,onActionPress:A,onEmojiReact:I})=>{let P=ke(),[V,E]=(0,Ve.useState)(!1),v=(0,Ve.useRef)(null),[B,k]=(0,Ve.useState)({x:0,y:0}),z=(0,Ve.useRef)(new W.Animated.Value(0)).current,D=(0,Ve.useRef)(new W.Animated.Value(0)).current,L=(0,Ve.useRef)(!1),O=(0,Ve.useRef)(!1),j=Te=>{A(Te),S()},H=Te=>{I?.(Te),S()},N=()=>{E(!0)},F=()=>{E(!1)},te=Te=>{I?.(Te),E(!1),S()},je=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],Ee=(()=>{if(!R)return{emojiBar:{top:hs/2-200,left:jt/2-160},actionMenu:{top:hs/2+50,left:jt/2-100}};let Te=320,Be=60,Ae=200,qe=160,U=20,Ye=8,Fe,Mt,Me,_e,Ze,we=hs/2,Pt=Be+Ye+R.height+Ye+qe,St=we-Pt/2;return Mt=St,Ze=St+Be+Ye,_e=St+Be+Ye+R.height+Ye,Fe=R.x,Me=R.x,Fe+Te>jt-U&&(Fe=jt-Te-U),Fe<U&&(Fe=U),Me+Ae>jt-U&&(Me=jt-Ae-U),Me<U&&(Me=U),{emojiBar:{top:Mt,left:Fe},actionMenu:{top:_e,left:Me},messagePreviewTop:Ze,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return(0,Ve.useEffect)(()=>{C&&R&&!O.current&&(z.setValue(0),D.setValue(0),setTimeout(()=>{W.Animated.sequence([W.Animated.timing(z,{toValue:1,duration:200,useNativeDriver:!1}),W.Animated.timing(D,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{O.current=!0})},50))},[C,R,z,D]),(0,Ve.useEffect)(()=>{C||(L.current=!1,O.current=!1,z.setValue(0),D.setValue(0))},[C,z,D]),C?<>
241
241
  {}
242
- <Ca visible={!0}onPress={R}>
243
- <W.Pressable style={Ve.overlayPressable}onPress={R}/>
244
- </Ca>
242
+ <Ba visible={!0}onPress={S}>
243
+ <W.Pressable style={De.overlayPressable}onPress={S}/>
244
+ </Ba>
245
245
 
246
246
  <W.View ref={v}style={{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}>
247
247
  {}
248
248
  </W.View>
249
249
 
250
250
  {}
251
- {S&&C&&<Ra message={C}positions={Ee}messagePosition={S}containerRef={v}containerOffset={B}setContainerOffset={k}/>}
251
+ {R&&M&&<La message={M}positions={Ee}messagePosition={R}containerRef={v}containerOffset={B}setContainerOffset={k}/>}
252
252
 
253
253
  {}
254
- <W.Animated.View style={[Ve.emojiBar,{position:"absolute",top:Ee.emojiBar.top-(B.y||0),left:Ee.emojiBar.left,opacity:A,pointerEvents:"auto"}]}>
255
- <W.ScrollView horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={Ve.emojiContainer}>
256
- {je.map((Te,De)=><W.TouchableOpacity key={De}style={Ve.emojiButton}onPress={()=>H(Te)}>
257
- <W.Text style={Ve.emojiText}>{Te}</W.Text>
254
+ <W.Animated.View style={[De.emojiBar,{position:"absolute",top:Ee.emojiBar.top-(B.y||0),left:Ee.emojiBar.left,opacity:z,pointerEvents:"auto"}]}>
255
+ <W.ScrollView horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={De.emojiContainer}>
256
+ {je.map((Te,Be)=><W.TouchableOpacity key={Be}style={De.emojiButton}onPress={()=>H(Te)}>
257
+ <W.Text style={De.emojiText}>{Te}</W.Text>
258
258
  </W.TouchableOpacity>)}
259
- <W.TouchableOpacity style={Ve.addEmojiButton}onPress={N}>
259
+ <W.TouchableOpacity style={De.addEmojiButton}onPress={N}>
260
260
  <ft.Plus size={20}color='#666'/>
261
261
  </W.TouchableOpacity>
262
262
  </W.ScrollView>
263
263
  </W.Animated.View>
264
264
 
265
265
  {}
266
- <W.Animated.View style={[Ve.actionMenu,{position:"absolute",top:Ee.actionMenu.top-(B.y||0)+(C?.replyTo?10:0),left:Ee.actionMenu.left,opacity:z,pointerEvents:"auto"}]}>
267
- <W.View style={Ve.actionItems}>
266
+ <W.Animated.View style={[De.actionMenu,{position:"absolute",top:Ee.actionMenu.top-(B.y||0)+(M?.replyTo?10:0),left:Ee.actionMenu.left,opacity:D,pointerEvents:"auto"}]}>
267
+ <W.View style={De.actionItems}>
268
268
  {}
269
- <W.TouchableOpacity style={Ve.actionRow}onPress={()=>j("reply")}>
269
+ <W.TouchableOpacity style={De.actionRow}onPress={()=>j("reply")}>
270
270
  <ft.Reply size={18}color='#333'/>
271
- <W.Text style={Ve.actionLabel}>{P("action.reply")}</W.Text>
271
+ <W.Text style={De.actionLabel}>{P("action.reply")}</W.Text>
272
272
  </W.TouchableOpacity>
273
273
 
274
274
  {}
275
- <W.TouchableOpacity style={Ve.actionRow}onPress={()=>j("copy")}>
275
+ <W.TouchableOpacity style={De.actionRow}onPress={()=>j("copy")}>
276
276
  <ft.Copy size={18}color='#333'/>
277
- <W.Text style={Ve.actionLabel}>{P("action.copy")}</W.Text>
277
+ <W.Text style={De.actionLabel}>{P("action.copy")}</W.Text>
278
278
  </W.TouchableOpacity>
279
279
 
280
280
  {}
281
- {T&&<W.TouchableOpacity style={Ve.actionRow}onPress={()=>j("delete")}>
281
+ {T&&<W.TouchableOpacity style={De.actionRow}onPress={()=>j("delete")}>
282
282
  <ft.Trash2 size={18}color='#ff4444'/>
283
- <W.Text style={[Ve.actionLabel,{color:"#ff4444"}]}>
283
+ <W.Text style={[De.actionLabel,{color:"#ff4444"}]}>
284
284
  {P("action.delete")}
285
285
  </W.Text>
286
286
  </W.TouchableOpacity>}
@@ -288,9 +288,9 @@ await initChat({ projectId: 'your-project-id' });`)},Ts=()=>(vt(),lt.projectId),
288
288
  </W.Animated.View>
289
289
 
290
290
  {}
291
- <Dt visible={D}onClose={F}onEmojiSelected={te}/>
292
- </>: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)"}}),Lo=Sa;var Lt=require("react"),J=require("react-native"),Ns=$(require("react-native-actions-sheet"));var wa=({visible:M,onClose:R,reactions:T,messageText:C,onAddReaction:S,onRemoveReaction:V})=>{let I=(0,Lt.useRef)(null),[P,D]=(0,Lt.useState)(!1);(0,Lt.useEffect)(()=>{M?I.current?.show():I.current?.hide()},[M]);let v=(()=>{let j=[];return T.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 F=0;F<Math.min(H.count,N.length);F++)j.push({id:`${H.emoji}-${F}`,name:N[F].name,avatar:N[F].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),j})(),B=T.reduce((j,H)=>j+H.count,0),k=j=>{console.log("Remove reaction called with:",j),console.log("onRemoveReaction prop exists:",!!V),console.log("User is current user:",j.name==="You"),j.name==="You"&&V?(console.log("Calling onRemoveReaction with emoji:",j.emoji),V(j.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:j.name==="You",hasCallback:!!V})},A=()=>{I.current?.hide(),R(),setTimeout(()=>{D(!0)},300)},z=()=>{D(!1)},L=j=>{console.log("Selected emoji from picker:",j),S?.(j),D(!1),R()},O=()=>{I.current?.hide(),R()};return<>
293
- <Ns.default ref={I}onClose={O}containerStyle={Q.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
291
+ <Lt visible={V}onClose={F}onEmojiSelected={te}/>
292
+ </>:null},De=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)"}}),Yo=ja;var Et=require("react"),J=require("react-native"),Xs=Y(require("react-native-actions-sheet"));var Ea=({visible:C,onClose:S,reactions:T,messageText:M,onAddReaction:R,onRemoveReaction:A})=>{let I=(0,Et.useRef)(null),[P,V]=(0,Et.useState)(!1);(0,Et.useEffect)(()=>{C?I.current?.show():I.current?.hide()},[C]);let v=(()=>{let j=[];return T.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 F=0;F<Math.min(H.count,N.length);F++)j.push({id:`${H.emoji}-${F}`,name:N[F].name,avatar:N[F].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),j})(),B=T.reduce((j,H)=>j+H.count,0),k=j=>{console.log("Remove reaction called with:",j),console.log("onRemoveReaction prop exists:",!!A),console.log("User is current user:",j.name==="You"),j.name==="You"&&A?(console.log("Calling onRemoveReaction with emoji:",j.emoji),A(j.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:j.name==="You",hasCallback:!!A})},z=()=>{I.current?.hide(),S(),setTimeout(()=>{V(!0)},300)},D=()=>{V(!1)},L=j=>{console.log("Selected emoji from picker:",j),R?.(j),V(!1),S()},O=()=>{I.current?.hide(),S()};return<>
293
+ <Xs.default ref={I}onClose={O}containerStyle={Q.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
294
294
  {}
295
295
  <J.View style={Q.header}>
296
296
  <J.Text style={Q.title}>{B} reactions</J.Text>
@@ -302,7 +302,7 @@ await initChat({ projectId: 'your-project-id' });`)},Ts=()=>(vt(),lt.projectId),
302
302
  {}
303
303
  <J.View style={Q.messagePreview}>
304
304
  <J.Text style={Q.messageText}numberOfLines={2}>
305
- {C}
305
+ {M}
306
306
  </J.Text>
307
307
  </J.View>
308
308
 
@@ -331,133 +331,136 @@ await initChat({ projectId: 'your-project-id' });`)},Ts=()=>(vt(),lt.projectId),
331
331
  </J.View>
332
332
  </N>})}
333
333
  </J.ScrollView>
334
- </Ns.default>
334
+ </Xs.default>
335
335
 
336
336
  {}
337
- <Dt visible={P}onClose={z}onEmojiSelected={L}/>
338
- </>},Q=J.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=wa;var jt=$(require("react")),tt=require("react-native"),Ws=$(require("react-native-actions-sheet")),Us=require("lucide-react-native"),St=(0,jt.forwardRef)(({onOptionSelect:M,options:R},T)=>{let C=jt.default.useRef(null);(0,jt.useImperativeHandle)(T,()=>({show:()=>C.current?.show(),hide:()=>C.current?.hide()}));let S=V=>{M(V),C.current?.hide()};return<Ws.default ref={C}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
339
- <tt.View style={{padding:20,width:"100%"}}>
337
+ <Lt visible={P}onClose={D}onEmojiSelected={L}/>
338
+ </>},Q=J.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}}),_o=Ea;var Ft=Y(require("react")),ot=require("react-native"),Zs=Y(require("react-native-actions-sheet")),Qs=require("lucide-react-native"),It=(0,Ft.forwardRef)(({onOptionSelect:C,options:S},T)=>{let M=Ft.default.useRef(null);(0,Ft.useImperativeHandle)(T,()=>({show:()=>M.current?.show(),hide:()=>M.current?.hide()}));let R=A=>{C(A),M.current?.hide()};return<Zs.default ref={M}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
339
+ <ot.View style={{padding:20,width:"100%"}}>
340
340
 
341
341
  {}
342
- <tt.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:20}}>
343
- <tt.Text style={{fontSize:18,fontWeight:"600",color:"#1F2937"}}>
342
+ <ot.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:20}}>
343
+ <ot.Text style={{fontSize:18,fontWeight:"600",color:"#1F2937"}}>
344
344
  Share Content
345
- </tt.Text>
346
- <tt.TouchableOpacity onPress={()=>C.current?.hide()}>
347
- <Us.X size={24}color="#6B7280"/>
348
- </tt.TouchableOpacity>
349
- </tt.View>
345
+ </ot.Text>
346
+ <ot.TouchableOpacity onPress={()=>M.current?.hide()}>
347
+ <Qs.X size={24}color="#6B7280"/>
348
+ </ot.TouchableOpacity>
349
+ </ot.View>
350
350
 
351
351
  {}
352
- <tt.View style={{flexDirection:"row",flexWrap:"wrap",justifyContent:"space-between",paddingBottom:20}}>
353
- {R.map(V=>{let I=V.icon;return<tt.TouchableOpacity key={V.id}style={{width:"30%",aspectRatio:1,marginBottom:20,alignItems:"center",justifyContent:"center"}}onPress={()=>S(V.id)}>
354
- <tt.View style={{width:60,height:60,borderRadius:30,backgroundColor:"#F3F4F6",alignItems:"center",justifyContent:"center",marginBottom:8}}>
355
- <I size={24}color={V.color}/>
356
- </tt.View>
357
- <tt.Text style={{fontSize:12,color:"#6B7280",textAlign:"center",fontWeight:"500"}}>
358
- {V.label}
359
- </tt.Text>
360
- </tt.TouchableOpacity>})}
361
- </tt.View>
362
- </tt.View>
363
- </Ws.default>});St.displayName="AttachmentMenu";var Fo=require("react"),Le=require("react-native"),Ia=({isVisible:M})=>{let R=(0,Fo.useRef)(new Le.Animated.Value(0)).current;return(0,Fo.useEffect)(()=>{if(!M){R.setValue(0);return}let T=Le.Animated.loop(Le.Animated.sequence([Le.Animated.timing(R,{toValue:1,duration:1200,useNativeDriver:!0}),Le.Animated.timing(R,{toValue:0,duration:1200,useNativeDriver:!0})]));return T.start(),()=>{T.stop()}},[M,R]),M?<Le.View style={Et.container}>
364
- <Le.View style={Et.bubble}>
365
- <Le.View style={Et.dotsContainer}>
366
- <Le.Animated.View style={[Et.dot,{opacity:R.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
367
- <Le.Animated.View style={[Et.dot,{opacity:R.interpolate({inputRange:[.33,.83,1.33],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[.33,.83,1.33],outputRange:[0,-4,0]})}]}]}/>
368
- <Le.Animated.View style={[Et.dot,{opacity:R.interpolate({inputRange:[.66,1.16,1.66],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[.66,1.16,1.66],outputRange:[0,-4,0]})}]}]}/>
352
+ <ot.View style={{flexDirection:"row",flexWrap:"wrap",justifyContent:"space-between",paddingBottom:20}}>
353
+ {S.map(A=>{let I=A.icon;return<ot.TouchableOpacity key={A.id}style={{width:"30%",aspectRatio:1,marginBottom:20,alignItems:"center",justifyContent:"center"}}onPress={()=>R(A.id)}>
354
+ <ot.View style={{width:60,height:60,borderRadius:30,backgroundColor:"#F3F4F6",alignItems:"center",justifyContent:"center",marginBottom:8}}>
355
+ <I size={24}color={A.color}/>
356
+ </ot.View>
357
+ <ot.Text style={{fontSize:12,color:"#6B7280",textAlign:"center",fontWeight:"500"}}>
358
+ {A.label}
359
+ </ot.Text>
360
+ </ot.TouchableOpacity>})}
361
+ </ot.View>
362
+ </ot.View>
363
+ </Zs.default>});It.displayName="AttachmentMenu";var Go=require("react"),Le=require("react-native"),Fa=({isVisible:C})=>{let S=(0,Go.useRef)(new Le.Animated.Value(0)).current;return(0,Go.useEffect)(()=>{if(!C){S.setValue(0);return}let T=Le.Animated.loop(Le.Animated.sequence([Le.Animated.timing(S,{toValue:1,duration:1200,useNativeDriver:!0}),Le.Animated.timing(S,{toValue:0,duration:1200,useNativeDriver:!0})]));return T.start(),()=>{T.stop()}},[C,S]),C?<Le.View style={Ot.container}>
364
+ <Le.View style={Ot.bubble}>
365
+ <Le.View style={Ot.dotsContainer}>
366
+ <Le.Animated.View style={[Ot.dot,{opacity:S.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:S.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
367
+ <Le.Animated.View style={[Ot.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]})}]}]}/>
368
+ <Le.Animated.View style={[Ot.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]})}]}]}/>
369
369
  </Le.View>
370
370
  </Le.View>
371
- </Le.View>:null},Et=Le.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}}),Ft=Ia;var Oo=$(require("react")),Ot=require("react-native"),Ks=require("lucide-react-native");var va=({visible:M,onPress:R,isReplyActive:T=!1})=>{let C=Y(),S=Oo.default.useRef(new Ot.Animated.Value(0)).current,[V,I]=Oo.default.useState(!1);return Oo.default.useEffect(()=>{Ot.Animated.timing(S,{toValue:M?1:0,duration:200,useNativeDriver:!0}).start(()=>{I(M)})},[M,S]),!M&&!V?null:<Ot.Pressable onPress={R}hitSlop={{top:10,bottom:10,left:10,right:10}}>
372
- {({pressed:P})=><Ot.Animated.View style={[{position:"absolute",bottom:40,right:C.spacing.lg,zIndex:9999,width:32,height:32,backgroundColor:C.colors.background,borderRadius:C.borderRadius.xl,justifyContent:"center",alignItems:"center",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:3.84,elevation:5,opacity:S,transform:P?[{scale:.95}]:[]}]}>
373
- <Ks.ChevronDown size={20}color={C.colors.text}/>
374
- </Ot.Animated.View>}
375
- </Ot.Pressable>},Ho=va;var Zt=require("react-native");var Pa=({displayDate:M})=>{let R=Y();return<Zt.View style={{marginVertical:R.spacing.lg,alignItems:"center"}}>
376
- <Zt.View style={{borderRadius:R.borderRadius.full,backgroundColor:R.colors.surfaceSecondary,paddingHorizontal:R.spacing.md,paddingVertical:R.spacing.xs}}>
377
- <Zt.Text style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,fontWeight:R.typography.fontWeight.medium}}>
378
- {M}
379
- </Zt.Text>
380
- </Zt.View>
381
- </Zt.View>},No=Pa;var We=$(require("react")),Je=require("react-native"),Ht=require("lucide-react-native");var ot=require("react"),ee=require("react-native"),Oe=require("lucide-react-native");var Aa={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},ns=async(M,R={})=>{try{let T;try{T=await import("expo-image-manipulator")}catch(B){console.log("expo-image-manipulator not available, returning original image info:",B);let A=`image_${Date.now()}.jpg`;return{uri:M,width:1920,height:1920,fileName:A}}let C={...Aa,...R};console.log("Starting image compression...",{uri:M,options:C});let S=await T.manipulateAsync(M,[],{});console.log("Original image info:",{width:S.width,height:S.height,uri:S.uri});let V=[];if(C.maxWidth||C.maxHeight){let{width:B,height:k}=S,A=B,z=k;if(C.maxWidth&&B>C.maxWidth){let L=C.maxWidth/B;A=C.maxWidth,z=k*L}if(C.maxHeight&&z>C.maxHeight){let L=C.maxHeight/z;z=C.maxHeight,A=A*L}(A!==B||z!==k)&&(V.push({resize:{width:Math.round(A),height:Math.round(z)}}),console.log("Resizing image:",{from:{width:B,height:k},to:{width:Math.round(A),height:Math.round(z)}}))}let I={compress:C.quality,format:C.format==="png"?T.SaveFormat?.PNG:T.SaveFormat?.JPEG};console.log("Applying compression with options:",I);let P=await T.manipulateAsync(M,V,I);console.log("Image compression completed:",{originalUri:M,compressedUri:P.uri,finalDimensions:{width:P.width,height:P.height}});let D=Date.now(),E=C.format==="png"?"png":"jpg",v=`compressed_image_${D}.${E}`;return{uri:P.uri,width:P.width,height:P.height,fileName:v}}catch(T){console.error("Error compressing image:",T);let C=T instanceof Error?T.message:"Unknown error";throw new Error(`Failed to compress image: ${C}`)}},rs=(M,R)=>M>3e3||R>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:M>1920||R>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var za=[{id:"photo",label:"Photo",icon:Oe.Image,color:"#3B82F6"},{id:"camera",label:"Camera",icon:Oe.Camera,color:"#6B7280"},{id:"location",label:"Location",icon:Oe.MapPin,color:"#10B981"},{id:"contact",label:"Contact",icon:Oe.User,color:"#6B7280"},{id:"document",label:"Document",icon:Oe.FileText,color:"#3B82F6"},{id:"poll",label:"Poll",icon:Oe.BarChart3,color:"#F59E0B"},{id:"event",label:"Event",icon:Oe.Calendar,color:"#EF4444"}],Wo=M=>{let R=(0,ot.useRef)(null),T=(0,ot.useCallback)(async()=>{console.log("Photo selection initiated");try{let v;try{v=await import("expo-image-picker")}catch(A){console.log("expo-image-picker not available:",A),ee.Alert.alert("Feature Not Available","Photo selection requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting photo library permissions...");let{status:B}=await v.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(A=>setTimeout(()=>A(void 0),300)),console.log("Launching image picker...");let k=await v.launchImageLibraryAsync({mediaTypes:"images",allowsEditing:!0,aspect:[4,3],quality:.8,allowsMultipleSelection:!1});if(console.log("Image picker result:",k),!k.canceled&&k.assets&&k.assets.length>0){let A=k.assets[0];console.log("Photo selected successfully:",A.uri);try{console.log("Starting image compression...");let z=rs(A.width||1920,A.height||1920),L=await ns(A.uri,z);console.log("Image compression completed:",L),M?.({type:"image",data:{...L,originalFileSize:A.fileSize}})}catch(z){console.error("Image compression failed:",z),ee.Alert.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:A.uri,width:A.width,height:A.height,fileSize:A.fileSize,fileName:A.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),ee.Alert.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),C=(0,ot.useCallback)(async()=>{console.log("Camera capture initiated");try{let v;try{v=await import("expo-image-picker")}catch(A){console.log("expo-image-picker not available:",A),ee.Alert.alert("Feature Not Available","Camera capture requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting camera permissions...");let{status:B}=await v.requestCameraPermissionsAsync();if(console.log("Camera permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(A=>setTimeout(()=>A(void 0),300)),console.log("Launching camera...");let k=await v.launchCameraAsync({allowsEditing:!0,aspect:[4,3],quality:.8,mediaTypes:"images"});if(console.log("Camera result:",k),!k.canceled&&k.assets&&k.assets.length>0){let A=k.assets[0];console.log("Photo captured successfully:",A.uri);try{console.log("Starting camera image compression...");let z=rs(A.width||1920,A.height||1920),L=await ns(A.uri,z);console.log("Camera image compression completed:",L),M?.({type:"image",data:{...L,originalFileSize:A.fileSize}})}catch(z){console.error("Camera image compression failed:",z),ee.Alert.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:A.uri,width:A.width,height:A.height,fileSize:A.fileSize,fileName:A.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),ee.Alert.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),S=(0,ot.useCallback)(async()=>{console.log("Location sharing initiated");try{let v;try{v=await import("expo-location")}catch(L){console.log("expo-location not available:",L),ee.Alert.alert("Feature Not Available","Location sharing requires expo-location to be installed. Please install expo-location to use this feature.",[{text:"OK"}]);return}console.log("Requesting location permissions...");let{status:B}=await v.requestForegroundPermissionsAsync();if(console.log("Location permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let k=await v.getCurrentPositionAsync({accuracy:v.Accuracy.High});console.log("Getting address from coordinates...");let A=await v.reverseGeocodeAsync({latitude:k.coords.latitude,longitude:k.coords.longitude}),z={coordinates:{latitude:k.coords.latitude,longitude:k.coords.longitude},address:A[0]||null,timestamp:k.timestamp};console.log("Location shared successfully:",z.coordinates),M?.({type:"location",data:z})}catch(v){console.error("Error in location sharing process:",v),ee.Alert.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),V=(0,ot.useCallback)(async()=>{try{let v;try{v=await import("expo-contacts")}catch(k){console.log("expo-contacts not available:",k),ee.Alert.alert("Feature Not Available","Contact sharing requires expo-contacts to be installed. Please install expo-contacts to use this feature.",[{text:"OK"}]);return}let{status:B}=await v.requestPermissionsAsync();if(B!=="granted"){ee.Alert.alert("Permission needed","Please grant contacts access to share contacts.");return}ee.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),ee.Alert.alert("Error","Failed to access contacts. Please try again.")}finally{R.current?.hide()}},[]),I=(0,ot.useCallback)(async()=>{console.log("Document selection initiated");try{let v;try{v=await import("expo-document-picker")}catch(k){console.log("expo-document-picker not available:",k),ee.Alert.alert("Feature Not Available","Document selection requires expo-document-picker to be installed. Please install expo-document-picker to use this feature.",[{text:"OK"}]);return}console.log("Waiting for UI to stabilize..."),await new Promise(k=>setTimeout(()=>k(void 0),300)),console.log("Launching document picker...");let B=await v.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",B),!B.canceled&&B.assets&&B.assets.length>0){let k=B.assets[0];console.log("Document selected successfully:",k.name),M?.({type:"document",data:{uri:k.uri,name:k.name,size:k.size,mimeType:k.mimeType}})}else console.log("Document selection was canceled by user")}catch(v){console.error("Error in document selection process:",v),ee.Alert.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[M]),P=(0,ot.useCallback)(()=>{ee.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")}])},[]),D=(0,ot.useCallback)(()=>{ee.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,ot.useCallback)(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await T();break;case"camera":await C();break;case"location":await S();break;case"contact":await V();break;case"document":await I();break;case"poll":P();break;case"event":D();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(B){console.error(`Error handling ${v}:`,B),ee.Alert.alert("Error",`Failed to handle ${v}. Please try again.`)}},[T,C,S,V,I,P,D]);return{menuRef:R,handleOptionSelect:E,options:za}};var G=$(require("react")),Qt=(M={})=>{let{initialValue:R="",initialHeight:T=50,onValueChange:C,onHeightChange:S,onSend:V,onAttachmentSend:I,onReplyCancel:P,onFocus:D,onBlur:E,maxHeight:v=100,minHeight:B=50,maxLength:k=1e3,placeholder:A="Type a message..."}=M,z=(0,G.useRef)(null),[L,O]=G.default.useState(R),[j,H]=G.default.useState(T),[N,F]=G.default.useState(!1),[te,je]=G.default.useState(null),[Me,Ee]=G.default.useState([]),Te=G.default.useMemo(()=>({value:L,height:j,isFocused:N,replyToMessage:te,attachments:Me}),[L,j,N,te,Me]),De=(0,G.useCallback)(ze=>{O(ze),C?.(ze)},[C]),Ae=(0,G.useCallback)(ze=>{let Ne=Math.max(B,Math.min(v,ze));H(Ne),S?.(Ne)},[B,v,S]),Ye=(0,G.useCallback)(()=>{F(!0),D?.()},[D]),U=(0,G.useCallback)(()=>{F(!1),E?.()},[E]),$e=(0,G.useCallback)(ze=>{let{height:Ne}=ze.nativeEvent.contentSize,Kt=Math.max(B,Math.min(v,Ne+16));Ae(Kt)},[B,v,Ae]),Fe=(0,G.useCallback)(()=>{V&&(L||Me.length>0)&&(V(L,Me,te),O(R),Ee([]),je(null),H(T))},[V,L,Me,te,R,T]),Tt=(0,G.useCallback)(ze=>{I?(I(ze,L),L&&O(R)):Ee(Ne=>[...Ne,{...ze,id:Date.now().toString()}])},[I,L,R]),Ce=(0,G.useCallback)(ze=>{Ee(Ne=>[...Ne,ze])},[]),Ge=(0,G.useCallback)(ze=>{Ee(Ne=>Ne.filter(Kt=>Kt.id!==ze))},[]),Xe=(0,G.useCallback)(()=>{Ee([])},[]),we=(0,G.useCallback)(()=>{je(null),P?.()},[P]),It=(0,G.useCallback)(()=>{z.current?.focus()},[]),Ct=G.default.useMemo(()=>({setValue:De,setHeight:Ae,setFocus:F,setReplyToMessage:je,addAttachment:Ce,removeAttachment:Ge,clearAttachments:Xe,sendMessage:Fe,cancelReply:we,focusInput:It,handleAttachmentSelected:Tt,handleContentSizeChange:$e,handleFocus:Ye,handleBlur:U}),[De,Ae,F,je,Ce,Ge,Xe,Fe,we,It,Tt,$e,Ye,U]),Xo=G.default.useMemo(()=>({textInputRef:z}),[]);return{state:Te,actions:Ct,refs:Xo}},ai=(0,G.createContext)(null);var mt=(0,We.forwardRef)(({value:M,onChangeText:R,onSend:T,onFocus:C,height:S,onContentSizeChange:V,replyToMessage:I,onCancelReply:P,onAttachmentSend:D},E)=>{let v=Y(),B=ke(),k=(0,We.useRef)(null);(0,We.useImperativeHandle)(E,()=>({focus:()=>{k.current?.focus()}}));let{state:A,actions:z}=Qt({initialValue:M,initialHeight:S,onValueChange:R,onHeightChange:V,onSend:T,onAttachmentSend:D,onReplyCancel:P,onFocus:C});We.default.useEffect(()=>{M!==A.value&&z.setValue(M)},[M,A.value,z]),We.default.useEffect(()=>{S!==A.height&&z.setHeight(S)},[S,A.height,z]),We.default.useEffect(()=>{I!==A.replyToMessage&&z.setReplyToMessage(I||null)},[I,A.replyToMessage,z]),We.default.useEffect(()=>{if(I&&k.current){let j=setTimeout(()=>{k.current?.focus()},100);return()=>clearTimeout(j)}},[I]);let L=(0,We.useCallback)(j=>{if(console.log("Attachment selected:",j),D)D(j,M.trim()||void 0),M.trim()&&R("");else switch(j.type){case"image":console.log("Image attachment ready to send:",{uri:j.data.uri,dimensions:{width:j.data.width,height:j.data.height},fileName:j.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:j.data.name,size:j.data.size});break;case"location":console.log("Location attachment ready to send:",j.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",j.data);break;default:console.log("Other attachment ready to send:",j)}},[D,M,R]),O=Wo(L);return<>
382
- {I&&P&&<Xt replyToMessage={I}onCancel={P}/>}
383
- <Je.View style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
384
- <Je.View style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:S}}>
385
- <Je.TouchableOpacity style={{marginRight:v.spacing.md}}onPress={()=>O.menuRef.current?.show()}>
386
- <Ht.Plus size={24}color={v.colors.textSecondary}/>
387
- </Je.TouchableOpacity>
388
-
389
- <Je.View style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:v.borderRadius.full,backgroundColor:v.colors.surfaceSecondary,paddingHorizontal:v.spacing.lg,paddingVertical:6}}>
390
- <Je.TextInput ref={k}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={R}placeholder={B("input.placeholder")}placeholderTextColor={v.colors.textMuted}multiline maxLength={1e3}onFocus={C}onContentSizeChange={z.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
391
- </Je.View>
392
-
393
- <Je.TouchableOpacity onPress={T}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()}>
394
- {M.trim()?<Ht.Send size={18}color='white'/>:<Ht.Mic size={18}color='white'/>}
395
- </Je.TouchableOpacity>
396
- </Je.View>
397
- </Je.View>
398
-
399
- <St ref={O.menuRef}onOptionSelect={O.handleOptionSelect}options={O.options}/>
400
- </>});mt.displayName="MessageInput";var Uo=require("react-native"),is=require("lucide-react-native");var qo=$(require("react"));var yt=$(require("react"));var Ko=require("react");function eo(M,R={}){let{initialNumToRender:T=20,maxToRenderPerBatch:C=10,windowSize:S=10}=R,V=(0,Ko.useMemo)(()=>Ao(M).reverse(),[M]),I=(0,Ko.useCallback)(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:V,keyExtractor:I,flatListProps:{initialNumToRender:T,maxToRenderPerBatch:C,windowSize:S,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}var Ue=require("react");function ls(M={}){let{scrollThreshold:R=50,autoScrollToBottom:T=!0}=M,C=(0,Ue.useRef)(null),[S,V]=(0,Ue.useState)({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=(0,Ue.useRef)(0),P=(0,Ue.useCallback)(z=>{let{contentOffset:L,contentSize:O,layoutMeasurement:j}=z.nativeEvent,H=L.y,N=Math.abs(H)<R,F=Math.abs(H)>O.height-j.height-R;V({isNearBottom:N,isNearTop:F,showScrollToBottomButton:!N})},[R]),D=(0,Ue.useCallback)(z=>{let L=z>I.current;return I.current=z,L},[]),E=(0,Ue.useCallback)(()=>{},[]),v=(0,Ue.useCallback)((z=!0)=>{C.current&&C.current.scrollToOffset({offset:0,animated:z})},[]),B=(0,Ue.useCallback)((z,L=!0)=>{C.current&&C.current.scrollToOffset({offset:z,animated:L})},[]),k=(0,Ue.useCallback)((z,L=!0)=>{C.current&&C.current.scrollToIndex({index:z,animated:L})},[]),A=(0,Ue.useCallback)(z=>{D(z)&&T&&C.current&&setTimeout(()=>{v()},100)},[D,T,v]);return{flatListRef:C,scrollState:S,handleScroll:P,handleContentSizeChange:E,handleNewMessages:A,scrollToEnd:v,scrollToOffset:B,scrollToIndex:k}}var Nt=require("react");function to(M={}){let{enableMessageActions:R=!0}=M,[T,C]=(0,Nt.useState)({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),S=(0,Nt.useCallback)((P,D)=>{R&&C({actionSheetVisible:!0,selectedMessage:P,messagePosition:D})},[R]),V=(0,Nt.useCallback)(()=>{C({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=(0,Nt.useCallback)((P,D)=>{if(!T.selectedMessage)return;let{selectedMessage:E}=T;switch(P){case"reply":D?.onReply?.(E);break;case"copy":if(D?.onCopy)D.onCopy(E);else{let v=E.type==="image"&&E.imageData?E.text||"Image message":E.text;Promise.resolve().then(()=>(Ys(),qs)).then(({copyToClipboard:B})=>{B(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":D?.onDelete?.(E.id);break;default:D?.onCustomAction?.(P,E);break}V()},[T.selectedMessage,V]);return{actionState:T,handleMessageLongPress:S,handleActionSheetClose:V,handleActionPress:I}}var dt=require("react");function oo(M={}){let{enableReactionDetails:R=!0}=M,[T,C]=(0,dt.useState)({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[S,V]=(0,dt.useState)(null),I=(0,dt.useCallback)(B=>{R&&B.reactions&&B.reactions.length>0&&(V(B),C({isReactionDetailsVisible:!0,selectedReactions:B.reactions,selectedMessageText:B.text}))},[R]),P=(0,dt.useCallback)(()=>{C({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),V(null)},[]),D=(0,dt.useCallback)((B,k)=>{S&&k?.(S.id,B),P()},[S,P]),E=(0,dt.useCallback)((B,k)=>{S&&k?.(S.id,B),P()},[S,P]),v=(0,dt.useCallback)((B,k)=>{S&&k?.(S.id,B)},[S]);return{reactionState:T,selectedMessage:S,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:D,handleRemoveReaction:E,handleEmojiReact:v}}var so=require("react");function cs(){let[M,R]=(0,so.useState)({replyToMessage:null}),T=(0,so.useCallback)(S=>{R({replyToMessage:S})},[]),C=(0,so.useCallback)(()=>{R({replyToMessage:null})},[]);return{replyState:M,setReplyToMessage:T,clearReply:C}}var $s=(0,yt.createContext)(null);function Wt(){let M=(0,yt.useContext)($s);if(!M)throw new Error("useMessageListContext must be used within MessageListProvider");return M}function Mo({children:M,messages:R,config:T={},...C}){let S=eo(R,T),V=ls(T),I=to(T),P=oo(T),D=cs();yt.default.useEffect(()=>{V.handleNewMessages(R.length)},[R.length,V.handleNewMessages]);let E=(0,yt.useMemo)(()=>({messageList:S,scroll:V,actions:I,reactions:P,reply:D,config:T,callbacks:C}),[S,V,I,P,D,T,C]);return<$s.Provider value={E}>
401
- {M}
402
- </$s.Provider>}var To=require("react"),Ut=require("react-native");var xt={Provider:Mo,Container:({children:M,style:R})=><Ut.View style={[Gs.container,R]}>{M}</Ut.View>,Messages:({renderMessage:M,style:R})=>{let{messageList:T,scroll:C,actions:S,reactions:V,callbacks:I}=Wt(),P=(0,To.useCallback)(({item:E,index:v})=>M&&E.listItemType!=="date-separator"?M({message:E,index:v})||null:E.listItemType==="date-separator"?<No date={E.date}displayDate={E.displayDate}/>:<Do message={E}onLongPress={S.handleMessageLongPress}onReactionPress={V.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[S.handleMessageLongPress,V.handleReactionPress,I.onReactionRemove,M]),D=(0,To.useCallback)(E=>{C.handleScroll(E);let{isNearBottom:v,isNearTop:B}=C.scrollState;I.onScrollPositionChange?.(v,B),v&&I.onScrollToBottom?.(),B&&I.onScrollToTop?.()},[C.handleScroll,C.scrollState,I]);return<Ut.FlatList ref={C.flatListRef}data={T.messageItems}renderItem={P}keyExtractor={T.keyExtractor}contentContainerStyle={[Gs.contentContainer,R]}onContentSizeChange={C.handleContentSizeChange}onScroll={D}{...T.flatListProps}/>},TypingIndicator:({isVisible:M})=>M?<Ft isVisible={M}/>:null,ScrollButton:({visible:M,isReplyActive:R,onPress:T})=>{let{scroll:C}=Wt();return<Ho visible={M??C.scrollState.showScrollToBottomButton}onPress={T??C.scrollToEnd}isReplyActive={R}/>},ActionSheet:()=>{let{actions:M,reactions:R,reply:T,callbacks:C,config:S}=Wt(),V=(0,To.useCallback)(P=>{M.handleActionPress(P,{onReply:D=>{T.setReplyToMessage(D),C.onReplyMessage?.(D)},onDelete:C.onMessageDelete,onCustomAction:C.onActionPress})},[M.handleActionPress,T.setReplyToMessage,C]),I=(0,To.useCallback)(P=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",P);let D=M.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",D?.id,"callbacks.onReactionAdd exists:",!!C.onReactionAdd),D&&C.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",D.id,"emoji:",P),C.onReactionAdd(D.id,P)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!D,"callback exists:",!!C.onReactionAdd)},[M.actionState.selectedMessage,C.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={V}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:M,callbacks:R,config:T}=Wt();return T.enableReactionDetails?<Eo visible={M.reactionState.isReactionDetailsVisible}onClose={M.handleReactionDetailsClose}reactions={M.reactionState.selectedReactions}messageText={M.reactionState.selectedMessageText}onRemoveReaction={C=>M.handleRemoveReaction(C,R.onReactionRemove)}/>:null}},Gs=Ut.StyleSheet.create({container:{flex:1},contentContainer:{paddingVertical:16}});var pt=(0,qo.forwardRef)(({messages:M,isTyping:R,showScrollToBottom:T=!1,isReplyActive:C=!1,...S},V)=>{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 qo.default.useImperativeHandle(V,()=>({scrollToEnd:(D=!0)=>{},scrollToOffset:(D,E=!0)=>{},scrollToIndex:(D,E=!0)=>{}}),[]),<Mo messages={M}config={I}{...P}>
371
+ </Le.View>:null},Ot=Le.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}}),Ht=Fa;var Jo=Y(require("react")),Nt=require("react-native"),ea=require("lucide-react-native");var Oa=({visible:C,onPress:S,isReplyActive:T=!1})=>{let M=q(),R=Jo.default.useRef(new Nt.Animated.Value(0)).current,[A,I]=Jo.default.useState(!1);return Jo.default.useEffect(()=>{Nt.Animated.timing(R,{toValue:C?1:0,duration:200,useNativeDriver:!0}).start(()=>{I(C)})},[C,R]),!C&&!A?null:<Nt.Pressable onPress={S}hitSlop={{top:10,bottom:10,left:10,right:10}}>
372
+ {({pressed:P})=><Nt.Animated.View style={[{position:"absolute",bottom:40,right:M.spacing.lg,zIndex:9999,width:32,height:32,backgroundColor:M.colors.background,borderRadius:M.borderRadius.xl,justifyContent:"center",alignItems:"center",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:3.84,elevation:5,opacity:R,transform:P?[{scale:.95}]:[]}]}>
373
+ <ea.ChevronDown size={20}color={M.colors.text}/>
374
+ </Nt.Animated.View>}
375
+ </Nt.Pressable>},Xo=Oa;var To=require("react-native");var Ha=({displayDate:C})=>{let S=q();return<To.View style={{marginVertical:S.spacing.lg,alignItems:"center"}}>
376
+ <To.View style={{borderRadius:S.borderRadius.full,backgroundColor:S.colors.surfaceSecondary,paddingHorizontal:S.spacing.md,paddingVertical:S.spacing.xs}}>
377
+ <To.Text style={{fontSize:S.typography.fontSize.xs,color:S.colors.textSecondary,fontWeight:S.typography.fontWeight.medium}}>
378
+ {C}
379
+ </To.Text>
380
+ </To.View>
381
+ </To.View>},Zo=Ha;var We=Y(require("react")),Xe=require("react-native"),Wt=require("lucide-react-native");var st=require("react"),ee=require("react-native"),Oe=require("lucide-react-native");var Na={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},fs=async(C,S={})=>{try{let T;try{T=await import("expo-image-manipulator")}catch(B){console.log("expo-image-manipulator not available, returning original image info:",B);let z=`image_${Date.now()}.jpg`;return{uri:C,width:1920,height:1920,fileName:z}}let M={...Na,...S};console.log("Starting image compression...",{uri:C,options:M});let R=await T.manipulateAsync(C,[],{});console.log("Original image info:",{width:R.width,height:R.height,uri:R.uri});let A=[];if(M.maxWidth||M.maxHeight){let{width:B,height:k}=R,z=B,D=k;if(M.maxWidth&&B>M.maxWidth){let L=M.maxWidth/B;z=M.maxWidth,D=k*L}if(M.maxHeight&&D>M.maxHeight){let L=M.maxHeight/D;D=M.maxHeight,z=z*L}(z!==B||D!==k)&&(A.push({resize:{width:Math.round(z),height:Math.round(D)}}),console.log("Resizing image:",{from:{width:B,height:k},to:{width:Math.round(z),height:Math.round(D)}}))}let I={compress:M.quality,format:M.format==="png"?T.SaveFormat?.PNG:T.SaveFormat?.JPEG};console.log("Applying compression with options:",I);let P=await T.manipulateAsync(C,A,I);console.log("Image compression completed:",{originalUri:C,compressedUri:P.uri,finalDimensions:{width:P.width,height:P.height}});let V=Date.now(),E=M.format==="png"?"png":"jpg",v=`compressed_image_${V}.${E}`;return{uri:P.uri,width:P.width,height:P.height,fileName:v}}catch(T){console.error("Error compressing image:",T);let M=T instanceof Error?T.message:"Unknown error";throw new Error(`Failed to compress image: ${M}`)}},ys=(C,S)=>C>3e3||S>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:C>1920||S>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var Wa=[{id:"photo",label:"Photo",icon:Oe.Image,color:"#3B82F6"},{id:"camera",label:"Camera",icon:Oe.Camera,color:"#6B7280"},{id:"location",label:"Location",icon:Oe.MapPin,color:"#10B981"},{id:"contact",label:"Contact",icon:Oe.User,color:"#6B7280"},{id:"document",label:"Document",icon:Oe.FileText,color:"#3B82F6"},{id:"poll",label:"Poll",icon:Oe.BarChart3,color:"#F59E0B"},{id:"event",label:"Event",icon:Oe.Calendar,color:"#EF4444"}],Qo=C=>{let S=(0,st.useRef)(null),T=(0,st.useCallback)(async()=>{console.log("Photo selection initiated");try{let v;try{v=await import("expo-image-picker")}catch(z){console.log("expo-image-picker not available:",z),ee.Alert.alert("Feature Not Available","Photo selection requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting photo library permissions...");let{status:B}=await v.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(z=>setTimeout(()=>z(void 0),300)),console.log("Launching image picker...");let k=await v.launchImageLibraryAsync({mediaTypes:"images",allowsEditing:!0,aspect:[4,3],quality:.8,allowsMultipleSelection:!1});if(console.log("Image picker result:",k),!k.canceled&&k.assets&&k.assets.length>0){let z=k.assets[0];console.log("Photo selected successfully:",z.uri);try{console.log("Starting image compression...");let D=ys(z.width||1920,z.height||1920),L=await fs(z.uri,D);console.log("Image compression completed:",L),C?.({type:"image",data:{...L,originalFileSize:z.fileSize}})}catch(D){console.error("Image compression failed:",D),ee.Alert.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),C?.({type:"image",data:{uri:z.uri,width:z.width,height:z.height,fileSize:z.fileSize,fileName:z.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),ee.Alert.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),M=(0,st.useCallback)(async()=>{console.log("Camera capture initiated");try{let v;try{v=await import("expo-image-picker")}catch(z){console.log("expo-image-picker not available:",z),ee.Alert.alert("Feature Not Available","Camera capture requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting camera permissions...");let{status:B}=await v.requestCameraPermissionsAsync();if(console.log("Camera permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(z=>setTimeout(()=>z(void 0),300)),console.log("Launching camera...");let k=await v.launchCameraAsync({allowsEditing:!0,aspect:[4,3],quality:.8,mediaTypes:"images"});if(console.log("Camera result:",k),!k.canceled&&k.assets&&k.assets.length>0){let z=k.assets[0];console.log("Photo captured successfully:",z.uri);try{console.log("Starting camera image compression...");let D=ys(z.width||1920,z.height||1920),L=await fs(z.uri,D);console.log("Camera image compression completed:",L),C?.({type:"image",data:{...L,originalFileSize:z.fileSize}})}catch(D){console.error("Camera image compression failed:",D),ee.Alert.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),C?.({type:"image",data:{uri:z.uri,width:z.width,height:z.height,fileSize:z.fileSize,fileName:z.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),ee.Alert.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),R=(0,st.useCallback)(async()=>{console.log("Location sharing initiated");try{let v;try{v=await import("expo-location")}catch(L){console.log("expo-location not available:",L),ee.Alert.alert("Feature Not Available","Location sharing requires expo-location to be installed. Please install expo-location to use this feature.",[{text:"OK"}]);return}console.log("Requesting location permissions...");let{status:B}=await v.requestForegroundPermissionsAsync();if(console.log("Location permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let k=await v.getCurrentPositionAsync({accuracy:v.Accuracy.High});console.log("Getting address from coordinates...");let z=await v.reverseGeocodeAsync({latitude:k.coords.latitude,longitude:k.coords.longitude}),D={coordinates:{latitude:k.coords.latitude,longitude:k.coords.longitude},address:z[0]||null,timestamp:k.timestamp};console.log("Location shared successfully:",D.coordinates),C?.({type:"location",data:D})}catch(v){console.error("Error in location sharing process:",v),ee.Alert.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),A=(0,st.useCallback)(async()=>{try{let v;try{v=await import("expo-contacts")}catch(k){console.log("expo-contacts not available:",k),ee.Alert.alert("Feature Not Available","Contact sharing requires expo-contacts to be installed. Please install expo-contacts to use this feature.",[{text:"OK"}]);return}let{status:B}=await v.requestPermissionsAsync();if(B!=="granted"){ee.Alert.alert("Permission needed","Please grant contacts access to share contacts.");return}ee.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),ee.Alert.alert("Error","Failed to access contacts. Please try again.")}finally{S.current?.hide()}},[]),I=(0,st.useCallback)(async()=>{console.log("Document selection initiated");try{let v;try{v=await import("expo-document-picker")}catch(k){console.log("expo-document-picker not available:",k),ee.Alert.alert("Feature Not Available","Document selection requires expo-document-picker to be installed. Please install expo-document-picker to use this feature.",[{text:"OK"}]);return}console.log("Waiting for UI to stabilize..."),await new Promise(k=>setTimeout(()=>k(void 0),300)),console.log("Launching document picker...");let B=await v.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",B),!B.canceled&&B.assets&&B.assets.length>0){let k=B.assets[0];console.log("Document selected successfully:",k.name),C?.({type:"document",data:{uri:k.uri,name:k.name,size:k.size,mimeType:k.mimeType}})}else console.log("Document selection was canceled by user")}catch(v){console.error("Error in document selection process:",v),ee.Alert.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[C]),P=(0,st.useCallback)(()=>{ee.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")}])},[]),V=(0,st.useCallback)(()=>{ee.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,st.useCallback)(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await T();break;case"camera":await M();break;case"location":await R();break;case"contact":await A();break;case"document":await I();break;case"poll":P();break;case"event":V();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(B){console.error(`Error handling ${v}:`,B),ee.Alert.alert("Error",`Failed to handle ${v}. Please try again.`)}},[T,M,R,A,I,P,V]);return{menuRef:S,handleOptionSelect:E,options:Wa}};var _=Y(require("react")),Mo=(C={})=>{let{initialValue:S="",initialHeight:T=50,onValueChange:M,onHeightChange:R,onSend:A,onAttachmentSend:I,onReplyCancel:P,onFocus:V,onBlur:E,maxHeight:v=100,minHeight:B=50,maxLength:k=1e3,placeholder:z="Type a message..."}=C,D=(0,_.useRef)(null),[L,O]=_.default.useState(S),[j,H]=_.default.useState(T),[N,F]=_.default.useState(!1),[te,je]=_.default.useState(null),[Ce,Ee]=_.default.useState([]),Te=_.default.useMemo(()=>({value:L,height:j,isFocused:N,replyToMessage:te,attachments:Ce}),[L,j,N,te,Ce]),Be=(0,_.useCallback)(ze=>{O(ze),M?.(ze)},[M]),Ae=(0,_.useCallback)(ze=>{let Ne=Math.max(B,Math.min(v,ze));H(Ne),R?.(Ne)},[B,v,R]),qe=(0,_.useCallback)(()=>{F(!0),V?.()},[V]),U=(0,_.useCallback)(()=>{F(!1),E?.()},[E]),Ye=(0,_.useCallback)(ze=>{let{height:Ne}=ze.nativeEvent.contentSize,Yt=Math.max(B,Math.min(v,Ne+16));Ae(Yt)},[B,v,Ae]),Fe=(0,_.useCallback)(()=>{A&&(L||Ce.length>0)&&(A(L,Ce,te),O(S),Ee([]),je(null),H(T))},[A,L,Ce,te,S,T]),Mt=(0,_.useCallback)(ze=>{I?(I(ze,L),L&&O(S)):Ee(Ne=>[...Ne,{...ze,id:Date.now().toString()}])},[I,L,S]),Me=(0,_.useCallback)(ze=>{Ee(Ne=>[...Ne,ze])},[]),_e=(0,_.useCallback)(ze=>{Ee(Ne=>Ne.filter(Yt=>Yt.id!==ze))},[]),Ze=(0,_.useCallback)(()=>{Ee([])},[]),we=(0,_.useCallback)(()=>{je(null),P?.()},[P]),Pt=(0,_.useCallback)(()=>{D.current?.focus()},[]),St=_.default.useMemo(()=>({setValue:Be,setHeight:Ae,setFocus:F,setReplyToMessage:je,addAttachment:Me,removeAttachment:_e,clearAttachments:Ze,sendMessage:Fe,cancelReply:we,focusInput:Pt,handleAttachmentSelected:Mt,handleContentSizeChange:Ye,handleFocus:qe,handleBlur:U}),[Be,Ae,F,je,Me,_e,Ze,Fe,we,Pt,Mt,Ye,qe,U]),ls=_.default.useMemo(()=>({textInputRef:D}),[]);return{state:Te,actions:St,refs:ls}},xi=(0,_.createContext)(null);var mt=(0,We.forwardRef)(({value:C,onChangeText:S,onSend:T,onFocus:M,height:R,onContentSizeChange:A,replyToMessage:I,onCancelReply:P,onAttachmentSend:V},E)=>{let v=q(),B=ke(),k=(0,We.useRef)(null);(0,We.useImperativeHandle)(E,()=>({focus:()=>{k.current?.focus()}}));let{state:z,actions:D}=Mo({initialValue:C,initialHeight:R,onValueChange:S,onHeightChange:A,onSend:T,onAttachmentSend:V,onReplyCancel:P,onFocus:M});We.default.useEffect(()=>{C!==z.value&&D.setValue(C)},[C,z.value,D]),We.default.useEffect(()=>{R!==z.height&&D.setHeight(R)},[R,z.height,D]),We.default.useEffect(()=>{I!==z.replyToMessage&&D.setReplyToMessage(I||null)},[I,z.replyToMessage,D]),We.default.useEffect(()=>{if(I&&k.current){let j=setTimeout(()=>{k.current?.focus()},100);return()=>clearTimeout(j)}},[I]);let L=(0,We.useCallback)(j=>{if(console.log("Attachment selected:",j),V)V(j,C.trim()||void 0),C.trim()&&S("");else switch(j.type){case"image":console.log("Image attachment ready to send:",{uri:j.data.uri,dimensions:{width:j.data.width,height:j.data.height},fileName:j.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:j.data.name,size:j.data.size});break;case"location":console.log("Location attachment ready to send:",j.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",j.data);break;default:console.log("Other attachment ready to send:",j)}},[V,C,S]),O=Qo(L);return<>
382
+ {I&&P&&<Co replyToMessage={I}onCancel={P}/>}
383
+ <Xe.View style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
384
+ <Xe.View style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:R}}>
385
+ <Xe.TouchableOpacity style={{marginRight:v.spacing.md}}onPress={()=>O.menuRef.current?.show()}>
386
+ <Wt.Plus size={24}color={v.colors.textSecondary}/>
387
+ </Xe.TouchableOpacity>
388
+
389
+ <Xe.View style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:v.borderRadius.full,backgroundColor:v.colors.surfaceSecondary,paddingHorizontal:v.spacing.lg,paddingVertical:6}}>
390
+ <Xe.TextInput ref={k}style={{flex:1,fontSize:v.typography.fontSize.base,maxHeight:70,minHeight:18,paddingTop:Xe.Platform.OS==="ios"?6:3,paddingBottom:Xe.Platform.OS==="ios"?6:3,color:v.colors.text}}value={C}onChangeText={S}placeholder={B("input.placeholder")}placeholderTextColor={v.colors.textMuted}multiline maxLength={1e3}onFocus={M}onContentSizeChange={D.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
391
+ </Xe.View>
392
+
393
+ <Xe.TouchableOpacity onPress={T}style={{marginLeft:v.spacing.md,height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:v.borderRadius.full,backgroundColor:C.trim()?v.colors.primary:v.colors.gray[300]}}disabled={!C.trim()}>
394
+ {C.trim()?<Wt.Send size={18}color='white'/>:<Wt.Mic size={18}color='white'/>}
395
+ </Xe.TouchableOpacity>
396
+ </Xe.View>
397
+ </Xe.View>
398
+
399
+ <It ref={O.menuRef}onOptionSelect={O.handleOptionSelect}options={O.options}/>
400
+ </>});mt.displayName="MessageInput";var es=require("react-native"),xs=require("lucide-react-native");var os=Y(require("react"));var yt=Y(require("react"));var ts=require("react");function So(C,S={}){let{initialNumToRender:T=20,maxToRenderPerBatch:M=10,windowSize:R=10}=S,A=(0,ts.useMemo)(()=>Wo(C).reverse(),[C]),I=(0,ts.useCallback)(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:T,maxToRenderPerBatch:M,windowSize:R,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}var Ue=require("react");function bs(C={}){let{scrollThreshold:S=50,autoScrollToBottom:T=!0}=C,M=(0,Ue.useRef)(null),[R,A]=(0,Ue.useState)({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=(0,Ue.useRef)(0),P=(0,Ue.useCallback)(D=>{let{contentOffset:L,contentSize:O,layoutMeasurement:j}=D.nativeEvent,H=L.y,N=Math.abs(H)<S,F=Math.abs(H)>O.height-j.height-S;A({isNearBottom:N,isNearTop:F,showScrollToBottomButton:!N})},[S]),V=(0,Ue.useCallback)(D=>{let L=D>I.current;return I.current=D,L},[]),E=(0,Ue.useCallback)(()=>{},[]),v=(0,Ue.useCallback)((D=!0)=>{M.current&&M.current.scrollToOffset({offset:0,animated:D})},[]),B=(0,Ue.useCallback)((D,L=!0)=>{M.current&&M.current.scrollToOffset({offset:D,animated:L})},[]),k=(0,Ue.useCallback)((D,L=!0)=>{M.current&&M.current.scrollToIndex({index:D,animated:L})},[]),z=(0,Ue.useCallback)(D=>{V(D)&&T&&M.current&&setTimeout(()=>{v()},100)},[V,T,v]);return{flatListRef:M,scrollState:R,handleScroll:P,handleContentSizeChange:E,handleNewMessages:z,scrollToEnd:v,scrollToOffset:B,scrollToIndex:k}}var Ut=require("react");function Ro(C={}){let{enableMessageActions:S=!0}=C,[T,M]=(0,Ut.useState)({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),R=(0,Ut.useCallback)((P,V)=>{S&&M({actionSheetVisible:!0,selectedMessage:P,messagePosition:V})},[S]),A=(0,Ut.useCallback)(()=>{M({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=(0,Ut.useCallback)((P,V)=>{if(!T.selectedMessage)return;let{selectedMessage:E}=T;switch(P){case"reply":V?.onReply?.(E);break;case"copy":if(V?.onCopy)V.onCopy(E);else{let v=E.type==="image"&&E.imageData?E.text||"Image message":E.text;Promise.resolve().then(()=>(oa(),ta)).then(({copyToClipboard:B})=>{B(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":V?.onDelete?.(E.id);break;default:V?.onCustomAction?.(P,E);break}A()},[T.selectedMessage,A]);return{actionState:T,handleMessageLongPress:R,handleActionSheetClose:A,handleActionPress:I}}var dt=require("react");function wo(C={}){let{enableReactionDetails:S=!0}=C,[T,M]=(0,dt.useState)({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[R,A]=(0,dt.useState)(null),I=(0,dt.useCallback)(B=>{S&&B.reactions&&B.reactions.length>0&&(A(B),M({isReactionDetailsVisible:!0,selectedReactions:B.reactions,selectedMessageText:B.text}))},[S]),P=(0,dt.useCallback)(()=>{M({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),V=(0,dt.useCallback)((B,k)=>{R&&k?.(R.id,B),P()},[R,P]),E=(0,dt.useCallback)((B,k)=>{R&&k?.(R.id,B),P()},[R,P]),v=(0,dt.useCallback)((B,k)=>{R&&k?.(R.id,B)},[R]);return{reactionState:T,selectedMessage:R,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:V,handleRemoveReaction:E,handleEmojiReact:v}}var Io=require("react");function Cs(){let[C,S]=(0,Io.useState)({replyToMessage:null}),T=(0,Io.useCallback)(R=>{S({replyToMessage:R})},[]),M=(0,Io.useCallback)(()=>{S({replyToMessage:null})},[]);return{replyState:C,setReplyToMessage:T,clearReply:M}}var sa=(0,yt.createContext)(null);function Kt(){let C=(0,yt.useContext)(sa);if(!C)throw new Error("useMessageListContext must be used within MessageListProvider");return C}function Po({children:C,messages:S,config:T={},...M}){let R=So(S,T),A=bs(T),I=Ro(T),P=wo(T),V=Cs();yt.default.useEffect(()=>{A.handleNewMessages(S.length)},[S.length,A.handleNewMessages]);let E=(0,yt.useMemo)(()=>({messageList:R,scroll:A,actions:I,reactions:P,reply:V,config:T,callbacks:M}),[R,A,I,P,V,T,M]);return<sa.Provider value={E}>
401
+ {C}
402
+ </sa.Provider>}var Ao=require("react"),$t=require("react-native");var xt={Provider:Po,Container:({children:C,style:S})=><$t.View style={[aa.container,S]}>{C}</$t.View>,Messages:({renderMessage:C,style:S})=>{let{messageList:T,scroll:M,actions:R,reactions:A,callbacks:I}=Kt(),P=(0,Ao.useCallback)(({item:E,index:v})=>C&&E.listItemType!=="date-separator"?C({message:E,index:v})||null:E.listItemType==="date-separator"?<Zo date={E.date}displayDate={E.displayDate}/>:<$o message={E}onLongPress={R.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[R.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,C]),V=(0,Ao.useCallback)(E=>{M.handleScroll(E);let{isNearBottom:v,isNearTop:B}=M.scrollState;I.onScrollPositionChange?.(v,B),v&&I.onScrollToBottom?.(),B&&I.onScrollToTop?.()},[M.handleScroll,M.scrollState,I]);return<$t.FlatList ref={M.flatListRef}data={T.messageItems}renderItem={P}keyExtractor={T.keyExtractor}contentContainerStyle={[aa.contentContainer,S]}onContentSizeChange={M.handleContentSizeChange}onScroll={V}{...T.flatListProps}/>},TypingIndicator:({isVisible:C})=>C?<Ht isVisible={C}/>:null,ScrollButton:({visible:C,isReplyActive:S,onPress:T})=>{let{scroll:M}=Kt();return<Xo visible={C??M.scrollState.showScrollToBottomButton}onPress={T??M.scrollToEnd}isReplyActive={S}/>},ActionSheet:()=>{let{actions:C,reactions:S,reply:T,callbacks:M,config:R}=Kt(),A=(0,Ao.useCallback)(P=>{C.handleActionPress(P,{onReply:V=>{T.setReplyToMessage(V),M.onReplyMessage?.(V)},onDelete:M.onMessageDelete,onCustomAction:M.onActionPress})},[C.handleActionPress,T.setReplyToMessage,M]),I=(0,Ao.useCallback)(P=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",P);let V=C.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",V?.id,"callbacks.onReactionAdd exists:",!!M.onReactionAdd),V&&M.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",V.id,"emoji:",P),M.onReactionAdd(V.id,P)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!V,"callback exists:",!!M.onReactionAdd)},[C.actionState.selectedMessage,M.onReactionAdd]);return R.enableMessageActions?<Yo visible={C.actionState.actionSheetVisible}onClose={C.handleActionSheetClose}isMyMessage={C.actionState.selectedMessage?.isMe||!1}selectedMessage={C.actionState.selectedMessage||void 0}messagePosition={C.actionState.messagePosition}onActionPress={A}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:C,callbacks:S,config:T}=Kt();return T.enableReactionDetails?<_o visible={C.reactionState.isReactionDetailsVisible}onClose={C.handleReactionDetailsClose}reactions={C.reactionState.selectedReactions}messageText={C.reactionState.selectedMessageText}onRemoveReaction={M=>C.handleRemoveReaction(M,S.onReactionRemove)}/>:null}},aa=$t.StyleSheet.create({container:{flex:1},contentContainer:{paddingVertical:16}});var pt=(0,os.forwardRef)(({messages:C,isTyping:S,showScrollToBottom:T=!1,isReplyActive:M=!1,...R},A)=>{let I={scrollThreshold:R.scrollThreshold,autoScrollToBottom:R.autoScrollToBottom,enableMessageActions:R.enableMessageActions,enableReactionDetails:R.enableReactionDetails},P={onScrollToBottom:R.onScrollToBottom,onScrollToTop:R.onScrollToTop,onScrollPositionChange:R.onScrollPositionChange,onReactionAdd:R.onReactionAdd,onReactionRemove:R.onReactionRemove,onMessageDelete:R.onMessageDelete,onReplyMessage:R.onReplyMessage,onActionPress:R.onActionPress};return os.default.useImperativeHandle(A,()=>({scrollToEnd:(V=!0)=>{},scrollToOffset:(V,E=!0)=>{},scrollToIndex:(V,E=!0)=>{}}),[]),<Po messages={C}config={I}{...P}>
403
403
  <xt.Container>
404
404
  <xt.Messages/>
405
- <xt.TypingIndicator isVisible={R}/>
406
- <xt.ScrollButton visible={T?void 0:!1}isReplyActive={C}/>
405
+ <xt.TypingIndicator isVisible={S}/>
406
+ <xt.ScrollButton visible={T?void 0:!1}isReplyActive={M}/>
407
407
  <xt.ActionSheet/>
408
408
  <xt.ReactionDetails/>
409
409
  </xt.Container>
410
- </Mo>});pt.displayName="MessageList";var _s=$(require("react"));function He(M){let R=_s.default.forwardRef((C,S)=>(vt(),<M{...C}ref={S}/>)),T=M.displayName||M.name||"Component";return R.displayName=`RequireAuth(${T})`,R}function st(M){return(...R)=>(vt(),M(...R))}var Yo=require("react-native");var Ke=require("react-native");var bt=require("react-native");var ka=({avatar:M,isOnline:R=!1,size:T="medium"})=>{let C=Y(),S=()=>{switch(T){case"small":return{width:32,height:32};case"large":return{width:64,height:64};default:return{width:48,height:48}}},V=()=>{switch(T){case"small":return{width:12,height:12};case"large":return{width:24,height:24};default:return{width:16,height:16}}},I=S(),P=V(),E=(()=>{switch(T){case"small":return 14;case"large":return 28;default:return 20}})();return<bt.View style={{position:"relative"}}>
411
- {M&&M.trim()!==""?<bt.Image source={{uri:M}}style={[I,{borderRadius:C.borderRadius.full}]}resizeMode="cover"/>:<bt.View style={[I,{borderRadius:C.borderRadius.full,backgroundColor:C.colors.primary,justifyContent:"center",alignItems:"center"}]}>
412
- <bt.Text style={{color:C.colors.background,fontSize:E,fontWeight:"600"}}>
410
+ </Po>});pt.displayName="MessageList";var qt=Y(require("react")),bt=require("react-native");var Ya=()=><bt.View style={na.container}>
411
+ <bt.ActivityIndicator size="small"color="#007AFF"/>
412
+ <bt.Text style={na.text}>Initializing...</bt.Text>
413
+ </bt.View>,na=bt.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center",padding:20},text:{marginTop:8,fontSize:14,color:"#666"}});function He(C){let S=qt.default.forwardRef((M,R)=>{let[,A]=(0,qt.useState)(0),I=At();return(0,qt.useEffect)(()=>{if(I==="pending"){let P=setInterval(()=>{Eo()!=="pending"&&(clearInterval(P),A(E=>E+1))},100);return()=>clearInterval(P)}},[I]),I==="pending"?<Ya/>:<C{...M}ref={R}/>}),T=C.displayName||C.name||"Component";return S.displayName=`RequireAuth(${T})`,S}function at(C){return(...S)=>{if(At()==="pending")throw new Error("[UseChat SDK] SDK is still initializing. Make sure to await initChat() before rendering components that use this hook.");return C(...S)}}var ss=require("react-native");var Ke=require("react-native");var Ct=require("react-native");var _a=({avatar:C,isOnline:S=!1,size:T="medium"})=>{let M=q(),R=()=>{switch(T){case"small":return{width:32,height:32};case"large":return{width:64,height:64};default:return{width:48,height:48}}},A=()=>{switch(T){case"small":return{width:12,height:12};case"large":return{width:24,height:24};default:return{width:16,height:16}}},I=R(),P=A(),E=(()=>{switch(T){case"small":return 14;case"large":return 28;default:return 20}})();return<Ct.View style={{position:"relative"}}>
414
+ {C&&C.trim()!==""?<Ct.Image source={{uri:C}}style={[I,{borderRadius:M.borderRadius.full}]}resizeMode="cover"/>:<Ct.View style={[I,{borderRadius:M.borderRadius.full,backgroundColor:M.colors.primary,justifyContent:"center",alignItems:"center"}]}>
415
+ <Ct.Text style={{color:M.colors.background,fontSize:E,fontWeight:"600"}}>
413
416
  👤
414
- </bt.Text>
415
- </bt.View>}
417
+ </Ct.Text>
418
+ </Ct.View>}
416
419
 
417
420
  {}
418
- {R&&<bt.View style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:C.colors.online,borderRadius:C.borderRadius.full,borderWidth:2,borderColor:C.colors.background}]}/>}
419
- </bt.View>},Co=ka;var La=({item:M,onPress:R})=>{let T=Y(),C=M.unreadCount&&M.unreadCount>0;return<Ke.TouchableOpacity style={{flexDirection:"row",alignItems:"center",paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.md,borderBottomWidth:1,borderBottomColor:T.colors.borderLight,backgroundColor:C?T.colors.unread:T.colors.background}}onPress={()=>R(M)}>
421
+ {S&&<Ct.View style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:M.colors.online,borderRadius:M.borderRadius.full,borderWidth:2,borderColor:M.colors.background}]}/>}
422
+ </Ct.View>},Do=_a;var Ga=({item:C,onPress:S})=>{let T=q(),M=C.unreadCount&&C.unreadCount>0;return<Ke.TouchableOpacity style={{flexDirection:"row",alignItems:"center",paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.md,borderBottomWidth:1,borderBottomColor:T.colors.borderLight,backgroundColor:M?T.colors.unread:T.colors.background}}onPress={()=>S(C)}>
420
423
  <Ke.View style={{marginRight:T.spacing.md}}>
421
- <Co avatar={M.avatar}isOnline={M.isOnline}size="medium"/>
424
+ <Do avatar={C.avatar}isOnline={C.isOnline}size="medium"/>
422
425
  </Ke.View>
423
426
 
424
427
  <Ke.View style={{flex:1,marginRight:T.spacing.md}}>
425
428
  {}
426
429
  <Ke.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:T.spacing.xs}}>
427
- <Ke.Text style={{fontSize:T.typography.fontSize.base,flex:1,fontWeight:C?T.typography.fontWeight.bold:T.typography.fontWeight.semibold,color:T.colors.text}}>
428
- {M.name}
430
+ <Ke.Text style={{fontSize:T.typography.fontSize.base,flex:1,fontWeight:M?T.typography.fontWeight.bold:T.typography.fontWeight.semibold,color:T.colors.text}}>
431
+ {C.name}
429
432
  </Ke.Text>
430
- <Ke.Text style={{fontSize:T.typography.fontSize.sm,marginLeft:T.spacing.sm,color:C?T.colors.gray[700]:T.colors.textSecondary,fontWeight:C?T.typography.fontWeight.medium:T.typography.fontWeight.normal}}>
431
- {M.time}
433
+ <Ke.Text style={{fontSize:T.typography.fontSize.sm,marginLeft:T.spacing.sm,color:M?T.colors.gray[700]:T.colors.textSecondary,fontWeight:M?T.typography.fontWeight.medium:T.typography.fontWeight.normal}}>
434
+ {C.time}
432
435
  </Ke.Text>
433
436
  </Ke.View>
434
437
 
435
438
  {}
436
439
  <Ke.View style={{flexDirection:"row",alignItems:"center"}}>
437
- <Ke.Text style={{fontSize:T.typography.fontSize.sm,flex:1,color:C?T.colors.gray[800]:T.colors.textSecondary,fontWeight:C?T.typography.fontWeight.medium:T.typography.fontWeight.normal}}numberOfLines={1}>
438
- {M.message}
440
+ <Ke.Text style={{fontSize:T.typography.fontSize.sm,flex:1,color:M?T.colors.gray[800]:T.colors.textSecondary,fontWeight:M?T.typography.fontWeight.medium:T.typography.fontWeight.normal}}numberOfLines={1}>
441
+ {C.message}
439
442
  </Ke.Text>
440
- {M.unreadCount&&<Ke.View style={{width:20,height:20,backgroundColor:T.colors.primary,borderRadius:T.borderRadius.full,alignItems:"center",justifyContent:"center",marginLeft:T.spacing.sm}}>
443
+ {C.unreadCount&&<Ke.View style={{width:20,height:20,backgroundColor:T.colors.primary,borderRadius:T.borderRadius.full,alignItems:"center",justifyContent:"center",marginLeft:T.spacing.sm}}>
441
444
  <Ke.Text style={{fontSize:T.typography.fontSize.xs,color:"white",fontWeight:T.typography.fontWeight.bold}}>
442
- {M.unreadCount}
445
+ {C.unreadCount}
443
446
  </Ke.Text>
444
447
  </Ke.View>}
445
448
  </Ke.View>
446
449
  </Ke.View>
447
- </Ke.TouchableOpacity>},Ro=La;var ja=({chats:M,onChatPress:R,onRefresh:T,refreshing:C=!1})=>{let S=({item:V})=><Ro item={V}onPress={R}/>;return<Yo.FlatList data={M}renderItem={S}keyExtractor={V=>V.id}showsVerticalScrollIndicator={!1}style={{flex:1}}refreshControl={T?<Yo.RefreshControl refreshing={C}onRefresh={T}tintColor="#007AFF"colors={["#007AFF"]}/>:void 0}/>},ds=ja;var $o=require("react-native");var Ea=({title:M})=>{let R=Y();return<$o.View style={{backgroundColor:R.colors.background,paddingHorizontal:R.spacing.lg,paddingVertical:R.spacing.lg,borderBottomWidth:1,borderBottomColor:R.colors.borderLight}}>
448
- <$o.Text style={{fontSize:R.typography.fontSize.xxl,fontWeight:R.typography.fontWeight.bold,color:R.colors.text}}>
449
- {M}
450
- </$o.Text>
451
- </$o.View>},us=Ea;var Mt=require("react-native"),Go=require("lucide-react-native");var Fa=({value:M,onChangeText:R,onClear:T,placeholder:C})=>{let S=Y(),I=ke()("search.placeholder");return<Mt.View style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.md,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
452
- <Mt.View style={{position:"relative"}}>
453
- <Mt.View style={{position:"absolute",left:S.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
454
- <Go.Search size={20}color={S.colors.textMuted}/>
455
- </Mt.View>
450
+ </Ke.TouchableOpacity>},Vo=Ga;var Ja=({chats:C,onChatPress:S,onRefresh:T,refreshing:M=!1})=>{let R=({item:A})=><Vo item={A}onPress={S}/>;return<ss.FlatList data={C}renderItem={R}keyExtractor={A=>A.id}showsVerticalScrollIndicator={!1}style={{flex:1}}refreshControl={T?<ss.RefreshControl refreshing={M}onRefresh={T}tintColor="#007AFF"colors={["#007AFF"]}/>:void 0}/>},Ts=Ja;var as=require("react-native");var Xa=({title:C})=>{let S=q();return<as.View style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.lg,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
451
+ <as.Text style={{fontSize:S.typography.fontSize.xxl,fontWeight:S.typography.fontWeight.bold,color:S.colors.text}}>
452
+ {C}
453
+ </as.Text>
454
+ </as.View>},Ms=Xa;var Tt=require("react-native"),ns=require("lucide-react-native");var Za=({value:C,onChangeText:S,onClear:T,placeholder:M})=>{let R=q(),I=ke()("search.placeholder");return<Tt.View style={{backgroundColor:R.colors.background,paddingHorizontal:R.spacing.lg,paddingVertical:R.spacing.md,borderBottomWidth:1,borderBottomColor:R.colors.borderLight}}>
455
+ <Tt.View style={{position:"relative"}}>
456
+ <Tt.View style={{position:"absolute",left:R.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
457
+ <ns.Search size={20}color={R.colors.textMuted}/>
458
+ </Tt.View>
456
459
 
457
- <Mt.TextInput value={M}onChangeText={R}placeholder={C||I}placeholderTextColor={S.colors.textMuted}style={{backgroundColor:S.colors.surfaceSecondary,borderRadius:S.borderRadius.full,paddingLeft:48,paddingRight:40,paddingVertical:S.spacing.md,color:S.colors.text,fontSize:S.typography.fontSize.base}}autoCapitalize="none"autoCorrect={!1}clearButtonMode="never"/>
460
+ <Tt.TextInput value={C}onChangeText={S}placeholder={M||I}placeholderTextColor={R.colors.textMuted}style={{backgroundColor:R.colors.surfaceSecondary,borderRadius:R.borderRadius.full,paddingLeft:48,paddingRight:40,paddingVertical:R.spacing.md,color:R.colors.text,fontSize:R.typography.fontSize.base}}autoCapitalize="none"autoCorrect={!1}clearButtonMode="never"/>
458
461
 
459
- {M.length>0&&<Mt.TouchableOpacity onPress={T}style={{position:"absolute",right:S.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
460
- <Go.X size={20}color={S.colors.textMuted}/>
461
- </Mt.TouchableOpacity>}
462
- </Mt.View>
463
- </Mt.View>},ms=Fa;var ut=require("react"),_o=$(require("dayjs")),wt=(0,_o.default)(),Js=wt.subtract(1,"day"),Xs=wt.subtract(2,"day"),Zs=wt.subtract(3,"day"),Oa=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:Zs.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:Zs.hour(10).minute(31).toISOString(),reactions:[{emoji:"\u2764\uFE0F",count:1,users:["anna"]}]},{id:3,text:"Good too! What are we doing tonight?",isMe:!1,timestamp:Xs.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Xs.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:Js.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:Js.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:wt.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:wt.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:wt.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:wt.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],ps=M=>{let R=Oa.map(v=>v.isMe?v:{...v,senderName:M||v.senderName}),[T,C]=(0,ut.useState)(R),S=(0,ut.useCallback)((v,B)=>{if(console.log("sendMessage called with text:",v,"and replyTo:",B),!v.trim())return;let k={id:Date.now(),text:v.trim(),isMe:!0,timestamp:(0,_o.default)().toISOString(),status:"sent",replyTo:B};C(A=>[...A,k]),setTimeout(()=>{C(A=>A.map(z=>z.id===k.id?{...z,status:"delivered"}:z))},1e3),setTimeout(()=>{C(A=>A.map(z=>z.id===k.id?{...z,status:"read"}:z))},3e3)},[]),V=(0,ut.useCallback)((v,B,k)=>{let A={id:Date.now(),text:B||"",isMe:!0,timestamp:(0,_o.default)().toISOString(),status:"sent",type:"image",imageData:v,replyTo:k};C(z=>[...z,A]),setTimeout(()=>{C(z=>z.map(L=>L.id===A.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{C(z=>z.map(L=>L.id===A.id?{...L,status:"read"}:L))},3e3)},[]),I=(0,ut.useCallback)((v,B)=>{C(k=>k.map(A=>A.id===v?{...A,status:B}:A))},[]),P=(0,ut.useCallback)((v,B)=>{C(k=>k.map(A=>{if(A.id===v){let z=A.reactions||[],L=z.findIndex(O=>O.emoji===B);if(L>=0){let O=[...z];return O[L]={...O[L],count:O[L].count+1,users:[...O[L].users,"me"]},{...A,reactions:O}}else{let O={emoji:B,count:1,users:["me"]};return{...A,reactions:[...z,O]}}}return A}))},[]),D=(0,ut.useCallback)((v,B)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",B),C(k=>k.map(A=>{if(A.id===v){let z=A.reactions||[],L=z.findIndex(O=>O.emoji===B);if(L>=0){let O=z[L];if(O.count>1){let j=[...z];return j[L]={...O,count:O.count-1,users:O.users.filter(H=>H!=="me")},{...A,reactions:j}}else return{...A,reactions:z.filter(j=>j.emoji!==B)}}}return A}))},[]),E=(0,ut.useCallback)(v=>{console.log("deleteMessage called with messageId:",v),C(B=>{let k=B.map(A=>A.id===v?{...A,deleted:!0}:A);return console.log("Message marked as deleted:",v),k})},[]);return{messages:T,sendMessage:S,sendImageMessage:V,updateMessageStatus:I,addReaction:P,deleteMessage:E,removeReaction:D}};var qe=require("react");var gs=(M={})=>{vt();let[R,T]=(0,qe.useState)(M.initialMessages||[]),[C,S]=(0,qe.useState)(!1),V=(0,qe.useCallback)((z,L)=>{let O={id:Date.now(),text:z,isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:L?{id:L.id,text:L.text,senderName:L.senderName,isMe:L.isMe}:void 0};T(j=>[O,...j])},[]),I=(0,qe.useCallback)(z=>{T(L=>[z,...L])},[]),P=(0,qe.useCallback)((z,L)=>{T(O=>O.map(j=>j.id===z?{...j,...L}:j))},[]),D=(0,qe.useCallback)(z=>{T(L=>L.filter(O=>O.id!==z))},[]),E=(0,qe.useCallback)((z,L)=>{T(O=>O.map(j=>{if(j.id!==z)return j;let H=j.reactions||[];if(H.find(F=>F.emoji===L))return{...j,reactions:H.map(F=>F.emoji===L?{...F,count:F.count+1,users:[...F.users,"current-user"]}:F)};{let F={emoji:L,count:1,users:["current-user"]};return{...j,reactions:[...H,F]}}}))},[]),v=(0,qe.useCallback)((z,L)=>{T(O=>O.map(j=>{if(j.id!==z)return j;let H=j.reactions||[],N=H.find(F=>F.emoji===L);return N?N.count<=1?{...j,reactions:H.filter(F=>F.emoji!==L)}:{...j,reactions:H.map(F=>F.emoji===L?{...F,count:F.count-1,users:F.users.filter(te=>te!=="current-user")}:F)}:j}))},[]),B=(0,qe.useCallback)(z=>{S(z)},[]),k=(0,qe.useCallback)(()=>{T(M.initialMessages||[]),S(!1)},[M.initialMessages]),A=(0,qe.useCallback)(z=>R.find(L=>L.id===z),[R]);return{messages:R,isTyping:C,sendMessage:V,addReaction:E,removeReaction:v,setMessages:T,addMessage:I,updateMessage:P,deleteMessage:D,setTyping:B,resetChat:k,getMessageById:A}};var Jo=require("react");var Qs=()=>{let M=ke(),R=()=>"en";return{formatDate:P=>Ds(P,M,R()),formatTime:P=>Jt(P,R()),formatRelative:P=>ks(P,R()),formatDateTimeWithTime:P=>Ls(P,M,R()),groupMessages:P=>Ao(P,R())}};var Ha=He(ts),Na=He(es),Wa=st(Gt),Ua=He(pt),Ka=He(mt),qa=He(Po),Ya=He(Ft),$a=He(ds),Ga=He(Ro),_a=He(us),Ja=He(ms),Xa=He(Co),Za=He(St),Qa=He(vs),en=st(Y),tn=st(gs),on=st(ps),sn=st(eo),an=st(to),nn=st(oo),rn=st(_t),ln=st(Qt),cn=st(Qs);0&&(module.exports={AttachmentMenu,Chat,ChatAvatar,ChatHeader,ChatItem,ChatList,ChatListSearchBar,ChatProvider,ChatScreenHeader,I18nProvider,MessageInput,MessageList,ThemeProvider,TypingIndicator,defaultTheme,defaultTranslations,getAuthState,getProjectId,getTranslation,initChat,isInitialized,isSupportedLocale,useAttachments,useChatConfig,useChatMessages,useChatSDK,useDateFormatter,useMessageActions,useMessageInput,useMessageList,useMessageReactions,useTheme,useTranslation,useTranslationFunction});
462
+ {C.length>0&&<Tt.TouchableOpacity onPress={T}style={{position:"absolute",right:R.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
463
+ <ns.X size={20}color={R.colors.textMuted}/>
464
+ </Tt.TouchableOpacity>}
465
+ </Tt.View>
466
+ </Tt.View>},Ss=Za;var ut=require("react"),rs=Y(require("dayjs")),vt=(0,rs.default)(),ra=vt.subtract(1,"day"),ia=vt.subtract(2,"day"),la=vt.subtract(3,"day"),Qa=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:la.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:la.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:ia.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:ia.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:ra.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:ra.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:vt.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:vt.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:vt.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:vt.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],Rs=C=>{let S=Qa.map(v=>v.isMe?v:{...v,senderName:C||v.senderName}),[T,M]=(0,ut.useState)(S),R=(0,ut.useCallback)((v,B)=>{if(console.log("sendMessage called with text:",v,"and replyTo:",B),!v.trim())return;let k={id:Date.now(),text:v.trim(),isMe:!0,timestamp:(0,rs.default)().toISOString(),status:"sent",replyTo:B};M(z=>[...z,k]),setTimeout(()=>{M(z=>z.map(D=>D.id===k.id?{...D,status:"delivered"}:D))},1e3),setTimeout(()=>{M(z=>z.map(D=>D.id===k.id?{...D,status:"read"}:D))},3e3)},[]),A=(0,ut.useCallback)((v,B,k)=>{let z={id:Date.now(),text:B||"",isMe:!0,timestamp:(0,rs.default)().toISOString(),status:"sent",type:"image",imageData:v,replyTo:k};M(D=>[...D,z]),setTimeout(()=>{M(D=>D.map(L=>L.id===z.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{M(D=>D.map(L=>L.id===z.id?{...L,status:"read"}:L))},3e3)},[]),I=(0,ut.useCallback)((v,B)=>{M(k=>k.map(z=>z.id===v?{...z,status:B}:z))},[]),P=(0,ut.useCallback)((v,B)=>{M(k=>k.map(z=>{if(z.id===v){let D=z.reactions||[],L=D.findIndex(O=>O.emoji===B);if(L>=0){let O=[...D];return O[L]={...O[L],count:O[L].count+1,users:[...O[L].users,"me"]},{...z,reactions:O}}else{let O={emoji:B,count:1,users:["me"]};return{...z,reactions:[...D,O]}}}return z}))},[]),V=(0,ut.useCallback)((v,B)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",B),M(k=>k.map(z=>{if(z.id===v){let D=z.reactions||[],L=D.findIndex(O=>O.emoji===B);if(L>=0){let O=D[L];if(O.count>1){let j=[...D];return j[L]={...O,count:O.count-1,users:O.users.filter(H=>H!=="me")},{...z,reactions:j}}else return{...z,reactions:D.filter(j=>j.emoji!==B)}}}return z}))},[]),E=(0,ut.useCallback)(v=>{console.log("deleteMessage called with messageId:",v),M(B=>{let k=B.map(z=>z.id===v?{...z,deleted:!0}:z);return console.log("Message marked as deleted:",v),k})},[]);return{messages:T,sendMessage:R,sendImageMessage:A,updateMessageStatus:I,addReaction:P,deleteMessage:E,removeReaction:V}};var $e=require("react");var ws=(C={})=>{At();let[S,T]=(0,$e.useState)(C.initialMessages||[]),[M,R]=(0,$e.useState)(!1),A=(0,$e.useCallback)((D,L)=>{let O={id:Date.now(),text:D,isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:L?{id:L.id,text:L.text,senderName:L.senderName,isMe:L.isMe}:void 0};T(j=>[O,...j])},[]),I=(0,$e.useCallback)(D=>{T(L=>[D,...L])},[]),P=(0,$e.useCallback)((D,L)=>{T(O=>O.map(j=>j.id===D?{...j,...L}:j))},[]),V=(0,$e.useCallback)(D=>{T(L=>L.filter(O=>O.id!==D))},[]),E=(0,$e.useCallback)((D,L)=>{T(O=>O.map(j=>{if(j.id!==D)return j;let H=j.reactions||[];if(H.find(F=>F.emoji===L))return{...j,reactions:H.map(F=>F.emoji===L?{...F,count:F.count+1,users:[...F.users,"current-user"]}:F)};{let F={emoji:L,count:1,users:["current-user"]};return{...j,reactions:[...H,F]}}}))},[]),v=(0,$e.useCallback)((D,L)=>{T(O=>O.map(j=>{if(j.id!==D)return j;let H=j.reactions||[],N=H.find(F=>F.emoji===L);return N?N.count<=1?{...j,reactions:H.filter(F=>F.emoji!==L)}:{...j,reactions:H.map(F=>F.emoji===L?{...F,count:F.count-1,users:F.users.filter(te=>te!=="current-user")}:F)}:j}))},[]),B=(0,$e.useCallback)(D=>{R(D)},[]),k=(0,$e.useCallback)(()=>{T(C.initialMessages||[]),R(!1)},[C.initialMessages]),z=(0,$e.useCallback)(D=>S.find(L=>L.id===D),[S]);return{messages:S,isTyping:M,sendMessage:A,addReaction:E,removeReaction:v,setMessages:T,addMessage:I,updateMessage:P,deleteMessage:V,setTyping:B,resetChat:k,getMessageById:z}};var is=require("react");var ca=()=>{let C=ke(),S=()=>"en";return{formatDate:P=>Us(P,C,S()),formatTime:P=>eo(P,S()),formatRelative:P=>Ks(P,S()),formatDateTimeWithTime:P=>$s(P,C,S()),groupMessages:P=>Wo(P,S())}};var en=He(ms),tn=He(us),on=at(Zt),sn=He(pt),an=He(mt),nn=He(No),rn=He(Ht),ln=He(Ts),cn=He(Vo),dn=He(Ms),un=He(Ss),mn=He(Do),pn=He(It),gn=He(Es),hn=at(q),fn=at(ws),yn=at(Rs),xn=at(So),bn=at(Ro),Cn=at(wo),Tn=at(Qt),Mn=at(Mo),Sn=at(ca);0&&(module.exports={AttachmentMenu,Chat,ChatAvatar,ChatHeader,ChatItem,ChatList,ChatListSearchBar,ChatProvider,ChatScreenHeader,I18nProvider,MessageInput,MessageList,ThemeProvider,TypingIndicator,defaultTheme,defaultTranslations,getAuthState,getInitStatus,getProjectId,getTranslation,initChat,isInitialized,isInitializing,isSupportedLocale,useAttachments,useChatConfig,useChatMessages,useChatSDK,useDateFormatter,useMessageActions,useMessageInput,useMessageList,useMessageReactions,useTheme,useTranslation,useTranslationFunction});