movius-chats 1.3.11 → 1.3.13
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/lib/commonjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react-native"),n=require("twrnc"),r=require("react"),o=require("react-native-svg"),i=require("react-native-reanimated"),l=require("react-native-sound"),s=require("react-native-video");function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n){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,n||[],y(e).constructor):t.apply(e,n))}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t,n){return(t=w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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 p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,s=[],a=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(a=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{if(!a&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(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 b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function w(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var j=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 48 48",children:e.jsx(o.Path,{fill:r,fillRule:"evenodd",stroke:r,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"})})},S=["children"],P=r.createContext(void 0),C=function(t){var n=t.children,o=m(t,S),i=g(r.useState(null),2),l=i[0],s=i[1],a=g(r.useState(!1),2),u=a[0],c=a[1];return e.jsx(P.Provider,{value:v(v({},o),{},{mediaViewerGallery:l,setMediaViewerGallery:function(e,t){s({items:e,initialIndex:t});var n=e[t];c("video"===(null==n?void 0:n.kind))},clearMediaViewerGallery:function(){s(null),c(!1)},isVideoPlaying:u,setIsVideoPlaying:c}),children:n})},I=function(){var e=r.useContext(P);if(!e)throw new Error("useChatContext must be used within a ChatProvider");return e};function O(e){if(e.mediaItems&&e.mediaItems.length>0)return e.mediaItems;var t=[];return e.image&&t.push({uri:e.image,kind:"image"}),e.video&&t.push({uri:e.video,kind:"video"}),t}var T="ios"===t.Platform.OS?"h-6 w-6":"w-6 h-6";function A(e,t){return t?[e,{fontFamily:t}]:e}var k,V,E,M,R,_,z,N,F,L,$,D,q,W,B,H=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 15 15",children:e.jsx(o.Path,{fill:r,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=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsx(o.Path,{fill:r,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"})})},G=r.createContext(void 0),Y=function(t){var n=t.children,o=g(r.useState(null),2),i=o[0],l=o[1];return e.jsx(G.Provider,{value:{currentlyPlayingId:i,setCurrentlyPlayingId:l},children:n})},K={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":"AAiH2C,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"},X=function(o){var s,a,u,c,d,f,y,h=o.audioUrl,p=o.audioId,m=o.isVideoPlaying,x=I(),w=x.theme,j=x.CustomPlayIcon,S=x.CustomPauseIcon,P=function(){var e=r.useContext(G);if(!e)throw new Error("useAudio must be used within an AudioProvider");return e}(),C=P.currentlyPlayingId,O=P.setCurrentlyPlayingId,T=g(r.useState(null),2),N=T[0],F=T[1],L=g(r.useState(!1),2),$=L[0],D=L[1],q=g(r.useState(0),2),W=q[0],B=q[1],Y=g(r.useState(0),2),X=Y[0],Z=Y[1],Q=g(r.useState(!1),2),J=Q[0],ee=Q[1],te=r.useRef(null),ne=r.useRef(0),re=r.useRef(0),oe=r.useRef(0),ie=i.useSharedValue(0);r.useEffect((function(){var e=!0,t=new l(h,"",(function(n){!n&&e&&Z(t.getDuration())}));return F(t),function(){e=!1,t&&(t.pause(),t.release())}}),[h]),r.useEffect((function(){C&&C!==p&&$&&N&&(N.pause(),D(!1),B(0),ie.value=0)}),[C,p,$,N]),r.useEffect((function(){var e;return $&&N&&!J&&(e=setInterval((function(){N.getCurrentTime((function(e){if("number"==typeof e&&!isNaN(e)&&(B(e),ne.current>0&&X>0)){var t=e/X*ne.current;isNaN(t)||(ie.value=i.withSpring(t,{damping:15,stiffness:100}))}}))}),100)),function(){e&&clearInterval(e)}}),[$,N,J,X]);var le,se,ae,ue,ce,de=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(ne.current>0){var t=e.nativeEvent.pageX-oe.current,n=Math.max(0,Math.min(t,ne.current));ie.value=n;var r=n/ne.current*X;isNaN(r)||B(r)}},onPanResponderRelease:function(){if(ee(!1),N&&ne.current>0){var e=ie.value/ne.current*X;isNaN(e)||N.setCurrentTime(e)}},onPanResponderTerminate:function(){ee(!1)}}),fe=i.useAnimatedStyle((le=[new global.Error,-2,-27],(se=function(){return{transform:[{translateX:ie.value}]}}).__closure={knobPosition:ie},se.__workletHash=1935336866997,se.__initData=K,se.__stackDetails=le,se));return r.useEffect((function(){m&&$&&N&&N.pause((function(){D(!1),O(null)}))}),[m]),e.jsxs(t.View,{style:n(k||(k=b(["rounded-lg w-56"]))),children:[e.jsxs(t.View,{style:n(V||(V=b(["flex-row items-center gap-2 px-2 pt-2"]))),children:[e.jsx(t.Pressable,{onPress:function(){N&&($?N.pause((function(){D(!1),O(null)})):(O(p),N.play((function(e){e&&(D(!1),B(0),ie.value=i.withSpring(0),O(null))})),D(!0)))},style:[n(E||(E=b(["bg-black/40 rounded-full p-2"]))),null==w||null===(s=w.messageStyle)||void 0===s?void 0:s.audioPlayButtonStyle],children:$?S?e.jsx(S,{}):e.jsx(H,{style:n.style("h-6 w-6"),color:(null==w||null===(a=w.colors)||void 0===a?void 0:a.audioPauseIconColor)||"white"}):j?e.jsx(j,{}):e.jsx(U,{style:n.style("h-6 w-6"),color:(null==w||null===(u=w.colors)||void 0===u?void 0:u.audioPlayIconColor)||"white"})}),e.jsxs(t.View,{ref:te,onLayout:function(e){var t,n=e.nativeEvent.layout.width;ne.current=n,null===(t=te.current)||void 0===t||t.measure((function(e,t,n,r,o){re.current=o}))},style:[n(M||(M=b(["relative h-1 bg-zinc-400 rounded overflow-visible w-[75%]"]))),null==w||null===(c=w.messageStyle)||void 0===c?void 0:c.progressBarStyle],children:[e.jsx(t.View,{style:[n(R||(R=b(["absolute h-full bg-slate-200"]))),{width:"".concat(X>0?W/X*100:0,"%")},null==w||null===(d=w.messageStyle)||void 0===d?void 0:d.activeProgressBarStyle]}),e.jsx(i.View,v(v({},de.panHandlers),{},{style:[fe,{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},v({},null==w||null===(f=w.messageStyle)||void 0===f?void 0:f.audioKnobStyle)]}))]})]}),e.jsx(t.View,{style:n(_||(_=b(["px-4 py-1"]))),children:e.jsx(t.Text,{style:A([n(z||(z=b(["text-xs text-gray-500"]))),null==w||null===(y=w.messageStyle)||void 0===y?void 0:y.audioDurationStyle],null==w?void 0:w.fontFamily),children:isNaN(W)?"0:00":(ae=W,ue=Math.floor(ae/60),ce=Math.floor(ae%60),"".concat(ue,":").concat(ce<10?"0":"").concat(ce))})})]})},Z=r.memo(X),Q=function(n){var i=n.style,l=n.spinning,s=void 0!==l&&l,a=r.useRef(new t.Animated.Value(0)).current;r.useEffect((function(){s&&t.Animated.loop(t.Animated.timing(a,{toValue:1,duration:1e3,easing:t.Easing.linear,useNativeDriver:!0})).start()}),[s]);var u=a.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return e.jsx(t.Animated.View,{style:s?{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"})})})},J=320,ee=J,te=Math.round(176),ne=J-te-2,re=Math.round(159),oe=function(o){var i,l=o.uri,a=o.cellStyle,u=o.roundedStyle,c=I(),d=c.theme,f=c.CustomPlayIcon,y=r.useRef(null),h=g(r.useState(0),2),p=h[0],v=h[1],m=g(r.useState(!0),2),x=m[0],w=m[1],j=g(r.useState(!1),2),S=j[0],P=j[1];return e.jsxs(t.View,{style:[a,u],children:[e.jsx(s,{source:{uri:l},ref:y,paused:!0,muted:!0,style:[u,{width:"100%",height:"100%"}],resizeMode:"cover",onLoadStart:function(){w(!0),P(!1)},onLoad:function(e){v(e.duration),w(!1)},onError:function(){P(!0),w(!1)}}),x&&e.jsx(t.View,{style:[n(N||(N=b(["absolute inset-0 items-center justify-center bg-black/40"]))),u],children:e.jsx(Q,{style:n.style("h-8 w-8"),spinning:!0})}),!x&&!S&&e.jsxs(e.Fragment,{children:[e.jsx(t.View,{style:n(F||(F=b(["pointer-events-none absolute inset-0 items-center justify-center"]))),children:f?e.jsx(f,{}):e.jsx(U,{style:n.style("h-10 w-10"),color:(null==d||null===(i=d.colors)||void 0===i?void 0:i.audioPlayIconColor)||"white"})}),e.jsx(t.View,{style:n(L||(L=b(["pointer-events-none absolute bottom-1 left-1 bg-black/50 px-1.5 py-0.5 rounded"]))),children:e.jsx(t.Text,{style:n($||($=b(["text-white text-[10px] font-semibold"]))),children:ie(p)})})]}),S&&e.jsx(t.View,{style:[n(D||(D=b(["absolute inset-0 items-center justify-center bg-red-500/50"]))),u],children:e.jsx(t.Text,{style:A(n(q||(q=b(["text-white text-xs"]))),null==d?void 0:d.fontFamily),children:"Video"})})]})};function ie(e){if(!e||Number.isNaN(e))return"0:00";var t=Math.floor(e/60),n=Math.floor(e%60);return"".concat(t,":").concat(n.toString().padStart(2,"0"))}var le=function(r){var o=r.items,i=r.onOpenGallery,l=t.useWindowDimensions().width,s=Math.min(240,.72*l);if(0===o.length)return null;var a={borderRadius:6,overflow:"hidden"};if(1===o.length){var u=o[0];return e.jsx(t.Pressable,{onPress:function(){return i(o,0)},style:{width:s,height:320,marginVertical:8},children:"image"===u.kind?e.jsx(t.Image,{source:{uri:u.uri},style:{width:"100%",height:"100%",borderRadius:8},resizeMode:"cover"}):e.jsx(oe,{uri:u.uri,cellStyle:{width:s,height:320},roundedStyle:{borderRadius:8}})})}if(2===o.length){var c=(s-2)/2;return e.jsx(t.View,{style:{width:s,height:ee,flexDirection:"row",gap:2,marginVertical:8},children:o.slice(0,2).map((function(n,r){return e.jsx(t.Pressable,{onPress:function(){return i(o,r)},style:{width:c,height:ee},children:"image"===n.kind?e.jsx(t.Image,{source:{uri:n.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(oe,{uri:n.uri,cellStyle:{width:c,height:ee},roundedStyle:a})},"".concat(n.uri,"-").concat(r))}))})}if(3===o.length){var d=o[0],f=o[1],y=o[2],h=(s-2)/2;return e.jsxs(t.View,{style:{width:s,height:J,marginVertical:8,gap:2},children:[e.jsx(t.Pressable,{onPress:function(){return i(o,0)},style:{width:s,height:te},children:"image"===d.kind?e.jsx(t.Image,{source:{uri:d.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(oe,{uri:d.uri,cellStyle:{width:s,height:te},roundedStyle:a})}),e.jsxs(t.View,{style:{flexDirection:"row",gap:2,height:ne},children:[e.jsx(t.Pressable,{onPress:function(){return i(o,1)},style:{width:h,height:ne},children:"image"===f.kind?e.jsx(t.Image,{source:{uri:f.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(oe,{uri:f.uri,cellStyle:{width:h,height:ne},roundedStyle:a})},"".concat(f.uri,"-1")),e.jsx(t.Pressable,{onPress:function(){return i(o,2)},style:{width:h,height:ne},children:"image"===y.kind?e.jsx(t.Image,{source:{uri:y.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(oe,{uri:y.uri,cellStyle:{width:h,height:ne},roundedStyle:a})},"".concat(y.uri,"-2"))]})]})}var p=(s-2)/2,v=o.length-4,m=o.slice(0,4);return e.jsx(t.View,{style:{width:s,height:J,flexWrap:"wrap",flexDirection:"row",gap:2,marginVertical:8},children:m.map((function(r,l){return e.jsxs(t.Pressable,{onPress:function(){return i(o,l)},style:{width:p,height:re,position:"relative"},children:["image"===r.kind?e.jsx(t.Image,{source:{uri:r.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(oe,{uri:r.uri,cellStyle:{width:p,height:re},roundedStyle:a}),3===l&&v>0&&e.jsx(t.View,{style:n(W||(W=b(["absolute inset-0 bg-black/55 items-center justify-center"]))),children:e.jsxs(t.Text,{style:n(B||(B=b(["text-white text-lg font-bold"]))),children:["+",v]})})]},"".concat(r.uri,"-").concat(l))}))})};function se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ae,ue={exports:{}},ce={exports:{}},de={};var fe,ye,he,pe,ve,me,xe,ge,be,we,je,Se,Pe,Ce,Ie,Oe={};
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react-native"),n=require("twrnc"),r=require("react"),o=require("react-native-svg"),i=require("react-native-reanimated"),l=require("react-native-sound"),s=require("react-native-video");function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n){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,n||[],y(e).constructor):t.apply(e,n))}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t,n){return(t=w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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 p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,s=[],a=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(a=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{if(!a&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(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 b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function w(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var j=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 48 48",children:e.jsx(o.Path,{fill:r,fillRule:"evenodd",stroke:r,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"})})},S=["children"],P=r.createContext(void 0),C=function(t){var n=t.children,o=m(t,S),i=g(r.useState(null),2),l=i[0],s=i[1],a=g(r.useState(!1),2),u=a[0],c=a[1];return e.jsx(P.Provider,{value:v(v({},o),{},{mediaViewerGallery:l,setMediaViewerGallery:function(e,t){s({items:e,initialIndex:t});var n=e[t];c("video"===(null==n?void 0:n.kind))},clearMediaViewerGallery:function(){s(null),c(!1)},isVideoPlaying:u,setIsVideoPlaying:c}),children:n})},I=function(){var e=r.useContext(P);if(!e)throw new Error("useChatContext must be used within a ChatProvider");return e};function O(e){if(e.mediaItems&&e.mediaItems.length>0)return e.mediaItems;var t=[];return e.image&&t.push({uri:e.image,kind:"image"}),e.video&&t.push({uri:e.video,kind:"video"}),t}var A="ios"===t.Platform.OS?"h-6 w-6":"w-6 h-6";function T(e,t){return t?[e,{fontFamily:t}]:e}var k,V,E,M,R,_,z,N=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 15 15",children:e.jsx(o.Path,{fill:r,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"})})},L=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsx(o.Path,{fill:r,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"})})},F=r.createContext(void 0),$=function(t){var n=t.children,o=g(r.useState(null),2),i=o[0],l=o[1];return e.jsx(F.Provider,{value:{currentlyPlayingId:i,setCurrentlyPlayingId:l},children:n})};try{var q=require("react-native/Libraries/Image/resolveAssetSource");if("function"!=typeof q){var D=t.Image.resolveAssetSource.bind(t.Image);Object.keys(q).forEach((function(e){try{q[e]=D[e]}catch(e){}})),Object.defineProperty(q,"__esModule",{value:!1,configurable:!0}),global.__moviusRAS=D}}catch(e){}var W,B,H,U,G,Y,K,X,Z={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":"AAoJ2C,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"},J=function(o){var s,a,u,c,d,f,y,h=o.audioUrl,p=o.audioId,m=o.isVideoPlaying,x=I(),w=x.theme,j=x.CustomPlayIcon,S=x.CustomPauseIcon,P=function(){var e=r.useContext(F);if(!e)throw new Error("useAudio must be used within an AudioProvider");return e}(),C=P.currentlyPlayingId,O=P.setCurrentlyPlayingId,A=g(r.useState(null),2),$=A[0],q=A[1],D=g(r.useState(!1),2),W=D[0],B=D[1],H=g(r.useState(0),2),U=H[0],G=H[1],Y=g(r.useState(0),2),K=Y[0],X=Y[1],J=g(r.useState(!1),2),Q=J[0],ee=J[1],te=r.useRef(null),ne=r.useRef(0),re=r.useRef(0),oe=r.useRef(0),ie=i.useSharedValue(0);r.useEffect((function(){var e=!0,t=null;try{t=new l(h,"",(function(n){!n&&e&&t&&X(t.getDuration())})),q(t)}catch(e){console.warn("[movius-chats] AudioPlayer: Could not initialize react-native-sound.\nRun `npx expo run:android` (or ios) after a fresh install to apply the resolveAssetSource compatibility patch automatically.")}return function(){e=!1,t&&(t.pause(),t.release())}}),[h]),r.useEffect((function(){C&&C!==p&&W&&$&&($.pause(),B(!1),G(0),ie.value=0)}),[C,p,W,$]),r.useEffect((function(){var e;return W&&$&&!Q&&(e=setInterval((function(){$.getCurrentTime((function(e){if("number"==typeof e&&!isNaN(e)&&(G(e),ne.current>0&&K>0)){var t=e/K*ne.current;isNaN(t)||(ie.value=i.withSpring(t,{damping:15,stiffness:100}))}}))}),100)),function(){e&&clearInterval(e)}}),[W,$,Q,K]);var le,se,ae,ue,ce,de=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(ne.current>0){var t=e.nativeEvent.pageX-oe.current,n=Math.max(0,Math.min(t,ne.current));ie.value=n;var r=n/ne.current*K;isNaN(r)||G(r)}},onPanResponderRelease:function(){if(ee(!1),$&&ne.current>0){var e=ie.value/ne.current*K;isNaN(e)||$.setCurrentTime(e)}},onPanResponderTerminate:function(){ee(!1)}}),fe=i.useAnimatedStyle((le=[new global.Error,-2,-27],(se=function(){return{transform:[{translateX:ie.value}]}}).__closure={knobPosition:ie},se.__workletHash=1935336866997,se.__initData=Z,se.__stackDetails=le,se));return r.useEffect((function(){m&&W&&$&&$.pause((function(){B(!1),O(null)}))}),[m]),e.jsxs(t.View,{style:n(k||(k=b(["rounded-lg w-56"]))),children:[e.jsxs(t.View,{style:n(V||(V=b(["flex-row items-center gap-2 px-2 pt-2"]))),children:[e.jsx(t.Pressable,{onPress:function(){$&&(W?$.pause((function(){B(!1),O(null)})):(O(p),$.play((function(e){e&&(B(!1),G(0),ie.value=i.withSpring(0),O(null))})),B(!0)))},style:[n(E||(E=b(["bg-black/40 rounded-full p-2"]))),null==w||null===(s=w.messageStyle)||void 0===s?void 0:s.audioPlayButtonStyle],children:W?S?e.jsx(S,{}):e.jsx(N,{style:n.style("h-6 w-6"),color:(null==w||null===(a=w.colors)||void 0===a?void 0:a.audioPauseIconColor)||"white"}):j?e.jsx(j,{}):e.jsx(L,{style:n.style("h-6 w-6"),color:(null==w||null===(u=w.colors)||void 0===u?void 0:u.audioPlayIconColor)||"white"})}),e.jsxs(t.View,{ref:te,onLayout:function(e){var t,n=e.nativeEvent.layout.width;ne.current=n,null===(t=te.current)||void 0===t||t.measure((function(e,t,n,r,o){re.current=o}))},style:[n(M||(M=b(["relative h-1 bg-zinc-400 rounded overflow-visible w-[75%]"]))),null==w||null===(c=w.messageStyle)||void 0===c?void 0:c.progressBarStyle],children:[e.jsx(t.View,{style:[n(R||(R=b(["absolute h-full bg-slate-200"]))),{width:"".concat(K>0?U/K*100:0,"%")},null==w||null===(d=w.messageStyle)||void 0===d?void 0:d.activeProgressBarStyle]}),e.jsx(i.View,v(v({},de.panHandlers),{},{style:[fe,{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},v({},null==w||null===(f=w.messageStyle)||void 0===f?void 0:f.audioKnobStyle)]}))]})]}),e.jsx(t.View,{style:n(_||(_=b(["px-4 py-1"]))),children:e.jsx(t.Text,{style:T([n(z||(z=b(["text-xs text-gray-500"]))),null==w||null===(y=w.messageStyle)||void 0===y?void 0:y.audioDurationStyle],null==w?void 0:w.fontFamily),children:isNaN(U)?"0:00":(ae=U,ue=Math.floor(ae/60),ce=Math.floor(ae%60),"".concat(ue,":").concat(ce<10?"0":"").concat(ce))})})]})},Q=r.memo(J),ee=function(n){var i=n.style,l=n.spinning,s=void 0!==l&&l,a=r.useRef(new t.Animated.Value(0)).current;r.useEffect((function(){s&&t.Animated.loop(t.Animated.timing(a,{toValue:1,duration:1e3,easing:t.Easing.linear,useNativeDriver:!0})).start()}),[s]);var u=a.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return e.jsx(t.Animated.View,{style:s?{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"})})})},te=320,ne=te,re=Math.round(176),oe=te-re-2,ie=Math.round(159),le=function(o){var i,l=o.uri,a=o.cellStyle,u=o.roundedStyle,c=I(),d=c.theme,f=c.CustomPlayIcon,y=r.useRef(null),h=g(r.useState(0),2),p=h[0],v=h[1],m=g(r.useState(!0),2),x=m[0],w=m[1],j=g(r.useState(!1),2),S=j[0],P=j[1];return e.jsxs(t.View,{style:[a,u],children:[e.jsx(s,{source:{uri:l},ref:y,paused:!0,muted:!0,style:[u,{width:"100%",height:"100%"}],resizeMode:"cover",onLoadStart:function(){w(!0),P(!1)},onLoad:function(e){v(e.duration),w(!1)},onError:function(){P(!0),w(!1)}}),x&&e.jsx(t.View,{style:[n(W||(W=b(["absolute inset-0 items-center justify-center bg-black/40"]))),u],children:e.jsx(ee,{style:n.style("h-8 w-8"),spinning:!0})}),!x&&!S&&e.jsxs(e.Fragment,{children:[e.jsx(t.View,{style:n(B||(B=b(["pointer-events-none absolute inset-0 items-center justify-center"]))),children:f?e.jsx(f,{}):e.jsx(L,{style:n.style("h-10 w-10"),color:(null==d||null===(i=d.colors)||void 0===i?void 0:i.audioPlayIconColor)||"white"})}),e.jsx(t.View,{style:n(H||(H=b(["pointer-events-none absolute bottom-1 left-1 bg-black/50 px-1.5 py-0.5 rounded"]))),children:e.jsx(t.Text,{style:n(U||(U=b(["text-white text-[10px] font-semibold"]))),children:se(p)})})]}),S&&e.jsx(t.View,{style:[n(G||(G=b(["absolute inset-0 items-center justify-center bg-red-500/50"]))),u],children:e.jsx(t.Text,{style:T(n(Y||(Y=b(["text-white text-xs"]))),null==d?void 0:d.fontFamily),children:"Video"})})]})};function se(e){if(!e||Number.isNaN(e))return"0:00";var t=Math.floor(e/60),n=Math.floor(e%60);return"".concat(t,":").concat(n.toString().padStart(2,"0"))}var ae=function(r){var o=r.items,i=r.onOpenGallery,l=t.useWindowDimensions().width,s=Math.min(240,.72*l);if(0===o.length)return null;var a={borderRadius:6,overflow:"hidden"};if(1===o.length){var u=o[0];return e.jsx(t.Pressable,{onPress:function(){return i(o,0)},style:{width:s,height:320,marginVertical:8},children:"image"===u.kind?e.jsx(t.Image,{source:{uri:u.uri},style:{width:"100%",height:"100%",borderRadius:8},resizeMode:"cover"}):e.jsx(le,{uri:u.uri,cellStyle:{width:s,height:320},roundedStyle:{borderRadius:8}})})}if(2===o.length){var c=(s-2)/2;return e.jsx(t.View,{style:{width:s,height:ne,flexDirection:"row",gap:2,marginVertical:8},children:o.slice(0,2).map((function(n,r){return e.jsx(t.Pressable,{onPress:function(){return i(o,r)},style:{width:c,height:ne},children:"image"===n.kind?e.jsx(t.Image,{source:{uri:n.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(le,{uri:n.uri,cellStyle:{width:c,height:ne},roundedStyle:a})},"".concat(n.uri,"-").concat(r))}))})}if(3===o.length){var d=o[0],f=o[1],y=o[2],h=(s-2)/2;return e.jsxs(t.View,{style:{width:s,height:te,marginVertical:8,gap:2},children:[e.jsx(t.Pressable,{onPress:function(){return i(o,0)},style:{width:s,height:re},children:"image"===d.kind?e.jsx(t.Image,{source:{uri:d.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(le,{uri:d.uri,cellStyle:{width:s,height:re},roundedStyle:a})}),e.jsxs(t.View,{style:{flexDirection:"row",gap:2,height:oe},children:[e.jsx(t.Pressable,{onPress:function(){return i(o,1)},style:{width:h,height:oe},children:"image"===f.kind?e.jsx(t.Image,{source:{uri:f.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(le,{uri:f.uri,cellStyle:{width:h,height:oe},roundedStyle:a})},"".concat(f.uri,"-1")),e.jsx(t.Pressable,{onPress:function(){return i(o,2)},style:{width:h,height:oe},children:"image"===y.kind?e.jsx(t.Image,{source:{uri:y.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(le,{uri:y.uri,cellStyle:{width:h,height:oe},roundedStyle:a})},"".concat(y.uri,"-2"))]})]})}var p=(s-2)/2,v=o.length-4,m=o.slice(0,4);return e.jsx(t.View,{style:{width:s,height:te,flexWrap:"wrap",flexDirection:"row",gap:2,marginVertical:8},children:m.map((function(r,l){return e.jsxs(t.Pressable,{onPress:function(){return i(o,l)},style:{width:p,height:ie,position:"relative"},children:["image"===r.kind?e.jsx(t.Image,{source:{uri:r.uri},style:[a,{width:"100%",height:"100%"}],resizeMode:"cover"}):e.jsx(le,{uri:r.uri,cellStyle:{width:p,height:ie},roundedStyle:a}),3===l&&v>0&&e.jsx(t.View,{style:n(K||(K=b(["absolute inset-0 bg-black/55 items-center justify-center"]))),children:e.jsxs(t.Text,{style:n(X||(X=b(["text-white text-lg font-bold"]))),children:["+",v]})})]},"".concat(r.uri,"-").concat(l))}))})};function ue(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ce,de={exports:{}},fe={exports:{}},ye={};var he,pe,ve,me,xe,ge,be,we,je,Se,Pe,Ce,Ie,Oe,Ae,Te={};
|
|
2
2
|
/** @license React v16.13.1
|
|
3
3
|
* react-is.development.js
|
|
4
4
|
*
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/function
|
|
9
|
+
*/function ke(){return pe||(pe=1,"production"===process.env.NODE_ENV?fe.exports=function(){if(ce)return ye;ce=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,s=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,y=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,p=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 g(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case a:case u:case r:case i:case o:case d:return e;default:switch(e=e&&e.$$typeof){case s:case c:case h:case y:case l:return e;default:return f}}case n:return f}}}function b(e){return g(e)===u}return ye.AsyncMode=a,ye.ConcurrentMode=u,ye.ContextConsumer=s,ye.ContextProvider=l,ye.Element=t,ye.ForwardRef=c,ye.Fragment=r,ye.Lazy=h,ye.Memo=y,ye.Portal=n,ye.Profiler=i,ye.StrictMode=o,ye.Suspense=d,ye.isAsyncMode=function(e){return b(e)||g(e)===a},ye.isConcurrentMode=b,ye.isContextConsumer=function(e){return g(e)===s},ye.isContextProvider=function(e){return g(e)===l},ye.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},ye.isForwardRef=function(e){return g(e)===c},ye.isFragment=function(e){return g(e)===r},ye.isLazy=function(e){return g(e)===h},ye.isMemo=function(e){return g(e)===y},ye.isPortal=function(e){return g(e)===n},ye.isProfiler=function(e){return g(e)===i},ye.isStrictMode=function(e){return g(e)===o},ye.isSuspense=function(e){return g(e)===d},ye.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===i||e===o||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===l||e.$$typeof===s||e.$$typeof===c||e.$$typeof===v||e.$$typeof===m||e.$$typeof===x||e.$$typeof===p)},ye.typeOf=g,ye}():fe.exports=(he||(he=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,s=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,y=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,p=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 g(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var p=e.type;switch(p){case a:case u:case r:case i:case o:case d:return p;default:var v=p&&p.$$typeof;switch(v){case s:case c:case h:case y:case l:return v;default:return f}}case n:return f}}}var b=a,w=u,j=s,S=l,P=t,C=c,I=r,O=h,A=y,T=n,k=i,V=o,E=d,M=!1;function R(e){return g(e)===u}Te.AsyncMode=b,Te.ConcurrentMode=w,Te.ContextConsumer=j,Te.ContextProvider=S,Te.Element=P,Te.ForwardRef=C,Te.Fragment=I,Te.Lazy=O,Te.Memo=A,Te.Portal=T,Te.Profiler=k,Te.StrictMode=V,Te.Suspense=E,Te.isAsyncMode=function(e){return M||(M=!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)||g(e)===a},Te.isConcurrentMode=R,Te.isContextConsumer=function(e){return g(e)===s},Te.isContextProvider=function(e){return g(e)===l},Te.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Te.isForwardRef=function(e){return g(e)===c},Te.isFragment=function(e){return g(e)===r},Te.isLazy=function(e){return g(e)===h},Te.isMemo=function(e){return g(e)===y},Te.isPortal=function(e){return g(e)===n},Te.isProfiler=function(e){return g(e)===i},Te.isStrictMode=function(e){return g(e)===o},Te.isSuspense=function(e){return g(e)===d},Te.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===i||e===o||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===l||e.$$typeof===s||e.$$typeof===c||e.$$typeof===v||e.$$typeof===m||e.$$typeof===x||e.$$typeof===p)},Te.typeOf=g}()),Te)),fe.exports}
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/function Ae(){if(pe)return he;pe=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return he=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={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var i,l,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),a=1;a<arguments.length;a++){for(var u in i=Object(arguments[a]))t.call(i,u)&&(s[u]=i[u]);if(e){l=e(i);for(var c=0;c<l.length;c++)n.call(i,l[c])&&(s[l[c]]=i[l[c]])}}return s},he}function ke(){if(me)return ve;me=1;return ve="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Ve(){return ge?xe:(ge=1,xe=Function.call.bind(Object.prototype.hasOwnProperty))}function Ee(){if(we)return be;we=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=ke(),n={},r=Ve();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,i,l,s,a){if("production"!==process.env.NODE_ENV)for(var u in o)if(r(o,u)){var c;try{if("function"!=typeof o[u]){var d=Error((s||"React class")+": "+l+" 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,s,l,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((s||"React class")+": type specification of "+l+" `"+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 n)){n[c.message]=!0;var f=a?a():"";e("Failed "+l+" type: "+c.message+(null!=f?f:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},be=o}function Me(){if(Se)return je;Se=1;var e=Te(),t=Ae(),n=ke(),r=Ve(),o=Ee(),i=function(){};function l(){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){}}),je=function(s,a){var u="function"==typeof Symbol&&Symbol.iterator;var c="<<anonymous>>",d={array:p("array"),bigint:p("bigint"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:h(l),arrayOf:function(e){return h((function(t,r,o,i,l){if("function"!=typeof e)return new y("Property `"+l+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s))return new y("Invalid "+i+" `"+l+"` of type `"+x(s)+"` supplied to `"+o+"`, expected an array.");for(var a=0;a<s.length;a++){var u=e(s,a,o,i,l+"["+a+"]",n);if(u instanceof Error)return u}return null}))},element:h((function(e,t,n,r,o){var i=e[t];return s(i)?null:new y("Invalid "+r+" `"+o+"` of type `"+x(i)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:h((function(t,n,r,o,i){var l=t[n];return e.isValidElementType(l)?null:new y("Invalid "+o+" `"+i+"` of type `"+x(l)+"` supplied to `"+r+"`, expected a single ReactElement type.")})),instanceOf:function(e){return h((function(t,n,r,o,i){if(!(t[n]instanceof e)){var l=e.name||c;return new y("Invalid "+o+" `"+i+"` of type `"+(((s=t[n]).constructor&&s.constructor.name?s.constructor.name:c)+"` supplied to `")+r+"`, expected instance of `"+l+"`.")}var s;return null}))},node:h((function(e,t,n,r,o){return m(e[t])?null:new y("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return h((function(t,o,i,l,s){if("function"!=typeof e)return new y("Property `"+s+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var a=t[o],u=x(a);if("object"!==u)return new y("Invalid "+l+" `"+s+"` of type `"+u+"` supplied to `"+i+"`, expected an object.");for(var c in a)if(r(a,c)){var d=e(a,c,i,l,s+"."+c,n);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."),l;return h((function(t,n,r,o,i){for(var l=t[n],s=0;s<e.length;s++)if(f(l,e[s]))return null;var a=JSON.stringify(e,(function(e,t){return"symbol"===g(t)?String(t):t}));return new y("Invalid "+o+" `"+i+"` of value `"+String(l)+"` supplied to `"+r+"`, 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."),l;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 "+b(o)+" at index "+t+"."),l}return h((function(t,o,i,l,s){for(var a=[],u=0;u<e.length;u++){var c=(0,e[u])(t,o,i,l,s,n);if(null==c)return null;c.data&&r(c.data,"expectedType")&&a.push(c.data.expectedType)}return new y("Invalid "+l+" `"+s+"` supplied to `"+i+"`"+(a.length>0?", expected one of type ["+a.join(", ")+"]":"")+".")}))},shape:function(e){return h((function(t,r,o,i,l){var s=t[r],a=x(s);if("object"!==a)return new y("Invalid "+i+" `"+l+"` 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,l,u,g(c));var d=c(s,u,o,i,l+"."+u,n);if(d)return d}return null}))},exact:function(e){return h((function(o,i,l,s,a){var u=o[i],c=x(u);if("object"!==c)return new y("Invalid "+s+" `"+a+"` of type `"+c+"` supplied to `"+l+"`, expected `object`.");var d=t({},o[i],e);for(var f in d){var h=e[f];if(r(e,f)&&"function"!=typeof h)return v(l,s,a,f,g(h));if(!h)return new y("Invalid "+s+" `"+a+"` key `"+f+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var p=h(u,f,l,s,a+"."+f,n);if(p)return p}return null}))}};function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function y(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function h(e){if("production"!==process.env.NODE_ENV)var t={},r=0;function o(o,l,s,u,d,f,h){if(u=u||c,f=f||s,h!==n){if(a){var p=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 p.name="Invariant Violation",p}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var v=u+":"+s;!t[v]&&r<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,r++)}}return null==l[s]?o?null===l[s]?new y("The "+d+" `"+f+"` is marked as required in `"+u+"`, but its value is `null`."):new y("The "+d+" `"+f+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(l,s,u,d,f)}var l=o.bind(null,!1);return l.isRequired=o.bind(null,!0),l}function p(e){return h((function(t,n,r,o,i,l){var s=t[n];return x(s)!==e?new y("Invalid "+o+" `"+i+"` of type `"+g(s)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null}))}function v(e,t,n,r,o){return new y((e||"React class")+": "+t+" type `"+n+"."+r+"` 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||s(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 n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!m(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.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 g(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 b(e){var t=g(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return y.prototype=Error.prototype,d.checkPropTypes=o,d.resetWarningCache=o.resetWarningCache,d.PropTypes=d,d},je}function Re(){if(Ce)return Pe;Ce=1;var e=ke();function t(){}function n(){}return n.resetWarningCache=t,Pe=function(){function r(t,n,r,o,i,l){if(l!==e){var s=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 s.name="Invariant Violation",s}}function o(){return r}r.isRequired=r;var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i}}function _e(){if(Ie)return ue.exports;if(Ie=1,"production"!==process.env.NODE_ENV){var e=Te();ue.exports=Me()(e.isElement,true)}else ue.exports=Re()();return ue.exports}var ze,Ne,Fe,Le,$e,De,qe,We=se(_e()),Be=function(){return d((function e(t,n){c(this,e),this.text=t,this.patterns=n||[]}),[{key:"parse",value:function(){var e=this,t=[{children:this.text}];return this.patterns.forEach((function(n){var r=[],o=n.nonExhaustiveModeMaxMatchCount||0,i=Math.min(Math.max(Number.isInteger(o)?o:0,0)||Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),l=0;t.forEach((function(t){if(t._matched)r.push(t);else{var o,s=[],a=t.children,u=0;for(n.pattern.lastIndex=0;a&&(o=n.pattern.exec(a));){var c=a.substr(0,o.index);if(u=o.index,++l>i)break;s.push({children:c}),s.push(e.getMatchedPart(n,o[0],o,u)),a=a.substr(o.index+o[0].length),u+=o[0].length-1,n.pattern.lastIndex=0}s.push({children:a}),r.push.apply(r,s)}})),t=r})),t.forEach((function(e){return delete e._matched})),t.filter((function(e){return!!e.children}))}},{key:"getMatchedPart",value:function(e,t,n,r){var o={};Object.keys(e).forEach((function(n){"pattern"!==n&&"renderText"!==n&&"nonExhaustiveModeMaxMatchCount"!==n&&("function"==typeof e[n]?o[n]=function(){return e[n](t,r)}:o[n]=e[n])}));var i=t;return e.renderText&&"function"==typeof e.renderText&&(i=e.renderText(t,n)),v(v({},o),{},{children:i,_matched:!0})}}])}(),He=["type"],Ue=["style"],Ge=["parse","childrenProps"],Ye={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+/},Ke=We.shape(v(v({},t.Text.propTypes),{},{type:We.oneOf(Object.keys(Ye)).isRequired,nonExhaustiveMaxMatchCount:We.number})),Xe=We.shape(v(v({},t.Text.propTypes),{},{pattern:We.oneOfType([We.string,We.instanceOf(RegExp)]).isRequired,nonExhaustiveMaxMatchCount:We.number})),Ze=function(){function n(){return c(this,n),u(this,n,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&&x(e,t)}(n,r.Component),d(n,[{key:"setNativeProps",value:function(e){this._root.setNativeProps(e)}},{key:"getPatterns",value:function(){return this.props.parse.map((function(e){var t=e.type,n=m(e,He);if(t){if(!Ye[t])throw new Error("".concat(e.type," is not a supported type"));n.pattern=Ye[t]}return n}))}},{key:"getParsedText",value:function(){var n=this;return this.props.parse?"string"!=typeof this.props.children?this.props.children:new Be(this.props.children,this.getPatterns()).parse().map((function(r,o){var i=n.props.style,l=r.style,s=m(r,Ue);return e.jsx(t.Text,v(v({style:[i,l]},n.props.childrenProps),s),"parsedText-".concat(o))})):this.props.children}},{key:"render",value:function(){var n=this,r=v({},this.props);r.parse,r.childrenProps;var o=m(r,Ge);return e.jsx(t.Text,v(v({ref:function(e){return n._root=e}},o),{},{children:this.getParsedText()}))}}])}();Ze.displayName="ParsedText",Ze.propTypes=v(v({},t.Text.propTypes),{},{parse:We.arrayOf(We.oneOfType([Ke,Xe])),childrenProps:We.shape(t.Text.propTypes)}),Ze.defaultProps={parse:null,childrenProps:{}};var Qe,Je,et,tt,nt,rt,ot,it,lt,st,at,ut,ct,dt,ft,yt,ht,pt,vt=function(o){var i,l,s,a,u=o.message,c=o.onGalleryOpen,d=o.isVideoPlaying,f=o.isCurrentUser,y=I(),h=y.theme,p=y.showMessageStatus,m=y.onFileAttachmentPress,x=r.useMemo((function(){return O(u)}),[u]);return e.jsxs(t.View,{children:[x.length>0&&e.jsx(le,{items:x,onOpenGallery:c}),(null!==(i=u.fileAttachments)&&void 0!==i?i:[]).map((function(r,o){return e.jsxs(t.Pressable,{onPress:function(){m?m(r):t.Linking.openURL(r.uri.startsWith("http")||r.uri.startsWith("file:")?r.uri:"file://".concat(r.uri))},style:n(ze||(ze=b(["my-1.5 py-2 px-3 rounded-lg bg-black/10 max-w-[220px]"]))),children:[e.jsxs(t.Text,{style:A(n(Ne||(Ne=b(["text-xs font-semibold"]))),null==h?void 0:h.fontFamily),numberOfLines:2,children:["📎 ",r.name]}),e.jsx(t.Text,{style:n(Fe||(Fe=b(["text-[10px] opacity-70 mt-0.5"]))),children:r.type})]},"".concat(r.uri,"-").concat(o))})),u.audio&&e.jsx(t.View,{style:n(Le||(Le=b(["my-2"]))),children:e.jsx(Z,{audioUrl:u.audio,audioId:u.id,isVideoPlaying:d})}),u.text&&e.jsx(Ze,{style:A([n($e||($e=b(["pt-1"]))),n(p?De||(De=b(["pb-0"])):qe||(qe=b(["pb-2"]))),{wordBreak:"break-word",overflowWrap:"break-word"},f?null==h||null===(l=h.messageStyle)||void 0===l?void 0:l.sentTextStyle:null==h||null===(s=h.messageStyle)||void 0===s?void 0:s.receivedTextStyle],null==h?void 0:h.fontFamily),parse:[{type:"url",style:v({color:"blue",textDecorationLine:"underline"},(a=null==h?void 0:h.fontFamily,a?{fontFamily:a}:void 0)),onPress:function(e){return t.Linking.openURL(e.startsWith("http")?e:"https://".concat(e))}}],childrenProps:{allowFontScaling:!1},children:u.text})]})},mt=r.memo(vt),xt=function(t){var n=t.style,r=t.fill;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsx(o.Path,{fill:r,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"})})},gt=function(t){var n=t.style,r=t.fill;return e.jsx(o,{style:n,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",fill:r})})},bt=function(r){var o,i,l,s,a=r.time,u=r.status,c=r.isCurrentUser,d=r.hasText,f=r.hasAudio,y=r.hasGalleryMedia,h=r.hasFileAttachments,p=I(),v=p.theme,m=p.showMessageStatus,x=(y||h)&&!d&&!f;return e.jsx(e.Fragment,{children:m&&e.jsxs(t.View,{style:[n(Qe||(Qe=b(["flex-row items-center"]))),n(d?Je||(Je=b(["justify-end pb-1 ml-4"])):f?et||(et=b(["absolute right-3 bottom-3"])):x?tt||(tt=b(["absolute right-3 bottom-4 bg-black/50 px-2 py-1 rounded-md"])):nt||(nt=b(["absolute right-3 bottom-4 bg-black/50 px-2 py-1 rounded-md"])))],children:[e.jsx(t.Text,{style:A([n(rt||(rt=b(["text-xs"]))),{color:d||f?(null==v||null===(o=v.colors)||void 0===o?void 0:o.timestamp)||"rgba(107, 114, 128, 0.7)":"white"}],null==v?void 0:v.fontFamily),children:a}),c&&e.jsxs(t.View,{style:n(ot||(ot=b(["ml-1 flex-row items-center"]))),children:["sent"===u&&e.jsx(gt,{style:n.style("h-4 w-4",{opacity:.7}),fill:(null==v||null===(i=v.colors)||void 0===i?void 0:i.sentIconColor)||"#6B7280"}),"delivered"===u&&e.jsx(xt,{style:n.style("h-4 w-4",{opacity:.7}),fill:(null==v||null===(l=v.colors)||void 0===l?void 0:l.deliveredIconColor)||"#6B7280"}),"read"===u&&e.jsx(xt,{style:n.style("h-4 w-4",{opacity:.9}),fill:(null==v||null===(s=v.colors)||void 0===s?void 0:s.readIconColor)||"#3B82F6"})]})]})})},wt=r.memo(bt),jt=function(r){var o,i,l,s,a,u,c,d,f,y,h=r.message,p=r.isCurrentUser,m=r.isFirstInSequence,x=r.onLongPress,g=I(),w=g.theme,S=g.showAvatars,P=g.showUserNames,C=g.showBubbleTail,T=g.setMediaViewerGallery,k=g.isVideoPlaying,V=O(h),E=(null!==(o=null===(i=h.fileAttachments)||void 0===i?void 0:i.length)&&void 0!==o?o:0)>0&&0===V.length&&!h.text&&!h.audio;return e.jsxs(t.Pressable,{onLongPress:x,style:[n(it||(it=b(["px-2 my-1 max-w-[75%] relative"]))),n(p?lt||(lt=b(["self-end mr-3"])):st||(st=b(["self-start ml-9"]))),n(m?p?at||(at=b(["bg-green-500 rounded-tr-none"])):ut||(ut=b(["bg-white rounded-tl-none"])):p?ct||(ct=b(["bg-green-500"])):dt||(dt=b(["bg-white"]))),v({borderRadius:8},p?null==w||null===(l=w.bubbleStyle)||void 0===l?void 0:l.sent:null==w||null===(s=w.bubbleStyle)||void 0===s?void 0:s.received)],children:[!p&&m&&S&&e.jsxs(e.Fragment,{children:[e.jsx(t.View,{style:n(ft||(ft=b(["absolute w-6 h-6 rounded-full top-0 -left-9 flex-row items-center"]))),children:h.senderAvatar?e.jsx(t.Image,{source:{uri:h.senderAvatar},style:[n(yt||(yt=b(["w-full h-full rounded-full"]))),null==w||null===(a=w.bubbleStyle)||void 0===a?void 0:a.avatarImageStyle],resizeMode:"cover"}):e.jsx(t.Text,{style:A([n(ht||(ht=b(["text-sm text-black font-semibold capitalize rounded-full bg-zinc-300 w-full h-full text-center pt-0.5"]))),null==w||null===(u=w.bubbleStyle)||void 0===u?void 0:u.avatarTextStyle],null==w?void 0:w.fontFamily),children:null===(c=h.senderName)||void 0===c?void 0:c.charAt(0)})}),P&&h.senderName&&e.jsx(t.Text,{style:A([n(pt||(pt=b(["text-sm text-black font-semibold mt-1 capitalize"]))),null==w||null===(d=w.bubbleStyle)||void 0===d?void 0:d.userNameStyle],null==w?void 0:w.fontFamily),children:h.senderName})]}),m&&C&&e.jsx(j,{style:n.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==w||null===(f=w.colors)||void 0===f?void 0:f.sentMessageTailColor)||"rgba(34, 197, 94,1)":(null==w||null===(y=w.colors)||void 0===y?void 0:y.receivedMessageTailColor)||"white")}),e.jsx(mt,{message:h,isCurrentUser:p,isFirstInSequence:m,onGalleryOpen:function(e,t){T(e,t)},isVideoPlaying:k}),e.jsx(wt,{time:h.time,status:p?h.status:void 0,isCurrentUser:p,hasText:!!h.text,hasAudio:!!h.audio,hasGalleryMedia:V.length>0&&!h.text,hasFileAttachments:E})]})},St=r.memo(jt),Pt=function(t){var n=t.style,r=t.color;return e.jsx(o.Svg,{style:n,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:r,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"})]})})},Ct=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",stroke:r,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"})]})})},It=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:r,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"})]})})},Ot=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,fill:r,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"})})},Tt=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:r,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"})]})})},At=function(t){var n=t.style,r=t.fill,i=void 0===r?"currentColor":r;return e.jsxs(o,{style:n,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"})]})},kt=function(n){var r=n.fileName,o=n.style,i=I().theme;return e.jsx(t.Text,{numberOfLines:2,ellipsizeMode:"tail",style:A([{fontSize:14,fontWeight:"600",color:"black"},o],null==i?void 0:i.fontFamily),children:function(e){var t=e.lastIndexOf(".");if(-1===t)return e;var n=e.slice(0,t),r=e.slice(t);return n.length>40?n.slice(0,40)+"..."+r:n+r}(r)})},Vt=r.memo(kt);function Et(e){return e.filter((function(e){var t,n;return(null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))||(null===(n=e.type)||void 0===n?void 0:n.startsWith("video/"))})).map((function(e){return{uri:e.uri,kind:e.type.startsWith("video/")?"video":"image"}}))}var Mt,Rt,_t,zt,Nt,Ft,Lt,$t,Dt,qt,Wt,Bt,Ht,Ut,Gt,Yt,Kt=function(n){var r,o=n.previews,i=n.closePreview,l=n.onRemoveItem,a=n.CustomFileIcon,u=n.CustomImagePreview,c=n.CustomVideoPreview,d=n.inputHeight,f=I(),y=f.theme,h=f.setMediaViewerGallery,p=o.filter((function(e){var t,n;return(null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))||(null===(n=e.type)||void 0===n?void 0:n.startsWith("video/"))})),v=o.filter((function(e){var t,n;return!(null!==(t=e.type)&&void 0!==t&&t.startsWith("image/")||null!==(n=e.type)&&void 0!==n&&n.startsWith("video/"))})),m=Et(o);if(0===o.length)return null;var x=function(e){0!==m.length&&h(m,e)},g=function(n){var r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:56,l=null===(r=n.type)||void 0===r?void 0:r.startsWith("image/"),a=null===(o=n.type)||void 0===o?void 0:o.startsWith("video/");return l&&u?e.jsx(u,{uri:n.uri}):a&&c?e.jsx(c,{uri:n.uri}):l?e.jsx(t.Image,{source:{uri:n.uri},style:{width:i,height:i,borderRadius:12},resizeMode:"cover"}):a?e.jsx(t.View,{style:{width:i,height:i,borderRadius:12,overflow:"hidden"},children:e.jsx(s,{source:{uri:n.uri},style:{width:"100%",height:"100%"},resizeMode:"cover",muted:!0,repeat:!0,paused:!1})}):null},b=function(n,r){return e.jsx(t.Pressable,{onPress:function(){return l?l(n):null==i?void 0:i()},style:{position:"absolute",zIndex:50,height:22,width:22,backgroundColor:"rgba(0,0,0,0.55)",right:-6,top:-6,borderRadius:11,justifyContent:"center",alignItems:"center",transform:r?[{rotate:r}]:void 0},children:e.jsx(t.Text,{style:A({fontSize:13,color:"white",fontWeight:"700",lineHeight:14},null==y?void 0:y.fontFamily),children:"×"})})};return e.jsx(t.View,{style:[{position:"absolute",bottom:(null!=d?d:0)+8,zIndex:20,borderRadius:12,maxWidth:"92%",alignSelf:"flex-start"},null==y||null===(r=y.filePreviewStyle)||void 0===r?void 0:r.root],children:e.jsxs(t.View,{style:{gap:8},children:[function(){if(0===p.length)return null;if(1===p.length){var n=p[0];return n?e.jsxs(t.Pressable,{onPress:function(){return x(0)},style:{position:"relative"},children:[g(n),b(n.uri)]}):null}var r=p.slice(0,3),o=p.length>3?p.length-3:0;return e.jsx(t.View,{style:{flexDirection:"row",alignItems:"center",minHeight:68},children:r.map((function(n,i){var l=2===r.length?0===i?"-4deg":"4deg":0===i?"-10deg":1===i?"0deg":"10deg",s=2===r.length?0===i?"4deg":"-4deg":0===i?"10deg":1===i?"0deg":"-10deg";return e.jsx(t.Pressable,{onPress:function(){var e=Et(p).findIndex((function(e){return e.uri===n.uri}));x(e>=0?e:0)},style:{marginLeft:0===i?0:-18,zIndex:i+1,transform:[{rotate:l}],position:"relative"},children:e.jsxs(t.View,{style:{position:"relative"},children:[g(n),2===i&&o>0&&e.jsx(t.View,{style:{position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:12,backgroundColor:"rgba(0,0,0,0.55)",alignItems:"center",justifyContent:"center"},children:e.jsxs(t.Text,{style:{color:"#fff",fontWeight:"700",fontSize:14},children:["+",o]})}),b(n.uri,s)]})},"".concat(n.uri,"-").concat(i))}))})}(),v.length>0&&e.jsx(t.ScrollView,{scrollEnabled:v.length>3,style:{maxHeight:232},showsVerticalScrollIndicator:v.length>3,contentContainerStyle:{gap:8},nestedScrollEnabled:!0,children:v.map((function(n,r){return function(n,r){var o,i,l,s;return e.jsxs(t.View,{style:{position:"relative"},children:[e.jsxs(t.View,{style:[{backgroundColor:"white",width:240,minHeight:64,borderRadius:12,flexDirection:"row",padding:4,gap:4,alignItems:"center"},null==y||null===(o=y.filePreviewStyle)||void 0===o?void 0:o.container],children:[e.jsx(t.View,{style:[{backgroundColor:"#d1d5db",borderRadius:8,padding:4,justifyContent:"center",alignItems:"center"},null==y||null===(i=y.filePreviewStyle)||void 0===i?void 0:i.iconContainer],children:a?e.jsx(a,{}):e.jsx(At,{style:{width:40,height:40},fill:"white"})}),e.jsx(t.View,{style:[{backgroundColor:"#f3f4f6",flex:1,borderRadius:8,justifyContent:"center",paddingHorizontal:12},null==y||null===(l=y.filePreviewStyle)||void 0===l?void 0:l.nameContainer],children:e.jsx(Vt,{fileName:n.name||"File",style:null==y||null===(s=y.filePreviewStyle)||void 0===s?void 0:s.text})})]}),b(n.uri)]},"".concat(n.uri,"-").concat(r))}(n,r)}))})]})})},Xt=r.memo(Kt),Zt="ios"===t.Platform.OS?32:30,Qt="ios"===t.Platform.OS?50:48,Jt="h-6 w-6",en=function(o){var i,l,s,a,u,c,d,f,y,h,p,m,x,w=o.onSendMessage,j=o.onTypingStart,S=o.onTypingEnd,P=o.onAttachmentPress,C=o.onCameraPress,O=o.onAudioRecordStart,k=o.onAudioRecordEnd,V=o.CustomEmojiIcon,E=o.CustomAttachmentIcon,M=o.CustomCameraIcon,R=o.CustomSendIcon,_=o.CustomMicrophoneIcon,z=o.CustomFileIcon,N=o.CustomImagePreview,F=o.CustomVideoPreview,L=g(r.useState(""),2),$=L[0],D=L[1],q=g(r.useState(0),2),W=q[0],B=q[1],H=g(r.useState({height:Zt,isMultiline:!1}),2),U=H[0],G=H[1],Y=I(),K=Y.theme,X=Y.currentUserId,Z=Y.showEmojiButton,Q=Y.showAttachmentsButton,J=Y.showCameraButton,ee=Y.showVoiceRecordButton,te=Y.placeholder,ne=Y.previewData,re=Y.previewItems,oe=Y.closePreview,ie=Y.onRemovePreviewItem,le=r.useMemo((function(){return null!=re&&re.length?re:ne?[ne]:[]}),[re,ne]),se=le.length>0,ae=null==K||null===(i=K.sizes)||void 0===i?void 0:i.inputIconSize,ue=function(e){if("number"==typeof e&&e>0)return{width:e,height:e};var t="string"==typeof e&&e.trim().length>0?e.trim():T;return n.style(t)}(ae),ce="number"==typeof(x=ae)&&x>0?x:24,de=0===$.trim().length&&!U.isMultiline,fe=Math.max(0,(Qt-ce)/2),ye=de?{paddingTop:fe,paddingBottom:fe}:{paddingBottom:fe},he=r.useCallback((function(){G({height:Zt,isMultiline:!1}),B((function(e){return e+1}))}),[]),pe=r.useCallback((function(e){D(e),0===e.length&&he()}),[he]),ve=r.useCallback((function(e){var t=Math.min(Math.max(e.nativeEvent.contentSize.height,Zt),118),n=t>Zt;G({height:n?t:Zt,isMultiline:n})}),[]),me=r.useCallback((function(){var e=$.trim();(e||se)&&(w({text:e,senderId:X}),D(""),he())}),[$,w,X,se,he]);r.useEffect((function(){$.trim()?null==j||j():null==S||S()}),[$,j,S]);var xe=!!$.trim()||se;return e.jsxs(t.View,{style:n(Mt||(Mt=b(["w-full px-2"]))),children:[se&&e.jsx(Xt,{previews:le,closePreview:oe,onRemoveItem:ie,CustomFileIcon:z,CustomImagePreview:N,CustomVideoPreview:F,inputHeight:U.height}),e.jsxs(t.View,{style:[n(Rt||(Rt=b(["flex-row items-end gap-2"]))),null==K||null===(l=K.inputStyles)||void 0===l?void 0:l.inputSectionContainerStyle],children:[e.jsxs(t.View,{style:[n(_t||(_t=b(["flex-1 flex-row bg-white overflow-hidden px-3.5"]))),{minHeight:Qt,borderRadius:de?9999:24,alignItems:de?"center":"flex-end"},null==K||null===(s=K.inputStyles)||void 0===s?void 0:s.inputContainerStyle],children:[Z&&e.jsx(t.View,{style:ye,children:e.jsx(t.Pressable,{children:V?e.jsx(V,{}):e.jsx(Ct,{style:ue,color:(null==K||null===(a=K.colors)||void 0===a?void 0:a.inputsIconsColor)||"rgba(0,0,0,0.7)"})})}),e.jsx(t.TextInput,{value:$,onChangeText:pe,placeholder:te||"Message",style:A([n(zt||(zt=b(["bg-transparent flex-1 pl-2"]))),"ios"===t.Platform.OS?n(Nt||(Nt=b(["text-[17px]"]))):n(Ft||(Ft=b(["text-[16px]"]))),{minHeight:Zt,maxHeight:118,paddingVertical:de?0:8,marginVertical:de?(Qt-Zt)/2:4},{color:(null==K||null===(u=K.colors)||void 0===u?void 0:u.inputTextColor)||"rgba(0, 0, 0, 0.87)"}],null==K?void 0:K.fontFamily),placeholderTextColor:(null==K||null===(c=K.colors)||void 0===c?void 0:c.placeholderTextColor)||"rgba(0, 0, 0, 0.4)",multiline:!0,textAlignVertical:U.isMultiline&&$.length>0?"top":"center",onContentSizeChange:ve},"chat-input-".concat(W)),e.jsxs(t.View,{style:[n(Lt||(Lt=b(["flex-row items-center gap-4"]))),ye],children:[Q&&e.jsx(t.Pressable,{onPress:P,children:E?e.jsx(E,{}):e.jsx(Ot,{style:ue,color:(null==K||null===(d=K.colors)||void 0===d?void 0:d.inputsIconsColor)||"rgba(0,0,0,0.7)"})}),J&&!$.trim()&&e.jsx(t.Pressable,{onPress:C,children:M?e.jsx(M,{}):e.jsx(Pt,{style:ue,color:(null==K||null===(f=K.colors)||void 0===f?void 0:f.inputsIconsColor)||"rgba(0,0,0,0.7)"})})]})]}),e.jsx(t.Pressable,{style:[n($t||($t=b(["p-2 rounded-full bg-green-600 justify-center items-center"]))),v({height:Qt,width:Qt},null==K||null===(y=K.inputStyles)||void 0===y?void 0:y.sendButtonStyle)],onPress:xe?me:O,onLongPress:O,onPressOut:k,children:xe?R?e.jsx(R,{}):e.jsx(Tt,{style:n.style(Jt),color:(null==K||null===(h=K.colors)||void 0===h?void 0:h.sendIconsColor)||"rgba(255,255,255,0.7)"}):ee?_?e.jsx(_,{}):e.jsx(It,{style:n.style("h-8 w-8"),color:(null==K||null===(p=K.colors)||void 0===p?void 0:p.sendIconsColor)||"rgba(255,255,255,0.7)"}):R?e.jsx(R,{}):e.jsx(Tt,{style:n.style(Jt),color:(null==K||null===(m=K.colors)||void 0===m?void 0:m.sendIconsColor)||"rgba(255,255,255,0.7)"})})]})]})},tn=r.memo(en);function nn(t){var r=t.style;return e.jsxs(o.Svg,{viewBox:"0 0 24 24",fill:"none",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:n.style("h-6 w-6 text-black",r),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 rn,on,ln,sn,an,un,cn,dn,fn,yn,hn,pn,vn,mn,xn,gn=function(o){var i=o.gallery,l=o.onClose,s=I(),a=s.theme,u=s.setIsVideoPlaying,c=r.useRef(null),d=g(r.useState(0),2),f=d[0],y=d[1],h=t.useWindowDimensions(),p=h.width,v=h.height;r.useEffect((function(){null!=i&&i.items.length&&(y(i.initialIndex),requestAnimationFrame((function(){try{var e;null===(e=c.current)||void 0===e||e.scrollToIndex({index:i.initialIndex,animated:!1})}catch(e){}})))}),[null==i?void 0:i.initialIndex,null==i?void 0:i.items]);var m=r.useCallback((function(e){var t=Math.round(e.nativeEvent.contentOffset.x/p);y(t);var n=null==i?void 0:i.items[t];u("video"===(null==n?void 0:n.kind))}),[null==i?void 0:i.items,p,u]);return i&&0!==i.items.length?e.jsx(t.Modal,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:e.jsxs(t.View,{style:[n(Dt||(Dt=b(["flex-1 bg-black"]))),{width:p,height:v}],children:[e.jsx(t.Pressable,{onPress:l,style:n(qt||(qt=b(["absolute right-4 top-12 z-20 p-2 rounded-full bg-slate-100/70"]))),children:e.jsx(nn,{style:n(Wt||(Wt=b(["h-8 w-8"])))})}),i.items.length>1&&e.jsx(t.View,{style:n(Bt||(Bt=b(["absolute top-14 left-0 right-0 z-10 items-center"]))),children:e.jsxs(t.Text,{style:A(n(Ht||(Ht=b(["text-white/90 text-sm bg-black/40 px-3 py-1 rounded-full"]))),null==a?void 0:a.fontFamily),children:[f+1," / ",i.items.length]})}),e.jsx(t.FlatList,{ref:c,data:i.items,horizontal:!0,pagingEnabled:!0,showsHorizontalScrollIndicator:!1,keyExtractor:function(e,t){return"".concat(e.uri,"-").concat(t)},initialScrollIndex:i.initialIndex,getItemLayout:function(e,t){return{length:p,offset:p*t,index:t}},onMomentumScrollEnd:m,onScrollToIndexFailed:function(e){var t=e.index;setTimeout((function(){var e;null===(e=c.current)||void 0===e||e.scrollToIndex({index:t,animated:!1})}),100)},renderItem:function(t){var n=t.item;return e.jsx(bn,{item:n,width:p,height:v})}})]})}):null},bn=function(o){var i=o.item,l=o.width,a=o.height,u=I().theme,c=r.useRef(null),d=g(r.useState("video"===i.kind),2),f=d[0],y=d[1],h=g(r.useState(!1),2),p=h[0],v=h[1];return"image"===i.kind?e.jsx(t.View,{style:{width:l,height:a,justifyContent:"center"},children:e.jsx(t.Image,{source:{uri:i.uri},style:{width:l,height:a},resizeMode:"contain"})}):e.jsxs(t.View,{style:{width:l,height:a,justifyContent:"center",alignItems:"center",paddingHorizontal:16},children:[e.jsx(s,{source:{uri:i.uri},ref:c,controls:!0,shutterColor:"transparent",style:{width:l-32,height:.55*a,backgroundColor:"#000"},resizeMode:"contain",onLoadStart:function(){y(!0),v(!1)},onLoad:function(){return y(!1)},onBuffer:function(e){var t=e.isBuffering;return y(t)},onError:function(){v(!0),y(!1)}}),f&&e.jsx(t.View,{style:n(Ut||(Ut=b(["absolute inset-0 items-center justify-center"]))),children:e.jsx(Q,{style:n.style("h-14 w-14"),spinning:!0})}),p&&e.jsx(t.View,{style:n(Gt||(Gt=b(["absolute inset-0 items-center justify-center px-6"]))),children:e.jsx(t.Text,{style:A(n(Yt||(Yt=b(["text-white font-semibold"]))),null==u?void 0:u.fontFamily),children:"Failed to load video"})})]})},wn=r.memo(gn),jn=function(r){var o,i,l,s,a=r.typingUsers,u=r.currentUserId,c=I(),d=c.theme,f=c.showAvatars,y=c.renderCustomTyping,h=c.showBubbleTail,p=a.filter((function(e){return e.id!==u}));if(!p.length)return null;var m=p.slice(0,2),x=p.length-2;return e.jsxs(t.View,{style:n(rn||(rn=b(["my-1 max-w-[75%] self-start flex-row"]))),children:[f&&e.jsxs(t.View,{style:n(on||(on=b(["flex-row"]))),children:[m.map((function(r,o){var i,l,s;return e.jsx(t.View,{style:[n(ln||(ln=b(["bg-gray-400 w-6 h-6 rounded-full items-center"]))),{marginLeft:o>0?-10:0,zIndex:m.length+o}],children:r.avatar?e.jsx(t.Image,{source:{uri:r.avatar},style:[n(sn||(sn=b(["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:A([n(an||(an=b(["text-sm text-black font-semibold capitalize rounded-full bg-zinc-300 w-full h-full text-center pt-0.5"]))),null==d||null===(l=d.bubbleStyle)||void 0===l?void 0:l.avatarTextStyle],null==d?void 0:d.fontFamily),children:null===(s=r.name)||void 0===s?void 0:s.charAt(0)})},r.id)})),x>0&&e.jsx(t.View,{style:[n(un||(un=b(["bg-gray-400 w-6 h-6 rounded-full items-center justify-center"]))),{marginLeft:-10,zIndex:3},v({},null==d||null===(o=d.bubbleStyle)||void 0===o?void 0:o.additionalTypingUsersContainerStyle)],children:e.jsxs(t.Text,{style:A([n(cn||(cn=b(["text-white text-xs font-semibold"]))),null==d||null===(i=d.bubbleStyle)||void 0===i?void 0:i.additionalTypingUsersTextStyle],null==d?void 0:d.fontFamily),children:["+",x]})})]}),h&&e.jsx(j,{style:n.style("w-6 h-6 fill-white mt-[1.25px]",{transform:[{rotate:"180deg"},{translateX:6}]}),color:"".concat((null==d||null===(l=d.colors)||void 0===l?void 0:l.receivedMessageTailColor)||"white")}),e.jsx(t.View,{style:[n(dn||(dn=b(["px-2 my-1 bg-white rounded-tl-none rounded-lg"]))),null==d||null===(s=d.bubbleStyle)||void 0===s?void 0:s.typingContainerStyle],children:y?y():e.jsx(t.View,{style:n(fn||(fn=b(["flex-row items-center py-3 px-2 justify-center"]))),children:e.jsx(t.Text,{style:A(n(yn||(yn=b(["text-gray-600"]))),null==d?void 0:d.fontFamily),children:"Typing..."})})})]})};var Sn=function(){var o=I(),i=o.messages,l=o.currentUserId,s=o.onMessageLongPress,a=o.mediaViewerGallery,u=o.clearMediaViewerGallery,c=o.typingUsers,d=o.onSendMessage,f=o.onTypingStart,y=o.onTypingEnd,h=o.onAttachmentPress,p=o.onAudioRecordEnd,v=o.onAudioRecordStart,m=o.onCameraPress,x=o.renderCustomInput,w=o.CustomEmojiIcon,j=o.CustomAttachmentIcon,S=o.CustomCameraIcon,P=o.CustomMicrophoneIcon,C=o.CustomSendIcon,O=o.CustomFileIcon,T=o.CustomImagePreview,A=o.CustomVideoPreview,k=o.keyboardVerticalOffset,V=void 0===k?0:k,E=o.disableKeyboardAvoiding,M=void 0!==E&&E,R=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=g(r.useState(0),2),o=n[0],i=n[1];return r.useEffect((function(){if(e){var n="ios"===t.Platform.OS?"keyboardWillShow":"keyboardDidShow",r="ios"===t.Platform.OS?"keyboardWillHide":"keyboardDidHide",o=t.Keyboard.addListener(n,(function(e){i(e.endCoordinates.height)})),l=t.Keyboard.addListener(r,(function(){return i(0)}));return function(){o.remove(),l.remove()}}i(0)}),[e]),e?o:0}(!M),_=x?x():e.jsx(tn,{onSendMessage:d,onTypingStart:f,onTypingEnd:y,onAttachmentPress:h,onAudioRecordEnd:p,onAudioRecordStart:v,onCameraPress:m,CustomEmojiIcon:w,CustomAttachmentIcon:j,CustomCameraIcon:S,CustomMicrophoneIcon:P,CustomSendIcon:C,CustomFileIcon:O,CustomImagePreview:T,CustomVideoPreview:A}),z=e.jsxs(t.View,{style:n(hn||(hn=b(["flex-1 px-2 pb-4 gap-2 relative"]))),children:[e.jsx(t.FlatList,{style:n(pn||(pn=b(["flex-1"]))),data:i,keyExtractor:function(e){return e.id},renderItem:function(t){var n,r=t.item,o=t.index;return e.jsx(St,{message:r,isCurrentUser:r.senderId===l,onLongPress:function(){return null==s?void 0:s(r)},isFirstInSequence:o===i.length-1||(null===(n=i[o+1])||void 0===n?void 0:n.senderId)!==r.senderId})},ListHeaderComponent:e.jsx(jn,{typingUsers:c||[],currentUserId:l}),showsVerticalScrollIndicator:!1,inverted:!0,keyboardShouldPersistTaps:"handled",keyboardDismissMode:"interactive"}),e.jsx(t.View,{style:!M&&R>0?{marginBottom:R}:void 0,children:_}),e.jsx(wn,{gallery:a,onClose:u})]});return M?e.jsx(t.View,{style:n(vn||(vn=b(["flex-1"]))),children:z}):"android"===t.Platform.OS?e.jsx(t.View,{style:n(mn||(mn=b(["flex-1"]))),children:z}):e.jsx(t.KeyboardAvoidingView,{style:n(xn||(xn=b(["flex-1"]))),behavior:"padding",keyboardVerticalOffset:V,children:z})};module.exports=function(t){return e.jsx(Y,{children:e.jsx(C,v(v({},t),{},{children:e.jsx(Sn,{})}))})};
|
|
14
|
+
*/function Ve(){if(me)return ve;me=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return ve=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={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var i,l,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),a=1;a<arguments.length;a++){for(var u in i=Object(arguments[a]))t.call(i,u)&&(s[u]=i[u]);if(e){l=e(i);for(var c=0;c<l.length;c++)n.call(i,l[c])&&(s[l[c]]=i[l[c]])}}return s},ve}function Ee(){if(ge)return xe;ge=1;return xe="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Me(){return we?be:(we=1,be=Function.call.bind(Object.prototype.hasOwnProperty))}function Re(){if(Se)return je;Se=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=Ee(),n={},r=Me();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,i,l,s,a){if("production"!==process.env.NODE_ENV)for(var u in o)if(r(o,u)){var c;try{if("function"!=typeof o[u]){var d=Error((s||"React class")+": "+l+" 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,s,l,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((s||"React class")+": type specification of "+l+" `"+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 n)){n[c.message]=!0;var f=a?a():"";e("Failed "+l+" type: "+c.message+(null!=f?f:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},je=o}function _e(){if(Ce)return Pe;Ce=1;var e=ke(),t=Ve(),n=Ee(),r=Me(),o=Re(),i=function(){};function l(){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){}}),Pe=function(s,a){var u="function"==typeof Symbol&&Symbol.iterator;var c="<<anonymous>>",d={array:p("array"),bigint:p("bigint"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:h(l),arrayOf:function(e){return h((function(t,r,o,i,l){if("function"!=typeof e)return new y("Property `"+l+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s))return new y("Invalid "+i+" `"+l+"` of type `"+x(s)+"` supplied to `"+o+"`, expected an array.");for(var a=0;a<s.length;a++){var u=e(s,a,o,i,l+"["+a+"]",n);if(u instanceof Error)return u}return null}))},element:h((function(e,t,n,r,o){var i=e[t];return s(i)?null:new y("Invalid "+r+" `"+o+"` of type `"+x(i)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:h((function(t,n,r,o,i){var l=t[n];return e.isValidElementType(l)?null:new y("Invalid "+o+" `"+i+"` of type `"+x(l)+"` supplied to `"+r+"`, expected a single ReactElement type.")})),instanceOf:function(e){return h((function(t,n,r,o,i){if(!(t[n]instanceof e)){var l=e.name||c;return new y("Invalid "+o+" `"+i+"` of type `"+(((s=t[n]).constructor&&s.constructor.name?s.constructor.name:c)+"` supplied to `")+r+"`, expected instance of `"+l+"`.")}var s;return null}))},node:h((function(e,t,n,r,o){return m(e[t])?null:new y("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return h((function(t,o,i,l,s){if("function"!=typeof e)return new y("Property `"+s+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var a=t[o],u=x(a);if("object"!==u)return new y("Invalid "+l+" `"+s+"` of type `"+u+"` supplied to `"+i+"`, expected an object.");for(var c in a)if(r(a,c)){var d=e(a,c,i,l,s+"."+c,n);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."),l;return h((function(t,n,r,o,i){for(var l=t[n],s=0;s<e.length;s++)if(f(l,e[s]))return null;var a=JSON.stringify(e,(function(e,t){return"symbol"===g(t)?String(t):t}));return new y("Invalid "+o+" `"+i+"` of value `"+String(l)+"` supplied to `"+r+"`, 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."),l;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 "+b(o)+" at index "+t+"."),l}return h((function(t,o,i,l,s){for(var a=[],u=0;u<e.length;u++){var c=(0,e[u])(t,o,i,l,s,n);if(null==c)return null;c.data&&r(c.data,"expectedType")&&a.push(c.data.expectedType)}return new y("Invalid "+l+" `"+s+"` supplied to `"+i+"`"+(a.length>0?", expected one of type ["+a.join(", ")+"]":"")+".")}))},shape:function(e){return h((function(t,r,o,i,l){var s=t[r],a=x(s);if("object"!==a)return new y("Invalid "+i+" `"+l+"` 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,l,u,g(c));var d=c(s,u,o,i,l+"."+u,n);if(d)return d}return null}))},exact:function(e){return h((function(o,i,l,s,a){var u=o[i],c=x(u);if("object"!==c)return new y("Invalid "+s+" `"+a+"` of type `"+c+"` supplied to `"+l+"`, expected `object`.");var d=t({},o[i],e);for(var f in d){var h=e[f];if(r(e,f)&&"function"!=typeof h)return v(l,s,a,f,g(h));if(!h)return new y("Invalid "+s+" `"+a+"` key `"+f+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var p=h(u,f,l,s,a+"."+f,n);if(p)return p}return null}))}};function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function y(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function h(e){if("production"!==process.env.NODE_ENV)var t={},r=0;function o(o,l,s,u,d,f,h){if(u=u||c,f=f||s,h!==n){if(a){var p=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 p.name="Invariant Violation",p}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var v=u+":"+s;!t[v]&&r<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,r++)}}return null==l[s]?o?null===l[s]?new y("The "+d+" `"+f+"` is marked as required in `"+u+"`, but its value is `null`."):new y("The "+d+" `"+f+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(l,s,u,d,f)}var l=o.bind(null,!1);return l.isRequired=o.bind(null,!0),l}function p(e){return h((function(t,n,r,o,i,l){var s=t[n];return x(s)!==e?new y("Invalid "+o+" `"+i+"` of type `"+g(s)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null}))}function v(e,t,n,r,o){return new y((e||"React class")+": "+t+" type `"+n+"."+r+"` 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||s(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 n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!m(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.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 g(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 b(e){var t=g(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return y.prototype=Error.prototype,d.checkPropTypes=o,d.resetWarningCache=o.resetWarningCache,d.PropTypes=d,d},Pe}function ze(){if(Oe)return Ie;Oe=1;var e=Ee();function t(){}function n(){}return n.resetWarningCache=t,Ie=function(){function r(t,n,r,o,i,l){if(l!==e){var s=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 s.name="Invariant Violation",s}}function o(){return r}r.isRequired=r;var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i}}function Ne(){if(Ae)return de.exports;if(Ae=1,"production"!==process.env.NODE_ENV){var e=ke();de.exports=_e()(e.isElement,true)}else de.exports=ze()();return de.exports}var Le,Fe,$e,qe,De,We,Be,He=ue(Ne()),Ue=function(){return d((function e(t,n){c(this,e),this.text=t,this.patterns=n||[]}),[{key:"parse",value:function(){var e=this,t=[{children:this.text}];return this.patterns.forEach((function(n){var r=[],o=n.nonExhaustiveModeMaxMatchCount||0,i=Math.min(Math.max(Number.isInteger(o)?o:0,0)||Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),l=0;t.forEach((function(t){if(t._matched)r.push(t);else{var o,s=[],a=t.children,u=0;for(n.pattern.lastIndex=0;a&&(o=n.pattern.exec(a));){var c=a.substr(0,o.index);if(u=o.index,++l>i)break;s.push({children:c}),s.push(e.getMatchedPart(n,o[0],o,u)),a=a.substr(o.index+o[0].length),u+=o[0].length-1,n.pattern.lastIndex=0}s.push({children:a}),r.push.apply(r,s)}})),t=r})),t.forEach((function(e){return delete e._matched})),t.filter((function(e){return!!e.children}))}},{key:"getMatchedPart",value:function(e,t,n,r){var o={};Object.keys(e).forEach((function(n){"pattern"!==n&&"renderText"!==n&&"nonExhaustiveModeMaxMatchCount"!==n&&("function"==typeof e[n]?o[n]=function(){return e[n](t,r)}:o[n]=e[n])}));var i=t;return e.renderText&&"function"==typeof e.renderText&&(i=e.renderText(t,n)),v(v({},o),{},{children:i,_matched:!0})}}])}(),Ge=["type"],Ye=["style"],Ke=["parse","childrenProps"],Xe={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+/},Ze=He.shape(v(v({},t.Text.propTypes),{},{type:He.oneOf(Object.keys(Xe)).isRequired,nonExhaustiveMaxMatchCount:He.number})),Je=He.shape(v(v({},t.Text.propTypes),{},{pattern:He.oneOfType([He.string,He.instanceOf(RegExp)]).isRequired,nonExhaustiveMaxMatchCount:He.number})),Qe=function(){function n(){return c(this,n),u(this,n,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&&x(e,t)}(n,r.Component),d(n,[{key:"setNativeProps",value:function(e){this._root.setNativeProps(e)}},{key:"getPatterns",value:function(){return this.props.parse.map((function(e){var t=e.type,n=m(e,Ge);if(t){if(!Xe[t])throw new Error("".concat(e.type," is not a supported type"));n.pattern=Xe[t]}return n}))}},{key:"getParsedText",value:function(){var n=this;return this.props.parse?"string"!=typeof this.props.children?this.props.children:new Ue(this.props.children,this.getPatterns()).parse().map((function(r,o){var i=n.props.style,l=r.style,s=m(r,Ye);return e.jsx(t.Text,v(v({style:[i,l]},n.props.childrenProps),s),"parsedText-".concat(o))})):this.props.children}},{key:"render",value:function(){var n=this,r=v({},this.props);r.parse,r.childrenProps;var o=m(r,Ke);return e.jsx(t.Text,v(v({ref:function(e){return n._root=e}},o),{},{children:this.getParsedText()}))}}])}();Qe.displayName="ParsedText",Qe.propTypes=v(v({},t.Text.propTypes),{},{parse:He.arrayOf(He.oneOfType([Ze,Je])),childrenProps:He.shape(t.Text.propTypes)}),Qe.defaultProps={parse:null,childrenProps:{}};var et,tt,nt,rt,ot,it,lt,st,at,ut,ct,dt,ft,yt,ht,pt,vt,mt,xt=function(o){var i,l,s,a,u=o.message,c=o.onGalleryOpen,d=o.isVideoPlaying,f=o.isCurrentUser,y=I(),h=y.theme,p=y.showMessageStatus,m=y.onFileAttachmentPress,x=r.useMemo((function(){return O(u)}),[u]);return e.jsxs(t.View,{children:[x.length>0&&e.jsx(ae,{items:x,onOpenGallery:c}),(null!==(i=u.fileAttachments)&&void 0!==i?i:[]).map((function(r,o){return e.jsxs(t.Pressable,{onPress:function(){m?m(r):t.Linking.openURL(r.uri.startsWith("http")||r.uri.startsWith("file:")?r.uri:"file://".concat(r.uri))},style:n(Le||(Le=b(["my-1.5 py-2 px-3 rounded-lg bg-black/10 max-w-[220px]"]))),children:[e.jsxs(t.Text,{style:T(n(Fe||(Fe=b(["text-xs font-semibold"]))),null==h?void 0:h.fontFamily),numberOfLines:2,children:["📎 ",r.name]}),e.jsx(t.Text,{style:n($e||($e=b(["text-[10px] opacity-70 mt-0.5"]))),children:r.type})]},"".concat(r.uri,"-").concat(o))})),u.audio&&e.jsx(t.View,{style:n(qe||(qe=b(["my-2"]))),children:e.jsx(Q,{audioUrl:u.audio,audioId:u.id,isVideoPlaying:d})}),u.text&&e.jsx(Qe,{style:T([n(De||(De=b(["pt-1"]))),n(p?We||(We=b(["pb-0"])):Be||(Be=b(["pb-2"]))),{wordBreak:"break-word",overflowWrap:"break-word"},f?null==h||null===(l=h.messageStyle)||void 0===l?void 0:l.sentTextStyle:null==h||null===(s=h.messageStyle)||void 0===s?void 0:s.receivedTextStyle],null==h?void 0:h.fontFamily),parse:[{type:"url",style:v({color:"blue",textDecorationLine:"underline"},(a=null==h?void 0:h.fontFamily,a?{fontFamily:a}:void 0)),onPress:function(e){return t.Linking.openURL(e.startsWith("http")?e:"https://".concat(e))}}],childrenProps:{allowFontScaling:!1},children:u.text})]})},gt=r.memo(xt),bt=function(t){var n=t.style,r=t.fill;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsx(o.Path,{fill:r,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"})})},wt=function(t){var n=t.style,r=t.fill;return e.jsx(o,{style:n,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",fill:r})})},jt=function(r){var o,i,l,s,a=r.time,u=r.status,c=r.isCurrentUser,d=r.hasText,f=r.hasAudio,y=r.hasGalleryMedia,h=r.hasFileAttachments,p=I(),v=p.theme,m=p.showMessageStatus,x=(y||h)&&!d&&!f;return e.jsx(e.Fragment,{children:m&&e.jsxs(t.View,{style:[n(et||(et=b(["flex-row items-center"]))),n(d?tt||(tt=b(["justify-end pb-1 ml-4"])):f?nt||(nt=b(["absolute right-3 bottom-3"])):x?rt||(rt=b(["absolute right-3 bottom-4 bg-black/50 px-2 py-1 rounded-md"])):ot||(ot=b(["absolute right-3 bottom-4 bg-black/50 px-2 py-1 rounded-md"])))],children:[e.jsx(t.Text,{style:T([n(it||(it=b(["text-xs"]))),{color:d||f?(null==v||null===(o=v.colors)||void 0===o?void 0:o.timestamp)||"rgba(107, 114, 128, 0.7)":"white"}],null==v?void 0:v.fontFamily),children:a}),c&&e.jsxs(t.View,{style:n(lt||(lt=b(["ml-1 flex-row items-center"]))),children:["sent"===u&&e.jsx(wt,{style:n.style("h-4 w-4",{opacity:.7}),fill:(null==v||null===(i=v.colors)||void 0===i?void 0:i.sentIconColor)||"#6B7280"}),"delivered"===u&&e.jsx(bt,{style:n.style("h-4 w-4",{opacity:.7}),fill:(null==v||null===(l=v.colors)||void 0===l?void 0:l.deliveredIconColor)||"#6B7280"}),"read"===u&&e.jsx(bt,{style:n.style("h-4 w-4",{opacity:.9}),fill:(null==v||null===(s=v.colors)||void 0===s?void 0:s.readIconColor)||"#3B82F6"})]})]})})},St=r.memo(jt),Pt=function(r){var o,i,l,s,a,u,c,d,f,y,h=r.message,p=r.isCurrentUser,m=r.isFirstInSequence,x=r.onLongPress,g=I(),w=g.theme,S=g.showAvatars,P=g.showUserNames,C=g.showBubbleTail,A=g.setMediaViewerGallery,k=g.isVideoPlaying,V=O(h),E=(null!==(o=null===(i=h.fileAttachments)||void 0===i?void 0:i.length)&&void 0!==o?o:0)>0&&0===V.length&&!h.text&&!h.audio;return e.jsxs(t.Pressable,{onLongPress:x,style:[n(st||(st=b(["px-2 my-1 max-w-[75%] relative"]))),n(p?at||(at=b(["self-end mr-3"])):ut||(ut=b(["self-start ml-9"]))),n(m?p?ct||(ct=b(["bg-green-500 rounded-tr-none"])):dt||(dt=b(["bg-white rounded-tl-none"])):p?ft||(ft=b(["bg-green-500"])):yt||(yt=b(["bg-white"]))),v({borderRadius:8},p?null==w||null===(l=w.bubbleStyle)||void 0===l?void 0:l.sent:null==w||null===(s=w.bubbleStyle)||void 0===s?void 0:s.received)],children:[!p&&m&&S&&e.jsxs(e.Fragment,{children:[e.jsx(t.View,{style:n(ht||(ht=b(["absolute w-6 h-6 rounded-full top-0 -left-9 flex-row items-center"]))),children:h.senderAvatar?e.jsx(t.Image,{source:{uri:h.senderAvatar},style:[n(pt||(pt=b(["w-full h-full rounded-full"]))),null==w||null===(a=w.bubbleStyle)||void 0===a?void 0:a.avatarImageStyle],resizeMode:"cover"}):e.jsx(t.Text,{style:T([n(vt||(vt=b(["text-sm text-black font-semibold capitalize rounded-full bg-zinc-300 w-full h-full text-center pt-0.5"]))),null==w||null===(u=w.bubbleStyle)||void 0===u?void 0:u.avatarTextStyle],null==w?void 0:w.fontFamily),children:null===(c=h.senderName)||void 0===c?void 0:c.charAt(0)})}),P&&h.senderName&&e.jsx(t.Text,{style:T([n(mt||(mt=b(["text-sm text-black font-semibold mt-1 capitalize"]))),null==w||null===(d=w.bubbleStyle)||void 0===d?void 0:d.userNameStyle],null==w?void 0:w.fontFamily),children:h.senderName})]}),m&&C&&e.jsx(j,{style:n.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==w||null===(f=w.colors)||void 0===f?void 0:f.sentMessageTailColor)||"rgba(34, 197, 94,1)":(null==w||null===(y=w.colors)||void 0===y?void 0:y.receivedMessageTailColor)||"white")}),e.jsx(gt,{message:h,isCurrentUser:p,isFirstInSequence:m,onGalleryOpen:function(e,t){A(e,t)},isVideoPlaying:k}),e.jsx(St,{time:h.time,status:p?h.status:void 0,isCurrentUser:p,hasText:!!h.text,hasAudio:!!h.audio,hasGalleryMedia:V.length>0&&!h.text,hasFileAttachments:E})]})},Ct=r.memo(Pt),It=function(t){var n=t.style,r=t.color;return e.jsx(o.Svg,{style:n,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:r,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"})]})})},Ot=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",stroke:r,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"})]})})},At=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:r,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"})]})})},Tt=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,fill:r,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"})})},kt=function(t){var n=t.style,r=t.color;return e.jsx(o,{style:n,viewBox:"0 0 24 24",children:e.jsxs(o.G,{fill:"none",strokeWidth:"1.5",stroke:r,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"})]})})},Vt=function(t){var n=t.style,r=t.fill,i=void 0===r?"currentColor":r;return e.jsxs(o,{style:n,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"})]})},Et=function(n){var r=n.fileName,o=n.style,i=I().theme;return e.jsx(t.Text,{numberOfLines:2,ellipsizeMode:"tail",style:T([{fontSize:14,fontWeight:"600",color:"black"},o],null==i?void 0:i.fontFamily),children:function(e){var t=e.lastIndexOf(".");if(-1===t)return e;var n=e.slice(0,t),r=e.slice(t);return n.length>40?n.slice(0,40)+"..."+r:n+r}(r)})},Mt=r.memo(Et);function Rt(e){return e.filter((function(e){var t,n;return(null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))||(null===(n=e.type)||void 0===n?void 0:n.startsWith("video/"))})).map((function(e){return{uri:e.uri,kind:e.type.startsWith("video/")?"video":"image"}}))}var _t,zt,Nt,Lt,Ft,$t,qt,Dt,Wt,Bt,Ht,Ut,Gt,Yt,Kt,Xt,Zt=function(n){var r,o=n.previews,i=n.closePreview,l=n.onRemoveItem,a=n.CustomFileIcon,u=n.CustomImagePreview,c=n.CustomVideoPreview,d=n.inputHeight,f=I(),y=f.theme,h=f.setMediaViewerGallery,p=o.filter((function(e){var t,n;return(null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))||(null===(n=e.type)||void 0===n?void 0:n.startsWith("video/"))})),v=o.filter((function(e){var t,n;return!(null!==(t=e.type)&&void 0!==t&&t.startsWith("image/")||null!==(n=e.type)&&void 0!==n&&n.startsWith("video/"))})),m=Rt(o);if(0===o.length)return null;var x=function(e){0!==m.length&&h(m,e)},g=function(n){var r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:56,l=null===(r=n.type)||void 0===r?void 0:r.startsWith("image/"),a=null===(o=n.type)||void 0===o?void 0:o.startsWith("video/");return l&&u?e.jsx(u,{uri:n.uri}):a&&c?e.jsx(c,{uri:n.uri}):l?e.jsx(t.Image,{source:{uri:n.uri},style:{width:i,height:i,borderRadius:12},resizeMode:"cover"}):a?e.jsx(t.View,{style:{width:i,height:i,borderRadius:12,overflow:"hidden"},children:e.jsx(s,{source:{uri:n.uri},style:{width:"100%",height:"100%"},resizeMode:"cover",muted:!0,repeat:!0,paused:!1})}):null},b=function(n,r){return e.jsx(t.Pressable,{onPress:function(){return l?l(n):null==i?void 0:i()},style:{position:"absolute",zIndex:50,height:22,width:22,backgroundColor:"rgba(0,0,0,0.55)",right:-6,top:-6,borderRadius:11,justifyContent:"center",alignItems:"center",transform:r?[{rotate:r}]:void 0},children:e.jsx(t.Text,{style:T({fontSize:13,color:"white",fontWeight:"700",lineHeight:14},null==y?void 0:y.fontFamily),children:"×"})})};return e.jsx(t.View,{style:[{position:"absolute",bottom:(null!=d?d:0)+8,zIndex:20,borderRadius:12,maxWidth:"92%",alignSelf:"flex-start"},null==y||null===(r=y.filePreviewStyle)||void 0===r?void 0:r.root],children:e.jsxs(t.View,{style:{gap:8},children:[function(){if(0===p.length)return null;if(1===p.length){var n=p[0];return n?e.jsxs(t.Pressable,{onPress:function(){return x(0)},style:{position:"relative"},children:[g(n),b(n.uri)]}):null}var r=p.slice(0,3),o=p.length>3?p.length-3:0;return e.jsx(t.View,{style:{flexDirection:"row",alignItems:"center",minHeight:68},children:r.map((function(n,i){var l=2===r.length?0===i?"-4deg":"4deg":0===i?"-10deg":1===i?"0deg":"10deg",s=2===r.length?0===i?"4deg":"-4deg":0===i?"10deg":1===i?"0deg":"-10deg";return e.jsx(t.Pressable,{onPress:function(){var e=Rt(p).findIndex((function(e){return e.uri===n.uri}));x(e>=0?e:0)},style:{marginLeft:0===i?0:-18,zIndex:i+1,transform:[{rotate:l}],position:"relative"},children:e.jsxs(t.View,{style:{position:"relative"},children:[g(n),2===i&&o>0&&e.jsx(t.View,{style:{position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:12,backgroundColor:"rgba(0,0,0,0.55)",alignItems:"center",justifyContent:"center"},children:e.jsxs(t.Text,{style:{color:"#fff",fontWeight:"700",fontSize:14},children:["+",o]})}),b(n.uri,s)]})},"".concat(n.uri,"-").concat(i))}))})}(),v.length>0&&e.jsx(t.ScrollView,{scrollEnabled:v.length>3,style:{maxHeight:232},showsVerticalScrollIndicator:v.length>3,contentContainerStyle:{gap:8},nestedScrollEnabled:!0,children:v.map((function(n,r){return function(n,r){var o,i,l,s;return e.jsxs(t.View,{style:{position:"relative"},children:[e.jsxs(t.View,{style:[{backgroundColor:"white",width:240,minHeight:64,borderRadius:12,flexDirection:"row",padding:4,gap:4,alignItems:"center"},null==y||null===(o=y.filePreviewStyle)||void 0===o?void 0:o.container],children:[e.jsx(t.View,{style:[{backgroundColor:"#d1d5db",borderRadius:8,padding:4,justifyContent:"center",alignItems:"center"},null==y||null===(i=y.filePreviewStyle)||void 0===i?void 0:i.iconContainer],children:a?e.jsx(a,{}):e.jsx(Vt,{style:{width:40,height:40},fill:"white"})}),e.jsx(t.View,{style:[{backgroundColor:"#f3f4f6",flex:1,borderRadius:8,justifyContent:"center",paddingHorizontal:12},null==y||null===(l=y.filePreviewStyle)||void 0===l?void 0:l.nameContainer],children:e.jsx(Mt,{fileName:n.name||"File",style:null==y||null===(s=y.filePreviewStyle)||void 0===s?void 0:s.text})})]}),b(n.uri)]},"".concat(n.uri,"-").concat(r))}(n,r)}))})]})})},Jt=r.memo(Zt),Qt="ios"===t.Platform.OS?32:30,en="ios"===t.Platform.OS?50:48,tn="h-6 w-6",nn=function(o){var i,l,s,a,u,c,d,f,y,h,p,m,x,w=o.onSendMessage,j=o.onTypingStart,S=o.onTypingEnd,P=o.onAttachmentPress,C=o.onCameraPress,O=o.onAudioRecordStart,k=o.onAudioRecordEnd,V=o.CustomEmojiIcon,E=o.CustomAttachmentIcon,M=o.CustomCameraIcon,R=o.CustomSendIcon,_=o.CustomMicrophoneIcon,z=o.CustomFileIcon,N=o.CustomImagePreview,L=o.CustomVideoPreview,F=g(r.useState(""),2),$=F[0],q=F[1],D=g(r.useState(0),2),W=D[0],B=D[1],H=g(r.useState({height:Qt,isMultiline:!1}),2),U=H[0],G=H[1],Y=I(),K=Y.theme,X=Y.currentUserId,Z=Y.showEmojiButton,J=Y.showAttachmentsButton,Q=Y.showCameraButton,ee=Y.showVoiceRecordButton,te=Y.placeholder,ne=Y.previewData,re=Y.previewItems,oe=Y.closePreview,ie=Y.onRemovePreviewItem,le=r.useMemo((function(){return null!=re&&re.length?re:ne?[ne]:[]}),[re,ne]),se=le.length>0,ae=null==K||null===(i=K.sizes)||void 0===i?void 0:i.inputIconSize,ue=function(e){if("number"==typeof e&&e>0)return{width:e,height:e};var t="string"==typeof e&&e.trim().length>0?e.trim():A;return n.style(t)}(ae),ce="number"==typeof(x=ae)&&x>0?x:24,de=0===$.trim().length&&!U.isMultiline,fe=Math.max(0,(en-ce)/2),ye=de?{paddingTop:fe,paddingBottom:fe}:{paddingBottom:fe},he=r.useCallback((function(){G({height:Qt,isMultiline:!1}),B((function(e){return e+1}))}),[]),pe=r.useCallback((function(e){q(e),0===e.length&&he()}),[he]),ve=r.useCallback((function(e){var t=Math.min(Math.max(e.nativeEvent.contentSize.height,Qt),118),n=t>Qt;G({height:n?t:Qt,isMultiline:n})}),[]),me=r.useCallback((function(){var e=$.trim();(e||se)&&(w({text:e,senderId:X}),q(""),he())}),[$,w,X,se,he]);r.useEffect((function(){$.trim()?null==j||j():null==S||S()}),[$,j,S]);var xe=!!$.trim()||se;return e.jsxs(t.View,{style:n(_t||(_t=b(["w-full px-2"]))),children:[se&&e.jsx(Jt,{previews:le,closePreview:oe,onRemoveItem:ie,CustomFileIcon:z,CustomImagePreview:N,CustomVideoPreview:L,inputHeight:U.height}),e.jsxs(t.View,{style:[n(zt||(zt=b(["flex-row items-end gap-2"]))),null==K||null===(l=K.inputStyles)||void 0===l?void 0:l.inputSectionContainerStyle],children:[e.jsxs(t.View,{style:[n(Nt||(Nt=b(["flex-1 flex-row bg-white overflow-hidden px-3.5"]))),{minHeight:en,borderRadius:de?9999:24,alignItems:de?"center":"flex-end"},null==K||null===(s=K.inputStyles)||void 0===s?void 0:s.inputContainerStyle],children:[Z&&e.jsx(t.View,{style:ye,children:e.jsx(t.Pressable,{children:V?e.jsx(V,{}):e.jsx(Ot,{style:ue,color:(null==K||null===(a=K.colors)||void 0===a?void 0:a.inputsIconsColor)||"rgba(0,0,0,0.7)"})})}),e.jsx(t.TextInput,{value:$,onChangeText:pe,placeholder:te||"Message",style:T([n(Lt||(Lt=b(["bg-transparent flex-1 pl-2"]))),"ios"===t.Platform.OS?n(Ft||(Ft=b(["text-[17px]"]))):n($t||($t=b(["text-[16px]"]))),{minHeight:Qt,maxHeight:118,paddingVertical:de?0:8,marginVertical:de?(en-Qt)/2:4},{color:(null==K||null===(u=K.colors)||void 0===u?void 0:u.inputTextColor)||"rgba(0, 0, 0, 0.87)"}],null==K?void 0:K.fontFamily),placeholderTextColor:(null==K||null===(c=K.colors)||void 0===c?void 0:c.placeholderTextColor)||"rgba(0, 0, 0, 0.4)",multiline:!0,textAlignVertical:U.isMultiline&&$.length>0?"top":"center",onContentSizeChange:ve},"chat-input-".concat(W)),e.jsxs(t.View,{style:[n(qt||(qt=b(["flex-row items-center gap-4"]))),ye],children:[J&&e.jsx(t.Pressable,{onPress:P,children:E?e.jsx(E,{}):e.jsx(Tt,{style:ue,color:(null==K||null===(d=K.colors)||void 0===d?void 0:d.inputsIconsColor)||"rgba(0,0,0,0.7)"})}),Q&&!$.trim()&&e.jsx(t.Pressable,{onPress:C,children:M?e.jsx(M,{}):e.jsx(It,{style:ue,color:(null==K||null===(f=K.colors)||void 0===f?void 0:f.inputsIconsColor)||"rgba(0,0,0,0.7)"})})]})]}),e.jsx(t.Pressable,{style:[n(Dt||(Dt=b(["p-2 rounded-full bg-green-600 justify-center items-center"]))),v({height:en,width:en},null==K||null===(y=K.inputStyles)||void 0===y?void 0:y.sendButtonStyle)],onPress:xe?me:O,onLongPress:O,onPressOut:k,children:xe?R?e.jsx(R,{}):e.jsx(kt,{style:n.style(tn),color:(null==K||null===(h=K.colors)||void 0===h?void 0:h.sendIconsColor)||"rgba(255,255,255,0.7)"}):ee?_?e.jsx(_,{}):e.jsx(At,{style:n.style("h-8 w-8"),color:(null==K||null===(p=K.colors)||void 0===p?void 0:p.sendIconsColor)||"rgba(255,255,255,0.7)"}):R?e.jsx(R,{}):e.jsx(kt,{style:n.style(tn),color:(null==K||null===(m=K.colors)||void 0===m?void 0:m.sendIconsColor)||"rgba(255,255,255,0.7)"})})]})]})},rn=r.memo(nn);function on(t){var r=t.style;return e.jsxs(o.Svg,{viewBox:"0 0 24 24",fill:"none",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:n.style("h-6 w-6 text-black",r),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 ln,sn,an,un,cn,dn,fn,yn,hn,pn,vn,mn,xn,gn,bn,wn=function(o){var i=o.gallery,l=o.onClose,s=I(),a=s.theme,u=s.setIsVideoPlaying,c=r.useRef(null),d=g(r.useState(0),2),f=d[0],y=d[1],h=t.useWindowDimensions(),p=h.width,v=h.height;r.useEffect((function(){null!=i&&i.items.length&&(y(i.initialIndex),requestAnimationFrame((function(){try{var e;null===(e=c.current)||void 0===e||e.scrollToIndex({index:i.initialIndex,animated:!1})}catch(e){}})))}),[null==i?void 0:i.initialIndex,null==i?void 0:i.items]);var m=r.useCallback((function(e){var t=Math.round(e.nativeEvent.contentOffset.x/p);y(t);var n=null==i?void 0:i.items[t];u("video"===(null==n?void 0:n.kind))}),[null==i?void 0:i.items,p,u]);return i&&0!==i.items.length?e.jsx(t.Modal,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:e.jsxs(t.View,{style:[n(Wt||(Wt=b(["flex-1 bg-black"]))),{width:p,height:v}],children:[e.jsx(t.Pressable,{onPress:l,style:n(Bt||(Bt=b(["absolute right-4 top-12 z-20 p-2 rounded-full bg-slate-100/70"]))),children:e.jsx(on,{style:n(Ht||(Ht=b(["h-8 w-8"])))})}),i.items.length>1&&e.jsx(t.View,{style:n(Ut||(Ut=b(["absolute top-14 left-0 right-0 z-10 items-center"]))),children:e.jsxs(t.Text,{style:T(n(Gt||(Gt=b(["text-white/90 text-sm bg-black/40 px-3 py-1 rounded-full"]))),null==a?void 0:a.fontFamily),children:[f+1," / ",i.items.length]})}),e.jsx(t.FlatList,{ref:c,data:i.items,horizontal:!0,pagingEnabled:!0,showsHorizontalScrollIndicator:!1,keyExtractor:function(e,t){return"".concat(e.uri,"-").concat(t)},initialScrollIndex:i.initialIndex,getItemLayout:function(e,t){return{length:p,offset:p*t,index:t}},onMomentumScrollEnd:m,onScrollToIndexFailed:function(e){var t=e.index;setTimeout((function(){var e;null===(e=c.current)||void 0===e||e.scrollToIndex({index:t,animated:!1})}),100)},renderItem:function(t){var n=t.item;return e.jsx(jn,{item:n,width:p,height:v})}})]})}):null},jn=function(o){var i=o.item,l=o.width,a=o.height,u=I().theme,c=r.useRef(null),d=g(r.useState("video"===i.kind),2),f=d[0],y=d[1],h=g(r.useState(!1),2),p=h[0],v=h[1];return"image"===i.kind?e.jsx(t.View,{style:{width:l,height:a,justifyContent:"center"},children:e.jsx(t.Image,{source:{uri:i.uri},style:{width:l,height:a},resizeMode:"contain"})}):e.jsxs(t.View,{style:{width:l,height:a,justifyContent:"center",alignItems:"center",paddingHorizontal:16},children:[e.jsx(s,{source:{uri:i.uri},ref:c,controls:!0,shutterColor:"transparent",style:{width:l-32,height:.55*a,backgroundColor:"#000"},resizeMode:"contain",onLoadStart:function(){y(!0),v(!1)},onLoad:function(){return y(!1)},onBuffer:function(e){var t=e.isBuffering;return y(t)},onError:function(){v(!0),y(!1)}}),f&&e.jsx(t.View,{style:n(Yt||(Yt=b(["absolute inset-0 items-center justify-center"]))),children:e.jsx(ee,{style:n.style("h-14 w-14"),spinning:!0})}),p&&e.jsx(t.View,{style:n(Kt||(Kt=b(["absolute inset-0 items-center justify-center px-6"]))),children:e.jsx(t.Text,{style:T(n(Xt||(Xt=b(["text-white font-semibold"]))),null==u?void 0:u.fontFamily),children:"Failed to load video"})})]})},Sn=r.memo(wn),Pn=function(r){var o,i,l,s,a=r.typingUsers,u=r.currentUserId,c=I(),d=c.theme,f=c.showAvatars,y=c.renderCustomTyping,h=c.showBubbleTail,p=a.filter((function(e){return e.id!==u}));if(!p.length)return null;var m=p.slice(0,2),x=p.length-2;return e.jsxs(t.View,{style:n(ln||(ln=b(["my-1 max-w-[75%] self-start flex-row"]))),children:[f&&e.jsxs(t.View,{style:n(sn||(sn=b(["flex-row"]))),children:[m.map((function(r,o){var i,l,s;return e.jsx(t.View,{style:[n(an||(an=b(["bg-gray-400 w-6 h-6 rounded-full items-center"]))),{marginLeft:o>0?-10:0,zIndex:m.length+o}],children:r.avatar?e.jsx(t.Image,{source:{uri:r.avatar},style:[n(un||(un=b(["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:T([n(cn||(cn=b(["text-sm text-black font-semibold capitalize rounded-full bg-zinc-300 w-full h-full text-center pt-0.5"]))),null==d||null===(l=d.bubbleStyle)||void 0===l?void 0:l.avatarTextStyle],null==d?void 0:d.fontFamily),children:null===(s=r.name)||void 0===s?void 0:s.charAt(0)})},r.id)})),x>0&&e.jsx(t.View,{style:[n(dn||(dn=b(["bg-gray-400 w-6 h-6 rounded-full items-center justify-center"]))),{marginLeft:-10,zIndex:3},v({},null==d||null===(o=d.bubbleStyle)||void 0===o?void 0:o.additionalTypingUsersContainerStyle)],children:e.jsxs(t.Text,{style:T([n(fn||(fn=b(["text-white text-xs font-semibold"]))),null==d||null===(i=d.bubbleStyle)||void 0===i?void 0:i.additionalTypingUsersTextStyle],null==d?void 0:d.fontFamily),children:["+",x]})})]}),h&&e.jsx(j,{style:n.style("w-6 h-6 fill-white mt-[1.25px]",{transform:[{rotate:"180deg"},{translateX:6}]}),color:"".concat((null==d||null===(l=d.colors)||void 0===l?void 0:l.receivedMessageTailColor)||"white")}),e.jsx(t.View,{style:[n(yn||(yn=b(["px-2 my-1 bg-white rounded-tl-none rounded-lg"]))),null==d||null===(s=d.bubbleStyle)||void 0===s?void 0:s.typingContainerStyle],children:y?y():e.jsx(t.View,{style:n(hn||(hn=b(["flex-row items-center py-3 px-2 justify-center"]))),children:e.jsx(t.Text,{style:T(n(pn||(pn=b(["text-gray-600"]))),null==d?void 0:d.fontFamily),children:"Typing..."})})})]})};var Cn=function(){var o=I(),i=o.messages,l=o.currentUserId,s=o.onMessageLongPress,a=o.mediaViewerGallery,u=o.clearMediaViewerGallery,c=o.typingUsers,d=o.onSendMessage,f=o.onTypingStart,y=o.onTypingEnd,h=o.onAttachmentPress,p=o.onAudioRecordEnd,v=o.onAudioRecordStart,m=o.onCameraPress,x=o.renderCustomInput,w=o.CustomEmojiIcon,j=o.CustomAttachmentIcon,S=o.CustomCameraIcon,P=o.CustomMicrophoneIcon,C=o.CustomSendIcon,O=o.CustomFileIcon,A=o.CustomImagePreview,T=o.CustomVideoPreview,k=o.keyboardVerticalOffset,V=void 0===k?0:k,E=o.disableKeyboardAvoiding,M=void 0!==E&&E,R=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=g(r.useState(0),2),o=n[0],i=n[1];return r.useEffect((function(){if(e){var n="ios"===t.Platform.OS?"keyboardWillShow":"keyboardDidShow",r="ios"===t.Platform.OS?"keyboardWillHide":"keyboardDidHide",o=t.Keyboard.addListener(n,(function(e){i(e.endCoordinates.height)})),l=t.Keyboard.addListener(r,(function(){return i(0)}));return function(){o.remove(),l.remove()}}i(0)}),[e]),e?o:0}(!M),_=x?x():e.jsx(rn,{onSendMessage:d,onTypingStart:f,onTypingEnd:y,onAttachmentPress:h,onAudioRecordEnd:p,onAudioRecordStart:v,onCameraPress:m,CustomEmojiIcon:w,CustomAttachmentIcon:j,CustomCameraIcon:S,CustomMicrophoneIcon:P,CustomSendIcon:C,CustomFileIcon:O,CustomImagePreview:A,CustomVideoPreview:T}),z=e.jsxs(t.View,{style:n(vn||(vn=b(["flex-1 px-2 pb-4 gap-2 relative"]))),children:[e.jsx(t.FlatList,{style:n(mn||(mn=b(["flex-1"]))),data:i,keyExtractor:function(e){return e.id},renderItem:function(t){var n,r=t.item,o=t.index;return e.jsx(Ct,{message:r,isCurrentUser:r.senderId===l,onLongPress:function(){return null==s?void 0:s(r)},isFirstInSequence:o===i.length-1||(null===(n=i[o+1])||void 0===n?void 0:n.senderId)!==r.senderId})},ListHeaderComponent:e.jsx(Pn,{typingUsers:c||[],currentUserId:l}),showsVerticalScrollIndicator:!1,inverted:!0,keyboardShouldPersistTaps:"handled",keyboardDismissMode:"interactive"}),e.jsx(t.View,{style:!M&&R>0?{marginBottom:R}:void 0,children:_}),e.jsx(Sn,{gallery:a,onClose:u})]});return M?e.jsx(t.View,{style:n(xn||(xn=b(["flex-1"]))),children:z}):"android"===t.Platform.OS?e.jsx(t.View,{style:n(gn||(gn=b(["flex-1"]))),children:z}):e.jsx(t.KeyboardAvoidingView,{style:n(bn||(bn=b(["flex-1"]))),behavior:"padding",keyboardVerticalOffset:V,children:z})};module.exports=function(t){return e.jsx($,{children:e.jsx(C,v(v({},t),{},{children:e.jsx(Cn,{})}))})};
|
|
15
15
|
//# sourceMappingURL=index.js.map
|