movius-chats 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +48 -27
  2. package/lib/commonjs/index.js +14 -1
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/module/index.js +14 -1
  5. package/lib/module/index.js.map +1 -1
  6. package/lib/typescript/assets/Icons/FileIcon.d.ts +5 -0
  7. package/lib/typescript/assets/Icons/LoadingIcon.d.ts +6 -3
  8. package/lib/typescript/assets/Icons/XIcon.d.ts +1 -1
  9. package/lib/typescript/components/ChatInput/ChatInput.d.ts +2 -2
  10. package/lib/typescript/components/ChatInput/FilePreview.d.ts +4 -0
  11. package/lib/typescript/components/ChatInput/TruncateFileName.d.ts +7 -0
  12. package/lib/typescript/components/ChatInput/types.d.ts +18 -2
  13. package/lib/typescript/context/ChatContext.d.ts +2 -2
  14. package/lib/typescript/types/index.d.ts +24 -2
  15. package/package.json +8 -7
  16. package/src/assets/Icons/FileIcon.tsx +22 -0
  17. package/src/assets/Icons/LoadingIcon.tsx +38 -10
  18. package/src/assets/Icons/XIcon.tsx +7 -7
  19. package/src/components/ChatBubble/ChatBubble.tsx +2 -2
  20. package/src/components/ChatBubble/MessageContent.tsx +18 -7
  21. package/src/components/ChatInput/ChatInput.tsx +152 -120
  22. package/src/components/ChatInput/FilePreview.tsx +161 -0
  23. package/src/components/ChatInput/TruncateFileName.tsx +33 -0
  24. package/src/components/ChatInput/types.ts +8 -2
  25. package/src/components/MediaViewer/MediaViewer.tsx +4 -6
  26. package/src/components/TypingComponent/TypingIndicator.tsx +3 -6
  27. package/src/context/ChatContext.tsx +4 -4
  28. package/src/index.tsx +6 -0
  29. package/src/types/index.ts +14 -2
  30. package/lib/commonjs/assets/Icons/ArrowBack2RoundedIcon.js +0 -2
  31. package/lib/commonjs/assets/Icons/ArrowBack2RoundedIcon.js.map +0 -1
  32. package/lib/commonjs/assets/Icons/CameraIcon.js +0 -2
  33. package/lib/commonjs/assets/Icons/CameraIcon.js.map +0 -1
  34. package/lib/commonjs/assets/Icons/CheckAllIcon.js +0 -2
  35. package/lib/commonjs/assets/Icons/CheckAllIcon.js.map +0 -1
  36. package/lib/commonjs/assets/Icons/CheckIcon.js +0 -2
  37. package/lib/commonjs/assets/Icons/CheckIcon.js.map +0 -1
  38. package/lib/commonjs/assets/Icons/EmojiFunnySquareIcon.js +0 -2
  39. package/lib/commonjs/assets/Icons/EmojiFunnySquareIcon.js.map +0 -1
  40. package/lib/commonjs/assets/Icons/LoadingIcon.js +0 -2
  41. package/lib/commonjs/assets/Icons/LoadingIcon.js.map +0 -1
  42. package/lib/commonjs/assets/Icons/MicrophoneIcon.js +0 -2
  43. package/lib/commonjs/assets/Icons/MicrophoneIcon.js.map +0 -1
  44. package/lib/commonjs/assets/Icons/PaperClipIcon.js +0 -2
  45. package/lib/commonjs/assets/Icons/PaperClipIcon.js.map +0 -1
  46. package/lib/commonjs/assets/Icons/PaperPlaneIcon.js +0 -2
  47. package/lib/commonjs/assets/Icons/PaperPlaneIcon.js.map +0 -1
  48. package/lib/commonjs/assets/Icons/PauseIcon.js +0 -2
  49. package/lib/commonjs/assets/Icons/PauseIcon.js.map +0 -1
  50. package/lib/commonjs/assets/Icons/PlayIcon.js +0 -2
  51. package/lib/commonjs/assets/Icons/PlayIcon.js.map +0 -1
  52. package/lib/commonjs/assets/Icons/XIcon.js +0 -2
  53. package/lib/commonjs/assets/Icons/XIcon.js.map +0 -1
  54. package/lib/commonjs/components/AudioPlayer/AudioPlayer.js +0 -2
  55. package/lib/commonjs/components/AudioPlayer/AudioPlayer.js.map +0 -1
  56. package/lib/commonjs/components/ChatBubble/ChatBubble.js +0 -2
  57. package/lib/commonjs/components/ChatBubble/ChatBubble.js.map +0 -1
  58. package/lib/commonjs/components/ChatBubble/MessageContent.js +0 -2
  59. package/lib/commonjs/components/ChatBubble/MessageContent.js.map +0 -1
  60. package/lib/commonjs/components/ChatBubble/MessageStatus.js +0 -2
  61. package/lib/commonjs/components/ChatBubble/MessageStatus.js.map +0 -1
  62. package/lib/commonjs/components/ChatInput/ChatInput.js +0 -2
  63. package/lib/commonjs/components/ChatInput/ChatInput.js.map +0 -1
  64. package/lib/commonjs/components/MediaViewer/MediaViewer.js +0 -2
  65. package/lib/commonjs/components/MediaViewer/MediaViewer.js.map +0 -1
  66. package/lib/commonjs/components/TypingComponent/TypingIndicator.js +0 -2
  67. package/lib/commonjs/components/TypingComponent/TypingIndicator.js.map +0 -1
  68. package/lib/commonjs/context/AudioContext.js +0 -2
  69. package/lib/commonjs/context/AudioContext.js.map +0 -1
  70. package/lib/commonjs/context/ChatContext.js +0 -2
  71. package/lib/commonjs/context/ChatContext.js.map +0 -1
  72. package/lib/commonjs/utils/datefunc.js +0 -2
  73. package/lib/commonjs/utils/datefunc.js.map +0 -1
  74. package/lib/module/assets/Icons/ArrowBack2RoundedIcon.js +0 -2
  75. package/lib/module/assets/Icons/ArrowBack2RoundedIcon.js.map +0 -1
  76. package/lib/module/assets/Icons/CameraIcon.js +0 -2
  77. package/lib/module/assets/Icons/CameraIcon.js.map +0 -1
  78. package/lib/module/assets/Icons/CheckAllIcon.js +0 -2
  79. package/lib/module/assets/Icons/CheckAllIcon.js.map +0 -1
  80. package/lib/module/assets/Icons/CheckIcon.js +0 -2
  81. package/lib/module/assets/Icons/CheckIcon.js.map +0 -1
  82. package/lib/module/assets/Icons/EmojiFunnySquareIcon.js +0 -2
  83. package/lib/module/assets/Icons/EmojiFunnySquareIcon.js.map +0 -1
  84. package/lib/module/assets/Icons/LoadingIcon.js +0 -2
  85. package/lib/module/assets/Icons/LoadingIcon.js.map +0 -1
  86. package/lib/module/assets/Icons/MicrophoneIcon.js +0 -2
  87. package/lib/module/assets/Icons/MicrophoneIcon.js.map +0 -1
  88. package/lib/module/assets/Icons/PaperClipIcon.js +0 -2
  89. package/lib/module/assets/Icons/PaperClipIcon.js.map +0 -1
  90. package/lib/module/assets/Icons/PaperPlaneIcon.js +0 -2
  91. package/lib/module/assets/Icons/PaperPlaneIcon.js.map +0 -1
  92. package/lib/module/assets/Icons/PauseIcon.js +0 -2
  93. package/lib/module/assets/Icons/PauseIcon.js.map +0 -1
  94. package/lib/module/assets/Icons/PlayIcon.js +0 -2
  95. package/lib/module/assets/Icons/PlayIcon.js.map +0 -1
  96. package/lib/module/assets/Icons/XIcon.js +0 -2
  97. package/lib/module/assets/Icons/XIcon.js.map +0 -1
  98. package/lib/module/components/AudioPlayer/AudioPlayer.js +0 -2
  99. package/lib/module/components/AudioPlayer/AudioPlayer.js.map +0 -1
  100. package/lib/module/components/ChatBubble/ChatBubble.js +0 -2
  101. package/lib/module/components/ChatBubble/ChatBubble.js.map +0 -1
  102. package/lib/module/components/ChatBubble/MessageContent.js +0 -2
  103. package/lib/module/components/ChatBubble/MessageContent.js.map +0 -1
  104. package/lib/module/components/ChatBubble/MessageStatus.js +0 -2
  105. package/lib/module/components/ChatBubble/MessageStatus.js.map +0 -1
  106. package/lib/module/components/ChatInput/ChatInput.js +0 -2
  107. package/lib/module/components/ChatInput/ChatInput.js.map +0 -1
  108. package/lib/module/components/MediaViewer/MediaViewer.js +0 -2
  109. package/lib/module/components/MediaViewer/MediaViewer.js.map +0 -1
  110. package/lib/module/components/TypingComponent/TypingIndicator.js +0 -2
  111. package/lib/module/components/TypingComponent/TypingIndicator.js.map +0 -1
  112. package/lib/module/context/AudioContext.js +0 -2
  113. package/lib/module/context/AudioContext.js.map +0 -1
  114. package/lib/module/context/ChatContext.js +0 -2
  115. package/lib/module/context/ChatContext.js.map +0 -1
  116. package/lib/module/utils/datefunc.js +0 -2
  117. package/lib/module/utils/datefunc.js.map +0 -1
package/README.md CHANGED
@@ -61,6 +61,7 @@ module.exports = {
61
61
  After installing this package and its dependencies:
62
62
 
63
63
  1. **For React Native CLI Projects**:
64
+
64
65
  ```bash
65
66
  npx pod-install # For iOS
66
67
  npx react-native run-android # Rebuild for Android
@@ -110,20 +111,20 @@ const App = () => {
110
111
 
111
112
  ### Core Props
112
113
 
113
- | Prop | Type | Required | Description |
114
- |------|------|----------|-------------|
115
- | messages | Message[] | Yes | Array of message objects to display |
116
- | currentUserId | string | Yes | ID of the current user |
117
- | onSendMessage | (message: Omit<Message, "id" \| "time" \| "status">) => void | Yes | Callback when a message is sent |
118
- | onMessageLongPress | (message: Message) => void | No | Callback for long-pressing a message |
119
- | onAttachmentPress | () => void | No | Callback for attachment button press |
120
- | onAudioRecordStart | () => void | No | Callback when audio recording starts |
121
- | onAudioRecordEnd | () => void | No | Callback when audio recording ends |
122
- | onCameraPress | () => void | No | Callback for camera button press |
123
- | onTypingStart | () => void | No | Callback when user starts typing |
124
- | onTypingEnd | () => void | No | Callback when user stops typing |
125
- | placeholder | string | No | Input placeholder text |
126
- | typingUsers | Array<{ id: string; avatar: string; name: string }> | No | List of users who are typing |
114
+ | Prop | Type | Required | Description |
115
+ | ------------------ | ------------------------------------------------------------ | -------- | ---------------------------------------------------------------------- |
116
+ | messages | Message[] | Yes | Array of message objects to display |
117
+ | currentUserId | string | Yes | ID of the current user |
118
+ | onSendMessage | (message: Omit<Message, "id" \| "time" \| "status">) => void | Yes | Callback when a message is sent |
119
+ | onMessageLongPress | (message: Message) => void | No | Callback for long-pressing a message |
120
+ | onAttachmentPress | () => void | No | Callback for attachment button press |
121
+ | onAudioRecordStart | () => void | No | Callback when audio recording starts |
122
+ | onAudioRecordEnd | () => void | No | Callback when audio recording ends |
123
+ | onCameraPress | () => void | No | Callback for camera button press |
124
+ | onTypingStart | () => void | No | Callback when user starts typing |
125
+ | onTypingEnd | () => void | No | Callback when user stops typing |
126
+ | placeholder | string | No | Input placeholder text |
127
+ | typingUsers | Array<{ id: string; avatar: string; name: string }> | No | List of users who are typing |
127
128
 
128
129
  ### Theming
129
130
 
@@ -166,23 +167,34 @@ The component supports extensive theming through the `theme` prop:
166
167
  inputContainerStyle?: ViewStyle;
167
168
  sendButtonStyle?: ViewStyle;
168
169
  };
170
+ filePreviewStyle?: {
171
+ root?: ViewStyle;
172
+ container?: ViewStyle;
173
+ iconContainer?: ViewStyle;
174
+ nameContainer?: ViewStyle;
175
+ text?: TextStyle;
176
+ };
169
177
  };
170
178
  ```
171
179
 
172
180
  ### Custom Components
173
181
 
174
- | Prop | Type | Description |
175
- |------|------|-------------|
176
- | renderCustomInput | () => React.ReactNode | Custom input component |
177
- | renderCustomVideoBubbleError | () => React.ReactNode | Custom video error display |
178
- | renderCustomTyping | () => React.ReactNode | Custom typing indicator |
179
- | CustomEmojiIcon | () => React.ReactNode | Custom emoji picker icon |
180
- | CustomAttachmentIcon | () => React.ReactNode | Custom attachment icon |
181
- | CustomCameraIcon | () => React.ReactNode | Custom camera icon |
182
- | CustomSendIcon | () => React.ReactNode | Custom send button icon |
183
- | CustomMicrophoneIcon | () => React.ReactNode | Custom microphone icon |
184
- | CustomPlayIcon | () => React.ReactNode | Custom play icon |
185
- | CustomPauseIcon | () => React.ReactNode | Custom pause icon |
182
+ | Prop | Type | Description |
183
+ | ---------------------------- | ------------------------------------ | -------------------------- | ------------------------------- |
184
+ | renderCustomInput | () => React.ReactNode | Custom input component |
185
+ | renderCustomVideoBubbleError | () => React.ReactNode | Custom video error display |
186
+ | renderCustomTyping | () => React.ReactNode | Custom typing indicator |
187
+ | CustomEmojiIcon | () => React.ReactNode | Custom emoji picker icon |
188
+ | CustomAttachmentIcon | () => React.ReactNode | Custom attachment icon |
189
+ | CustomCameraIcon | () => React.ReactNode | Custom camera icon |
190
+ | CustomSendIcon | () => React.ReactNode | Custom send button icon |
191
+ | CustomMicrophoneIcon | () => React.ReactNode | Custom microphone icon |
192
+ | CustomPlayIcon | () => React.ReactNode | Custom play icon |
193
+ | CustomPauseIcon | () => React.ReactNode | Custom pause icon |
194
+ | CustomFileIcon | React.ComponentType<{ style?: any }> | Custom file icon |
195
+ | CustomImagePreview | React.ComponentType<{ uri: string }> | Custom image preview component. |
196
+ | CustomVideoPreview | React.ComponentType<{ uri: string }> | Custom video preview component. |
197
+
186
198
 
187
199
  ## Advanced Usage
188
200
 
@@ -209,6 +221,13 @@ The component supports extensive theming through the `theme` prop:
209
221
  borderRadius: 20,
210
222
  },
211
223
  },
224
+ filePreviewStyle: {
225
+ root: { top: 10, left: 10 },
226
+ container: { backgroundColor: '#f0f0f0', borderRadius: 16 },
227
+ iconContainer: { backgroundColor: '#333' },
228
+ nameContainer: { backgroundColor: '#eee' },
229
+ text: { color: 'red', fontWeight: 'bold' },
230
+ },
212
231
  }}
213
232
  />
214
233
  ```
@@ -218,11 +237,13 @@ The component supports extensive theming through the `theme` prop:
218
237
  If you're using Expo, follow these steps:
219
238
 
220
239
  1. Create a development build of your app:
240
+
221
241
  ```bash
222
242
  npx expo prebuild
223
243
  ```
224
244
 
225
245
  2. Run on your desired platform:
246
+
226
247
  ```bash
227
248
  npx expo run:android
228
249
  # or
@@ -259,4 +280,4 @@ MIT
259
280
 
260
281
  ## Support
261
282
 
262
- For issues and feature requests, please file an issue on the GitHub repository.
283
+ For issues and feature requests, please file an issue on the GitHub repository.
@@ -1,2 +1,15 @@
1
- "use strict";require("react");var e=require("react-native"),n=require("twrnc"),r=require("./components/ChatBubble/ChatBubble.js"),t=require("./components/ChatInput/ChatInput.js"),o=require("./components/MediaViewer/MediaViewer.js"),s=require("./components/TypingComponent/TypingIndicator.js"),i=require("./context/AudioContext.js"),a=require("./context/ChatContext.js"),d=require("react/jsx-runtime");const c=()=>{const{messages:i,currentUserId:c,onMessageLongPress:u,mediaUrl:m,setMediaUrl:C,setIsVideoPlaying:l,typingUsers:p,onSendMessage:I,onTypingStart:g,onTypingEnd:x,onAttachmentPress:h,onAudioRecordEnd:j,onAudioRecordStart:U,onCameraPress:y,renderCustomInput:q,CustomEmojiIcon:A,CustomAttachmentIcon:S,CustomCameraIcon:v,CustomMicrophoneIcon:P,CustomSendIcon:M}=a.useChatContext();return d.jsxs(e.View,{style:n`flex-1 px-2 pb-4 gap-2 relative`,children:[d.jsx(e.FlatList,{data:i,keyExtractor:e=>e.id,renderItem:({item:e,index:n})=>d.jsx(r,{message:e,isCurrentUser:e.senderId===c,onLongPress:()=>u?.(e),isFirstInSequence:n===i.length-1||i[n+1]?.senderId!==e.senderId}),ListHeaderComponent:d.jsx(s.TypingIndicator,{typingUsers:p||[],currentUserId:c}),showsVerticalScrollIndicator:!1,inverted:!0}),q?q():d.jsx(t,{onSendMessage:I,onTypingStart:g,onTypingEnd:x,onAttachmentPress:h,onAudioRecordEnd:j,onAudioRecordStart:U,onCameraPress:y,CustomEmojiIcon:A,CustomAttachmentIcon:S,CustomCameraIcon:v,CustomMicrophoneIcon:P,CustomSendIcon:M}),d.jsx(o,{imageUrl:m.imageUrl,videoUrl:m.videoUrl,onClose:()=>{C({imageUrl:"",videoUrl:""}),l(!1)}})]})};module.exports=e=>d.jsx(i.AudioProvider,{children:d.jsx(a.ChatProvider,{...e,children:d.jsx(c,{})})});
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react-native"),r=require("twrnc"),n=require("react"),o=require("react-native-svg"),i=require("react-native-video"),s=require("react-native-reanimated"),l=require("react-native-sound"),a=require("react-native-image-zoom-viewer");function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r){return t=y(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,h()?Reflect.construct(t,r||[],y(e).constructor):t.apply(e,r))}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,j(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e,t,r){return(t=j(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function x(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,l=[],a=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t);else for(;!(a=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{if(!a&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function j(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var P,S,C,O,I,A,T,E=function(t){var r=t.style,n=t.color;return e.jsx(o,{style:r,viewBox:"0 0 48 48",children:e.jsx(o.Path,{fill:n,fillRule:"evenodd",stroke:n,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4",d:"M8 9.115c0-1.82 2.235-2.694 3.47-1.356l29.432 31.884c1.182 1.282.273 3.357-1.47 3.357H10a2 2 0 0 1-2-2z",clipRule:"evenodd"})})},M=["children"],k=n.createContext(void 0),V=function(t){var r=t.children,o=x(t,M),i=g(n.useState({imageUrl:"",videoUrl:""}),2),s=i[0],l=i[1],a=g(n.useState(!1),2),u=a[0],c=a[1];return e.jsx(k.Provider,{value:m(m({},o),{},{mediaUrl:s,setMediaUrl:l,isVideoPlaying:u,setIsVideoPlaying:c}),children:r})},R=function(){var e=n.useContext(k);if(!e)throw new Error("useChatContext must be used within a ChatProvider");return e},_=function(r){var i=r.style,s=r.spinning,l=void 0!==s&&s,a=n.useRef(new t.Animated.Value(0)).current;n.useEffect((function(){l&&t.Animated.loop(t.Animated.timing(a,{toValue:1,duration:1e3,easing:t.Easing.linear,useNativeDriver:!0})).start()}),[l]);var u=a.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return e.jsx(t.Animated.View,{style:l?{transform:[{rotate:u}]}:void 0,children:e.jsx(o,{style:i,viewBox:"0 0 1024 1024",children:e.jsx(o.Path,{d:"M988 548c-19.9 0-36-16.1-36-36c0-59.4-11.6-117-34.6-171.3a440.5 440.5 0 0 0-94.3-139.9a437.7 437.7 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150s83.9 101.8 109.7 162.7c26.7 63.1 40.2 130.2 40.2 199.3c.1 19.9-16 36-35.9 36",fill:"white"})})})},N=function(t){var r=t.style,n=t.color;return e.jsx(o,{style:r,viewBox:"0 0 24 24",children:e.jsx(o.Path,{fill:n,d:"M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712"})})},z=function(e){var t=Math.floor(e/60),r=Math.floor(e%60);return"".concat(t,":").concat(r<10?"0":"").concat(r)},$=function(t){var r=t.style,n=t.color;return e.jsx(o,{style:r,viewBox:"0 0 15 15",children:e.jsx(o.Path,{fill:n,fillRule:"evenodd",d:"M6.05 2.75a.55.55 0 0 0-1.1 0v9.5a.55.55 0 0 0 1.1 0zm4 0a.55.55 0 0 0-1.1 0v9.5a.55.55 0 0 0 1.1 0z",clipRule:"evenodd"})})},U=n.createContext(void 0),L=function(t){var r=t.children,o=g(n.useState(null),2),i=o[0],s=o[1];return e.jsx(U.Provider,{value:{currentlyPlayingId:i,setCurrentlyPlayingId:s},children:r})},q={code:"function AudioPlayerTsx1(){const{knobPosition}=this.__closure;return{transform:[{translateX:knobPosition.value}]};}",location:"/home/eadav/Documents/packages/Movius-Chats/src/components/AudioPlayer/AudioPlayer.tsx",sourceMap:'{"version":3,"names":["AudioPlayerTsx1","knobPosition","__closure","transform","translateX","value"],"sources":["/home/eadav/Documents/packages/Movius-Chats/src/components/AudioPlayer/AudioPlayer.tsx"],"mappings":"AAgH2C,SAAAA,eAAMA,CAAA,QAAAC,YAAA,OAAAC,SAAA,CACzC,MAAO,CACHC,SAAS,CAAE,CAAC,CAAEC,UAAU,CAAEH,YAAY,CAACI,KAAM,CAAC,CAClD,CAAC,CACL","ignoreList":[]}',version:"3.16.7"},B=function(o){var i,a,u,c,d,f,p,y=o.audioUrl,h=o.audioId,v=o.isVideoPlaying,x=R(),b=x.theme,j=x.CustomPlayIcon,E=x.CustomPauseIcon,M=function(){var e=n.useContext(U);if(!e)throw new Error("useAudio must be used within an AudioProvider");return e}(),k=M.currentlyPlayingId,V=M.setCurrentlyPlayingId,_=g(n.useState(null),2),L=_[0],B=_[1],D=g(n.useState(!1),2),F=D[0],W=D[1],H=g(n.useState(0),2),Y=H[0],X=H[1],Z=g(n.useState(0),2),G=Z[0],Q=Z[1],J=g(n.useState(!1),2),K=J[0],ee=J[1],te=n.useRef(null),re=n.useRef(0),ne=n.useRef(0),oe=n.useRef(0),ie=s.useSharedValue(0);n.useEffect((function(){var e=!0,t=new l(y,"",(function(r){!r&&e&&Q(t.getDuration())}));return B(t),function(){e=!1,t&&(t.pause(),t.release())}}),[y]),n.useEffect((function(){k&&k!==h&&F&&L&&(L.pause(),W(!1),X(0),ie.value=0)}),[k,h,F,L]),n.useEffect((function(){var e;return F&&L&&!K&&(e=setInterval((function(){L.getCurrentTime((function(e){if("number"==typeof e&&!isNaN(e)&&(X(e),re.current>0&&G>0)){var t=e/G*re.current;isNaN(t)||(ie.value=s.withSpring(t,{damping:15,stiffness:100}))}}))}),100)),function(){e&&clearInterval(e)}}),[F,L,K,G]);var se,le,ae=t.PanResponder.create({onStartShouldSetPanResponder:function(){return!0},onMoveShouldSetPanResponder:function(){return!0},onPanResponderGrant:function(e){ee(!0),oe.current=e.nativeEvent.pageX-ie.value},onPanResponderMove:function(e){if(re.current>0){var t=e.nativeEvent.pageX-oe.current,r=Math.max(0,Math.min(t,re.current));ie.value=r;var n=r/re.current*G;isNaN(n)||X(n)}},onPanResponderRelease:function(){if(ee(!1),L&&re.current>0){var e=ie.value/re.current*G;isNaN(e)||L.setCurrentTime(e)}},onPanResponderTerminate:function(){ee(!1)}}),ue=s.useAnimatedStyle((se=[new global.Error,-2,-27],(le=function(){return{transform:[{translateX:ie.value}]}}).__closure={knobPosition:ie},le.__workletHash=1935336866997,le.__initData=q,le.__stackDetails=se,le));return n.useEffect((function(){v&&F&&L&&L.pause((function(){W(!1),V(null)}))}),[v]),e.jsxs(t.View,{style:r(P||(P=w(["rounded-lg w-56"]))),children:[e.jsxs(t.View,{style:r(S||(S=w(["flex-row items-center gap-2 px-2 pt-2"]))),children:[e.jsx(t.Pressable,{onPress:function(){L&&(F?L.pause((function(){W(!1),V(null)})):(V(h),L.play((function(e){e&&(W(!1),X(0),ie.value=s.withSpring(0),V(null))})),W(!0)))},style:[r(C||(C=w(["bg-black/40 rounded-full p-2"]))),null==b||null===(i=b.messageStyle)||void 0===i?void 0:i.audioPlayButtonStyle],children:F?E?e.jsx(E,{}):e.jsx($,{style:r.style("h-6 w-6"),color:(null==b||null===(a=b.colors)||void 0===a?void 0:a.audioPauseIconColor)||"white"}):j?e.jsx(j,{}):e.jsx(N,{style:r.style("h-6 w-6"),color:(null==b||null===(u=b.colors)||void 0===u?void 0:u.audioPlayIconColor)||"white"})}),e.jsxs(t.View,{ref:te,onLayout:function(e){var t,r=e.nativeEvent.layout.width;re.current=r,null===(t=te.current)||void 0===t||t.measure((function(e,t,r,n,o){ne.current=o}))},style:[r(O||(O=w(["relative h-1 bg-zinc-400 rounded overflow-visible w-[75%]"]))),null==b||null===(c=b.messageStyle)||void 0===c?void 0:c.progressBarStyle],children:[e.jsx(t.View,{style:[r(I||(I=w(["absolute h-full bg-slate-200"]))),{width:"".concat(G>0?Y/G*100:0,"%")},null==b||null===(d=b.messageStyle)||void 0===d?void 0:d.activeProgressBarStyle]}),e.jsx(s.View,m(m({},ae.panHandlers),{},{style:[ue,{position:"absolute",top:-6,width:16,height:16,borderRadius:8,backgroundColor:"white",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:3.84,elevation:5},m({},null==b||null===(f=b.messageStyle)||void 0===f?void 0:f.audioKnobStyle)]}))]})]}),e.jsx(t.View,{style:r(A||(A=w(["px-4 py-1"]))),children:e.jsx(t.Text,{style:[r(T||(T=w(["text-xs text-gray-500"]))),null==b||null===(p=b.messageStyle)||void 0===p?void 0:p.audioDurationStyle],children:isNaN(Y)?"0:00":z(Y)})})]})},D=n.memo(B);function F(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W,H={exports:{}},Y={exports:{}},X={};var Z,G,Q,J,K,ee,te,re,ne,oe,ie,se,le,ae,ue,ce={};
2
+ /** @license React v16.13.1
3
+ * react-is.development.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */function de(){return G||(G=1,"production"===process.env.NODE_ENV?Y.exports=function(){if(W)return X;W=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,a=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,m=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case a:case u:case n:case i:case o:case d:return e;default:switch(e=e&&e.$$typeof){case l:case c:case y:case p:case s:return e;default:return f}}case r:return f}}}function g(e){return b(e)===u}return X.AsyncMode=a,X.ConcurrentMode=u,X.ContextConsumer=l,X.ContextProvider=s,X.Element=t,X.ForwardRef=c,X.Fragment=n,X.Lazy=y,X.Memo=p,X.Portal=r,X.Profiler=i,X.StrictMode=o,X.Suspense=d,X.isAsyncMode=function(e){return g(e)||b(e)===a},X.isConcurrentMode=g,X.isContextConsumer=function(e){return b(e)===l},X.isContextProvider=function(e){return b(e)===s},X.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},X.isForwardRef=function(e){return b(e)===c},X.isFragment=function(e){return b(e)===n},X.isLazy=function(e){return b(e)===y},X.isMemo=function(e){return b(e)===p},X.isPortal=function(e){return b(e)===r},X.isProfiler=function(e){return b(e)===i},X.isStrictMode=function(e){return b(e)===o},X.isSuspense=function(e){return b(e)===d},X.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===i||e===o||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===p||e.$$typeof===s||e.$$typeof===l||e.$$typeof===c||e.$$typeof===v||e.$$typeof===m||e.$$typeof===x||e.$$typeof===h)},X.typeOf=b,X}():Y.exports=(Z||(Z=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,a=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,m=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var h=e.type;switch(h){case a:case u:case n:case i:case o:case d:return h;default:var v=h&&h.$$typeof;switch(v){case l:case c:case y:case p:case s:return v;default:return f}}case r:return f}}}var g=a,w=u,j=l,P=s,S=t,C=c,O=n,I=y,A=p,T=r,E=i,M=o,k=d,V=!1;function R(e){return b(e)===u}ce.AsyncMode=g,ce.ConcurrentMode=w,ce.ContextConsumer=j,ce.ContextProvider=P,ce.Element=S,ce.ForwardRef=C,ce.Fragment=O,ce.Lazy=I,ce.Memo=A,ce.Portal=T,ce.Profiler=E,ce.StrictMode=M,ce.Suspense=k,ce.isAsyncMode=function(e){return V||(V=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),R(e)||b(e)===a},ce.isConcurrentMode=R,ce.isContextConsumer=function(e){return b(e)===l},ce.isContextProvider=function(e){return b(e)===s},ce.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},ce.isForwardRef=function(e){return b(e)===c},ce.isFragment=function(e){return b(e)===n},ce.isLazy=function(e){return b(e)===y},ce.isMemo=function(e){return b(e)===p},ce.isPortal=function(e){return b(e)===r},ce.isProfiler=function(e){return b(e)===i},ce.isStrictMode=function(e){return b(e)===o},ce.isSuspense=function(e){return b(e)===d},ce.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===i||e===o||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===p||e.$$typeof===s||e.$$typeof===l||e.$$typeof===c||e.$$typeof===v||e.$$typeof===m||e.$$typeof===x||e.$$typeof===h)},ce.typeOf=b}()),ce)),Y.exports}
10
+ /*
11
+ object-assign
12
+ (c) Sindre Sorhus
13
+ @license MIT
14
+ */function fe(){if(J)return Q;J=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return Q=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(n,o){for(var i,s,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(n),a=1;a<arguments.length;a++){for(var u in i=Object(arguments[a]))t.call(i,u)&&(l[u]=i[u]);if(e){s=e(i);for(var c=0;c<s.length;c++)r.call(i,s[c])&&(l[s[c]]=i[s[c]])}}return l},Q}function pe(){if(ee)return K;ee=1;return K="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function ye(){return re?te:(re=1,te=Function.call.bind(Object.prototype.hasOwnProperty))}function he(){if(oe)return ne;oe=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=pe(),r={},n=ye();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,i,s,l,a){if("production"!==process.env.NODE_ENV)for(var u in o)if(n(o,u)){var c;try{if("function"!=typeof o[u]){var d=Error((l||"React class")+": "+s+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}c=o[u](i,u,l,s,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((l||"React class")+": type specification of "+s+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in r)){r[c.message]=!0;var f=a?a():"";e("Failed "+s+" type: "+c.message+(null!=f?f:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},ne=o}function ve(){if(se)return ie;se=1;var e=de(),t=fe(),r=pe(),n=ye(),o=he(),i=function(){};function s(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),ie=function(l,a){var u="function"==typeof Symbol&&Symbol.iterator;var c="<<anonymous>>",d={array:h("array"),bigint:h("bigint"),bool:h("boolean"),func:h("function"),number:h("number"),object:h("object"),string:h("string"),symbol:h("symbol"),any:y(s),arrayOf:function(e){return y((function(t,n,o,i,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var l=t[n];if(!Array.isArray(l))return new p("Invalid "+i+" `"+s+"` of type `"+x(l)+"` supplied to `"+o+"`, expected an array.");for(var a=0;a<l.length;a++){var u=e(l,a,o,i,s+"["+a+"]",r);if(u instanceof Error)return u}return null}))},element:y((function(e,t,r,n,o){var i=e[t];return l(i)?null:new p("Invalid "+n+" `"+o+"` of type `"+x(i)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:y((function(t,r,n,o,i){var s=t[r];return e.isValidElementType(s)?null:new p("Invalid "+o+" `"+i+"` of type `"+x(s)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return y((function(t,r,n,o,i){if(!(t[r]instanceof e)){var s=e.name||c;return new p("Invalid "+o+" `"+i+"` of type `"+(((l=t[r]).constructor&&l.constructor.name?l.constructor.name:c)+"` supplied to `")+n+"`, expected instance of `"+s+"`.")}var l;return null}))},node:y((function(e,t,r,n,o){return m(e[t])?null:new p("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return y((function(t,o,i,s,l){if("function"!=typeof e)return new p("Property `"+l+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var a=t[o],u=x(a);if("object"!==u)return new p("Invalid "+s+" `"+l+"` of type `"+u+"` supplied to `"+i+"`, expected an object.");for(var c in a)if(n(a,c)){var d=e(a,c,i,s,l+"."+c,r);if(d instanceof Error)return d}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),s;return y((function(t,r,n,o,i){for(var s=t[r],l=0;l<e.length;l++)if(f(s,e[l]))return null;var a=JSON.stringify(e,(function(e,t){return"symbol"===b(t)?String(t):t}));return new p("Invalid "+o+" `"+i+"` of value `"+String(s)+"` supplied to `"+n+"`, expected one of "+a+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+g(o)+" at index "+t+"."),s}return y((function(t,o,i,s,l){for(var a=[],u=0;u<e.length;u++){var c=(0,e[u])(t,o,i,s,l,r);if(null==c)return null;c.data&&n(c.data,"expectedType")&&a.push(c.data.expectedType)}return new p("Invalid "+s+" `"+l+"` supplied to `"+i+"`"+(a.length>0?", expected one of type ["+a.join(", ")+"]":"")+".")}))},shape:function(e){return y((function(t,n,o,i,s){var l=t[n],a=x(l);if("object"!==a)return new p("Invalid "+i+" `"+s+"` of type `"+a+"` supplied to `"+o+"`, expected `object`.");for(var u in e){var c=e[u];if("function"!=typeof c)return v(o,i,s,u,b(c));var d=c(l,u,o,i,s+"."+u,r);if(d)return d}return null}))},exact:function(e){return y((function(o,i,s,l,a){var u=o[i],c=x(u);if("object"!==c)return new p("Invalid "+l+" `"+a+"` of type `"+c+"` supplied to `"+s+"`, expected `object`.");var d=t({},o[i],e);for(var f in d){var y=e[f];if(n(e,f)&&"function"!=typeof y)return v(s,l,a,f,b(y));if(!y)return new p("Invalid "+l+" `"+a+"` key `"+f+"` supplied to `"+s+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var h=y(u,f,s,l,a+"."+f,r);if(h)return h}return null}))}};function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function y(e){if("production"!==process.env.NODE_ENV)var t={},n=0;function o(o,s,l,u,d,f,y){if(u=u||c,f=f||l,y!==r){if(a){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var v=u+":"+l;!t[v]&&n<3&&(i("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+u+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[v]=!0,n++)}}return null==s[l]?o?null===s[l]?new p("The "+d+" `"+f+"` is marked as required in `"+u+"`, but its value is `null`."):new p("The "+d+" `"+f+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(s,l,u,d,f)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function h(e){return y((function(t,r,n,o,i,s){var l=t[r];return x(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+b(l)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function v(e,t,r,n,o){return new p((e||"React class")+": "+t+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function m(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(m);if(null===e||l(e))return!0;var t=function(e){var t=e&&(u&&e[u]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(!t)return!1;var r,n=t.call(e);if(t!==e.entries){for(;!(r=n.next()).done;)if(!m(r.value))return!1}else for(;!(r=n.next()).done;){var o=r.value;if(o&&!m(o[1]))return!1}return!0;default:return!1}}function x(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=x(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return p.prototype=Error.prototype,d.checkPropTypes=o,d.resetWarningCache=o.resetWarningCache,d.PropTypes=d,d},ie}function me(){if(ae)return le;ae=1;var e=pe();function t(){}function r(){}return r.resetWarningCache=t,le=function(){function n(t,r,n,o,i,s){if(s!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function o(){return n}n.isRequired=n;var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i}}function xe(){if(ue)return H.exports;if(ue=1,"production"!==process.env.NODE_ENV){var e=de();H.exports=ve()(e.isElement,true)}else H.exports=me()();return H.exports}var be,ge,we,je,Pe,Se,Ce,Oe,Ie,Ae,Te,Ee,Me,ke=F(xe()),Ve=function(){return f((function e(t,r){d(this,e),this.text=t,this.patterns=r||[]}),[{key:"parse",value:function(){var e=this,t=[{children:this.text}];return this.patterns.forEach((function(r){var n=[],o=r.nonExhaustiveModeMaxMatchCount||0,i=Math.min(Math.max(Number.isInteger(o)?o:0,0)||Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),s=0;t.forEach((function(t){if(t._matched)n.push(t);else{var o,l=[],a=t.children,u=0;for(r.pattern.lastIndex=0;a&&(o=r.pattern.exec(a));){var c=a.substr(0,o.index);if(u=o.index,++s>i)break;l.push({children:c}),l.push(e.getMatchedPart(r,o[0],o,u)),a=a.substr(o.index+o[0].length),u+=o[0].length-1,r.pattern.lastIndex=0}l.push({children:a}),n.push.apply(n,l)}})),t=n})),t.forEach((function(e){return delete e._matched})),t.filter((function(e){return!!e.children}))}},{key:"getMatchedPart",value:function(e,t,r,n){var o={};Object.keys(e).forEach((function(r){"pattern"!==r&&"renderText"!==r&&"nonExhaustiveModeMaxMatchCount"!==r&&("function"==typeof e[r]?o[r]=function(){return e[r](t,n)}:o[r]=e[r])}));var i=t;return e.renderText&&"function"==typeof e.renderText&&(i=e.renderText(t,r)),m(m({},o),{},{children:i,_matched:!0})}}])}(),Re=["type"],_e=["style"],Ne=["parse","childrenProps"],ze={url:/(https?:\/\/|www\.)[-a-zA-Z0-9@:%._\+~#=]{1,256}\.(xn--)?[a-z0-9-]{2,20}\b([-a-zA-Z0-9@:%_\+\[\],.~#?&\/=]*[-a-zA-Z0-9@:%_\+\]~#?&\/=])*/i,phone:/[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,7}/,email:/\S+@\S+\.\S+/},$e=ke.shape(m(m({},t.Text.propTypes),{},{type:ke.oneOf(Object.keys(ze)).isRequired,nonExhaustiveMaxMatchCount:ke.number})),Ue=ke.shape(m(m({},t.Text.propTypes),{},{pattern:ke.oneOfType([ke.string,ke.instanceOf(RegExp)]).isRequired,nonExhaustiveMaxMatchCount:ke.number})),Le=function(){function r(){return d(this,r),c(this,r,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(r,n.Component),f(r,[{key:"setNativeProps",value:function(e){this._root.setNativeProps(e)}},{key:"getPatterns",value:function(){return this.props.parse.map((function(e){var t=e.type,r=x(e,Re);if(t){if(!ze[t])throw new Error("".concat(e.type," is not a supported type"));r.pattern=ze[t]}return r}))}},{key:"getParsedText",value:function(){var r=this;return this.props.parse?"string"!=typeof this.props.children?this.props.children:new Ve(this.props.children,this.getPatterns()).parse().map((function(n,o){var i=r.props.style,s=n.style,l=x(n,_e);return e.jsx(t.Text,m(m({style:[i,s]},r.props.childrenProps),l),"parsedText-".concat(o))})):this.props.children}},{key:"render",value:function(){var r=this,n=m({},this.props);n.parse,n.childrenProps;var o=x(n,Ne);return e.jsx(t.Text,m(m({ref:function(e){return r._root=e}},o),{},{children:this.getParsedText()}))}}])}();Le.displayName="ParsedText",Le.propTypes=m(m({},t.Text.propTypes),{},{parse:ke.arrayOf(ke.oneOfType([$e,Ue])),childrenProps:ke.shape(t.Text.propTypes)}),Le.defaultProps={parse:null,childrenProps:{}};var qe,Be,De,Fe,We,He,Ye,Xe,Ze,Ge,Qe,Je,Ke,et,tt,rt,nt,ot,it,st,lt,at,ut,ct,dt,ft,pt,yt,ht,vt,mt,xt,bt,gt,wt,jt,Pt=function(o){var s,l,a,u=o.message,c=o.onMediaPress,d=o.isVideoPlaying,f=o.isCurrentUser,p=R(),y=p.theme,h=p.showMessageStatus,v=p.CustomPlayIcon,m=p.renderCustomVideoBubbleError,x=n.useRef(null),b=g(n.useState(0),2),j=b[0],P=b[1],S=g(n.useState(!1),2),C=S[0],O=S[1],I=g(n.useState(!1),2),A=I[0],T=I[1];return e.jsxs(t.View,{children:[u.image&&e.jsx(t.Pressable,{onPress:function(){return c("image",u.image)},style:r(be||(be=w(["w-60 h-80 my-2"]))),children:e.jsx(t.Image,{source:{uri:u.image},style:r(ge||(ge=w(["w-full h-full rounded-lg"]))),resizeMode:"contain"})}),u.video&&e.jsxs(t.Pressable,{onPress:function(){return c("video",u.video)},style:r(we||(we=w(["w-60 h-80 my-2 justify-center items-center"]))),disabled:C,children:[e.jsx(i,{source:{uri:u.video},ref:x,paused:!0,style:{width:"100%",height:"100%",borderRadius:8,position:"relative"},resizeMode:"cover",onLoadStart:function(){O(!0),T(!1)},onLoad:function(e){P(e.duration),O(!1)},onBuffer:function(e){var t=e.isBuffering;return O(t)},onError:function(){T(!0),O(!1)}}),C?e.jsx(t.View,{style:r(je||(je=w(["absolute inset-0 flex items-center justify-center bg-black/40 rounded-full"]))),children:e.jsx(_,{style:r.style("h-12 w-12"),spinning:!0})}):A?m?m():e.jsx(t.View,{style:r(Pe||(Pe=w(["absolute inset-0 flex items-center justify-center bg-red-500/60 p-2"]))),children:e.jsx(t.Text,{style:r(Se||(Se=w(["text-white font-bold"]))),children:"Failed to load video"})}):e.jsxs(e.Fragment,{children:[e.jsx(t.View,{style:r(Ce||(Ce=w(["absolute bg-black/40 rounded-full"]))),children:v?e.jsx(v,{}):e.jsx(N,{style:r.style("h-16 w-16"),color:(null==y||null===(s=y.colors)||void 0===s?void 0:s.audioPlayIconColor)||"white"})}),e.jsx(t.View,{style:r(Oe||(Oe=w(["absolute bottom-2 left-2 bg-black/50 px-2 py-1 rounded-md"]))),children:e.jsx(t.Text,{style:r(Ie||(Ie=w(["text-white text-xs font-semibold"]))),children:z(j)})})]})]}),u.audio&&e.jsx(t.View,{style:r(Ae||(Ae=w(["my-2"]))),children:e.jsx(D,{audioUrl:u.audio,audioId:u.id,isVideoPlaying:d})}),u.text&&e.jsx(Le,{style:[r(Te||(Te=w(["pt-1"]))),r(h?Ee||(Ee=w(["pb-0"])):Me||(Me=w(["pb-2"]))),{wordBreak:"break-word",overflowWrap:"break-word"},f?null==y||null===(l=y.messageStyle)||void 0===l?void 0:l.sentTextStyle:null==y||null===(a=y.messageStyle)||void 0===a?void 0:a.receivedTextStyle],parse:[{type:"url",style:{color:"blue",textDecorationLine:"underline"},onPress:function(e){return t.Linking.openURL(e.startsWith("http")?e:"https://".concat(e))}}],childrenProps:{allowFontScaling:!1},children:u.text})]})},St=n.memo(Pt),Ct=function(t){var r=t.style;return e.jsx(o,{style:r,viewBox:"0 0 24 24",children:e.jsx(o.Path,{d:"M.41 13.41L6 19l1.41-1.42L1.83 12m20.41-6.42L11.66 16.17L7.5 12l-1.43 1.41L11.66 19l12-12M18 7l-1.41-1.42l-6.35 6.35l1.42 1.41z"})})},Ot=function(t){var r=t.style;return e.jsx(o,{style:r,viewBox:"0 0 24 24",children:e.jsx(o.Path,{d:"m9.55 18l-5.7-5.7l1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"})})},It=function(n){var o,i=n.time,s=n.status,l=n.isCurrentUser,a=n.hasText,u=n.hasAudio,c=R(),d=c.theme,f=c.showMessageStatus;return e.jsx(e.Fragment,{children:f&&e.jsxs(t.View,{style:[r(qe||(qe=w(["flex-row items-center"]))),r(a?Be||(Be=w(["justify-end pb-1 ml-4"])):u?De||(De=w(["absolute right-3 bottom-3"])):Fe||(Fe=w(["absolute right-3 bottom-4 bg-black/50 px-2 py-1 rounded-md"])))],children:[e.jsx(t.Text,{style:[r(We||(We=w(["text-xs"]))),{color:a||u?(null==d||null===(o=d.colors)||void 0===o?void 0:o.timestamp)||"rgba(107, 114, 128, 0.7)":"white"}],children:i}),l&&e.jsxs(t.View,{style:r(He||(He=w(["ml-1 flex-row items-center"]))),children:["sent"===s&&e.jsx(Ot,{style:r.style("fill-[#6B7280] h-4 w-4",{opacity:.7})}),"delivered"===s&&e.jsx(Ct,{style:r.style("fill-[#6B7280] h-4 w-4",{opacity:.7})}),"read"===s&&e.jsx(Ct,{style:r.style("fill-[#3B82F6] h-4 w-4",{opacity:.9})})]})]})})},At=n.memo(It),Tt=function(n){var o,i,s,l,a,u,c,d,f=n.message,p=n.isCurrentUser,y=n.isFirstInSequence,h=n.onLongPress,v=R(),x=v.theme,b=v.showAvatars,g=v.showUserNames,j=v.showBubbleTail,P=v.setMediaUrl,S=v.setIsVideoPlaying,C=v.isVideoPlaying;return e.jsxs(t.Pressable,{onLongPress:h,style:[r(Ye||(Ye=w(["px-2 my-1 max-w-[75%] relative"]))),r(p?Xe||(Xe=w(["self-end mr-3"])):Ze||(Ze=w(["self-start ml-9"]))),r(y?p?Ge||(Ge=w(["bg-green-500 rounded-tr-none"])):Qe||(Qe=w(["bg-white rounded-tl-none"])):p?Je||(Je=w(["bg-green-500"])):Ke||(Ke=w(["bg-white"]))),m({borderRadius:8},p?null==x||null===(o=x.bubbleStyle)||void 0===o?void 0:o.sent:null==x||null===(i=x.bubbleStyle)||void 0===i?void 0:i.received)],children:[!p&&y&&b&&e.jsxs(e.Fragment,{children:[e.jsx(t.View,{style:r(et||(et=w(["absolute w-6 h-6 rounded-full top-0 -left-9 flex-row items-center"]))),children:f.senderAvatar?e.jsx(t.Image,{source:{uri:f.senderAvatar},style:[r(tt||(tt=w(["w-full h-full rounded-full"]))),null==x||null===(s=x.bubbleStyle)||void 0===s?void 0:s.avatarImageStyle],resizeMode:"cover"}):e.jsx(t.Text,{style:[r(rt||(rt=w(["text-sm text-black font-semibold capitalize rounded-full bg-zinc-300 w-full h-full text-center pt-0.5"]))),null==x||null===(l=x.bubbleStyle)||void 0===l?void 0:l.avatarTextStyle],children:null===(a=f.senderName)||void 0===a?void 0:a.charAt(0)})}),g&&f.senderName&&e.jsx(t.Text,{style:[r(nt||(nt=w(["text-sm text-black font-semibold mt-1 capitalize"]))),null==x||null===(u=x.bubbleStyle)||void 0===u?void 0:u.userNameStyle],children:f.senderName})]}),y&&j&&e.jsx(E,{style:r.style("absolute -top-1 w-6 h-6 ",p?"-right-3.5 mt-[1.24px]":"-left-3.5 mt-[1.25px]",{transform:[{rotate:p?"90deg":"180deg"}]}),color:"".concat(p?(null==x||null===(c=x.colors)||void 0===c?void 0:c.sentMessageTailColor)||"rgba(34, 197, 94,1)":(null==x||null===(d=x.colors)||void 0===d?void 0:d.receivedMessageTailColor)||"white")}),e.jsx(St,{message:f,isCurrentUser:p,isFirstInSequence:y,onMediaPress:function(e,t){P({imageUrl:"image"===e?t:"",videoUrl:"video"===e?t:""}),"video"===e&&S(!0)},isVideoPlaying:C}),e.jsx(At,{time:f.time,status:p?f.status:void 0,isCurrentUser:p,hasText:!!f.text,hasAudio:!!f.audio})]})},Et=n.memo(Tt),Mt=function(t){var r=t.style,n=t.color;return e.jsx(o.Svg,{style:r,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:n,children:[e.jsx(o.Circle,{cx:"12",cy:"13",r:"3"}),e.jsx(o.Path,{d:"M9.778 21h4.444c3.121 0 4.682 0 5.803-.735a4.4 4.4 0 0 0 1.226-1.204c.749-1.1.749-2.633.749-5.697s0-4.597-.749-5.697a4.4 4.4 0 0 0-1.226-1.204c-.72-.473-1.622-.642-3.003-.702c-.659 0-1.226-.49-1.355-1.125A2.064 2.064 0 0 0 13.634 3h-3.268c-.988 0-1.839.685-2.033 1.636c-.129.635-.696 1.125-1.355 1.125c-1.38.06-2.282.23-3.003.702A4.4 4.4 0 0 0 2.75 7.667C2 8.767 2 10.299 2 13.364s0 4.596.749 5.697c.324.476.74.885 1.226 1.204C5.096 21 6.657 21 9.778 21Z"}),e.jsx(o.Path,{strokeLinecap:"round",d:"M19 10h-1"})]})})},kt=function(t){var r=t.style,n=t.color;return e.jsx(o,{style:r,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",stroke:n,children:[e.jsx(o.Path,{strokeLinecap:"round",strokeWidth:"1.5",d:"M8.913 15.934c1.258.315 2.685.315 4.122-.07s2.673-1.099 3.605-2.001"}),e.jsx(o.Ellipse,{cx:"14.509",cy:"9.774",fill:"currentColor",rx:"1",ry:"1.5",transform:"rotate(-15 14.51 9.774)"}),e.jsx(o.Ellipse,{cx:"8.714",cy:"11.328",fill:"currentColor",rx:"1",ry:"1.5",transform:"rotate(-15 8.714 11.328)"}),e.jsx(o.Path,{strokeWidth:"1.5",d:"M3.204 14.357c-1.112-4.147-1.667-6.22-.724-7.853s3.016-2.19 7.163-3.3c4.147-1.112 6.22-1.667 7.853-.724s2.19 3.016 3.3 7.163c1.111 4.147 1.667 6.22.724 7.853s-3.016 2.19-7.163 3.3c-4.147 1.111-6.22 1.667-7.853.724s-2.19-3.016-3.3-7.163Z"}),e.jsx(o.Path,{strokeWidth:"1.5",d:"m13 16l.478.974a1.5 1.5 0 1 0 2.693-1.322l-.46-.935"})]})})},Vt=function(t){var r=t.style,n=t.color;return e.jsx(o,{style:r,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:n,children:[e.jsx(o.Path,{d:"M7 8a5 5 0 0 1 10 0v3a5 5 0 0 1-10 0z"}),e.jsx(o.Path,{strokeLinecap:"round",d:"M13.5 8H17m-3.5 3H17M7 8h2m-2 3h2m11-1v1a8 8 0 0 1-8 8m-8-9v1a8 8 0 0 0 8 8m0 0v3",opacity:".5"})]})})},Rt=function(t){var r=t.style,n=t.color;return e.jsx(o,{style:r,fill:n,viewBox:"0 0 24 24",children:e.jsx(o.Path,{d:"M17.346 15.539q0 2.271-1.565 3.866T11.952 21t-3.838-1.595t-1.576-3.867v-8.73q0-1.587 1.092-2.697Q8.72 3 10.308 3t2.678 1.11t1.091 2.698v8.269q0 .88-.615 1.517q-.614.637-1.498.637t-1.52-.627t-.636-1.527V6.769h1v8.308q0 .479.327.816q.328.338.807.338t.807-.338t.328-.816V6.789q-.006-1.166-.802-1.977Q11.48 4 10.308 4q-1.163 0-1.966.821q-.804.821-.804 1.987v8.73q-.005 1.853 1.283 3.157Q10.11 20 11.96 20q1.823 0 3.1-1.305t1.287-3.156v-8.77h1z"})})},_t=function(t){var r=t.style,n=t.color;return e.jsx(o,{style:r,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:n,children:[e.jsx(o.Path,{d:"m18.636 15.67l1.716-5.15c1.5-4.498 2.25-6.747 1.062-7.934s-3.436-.438-7.935 1.062L8.33 5.364C4.7 6.574 2.885 7.18 2.37 8.067a2.72 2.72 0 0 0 0 2.73c.515.888 2.33 1.493 5.96 2.704c.584.194.875.291 1.119.454c.236.158.439.361.597.597c.163.244.26.535.454 1.118c1.21 3.63 1.816 5.446 2.703 5.962a2.72 2.72 0 0 0 2.731 0c.887-.516 1.492-2.331 2.703-5.962Z"}),e.jsx(o.Path,{strokeLinecap:"round",d:"m17.79 6.21l-4.211 4.165",opacity:".5"})]})})},Nt=function(t){var r=t.style,n=t.fill,i=void 0===n?"currentColor":n;return e.jsxs(o,{style:r,viewBox:"0 0 24 24",children:[e.jsx(o.Path,{fill:i,d:"M13 4H6v16h12V9h-5z",opacity:".3"}),e.jsx(o.Path,{fill:i,d:"m20 8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2zm-2 12H6V4h7v5h5z"})]})},zt=function(r){var n=r.fileName,o=r.style;return e.jsx(t.Text,{numberOfLines:2,ellipsizeMode:"tail",style:[{fontSize:14,fontWeight:"600",color:"black"},o],children:function(e){var t=e.lastIndexOf(".");if(-1===t)return e;var r=e.slice(0,t),n=e.slice(t);return r.length>40?r.slice(0,40)+"..."+n:r+n}(n)})},$t=n.memo(zt),Ut=function(r){var n,o,s,l,a,u,c,d=r.previewData,f=r.closePreview,p=r.CustomFileIcon,y=r.CustomImagePreview,h=r.CustomVideoPreview,v=r.inputHeight,m=R(),x=m.theme,b=m.setMediaUrl,g=m.setIsVideoPlaying;if(!d)return null;var w=null===(n=d.type)||void 0===n?void 0:n.startsWith("image/"),j=null===(o=d.type)||void 0===o?void 0:o.startsWith("video/");return e.jsxs(t.Pressable,{style:[{position:"absolute",bottom:(null!=v?v:0)+8,zIndex:20,borderRadius:12},null==x||null===(s=x.filePreviewStyle)||void 0===s?void 0:s.root],onPress:function(){(w||j)&&(b({imageUrl:w?d.uri:"",videoUrl:j?d.uri:""}),j&&g(!0))},children:[e.jsx(t.Pressable,{onPress:f,style:{position:"absolute",zIndex:10,height:20,width:20,backgroundColor:"rgba(255, 255, 255, 0.5)",right:0,borderTopRightRadius:8,borderRadius:8,justifyContent:"center",alignItems:"center"},children:e.jsx(t.Text,{style:{fontSize:12,color:"black"},children:"X"})}),w?y?e.jsx(y,{uri:d.uri}):e.jsx(t.View,{style:{width:56,height:56,borderRadius:12,overflow:"hidden"},children:e.jsx(t.Image,{source:{uri:d.uri},style:{width:"100%",height:"100%",borderRadius:12},resizeMode:"cover"})}):j?h?e.jsx(h,{uri:d.uri}):e.jsx(t.View,{style:{width:56,height:56,borderRadius:12,overflow:"hidden"},children:e.jsx(i,{source:{uri:d.uri},style:{width:"100%",height:"100%",borderRadius:12},resizeMode:"cover",muted:!0,repeat:!0,paused:!1})}):e.jsxs(t.View,{style:[{backgroundColor:"white",width:240,height:64,borderRadius:12,flexDirection:"row",padding:4,gap:4,alignItems:"center"},null==x||null===(l=x.filePreviewStyle)||void 0===l?void 0:l.container],children:[e.jsx(t.View,{style:[{backgroundColor:"#d1d5db",borderRadius:8,padding:4,justifyContent:"center",alignItems:"center"},null==x||null===(a=x.filePreviewStyle)||void 0===a?void 0:a.iconContainer],children:p?e.jsx(p,{}):e.jsx(Nt,{style:{width:40,height:40},fill:"white"})}),e.jsx(t.View,{style:[{backgroundColor:"#f3f4f6",flex:1,borderRadius:8,justifyContent:"center",paddingHorizontal:12},null==x||null===(u=x.filePreviewStyle)||void 0===u?void 0:u.nameContainer],children:e.jsx($t,{fileName:d.name,style:null==x||null===(c=x.filePreviewStyle)||void 0===c?void 0:c.text})})]})]})},Lt=n.memo(Ut),qt="ios"===t.Platform.OS?32:30,Bt=function(o){var i,s,l,a,u,c,d,f,p,y,h=o.onSendMessage,v=o.onTypingStart,x=o.onTypingEnd,b=o.onAttachmentPress,j=o.onCameraPress,P=o.onAudioRecordStart,S=o.onAudioRecordEnd,C=o.CustomEmojiIcon,O=o.CustomAttachmentIcon,I=o.CustomCameraIcon,A=o.CustomSendIcon,T=o.CustomMicrophoneIcon,E=o.CustomFileIcon,M=o.CustomImagePreview,k=o.CustomVideoPreview,V=g(n.useState(""),2),_=V[0],N=V[1],z=g(n.useState({height:qt,isMultiline:!1}),2),$=z[0],U=z[1],L=R(),q=L.theme,B=L.currentUserId,D=L.showEmojiButton,F=L.showAttachmentsButton,W=L.showCameraButton,H=L.showVoiceRecordButton,Y=L.placeholder,X=L.previewData,Z=L.closePreview,G=n.useCallback((function(e){var t=Math.min(Math.max(e.nativeEvent.contentSize.height,qt),118);U({height:t,isMultiline:t>qt})}),[]),Q=n.useCallback((function(){var e=_.trim();(e||X)&&(h({text:e,senderId:B}),N(""),U({height:qt,isMultiline:!1}))}),[_,h,B,X]);return n.useEffect((function(){_.trim()?null==v||v():null==x||x()}),[_,v,x]),e.jsxs(t.View,{style:r(ot||(ot=w(["w-full px-2"]))),children:[X&&e.jsx(Lt,{previewData:X,closePreview:Z,CustomFileIcon:E,CustomImagePreview:M,CustomVideoPreview:k,inputHeight:$.height}),e.jsxs(t.View,{style:[r(it||(it=w(["flex-row items-end gap-2"]))),null==q||null===(i=q.inputStyles)||void 0===i?void 0:i.inputSectionContainerStyle],children:[e.jsxs(t.View,{style:[r(st||(st=w(["flex-1 px-3.5 bg-white gap-1 flex-row justify-between"]))),$.isMultiline?r(lt||(lt=w(["rounded-3xl items-end"]))):r(at||(at=w(["rounded-full items-center"]))),null==q||null===(s=q.inputStyles)||void 0===s?void 0:s.inputContainerStyle],children:[D&&e.jsx(t.Pressable,{children:C?e.jsx(C,{}):e.jsx(kt,{style:r.style("".concat("ios"===t.Platform.OS?"h-6 w-6":"w-7 h-7"),$.isMultiline?"pb-14":"pb-0"),color:(null==q||null===(l=q.colors)||void 0===l?void 0:l.inputsIconsColor)||"rgba(0,0,0,0.7)"})}),e.jsx(t.TextInput,{value:_,onChangeText:N,placeholder:Y||"Message",style:[r(ut||(ut=w(["bg-transparent flex-1 pl-2 my-3"]))),"ios"===t.Platform.OS?r(ct||(ct=w(["text-[17px]"]))):r(dt||(dt=w(["text-[16px]"]))),{minHeight:qt,maxHeight:118}],placeholderTextColor:(null==q||null===(a=q.colors)||void 0===a?void 0:a.placeholderTextColor)||"rgba(0, 0, 0, 0.4)",multiline:!0,textAlignVertical:"center",onContentSizeChange:G}),e.jsxs(t.View,{style:[r(ft||(ft=w(["gap-4 flex-row"]))),$.isMultiline?r(pt||(pt=w(["pb-4"]))):r(yt||(yt=w(["pb-0"])))],children:[F&&e.jsx(t.Pressable,{onPress:b,children:O?e.jsx(O,{}):e.jsx(Rt,{style:r.style("ios"===t.Platform.OS?"h-6 w-6":"w-7 h-7"),color:(null==q||null===(u=q.colors)||void 0===u?void 0:u.inputsIconsColor)||"rgba(0,0,0,0.7)"})}),W&&!_.trim()&&e.jsx(t.Pressable,{onPress:j,children:I?e.jsx(I,{}):e.jsx(Mt,{style:r.style("ios"===t.Platform.OS?"h-6 w-6":"w-7 h-7"),color:(null==q||null===(c=q.colors)||void 0===c?void 0:c.inputsIconsColor)||"rgba(0,0,0,0.7)"})})]})]}),e.jsx(t.Pressable,{style:[r(ht||(ht=w(["p-2 rounded-full bg-green-600 justify-center items-center"]))),m({height:"ios"===t.Platform.OS?50:48,width:"ios"===t.Platform.OS?50:48},null==q||null===(d=q.inputStyles)||void 0===d?void 0:d.sendButtonStyle)],onPress:_.trim()||X?Q:P,onLongPress:P,onPressOut:S,children:_.trim()?A?e.jsx(A,{}):e.jsx(_t,{style:r.style("h-6 w-6"),color:(null==q||null===(f=q.colors)||void 0===f?void 0:f.sendIconsColor)||"rgba(255,255,255,0.7)"}):H?T?e.jsx(T,{}):e.jsx(Vt,{style:r.style("h-8 w-8"),color:(null==q||null===(p=q.colors)||void 0===p?void 0:p.sendIconsColor)||"rgba(255,255,255,0.7)"}):A?e.jsx(A,{}):e.jsx(_t,{style:r.style("h-6 w-6"),color:(null==q||null===(y=q.colors)||void 0===y?void 0:y.sendIconsColor)||"rgba(255,255,255,0.7)"})})]})]})},Dt=n.memo(Bt);function Ft(t){var n=t.style;return e.jsxs(o.Svg,{viewBox:"0 0 24 24",fill:"none",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:r.style("h-6 w-6 text-black",n),children:[e.jsx(o.Line,{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx(o.Line,{x1:"6",y1:"6",x2:"18",y2:"18"})]})}var Wt,Ht,Yt,Xt,Zt,Gt,Qt,Jt,Kt,er,tr,rr=function(o){var s=o.imageUrl,l=o.videoUrl,u=o.onClose,c=n.useRef(null),d=g(n.useState(!1),2),f=d[0],p=d[1],y=g(n.useState(!1),2),h=y[0],v=y[1];return s||l?e.jsx(t.Modal,{visible:!!s||!!l,transparent:!0,children:e.jsxs(t.View,{style:r(vt||(vt=w(["top-0 bottom-0 left-0 right-0 bg-black/80 flex-1 absolute"]))),children:[e.jsx(t.Pressable,{onPress:u,style:r(mt||(mt=w(["absolute right-4 top-4 p-2 rounded-full bg-slate-100/70 z-10"]))),children:e.jsx(Ft,{style:r(xt||(xt=w(["h-8 w-8"])))})}),s&&e.jsx(a,{imageUrls:[{url:s}],enableSwipeDown:!0,onSwipeDown:u,backgroundColor:"rgba(0,0,0,0.8)",enableImageZoom:!0,onSave:function(){return s},renderIndicator:function(){return e.jsx(e.Fragment,{})}}),l&&e.jsxs(t.View,{style:r(bt||(bt=w(["justify-center items-center"]))),children:[e.jsx(i,{source:{uri:l},ref:c,shutterColor:"transparent",controls:!0,style:{width:"100%",height:"100%",borderRadius:8,position:"relative",marginHorizontal:48},controlsStyles:{hideSettingButton:!1,hideNext:!0,hidePrevious:!0},resizeMode:"contain",onLoadStart:function(){p(!0),v(!1)},onLoad:function(){return p(!1)},onBuffer:function(e){var t=e.isBuffering;return p(t)},onError:function(){v(!0),p(!1)}}),f&&e.jsx(t.View,{style:r(gt||(gt=w(["absolute inset-0 flex items-center justify-center bg-black/40 rounded-full"]))),children:e.jsx(_,{style:r.style("h-12 w-12"),spinning:!0})}),h&&e.jsx(t.View,{style:r(wt||(wt=w(["absolute inset-0 flex items-center justify-center bg-red-500/60 p-2"]))),children:e.jsx(t.Text,{style:r(jt||(jt=w(["text-white font-bold"]))),children:"Failed to load video"})})]})]})}):null},nr=n.memo(rr),or=function(n){var o,i,s,l,a=n.typingUsers,u=n.currentUserId,c=R(),d=c.theme,f=c.showAvatars,p=c.renderCustomTyping,y=c.showBubbleTail,h=a.filter((function(e){return e.id!==u}));if(!h.length)return null;var v=h.slice(0,2),x=h.length-2;return e.jsxs(t.View,{style:r(Wt||(Wt=w(["my-1 max-w-[75%] self-start flex-row"]))),children:[f&&e.jsxs(t.View,{style:r(Ht||(Ht=w(["flex-row"]))),children:[v.map((function(n,o){var i,s,l;return e.jsx(t.View,{style:[r(Yt||(Yt=w(["bg-gray-400 w-6 h-6 rounded-full items-center"]))),{marginLeft:o>0?-10:0,zIndex:v.length+o}],children:n.avatar?e.jsx(t.Image,{source:{uri:n.avatar},style:[r(Xt||(Xt=w(["w-full h-full object-cover rounded-full"]))),null==d||null===(i=d.bubbleStyle)||void 0===i?void 0:i.avatarImageStyle]}):e.jsx(t.Text,{style:[r(Zt||(Zt=w(["text-sm text-black font-semibold capitalize rounded-full bg-zinc-300 w-full h-full text-center pt-0.5"]))),null==d||null===(s=d.bubbleStyle)||void 0===s?void 0:s.avatarTextStyle],children:null===(l=n.name)||void 0===l?void 0:l.charAt(0)})},n.id)})),x>0&&e.jsx(t.View,{style:[r(Gt||(Gt=w(["bg-gray-400 w-6 h-6 rounded-full items-center justify-center"]))),{marginLeft:-10,zIndex:3},m({},null==d||null===(o=d.bubbleStyle)||void 0===o?void 0:o.additionalTypingUsersContainerStyle)],children:e.jsxs(t.Text,{style:[r(Qt||(Qt=w(["text-white text-xs font-semibold"]))),null==d||null===(i=d.bubbleStyle)||void 0===i?void 0:i.additionalTypingUsersTextStyle],children:["+",x]})})]}),y&&e.jsx(E,{style:r.style("w-6 h-6 fill-white mt-[1.25px]",{transform:[{rotate:"180deg"},{translateX:6}]}),color:"".concat((null==d||null===(s=d.colors)||void 0===s?void 0:s.receivedMessageTailColor)||"white")}),e.jsx(t.View,{style:[r(Jt||(Jt=w(["px-2 my-1 bg-white rounded-tl-none rounded-lg"]))),null==d||null===(l=d.bubbleStyle)||void 0===l?void 0:l.typingContainerStyle],children:p?p():e.jsx(t.View,{style:r(Kt||(Kt=w(["flex-row items-center py-3 px-2 justify-center"]))),children:e.jsx(t.Text,{style:r(er||(er=w(["text-gray-600"]))),children:"Typing..."})})})]})},ir=function(){var n=R(),o=n.messages,i=n.currentUserId,s=n.onMessageLongPress,l=n.mediaUrl,a=n.setMediaUrl,u=n.setIsVideoPlaying,c=n.typingUsers,d=n.onSendMessage,f=n.onTypingStart,p=n.onTypingEnd,y=n.onAttachmentPress,h=n.onAudioRecordEnd,v=n.onAudioRecordStart,m=n.onCameraPress,x=n.renderCustomInput,b=n.CustomEmojiIcon,g=n.CustomAttachmentIcon,j=n.CustomCameraIcon,P=n.CustomMicrophoneIcon,S=n.CustomSendIcon,C=n.CustomFileIcon,O=n.CustomImagePreview,I=n.CustomVideoPreview;return e.jsxs(t.View,{style:r(tr||(tr=w(["flex-1 px-2 pb-4 gap-2 relative"]))),children:[e.jsx(t.FlatList,{data:o,keyExtractor:function(e){return e.id},renderItem:function(t){var r,n=t.item,l=t.index;return e.jsx(Et,{message:n,isCurrentUser:n.senderId===i,onLongPress:function(){return null==s?void 0:s(n)},isFirstInSequence:l===o.length-1||(null===(r=o[l+1])||void 0===r?void 0:r.senderId)!==n.senderId})},ListHeaderComponent:e.jsx(or,{typingUsers:c||[],currentUserId:i}),showsVerticalScrollIndicator:!1,inverted:!0}),x?x():e.jsx(Dt,{onSendMessage:d,onTypingStart:f,onTypingEnd:p,onAttachmentPress:y,onAudioRecordEnd:h,onAudioRecordStart:v,onCameraPress:m,CustomEmojiIcon:b,CustomAttachmentIcon:g,CustomCameraIcon:j,CustomMicrophoneIcon:P,CustomSendIcon:S,CustomFileIcon:C,CustomImagePreview:O,CustomVideoPreview:I}),e.jsx(nr,{imageUrl:l.imageUrl,videoUrl:l.videoUrl,onClose:function(){a({imageUrl:"",videoUrl:""}),u(!1)}})]})};module.exports=function(t){return e.jsx(L,{children:e.jsx(V,m(m({},t),{},{children:e.jsx(ir,{})}))})};
2
15
  //# sourceMappingURL=index.js.map