mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-03 10:07:55 +01:00
1 line
237 KiB
JavaScript
1 line
237 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],Array(90).concat([function(e,t,a){"use strict";a.r(t),a.d(t,"MediaViewer",(function(){return he})),a.d(t,"ForwardPicker",(function(){return ye})),a.d(t,"Errors",(function(){return Ie})),a.d(t,"Notifications",(function(){return we})),a.d(t,"CalendarModal",(function(){return Le})),a.d(t,"DeleteMessageModal",(function(){return Ae})),a.d(t,"PinMessageModal",(function(){return Te})),a.d(t,"UnpinAllMessagesModal",(function(){return De})),a.d(t,"MessageSelectToolbar",(function(){return Re})),a.d(t,"LeftSearch",(function(){return kt})),a.d(t,"Settings",(function(){return rn})),a.d(t,"ContactList",(function(){return ln})),a.d(t,"NewChat",(function(){return hn})),a.d(t,"NewChatStep1",(function(){return mn})),a.d(t,"NewChatStep2",(function(){return dn})),a.d(t,"ArchivedChats",(function(){return pn})),a.d(t,"ContextMenuContainer",(function(){return Sn})),a.d(t,"StickerSetModal",(function(){return wn})),a.d(t,"HeaderMenuContainer",(function(){return Mn})),a.d(t,"MobileSearch",(function(){return An})),a.d(t,"AttachmentModal",(function(){return zn})),a.d(t,"PollModal",(function(){return Hn})),a.d(t,"SymbolMenu",(function(){return pc})),a.d(t,"AttachMenu",(function(){return gc})),a.d(t,"MentionMenu",(function(){return qn})),a.d(t,"EmojiTooltip",(function(){return Ec})),a.d(t,"BotKeyboardMenu",(function(){return vc})),a.d(t,"CustomSendMenu",(function(){return Oc})),a.d(t,"DropArea",(function(){return fc.b})),a.d(t,"TextFormatter",(function(){return jc.a})),a.d(t,"RightSearch",(function(){return yc})),a.d(t,"StickerSearch",(function(){return Ic})),a.d(t,"GifSearch",(function(){return Sc})),a.d(t,"Statistics",(function(){return Lc})),a.d(t,"PollResults",(function(){return Tc})),a.d(t,"Management",(function(){return Zc})),a.d(t,"PaymentModal",(function(){return fr})),a.d(t,"ReceiptModal",(function(){return yr}));var n=a(0),c=a(2),r=a(5),s=a(18),l=a(1),o=a(7),i=a(104),m=a(6),d=a(4),u=a(3),h=a(128),b=a(42),p=a(166),g=a(29),E=a(97),v=a(112),O=a(169),f=a(102),j=a(136),C=a(14);var y=a(37),k=a(43),N=a(135),I=a(49);function S(e,t,a,n){const{mediaEl:c}=L(t,n);if(!c)return;const{width:r}=I.a.get();let o,m=!1;if(n){const{photo:e,video:t,webPage:a}=Object(d.v)(n);m=Boolean(t),o=t?Object(d.bb)(t):Object(d.R)(e||a.photo)}else o=i.a;const{width:u,height:h}=Object(i.j)(e,m),{width:b,height:p}=Object(i.e)(u,h,o.width,o.height),g=(r-b)/2,E=function(e){const t=window.matchMedia(i.b);let a=4.125;e&&(a+=t.matches?.875:3.375);return a*i.c}(e)+(h-p)/2;let{top:v,left:O,width:f,height:j}=c.getBoundingClientRect();if([s.h.SharedMedia,s.h.Album,s.h.ScheduledAlbum,s.h.SearchResult].includes(t)){const e=function(e,t,a,n,c,r){if(e===t){const s=Math.max(c,r)*(e/t);n-=(s-c)/2,a-=(s-r)/2,c=s,r=s}else if(e>t){const a=c;n-=((c=r*(e/t))-a)/2}else if(t>e){const n=r;a-=((r=c*(t/e))-n)/2}return{top:a,left:n,width:c,height:r}}(b,p,v,O,f,j);v=e.top,O=e.left,f=e.width,j=e.height}const C=O+f/2-(g+b/2),y=v+j/2-(E+p/2),k=f/b,N=j/p,S=P(a||c);F(S,{top:E+"px",left:g+"px",width:b+"px",height:p+"px",transform:`translate3d(${C}px, ${y}px, 0) scale(${k}, ${N})`}),A(S,t),document.body.classList.add("ghost-animating"),requestAnimationFrame(()=>{document.body.appendChild(S),requestAnimationFrame(()=>{S.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(S),setTimeout(()=>{requestAnimationFrame(()=>{document.body.removeChild(S),document.body.classList.remove("ghost-animating")})},200+l.c)})})}function w(e,t,a){const{container:n,mediaEl:c}=L(e,a);if(!c)return;const r=document.getElementById("MediaViewer").querySelector(".active .media-viewer-content img, .active .media-viewer-content video");if(!r||!c)return;const{top:o,left:i,width:m,height:d}=r.getBoundingClientRect(),{top:u,left:h,width:b,height:p}=c.getBoundingClientRect();let g=u;if(!function(e){if("none"===e.style.display)return!1;const t=e.getBoundingClientRect(),{height:a}=I.a.get();return t.top<=a&&t.top+t.height>=0}(n)){const{height:e}=I.a.get();g=u<o?-p:e}const E=i+m/2-(h+b/2),v=o+d/2-(g+p/2);let O=m/b,f=d/p;const j=[s.h.Inline,s.h.ScheduledInline].includes(e)&&!M(n,c)||[s.h.Album,s.h.ScheduledAlbum].includes(e)&&!M(n,c);[s.h.SharedMedia,s.h.Album,s.h.ScheduledAlbum,s.h.SearchResult].includes(e)&&(O>f?O=f:f>O&&(f=O));const C=P(t||c);F(C,{top:g+"px",left:h+"px",width:b+"px",height:p+"px",transform:`translate3d(${E}px, ${v}px, 0) scale(${O}, ${f})`}),requestAnimationFrame(()=>{document.body.classList.add("ghost-animating"),document.body.appendChild(C),requestAnimationFrame(()=>{C.style.transform="",j&&(C.style.opacity="0"),A(C,e),setTimeout(()=>{requestAnimationFrame(()=>{document.body.removeChild(C),document.body.classList.remove("ghost-animating")})},200+l.c)})})}function P(e){const t=document.createElement("div");t.classList.add("ghost");const a=new Image;return"string"==typeof e?a.src=e:e instanceof HTMLVideoElement?a.src=e.poster:a.src=e.src,t.appendChild(a),t}function M(e,t){const a=document.querySelector(".active > .MessageList");let n=e.offsetTop+t.closest(".content-inner, .WebPage").offsetTop;return e.id.includes("album-media-")&&(n+=e.parentElement.offsetTop+e.closest(".Message").offsetTop),n>a.scrollTop&&n+t.offsetHeight<a.scrollTop+a.offsetHeight}function F(e,t){Object.assign(e.style,t)}function L(e,t){let a,n;switch(e){case s.h.Album:case s.h.ScheduledAlbum:a=".active > .MessageList #album-media-"+t.id,n=".full-media";break;case s.h.SharedMedia:a="#shared-media"+t.id,n="img";break;case s.h.SearchResult:a="#search-media"+t.id,n="img";break;case s.h.MiddleHeaderAvatar:a=".MiddleHeader .ChatInfo .Avatar",n="img.avatar-media";break;case s.h.ProfileAvatar:a="#RightColumn .active .profile-info .Avatar",n="img.avatar-media";break;case s.h.ScheduledInline:case s.h.Inline:default:a=".active > .MessageList #message"+t.id,n=".message-content .full-media, .message-content .thumbnail"}const c=document.querySelector(a),r=c&&c.querySelectorAll(n);return{container:c,mediaEl:r&&r[r.length-1]}}function A(e,t){switch(t){case s.h.Album:case s.h.ScheduledAlbum:case s.h.Inline:case s.h.ScheduledInline:e.classList.add("rounded-corners");break;case s.h.SharedMedia:case s.h.SearchResult:e.firstChild.style.objectFit="cover";break;case s.h.MiddleHeaderAvatar:case s.h.ProfileAvatar:e.classList.add("circle")}}var T=a(93),D=a(20),B=a(164),U=a(100),x=a(31),R=a(28),G=a(35),q=a(99);a(239);var z=Object(c.h)((e,{chatId:t,messageId:a,isAvatar:n})=>{if(n&&t)return{sender:Object(d.lb)(t)?Object(m.Cb)(e,t):Object(m.f)(e,t)};if(!a||!t)return{};const c=Object(m.k)(e,t,a);return{message:c,sender:c&&Object(m.pb)(e,c)}},(e,t)=>Object(u.l)(t,["closeMediaViewer","focusMessage"]))(({chatId:e,messageId:t,sender:a,isAvatar:c,message:r,closeMediaViewer:s,focusMessage:l})=>{const o=Object(n.m)(()=>{s(),l({chatId:e,messageId:t})},[e,l,t,s]);if(Object(T.a)(),!a||!r&&!c)return;const i=a.id<0,m=Object(d.U)(a);return n.a.createElement("div",{className:"SenderInfo",onClick:o},i?n.a.createElement(q.a,{key:a.id,size:"medium",chat:a}):n.a.createElement(q.a,{key:a.id,size:"medium",user:a}),n.a.createElement("div",{className:"meta"},n.a.createElement("div",{className:"title"},m&&Object(G.a)(m)),n.a.createElement("div",{className:"date"},c?"Profile photo":Object(R.d)(1e3*r.date))))}),$=a(167),H=a(56),V=a(32),W=a(113);a(240);var Y=({mediaData:e,isVideo:t,isZoomed:a,message:c,fileName:r,isAvatar:s,onCloseMediaViewer:l,onForward:i,onZoomToggle:m})=>{const[u,h]=Object(n.r)(!1),b=t&&c?Object(d.D)(c,"download"):void 0,{mediaData:p,downloadProgress:g}=Object(v.a)(b,!u);Object(n.n)(()=>{u&&p&&(Object($.a)(p,r),h(!1))},[r,p,u]),Object(n.n)(()=>{h(!1)},[b]);const E=Object(n.m)(e=>{e.stopPropagation(),h(e=>!e)},[]),O=Object(T.a)(),f=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions"},n.a.createElement("i",{className:"icon-more"})),[]);return o.f?n.a.createElement("div",{className:"MediaViewerActions-mobile"},n.a.createElement(H.a,{trigger:f,positionX:"right"},!s&&n.a.createElement(V.a,{icon:"forward",onClick:i},O("Forward")),t?n.a.createElement(V.a,{icon:u?"close":"download",onClick:E},u?Math.round(100*g)+"% Downloading...":"Download"):n.a.createElement(V.a,{icon:"download",href:e,download:r},O("AccActionDownload"))),u&&n.a.createElement(W.a,{progress:g,size:"s",noCross:!0})):n.a.createElement("div",{className:"MediaViewerActions"},!s&&n.a.createElement(n.a.Fragment,null,n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:O("Forward"),onClick:i},n.a.createElement("i",{className:"icon-forward"}))),t?n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:O("AccActionDownload"),onClick:E},u?n.a.createElement(W.a,{progress:g,size:"s",onClick:E}):n.a.createElement("i",{className:"icon-download"})):n.a.createElement(x.a,{href:e,download:r,round:!0,size:"smaller",color:"translucent-white",ariaLabel:O("AccActionDownload")},n.a.createElement("i",{className:"icon-download"})),n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:a?"Zoom Out":"Zoom In",onClick:m},n.a.createElement("i",{className:a?"icon-zoom-out":"icon-zoom-in"})),n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:O("Close"),onClick:l},n.a.createElement("i",{className:"icon-close"})))},K=a(9);a(241);var Z=({text:e="",isHideable:t,onClick:a})=>{const[c,r]=Object(n.r)(!1);return Object(n.n)(()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;r(t>2*i.c)};t();const a=Object(K.g)(t,500,!0);return window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}},[]),n.a.createElement("div",{className:"MediaViewerFooter "+(t?"hideable":""),onClick:function(t){e&&t.stopPropagation()}},e&&n.a.createElement("div",{className:"media-viewer-footer-content",onClick:a},n.a.createElement("p",{className:"media-text custom-scroll "+(c?"multiline":"")},e)))},Q=a(27),_=a(121);const X=function(){if(void 0!==document.fullscreenElement)return"fullscreenElement";if(void 0!==document.mozFullScreenElement)return"mozFullScreenElement";if(void 0!==document.webkitFullscreenElement)return"webkitFullscreenElement";return""}();var J=a(137),ee=a(134);const te=["bytes","kB","MB","GB","TB","PB"];var ae=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${te[t]}`};a(242);const ne=e=>{e.stopPropagation()};var ce=({bufferedProgress:e,currentTime:t,duration:a,fileSize:c,isForceVisible:r,isForceMobileVersion:s,isPlayed:l,isFullscreenSupported:i,isFullscreen:m,onChangeFullscreen:d,onPlayPause:u,onSeek:h})=>{const[b,p]=Object(n.r)(!0);Object(n.n)(()=>{r&&p(r)},[r]),Object(n.n)(()=>{let e;return r||(o.f?p(!1):e=window.setTimeout(()=>{p(!1)},800)),()=>{e&&window.clearTimeout(e)}},[r]),Object(n.n)(()=>((b||r)&&document.body.classList.add("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")}),[r,b]);const g=Object(T.a)();var E,v;if(b||r)return n.a.createElement("div",{className:"VideoPlayerControls "+(s?"mobile":""),onClick:ne},function(e,t,a,c){const r=e/t*100,s=100*a;return n.a.createElement("div",{className:"player-seekline"},n.a.createElement("div",{className:"player-seekline-track"},n.a.createElement("div",{className:"player-seekline-buffered",style:`width: ${s||0}%`}),n.a.createElement("div",{className:"player-seekline-played",style:`width: ${r||0}%`}),n.a.createElement("input",{min:"0",max:"100",step:.01,type:"range",onInput:c,className:"player-seekline-input",value:r||0})))}(t,a,e,h),n.a.createElement(x.a,{ariaLabel:g("AccActionPlay"),size:"tiny",ripple:!o.f,color:"translucent-white",className:"play",onClick:u},n.a.createElement("i",{className:l?"icon-pause":"icon-play"})),function(e,t){return n.a.createElement("div",{className:"player-time"},`${Object(R.e)(e)} / ${Object(R.e)(t)}`)}(t,a),e<1&&(E=e,v=c,n.a.createElement("div",{className:"player-file-size"},`${ae(v*E)} / ${ae(v)}`)),i&&n.a.createElement(x.a,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",onClick:d},n.a.createElement("i",{className:""+(m?"icon-smallscreen":"icon-fullscreen")})))};a(243);function re(){return(re=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}var se=Object(n.h)(({url:e,isGif:t,posterData:a,posterSize:c,downloadProgress:r,fileSize:s,isMediaViewerOpen:l,noPlay:i,onClose:m})=>{const d=Object(n.q)(null),[u,h]=Object(n.r)(!o.k||!o.d),[b,p]=Object(n.r)(0),[g,E]=Object(n.r)(!0),[v,O,f]=function(e,t){const[a,c]=Object(n.r)(Boolean(X&&document[X]));return Object(n.o)(()=>{const a=()=>{c(Boolean(X&&document[X]))},n=()=>{c(!0)},r=()=>{c(!1),t(!1)},s=e.current;return document.addEventListener("fullscreenchange",a,!1),document.addEventListener("webkitfullscreenchange",a,!1),document.addEventListener("mozfullscreenchange",a,!1),s&&(s.addEventListener("webkitbeginfullscreen",n,!1),s.addEventListener("webkitendfullscreen",r,!1)),()=>{document.removeEventListener("fullscreenchange",a,!1),document.removeEventListener("webkitfullscreenchange",a,!1),document.removeEventListener("mozfullscreenchange",a,!1),s&&(s.removeEventListener("webkitbeginfullscreen",n,!1),s.removeEventListener("webkitendfullscreen",r,!1))}},[]),X||"iOS"===o.n?[a,()=>{e.current&&(X||"iOS"===o.n)&&(e.current.requestFullscreen?e.current.requestFullscreen():e.current.webkitRequestFullscreen?e.current.webkitRequestFullscreen():e.current.webkitEnterFullscreen?e.current.webkitEnterFullscreen():e.current.mozRequestFullScreen&&e.current.mozRequestFullScreen(),c(!0))},()=>{e.current&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),c(!1))}]:[!1]}(d,h),{isBuffered:j,bufferedProgress:C,bufferingHandlers:y}=Object(_.a)(),{shouldRender:k,transitionClassNames:N}=Object(Q.a)(!j,void 0,void 0,"slow");Object(n.n)(()=>{i||!l?d.current.pause():e&&!o.k&&Object(ee.a)(d.current)},[i,l,e]),Object(n.n)(()=>{d.current.currentTime===d.current.duration?(p(0),h(!1)):p(d.current.currentTime)},[b]);const I=Object(n.m)(e=>{e.stopPropagation(),u?(d.current.pause(),h(!1)):(d.current.play(),h(!0))},[u]);Object(J.a)(d,[]);const S=Object(n.m)(()=>{E(!0)},[]),w=Object(n.m)(()=>{E(!1)},[]),P=Object(n.m)(e=>{p(e.currentTarget.currentTime)},[]),M=Object(n.m)(()=>{p(0),h(!1)},[]),F=Object(n.m)(()=>{v&&f?f():!v&&O&&O()},[f,v,O]),L=Object(n.m)(e=>{e.stopPropagation(),d.current.currentTime=Number(e.target.value)*d.current.duration/100},[]),A=Object(n.m)(e=>{e.stopPropagation(),E(!g)},[g]);Object(n.n)(()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||I(e)};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}},[I]);const T=c&&`width: ${c.width}px; height: ${c.height}px`,D=`background-image: url(${a})`;return n.a.createElement("div",{className:"VideoPlayer",onClick:!t&&o.f?A:void 0,onMouseOver:t?void 0:S,onMouseOut:t?void 0:w},n.a.createElement("div",{style:T},n.a.createElement("video",re({ref:d,autoPlay:o.k,playsInline:!0,loop:t,muted:t,id:"media-viewer-video",style:D,onEnded:M},y,{onTimeUpdate:P}),e&&n.a.createElement("source",{src:e}))),k&&n.a.createElement("div",{className:["spinner-container",N].join(" ")},!j&&n.a.createElement("div",{className:"buffering"},"Buffering..."),n.a.createElement(W.a,{size:"xl",progress:j?1:r,square:!0,onClick:m})),!t&&!k&&n.a.createElement(ce,{isPlayed:u,bufferedProgress:C,currentTime:b,isFullscreenSupported:Boolean(O),isFullscreen:v,fileSize:s,duration:d.current?d.current.duration:0,isForceVisible:!u||g,isForceMobileVersion:c&&c.width<400,onSeek:L,onChangeFullscreen:F,onPlayPause:I}))}),le=a(8);a(244);var oe=Object(n.h)(({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:a}=Object(Q.a)(e),c=Object(y.a)(e),r=Object(n.q)(null),[s,l]=Object(n.r)(1),i=Object(n.q)(!1);Object(n.n)(()=>{e&&!c&&l(1.5)},[e,c]);const m=Object(n.m)(()=>{i.current=!0},[]),d=Object(n.m)(()=>{i.current=!1,1===s&&t(s,!i.current)},[t,s]);Object(n.n)(()=>{t(s,!i.current)},[s,t]);const u=Object(T.a)(),h=Object(le.a)("ZoomControls",a);return n.a.createElement("div",{className:h},n.a.createElement(x.a,{disabled:1===s,size:"tiny",color:"translucent-white",ariaLabel:u("ZoomOut"),className:"zoom-out",ripple:!o.f,onClick:()=>{r.current&&l(Math.max(1,s-.5))}},n.a.createElement("i",{className:"icon-zoom-out"})),n.a.createElement(x.a,{disabled:3===s,size:"tiny",color:"translucent-white",ariaLabel:"Zoom In",className:"zoom-in",ripple:!o.f,onClick:()=>{r.current&&l(Math.min(3,s+.5))}},n.a.createElement("i",{className:"icon-zoom-in"})),n.a.createElement("div",{className:"seekline"},n.a.createElement("div",{className:"seekline-track"},n.a.createElement("div",{className:"seekline-played",style:`width: ${50*(s-1)}%`}),n.a.createElement("input",{ref:r,min:1,max:3,step:"0.5",value:s,type:"range",className:"seekline-input",onChange:e=>{l(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown:m,onMouseUp:d}))))});a(245);const ie=[1,0,0,1,0,0],me={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5};var de=Object(n.h)(({children:e,className:t,noWrap:a,canPan:c,zoomLevel:r,panDeltaX:s,panDeltaY:l,onPan:o})=>{const i=me[r]||r,[m,d]=Object(n.r)(!1),[h,b]=Object(n.r)({dx:s,dy:l,x:0,y:0}),[p,g]=Object(n.r)(ie),E=Object(n.q)(null),v=Object(n.q)(null);Object(n.n)(()=>{const e=i||p[0],t=s||p[4],a=l||p[5],n=[...p];p[0]!==e&&(n[0]=e||n[0],n[3]=e||n[3]),p[4]!==t&&(n[4]=t),p[5]!==a&&(n[5]=a),Object(u.a)(p,n)||g(function(e,t,a){const n=a&&a.querySelector(".active img");if(!a||!n)return t;const c=a.getBoundingClientRect(),r=n.getBoundingClientRect(),s=r.width/e*t[0],l=r.height/e*t[3],o=(c.width-s)/2+t[4],i=(c.height-l)/2+t[5];return c.width&&c.width-150<o?t[4]-=o+c.width-150:s&&s+o<150&&(t[4]-=s+o-150),c.height&&c.height-150<i?t[5]-=i+c.height-150:l&&l+i<150&&(t[5]-=l+i-150),t}(p[0],n,E.current))},[s,l,i]),Object(n.n)(()=>{c||g(ie)},[c]),Object(n.n)(()=>{v.current&&(v.current.style.transform=`matrix(${p.toString()})`)},[a,p]);return a?e:n.a.createElement("div",{ref:E,className:"pan-wrapper "+(t||""),onMouseDown:e=>{if(!c)return;e.stopPropagation(),e.preventDefault();const t={dx:p[4],dy:p[5],x:e.pageX,y:e.pageY};b(t),d(!0),E.current&&E.current.classList.add("move")},onMouseUp:()=>{d(!1),E.current&&E.current.classList.remove("move"),o&&o(p[4],p[5])},onMouseMove:e=>{if(m){const t=function(e,t){const a=[...p],n=h.x-e,c=h.y-t;return a[4]=h.dx-n,a[5]=h.dy-c,a}(e.pageX,e.pageY);g(t),v.current&&(v.current.style.transform=`matrix(${p.toString()})`)}}},n.a.createElement("div",{ref:v,className:"pan-container"},e))});a(246);function ue(e,t){return e?n.a.createElement("img",{src:e,alt:"",style:t?`width: ${t.width}px`:"",draggable:!1}):n.a.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},n.a.createElement(D.a,{color:"white"}))}var he=Object(n.h)(Object(c.h)(e=>{const{chatId:t,threadId:a,messageId:n,avatarOwnerId:c,origin:r}=e.mediaViewer,{animationLevel:l}=e.settings.byKey;if(r===s.h.SearchResult){if(!t||!n)return{animationLevel:l};const a=Object(m.k)(e,t,n);return a?{chatId:t,messageId:n,senderId:a.senderId,origin:r,message:a,animationLevel:l}:{animationLevel:l}}if(c){return{messageId:-1,senderId:c,avatarOwner:Object(m.f)(e,c)||Object(m.Cb)(e,c),animationLevel:l,origin:r}}if(!(t&&a&&n))return{animationLevel:l};let o,i,d;if(o=r&&[s.h.ScheduledAlbum,s.h.ScheduledInline].includes(r)?Object(m.lb)(e,t,n):Object(m.k)(e,t,n),!o)return{animationLevel:l};if(i=r&&[s.h.ScheduledAlbum,s.h.ScheduledInline].includes(r)?Object(m.mb)(e,t):Object(m.m)(e,t),r===s.h.Inline||r===s.h.Album)d=Object(m.cb)(e,t,a)||Object(m.X)(e,t,a);else if(r===s.h.SharedMedia){const t=Object(m.v)(e),{foundIds:a}=t&&t.resultsByType&&t.resultsByType.media||{};d=a}return{chatId:t,threadId:a,messageId:n,senderId:o.senderId,origin:r,message:o,chatMessages:i,collectionIds:d,animationLevel:l}},(e,t)=>Object(u.l)(t,["openMediaViewer","closeMediaViewer","openForwardMenu","focusMessage"]))(({chatId:e,threadId:t,messageId:a,senderId:c,origin:m,avatarOwner:u,message:I,chatMessages:P,collectionIds:M,openMediaViewer:F,closeMediaViewer:L,openForwardMenu:A,focusMessage:D,animationLevel:R})=>{const G=Object(n.q)(null),q=Boolean(u||a),$=I?Object(d.Q)(I):void 0,H=I?Object(d.G)(I):void 0,V=I?Object(d.O)(I):void 0,W=Boolean($),K=Boolean(H||$),Q=Boolean(V),_=V?V.isGif:void 0,X=m===s.h.SharedMedia,J=m===s.h.SearchResult,ee=R>=1?"mv-slide":"none",te=2===R?"slide-fade":"none",ae=2===R,ne=u?`avatar${u.id}.jpg`:I&&Object(d.B)(I),ce=Object(y.a)(c),[re,le]=Object(n.r)(!1),[ie,me]=Object(n.r)(!1),[he,be]=Object(n.r)(1),[pe,ge]=Object(n.r)({x:0,y:0}),Ee=Object(n.p)(()=>W&&a?[a]:Object(d.i)(P||{},M||[],X),[W,a,P,M,X]),ve=a?Ee.indexOf(a):-1,Oe=0===ve||-1===ve,fe=ve===Ee.length-1||-1===ve;function je(e){return u?Object(d.f)(u,e?"big":"normal"):I&&Object(d.D)(I,e?"viewerFull":"viewerPreview")}!q||ce&&ce===c&&G.current||(G.current=ve);const Ce=Object(E.a)(I&&(X||J)&&Object(d.D)(I,"pictogram"),void 0,r.ApiMediaFormat.BlobUrl,void 0,ae&&350),ye=Object(E.a)(je(),void 0,u?r.ApiMediaFormat.DataUri:r.ApiMediaFormat.BlobUrl,void 0,ae&&350),{mediaData:ke,downloadProgress:Ne}=Object(v.a)(je(!0),void 0,I&&Object(d.C)(I,"viewerFull"),void 0,ae&&350),Ie=H||V?(H||V).blobUrl:void 0;let Se=!Q&&(Ie||ke)||ye||Ce;const we=function(e){const t=Object(n.q)();let a=!1;Object(f.a)(()=>{if(a=!0,t.current=void 0,!e)return;const n=new Image;if(n.src=e,!n.width)return;const c=Object(C.f)(n);Object(O.a)(c.getContext("2d"),0,0,c.width,c.height,2,2),t.current=c.toDataURL()},[e]);const c=Object(j.a)(e||void 0,Boolean(t.current));return t.current||!a&&c||e||void 0}(!Se&&I&&Object(d.E)(I));Se||m===s.h.SearchResult||(Se=we);const Pe=K?Object(d.R)(W?Object(d.Q)(I):Object(d.G)(I)):void 0,Me=Q?Object(d.bb)(Object(d.O)(I)):void 0;Object(n.n)(()=>{o.f&&document.body.classList.toggle("is-media-viewer-open",q)},[q]);const Fe=Object(g.a)();Object(n.n)(()=>{const e=window.matchMedia(i.b);return"function"==typeof e.addEventListener?e.addEventListener("change",Fe):"function"==typeof e.addListener&&e.addListener(Fe),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",Fe):"function"==typeof e.removeListener&&e.removeListener(Fe)}},[Fe]);const Le=Object(y.a)(I),Ae=Object(y.a)(m),Te=Object(y.a)(u),De=Object(y.a)(Se);Object(n.n)(()=>{if(ae&&q&&!Le&&!Te){Object(k.b)(350+l.c);const e=I?Object(N.a)(I):void 0;S(Boolean(e),m,Se,I)}ae&&!q&&(Le||Te)&&(Object(k.b)(350+l.c),w(Ae,De,Le||void 0))},[ae,q,m,Ae,I,Le,Te,Se,De]),Object(n.n)(()=>{let e;return ie?le(!0):e=window.setTimeout(()=>{le(!1)},350),()=>{e&&window.clearTimeout(e)}},[ie]);const Be=()=>{me(!1),be(1),ge({x:0,y:0})},Ue=Object(n.m)(()=>{me(!ie),be(ie?1:1.5),ie&&ge({x:0,y:0})},[ie]),xe=Object(n.m)((e,t=!1)=>{be(e),1===e&&t&&Be()},[]),Re=Object(n.m)(()=>{L(),Be()},[L]),Ge=Object(n.m)(()=>{Re(),D({chatId:e,threadId:t,messageId:a})},[Re,e,t,D,a]),qe=Object(n.m)(()=>{A({fromChatId:e,messageIds:[a]}),Be()},[A,e,a]);Object(n.n)(()=>q?Object(b.a)(()=>{ie?Be():Re()}):void 0,[Re,q,ie]),Object(n.n)(()=>{Q&&!_&&Object(p.b)()},[_,Q]);const ze=Object(n.m)((e,t)=>{let a=Ee.indexOf(e);return(-1===t&&a>0||1===t&&a<Ee.length-1)&&(a+=t),Ee[a]},[Ee]),$e=Object(n.m)(()=>{Oe||F({chatId:e,threadId:t,messageId:a?ze(a,-1):void 0,origin:m})},[e,t,ze,Oe,a,F,m]),He=Object(n.m)(()=>{fe||F({chatId:e,threadId:t,messageId:a?ze(a,1):void 0,origin:m})},[e,t,ze,fe,a,F,m]);Object(n.n)(()=>{const e=e=>{switch(e.key){case"Left":case"ArrowLeft":$e();break;case"Right":case"ArrowRight":He()}};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),Object(n.n)(()=>{const e=document.querySelector(".slide-container > .active, .slide-container > .to");if(!e)return;const t=_&&!o.d;return Object(h.b)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:()=>{ie||Re()},onSwipe:o.k?(e,t)=>{t===h.a.Right?$e():t===h.a.Left?He():Re()}:void 0})},[Re,_,ie,He,$e,re]);const Ve=Object(n.m)((e,t)=>{ge({x:e,y:t})},[]),We=Object(T.a)();function Ye(t){if(u)return n.a.createElement("div",{key:e,className:"media-viewer-content"},ue(ke||ye,Object(i.g)(i.a,!1)));if(I){const e=Object(N.a)(I),c=Boolean(e);return n.a.createElement("div",{key:a,className:"media-viewer-content "+(c?"has-footer":"")},K&&ue(Ie||ke||ye||Ce,I&&Object(i.g)(Pe,c)),Q&&n.a.createElement(se,{key:a,url:Ie||ke,isGif:_,posterData:Se,posterSize:I&&Object(i.g)(Me,c,!0),downloadProgress:Ne,fileSize:V.size,isMediaViewerOpen:q,noPlay:!t,onClose:Re}),e&&n.a.createElement(Z,{text:e,onClick:Ge,isHideable:Q}))}}function Ke(){return n.a.createElement(z,{key:u?u.id:a,chatId:u?u.id:e,messageId:a,isAvatar:Boolean(u)})}return n.a.createElement(B.a,{id:"MediaViewer",className:ie?"zoomed":"",isOpen:q},()=>n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"media-viewer-head"},o.f&&n.a.createElement(x.a,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:We("Close"),onClick:Re},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(U.a,{activeKey:G.current,name:te},Ke),n.a.createElement(Y,{mediaData:ke||ye,isVideo:Q,isZoomed:ie,message:I,fileName:ne,onCloseMediaViewer:Re,onForward:qe,onZoomToggle:Ue,isAvatar:Boolean(u)})),n.a.createElement(de,{noWrap:!re,canPan:ie,panDeltaX:pe.x,panDeltaY:pe.y,zoomLevel:he,onPan:Ve},n.a.createElement(U.a,{className:"slide-container",activeKey:ve,name:ee},Ye)),!Oe&&n.a.createElement("button",{type:"button",className:"navigation prev "+(Q&&!_&&"inline"),"aria-label":We("AccDescrPrevious"),onClick:$e}),!fe&&n.a.createElement("button",{type:"button",className:"navigation next "+(Q&&!_&&"inline"),"aria-label":We("Next"),onClick:He}),n.a.createElement(oe,{isShown:ie,onChangeZoom:xe})))})),be=a(46),pe=a(118),ge=a(16),Ee=a(98),ve=a(39),Oe=a(101),fe=a(94),je=a(96),Ce=a(111);a(247);var ye=Object(n.h)(Object(c.h)(e=>{const{chats:{byId:t,listIds:a,orderedPinnedIds:n},currentUserId:c}=e;return{chatsById:t,listIds:a.active,orderedPinnedIds:n.active,currentUser:c?Object(m.Cb)(e,c):void 0}},(e,t)=>Object(u.l)(t,["setForwardChatId","exitForwardMode","loadMoreChats"]))(({chatsById:e,listIds:t,orderedPinnedIds:a,currentUser:c,isOpen:r,setForwardChatId:s,exitForwardMode:l,loadMoreChats:i})=>{const[m,u]=Object(n.r)(""),h=Object(n.q)(null);Object(n.n)(()=>{r?o.f||setTimeout(()=>{requestAnimationFrame(()=>{h.current&&h.current.focus()})},500):(h.current&&h.current.blur(),setTimeout(()=>{u("")},300))},[r]);const b=Object(n.p)(()=>{const n=t?Object(d.Ab)(e,t,a):void 0;if(!n)return;const r=c?e[c.id]:void 0;return[...r?[r]:[],...n.pinnedChats.filter(({id:e})=>!r||e!==r.id),...n.otherChats.filter(({id:e})=>!r||e!==r.id)]},[e,t,a,c]),p=Object(n.p)(()=>{if(b)return b.filter(e=>!m||Object(be.a)(Object(d.l)(e,c),m)).map(({id:e})=>e)},[b,m,c]),[g,E]=Object(pe.a)(i,p,Boolean(m)),v=Object(n.m)(e=>{u(e.currentTarget.value)},[]),O=Object(T.a)(),f=n.a.createElement("div",{className:"modal-header"},n.a.createElement(x.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:O("Close"),onClick:l},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(ve.a,{ref:h,value:m,onChange:v,placeholder:O("ForwardTo")}));return n.a.createElement(Ee.a,{isOpen:r,onClose:l,className:"ForwardPicker",header:f},g&&g.length?n.a.createElement(Oe.a,{className:"picker-list custom-scroll",items:g,onLoadMore:E,isDisabled:Boolean(m)},g.map(e=>n.a.createElement(fe.a,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>s({id:e})},Object(d.lb)(e)?n.a.createElement(je.a,{userId:e}):n.a.createElement(Ce.a,{chatId:e})))):g&&!g.length?n.a.createElement("p",{className:"no-results"},"Sorry, nothing found."):n.a.createElement(ge.a,null))})),ke=a(158);a(248);function Ne(e){return e.isSlowMode?"Slowmode enabled":"Something went wrong"}var Ie=Object(n.h)(Object(c.h)(e=>Object(u.l)(e,["errors"]),(e,t)=>Object(u.l)(t,["dismissError"]))(({errors:e,dismissError:t})=>{const a=Object(T.a)();if(e.length)return n.a.createElement("div",{id:"Errors"},e.map(e=>n.a.createElement(Ee.a,{isOpen:!0,onClose:t,className:"error",title:Ne(e)},n.a.createElement("p",null,Object(ke.a)(e)),n.a.createElement(x.a,{isText:!0,onClick:t},a("OK")))))})),Se=a(170);var we=Object(n.h)(Object(c.h)(e=>Object(u.l)(e,["notifications"]),(e,t)=>Object(u.l)(t,["dismissNotification"]))(({notifications:e,dismissNotification:t})=>{if(e.length)return n.a.createElement("div",{id:"Notifications"},e.map(({message:e})=>n.a.createElement(Se.a,{message:Object(G.a)(e,["emoji","br","links"]),onDismiss:t})))}));a(249);const Pe=["M","T","W","T","F","S","S"];function Me(e,t,a,n,c){const r=new Date(e,t,a,0,0,0,0),s=n&&new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0),l=c&&new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0);return!!(l&&r>l)||!!(s&&r<s)}function Fe(e){return String(e).padStart(2,"0")}var Le=Object(n.h)(({selectedAt:e,maxAt:t,isFutureMode:a,isPastMode:c,isOpen:r,withTimePicker:s,submitButtonLabel:l,secondButtonLabel:i,onClose:m,onSubmit:d,onSecondButtonClick:u})=>{const h=new Date,b=Object(n.p)(()=>e?new Date(e):new Date,[e]),p=t?new Date(t):void 0,[g,E]=Object(n.r)(b),[v,O]=Object(n.r)(Fe(b.getHours())),[f,j]=Object(n.r)(Fe(b.getMinutes())),C=g.getFullYear(),y=g.getMonth(),k=g.getDate();Object(n.n)(()=>{r&&E(b)},[r,b]);const N=c&&C>=h.getFullYear()&&y>=h.getMonth()||p&&C>=p.getFullYear()&&y>=p.getMonth(),I=a&&C<=h.getFullYear()&&y<=h.getMonth(),S=Object(n.p)(()=>function(e,t){const a=[],n=new Date;n.setFullYear(e),n.setMonth(t),n.setDate(1);const c=n.getDay();for(let e=1;e<c;e++)a.push(0);for(;n.getMonth()===t;){const e=n.getDate();a.push(e),n.setDate(e+1)}return a}(C,y),[y,C]);const w=Object(n.m)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return O(""),void(e.target.value="");const a=Math.max(0,Math.min(Number(t),23)),n=new Date(g.getTime());n.setHours(a),E(n);const c=Fe(a);O(c),e.target.value=c},[g]),P=Object(n.m)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return j(""),void(e.target.value="");const a=Math.max(0,Math.min(Number(t),59)),n=new Date(g.getTime());n.setMinutes(a),E(n);const c=Fe(a);j(c),e.target.value=c},[g]);return n.a.createElement(Ee.a,{isOpen:r,onClose:m,className:"CalendarModal"},n.a.createElement("div",{className:"container"},n.a.createElement("div",{className:"month-selector"},n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",onClick:m},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("h4",null,Object(R.f)(g,o.f)),n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",disabled:I,onClick:I?void 0:function(){E(e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t})}},n.a.createElement("i",{className:"icon-previous"})),n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",disabled:N,onClick:N?void 0:function(){E(e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t})}},n.a.createElement("i",{className:"icon-next"})))),n.a.createElement("div",{className:"calendar-wrapper"},n.a.createElement("div",{className:"calendar-grid"},Pe.map(e=>n.a.createElement("div",{className:"day-button faded weekday"},n.a.createElement("span",null,e))),S.map(e=>n.a.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void E(e=>{const a=new Date(e);return a.setDate(t),a});var t},className:Object(le.a)("day-button",Me(C,y,e,a?h:void 0,c?h:p)?"disabled":""+(e?"clickable":""),e===k&&"selected")},!!e&&n.a.createElement("span",null,e))))),s&&n.a.createElement("div",{className:"timepicker"},n.a.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:v,onChange:w}),":",n.a.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:f,onChange:P})),n.a.createElement("div",{className:"footer"},n.a.createElement(x.a,{onClick:function(){d(g)}},s?function(e){const t=Object(R.c)(e,!0);return`Send ${"Today"===t?t:"on "+t} at ${Object(R.h)(e)}`}(g):l),i&&n.a.createElement(x.a,{onClick:u,isText:!0},i)))});var Ae=Object(n.h)(Object(c.h)((e,{message:t,isSchedule:a})=>{const{threadId:n}=Object(m.y)(e)||{},{canDeleteForAll:c}=n&&Object(m.b)(e,t,n)||{},r=Object(m.f)(e,t.chatId);return{canDeleteForAll:!a&&c,contactName:r&&Object(d.lb)(r.id)?Object(d.Y)(Object(m.Cb)(e,Object(d.T)(r))):void 0,willDeleteForCurrentUserOnly:r&&Object(d.ib)(r)&&!c,willDeleteForAll:r&&Object(d.nb)(r)}},(e,t)=>Object(u.l)(t,["deleteMessages","deleteScheduledMessages"]))(({isOpen:e,isSchedule:t,message:a,album:c,canDeleteForAll:r,contactName:s,willDeleteForCurrentUserOnly:l,willDeleteForAll:o,onClose:i,deleteMessages:m,deleteScheduledMessages:d})=>{const u=Object(n.m)(()=>{const e=c&&c.messages?c.messages.map(({id:e})=>e):[a.id];m({messageIds:e,shouldDeleteForAll:!0}),i()},[m,a.id,i,c]),h=Object(n.m)(()=>{const e=c&&c.messages?c.messages.map(({id:e})=>e):[a.id];t?d({messageIds:e}):m({messageIds:e,shouldDeleteForAll:!1}),i()},[c,a.id,t,i,d,m]),b=Object(T.a)();return n.a.createElement(Ee.a,{isOpen:e,onClose:i,onEnter:e&&!r?h:void 0,className:"delete",title:b("DeleteSingleMessagesTitle")},n.a.createElement("p",null,b("AreYouSureDeleteSingleMessage")),l&&n.a.createElement("p",null,"This will delete it just for you, not for other participants in the chat."),o&&n.a.createElement("p",null,"This will delete it for everyone in this chat."),r&&n.a.createElement(x.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},"Delete for ",s?"me and ":"Everyone",s&&Object(G.a)(s)),n.a.createElement(x.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},"Delete",r?" just for me":""),n.a.createElement(x.a,{className:"confirm-dialog-button",isText:!0,onClick:i},b("Cancel")))}));var Te=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.lb)(t),n=Object(m.O)(e,t),c=Object(m.f)(e,t),r=!!c&&Object(d.jb)(c),s=!!c&&Object(d.ib)(c),l=!!c&&Object(d.nb)(c);return{isPrivateChat:a,isChatWithSelf:n,isChannel:r,isGroup:s,isSuperGroup:l,canPinForAll:a&&!n||l||s,contactName:c&&Object(d.lb)(c.id)?Object(d.Y)(Object(m.Cb)(e,Object(d.T)(c))):void 0}},(e,t)=>Object(u.l)(t,["pinMessage"]))(({isOpen:e,messageId:t,chatId:a,isChannel:c,isGroup:r,isSuperGroup:s,canPinForAll:l,contactName:o,onClose:i,pinMessage:m})=>{const d=Object(n.m)(()=>{m({chatId:a,messageId:t,isUnpin:!1}),i()},[m,a,t,i]),u=Object(n.m)(()=>{m({chatId:a,messageId:t,isUnpin:!1,isOneSide:!0,isSilent:!0}),i()},[a,t,i,m]),h=Object(T.a)();return n.a.createElement(Ee.a,{isOpen:e,onClose:i,className:"pin",header:n.a.createElement("div",{className:"modal-header"},n.a.createElement("h3",{className:"modal-title"},h("PinMessageAlertTitle")))},c?n.a.createElement("p",null,h("PinMessageAlertChannel")):r||s?n.a.createElement("p",null,h("PinMessageAlert")):n.a.createElement("p",null,h("PinMessageAlertChat")),n.a.createElement(x.a,{className:"confirm-dialog-button",isText:!0,onClick:u},h("DialogPin")),l&&n.a.createElement(x.a,{className:"confirm-dialog-button",isText:!0,onClick:d},o?"Pin for me and "+o:"Pin and notify all memebers"),n.a.createElement(x.a,{className:"confirm-dialog-button",isText:!0,onClick:i},h("Cancel")))}));var De=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=t?Object(m.fb)(e,t):[];return{pinnedMessagesCount:a?a.length:0}})(({isOpen:e,pinnedMessagesCount:t,onClose:a,onUnpin:c})=>{const r=Object(T.a)();return n.a.createElement(Ee.a,{isOpen:e,onClose:a,className:"unpin-all",header:n.a.createElement("div",{className:"modal-header"},n.a.createElement("h3",{className:"modal-title"},r("UnpinAllMessages")))},n.a.createElement("p",null,"Do you want to unpin all ",t," messages in this chat?"),n.a.createElement(x.a,{className:"confirm-dialog-button",isText:!0,onClick:c},r("DialogUnpin")),n.a.createElement(x.a,{className:"confirm-dialog-button",isText:!0,onClick:a},r("Cancel")))})),Be=a(36),Ue=a(50);var xe=Object(n.h)(Object(c.h)((e,{isSchedule:t})=>{const{messageIds:a}=e.selectedMessages||{},{canDeleteForAll:n}=Object(m.e)(e),c=Object(m.r)(e);return{selectedMessageIds:a,canDeleteForAll:!t&&n,contactName:c&&Object(d.lb)(c.id)?Object(d.Y)(Object(m.Cb)(e,Object(d.T)(c))):void 0,willDeleteForCurrentUserOnly:c&&Object(d.ib)(c)&&!n,willDeleteForAll:c&&Object(d.nb)(c)}},(e,t)=>Object(u.l)(t,["deleteMessages","deleteScheduledMessages","exitMessageSelectMode"]))(({isOpen:e,isSchedule:t,selectedMessageIds:a,canDeleteForAll:c,contactName:r,willDeleteForCurrentUserOnly:s,willDeleteForAll:l,onClose:o,deleteMessages:i,deleteScheduledMessages:m,exitMessageSelectMode:d})=>{const u=Object(n.m)(()=>{i({messageIds:a,shouldDeleteForAll:!0}),d(),o()},[i,d,a,o]),h=Object(n.m)(()=>{t?m({messageIds:a}):i({messageIds:a,shouldDeleteForAll:!1}),d(),o()},[t,d,o,m,a,i]),b=Object(T.a)();if(a)return n.a.createElement(Ee.a,{isOpen:e,onClose:o,onEnter:c?void 0:h,className:"delete",title:"Delete Messages?"},n.a.createElement("p",null,b("AreYouSureDeleteFewMessages")),s&&n.a.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),l&&n.a.createElement("p",null,"This will delete them for everyone in this chat."),c&&n.a.createElement(x.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},"Delete for ",r?"me and ":"Everyone",r&&Object(G.a)(r)),n.a.createElement(x.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},"Delete",c?" just for me":""),n.a.createElement(x.a,{className:"confirm-dialog-button",isText:!0,onClick:o},b("Cancel")))}));a(250);var Re=Object(n.h)(Object(c.h)(e=>{const{type:t}=Object(m.y)(e)||{},{canDelete:a}=Object(m.e)(e);return{isSchedule:"scheduled"===t,selectedMessagesCount:Object(m.ob)(e),canDeleteMessages:a}},(e,t)=>Object(u.l)(t,["exitMessageSelectMode","openForwardMenuForSelectedMessages"]))(({canPost:e,isActive:t,messageListType:a,isSchedule:c,selectedMessagesCount:r,canDeleteMessages:s,exitMessageSelectMode:l,openForwardMenuForSelectedMessages:o})=>{const[i,m,d]=Object(Be.a)();Object(n.n)(()=>t&&!i?Object(Ue.a)({onBackspace:m,onDelete:m,onEsc:l}):void 0,[t,i,m,l]);const u=Object(y.a)(r||void 0,!0),h=t?r:u,b=Object(T.a)(),p=b("VoiceOver.Chat.MessagesSelected",h),g=Object(le.a)("MessageSelectToolbar",e&&"with-composer",t&&"shown");return n.a.createElement("div",{className:g},n.a.createElement("div",{className:"MessageSelectToolbar-inner"},n.a.createElement(x.a,{color:"translucent",round:!0,onClick:l,ariaLabel:"Exit select mode"},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("span",{className:"MessageSelectToolbar-count",title:p},p),!!r&&n.a.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==a&&n.a.createElement(V.a,{icon:"forward",ariaLabel:"Forward Messages",onClick:o},n.a.createElement("span",{className:"item-text"},b("Forward"))),n.a.createElement(V.a,{destructive:!0,icon:"delete",onClick:m,disabled:!s,ariaLabel:b("EditAdminGroupDeleteMessages")},n.a.createElement("span",{className:"item-text"},b("Delete"))))),n.a.createElement(xe,{isOpen:i,isSchedule:c,onClose:d}))})),Ge=a(157),qe=a(44),ze=a(160),$e=a(148);var He=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),n=a&&Object(d.T)(a);return{chat:a,privateChatUser:n?Object(m.Cb)(e,n):void 0,isPinned:Object(m.M)(e,t)}})(({chatId:e,chat:t,privateChatUser:a,isPinned:c,withHandle:r,onClick:s})=>{const[l,o,i]=Object(Be.a)(),m=Object(ze.a)({chat:t,privateChatUser:a,isPinned:c,handleDelete:o});if(t)return n.a.createElement(fe.a,{className:"chat-item-clickable search-result",onClick:()=>s(e),contextActions:m},Object(d.lb)(e)?n.a.createElement(je.a,{userId:e,withHandle:r,avatarSize:"large"}):n.a.createElement(Ce.a,{chatId:e,withHandle:r,avatarSize:"large"}),n.a.createElement($e.a,{isOpen:l,onClose:i,chat:t}))})),Ve=a(129);a(251);const We=Object(K.g)(e=>e(),6e4,!0);var Ye=Object(n.h)(Object(c.h)(e=>{const{userIds:t}=e.topPeers,a=e.users.byId,{recentlyFoundChatIds:n}=e.globalSearch;return{topUserIds:t,usersById:a,recentlyFoundChatIds:n}},(e,t)=>Object(u.l)(t,["loadTopUsers","loadContactList","openChat","addRecentlyFoundChatId","clearRecentlyFoundChats"]))(({topUserIds:e,usersById:t,recentlyFoundChatIds:a,onReset:c,loadTopUsers:r,loadContactList:s,openChat:l,addRecentlyFoundChatId:o,clearRecentlyFoundChats:i})=>{const m=Object(n.q)(null);Object(n.n)(()=>{We(()=>{r(),s()})},[r,s]),Object(Ve.a)(m,!e);const u=Object(n.m)(e=>{l({id:e}),c(),setTimeout(()=>{o({id:e})},250)},[l,o,c]),h=Object(T.a)();return n.a.createElement("div",{className:"RecentContacts custom-scroll"},e&&n.a.createElement("div",{className:"top-peers-section"},n.a.createElement("div",{ref:m,className:"top-peers no-selection"},e.map(e=>n.a.createElement("div",{className:"top-peer-item",onClick:()=>u(e)},n.a.createElement(q.a,{user:t[e]}),n.a.createElement("div",{className:"top-peer-name"},Object(G.a)(Object(d.Y)(t[e])||" ")))))),a&&n.a.createElement("div",{className:"search-section pt-1"},n.a.createElement("h3",{className:"section-heading mt-0 recent-chats-header"},h("Recent"),n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:i},n.a.createElement("i",{className:"icon-close"}))),a.map(e=>n.a.createElement(He,{chatId:e,onClick:u}))))})),Ke=a(131),Ze=a(110);a(252);var Qe=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t);if(!a)return{};const n=Object(d.T)(a);return{chat:a,...n&&{privateChatUser:Object(m.Cb)(e,n)},lastSyncTime:e.lastSyncTime}},(e,t)=>Object(u.l)(t,["focusMessage"]))(({message:e,searchQuery:t,chatId:a,chat:c,privateChatUser:r,focusMessage:s,lastSyncTime:l})=>{const i=Object(d.E)(e),m=Object(E.a)(Object(d.D)(e,"micro")),u=Object(n.m)(()=>{s({chatId:a,messageId:e.id})},[a,s,e.id]);if(Object(T.a)(),c)return n.a.createElement(fe.a,{className:"ChatMessage chat-item-clickable",ripple:!o.f,onClick:u},n.a.createElement(q.a,{chat:c,user:r,withOnlineStatus:!0,isSavedMessages:r&&r.isSelf,lastSyncTime:l}),n.a.createElement("div",{className:"info"},n.a.createElement("div",{className:"info-row"},n.a.createElement("div",{className:"title"},n.a.createElement("h3",null,Object(G.a)(Object(d.l)(c,r))),c.isVerified&&n.a.createElement(Ke.a,null)),n.a.createElement("div",{className:"message-date"},n.a.createElement(Ze.a,{className:"date"},Object(R.g)(1e3*e.date)))),n.a.createElement("div",{className:"subtitle"},n.a.createElement("div",{className:"message"},function(e,t,a){if(!t)return Object(G.a)(Object(d.M)(e));return n.a.createElement("span",{className:"media-preview"},n.a.createElement("img",{src:t,alt:""}),Object(d.O)(e)&&n.a.createElement("i",{className:"icon-play"}),Object(G.a)(Object(d.M)(e,!0),["emoji","highlight"],{highlight:a}))}(e,m||i,t)))))}));a(253);var _e=Object(n.h)(({searchDate:e,onSelect:t})=>{const a=Object(n.p)(()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:Object(R.a)(t)}]}const t=[],a=new Date,n=a.getFullYear(),c=a.getTime()>new Date(`${n}-${e}`).getTime()?n:n-1;for(let a=0;a<8;a++){const n=new Date(`${c-a}-${e}`);t.push({date:n,text:Object(R.a)(n)})}return t}(e),[e]);return n.a.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},a.map(({date:e,text:a})=>n.a.createElement("div",{onClick:()=>t(e),className:"date-item",key:a},n.a.createElement("i",{className:"icon-calendar"}),n.a.createElement("span",null,a))))}),Xe=a(108),Je=a(127),et=a(10);const tt=(e,t)=>Number(t.isVerified)-Number(e.isVerified),at=Object(K.g)(e=>e(),500,!0);var nt=Object(n.h)(Object(c.h)(e=>{const{byId:t}=e.chats,{byId:a}=e.users,{userIds:n}=e.contactList||{};if(!n)return{chatsById:t,usersById:a};const{currentUserId:c,messages:r,lastSyncTime:s}=e,{fetchingStatus:l,globalResults:o,localResults:i,resultsByType:m}=e.globalSearch,{chats:d,users:u}=o||{},{chats:h,users:b}=i||{},{byChatId:p}=r,{foundIds:g}=m&&m.text||{};return{currentUserId:c,localContactIds:n,localChats:h,localUsers:b,globalChats:d,globalUsers:u,foundIds:g,globalMessagesByChatId:p,chatsById:t,usersById:a,fetchingStatus:l,lastSyncTime:s}},(e,t)=>Object(u.l)(t,["openChat","addRecentlyFoundChatId","searchMessagesGlobal","setGlobalSearchChatId"]))(({searchQuery:e,searchDate:t,dateSearchQuery:a,currentUserId:c,localContactIds:r,localChats:l,localUsers:i,globalChats:m,globalUsers:h,foundIds:b,globalMessagesByChatId:p,chatsById:g,usersById:E,fetchingStatus:v,lastSyncTime:O,onReset:f,onSearchDateSelect:j,openChat:C,addRecentlyFoundChatId:y,searchMessagesGlobal:k,setGlobalSearchChatId:N})=>{const[I,S]=Object(n.r)(!1),[w,P]=Object(n.r)(!1),M=Object(n.m)(({direction:t})=>{O&&t===s.e.Backwards&&at(()=>{k({type:"text",query:e})})},[O,k,e]),F=Object(n.m)(e=>{C({id:e}),e!==c&&y({id:e}),o.f||f()},[c,C,y,f]),L=Object(n.m)(e=>{N({id:e})},[N]),A=Object(n.p)(()=>{if(!e||e.startsWith("@")&&e.length<2)return qe.a;const t=r?r.filter(t=>{const a=E[t];if(!a)return!1;const n=Object(d.Z)(a);return n&&Object(be.a)(n,e)||Object(be.a)(a.username,e)}).map(e=>E[e]):[];return Object(u.o)([...Object(be.a)(Object(et.b)("SavedMessages"),e)?[c]:[],...[...t,...l||[],...i||[]].sort(tt).map(e=>e.id)])},[e,r,l,i,E,c]),D=Object(n.p)(()=>!e||e.length<4||!m||!h?qe.a:Object(u.o)([...m,...h].sort(tt).map(e=>e.id)),[m,h,e]),B=Object(n.p)(()=>(e||t)&&b&&0!==b.length?b.map(e=>{const[t,a]=e.split("_").map(Number);return p&&p[t]&&p[t].byId[a]}).filter(Boolean).sort((e,t)=>t.date-e.date):qe.a,[b,p,e,t]),U=Object(n.m)(()=>{S(!I)},[I]),x=Object(n.m)(()=>{P(!w)},[w]),R=Object(T.a)();const G=v&&!v.chats&&!v.messages&&!A.length&&!D.length&&!B.length;return e||t?n.a.createElement(Oe.a,{className:"LeftSearch custom-scroll",items:B,onLoadMore:M,noFastList:!0},a&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},n.a.createElement(_e,{searchDate:a,onSelect:j})),G&&n.a.createElement(Xe.a,null),!!A.length&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},A.map(e=>n.a.createElement(Je.a,{chatOrUserId:e,onClick:L,clickArg:e}))),!!A.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading"},A.length>3&&n.a.createElement(Ze.a,{onClick:U},I?"Show less":"Show more"),"Contacts and Chats"),A.map((e,t)=>{if(I||!(t>=3))return n.a.createElement(He,{chatId:e,onClick:F})})),!!D.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading"},D.length>3&&n.a.createElement(Ze.a,{onClick:x},w?"Show less":"Show more"),"Global Search"),D.map((e,t)=>{if(w||!(t>=3))return n.a.createElement(He,{chatId:e,withHandle:!0,onClick:F})})),!!B.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading"},R("SearchMessages")),B.map((function(t){const a=Object(d.M)(t),c=g[t.chatId];if(a&&c)return n.a.createElement(Qe,{chatId:t.chatId,message:t,searchQuery:e})})))):n.a.createElement(Ye,{onReset:f})}));const ct=Object(K.g)(e=>e(),500,!0);var rt=Object(n.h)(Object(c.h)(e=>{const{byId:t}=e.chats,{currentUserId:a,messages:{byChatId:n},lastSyncTime:c}=e,{fetchingStatus:r,resultsByType:s}=e.globalSearch,{foundIds:l}=s&&s.text||{};return{currentUserId:a,foundIds:l,globalMessagesByChatId:n,chatsById:t,fetchingStatus:r,lastSyncTime:c}},(e,t)=>Object(u.l)(t,["searchMessagesGlobal"]))(({searchQuery:e,currentUserId:t,dateSearchQuery:a,foundIds:c,globalMessagesByChatId:r,chatsById:l,fetchingStatus:o,lastSyncTime:i,searchMessagesGlobal:m,onSearchDateSelect:u})=>{const h=Object(n.m)(({direction:a})=>{i&&a===s.e.Backwards&&ct(()=>{m({type:"text",query:e,chatId:t})})},[t,i,m,e]),b=Object(n.p)(()=>c&&0!==c.length?c.map(e=>{const[t,a]=e.split("_").map(Number);return r&&r[t]&&r[t].byId[a]}).filter(Boolean).sort((e,t)=>t.date-e.date):qe.a,[c,r]);const p=o&&!o.chats&&!o.messages&&!b.length;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content custom-scroll chat-list",items:b,onLoadMore:h,noFastList:!0},a&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},n.a.createElement(_e,{searchDate:a,onSelect:u})),p&&n.a.createElement(Xe.a,null),!!b.length&&b.map((function(t){const a=Object(d.M)(t),c=l[t.chatId];if(a&&c)return n.a.createElement(Qe,{chatId:t.chatId,message:t,searchQuery:e})}))))}));function st(e){return(t,a)=>{const{byId:n}=t.chats,{byId:c}=t.users,{fetchingStatus:r,resultsByType:s,chatId:l}=t.globalSearch,o="audio"!==e?e:a&&a.isVoice?"voice":"audio",{byChatId:i}=t.messages,{foundIds:m}=s&&s[o]||{};return{isLoading:void 0===m||!!r&&Boolean(r.chats||r.messages),chatsById:n,usersById:c,globalMessagesByChatId:i,foundIds:m,searchChatId:l,lastSyncTime:t.lastSyncTime}}}var lt=a(154),ot=a(109);const it=Object(K.g)(e=>e(),500,!0);var mt=Object(n.h)(Object(c.h)(st("media"),(e,t)=>Object(u.l)(t,["searchMessagesGlobal","openMediaViewer"]))(({searchQuery:e,searchChatId:t,isLoading:a,globalMessagesByChatId:c,foundIds:r,lastSyncTime:o,searchMessagesGlobal:i,openMediaViewer:m})=>{const d=Object(n.m)(({direction:a})=>{o&&a===s.e.Backwards&&it(()=>{i({type:"media",query:e,chatId:t})})},[o,i,e,t]),u=Object(n.p)(()=>r&&c?r.map(e=>{const[t,a]=e.split("_").map(Number);return c[t]&&c[t].byId[a]}).filter(Boolean):qe.a,[c,r]),h=Object(n.m)((e,t)=>{m({chatId:t,messageId:e,origin:s.h.SearchResult})},[m]);const b=Object(ot.a)([e],l.db)&&!a,p=b&&r&&r.length>0&&!e,g=b&&r&&r.length>0&&e,E=Object(le.a)("search-content custom-scroll",g&&"chat-list");return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:E,items:u,itemSelector:e?".ListItem":".Media",onLoadMore:d,noFastList:!0},!b&&n.a.createElement(ge.a,null),b&&(!r||0===r.length)&&n.a.createElement(Xe.a,null),p&&n.a.createElement("div",{className:"media-list"},u.map(e=>n.a.createElement(lt.a,{key:e.id,idPrefix:"search-media",message:e,onClick:h}))),g&&u.map(e=>n.a.createElement(Qe,{key:e.id,chatId:e.chatId,message:e}))))}));function dt(e,t,a){const{senderId:n}=e;if(!n)return;const c=Object(d.lb)(n)?a[n]:t[n];let r=Object(d.U)(c);const s=t[e.chatId];return s&&(Object(d.lb)(n)&&c.isSelf?r="You → "+Object(d.l)(s):Object(d.kb)(s)&&(r+=" → "+Object(d.l)(s))),r}var ut=a(173);const ht=Object(K.g)(e=>e(),500,!0);var bt=Object(n.h)(Object(c.h)(st("links"),(e,t)=>Object(u.l)(t,["searchMessagesGlobal","focusMessage"]))(({searchQuery:e,searchChatId:t,isLoading:a,chatsById:c,usersById:r,globalMessagesByChatId:o,foundIds:i,lastSyncTime:m,searchMessagesGlobal:d,focusMessage:u})=>{const h=Object(n.m)(({direction:a})=>{m&&a===s.e.Backwards&&ht(()=>{d({type:"links",query:e,chatId:t})})},[m,d,e,t]),b=Object(n.p)(()=>i&&o?i.map(e=>{const[t,a]=e.split("_").map(Number);return o[t]&&o[t].byId[a]}).filter(Boolean):qe.a,[o,i]),p=Object(n.m)((e,t)=>{u({chatId:t,messageId:e})},[u]);const g=Object(ot.a)([e],l.db)&&!a;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:b,onLoadMore:h,noFastList:!0},!g&&n.a.createElement(ge.a,null),g&&(!i||0===i.length)&&n.a.createElement(Xe.a,null),g&&i&&i.length>0&&b.map((e,t)=>{const a=0===t||Object(R.n)(e.date)!==Object(R.n)(b[t-1].date);return n.a.createElement("div",{className:"ListItem",key:e.id},a&&n.a.createElement("p",{className:"section-heading"},Object(R.f)(new Date(1e3*e.date))),n.a.createElement(ut.a,{key:e.id,message:e,senderTitle:dt(e,c,r),onMessageClick:p}))})))})),pt=a(151);const gt=Object(K.g)(e=>e(),500,!0);var Et=Object(n.h)(Object(c.h)(st("documents"),(e,t)=>Object(u.l)(t,["searchMessagesGlobal","focusMessage"]))(({searchQuery:e,searchChatId:t,isLoading:a,chatsById:c,usersById:r,globalMessagesByChatId:o,foundIds:i,lastSyncTime:m,searchMessagesGlobal:u,focusMessage:h})=>{const b=Object(n.m)(({direction:a})=>{m&&a===s.e.Backwards&>(()=>{u({type:"documents",query:e,chatId:t})})},[m,u,e,t]),p=Object(n.p)(()=>i&&o?i.map(e=>{const[t,a]=e.split("_").map(Number),n=o[t]&&o[t].byId[a];return n&&Object(d.y)(n)?n:void 0}).filter(Boolean):qe.a,[o,i]),g=Object(n.m)((e,t)=>{h({chatId:t,messageId:e})},[h]);const E=Object(ot.a)([e],l.db)&&!a;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:p,onLoadMore:b,noFastList:!0},!E&&n.a.createElement(ge.a,null),E&&(!i||0===i.length)&&n.a.createElement(Xe.a,null),E&&i&&i.length>0&&p.map((e,t)=>{const a=0===t||Object(R.n)(e.date)!==Object(R.n)(p[t-1].date);return n.a.createElement("div",{className:"ListItem",key:e.id},a&&n.a.createElement("p",{className:"section-heading"},Object(R.f)(new Date(1e3*e.date))),n.a.createElement(pt.a,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:dt(e,c,r),className:"scroll-item",onDateClick:g}))})))})),vt=a(156);const Ot=Object(K.g)(e=>e(),500,!0);var ft=Object(n.h)(Object(c.h)(st("audio"),(e,t)=>Object(u.l)(t,["searchMessagesGlobal","focusMessage","openAudioPlayer"]))(({isVoice:e,searchQuery:t,searchChatId:a,isLoading:c,chatsById:r,usersById:o,globalMessagesByChatId:i,foundIds:m,lastSyncTime:d,searchMessagesGlobal:u,focusMessage:h,openAudioPlayer:b})=>{const p=e?"voice":"audio",g=Object(n.m)(({direction:e})=>{d&&e===s.e.Backwards&&Ot(()=>{u({type:p,query:t,chatId:a})})},[p,d,u,t,a]),E=Object(n.p)(()=>m&&i?m.map(e=>{const[t,a]=e.split("_").map(Number);return i[t]&&i[t].byId[a]}).filter(Boolean):qe.a,[i,m]),v=Object(n.m)((e,t)=>{h({chatId:t,messageId:e})},[h]),O=Object(n.m)((e,t)=>{b({chatId:t,messageId:e})},[b]);const f=Object(ot.a)([t],l.db)&&!c;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:E,onLoadMore:g,noFastList:!0},!f&&n.a.createElement(ge.a,null),f&&(!m||0===m.length)&&n.a.createElement(Xe.a,null),f&&m&&m.length>0&&E.map((e,t)=>{const a=0===t||Object(R.n)(e.date)!==Object(R.n)(E[t-1].date);return n.a.createElement("div",{className:"ListItem",key:e.id},a&&n.a.createElement("p",{className:"section-heading"},Object(R.f)(new Date(1e3*e.date))),n.a.createElement(vt.a,{key:e.id,message:e,renderingFor:"searchResult",senderTitle:dt(e,r,o),date:e.date,lastSyncTime:d,className:"scroll-item",onPlay:O,onDateClick:v}))})))}));a(254);const jt=[{type:s.c.ChatList,title:"SearchAllChatsShort"},{type:s.c.Media,title:"SharedMediaTab2"},{type:s.c.Links,title:"SharedLinksTab2"},{type:s.c.Files,title:"SharedFilesTab2"},{type:s.c.Music,title:"SharedMusicTab2"},{type:s.c.Voice,title:"SharedVoiceTab2"}],Ct=[{type:s.c.ChatList,title:"All Messages"},...jt.slice(1)],yt=Object.keys(s.c).length/2;var kt=Object(n.h)(Object(c.h)(e=>{const{currentContent:t,chatId:a}=e.globalSearch;return{currentContent:t,chatId:a}},(e,t)=>Object(u.l)(t,["setGlobalSearchContent","setGlobalSearchDate"]))(({searchQuery:e,searchDate:t,currentContent:a=s.c.ChatList,chatId:c,setGlobalSearchContent:r,setGlobalSearchDate:l,onReset:o})=>{const[i,m]=Object(n.r)(0),d=Object(n.p)(()=>Object(R.l)(e),[e]),u=Object(n.m)(e=>{const t=jt[e];r({content:t.type}),m(e)},[r]),h=Object(n.m)(e=>{l({date:e.getTime()/1e3})},[l]);return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Ge.a,{activeTab:i,tabs:c?Ct:jt,onSwitchTab:u}),n.a.createElement(U.a,{name:"slide",renderCount:yt,activeKey:a},()=>{switch(a){case s.c.ChatList:return c?n.a.createElement(rt,{searchQuery:e,dateSearchQuery:d,onReset:o,onSearchDateSelect:h}):n.a.createElement(nt,{searchQuery:e,searchDate:t,dateSearchQuery:d,onReset:o,onSearchDateSelect:h});case s.c.Media:return n.a.createElement(mt,{searchQuery:e});case s.c.Links:return n.a.createElement(bt,{searchQuery:e});case s.c.Files:return n.a.createElement(Et,{searchQuery:e});case s.c.Music:return n.a.createElement(ft,{key:"audio",searchQuery:e});case s.c.Voice:return n.a.createElement(ft,{key:"voice",isVoice:!0,searchQuery:e});default:return}}))}));function Nt(e,t){const a=Object(n.q)(e),[c,r]=Object(n.r)(t);return[c,Object(n.m)(e=>{r(t=>a.current(t,e))},[])]}const It=[{icon:"user",title:"FilterContacts",key:"contacts"},{icon:"non-contacts",title:"FilterNonContacts",key:"nonContacts"},{icon:"group",title:"FilterGroups",key:"groups"},{icon:"channel",title:"FilterChannels",key:"channels"},{icon:"bots",title:"FilterBots",key:"bots"}],St=[{icon:"mute",title:"FilterMuted",key:"excludeMuted"},{icon:"archive",title:"FilterArchived",key:"excludeArchived"},{icon:"readchats",title:"FilterRead",key:"excludeRead"}],wt=["includedChatIds","bots","channels","groups","contacts","nonContacts"],Pt=["excludedChatIds","excludeArchived","excludeMuted","excludeRead"];function Mt(e,t,a){let n=[],c=[];if("included"===t){const{includedChatIds:t,...r}=a?e.includeFilters||{}:Object(u.l)(e.folder,wt);n=t||[],c=Object.keys(r).filter(e=>Boolean(r[e]))}else{const{excludedChatIds:t,...r}=a?e.excludeFilters||{}:Object(u.l)(e.folder,Pt);n=t||[],c=Object.keys(r).filter(e=>Boolean(r[e]))}return{selectedChatIds:n,selectedChatTypes:c}}function Ft(e){if(e){const{includedChatIds:t,...a}=e;if(Object.values(a).filter(Boolean).length>1||t&&t.length)return"";if(a.bots)return"Bots";if(a.groups)return"Groups";if(a.channels)return"Channels";if(a.contacts)return"Contacts";if(a.nonContacts)return"Non-Contacts"}return""}const Lt={mode:"create",chatFilter:"",folder:{title:"",includedChatIds:[],excludedChatIds:[]}},At=(e,t)=>{switch(t.type){case"setTitle":return{...e,folder:{...e.folder,title:t.payload},isTouched:!0};case"editIncludeFilters":return{...e,includeFilters:Object(u.l)(e.folder,wt)};case"editExcludeFilters":return{...e,excludeFilters:Object(u.l)(e.folder,Pt)};case"setIncludeFilters":return{...e,includeFilters:t.payload,chatFilter:""};case"setExcludeFilters":return{...e,excludeFilters:t.payload,chatFilter:""};case"saveFilters":return e.includeFilters?{...e,folder:{...Object(u.j)(e.folder,wt),title:e.folder.title?e.folder.title:Ft(e.includeFilters),...e.includeFilters},includeFilters:void 0,chatFilter:"",isTouched:!0}:e.excludeFilters?{...e,folder:{...Object(u.j)(e.folder,Pt),...e.excludeFilters},excludeFilters:void 0,chatFilter:"",isTouched:!0}:e;case"editFolder":{const{id:e,description:a,...n}=t.payload;return{mode:"edit",folderId:e,folder:n,chatFilter:""}}case"setChatFilter":return{...e,chatFilter:t.payload};case"setIsLoading":return{...e,isLoading:t.payload};case"setError":return{...e,error:t.payload};case"reset":return Lt;default:return e}};const Tt={currentPassword:"",password:"",hint:"",email:""},Dt=(e,t)=>{switch(t.type){case"setCurrentPassword":return{...e,currentPassword:t.payload};case"setPassword":return{...e,password:t.payload};case"setHint":return{...e,hint:t.payload};case"setEmail":return{...e,email:t.payload};case"reset":return Tt;default:return e}};var Bt=a(107);var Ut=Object(n.h)(Object(c.h)(void 0,(e,t)=>Object(u.l)(t,["signOut","deleteChatFolder"]))(({currentScreen:e,editedFolderId:t,onReset:a,onSaveFilter:c,signOut:r,deleteChatFolder:l})=>{const[i,m]=Object(n.r)(!1),[d,u]=Object(n.r)(!1),h=Object(n.m)(()=>{m(!0)},[]),b=Object(n.m)(()=>{m(!1)},[]),p=Object(n.m)(()=>{u(!0)},[]),g=Object(n.m)(()=>{u(!1)},[]),E=Object(n.m)(()=>{b(),r()},[b,r]),v=Object(n.m)(()=>{g(),l({id:t}),a()},[t,g,l,a]),O=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(x.a,{round:!0,ripple:!o.f,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},n.a.createElement("i",{className:"icon-more"})),[]),f=Object(T.a)();return n.a.createElement("div",{className:"left-header"},n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",onClick:a,ariaLabel:f("AccDescrGoBack")},n.a.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){case s.m.EditProfile:return n.a.createElement("h3",null,f("EditProfile"));case s.m.General:return n.a.createElement("h3",null,f("General"));case s.m.Notifications:return n.a.createElement("h3",null,f("Notifications"));case s.m.Privacy:return n.a.createElement("h3",null,f("PrivacySettings"));case s.m.Language:return n.a.createElement("h3",null,f("Language"));case s.m.GeneralChatBackground:return n.a.createElement("h3",null,f("ChatBackground"));case s.m.GeneralChatBackgroundColor:return n.a.createElement("h3",null,f("SetColor"));case s.m.PrivacyPhoneNumber:return n.a.createElement("h3",null,f("PrivacyPhone"));case s.m.PrivacyLastSeen:return n.a.createElement("h3",null,f("PrivacyLastSeen"));case s.m.PrivacyProfilePhoto:return n.a.createElement("h3",null,f("Privacy.ProfilePhoto"));case s.m.PrivacyForwarding:return n.a.createElement("h3",null,f("PrivacyForwards"));case s.m.PrivacyGroupChats:return n.a.createElement("h3",null,f("AutodownloadGroupChats"));case s.m.PrivacyPhoneNumberAllowedContacts:case s.m.PrivacyLastSeenAllowedContacts:case s.m.PrivacyProfilePhotoAllowedContacts:case s.m.PrivacyForwardingAllowedContacts:case s.m.PrivacyGroupChatsAllowedContacts:return n.a.createElement("h3",null,f("AlwaysShareWith"));case s.m.PrivacyPhoneNumberDeniedContacts:case s.m.PrivacyLastSeenDeniedContacts:case s.m.PrivacyProfilePhotoDeniedContacts:case s.m.PrivacyForwardingDeniedContacts:case s.m.PrivacyGroupChatsDeniedContacts:return n.a.createElement("h3",null,f("NeverShareWith"));case s.m.PrivacyActiveSessions:return n.a.createElement("h3",null,f("SessionsTitle"));case s.m.PrivacyBlockedUsers:return n.a.createElement("h3",null,f("BlockedUsers"));case s.m.TwoFaDisabled:case s.m.TwoFaEnabled:return n.a.createElement("h3",null,f("TwoStepVerification"));case s.m.TwoFaNewPassword:case s.m.TwoFaChangePasswordNew:case s.m.TwoFaChangePasswordConfirm:return n.a.createElement("h3",null,f("EnterPassword"));case s.m.TwoFaNewPasswordConfirm:return n.a.createElement("h3",null,f("PleaseReEnterPassword"));case s.m.TwoFaNewPasswordHint:case s.m.TwoFaChangePasswordHint:return n.a.createElement("h3",null,f("PasswordHint"));case s.m.TwoFaNewPasswordEmail:case s.m.TwoFaRecoveryEmail:return n.a.createElement("h3",null,f("RecoveryEmailTitle"));case s.m.TwoFaNewPasswordEmailCode:case s.m.TwoFaRecoveryEmailCode:return n.a.createElement("h3",null,"Recovery Email Code");case s.m.TwoFaCongratulations:return n.a.createElement("h3",null,f("TwoStepVerificationPasswordSet"));case s.m.TwoFaChangePasswordCurrent:case s.m.TwoFaTurnOff:case s.m.TwoFaRecoveryEmailCurrentPassword:return n.a.createElement("h3",null,f("PleaseEnterCurrentPassword"));case s.m.Folders:return n.a.createElement("h3",null,f("Filters"));case s.m.FoldersCreateFolder:return n.a.createElement("h3",null,f("FilterNew"));case s.m.FoldersEditFolder:return n.a.createElement("div",{className:"settings-main-header"},n.a.createElement("h3",null,f("FilterEdit")),t&&n.a.createElement(H.a,{className:"settings-more-menu",trigger:O,positionX:"right"},n.a.createElement(V.a,{icon:"delete",destructive:!0,onClick:p},"Delete Folder")));case s.m.FoldersIncludedChats:case s.m.FoldersExcludedChats:return n.a.createElement("div",{className:"settings-main-header"},e===s.m.FoldersIncludedChats?n.a.createElement("h3",null,f("FilterInclude")):n.a.createElement("h3",null,f("FilterExclude")),n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:c,ariaLabel:f("AutoDeleteConfirm")},n.a.createElement("i",{className:"icon-check"})));default:return n.a.createElement("div",{className:"settings-main-header"},n.a.createElement("h3",null,f("SETTINGS")),n.a.createElement(H.a,{className:"settings-more-menu",trigger:O,positionX:"right"},n.a.createElement(V.a,{icon:"logout",onClick:h},f("LogOutTitle"))))}}(),n.a.createElement(Bt.a,{isOpen:i,onClose:b,text:"Are you sure you want to log out?",confirmLabel:"Log Out",confirmHandler:E,confirmIsDestructive:!0}),n.a.createElement(Bt.a,{isOpen:d,onClose:g,text:"Are you sure you want to delete this folder?",confirmLabel:"Delete",confirmHandler:v,confirmIsDestructive:!0}))})),xt=a(19);var Rt=Object(n.h)(Object(c.h)(e=>{const{currentUserId:t}=e;return{currentUser:t?Object(m.Cb)(e,t):void 0}})(({onScreenSelect:e,currentUser:t})=>{const a=Object(T.a)();return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-main-menu"},t&&n.a.createElement("div",{className:"settings-current-user"},n.a.createElement(q.a,{user:t,size:"jumbo"}),n.a.createElement("p",{className:"name"},Object(d.Z)(t)),n.a.createElement("p",{className:"phone"},Object(xt.c)(t.phoneNumber))),n.a.createElement(fe.a,{icon:"edit",onClick:()=>e(s.m.EditProfile)},a("EditProfile")),n.a.createElement(fe.a,{icon:"folder",onClick:()=>e(s.m.Folders)},a("Filters")),n.a.createElement(fe.a,{icon:"settings",onClick:()=>e(s.m.General)},a("GeneralSettings")),n.a.createElement(fe.a,{icon:"unmute",onClick:()=>e(s.m.Notifications)},a("Notifications")),n.a.createElement(fe.a,{icon:"lock",onClick:()=>e(s.m.Privacy)},a("PrivacySettings")),n.a.createElement(fe.a,{icon:"language",onClick:()=>e(s.m.Language)},a("Language"))))})),Gt=a(120);a(255);var qt=({isShown:e,className:t,color:a="primary",ariaLabel:c,disabled:r,onClick:s,children:l})=>{const o=Object(le.a)("FloatingActionButton",e&&"revealed",t);return n.a.createElement(x.a,{className:o,color:a,round:!0,disabled:r,onClick:e&&!r?s:void 0,ariaLabel:c,tabIndex:-1},l)};const zt=/https:\/\/t\.me\/?/i,$t=/^([a-zA-Z0-9_]+)$/,Ht=Object(K.a)(e=>e(),250,!1);var Vt=Object(n.h)(({currentUsername:e,asLink:t,isLoading:a,isUsernameAvailable:c,checkUsername:r,onChange:s})=>{const[l,o]=Object(n.r)(e||""),i=Object(T.a)(),m=t?"SetUrl":"Username",d=i(t?"SetUrlPlaceholder":"Username"),[u,h]=Object(n.p)(()=>l.length?l.length<5?[void 0,d+" is too short"]:l.length>32?[void 0,d+" is too long"]:$t.test(l)?void 0===c?[]:[c?i(m+"Available","Username"):void 0,!1===c?i(m+"InUse"):void 0]:[void 0,d+" contains invalid characters"]:[],[l,c,i,m,d]);Object(n.n)(()=>{o(e||"")},[t,e]);const b=Object(n.m)(e=>{const a=e.target.value.trim().replace(zt,"");o(a),e.target.value=`${t?"https://t.me/":""}${a}`;const n=function(e){return e.length>=5&&e.length<=32&&$t.test(e)}(a);n&&Ht(()=>{r({username:a})}),s&&s(!!n&&a)},[t,r,s]);return n.a.createElement(ve.a,{value:`${t?"https://t.me/":""}${l}`,onChange:b,label:d,error:h,success:u,readOnly:a})});const Wt=Object(K.g)(e=>e(),6e4,!0);var Yt=Object(n.h)(Object(c.h)(e=>{const{currentUserId:t}=e,{progress:a,isUsernameAvailable:n}=e.profileEdit||{},c=t?Object(m.Cb)(e,t):void 0;if(!c)return{progress:a,isUsernameAvailable:n};const{firstName:r,lastName:s,username:l,fullInfo:o}=c,{bio:i}=o||{};return{currentAvatarHash:Object(d.f)(c),currentFirstName:r,currentLastName:s,currentBio:i,currentUsername:l,progress:a,isUsernameAvailable:n}},(e,t)=>Object(u.l)(t,["loadCurrentUser","updateProfile","checkUsername"]))(({currentAvatarHash:e,currentFirstName:t,currentLastName:a,currentBio:c,currentUsername:l,progress:o,isUsernameAvailable:i,loadCurrentUser:m,updateProfile:d,checkUsername:u})=>{const[h,b]=Object(n.r)(!1),[p,g]=Object(n.r)(!1),[v,O]=Object(n.r)(),[f,j]=Object(n.r)(),[C,y]=Object(n.r)(t||""),[k,N]=Object(n.r)(a||""),[I,S]=Object(n.r)(c||""),[w,P]=Object(n.r)(l||""),M=Object(E.a)(e,!1,r.ApiMediaFormat.BlobUrl),F=o===s.j.InProgress,L=!1===w,A=Object(n.p)(()=>!L&&(Boolean(f)||p||!0===i),[f,p,L,i]);Object(n.n)(()=>{Wt(()=>{m()})},[m]),Object(n.n)(()=>{j(void 0)},[M]),Object(n.n)(()=>{y(t||""),N(a||""),S(c||"")},[t,a,c]),Object(n.n)(()=>{P(l||"")},[l]),Object(n.n)(()=>{o===s.j.Complete&&(g(!1),b(!1),O(void 0))},[o]);const B=Object(n.m)(e=>{j(e)},[]),U=Object(n.m)(e=>{y(e.target.value),g(!0)},[]),x=Object(n.m)(e=>{N(e.target.value),g(!0)},[]),R=Object(n.m)(e=>{S(e.target.value),g(!0)},[]),q=Object(n.m)(e=>{P(e),b(!0)},[]),z=Object(n.m)(()=>{const e=C.trim(),t=k.trim(),a=I.trim();e.length?a.length>70?O("Bio can' be longer than 70 characters"):d({photo:f,...p&&{firstName:e,lastName:t,bio:a},...h&&{username:w}}):O("Please provide your first name")},[f,C,k,I,p,w,h,d]),$=Object(T.a)();return n.a.createElement("div",{className:"settings-fab-wrapper"},n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-edit-profile"},n.a.createElement(Gt.a,{currentAvatarBlobUrl:M,onChange:B,title:"Edit your profile photo",disabled:F}),n.a.createElement(ve.a,{value:C,onChange:U,label:$("FirstName"),disabled:F,error:"Please provide your first name"===v?v:void 0}),n.a.createElement(ve.a,{value:k,onChange:x,label:$("LastName"),disabled:F}),n.a.createElement(ve.a,{value:I,onChange:R,label:$("UserBio"),disabled:F,error:"Bio can' be longer than 70 characters"===v?v:void 0}),n.a.createElement("p",{className:"settings-item-description"},Object(G.a)($("BioAbout"),["br","simple_markdown"]))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},$("Username")),n.a.createElement(Vt,{currentUsername:w||"",isLoading:F,isUsernameAvailable:i,checkUsername:u,onChange:q}),n.a.createElement("p",{className:"settings-item-description"},Object(G.a)($("UsernameHelp"),["br","simple_markdown"])),w&&n.a.createElement("p",{className:"settings-item-description"},"This link opens a chat with you:",n.a.createElement("br",null),n.a.createElement("span",{className:"username-link"},"https://t.me/",w)))),n.a.createElement(qt,{isShown:A,onClick:z,disabled:F,ariaLabel:"Save changes"},F?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))})),Kt=a(116),Zt=a(106);const Qt=Object(K.g)(e=>e(),6e4,!0);var _t=Object(n.h)(Object(c.h)(e=>{const{chats:{byId:t},users:{byId:a}}=e,{orderedIds:n,byId:c,recommended:r}=e.chatFolders;return{chatsById:t,usersById:a,orderedFolderIds:n,foldersById:c,recommendedChatFolders:r}},(e,t)=>Object(u.l)(t,["loadRecommendedChatFolders","addChatFolder","showError"]))(({onCreateFolder:e,onEditFolder:t,chatsById:a,usersById:c,orderedFolderIds:r,foldersById:s,recommendedChatFolders:o,loadRecommendedChatFolders:i,addChatFolder:m,showError:u})=>{const[h,b]=Object(n.r)(),[p,g]=Object(n.r)(!1),E=Object(n.m)(()=>g(!0),[]);Object(n.n)(()=>{h||Object(Kt.a)("FoldersAll").then(b)},[h]),Object(n.n)(()=>{Qt(()=>{i()})},[i]);const v=Object(n.m)(()=>{Object.keys(s).length>=10?u({error:{message:"DIALOG_FILTERS_TOO_MUCH"}}):e()},[s,u,e]),O=Object(T.a)(),f=Object(n.p)(()=>{if(!r)return;const e=Object.keys(a).map(Number);return r.map(t=>{const n=s[t];return{id:n.id,title:n.title,subtitle:Object(d.o)(a,c,n,e,O)}})},[r,a,s,c,O]),j=Object(n.m)(e=>{Object.keys(s).length>=10?u({error:{message:"DIALOG_FILTERS_TOO_MUCH"}}):m({folder:e})},[s,m,u]);return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement("div",{className:"settings-content-icon"},h&&n.a.createElement(Zt.a,{id:"settingsFoldersMain",size:l.hb,animationData:h,play:p,noLoop:!0,onLoad:E})),n.a.createElement("p",{className:"settings-item-description mb-3"},O("CreateNewFilterInfo")),n.a.createElement(x.a,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:v},n.a.createElement("i",{className:"icon-add"}),O("CreateNewFilter"))),n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3"},O("Filters")),f&&f.length?f.map(e=>n.a.createElement(fe.a,{className:"mb-2",narrow:!0,onClick:()=>t(s[e.id])},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},e.title),n.a.createElement("span",{className:"subtitle"},e.subtitle)))):f&&!f.length?n.a.createElement("p",{className:"settings-item-description my-4"},"You have no folders yet."):n.a.createElement(ge.a,null)),o&&!!o.length&&n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3"},O("FilterRecommended")),o.map(e=>n.a.createElement(fe.a,{className:"mb-2",narrow:!0,onClick:()=>j(e)},n.a.createElement("div",{className:"settings-folders-recommended-item"},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},e.title),n.a.createElement("span",{className:"subtitle"},e.description)),n.a.createElement(x.a,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0},O("Add")))))))}));a(256);var Xt=({count:e,itemName:t,itemPluralName:a,isLoading:c,onClick:r})=>n.a.createElement(x.a,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:c,onClick:r},n.a.createElement("i",{className:"icon-down"}),"Show ",e," more ",e>1?a||t+"s":t);const Jt="Please provide a title for this folder.",ea="Please select at least one chat for this folder.";var ta=Object(n.h)(Object(c.h)(e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}},(e,t)=>Object(u.l)(t,["editChatFolder","addChatFolder","loadMoreChats"]))(({state:e,dispatch:t,onAddIncludedChats:a,onAddExcludedChats:c,onReset:r,loadedActiveChatIds:s,loadedArchivedChatIds:o,editChatFolder:i,addChatFolder:m,loadMoreChats:h})=>{const[b,p]=Object(n.r)(),[g,E]=Object(n.r)(!1),v=Object(n.m)(()=>E(!0),[]),[O,f]=Object(n.r)(!1),[j,C]=Object(n.r)(!1),{selectedChatIds:y,selectedChatTypes:k}=Mt(e,"included"),{selectedChatIds:N,selectedChatTypes:I}=Mt(e,"excluded");Object(n.n)(()=>{b||Object(Kt.a)("FoldersNew").then(p)},[b]),Object(n.n)(()=>{f(!1),C(!1)},[e.folderId]);const[S,w]=Object(n.p)(()=>{const e=new Set([...s||[],...o||[]]),t=Object(u.f)(y,e),a=Object(u.f)(N,e);return[O?t:t.slice(0,5-k.length),j?a:a.slice(0,5-I.length)]},[N,y,k,I,j,O,s,o]);Object(n.n)(()=>{(S.length<y.length||w.length<N.length)&&h({listType:"active"})},[h,N.length,y.length,w.length,S.length]);const P=Object(T.a)();function M(e){const t="included"===e?k:I,a="included"===e?S:w,c="included"===e?O:j,r=("included"===e?y:N).length-t.length-a.length,s="included"===e?()=>f(!0):()=>C(!0);return n.a.createElement(n.a.Fragment,null,t.map(t=>function(e,t){const a="included"===t?It.find(({key:t})=>t===e):St.find(({key:t})=>t===e);if(a)return n.a.createElement(fe.a,{key:a.key,className:"settings-folders-list-item mb-1",icon:a.icon,narrow:!0,inactive:!0},P(a.title))}(t,e)),a.map(e=>n.a.createElement(fe.a,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},Object(d.lb)(e)?n.a.createElement(je.a,{avatarSize:"small",userId:e}):n.a.createElement(Ce.a,{avatarSize:"small",chatId:e}))),!c&&r>0&&n.a.createElement(Xt,{count:r,itemName:"chat",onClick:s}))}return n.a.createElement("div",{className:"settings-fab-wrapper"},n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement("div",{className:"settings-content-icon"},b&&n.a.createElement(Zt.a,{id:"settingsFoldersEdit",size:l.hb,animationData:b,play:g&&String(e.folderId),noLoop:!0,onLoad:v})),"create"===e.mode&&n.a.createElement("p",{className:"settings-item-description mb-3"},P("FilterIncludeInfo")),n.a.createElement(ve.a,{className:"mb-0",label:P("FilterNameHint"),value:e.folder.title,onChange:function(e){const{currentTarget:a}=e;t({type:"setTitle",payload:a.value.trim()})},error:e.error&&e.error===Jt?Jt:void 0})),n.a.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===ea&&n.a.createElement("p",{className:"settings-item-description color-danger mb-2"},e.error),n.a.createElement("h4",{className:"settings-item-header mb-3"},P("FilterInclude")),n.a.createElement(fe.a,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:a},P("FilterAddChats")),M("included")),n.a.createElement("div",{className:"settings-item no-border pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3"},P("FilterExclude")),n.a.createElement(fe.a,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:c},P("FilterAddChats")),M("excluded"))),n.a.createElement(qt,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:a}=e.folder;a?y.length||Object.keys(k).length?(t({type:"setIsLoading",payload:!0}),"edit"===e.mode?i({id:e.folderId,folderUpdate:e.folder}):m({folder:e.folder}),setTimeout(()=>{r()},500)):t({type:"setError",payload:ea}):t({type:"setError",payload:Jt})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))})),aa=a(40);a(174),a(257);var na=Object(n.h)(({mode:e,chatIds:t,selectedIds:a,selectedChatTypes:c,filterValue:r,onSelectedIdsChange:s,onSelectedChatTypesChange:l,onFilterChange:o,onLoadMore:i})=>{const m=Object(n.q)(null),u="included"===e?It:St,h=a.length+c.length>10,b=a.length>=100;Object(n.n)(()=>{setTimeout(()=>{requestAnimationFrame(()=>{m.current.focus()})},500)},[]);const p=Object(n.m)(e=>{const t=[...a];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),s(t)},[a,s]),g=Object(n.m)(e=>{const t=[...c];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),l(t)},[c,l]),E=Object(n.m)(e=>{const{value:t}=e.currentTarget;o(t)},[o]),v=Object(T.a)();const[O,f]=Object(pe.a)(i,t,Boolean(r));return n.a.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},n.a.createElement("div",{className:"picker-header custom-scroll"},c.map((function(e){const t=u.find(({key:t})=>e===t);if(t)return n.a.createElement(Je.a,{icon:t.icon,title:v(t.title),isMinimized:h,canClose:!0,onClick:g,clickArg:t.key})})),a.map((e,t)=>n.a.createElement(Je.a,{chatOrUserId:e,isMinimized:h&&t<a.length-5,canClose:!0,onClick:p,clickArg:e})),b?n.a.createElement("p",{className:"max-items-reached"},"Sorry, you can't add more than 100 chats."):n.a.createElement(ve.a,{ref:m,value:r,onChange:E,placeholder:v("Search")})),n.a.createElement(Oe.a,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:O,onLoadMore:f},(!O||!O.length||O.includes(t[0]))&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h4",{key:"header1",className:"settings-item-header"},v("FilterChatTypes")),u.map((function(e){return n.a.createElement(fe.a,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>g(e.key),ripple:!0},n.a.createElement("i",{className:"icon-"+e.icon}),n.a.createElement("h3",{className:"chat-type"},v(e.title)),n.a.createElement(aa.a,{label:"",checked:c.includes(e.key),round:!0}))})),n.a.createElement("div",{key:"divider",className:"picker-list-divider"}),n.a.createElement("h4",{key:"header2",className:"settings-item-header"},v("FilterChats"))),O&&O.length?O.map((function(e){const t=a.includes(e);return n.a.createElement(fe.a,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>p(e),ripple:!0,disabled:!t&&b},Object(d.lb)(e)?n.a.createElement(je.a,{userId:e}):n.a.createElement(Ce.a,{chatId:e,withChatType:!0}),n.a.createElement(aa.a,{label:"",checked:t,round:!0}))})):O&&!O.length?n.a.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):n.a.createElement(ge.a,{key:"loading"})))});var ca=Object(n.h)(Object(c.h)(e=>{const{chats:{byId:t,listIds:a,orderedPinnedIds:n}}=e;return{chatsById:t,listIds:a.active,orderedPinnedIds:n.active,archivedPinnedIds:n.archived,archivedListIds:a.archived}},(e,t)=>Object(u.l)(t,["loadMoreChats"]))(({mode:e,state:t,dispatch:a,chatsById:c,listIds:r,orderedPinnedIds:s,archivedListIds:l,archivedPinnedIds:o,loadMoreChats:i})=>{const{chatFilter:m}=t,{selectedChatIds:u,selectedChatTypes:h}=Mt(t,e,!0),b=Object(n.p)(()=>{const e=r?Object(d.Ab)(c,r,s,"all"):void 0,t=l?Object(d.Ab)(c,l,o,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]},[c,r,s,l,o]),p=Object(n.p)(()=>{if(b)return b.filter(e=>!m||Object(be.a)(Object(d.l)(e),m)||u.includes(e.id)).map(({id:e})=>e)},[b,m,u]),g=Object(n.m)(e=>{a({type:"setChatFilter",payload:e})},[a]),E=Object(n.m)(n=>{a("included"===e?{type:"setIncludeFilters",payload:{...t.includeFilters,includedChatIds:n}}:{type:"setExcludeFilters",payload:{...t.excludeFilters,excludedChatIds:n}})},[e,t,a]),v=Object(n.m)(t=>{const n={};t.forEach(e=>{n[e]=!0}),a("included"===e?{type:"setIncludeFilters",payload:{includedChatIds:u,...n}}:{type:"setExcludeFilters",payload:{excludedChatIds:u,...n}})},[e,u,a]);return p?n.a.createElement(na,{mode:e,chatIds:p,selectedIds:u,selectedChatTypes:h,filterValue:m,onSelectedIdsChange:E,onSelectedChatTypesChange:v,onFilterChange:g,onLoadMore:i}):n.a.createElement(ge.a,null)}));a(258);var ra=Object(n.h)(({currentScreen:e,state:t,dispatch:a,onScreenSelect:c,onReset:r})=>{const l=Object(n.m)(()=>{e!==s.m.FoldersCreateFolder&&e!==s.m.FoldersEditFolder||setTimeout(()=>{a({type:"reset"})},200),e!==s.m.FoldersIncludedChats&&e!==s.m.FoldersExcludedChats?r():"create"===t.mode?c(s.m.FoldersCreateFolder):c(s.m.FoldersEditFolder)},[t.mode,a,e,r,c]),o=Object(n.m)(()=>{a({type:"reset"}),c(s.m.FoldersCreateFolder)},[c,a]),i=Object(n.m)(e=>{a({type:"editFolder",payload:e}),c(s.m.FoldersEditFolder)},[a,c]),m=Object(n.m)(()=>{a({type:"editIncludeFilters"}),c(s.m.FoldersIncludedChats)},[a,c]),d=Object(n.m)(()=>{a({type:"editExcludeFilters"}),c(s.m.FoldersExcludedChats)},[a,c]);switch(e){case s.m.Folders:return n.a.createElement(_t,{onCreateFolder:o,onEditFolder:i});case s.m.FoldersCreateFolder:case s.m.FoldersEditFolder:return n.a.createElement(ta,{state:t,dispatch:a,onAddIncludedChats:m,onAddExcludedChats:d,onReset:l});case s.m.FoldersIncludedChats:return n.a.createElement(ca,{mode:"included",state:t,dispatch:a});case s.m.FoldersExcludedChats:return n.a.createElement(ca,{mode:"excluded",state:t,dispatch:a});default:return}}),sa=a(95);a(259);var la=Object(n.h)(({options:e,range:t,label:a,value:c,disabled:r,onChange:s})=>{const l=Object(n.m)(e=>{s(Number(e.currentTarget.value))},[s]),o=Object(le.a)("RangeSlider",r&&"disabled"),i=Object(n.p)(()=>{if(e)return c/(e.length-1)*100;if(t){const e=(t.max-t.min)/(t.step||1);return(c-t.min)/e*100}return 0},[c,e,t]),[m,d,u]=Object(n.p)(()=>e?[0,e.length-1,1]:t?[t.min,t.max,t.step||1]:[0,0,0],[t,e]);return n.a.createElement("div",{className:o},a&&n.a.createElement("div",{className:"slider-top-row"},n.a.createElement("span",{className:"label"},a),t&&n.a.createElement("span",{className:"value"},c)),n.a.createElement("div",{className:"slider-main"},n.a.createElement("div",{className:"slider-fill-track",style:`width: ${i}%`}),n.a.createElement("input",{min:m,max:d,value:c,step:u,type:"range",onChange:l}),e&&n.a.createElement("div",{className:"slider-options"},e.map((e,t)=>n.a.createElement("div",{className:Object(le.a)("slider-option no-selection",t===c&&"active"),onClick:()=>s(t)},e)))))}),oa=a(117),ia=a(103),ma=a(45);var da=Object(n.h)(({size:e=l.nb,stickerSet:t,observeIntersection:a})=>{const c=Object(n.q)(null),s=Object(sa.b)(c,a),o="stickerSet"+t.id,i=Object(E.a)(o,!s,r.ApiMediaFormat.Lottie),{shouldRenderFullMedia:m,transitionClassNames:d}=Object(ia.a)(i,"slow");return n.a.createElement("div",{ref:c,className:"sticker-set-cover"},!m&&Object(ma.c)(t.title,2),m&&i&&n.a.createElement(Zt.a,{id:o,size:e,animationData:i,className:d}))});var ua=Object(n.h)(({stickerSet:e,observeIntersection:t})=>{const a=Object(n.q)(null),c=Object(sa.b)(a,t),r=Object(E.a)(e.hasThumbnail&&"stickerSet"+e.id,!c),{shouldRenderFullMedia:s,transitionClassNames:l}=Object(ia.a)(r,"slow");return n.a.createElement("div",{ref:a,className:"sticker-set-cover"},!s&&Object(ma.c)(e.title,2),s&&n.a.createElement("img",{src:r,className:l,alt:""}))});a(260);var ha=Object(n.h)(({sticker:e,size:t,observeIntersection:a,noAnimate:c,title:s,className:l,onClick:o,clickArg:i,onUnfaveClick:m})=>{const d=Object(n.q)(null),{isAnimated:u}=e,h="sticker"+e.id,b="sticker-button-"+e.id,p=Object(sa.b)(d,a),g=e.thumbnail?e.thumbnail.dataUri:void 0,v=Object(E.a)(h+"?size=m",!p,r.ApiMediaFormat.BlobUrl),O=p&&!c,f=Object(E.a)(h,!O,r.ApiMediaFormat.Lottie),[j,C,y]=Object(Be.a)(Boolean(f)),k=j&&O,{shouldRenderThumb:N,shouldRenderFullMedia:I,transitionClassNames:S}=Object(ia.a)(v||k,"slow");Object(n.n)(()=>{O||y()},[y,O]);const w=Object(le.a)("StickerButton",u&&"animated",b,l),P=N&&g?`background-image: url('${g}');`:"";return n.a.createElement("div",{ref:d,className:w,title:s||e&&e.emoji,style:P,"data-sticker-id":e.id,onClick:function(){o&&o(i)}},I&&!k&&n.a.createElement("img",{src:v,className:S}),O&&f&&n.a.createElement(Zt.a,{id:h,animationData:f,play:!0,size:t,isLowPriority:!0,onLoad:C}),m&&n.a.createElement(x.a,{className:"sticker-unfave-button",color:"dark",round:!0,onClick:function(t){t.stopPropagation(),t.preventDefault(),m(e)}},n.a.createElement("i",{className:"icon-close"})))});a(261);var ba=Object(n.h)(({stickerSet:e,observeIntersection:t,onClick:a})=>{const c=Object(T.a)();if(!e||!e.stickers)return;const r=e.stickers&&e.stickers[0];return e.hasThumbnail||!r?n.a.createElement(fe.a,{narrow:!0,className:"SettingsStickerSet",inactive:!r,onClick:()=>r&&a(r)},n.a.createElement(x.a,{ariaLabel:e.title,color:"translucent"},e.isAnimated?n.a.createElement(da,{size:l.ib,stickerSet:e,observeIntersection:t}):n.a.createElement(ua,{stickerSet:e,observeIntersection:t})),n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("div",{className:"title"},e.title),n.a.createElement("div",{className:"subtitle"},c("StickerPack.StickerCount",e.count,"i")))):n.a.createElement(fe.a,{narrow:!0,className:"SettingsStickerSet",onClick:()=>a(r)},n.a.createElement(ha,{sticker:r,size:l.ib,title:e.title,observeIntersection:t}),n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("div",{className:"title"},e.title),n.a.createElement("div",{className:"subtitle"},c("StickerPack.StickerCount",e.count,"i"))))}),pa=a(152);const ga=o.k?void 0:[{value:"enter",label:"Send by Enter",subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:`Send by ${o.e?"Cmd":"Ctrl"} + Enter`,subLabel:"New line by Enter"}],Ea=["Solid and Steady","Nice and Fast","Lots of Stuff"];var va=Object(n.h)(Object(c.h)(e=>({...Object(u.l)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldAutoDownloadMediaFromContacts","shouldAutoDownloadMediaInPrivateChats","shouldAutoDownloadMediaInGroups","shouldAutoDownloadMediaInChannels","shouldAutoPlayGifs","shouldAutoPlayVideos","shouldSuggestStickers","shouldLoopStickers"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById}),(e,t)=>Object(u.l)(t,["setSettingOption","loadStickerSets","loadAddedStickers"]))(({onScreenSelect:e,stickerSetIds:t,stickerSetsById:a,messageTextSize:c,animationLevel:r,messageSendKeyCombo:l,shouldAutoDownloadMediaFromContacts:o,shouldAutoDownloadMediaInPrivateChats:i,shouldAutoDownloadMediaInGroups:m,shouldAutoDownloadMediaInChannels:d,shouldAutoPlayGifs:u,shouldAutoPlayVideos:h,shouldSuggestStickers:b,shouldLoopStickers:p,setSettingOption:g,loadStickerSets:E,loadAddedStickers:v})=>{const O=Object(n.q)(null),{observe:f}=Object(sa.a)({rootRef:O}),[j,C,y]=Object(Be.a)(),[k,N]=Object(n.r)();Object(n.n)(()=>{E()},[E]),Object(n.n)(()=>{t&&t.length&&v()},[t,v]);const I=Object(n.m)(e=>{Ea.forEach((t,a)=>{document.body.classList.toggle("animation-level-"+a,e===a)}),g({animationLevel:e})},[g]),S=Object(n.m)(e=>{document.documentElement.style.setProperty("--message-text-size",e+"px"),g({messageTextSize:e})},[g]),w=Object(n.m)(e=>{N(e),C()},[C]),P=Object(T.a)(),M=t&&t.map(e=>!!(a&&a[e]&&a[e].installedDate)&&a[e]).filter(Boolean);return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header"},P("SETTINGS")),n.a.createElement(la,{label:P("TextSize"),range:{min:12,max:20},value:c,onChange:S}),n.a.createElement(fe.a,{icon:"photo",onClick:()=>e(s.m.GeneralChatBackground)},P("ChatBackground"))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},"Animation Level"),n.a.createElement("p",{className:"settings-item-description"},"Choose the desired animations amount."),n.a.createElement(la,{options:Ea,value:r,onChange:I})),ga&&n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},P("Keyboard")),n.a.createElement(oa.a,{name:"keyboard-send-settings",options:ga,onChange:e=>g({messageSendKeyCombo:e}),selected:l})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},P("AutoDownloadMedia")),n.a.createElement(aa.a,{label:P("Contacts"),checked:o,onCheck:e=>g({shouldAutoDownloadMediaFromContacts:e})}),n.a.createElement(aa.a,{label:P("AutodownloadPrivateChats"),checked:i,onCheck:e=>g({shouldAutoDownloadMediaInPrivateChats:e})}),n.a.createElement(aa.a,{label:P("AutodownloadGroupChats"),checked:m,onCheck:e=>g({shouldAutoDownloadMediaInGroups:e})}),n.a.createElement(aa.a,{label:P("FilterChannels"),checked:d,onCheck:e=>g({shouldAutoDownloadMediaInChannels:e})})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},P("AutoplayMedia")),n.a.createElement(aa.a,{label:P("GifsTab2"),checked:u,onCheck:e=>g({shouldAutoPlayGifs:e})}),n.a.createElement(aa.a,{label:P("VideosTitle"),checked:h,onCheck:e=>g({shouldAutoPlayVideos:e})})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},P("AccDescrStickers")),n.a.createElement(aa.a,{label:P("SuggestStickers"),checked:b,onCheck:e=>g({shouldSuggestStickers:e})}),n.a.createElement(aa.a,{label:P("LoopAnimatedStickers"),checked:p,onCheck:e=>g({shouldLoopStickers:e})}),n.a.createElement("div",{className:"mt-4",ref:O},M&&M.map(e=>n.a.createElement(ba,{key:e.id,stickerSet:e,observeIntersection:f,onClick:w}))),k&&n.a.createElement(pa.a,{isOpen:j,fromSticker:k,onClose:y})))}));let Oa;function fa(e="*",t,a=!1){Oa||(Oa=document.createElement("input"),Oa.setAttribute("type","file")),Oa.setAttribute("accept",e),a?Oa.removeAttribute("multiple"):Oa.setAttribute("multiple","multiple"),Oa.onchange=null,Oa.value="",Oa.onchange=t,Oa.click()}var ja=a(13);a(262);var Ca=Object(n.h)(({wallpaper:e,isSelected:t,onClick:a})=>{const{slug:c,document:r}=e,o="wallpaper"+r.id,i=r.previewBlobUrl,m=Object(E.a)(o+"?size=m"),d=Object(j.a)(r.thumbnail&&r.thumbnail.dataUri,Boolean(m),300),{shouldRenderThumb:u,shouldRenderFullMedia:h,transitionClassNames:b}=Object(ia.a)(m||i,"slow"),[p,g]=Object(n.r)(!1),{mediaData:O,downloadProgress:f}=Object(v.a)(o,!p),k=!1===Object(y.a)(p),{shouldRender:N,transitionClassNames:I}=Object(Q.a)(p&&!O||c===s.n,void 0,k,"slow"),S=Object(n.m)(()=>{(async()=>{const e=await Object(C.e)(O);await ja.d(l.l,l.l,e),a(c)})()},[O,a,c]);Object(n.n)(()=>{O&&S()},[O,S]);const w=Object(n.m)(()=>{O?S():g(e=>!e)},[O,S]),P=Object(le.a)("WallpaperTile",t&&"selected");return n.a.createElement("div",{className:P,onClick:w},n.a.createElement("div",{className:"media-inner"},u&&n.a.createElement("img",{src:d,className:"thumbnail",alt:""}),h&&n.a.createElement("img",{src:m||i,className:"full-media "+b,alt:""}),N&&n.a.createElement("div",{className:Object(le.a)("spinner-container",I)},n.a.createElement(W.a,{progress:f,onClick:w}))))});a(263);const ya=Object(K.g)(e=>e(),6e4,!0);var ka=Object(n.h)(Object(c.h)(e=>{const{isBackgroundBlurred:t,customBackground:a}=e.settings.byKey,{loadedWallpapers:n}=e.settings;return{customBackground:a,isBackgroundBlurred:t,loadedWallpapers:n}},(e,t)=>Object(u.l)(t,["setSettingOption","loadWallpapers","uploadWallpaper"]))(({onScreenSelect:e,customBackground:t,isBackgroundBlurred:a,loadedWallpapers:c,setSettingOption:r,loadWallpapers:l,uploadWallpaper:o})=>{Object(n.n)(()=>{ya(()=>{l()})},[l]);const i=Object(n.m)(e=>{const{files:t}=e.target;t&&t.length>0&&o(t[0])},[o]),m=Object(n.m)(()=>{fa("image/jpeg",i,!0)},[i]),d=Object(n.m)(()=>{e(s.m.GeneralChatBackgroundColor)},[e]),u=Object(n.m)(()=>{r({customBackground:void 0})},[r]),h=Object(n.m)(e=>{r({customBackground:e})},[r]),b=Object(n.m)(e=>{r({isBackgroundBlurred:e.target.checked})},[r]),p=Object(T.a)(),g=c&&c[0]&&c[0].slug===s.n;return n.a.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement(fe.a,{icon:"camera-add",className:"mb-0",disabled:g,onClick:m},p("UploadImage")),n.a.createElement(fe.a,{icon:"colorize",className:"mb-0",onClick:d},p("SetColor")),n.a.createElement(fe.a,{icon:"favorite",onClick:u},p("ThemeResetToDefaults")),n.a.createElement(aa.a,{label:p("BackgroundBlurred"),checked:Boolean(a),onChange:b})),c?n.a.createElement("div",{className:"settings-wallpapers"},c.map(e=>n.a.createElement(Ca,{wallpaper:e,isSelected:t===e.slug,onClick:h}))):n.a.createElement(ge.a,null))}));function Na(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function Ia(e){const t=e[0].toString(16),a=e[1].toString(16),n=e[2].toString(16);return(1==t.length?"0"+t:t)+(1==a.length?"0"+a:a)+(1==n.length?"0"+n:n)}function Sa([e,t,a]){e/=255,t/=255,a/=255;let n,c,r=Math.max(e,t,a),s=Math.min(e,t,a),l=r,o=r-s;if(c=0==r?0:o/r,r==s)n=0;else{switch(r){case e:n=(t-a)/o+(t<a?6:0);break;case t:n=(a-e)/o+2;break;case a:n=(e-t)/o+4}n/=6}return[n,c,l]}function wa([e,t,a]){let n,c,r,s=Math.floor(6*e),l=6*e-s,o=a*(1-t),i=a*(1-l*t),m=a*(1-(1-l)*t);switch(s%6){case 0:n=a,c=m,r=o;break;case 1:n=i,c=a,r=o;break;case 2:n=o,c=a,r=m;break;case 3:n=o,c=i,r=a;break;case 4:n=m,c=o,r=a;break;case 5:n=a,c=o,r=i}return[Math.round(255*n),Math.round(255*c),Math.round(255*r)]}a(264);const Pa=Sa(Na("e6ebee")),Ma=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Fa(e,t){return{colorPosition:[Math.round(e[1]*(t.colorRect.width-1)),Math.round((1-e[2])*(t.colorRect.height-1))],huePosition:Math.round(e[0]*(t.hueRect.width-1))}}function La({colorPosition:e,huePosition:t},a){return[t/(a.hueRect.width-1),e[0]/(a.colorRect.width-1),1-e[1]/(a.colorRect.height-1)]}var Aa=Object(n.h)(Object(c.h)(e=>({customBackground:e.settings.byKey.customBackground}),(e,t)=>Object(u.l)(t,["setSettingOption"]))(({customBackground:e,setSettingOption:t})=>{const a=Object(n.q)(null),c=Object(n.q)(null),r=Object(n.q)(null),s=Object(n.q)(!0),[l,o]=Object(n.r)(function(e){return e&&e.startsWith("#")?Sa(Na(e.replace("#",""))):Pa}(e)),i=Object(n.q)(l);Object(n.n)(()=>{i.current=l},[l]);const[m,d,b]=Object(Be.a)(),[p,g]=Object(n.r)(""),[E,v]=Object(n.r)(""),O=Object(n.q)(),f=Object(n.q)();Object(n.n)(()=>{const e={offsetLeft:c.current.offsetLeft,...Object(u.l)(c.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:r.current.offsetLeft,...Object(u.l)(r.current.getBoundingClientRect(),["width"])};function n(t){const n=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+a.current.scrollTop),e.height-1)],{huePosition:c}=Fa(i.current,O.current);o(La({colorPosition:n,huePosition:c},O.current)),d()}function s(e){const{colorPosition:a}=Fa(i.current,O.current),n=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);o(La({colorPosition:a,huePosition:n},O.current)),d()}O.current={colorRect:e,hueRect:t},Object(h.b)(c.current,{onCapture:n,onDrag:n,onRelease:b,onClick:b,withCursor:!0}),Object(h.b)(r.current,{onCapture:s,onDrag:s,onRelease:b,onClick:b,withCursor:!0})},[d,b]);const{colorPosition:j=[0,0],huePosition:C=0}=O.current?Fa(l,O.current):{},y=Ia(wa(l)),k=l[0],N=Ia(wa([k,1,1]));Object(n.n)(()=>{const e=wa(l),a="#"+Ia(e);g(e.join(", ")),v(a),s.current||t({customBackground:a}),s.current=!1},[l,t]),Object(n.n)(()=>{!function(e,t,a,n){let c,r,s;a.current&&n.current?(c=n.current.colorRect.width,r=n.current.colorRect.height,s=a.current):(c=e.offsetWidth,r=e.offsetHeight,s=e.getContext("2d"),e.width=c,e.height=r,a.current=s);const l=s.createImageData(c,r),o=l.data,i=wa([t,1,1]);let m=0;for(let e=0;e<r;e++){const t=1-e/(r-1),a=[255*t,255*t,255*t],n=[i[0]*t,i[1]*t,i[2]*t];for(let e=0;e<c;e++){const t=e/(c-1);o[m++]=a[0]+(n[0]-a[0])*t,o[m++]=a[1]+(n[1]-a[1])*t,o[m++]=a[2]+(n[2]-a[2])*t,o[m++]=255}}s.putImageData(l,0,0)}(c.current.firstChild,k,f,O)},[k]),Object(n.n)(()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const a=e.getContext("2d"),n=a.createImageData(t,1),c=n.data;let r=0;for(let e=0;e<t;e++){const a=wa([e/(t-1),1,1]);c[r++]=a[0],c[r++]=a[1],c[r++]=a[2],c[r++]=255}a.putImageData(n,0,0)}(r.current.firstChild)},[]);const I=Object(n.m)(e=>{const t=e.currentTarget.value.replace(/[^\d, ]/g,"").slice(0,13);if(t.match(/^\d{1,3},\s?\d{1,3},\s?\d{1,3}$/)){const e=t.split(",").map(e=>Number(e.trim()));o(Sa(e))}e.currentTarget.value=t},[]),S=Object(n.m)(e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&o(Sa(Na(t.replace("#","")))),e.currentTarget.value=t},[]),w=Object(n.m)(e=>{o(Sa(Na(e.currentTarget.dataset.color.replace("#",""))))},[]),P=Object(le.a)("SettingsGeneralBackgroundColor settings-content custom-scroll",m&&"is-dragging");return n.a.createElement("div",{ref:a,className:P},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("div",{ref:c,className:"color-picker"},n.a.createElement("canvas",null),n.a.createElement("div",{className:"handle",style:`transform: translate(${j[0]}px, ${j[1]}px); background-color: #${y};`})),n.a.createElement("div",{ref:r,className:"hue-picker"},n.a.createElement("canvas",null),n.a.createElement("div",{className:"handle",style:`transform: translateX(${C}px); background-color: #${N};`})),n.a.createElement("div",{className:"tools"},n.a.createElement(ve.a,{value:E,label:"HEX",onChange:S}),n.a.createElement(ve.a,{value:p,label:"RGB",onChange:I}))),n.a.createElement("div",{className:"predefined-colors"},Ma.map(e=>n.a.createElement("div",{className:e==="#"+y?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:w}))))}));var Ta=Object(n.h)(Object(c.h)(e=>({hasPrivateChatsNotifications:Boolean(e.settings.byKey.hasPrivateChatsNotifications),hasPrivateChatsMessagePreview:Boolean(e.settings.byKey.hasPrivateChatsMessagePreview),hasGroupNotifications:Boolean(e.settings.byKey.hasGroupNotifications),hasGroupMessagePreview:Boolean(e.settings.byKey.hasGroupMessagePreview),hasBroadcastNotifications:Boolean(e.settings.byKey.hasBroadcastNotifications),hasBroadcastMessagePreview:Boolean(e.settings.byKey.hasBroadcastMessagePreview),hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications)}),(e,t)=>Object(u.l)(t,["loadNotificationsSettings","updateContactSignUpNotification","updateNotificationSettings"]))(({hasPrivateChatsNotifications:e,hasPrivateChatsMessagePreview:t,hasGroupNotifications:a,hasGroupMessagePreview:c,hasBroadcastNotifications:r,hasBroadcastMessagePreview:s,hasContactJoinedNotifications:l,loadNotificationsSettings:o,updateContactSignUpNotification:i,updateNotificationSettings:m})=>{Object(n.n)(()=>{o()},[o]);const d=Object(n.m)((n,l,o)=>{const i="contact"===l?!e:!("group"===l?a:r),d="contact"===l?t:"group"===l?c:s;m({peerType:l,..."silent"===o&&{isSilent:!n.target.checked,isShowPreviews:d},..."showPreviews"===o&&{isShowPreviews:n.target.checked,isSilent:i}})},[s,r,c,a,t,e,m]),u=Object(n.m)(e=>{i({isSilent:!e.target.checked})},[i]),h=Object(T.a)();return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},h("AutodownloadPrivateChats")),n.a.createElement(aa.a,{label:h("NotificationsForPrivateChats"),subLabel:h(e?"NotificationsEnabled":"NotificationsDisabled"),checked:e,onChange:e=>{d(e,"contact","silent")}}),n.a.createElement(aa.a,{label:h("MessagePreview"),subLabel:h(t?"PreviewEnabled":"PreviewDisabled"),checked:t,onChange:e=>{d(e,"contact","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},h("FilterGroups")),n.a.createElement(aa.a,{label:h("NotificationsForGroups"),subLabel:h(a?"NotificationsEnabled":"NotificationsDisabled"),checked:a,onChange:e=>{d(e,"group","silent")}}),n.a.createElement(aa.a,{label:h("MessagePreview"),subLabel:h(c?"PreviewEnabled":"PreviewDisabled"),checked:c,onChange:e=>{d(e,"group","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},h("FilterChannels")),n.a.createElement(aa.a,{label:h("NotificationsForChannels"),subLabel:h(r?"NotificationsEnabled":"NotificationsDisabled"),checked:r,onChange:e=>{d(e,"broadcast","silent")}}),n.a.createElement(aa.a,{label:h("MessagePreview"),subLabel:h(s?"PreviewEnabled":"PreviewDisabled"),checked:s,onChange:e=>{d(e,"broadcast","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},h("PhoneOther")),n.a.createElement(aa.a,{label:h("ContactJoined"),checked:l,onChange:u})))}));var Da=Object(n.h)(Object(c.h)(e=>{const{settings:{byKey:{hasPassword:t},privacy:a},blocked:n,activeSessions:c}=e;return{hasPassword:t,blockedCount:n.totalCount,sessionsCount:c.length,visibilityPrivacyPhoneNumber:a.phoneNumber&&a.phoneNumber.visibility,visibilityPrivacyLastSeen:a.lastSeen&&a.lastSeen.visibility,visibilityPrivacyProfilePhoto:a.profilePhoto&&a.profilePhoto.visibility,visibilityPrivacyForwarding:a.forwards&&a.forwards.visibility,visibilityPrivacyGroupChats:a.chatInvite&&a.chatInvite.visibility}},(e,t)=>Object(u.l)(t,["loadBlockedContacts","loadAuthorizations","loadPrivacySettings"]))(({onScreenSelect:e,hasPassword:t,blockedCount:a,sessionsCount:c,visibilityPrivacyPhoneNumber:r,visibilityPrivacyLastSeen:l,visibilityPrivacyProfilePhoto:o,visibilityPrivacyForwarding:i,visibilityPrivacyGroupChats:m,loadPrivacySettings:d,loadBlockedContacts:u,loadAuthorizations:h})=>{Object(n.n)(()=>{u(),h(),d()},[u,h,d]);const b=Object(T.a)();function p(e){switch(e){case"everybody":return b("P2PEverybody");case"contacts":return b("P2PContacts");case"nobody":return b("P2PNobody")}}return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement(fe.a,{icon:"delete-user",narrow:!0,onClick:()=>e(s.m.PrivacyBlockedUsers)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},b("BlockedUsers")),a>0&&n.a.createElement("span",{className:"subtitle"},b("Users",a)))),n.a.createElement(fe.a,{icon:"lock",narrow:!0,onClick:()=>e(t?s.m.TwoFaEnabled:s.m.TwoFaDisabled)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},b("TwoStepVerification")),n.a.createElement("span",{className:"subtitle"},b(t?"PasswordOn":"PasswordOff")))),n.a.createElement(fe.a,{icon:"active-sessions",narrow:!0,onClick:()=>e(s.m.PrivacyActiveSessions)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},b("SessionsTitle")),c>0&&n.a.createElement("span",{className:"subtitle"},1===c?"1 session":c+" sessions")))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4"},b("PrivacyTitle")),n.a.createElement(fe.a,{narrow:!0,onClick:()=>e(s.m.PrivacyPhoneNumber)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},b("PrivacyPhoneTitle")),n.a.createElement("span",{className:"subtitle"},p(r)))),n.a.createElement(fe.a,{narrow:!0,onClick:()=>e(s.m.PrivacyLastSeen)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},b("LastSeenTitle")),n.a.createElement("span",{className:"subtitle"},p(l)))),n.a.createElement(fe.a,{narrow:!0,onClick:()=>e(s.m.PrivacyProfilePhoto)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},b("PrivacyProfilePhotoTitle")),n.a.createElement("span",{className:"subtitle"},p(o)))),n.a.createElement(fe.a,{narrow:!0,onClick:()=>e(s.m.PrivacyForwarding)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},b("PrivacyForwardsTitle")),n.a.createElement("span",{className:"subtitle"},p(i)))),n.a.createElement(fe.a,{narrow:!0,onClick:()=>e(s.m.PrivacyGroupChats)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},b("WhoCanAddMe")),n.a.createElement("span",{className:"subtitle"},p(m))))))}));var Ba=Object(n.h)(Object(c.h)(e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language}),(e,t)=>Object(u.l)(t,["loadLanguages","setSettingOption"]))(({languages:e,language:t,loadLanguages:a,setSettingOption:c})=>{const[r,s]=Object(n.r)(t),[l,o,i]=Object(Be.a)();Object(n.n)(()=>{a()},[a]);const m=Object(n.m)(e=>{s(e),o(),Object(et.c)(e,()=>{i(),c({language:e})})},[o,i,c]),d=Object(n.p)(()=>e?function(e){return e.map(({langCode:e,nativeName:t,name:a})=>({value:e,label:t,subLabel:a}))}(e):void 0,[e]);return n.a.createElement("div",{className:"settings-content settings-item settings-language custom-scroll"},d?n.a.createElement(oa.a,{name:"keyboard-send-settings",options:d,selected:r,loadingOption:l?r:void 0,onChange:m}):n.a.createElement(ge.a,null))}));function Ua(e){switch(e){case s.m.PrivacyPhoneNumber:case s.m.PrivacyPhoneNumberAllowedContacts:case s.m.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case s.m.PrivacyLastSeen:case s.m.PrivacyLastSeenAllowedContacts:case s.m.PrivacyLastSeenDeniedContacts:return"lastSeen";case s.m.PrivacyProfilePhoto:case s.m.PrivacyProfilePhotoAllowedContacts:case s.m.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case s.m.PrivacyForwarding:case s.m.PrivacyForwardingAllowedContacts:case s.m.PrivacyForwardingDeniedContacts:return"forwards";case s.m.PrivacyGroupChats:case s.m.PrivacyGroupChatsAllowedContacts:case s.m.PrivacyGroupChatsDeniedContacts:return"chatInvite"}}var xa=Object(n.h)(Object(c.h)((e,{screen:t})=>{let a;const{chats:{byId:n},settings:{privacy:c}}=e;switch(t){case s.m.PrivacyPhoneNumber:a=c.phoneNumber;break;case s.m.PrivacyLastSeen:a=c.lastSeen;break;case s.m.PrivacyProfilePhoto:a=c.profilePhoto;break;case s.m.PrivacyForwarding:a=c.forwards;break;case s.m.PrivacyGroupChats:a=c.chatInvite}return a?{...a,chatsById:n}:{}},(e,t)=>Object(u.l)(t,["setPrivacyVisibility"]))(({screen:e,onScreenSelect:t,visibility:a,allowUserIds:c,allowChatIds:r,blockUserIds:l,blockChatIds:o,chatsById:i,setPrivacyVisibility:m})=>{const d=Object(T.a)(),u=Object(n.p)(()=>{switch(e){case s.m.PrivacyProfilePhoto:case s.m.PrivacyGroupChats:return[{value:"everybody",label:d("P2PEverybody")},{value:"contacts",label:d("P2PContacts")}];default:return[{value:"everybody",label:d("P2PEverybody")},{value:"contacts",label:d("P2PContacts")},{value:"nobody",label:d("P2PNobody")}]}},[d,e]),h={shouldShowDenied:"nobody"!==a,shouldShowAllowed:"everybody"!==a},b=Ua(e),p=Object(n.p)(()=>{switch(e){case s.m.PrivacyPhoneNumber:return d("PrivacyPhoneTitle");case s.m.PrivacyLastSeen:return d("LastSeenTitle");case s.m.PrivacyProfilePhoto:return d("PrivacyProfilePhotoTitle");case s.m.PrivacyForwarding:return d("PrivacyForwardsTitle");case s.m.PrivacyGroupChats:return d("WhoCanAddMe");default:return}},[d,e]),g=Object(n.p)(()=>{switch(e){case s.m.PrivacyLastSeen:return d("CustomHelp");default:return}},[d,e]),E=(()=>{switch(e){case s.m.PrivacyPhoneNumber:return s.m.PrivacyPhoneNumberAllowedContacts;case s.m.PrivacyLastSeen:return s.m.PrivacyLastSeenAllowedContacts;case s.m.PrivacyProfilePhoto:return s.m.PrivacyProfilePhotoAllowedContacts;case s.m.PrivacyForwarding:return s.m.PrivacyForwardingAllowedContacts;default:return s.m.PrivacyGroupChatsAllowedContacts}})(),v=(()=>{switch(e){case s.m.PrivacyPhoneNumber:return s.m.PrivacyPhoneNumberDeniedContacts;case s.m.PrivacyLastSeen:return s.m.PrivacyLastSeenDeniedContacts;case s.m.PrivacyProfilePhoto:return s.m.PrivacyProfilePhotoDeniedContacts;case s.m.PrivacyForwarding:return s.m.PrivacyForwardingDeniedContacts;default:return s.m.PrivacyGroupChatsDeniedContacts}})(),O=Object(n.p)(()=>c&&r&&i?r.reduce((e,t)=>e+(i[t]?i[t].membersCount:0),c.length):0,[r,c,i]),f=Object(n.p)(()=>l&&o&&i?o.reduce((e,t)=>e+(i[t]?i[t].membersCount:0),l.length):0,[o,l,i]),j=Object(n.m)(e=>{m({privacyKey:b,visibility:e})},[b,m]);return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header"},p),n.a.createElement(oa.a,{name:"visibility-"+b,options:u,onChange:j,selected:a}),g&&n.a.createElement("p",{className:"settings-item-description-larger"},g)),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4"},d("PrivacyExceptions")),h.shouldShowAllowed&&n.a.createElement(fe.a,{narrow:!0,icon:"add-user",onClick:()=>{t(E)}},n.a.createElement("div",{className:"multiline-menu-item full-size"},O>0&&n.a.createElement("span",{className:"date"},"+",O),n.a.createElement("span",{className:"title"},d("AlwaysShareWith")),n.a.createElement("span",{className:"subtitle"},d("EditAdminAddUsers")))),h.shouldShowDenied&&n.a.createElement(fe.a,{narrow:!0,icon:"delete-user",onClick:()=>{t(v)}},n.a.createElement("div",{className:"multiline-menu-item full-size"},f>0&&n.a.createElement("span",{className:"date"},"−",f),n.a.createElement("span",{className:"title"},d("NeverShareWith")),n.a.createElement("span",{className:"subtitle"},d("EditAdminAddUsers"))))))}));function Ra(e){return[e.region,e.country].filter(Boolean).join(", ")}function Ga(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}var qa=Object(n.h)(Object(c.h)(e=>({activeSessions:e.activeSessions}),(e,t)=>Object(u.l)(t,["loadAuthorizations","terminateAuthorization","terminateAllAuthorizations"]))(({activeSessions:e,loadAuthorizations:t,terminateAuthorization:a,terminateAllAuthorizations:c})=>{const[r,s,l]=Object(Be.a)();Object(n.n)(()=>{t()},[t]);const o=Object(n.m)(e=>{a({hash:e})},[a]),i=Object(n.m)(()=>{l(),c()},[l,c]),m=Object(n.p)(()=>e.find(e=>e.isCurrent),[e]),d=Object(n.p)(()=>e.filter(e=>!e.isCurrent),[e]),u=Object(T.a)();function h(e){return n.a.createElement(fe.a,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{o(e.hash)}}]},n.a.createElement("div",{className:"multiline-menu-item full-size"},n.a.createElement("span",{className:"date"},Object(R.g)(1e3*e.dateActive)),n.a.createElement("span",{className:"title"},e.appName),n.a.createElement("span",{className:"subtitle black tight"},Ga(e)),n.a.createElement("span",{className:"subtitle"},e.ip," - ",Ra(e))))}return n.a.createElement("div",{className:"settings-content custom-scroll"},m&&(p=m,n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4"},u("AuthSessions.CurrentSession")),n.a.createElement(fe.a,{narrow:!0,inactive:!0},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},p.appName),n.a.createElement("span",{className:"subtitle black tight"},Ga(p)),n.a.createElement("span",{className:"subtitle"},p.ip," - ",Ra(p)))),n.a.createElement(fe.a,{className:"destructive mb-0",icon:"stop",ripple:!0,narrow:!0,onClick:s},u("TerminateAllSessions")))),d&&(b=d,n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4"},"Other Sessions"),b.map(h))),d&&n.a.createElement(Bt.a,{isOpen:r,onClose:l,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:i,confirmIsDestructive:!0}),";");var b,p}));var za=Object(n.h)(Object(c.h)(e=>{const{chats:{byId:t},users:{byId:a},blocked:{ids:n}}=e;return{chatsByIds:t,usersByIds:a,blockedIds:n}},(e,t)=>Object(u.l)(t,["unblockContact"]))(({chatsByIds:e,usersByIds:t,blockedIds:a,unblockContact:c})=>{const r=Object(n.m)(e=>{c({contactId:e})},[c]),s=Object(T.a)();return n.a.createElement("div",{className:"settings-fab-wrapper"},n.a.createElement("div",{className:"settings-content infinite-scroll"},n.a.createElement("div",{className:"settings-item"},n.a.createElement("p",{className:"settings-item-description-larger mt-0 mb-2"},s("BlockedUsersInfo"))),n.a.createElement("div",{className:"chat-list custom-scroll"},a&&a.length?n.a.createElement("div",{className:"scroll-container"},a.map((a,c)=>function(a,c,s){const o=Object(d.lb)(a),i=o?t[a]:void 0,m=o?void 0:e[a],u=Object(le.a)("Chat chat-item-clickable blocked-list-item",o?"private":"group");return n.a.createElement(fe.a,{key:a,className:u,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{r(a)}}],style:`top: ${(s+c)*l.h}px;`},n.a.createElement(q.a,{size:"medium",user:i,chat:m}),n.a.createElement("div",{className:"contact-info"},n.a.createElement("h3",null,Object(G.a)((o?Object(d.Z)(i):Object(d.l)(m))||"")),i&&i.phoneNumber&&n.a.createElement("div",{className:"contact-phone"},Object(xt.c)(i.phoneNumber)),i&&!i.phoneNumber&&i.username&&n.a.createElement("div",{className:"contact-username"},"@",i.username)))}(a,c,0))):a&&!a.length?n.a.createElement("div",{className:"no-results"},"List is empty"):n.a.createElement(ge.a,{key:"loading"}))),n.a.createElement(qt,{isShown:!0,onClick:()=>{},className:"not-implemented",ariaLabel:"Add a blocked user"},n.a.createElement("i",{className:"icon-add"})))})),$a=a(119);var Ha=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(m.c)(e,"🔐")}))(({animatedEmoji:e,onScreenSelect:t})=>{const a=Object(T.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement($a.a,{sticker:e}),n.a.createElement("p",{className:"settings-item-description mb-3"},Object(G.a)(a("EnabledPasswordText"),["br"]))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(fe.a,{icon:"edit",onClick:()=>t(s.m.TwoFaChangePasswordCurrent)},a("ChangePassword")),n.a.createElement(fe.a,{icon:"password-off",onClick:()=>t(s.m.TwoFaTurnOff)},a("TurnPasswordOff")),n.a.createElement(fe.a,{icon:"email",onClick:()=>t(s.m.TwoFaRecoveryEmailCurrentPassword)},a("SetRecoveryEmail"))))})),Va=a(138),Wa=a(139);var Ya=Object(n.h)(({error:e,isLoading:t,expectedPassword:a,placeholder:c="Current Password",hint:r,submitLabel:s,clearError:l,onSubmit:o})=>{const[i,m]=Object(n.r)(""),[d,u]=Object(n.r)(!1),h=Object(n.m)(e=>{a&&e!==a?m("Passwords Should Be Equal"):o(e)},[o,a]),b=Object(n.m)(()=>{l&&l(),m("")},[l]),p=Object(T.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Va.a,{isBig:!0,isPasswordVisible:d})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(Wa.a,{error:i||e,hint:r,placeholder:c,submitLabel:s||p("Next"),clearError:b,isLoading:t,isPasswordVisible:d,onChangePasswordVisibility:u,onSubmit:h})))});var Ka=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(m.c)(e,"🔐")}))(({animatedEmoji:e,onStart:t})=>{const a=Object(T.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement($a.a,{sticker:e}),n.a.createElement("p",{className:"settings-item-description mb-3"},a("SetAdditionalPasswordInfo"))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(x.a,{onClick:t},a("EditAdminTransferSetPassword"))))}));const Za=o.f?550:400;var Qa=Object(n.h)(Object(c.h)((e,{icon:t})=>({animatedEmoji:Object(m.c)(e,"email"===t?"💌":"💡")}))(({animatedEmoji:e,type:t="text",isLoading:a,error:c,placeholder:r,shouldConfirm:s,clearError:l,onSubmit:i})=>{const m=Object(n.q)(null),[d,u]=Object(n.r)(""),[h,b,p]=Object(Be.a)(!1);Object(n.n)(()=>{o.k||setTimeout(()=>{m.current.focus()},Za)},[]);const g=Object(T.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement($a.a,{sticker:e})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),m.current&&i(d)}},n.a.createElement(ve.a,{ref:m,value:d,inputMode:t,label:r,error:c,onChange:e=>{c&&l&&l(),u(e.target.value)}}),d?n.a.createElement(x.a,{type:"submit",isLoading:a,ripple:!0},g("Continue")):n.a.createElement(x.a,{isText:!0,isLoading:a,ripple:!0,onClick:s?b:()=>{i()}},g("YourEmailSkip"))),s&&n.a.createElement(Ee.a,{className:"narrow",isOpen:h,title:g("YourEmailSkipWarning"),onClose:p},Object(G.a)(g("YourEmailSkipWarningText"),["br","simple_markdown"]),n.a.createElement("div",{className:"dialog-buttons"},n.a.createElement(x.a,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{p(),i()}},g("YourEmailSkip")),n.a.createElement(x.a,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:p},g("Cancel"))))))}));var _a=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(m.c)(e,"🥳")}))(({animatedEmoji:e,onScreenSelect:t})=>{const a=Object(T.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement($a.a,{sticker:e}),n.a.createElement("p",{className:"settings-item-description mb-3"},a("TwoStepVerificationPasswordSetInfo"))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(x.a,{onClick:()=>{t(s.m.Privacy)}},a("TwoStepVerificationPasswordReturnSettings"))))}));const Xa=o.f?550:400;var Ja=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(m.c)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength}))(({animatedEmoji:e,codeLength:t,isLoading:a,error:c,clearError:r,onSubmit:s})=>{const l=Object(n.q)(null),[i,m]=Object(n.r)("");Object(n.n)(()=>{o.k||setTimeout(()=>{l.current.focus()},Xa)},[]);const d=Object(T.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement($a.a,{sticker:e})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(ve.a,{value:i,ref:l,inputMode:"decimal",label:d("YourEmailCode"),error:c,onChange:e=>{c&&r&&r();const a=e.target.value.slice(0,t);a.length===t&&s(a),m(a),e.target.value=a}}),a&&n.a.createElement(ge.a,null)))}));var en=Object(n.h)(Object(c.h)(e=>({...e.twoFaSettings}),(e,t)=>Object(u.l)(t,["updatePassword","updateRecoveryEmail","clearPassword","provideTwoFaEmailCode","checkPassword","clearTwoFaError"]))(({currentScreen:e,state:t,hint:a,isLoading:c,error:r,waitingEmailCodeLength:l,dispatch:o,onScreenSelect:i,updatePassword:m,checkPassword:d,clearTwoFaError:u,updateRecoveryEmail:h,provideTwoFaEmailCode:b,clearPassword:p})=>{Object(n.n)(()=>{l&&(e===s.m.TwoFaNewPasswordEmail?i(s.m.TwoFaNewPasswordEmailCode):e===s.m.TwoFaRecoveryEmail&&i(s.m.TwoFaRecoveryEmailCode))},[e,i,l]);const g=Object(n.m)(()=>{o({type:"reset"}),i(s.m.TwoFaNewPassword)},[o,i]),E=Object(n.m)(e=>{o({type:"setPassword",payload:e}),i(s.m.TwoFaNewPasswordConfirm)},[o,i]),v=Object(n.m)(()=>{i(s.m.TwoFaNewPasswordHint)},[i]),O=Object(n.m)(e=>{o({type:"setHint",payload:e}),i(s.m.TwoFaNewPasswordEmail)},[o,i]),f=Object(n.m)(e=>{o({type:"setEmail",payload:e}),m({...t,email:e,onSuccess:()=>{i(s.m.TwoFaCongratulations)}})},[o,i,t,m]),j=Object(n.m)(e=>{o({type:"setCurrentPassword",payload:e}),d({currentPassword:e,onSuccess:()=>{i(s.m.TwoFaChangePasswordNew)}})},[d,o,i]),C=Object(n.m)(e=>{o({type:"setPassword",payload:e}),i(s.m.TwoFaChangePasswordConfirm)},[o,i]),y=Object(n.m)(()=>{i(s.m.TwoFaChangePasswordHint)},[i]),k=Object(n.m)(e=>{o({type:"setHint",payload:e}),m({...t,hint:e,onSuccess:()=>{i(s.m.TwoFaCongratulations)}})},[o,i,t,m]),N=Object(n.m)(e=>{p({currentPassword:e,onSuccess:()=>{i(s.m.Privacy)}})},[p,i]),I=Object(n.m)(e=>{o({type:"setCurrentPassword",payload:e}),d({currentPassword:e,onSuccess:()=>{i(s.m.TwoFaRecoveryEmail)}})},[d,o,i]),S=Object(n.m)(e=>{o({type:"setEmail",payload:e}),h({...t,email:e,onSuccess:()=>{i(s.m.TwoFaCongratulations)}})},[o,i,t,h]),w=Object(n.m)(e=>{b({code:e})},[b]),P=Object(T.a)();switch(e){case s.m.TwoFaDisabled:return n.a.createElement(Ka,{onStart:g});case s.m.TwoFaNewPassword:return n.a.createElement(Ya,{placeholder:P("EnterPassword"),submitLabel:P("Continue"),onSubmit:E});case s.m.TwoFaNewPasswordConfirm:return n.a.createElement(Ya,{expectedPassword:t.password,placeholder:P("PleaseReEnterPassword"),submitLabel:P("Continue"),onSubmit:v});case s.m.TwoFaNewPasswordHint:return n.a.createElement(Qa,{icon:"hint",placeholder:P("PasswordHintPlaceholder"),onSubmit:O});case s.m.TwoFaNewPasswordEmail:return n.a.createElement(Qa,{icon:"email",type:"email",isLoading:c,error:r,clearError:u,placeholder:P("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:f});case s.m.TwoFaNewPasswordEmailCode:return n.a.createElement(Ja,{isLoading:c,error:r,clearError:u,onSubmit:w});case s.m.TwoFaCongratulations:return n.a.createElement(_a,{onScreenSelect:i});case s.m.TwoFaEnabled:return n.a.createElement(Ha,{onScreenSelect:i});case s.m.TwoFaChangePasswordCurrent:return n.a.createElement(Ya,{isLoading:c,error:r,clearError:u,hint:a,onSubmit:j});case s.m.TwoFaChangePasswordNew:return n.a.createElement(Ya,{placeholder:P("PleaseEnterNewFirstPassword"),onSubmit:C});case s.m.TwoFaChangePasswordConfirm:return n.a.createElement(Ya,{expectedPassword:t.password,placeholder:P("PleaseReEnterPassword"),onSubmit:y});case s.m.TwoFaChangePasswordHint:return n.a.createElement(Qa,{isLoading:c,error:r,clearError:u,icon:"hint",placeholder:P("PasswordHintPlaceholder"),onSubmit:k});case s.m.TwoFaTurnOff:return n.a.createElement(Ya,{isLoading:c,error:r,clearError:u,hint:a,onSubmit:N});case s.m.TwoFaRecoveryEmailCurrentPassword:return n.a.createElement(Ya,{isLoading:c,error:r,clearError:u,hint:a,onSubmit:I});case s.m.TwoFaRecoveryEmail:return n.a.createElement(Qa,{icon:"email",type:"email",placeholder:P("RecoveryEmailTitle"),onSubmit:S});case s.m.TwoFaRecoveryEmailCode:return n.a.createElement(Ja,{isLoading:c,error:r,clearError:u,onSubmit:w});default:return}}));var tn=Object(n.h)(({itemIds:e,selectedIds:t,filterValue:a,filterPlaceholder:c,notFoundText:r,searchInputId:s,isLoading:l,onSelectedIdsChange:o,onFilterChange:i,onLoadMore:m})=>{const u=Object(n.q)(null),h=t.length>10;Object(n.n)(()=>{setTimeout(()=>{requestAnimationFrame(()=>{u.current.focus()})},500)},[]);const b=Object(n.m)(e=>{const a=[...t];a.includes(e)?a.splice(a.indexOf(e),1):a.push(e),o(a),i("")},[t,o,i]),p=Object(n.m)(e=>{const{value:t}=e.currentTarget;i(t)},[i]),[g,E]=Object(pe.a)(m,e,Boolean(a)),v=Object(T.a)();return n.a.createElement("div",{className:"Picker"},n.a.createElement("div",{className:"picker-header custom-scroll"},t.map((e,a)=>n.a.createElement(Je.a,{chatOrUserId:e,isMinimized:h&&a<t.length-5,canClose:!0,onClick:b,clickArg:e})),n.a.createElement(ve.a,{id:s,ref:u,value:a,onChange:p,placeholder:c||v("SelectChat")})),g&&g.length?n.a.createElement(Oe.a,{className:"picker-list custom-scroll",items:g,onLoadMore:E},g.map(e=>n.a.createElement(fe.a,{key:e,className:"chat-item-clickable picker-list-item",onClick:()=>b(e),ripple:!0},n.a.createElement(aa.a,{label:"",checked:t.includes(e)}),Object(d.lb)(e)?n.a.createElement(je.a,{userId:e}):n.a.createElement(Ce.a,{chatId:e})))):l||!g||g.length?n.a.createElement(ge.a,null):n.a.createElement("p",{className:"no-results"},r||"Sorry, nothing found."))});function an(e,t){const{privacy:a}=e.settings;switch(t){case s.m.PrivacyPhoneNumberAllowedContacts:case s.m.PrivacyPhoneNumberDeniedContacts:return a.phoneNumber;case s.m.PrivacyLastSeenAllowedContacts:case s.m.PrivacyLastSeenDeniedContacts:return a.lastSeen;case s.m.PrivacyProfilePhotoAllowedContacts:case s.m.PrivacyProfilePhotoDeniedContacts:return a.profilePhoto;case s.m.PrivacyForwardingAllowedContacts:case s.m.PrivacyForwardingDeniedContacts:return a.forwards;case s.m.PrivacyGroupChatsDeniedContacts:case s.m.PrivacyGroupChatsAllowedContacts:return a.chatInvite}}var nn=Object(n.h)(Object(c.h)((e,{screen:t})=>{const{chats:{byId:a,listIds:n,orderedPinnedIds:c},currentUserId:r}=e;return{currentUserId:r,chatsById:a,listIds:n.active,orderedPinnedIds:c.active,archivedPinnedIds:c.archived,archivedListIds:n.archived,settings:an(e,t)}},(e,t)=>Object(u.l)(t,["setPrivacySettings"]))(({currentUserId:e,isAllowList:t,screen:a,settings:c,chatsById:r,listIds:l,orderedPinnedIds:o,archivedListIds:i,archivedPinnedIds:m,setPrivacySettings:u,onScreenSelect:h})=>{const b=Object(n.p)(()=>c?t?[...c.allowUserIds,...c.allowChatIds]:[...c.blockUserIds,...c.blockChatIds]:[],[t,c]),[p,g]=Object(n.r)(""),[E,v]=Object(n.r)(!1),[O,f]=Object(n.r)(b),j=Object(n.p)(()=>{const e=l?Object(d.Ab)(r,l,o,"all"):void 0,t=i?Object(d.Ab)(r,i,m,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]},[r,l,o,i,m]),C=Object(n.p)(()=>{if(j)return j.filter(t=>(Object(d.lb)(t.id)&&t.id!==e||Object(d.kb)(t))&&(!p||Object(be.a)(Object(d.l)(t),p)||b.includes(t.id))).map(({id:e})=>e)},[j,e,p,b]),y=Object(n.m)(e=>{f(e),v(!0)},[]),k=Object(n.m)(()=>{u({privacyKey:Ua(a),isAllowList:Boolean(t),contactsIds:O}),h(s.m.Privacy)},[t,O,h,a,u]),N=Object(T.a)();return n.a.createElement("div",{className:"NewChat-inner step-1"},n.a.createElement(tn,{itemIds:C||[],selectedIds:O,filterValue:p,filterPlaceholder:N(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:y,onFilterChange:g}),n.a.createElement(qt,{isShown:E,onClick:k,ariaLabel:N(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},n.a.createElement("i",{className:"icon-arrow-right"})))}));a(265);const cn=Object.keys(s.m).length/2;var rn=Object(n.h)(({currentScreen:e,onScreenSelect:t,onReset:a})=>{const[c,r]=Nt(At,Lt),[l,i]=Nt(Dt,Tt),m=Object(n.m)(()=>{e!==s.m.FoldersCreateFolder&&e!==s.m.FoldersEditFolder||setTimeout(()=>{r({type:"reset"})},200),e!==s.m.FoldersIncludedChats&&e!==s.m.FoldersExcludedChats?a():"create"===c.mode?t(s.m.FoldersCreateFolder):t(s.m.FoldersEditFolder)},[c.mode,r,e,a,t]),d=Object(n.m)(()=>{r({type:"saveFilters"}),m()},[r,m]);function u(){return n.a.createElement(n.a.Fragment,null,n.a.createElement(Ut,{currentScreen:e,onReset:m,onSaveFilter:d,editedFolderId:c.folderId}),function(){switch(e){case s.m.Main:return n.a.createElement(Rt,{onScreenSelect:t});case s.m.EditProfile:return n.a.createElement(Yt,null);case s.m.General:return n.a.createElement(va,{onScreenSelect:t});case s.m.Notifications:return n.a.createElement(Ta,null);case s.m.Privacy:return n.a.createElement(Da,{onScreenSelect:t});case s.m.Language:return n.a.createElement(Ba,null);case s.m.GeneralChatBackground:return n.a.createElement(ka,{onScreenSelect:t});case s.m.GeneralChatBackgroundColor:return n.a.createElement(Aa,{onScreenSelect:t});case s.m.PrivacyActiveSessions:return n.a.createElement(qa,null);case s.m.PrivacyBlockedUsers:return n.a.createElement(za,null);case s.m.PrivacyPhoneNumber:case s.m.PrivacyLastSeen:case s.m.PrivacyProfilePhoto:case s.m.PrivacyForwarding:case s.m.PrivacyGroupChats:return n.a.createElement(xa,{screen:e,onScreenSelect:t});case s.m.PrivacyPhoneNumberAllowedContacts:case s.m.PrivacyLastSeenAllowedContacts:case s.m.PrivacyProfilePhotoAllowedContacts:case s.m.PrivacyForwardingAllowedContacts:case s.m.PrivacyGroupChatsAllowedContacts:return n.a.createElement(nn,{isAllowList:!0,screen:e,onScreenSelect:t});case s.m.PrivacyPhoneNumberDeniedContacts:case s.m.PrivacyLastSeenDeniedContacts:case s.m.PrivacyProfilePhotoDeniedContacts:case s.m.PrivacyForwardingDeniedContacts:case s.m.PrivacyGroupChatsDeniedContacts:return n.a.createElement(nn,{screen:e,onScreenSelect:t});case s.m.Folders:case s.m.FoldersCreateFolder:case s.m.FoldersEditFolder:case s.m.FoldersIncludedChats:case s.m.FoldersExcludedChats:return n.a.createElement(ra,{currentScreen:e,state:c,dispatch:r,onScreenSelect:t,onReset:m});case s.m.TwoFaDisabled:case s.m.TwoFaNewPassword:case s.m.TwoFaNewPasswordConfirm:case s.m.TwoFaNewPasswordHint:case s.m.TwoFaNewPasswordEmail:case s.m.TwoFaNewPasswordEmailCode:case s.m.TwoFaCongratulations:case s.m.TwoFaEnabled:case s.m.TwoFaChangePasswordCurrent:case s.m.TwoFaChangePasswordNew:case s.m.TwoFaChangePasswordConfirm:case s.m.TwoFaChangePasswordHint:case s.m.TwoFaTurnOff:case s.m.TwoFaRecoveryEmailCurrentPassword:case s.m.TwoFaRecoveryEmail:case s.m.TwoFaRecoveryEmailCode:return n.a.createElement(en,{currentScreen:e,state:l,dispatch:i,onScreenSelect:t});default:return}}())}return n.a.createElement(U.a,{id:"Settings",name:o.f?"slide-layers":"push-slide",activeKey:e,renderCount:cn},u)});const sn=Object(K.g)(e=>e(),6e4,!0);var ln=Object(n.h)(Object(c.h)(e=>{const{userIds:t}=e.contactList||{},{byId:a}=e.users;return{usersById:a,contactIds:t}},(e,t)=>Object(u.l)(t,["loadContactList","openChat"]))(({filter:e,usersById:t,contactIds:a,loadContactList:c,openChat:r})=>{Object(n.n)(()=>{sn(()=>{c()})});const s=Object(n.m)(e=>{r({id:e})},[r]),l=Object(n.p)(()=>{if(!a)return;const n=e?a.filter(a=>{const n=t[a];if(!n)return!1;const c=Object(d.Z)(n);return c&&Object(be.a)(c,e)}):a;return Object(d.W)(n,t)},[e,t,a]),[i,m]=Object(pe.a)(void 0,l,Boolean(e));return n.a.createElement(Oe.a,{items:i,onLoadMore:m,className:"chat-list custom-scroll"},i&&i.length?i.map(e=>n.a.createElement(fe.a,{key:e,className:"chat-item-clickable",onClick:()=>s(e),ripple:!o.f},n.a.createElement(je.a,{userId:e,forceShowSelf:!0,avatarSize:"large"}))):i&&!i.length?n.a.createElement("p",{className:"no-results",key:"no-results"},e.length?"No contacts matched your search.":"Contact list is empty."):n.a.createElement(ge.a,{key:"loading"}))}));const on=Object(K.g)(e=>e(),6e4,!0);var mn=Object(n.h)(Object(c.h)(e=>{const{userIds:t}=e.contactList||{},{byId:a}=e.users,{currentUserId:n}=e,{query:c,fetchingStatus:r,globalResults:s,localResults:l}=e.globalSearch,{users:o}=s||{},{users:i}=l||{};return{currentUserId:n,usersById:a,localContactIds:t,searchQuery:c,isSearching:r&&r.chats,globalUsers:o,localUsers:i}},(e,t)=>Object(u.l)(t,["loadContactList","setGlobalSearchQuery"]))(({isChannel:e,selectedMemberIds:t,onSelectedMemberIdsChange:a,onNextStep:c,onReset:r,currentUserId:s,usersById:l,localContactIds:o,searchQuery:i,isSearching:m,localUsers:h,globalUsers:b,loadContactList:p,setGlobalSearchQuery:g})=>{Object(n.n)(()=>{on(()=>{p()})});const E=Object(n.m)(e=>{g({query:e})},[g]),v=Object(n.p)(()=>{const e=o?o.filter(e=>e!==s):[];if(!i)return e;const a=e.filter(e=>{const t=l[e];if(!t)return!1;const a=Object(d.Z)(t);return a&&Object(be.a)(a,i)});return Object(d.W)(Object(u.o)([...a,...h?h.map(e=>e.id):[],...b?b.map(e=>e.id):[]]),l,t)},[o,i,h,b,l,t,s]),O=Object(n.m)(()=>{t.length&&(g({query:""}),c())},[t,g,c]),f=Object(T.a)();return n.a.createElement("div",{className:"NewChat step-1"},n.a.createElement("div",{className:"left-header"},n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",onClick:r,ariaLabel:"Return to Chat List"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,f("GroupAddMembers"))),n.a.createElement("div",{className:"NewChat-inner step-1"},n.a.createElement(tn,{itemIds:v,selectedIds:t,filterValue:i,filterPlaceholder:f("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:m,onSelectedIdsChange:a,onFilterChange:E}),n.a.createElement(qt,{isShown:Boolean(t.length),onClick:O,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},n.a.createElement("i",{className:"icon-arrow-right"}))))}));var dn=Object(n.h)(Object(c.h)(e=>{const{progress:t,error:a}=e.chatCreation||{};return{creationProgress:t,creationError:a}},(e,t)=>Object(u.l)(t,["createGroupChat","createChannel"]))(({isChannel:e,memberIds:t,onReset:a,creationProgress:c,creationError:r,createGroupChat:l,createChannel:o})=>{const i=Object(T.a)(),[m,d]=Object(n.r)(""),[u,h]=Object(n.r)(""),[b,p]=Object(n.r)(),[g,E]=Object(n.r)(),v=c===s.a.InProgress,O=Object(n.m)(e=>{const{value:t}=e.currentTarget,a=t.replace(/^\s+/,"");d(a),a!==t&&(e.currentTarget.value=a)},[]),f=Object(n.m)(e=>{h(e.currentTarget.value)},[]),j=Object(n.m)(()=>{m.length?t.length>199?E("Sorry, creating supergroups is not yet supported"):l({title:m,photo:b,memberIds:t}):E("Chat title can't be empty")},[m,t,l,b,"Chat title can't be empty","Sorry, creating supergroups is not yet supported"]),C=Object(n.m)(()=>{m.length?o({title:m,about:u,photo:b,memberIds:t}):E("Channel title can't be empty")},[m,o,u,b,t,"Channel title can't be empty"]);Object(n.n)(()=>{c===s.a.Complete&&a(!0)},[c,a]);const y=r||("Chat title can't be empty"!==g&&"Channel title can't be empty"!==g?g:void 0);return n.a.createElement("div",{className:"NewChat"},n.a.createElement("div",{className:"left-header"},n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>a(),ariaLabel:"Return to member selection"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,i(e?"NewChannel":"NewGroup"))),n.a.createElement("div",{className:"NewChat-inner step-2"},n.a.createElement(Gt.a,{onChange:p,title:i("AddPhoto")}),n.a.createElement(ve.a,{value:m,onChange:O,label:i(e?"EnterChannelName":"GroupName"),error:"Chat title can't be empty"===g||"Channel title can't be empty"===g?g:void 0}),e&&n.a.createElement(n.a.Fragment,null,n.a.createElement(ve.a,{value:u,onChange:f,label:i("DescriptionOptionalPlaceholder")}),n.a.createElement("p",{className:"note"},i("DescriptionInfo"))),y&&n.a.createElement("p",{className:"error"},y),n.a.createElement("h3",{className:"chat-members-heading"},i("GroupInfo.ParticipantCount",t.length,"i")),n.a.createElement("div",{className:"chat-members-list custom-scroll"},t.map(e=>n.a.createElement(fe.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(je.a,{userId:e}))))),n.a.createElement(qt,{isShown:0!==m.length,onClick:e?C:j,disabled:v,ariaLabel:e?i("ChannelIntro.CreateChannel"):"Create Group"},v?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-arrow-right"})))}));a(266);const un=Object.keys(s.d).length/2;var hn=Object(n.h)(({isChannel:e=!1,content:t,onContentChange:a,onReset:c})=>{const[r,l]=Object(n.r)([]),i=Object(n.m)(()=>{a(e?s.d.NewChannelStep2:s.d.NewGroupStep2)},[e,a]);return n.a.createElement(U.a,{id:"NewChat",name:o.f?"slide-layers":"push-slide",renderCount:un,activeKey:t},()=>{switch(t){case s.d.NewChannelStep1:case s.d.NewGroupStep1:return n.a.createElement(mn,{isChannel:e,selectedMemberIds:r,onSelectedMemberIdsChange:l,onNextStep:i,onReset:c});case s.d.NewChannelStep2:case s.d.NewGroupStep2:return n.a.createElement(dn,{isChannel:e,memberIds:r,onReset:c});default:return}})}),bn=a(177);a(267);var pn=Object(n.h)(({onReset:e})=>{const t=Object(T.a)();return n.a.createElement("div",{className:"ArchivedChats"},n.a.createElement("div",{className:"left-header"},n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",onClick:e,ariaLabel:"Return to chat list"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,t("ArchivedChats"))),n.a.createElement(bn.a,{folderType:"archived",noChatsText:"Archive is empty."}))});const gn={Down:!0,ArrowDown:!0,Up:!0,ArrowUp:!0,Left:!0,ArrowLeft:!0,Right:!0,ArrowRight:!0," ":!0,PageUp:!0,PageDown:!0,End:!0,Home:!0,Tab:!0},En=e=>{e.preventDefault()};function vn(e){gn[e.key]&&En(e)}function On(){document.addEventListener("wheel",En,{passive:!1}),window.ontouchmove=En,document.onkeydown=vn}function fn(){document.removeEventListener("wheel",En),window.ontouchmove=null,document.onkeydown=null}var jn=a(48),Cn=a(159);function yn(e,t){return e?"Copy Selected Text":t?"Copy Text":"Copy"}var kn=a(163),Nn=a(47);a(268);var In=({isOpen:e,message:t,anchor:a,canSendNow:c,canReschedule:s,canReply:l,canEdit:o,canPin:i,canUnpin:m,canDelete:u,canForward:h,canFaveSticker:b,canUnfaveSticker:p,canCopy:g,canCopyLink:E,canSelect:v,onReply:O,onEdit:f,onPin:j,onUnpin:C,onForward:y,onDelete:N,onFaveSticker:I,onUnfaveSticker:S,onSelect:w,onSend:P,onReschedule:M,onClose:F,onCloseAnimationEnd:L,onCopyLink:A})=>{Object(n.n)(()=>{Object(k.b)(200)},[e]);const D=function(e,t,a){const n=[],c=Object(d.N)(e),s=Object(d.G)(e),l=Object(d.D)(e,"inline"),o=s&&l&&Cn.a,i=window.getSelection();if(o&&n.push({label:"Copy Media",handler:()=>{jn.b(l,r.ApiMediaFormat.BlobUrl).then(Cn.b),t&&t()}}),c){const e=Boolean(i&&i.anchorNode&&i.anchorNode.parentNode&&i.anchorNode.parentNode.closest(".Message .content-inner")&&""!==i.toString().replace(/(?:\r\n|\r|\n)/g,""));n.push({label:yn(e,o),handler:()=>{const a=e&&i?i.toString():c;Object(Cn.c)(a),t&&t()}})}return a&&n.push({label:"CopyMessageLink",handler:()=>{a(),t&&t()}}),n}(t,F,E?A:void 0),B=Object(n.m)(()=>document.querySelector(`.active > .MessageList div[data-message-id="${t.id}"]`),[t.id]),U=Object(n.m)(()=>document.querySelector(".active > .MessageList"),[]),x=Object(n.m)(()=>document.querySelector(".MessageContextMenu .bubble"),[]),{positionX:R,positionY:G,style:q}=Object(kn.a)(a,B,U,x,10,document.querySelector(".MiddleHeader").offsetHeight),z=Object(T.a)();return n.a.createElement(Nn.a,{isOpen:e,positionX:R,positionY:G,style:q,className:"MessageContextMenu fluid",onClose:F,onCloseAnimationEnd:L},c&&n.a.createElement(V.a,{icon:"send-outline",onClick:P},z("MessageScheduleSend")),s&&n.a.createElement(V.a,{icon:"schedule",onClick:M},z("MessageScheduleEditTime")),l&&n.a.createElement(V.a,{icon:"reply",onClick:O},z("Reply")),o&&n.a.createElement(V.a,{icon:"edit",onClick:f},z("Edit")),b&&n.a.createElement(V.a,{icon:"favorite",onClick:I},z("AddToFavorites")),p&&n.a.createElement(V.a,{icon:"favorite",onClick:S},z("Stickers.RemoveFromFavorites")),g&&D.map(e=>n.a.createElement(V.a,{key:e.label,icon:"copy",onClick:e.handler},z(e.label))),i&&n.a.createElement(V.a,{icon:"pin",onClick:j},z("DialogPin")),m&&n.a.createElement(V.a,{icon:"unpin",onClick:C},z("DialogUnpin")),h&&n.a.createElement(V.a,{icon:"forward",onClick:y},z("Forward")),v&&n.a.createElement(V.a,{icon:"select",onClick:w},z("Common.Select")),u&&n.a.createElement(V.a,{destructive:!0,icon:"delete",onClick:N},z("Delete")))};var Sn=Object(n.h)(Object(c.h)((e,{message:t,messageListType:a})=>{const{threadId:n}=Object(m.y)(e)||{},{noOptions:c,canReply:r,canPin:s,canUnpin:l,canDelete:o,canEdit:i,canForward:d,canFaveSticker:u,canUnfaveSticker:h,canCopy:b,canCopyLink:p,canSelect:g}=n&&Object(m.b)(e,t,n)||{},E="pinned"===a,v="scheduled"===a;return{noOptions:c,canSendNow:v,canReschedule:v,canReply:!E&&!v&&r,canPin:!v&&s,canUnpin:!v&&l,canDelete:o,canEdit:!E&&i,canForward:!v&&d,canFaveSticker:!v&&u,canUnfaveSticker:!v&&h,canCopy:b,canCopyLink:!v&&p,canSelect:g}},(e,t)=>Object(u.l)(t,["setReplyingToId","setEditingId","pinMessage","openForwardMenu","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","loadMessageLink"]))(({isOpen:e,messageListType:t,message:a,album:c,anchor:r,onClose:s,onCloseAnimationEnd:l,noOptions:o,canSendNow:i,canReschedule:m,canReply:d,canPin:u,canUnpin:h,canDelete:b,canEdit:p,canForward:g,canFaveSticker:E,canUnfaveSticker:v,canCopy:O,canCopyLink:f,canSelect:j,setReplyingToId:C,setEditingId:y,pinMessage:k,openForwardMenu:N,faveSticker:I,unfaveSticker:S,toggleMessageSelection:w,sendScheduledMessages:P,rescheduleMessage:M,loadMessageLink:F})=>{const{transitionClassNames:L}=Object(Q.a)(e,l,void 0,!1),[A,T]=Object(n.r)(!0),[D,B]=Object(n.r)(!1),[U,x]=Object(n.r)(!1),[G,q,z]=Object(Be.a)(),$=Object(n.m)(()=>{T(!1),B(!0)},[]),H=Object(n.m)(()=>{T(!1),s()},[s]),V=Object(n.m)(()=>{B(!1),s()},[s]),W=Object(n.m)(()=>{x(!1),s()},[s]),Y=Object(n.m)(()=>{z(),s()},[z,s]),K=Object(n.m)(()=>{C({messageId:a.id}),H()},[C,a.id,H]),Z=Object(n.m)(()=>{y({messageId:a.id}),H()},[y,a.id,H]),_=Object(n.m)(()=>{T(!1),x(!0)},[]),X=Object(n.m)(()=>{k({messageId:a.id,isUnpin:!0}),H()},[k,a.id,H]),J=Object(n.m)(()=>{if(H(),c&&c.messages){const e=c.messages.map(({id:e})=>e);N({fromChatId:a.chatId,messageIds:e})}else N({fromChatId:a.chatId,messageIds:[a.id]})},[N,a,H,c]),ee=Object(n.m)(()=>{H(),I({sticker:a.content.sticker})},[H,a.content.sticker,I]),te=Object(n.m)(()=>{H(),S({sticker:a.content.sticker})},[H,a.content.sticker,S]),ae=Object(n.m)(()=>{const e=c&&c.messages?{messageId:a.id,childMessageIds:c.messages.map(({id:e})=>e),withShift:!1}:{messageId:a.id,withShift:!1};w(e),H()},[H,a.id,w,c]),ne=Object(n.m)(()=>{P({chatId:a.chatId,id:a.id}),H()},[H,a.chatId,a.id,P]),ce=Object(n.m)(()=>{T(!1),q()},[q]),re=Object(n.m)(e=>{M({chatId:a.chatId,messageId:a.id,scheduledAt:Math.round(e.getTime()/1e3)})},[a.chatId,a.id,M]),se=Object(n.m)(()=>{F({messageId:a.id,chatId:a.chatId}),H()},[H,F,a.chatId,a.id]);if(Object(n.n)(()=>(On(),fn),[]),o)return void H();const le=new Date;return le.setFullYear(le.getFullYear()+1),n.a.createElement("div",{className:["ContextMenuContainer",L].join(" ")},n.a.createElement(In,{message:a,isOpen:A,anchor:r,canSendNow:i,canReschedule:m,canReply:d,canDelete:b,canPin:u,canUnpin:h,canEdit:p,canForward:g,canFaveSticker:E,canUnfaveSticker:v,canCopy:O,canCopyLink:f,canSelect:j,onReply:K,onEdit:Z,onPin:_,onUnpin:X,onForward:J,onDelete:$,onFaveSticker:ee,onUnfaveSticker:te,onSelect:ae,onSend:ne,onReschedule:ce,onClose:H,onCopyLink:se}),n.a.createElement(Ae,{isOpen:D,isSchedule:"scheduled"===t,onClose:V,album:c,message:a}),n.a.createElement(Te,{isOpen:U,messageId:a.id,chatId:a.chatId,onClose:W}),n.a.createElement(Le,{isOpen:G,withTimePicker:!0,selectedAt:1e3*a.date,maxAt:Object(R.k)(le),isFutureMode:!0,onClose:Y,onSubmit:re}))}));a(269);var wn=Object(n.h)(Object(c.h)((e,{fromSticker:t})=>({stickerSet:Object(m.tb)(e,t.stickerSetId)}),(e,t)=>Object(u.l)(t,["loadStickers","toggleStickerSet","sendMessage"]))(({isOpen:e,fromSticker:t,stickerSet:a,onClose:c,loadStickers:r,toggleStickerSet:s,sendMessage:o})=>{const i=Object(n.q)(null),{observe:m}=Object(sa.a)({rootRef:i,throttleMs:200,isDisabled:!e});Object(n.n)(()=>{if(e){const{stickerSetId:e,stickerSetAccessHash:a}=t;r({stickerSetId:e,stickerSetAccessHash:a})}},[e,t,r]);const d=Object(n.m)(e=>{e={...e,isPreloadedGlobally:!0},o({sticker:e}),c()},[c,o]),u=Object(n.m)(()=>{s({stickerSetId:t.stickerSetId}),c()},[t.stickerSetId,c,s]);return n.a.createElement(Ee.a,{className:"StickerSetModal",isOpen:e,onClose:c,hasCloseButton:!0,title:a?a.title:"Sticker Set"},a&&a.stickers?n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{ref:i,className:"stickers custom-scroll"},a.stickers.map(e=>n.a.createElement(ha,{sticker:e,size:l.lb,observeIntersection:m,onClick:d,clickArg:e}))),n.a.createElement("div",{className:"button-wrapper"},n.a.createElement(x.a,{size:"smaller",fluid:!0,color:a.installedDate?"danger":"primary",onClick:u},`${a.installedDate?"Remove":"Add"} ${a.count} stickers`))):n.a.createElement(ge.a,null))})),Pn=a(114);a(270);var Mn=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t);return!a||a.isRestricted?{}:{chat:a,isMuted:a.isMuted,isPrivate:Object(d.lb)(a.id),canDeleteChat:Object(d.d)(a)}},(e,t)=>Object(u.l)(t,["updateChatMutedState","enterMessageSelectMode"]))(({chatId:e,isOpen:t,anchor:a,isChannel:c,canSubscribe:r,canSearch:s,canMute:l,canSelect:i,canLeave:m,chat:d,isPrivate:u,isMuted:h,canDeleteChat:b,onSubscribeChannel:p,onSearchClick:g,onClose:E,onCloseAnimationEnd:v,updateChatMutedState:O,enterMessageSelectMode:f})=>{const[j,C]=Object(n.r)(!0),[y,k]=Object(n.r)(!1),{x:N,y:I}=a;Object(Q.a)(t,v,void 0,!1);const S=Object(n.m)(()=>{C(!1),k(!0)},[]),w=Object(n.m)(()=>{C(!1),E()},[E]),P=Object(n.m)(()=>{k(!1),E()},[E]),M=Object(n.m)(()=>{O({chatId:e,isMuted:!h}),w()},[e,w,h,O]),F=Object(n.m)(()=>{p(),w()},[w,p]),L=Object(n.m)(()=>{g(),w()},[w,g]),A=Object(n.m)(()=>{f(),w()},[w,f]);Object(n.n)(()=>(On(),fn),[]);const D=Object(T.a)();return n.a.createElement(Pn.a,null,n.a.createElement("div",{className:"HeaderMenuContainer"},n.a.createElement(Nn.a,{isOpen:j,positionX:"right",style:`left: ${N}px;top: ${I}px;`,onClose:w},o.f&&r&&n.a.createElement(V.a,{icon:c?"channel":"group",onClick:F},D(c?"Subscribe":"Join Group")),o.f&&s&&n.a.createElement(V.a,{icon:"search",onClick:L},D("Search")),l&&n.a.createElement(V.a,{icon:h?"unmute":"mute",onClick:M},D(h?"ChatsUnmute":"ChatsMute")),i&&n.a.createElement(V.a,{icon:"select",onClick:A},D("ReportSelectMessages")),m&&n.a.createElement(V.a,{destructive:!0,icon:"delete",onClick:S},D(u?"Delete":b?"Delete and Leave":"Leave"))),d&&n.a.createElement($e.a,{isOpen:y,onClose:P,chat:d})))})),Fn=a(143);a(271);const Ln=Object(K.a)(e=>e(),200,!1);var An=Object(n.h)(Object(c.h)(e=>{const t=Object(m.r)(e);if(!t)return{};const{query:a,results:n}=Object(m.A)(e)||{},{totalCount:c,foundIds:r}=n||{};return{chat:t,query:a,totalCount:c,foundIds:r}},(e,t)=>Object(u.l)(t,["setLocalTextSearchQuery","searchTextMessagesLocal","focusMessage","closeLocalTextSearch","searchMessagesByDate"]))(({isActive:e,chat:t,query:a,totalCount:c,foundIds:r,setLocalTextSearchQuery:s,searchTextMessagesLocal:l,focusMessage:o,closeLocalTextSearch:i,searchMessagesByDate:m})=>{const d=Object(n.q)(null),[u,h]=Object(n.r)(0),[b,p,g]=Object(Be.a)();Object(n.n)(()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),a=()=>{const{activeElement:a}=document;if(a&&a===d.current){const{pageTop:a,height:n}=e;t.style.transform=`translateY(${a}px)`,t.style.height=n+"px",document.documentElement.scrollTop=a}else t.style.transform="",t.style.height=""};return e.addEventListener("resize",a),()=>{e.removeEventListener("resize",a)}},[]),Object(n.n)(()=>{t&&r&&r.length?(o({chatId:t.id,messageId:r[r.length-1]}),h(0)):h(-1)},[t,o,r]),Object(n.n)(()=>{Array.from(document.querySelectorAll("input")).forEach(t=>{t.disabled=Boolean(e&&t!==d.current)}),Array.from(document.querySelectorAll("div[contenteditable]")).forEach(t=>{t.contentEditable=e?"false":"true"})},[e]),Object(n.n)(()=>{e||d.current.blur()},[e]),Object(n.o)(()=>{document.querySelector("#MobileSearch input").blur()},[b]);const E=Object(n.m)(e=>{s({query:e}),e.length&&Ln(l)},[l,s]),v=Object(n.m)(e=>{m({timestamp:e.valueOf()/1e3}),g()},[g,m]),O=Object(n.m)(()=>{if(t&&r){const e=u+1;o({chatId:t.id,messageId:r[r.length-1-e]}),h(e)}},[t,u,o,r]),f=Object(n.m)(()=>{if(t&&r){const e=u-1;o({chatId:t.id,messageId:r[r.length-1-e]}),h(e)}},[t,u,o,r]),j=Object(T.a)();return n.a.createElement("div",{id:"MobileSearch",className:e?"active":""},n.a.createElement("div",{className:"header"},n.a.createElement(x.a,{size:"smaller",round:!0,color:"translucent",onClick:i},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement(Fn.a,{ref:d,value:a,onChange:E})),n.a.createElement("div",{className:"footer"},n.a.createElement("div",{className:"counter"},a?r&&r.length?`${u+1} of ${c}`:r&&!r.length?"No results":"":n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",onClick:p,ariaLabel:"Search messages by date"},n.a.createElement("i",{className:"icon-calendar"}))),n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",onClick:O,disabled:!r||!r.length||u===r.length-1},n.a.createElement("i",{className:"icon-up"})),n.a.createElement(x.a,{round:!0,size:"smaller",color:"translucent",onClick:f,disabled:!r||!r.length||0===u},n.a.createElement("i",{className:"icon-down"}))),n.a.createElement(Le,{isOpen:b,isPastMode:!0,submitButtonLabel:j("JumpToDate"),onClose:g,onSubmit:v}))})),Tn=a(53),Dn=a(179),Bn=a(168),Un=a(172);var xn=function(e,t){const a=e.scrollTop,n=a+e.offsetHeight,c=t.offsetTop,r=c+t.offsetHeight;return c>a&&r<n},Rn=a(115),Gn=a(133);a(272);var qn=Object(n.h)(({isOpen:e,filter:t,onClose:a,onInsertUserName:c,usersById:r,filteredChatMembers:s})=>{const l=Object(n.q)(null),{shouldRender:o,transitionClassNames:i}=Object(Q.a)(e,void 0,void 0,!1),m=Object(n.m)(e=>{if(!s)return-1;const t=s.length;return Object(Gn.a)(t,e)},[s]),[d,u]=Object(n.r)(-1),h=Object(n.m)((e,t)=>{t.preventDefault(),u(t=>m(t+e))},[u,m]),b=Object(n.m)((e,t=!1)=>{const a=r&&r[e];a&&c(a,t)},[r,c]),p=Object(n.m)(e=>{if(s&&s.length&&d>-1){const t=s[d];t&&(e.preventDefault(),b(t.userId,!0))}},[s,d,b]);Object(n.n)(()=>e?Object(Ue.a)({onEsc:a,onUp:e=>h(-1,e),onDown:e=>h(1,e),onEnter:p,onTab:p}):void 0,[e,a,h,p]),Object(n.n)(()=>{s&&!s.length&&a()},[s,a]),Object(n.n)(()=>{u(0)},[t]),Object(n.n)(()=>{!function(e,t){const a=t.current;if(!a||e<0)return;const{visibleIndexes:n,allElements:c}=function(e,t,a=0,n=!1,c=!1){const r=e.scrollTop,s=r+e.offsetHeight,l="string"==typeof t?e.querySelectorAll(t):t,{length:o}=l,i=[];let m=!1;for(let e=0;e<o;e++){const t=l[e],o=t.offsetTop,d=o+t.offsetHeight;if(c?d>=r-a&&d<=s+a:o<=s+a&&d>=r-a)i.push(e),m=!0;else if(m&&!n)break}return{allElements:l,visibleIndexes:i}}(a,".chat-item-clickable",8,!0,!0);if(!c.length||!c[e])return;const r=n[0];if(!n.includes(e)||e===r&&!xn(a,c[r])){const t=e>n[n.length-1]?"start":"end";Object(Rn.a)(a,c[e],t,10)}}(d,l)},[d]);const g=Object(y.a)(s&&s.length?s:void 0,o),E=s&&!s.length?g:s;if(!o||E&&!E.length)return;const v=Object(le.a)("MentionMenu custom-scroll",i);return n.a.createElement("div",{className:v,ref:l},E&&E.map(({userId:e},t)=>n.a.createElement(fe.a,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>b(e),focus:d===t},n.a.createElement(je.a,{userId:e,avatarSize:"small",withHandle:!0}))))});a(273);var zn=Object(n.h)(({attachments:e,caption:t,canSuggestMembers:a,groupChatMembers:c,currentUserId:r,usersById:s,onCaptionUpdate:o,onSend:i,onClear:m})=>{const d=Object(y.a)(e),u=e.length?e:d,h=Boolean(e.length),{isMentionMenuOpen:p,mentionFilter:g,closeMentionMenu:E,insertMention:v,mentionFilteredMembers:O}=Object(Dn.a)(a&&h,t,o,l.s,c,r,s);Object(n.n)(()=>h?Object(b.a)(m):void 0,[h,m]);const f=Object(n.m)(()=>{h&&i()},[h,i]),j=Object(T.a)();if(!u)return;const C=u.every(e=>e.mimeType.startsWith("image/")),k=u.every(e=>e.mimeType.startsWith("video/"));let N="";N=C?1===u.length?"Send Photo":`Send ${u.length} Photos`:k?1===u.length?"Send Video":`Send ${u.length} Videos`:1===u.length?"Send File":`Send ${u.length} Files`;const I=u.every(e=>e.quick);return n.a.createElement(Ee.a,{isOpen:h,onClose:m,header:function(){if(u)return n.a.createElement("div",{className:"modal-header-condensed"},n.a.createElement(x.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:m},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("div",{className:"modal-title"},N),n.a.createElement(x.a,{color:"primary",size:"smaller",className:"modal-action-button",onClick:f},j("Send")))}(),className:"AttachmentModal"},I?n.a.createElement("div",{className:"media-wrapper custom-scroll"},u.map(e=>e.mimeType.startsWith("image/")?n.a.createElement("img",{src:e.blobUrl,alt:""}):n.a.createElement("video",{src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0}))):n.a.createElement("div",{className:"document-wrapper custom-scroll"},u.map(e=>n.a.createElement(Bn.a,{name:e.filename,extension:Object(Tn.d)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0}))),n.a.createElement("div",{className:"attachment-caption-wrapper"},n.a.createElement(qn,{isOpen:p,onClose:E,filter:g,onInsertUserName:v,filteredChatMembers:O,usersById:s}),n.a.createElement(Un.a,{id:"caption-input-text",html:t,editableInputId:l.s,placeholder:j("Caption"),onUpdate:o,onSend:i,shouldSetFocus:h})))}),$n=a(123);a(274);var Hn=Object(n.h)(({isOpen:e,onSend:t,onClear:a})=>{const c=Object(n.q)(null),r=Object(n.q)(null),s=Object(n.q)(null),[l,o]=Object(n.r)(""),[i,m]=Object(n.r)([""]),[d,u]=Object(n.r)(!0),[h,p]=Object(n.r)(!1),[g,E]=Object(n.r)(!1),[v,O]=Object(n.r)(),[f,j]=Object(n.r)(),[C,y]=Object(n.r)(!1),k=Object(n.m)(t=>{e&&t.current&&t.current.focus()},[e]);Object(n.n)(()=>e?Object(b.a)(a):void 0,[e,a]),Object(n.n)(()=>{e||(o(""),m([""]),u(!0),p(!1),E(!1),O(""),j(""),y(!1))},[e]),Object(n.n)(()=>k(c),[k,e]),Object(n.o)(()=>{const e=s.current;e&&v!==e.innerHTML&&(e.innerHTML=v)},[v]);const N=Object(n.m)((e=[])=>{m([...e,""]),requestAnimationFrame(()=>{const e=r.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))})},[]),I=Object(n.m)(()=>{if(y(!1),!e)return;const a=l.trim().substring(0,255),n=i.map(e=>e.trim().substring(0,100)).filter(e=>e.length);if(!a||n.length<2)return o(a),n.length?n.length<2?N(n):m(n):N(),void y(!0);if(g&&(!f||!n[Number(f)]))return void y(!0);const c={summary:{question:a,answers:n.map((e,t)=>({text:e.trim(),option:String(t),...String(t)===f&&{correct:!0}})),...!d&&{isPublic:!0},...h&&{multipleChoice:!0},...g&&{quiz:!0}}};if(g){const{text:e,entities:t}=v&&Object($n.a)(v.substring(0,200))||{};c.quiz={correctAnswers:[f],...e&&{solution:e},...t&&{solutionEntities:t}}}t(c)},[e,l,i,g,f,d,h,t,N,v]),S=Object(n.m)((e,t)=>{const a=[...i];a[e]=t,a[a.length-1].trim().length&&a.length<10?N(a):m(a)},[i,N]),w=Object(n.m)(e=>{const t=[...i];t.splice(e,1),m(t),requestAnimationFrame(()=>{r.current&&r.current.classList.toggle("overflown",r.current.scrollHeight>320)})},[i]),P=Object(n.m)(e=>{j(e)},[j]),M=Object(n.m)(e=>{u(e.target.checked)},[]),F=Object(n.m)(e=>{p(e.target.checked)},[]),L=Object(n.m)(e=>{E(e.target.checked)},[]),A=Object(n.m)(e=>{13===e.keyCode&&I()},[I]),D=Object(n.m)(()=>{if(C&&!l.trim().length)return"Please enter the question"},[C,l]),B=Object(n.m)(e=>{const t=i.map(e=>e.trim()).filter(e=>e.length);if(C&&t.length<2&&!i[e].trim().length)return"Please enter at least two options"},[C,i]),U=Object(T.a)();function R(){return i.map((e,t)=>n.a.createElement("div",{className:"option-wrapper"},n.a.createElement(ve.a,{label:t!==i.length-1||10===i.length?"Option "+(t+1):"Add an Option",error:B(t),value:e,onChange:e=>S(t,e.currentTarget.value),onKeyPress:A}),t!==i.length-1&&n.a.createElement(x.a,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:"Remove option",onClick:()=>w(t)},n.a.createElement("i",{className:"icon-close"}))))}return n.a.createElement(Ee.a,{isOpen:e,onClose:a,header:n.a.createElement("div",{className:"modal-header-condensed"},n.a.createElement(x.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:a},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("div",{className:"modal-title"},U("NewPoll")),n.a.createElement(x.a,{color:"primary",size:"smaller",className:"modal-action-button",onClick:I},U("Create"))),className:"PollModal"},n.a.createElement(ve.a,{ref:c,label:U("AskAQuestion"),value:l,error:D(),onChange:e=>o(e.currentTarget.value),onKeyPress:A}),n.a.createElement("div",{className:"options-divider"}),n.a.createElement("div",{className:"options-list custom-scroll",ref:r},n.a.createElement("h3",{className:"options-header"},"Options"),C&&function(){const e=i.map(e=>e.trim()).filter(e=>e.length);return g&&(!f||!e[Number(f)])&&n.a.createElement("p",{className:"error"},"Please choose the correct answer")}(),g?n.a.createElement(oa.a,{name:"correctOption",options:R().map((e,t)=>({value:String(t),label:e,hidden:t===i.length-1})),onChange:P}):R()),n.a.createElement("div",{className:"options-divider"}),n.a.createElement("div",{className:"quiz-mode"},n.a.createElement(aa.a,{label:U("PollAnonymous"),checked:d,onChange:M}),n.a.createElement(aa.a,{label:U("PollMultiple"),checked:h,disabled:g,onChange:F}),n.a.createElement(aa.a,{label:U("PollQuiz"),checked:g,disabled:h,onChange:L}),g&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h3",{className:"options-header"},"Solution"),n.a.createElement("div",{ref:s,className:"form-control",contentEditable:!0,onChange:e=>O(e.currentTarget.innerHTML)}),n.a.createElement("div",{className:"note"},"Users will see this comment after choosing a wrong answer, good for educational purposes."))))});let Vn;function Wn(e,t,a=250){const c=Object(n.q)(!1);Object(n.n)(()=>{Vn&&(clearTimeout(Vn),Vn=void 0),e&&!o.k&&(Vn=window.setTimeout(()=>{c.current||t()},2*a))},[e,a,t]);return[Object(n.m)(()=>{c.current=!0},[]),Object(n.m)(()=>{c.current=!1,Vn&&(clearTimeout(Vn),Vn=void 0),Vn=window.setTimeout(()=>{c.current||t()},a)},[a,t])]}var Yn=a(67),Kn=a(144);a(275);var Zn=Object(n.h)(({emoji:e,onClick:t})=>{const a=Object(n.m)(()=>{t(e.native,e.id)},[e,t]);return n.a.createElement("div",{className:"EmojiButton",onClick:a,title:e.colons},o.c?e.native:n.a.createElement("img",{src:`/img-apple-64/${e.image}.png`,alt:"",loading:"lazy"}))});var Qn=Object(n.h)(({category:e,index:t,allEmojis:a,observeIntersection:c,shouldRender:r,onEmojiSelect:s})=>{const l=Object(n.q)(null);Object(sa.c)(l,c);const{transitionClassNames:i}=Object(Q.a)(r,void 0,void 0,"slow"),m=Object(T.a)(),d=o.f?Math.floor((I.a.get().width-8)/44):9,u=44*Math.ceil(e.emojis.length/d);return n.a.createElement("div",{ref:l,key:e.id,id:"emoji-category-"+t,className:"symbol-set"},n.a.createElement("p",{className:"symbol-set-name"},m("recent"===e.id?"RecentStickers":"Emoji"+t)),n.a.createElement("div",{className:Object(le.a)("symbol-set-container",i),style:`height: ${u}px;`},r&&e.emojis.map(e=>{const t=a[e],c="id"in t?t:t[1];return n.a.createElement(Zn,{key:c.id,emoji:c,onClick:s})})))});a(276);const _n={recent:"icon-recent",people:"icon-smile",nature:"icon-animals",foods:"icon-eats",activity:"icon-sport",places:"icon-car",objects:"icon-lamp",symbols:"icon-language",flags:"icon-flag"},Xn=[];let Jn,ec,tc;var ac=Object(n.h)(Object(c.h)(e=>Object(u.l)(e,["recentEmojis"]),(e,t)=>Object(u.l)(t,["addRecentEmoji"]))(({className:e,onEmojiSelect:t,recentEmojis:c,addRecentEmoji:r})=>{const s=Object(n.q)(null),i=Object(n.q)(null),[m,d]=Object(n.r)(),[u,h]=Object(n.r)(),[b,p]=Object(n.r)(0),{observe:g}=Object(sa.a)({rootRef:s,throttleMs:200},e=>{e.forEach(e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const a=Number(t.replace("emoji-category-",""));Xn[a]=e.isIntersecting});const t=Xn.map((e,t)=>({index:t,isIntersecting:e})).filter(({isIntersecting:e})=>e);t.length&&p(t[Math.floor(t.length/2)].index)});Object(Ve.a)(i,!o.f),Object(n.n)(()=>{if(!m)return;const e=i.current;if(!e)return;const t=42*b-e.offsetWidth/2+21;Object(Kn.a)(e,t)},[m,b]);const E=Object(T.a)(),v=Object(n.p)(()=>{if(!m)return qe.a;const e=[...m];return c&&c.length&&e.unshift({id:"recent",name:E("RecentStickers"),emojis:c}),e},[m,E,c]);Object(n.n)(()=>{setTimeout(()=>{const e=()=>{d(tc.categories),h(tc.emojis)};tc?e():async function(){Jn||(Jn=a.e(9).then(a.t.bind(null,305,3)),ec=(await Jn).default,tc=Object(Yn.b)(ec));return Jn}().then(e)},200)},[]);const O=Object(n.m)(e=>{p(e);const t=document.getElementById("emoji-category-"+e);Object(Rn.a)(s.current,t,"start",50,800)},[]),f=Object(n.m)((e,a)=>{t(e),r({emoji:a})},[r,t]),j=Object(ot.a)([],l.L);const C=Object(le.a)("EmojiPicker",e);return u&&j?n.a.createElement("div",{className:C},n.a.createElement("div",{ref:i,className:"EmojiPicker-header"},v.map((function(e,t){const a=_n[e.id];return a&&n.a.createElement(x.a,{className:"symbol-set-button "+(t===b?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>O(t),ariaLabel:e.name},n.a.createElement("i",{className:a}))}))),n.a.createElement("div",{ref:s,className:"EmojiPicker-main no-selection no-scrollbar"},v.map((e,t)=>n.a.createElement(Qn,{category:e,index:t,allEmojis:u,observeIntersection:g,shouldRender:b>=t-1&&b<=t+1,onEmojiSelect:f})))):n.a.createElement("div",{className:C},n.a.createElement(ge.a,null))}));const nc=o.f?8:16;var cc=Object(n.h)(({stickerSet:e,loadAndPlay:t,index:a,observeIntersection:c,shouldRender:r,onStickerSelect:s,onStickerUnfave:i})=>{const m=Object(n.q)(null);Object(sa.c)(m,c);const{transitionClassNames:d}=Object(Q.a)(r,void 0,void 0,"slow"),u=o.f?Math.floor((I.a.get().width-8)/(l.mb+nc)):5,h=Math.ceil(e.count/u)*(l.mb+nc);return n.a.createElement("div",{ref:m,key:e.id,id:"sticker-set-"+a,className:"symbol-set"},n.a.createElement("p",{className:"symbol-set-name"},e.title),n.a.createElement("div",{className:Object(le.a)("symbol-set-container",d),style:`height: ${h}px;`},r&&e.stickers&&e.stickers.map(a=>n.a.createElement(ha,{key:a.id,sticker:a,size:l.mb,observeIntersection:c,noAnimate:!t,onClick:s,clickArg:a,onUnfaveClick:"favorite"===e.id?i:void 0}))))});a(277);const rc=[];var sc=Object(n.h)(Object(c.h)(e=>{const{setsById:t,added:a,recent:n,favorite:c}=e.stickers;return{recentStickers:n.stickers,favoriteStickers:c.stickers,stickerSetsById:t,addedSetIds:a.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers}},(e,t)=>Object(u.l)(t,["loadStickerSets","loadRecentStickers","loadFavoriteStickers","loadAddedStickers","addRecentSticker","unfaveSticker"]))(({className:e,loadAndPlay:t,canSendStickers:a,recentStickers:c,favoriteStickers:r,addedSetIds:s,stickerSetsById:o,shouldPlay:i,onStickerSelect:m,loadStickerSets:d,loadRecentStickers:u,loadFavoriteStickers:h,loadAddedStickers:b,addRecentSticker:p,unfaveSticker:g})=>{const E=Object(n.q)(null),v=Object(n.q)(null),[O,f]=Object(n.r)(0),{observe:j}=Object(sa.a)({rootRef:E,throttleMs:200},e=>{e.forEach(e=>{const{id:t}=e.target;if(!t||!t.startsWith("sticker-set-"))return;const a=Number(t.replace("sticker-set-",""));rc[a]=e.isIntersecting});const t=rc.map((e,t)=>({index:t,isIntersecting:e})).filter(({isIntersecting:e})=>e);t.length&&f(t[Math.floor(t.length/2)].index)}),{observe:C}=Object(sa.a)({rootRef:v}),y=Object(T.a)(),k=Boolean(s),N=Object(n.p)(()=>s?[{id:"recent",title:y("RecentStickers"),stickers:c,count:c.length},{id:"favorite",title:y("FavoriteStickers"),stickers:r,count:r.length},...s.map(e=>o[e]).filter(Boolean)]:qe.a,[s,y,c,r,o]),I=Object(n.p)(()=>k&&0===N.filter(e=>e.stickers&&e.stickers.length).length,[N,k]);Object(n.n)(()=>{t&&(d(),u(),h())},[t,h,u,d]),Object(n.n)(()=>{s&&s.length&&b()},[s,b]),Object(Ve.a)(v),Object(n.n)(()=>{if(!k)return;const e=v.current;if(!e)return;const t=52*O-(e.offsetWidth/2-26);Object(Kn.a)(e,t)},[k,O]);const S=Object(n.m)(e=>{f(e);const t=document.getElementById("sticker-set-"+e);Object(Rn.a)(E.current,t,"start",void 0,500)},[]),w=Object(n.m)(e=>{m(e),p({sticker:e})},[p,m]),P=Object(n.m)(e=>{g({sticker:e})},[g]),M=Object(ot.a)([],l.db);const F=Object(le.a)("StickerPicker",e);return k&&M&&!I&&a?n.a.createElement("div",{className:F},n.a.createElement("div",{ref:v,className:"StickerPicker-header no-selection no-scrollbar"},N.map((function(e,t){const a=e.stickers&&e.stickers[0],c=Object(le.a)("symbol-set-button sticker-set-button",t===O&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!a?n.a.createElement(x.a,{key:e.id,className:c,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>S(t)},"recent"===e.id?n.a.createElement("i",{className:"icon-recent"}):"favorite"===e.id?n.a.createElement("i",{className:"icon-favorite"}):e.isAnimated?n.a.createElement(da,{stickerSet:e,observeIntersection:C}):n.a.createElement(ua,{stickerSet:e,observeIntersection:C})):n.a.createElement(ha,{key:e.id,sticker:a,size:l.nb,title:e.title,className:c,observeIntersection:C,onClick:S,clickArg:t})}))),n.a.createElement("div",{ref:E,className:"StickerPicker-main no-scrollbar"},N.map((e,a)=>n.a.createElement(cc,{key:e.id,stickerSet:e,loadAndPlay:Boolean(i&&t),index:a,observeIntersection:j,shouldRender:O>=a-1&&O<=a+1,onStickerSelect:w,onStickerUnfave:P})))):n.a.createElement("div",{className:F},a?I?n.a.createElement("div",{className:"picker-disabled"},"You have no saved Stickers."):n.a.createElement(ge.a,null):n.a.createElement("div",{className:"picker-disabled"},"Sending stickers is not allowed in this chat."))}));a(278);function lc(){return(lc=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}var oc=Object(n.h)(({gif:e,observeIntersection:t,isDisabled:a,onClick:c})=>{const s=Object(n.q)(null),l=Object(n.q)(null),o="gif"+e.id,i=Object(sa.b)(s,t)&&!a,m=Object(E.a)(o+"?size=m",!i,r.ApiMediaFormat.BlobUrl),d=Object(j.a)(e.thumbnail&&e.thumbnail.dataUri,Boolean(m)),u=m||d,h=Object(E.a)(o,!i,r.ApiMediaFormat.BlobUrl),b=Boolean(i&&h),{transitionClassNames:p}=Object(ia.a)(u||h,"slow"),{isBuffered:g,bufferingHandlers:v}=Object(_.a)(!0),O=i&&!g;Object(J.a)(l,[b]);const f=Object(n.m)(()=>c({...e,blobUrl:h}),[c,e,h]),C=Object(le.a)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",p,o);return n.a.createElement("div",{ref:s,className:C,onClick:f},u&&!b&&n.a.createElement("div",{className:"preview",style:`background-image: url(${u});`}),b&&n.a.createElement("video",lc({ref:l,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none",poster:u},v),n.a.createElement("source",{src:h})),O&&n.a.createElement(D.a,{color:u?"white":"black"}))});a(279);var ic=Object(n.h)(Object(c.h)(e=>({savedGifs:e.gifs.saved.gifs}),(e,t)=>Object(u.l)(t,["loadSavedGifs"]))(({className:e,loadAndPlay:t,canSendGifs:a,savedGifs:c,onGifSelect:r,loadSavedGifs:s})=>{const o=Object(n.q)(null),{observe:i}=Object(sa.a)({rootRef:o,debounceMs:300});Object(n.n)(()=>{t&&s()},[t,s]);const m=Object(ot.a)([],l.db);return n.a.createElement("div",{ref:o,className:Object(le.a)("GifPicker no-scrollbar",e)},a?m&&c&&c.length?c.map(e=>n.a.createElement(oc,{key:e.id,gif:e,observeIntersection:i,isDisabled:!t,onClick:r})):m&&c?n.a.createElement("div",{className:"picker-disabled"},"No saved GIFs."):n.a.createElement(ge.a,null):n.a.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))}));let mc;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(mc||(mc={}));const dc=Object.values(mc).filter(e=>"string"==typeof e),uc={[mc.Emoji]:"icon-smile",[mc.Stickers]:"icon-stickers",[mc.GIFs]:"icon-gifs"};var hc=Object(n.h)(({activeTab:e,onSwitchTab:t,onRemoveSymbol:a,onSearchOpen:c})=>{function r(a){return n.a.createElement(x.a,{className:"symbol-tab-button "+(e===a?"activated":""),onClick:()=>t(a),ariaLabel:dc[a],round:!0,faded:!0,color:"translucent"},n.a.createElement("i",{className:uc[a]}))}const s=Object(n.m)(()=>{c(e===mc.Stickers?"stickers":"gifs")},[e,c]);return n.a.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()}},e!==mc.Emoji&&n.a.createElement(x.a,{className:"symbol-search-button",ariaLabel:e===mc.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:s},n.a.createElement("i",{className:"icon-search"})),r(mc.Emoji),r(mc.Stickers),r(mc.GIFs),e===mc.Emoji&&n.a.createElement(x.a,{className:"symbol-delete-button",onClick:a,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},n.a.createElement("i",{className:"icon-delete-left"})))});a(280);let bc=!1;var pc=Object(n.h)(({isOpen:e,allowedAttachmentOptions:t,onLoad:a,onClose:c,onEmojiSelect:r,onStickerSelect:s,onGifSelect:l,onRemoveSymbol:i,onSearchOpen:m})=>{const[d,u]=Object(n.r)(0),[h,b]=Wn(e,c),{shouldRender:p,transitionClassNames:g}=Object(Q.a)(e,c,!1,!1);!bc&&e&&(bc=!0),Object(n.n)(()=>{a()},[a]),Object(n.o)(()=>{if(o.f)return e&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{e&&Object(K.b)(()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout(()=>{document.body.classList.remove("enable-symbol-menu-transforms")},350)})}},[e]);const E=Object(n.m)(e=>{c(),m(e)},[c,m]),v=Object(T.a)(),{canSendStickers:O,canSendGifs:f}=t;function j(t,a){switch(d){case mc.Emoji:return n.a.createElement(ac,{className:"picker-tab",onEmojiSelect:r});case mc.Stickers:return n.a.createElement(sc,{className:"picker-tab",loadAndPlay:!!O&&(e&&(t||a)),canSendStickers:O,onStickerSelect:s});case mc.GIFs:return n.a.createElement(ic,{className:"picker-tab",loadAndPlay:!!f&&(e&&(t||a)),canSendGifs:f,onGifSelect:l})}}const C=n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},bc&&n.a.createElement(U.a,{name:"slide",activeKey:d,renderCount:dc.length},j)),o.f&&n.a.createElement(x.a,{round:!0,faded:!0,color:"translucent",ariaLabel:v("Close"),className:"symbol-close-button",size:"tiny",onClick:c},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(hc,{activeTab:d,onSwitchTab:u,onRemoveSymbol:i,onSearchOpen:E}));if(o.f){if(!p)return;const e=Object(le.a)("SymbolMenu mobile-menu",g);return n.a.createElement(Pn.a,null,n.a.createElement("div",{className:e},C))}return n.a.createElement(Nn.a,{isOpen:e,positionX:"left",positionY:"bottom",onClose:c,className:"SymbolMenu",onCloseAnimationEnd:c,onMouseEnter:o.k?void 0:h,onMouseLeave:o.k?void 0:b,noCloseOnBackdrop:!o.k},C)});a(281);var gc=Object(n.h)(({isOpen:e,allowedAttachmentOptions:t,onFileSelect:a,onPollCreate:c,onClose:r})=>{const[s,i]=Wn(e,r),m=Object(n.m)((e,t)=>{const{files:n}=e.target;n&&n.length>0&&a(Array.from(n),t)},[a]),d=Object(n.m)(()=>{fa(l.k,e=>m(e,!0))},[m]),u=Object(n.m)(()=>{fa("*",e=>m(e,!1))},[m]),h=Object(T.a)(),{canAttachMedia:b,canAttachPolls:p}=t;return n.a.createElement(Nn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:r,className:"AttachMenu fluid",onCloseAnimationEnd:r,onMouseEnter:o.k?void 0:s,onMouseLeave:o.k?void 0:i,noCloseOnBackdrop:!o.k},!b&&n.a.createElement(V.a,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),b&&n.a.createElement(n.a.Fragment,null,n.a.createElement(V.a,{icon:"photo",onClick:d},h("AttachmentMenu.PhotoOrVideo")),n.a.createElement(V.a,{icon:"document",onClick:u},"Document")),p&&n.a.createElement(V.a,{icon:"poll",onClick:c},h("Poll")))});a(282);var Ec=Object(n.h)(Object(c.h)(e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}},(e,t)=>Object(u.l)(t,["clearStickersForEmoji"]))(({isOpen:e,onStickerSelect:t,stickers:a,clearStickersForEmoji:c})=>{const r=Object(n.q)(null),{shouldRender:s,transitionClassNames:i}=Object(Q.a)(e,void 0,void 0,!1),m=Object(y.a)(a,!0),d=a||m,{observe:u}=Object(sa.a)({rootRef:r,throttleMs:200});Object(n.n)(()=>e?Object(b.a)(c):void 0,[e,c]);const h=Object(le.a)("EmojiTooltip custom-scroll",i);return n.a.createElement("div",{ref:r,className:h,onMouseEnter:o.k?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:o.k?void 0:()=>{document.body.classList.remove("no-select")}},s&&d?d.map(e=>n.a.createElement(ha,{key:e.id,sticker:e,size:l.mb,observeIntersection:u,onClick:t,clickArg:e})):s?n.a.createElement(ge.a,null):void 0)}));a(283);var vc=Object(n.h)(Object(c.h)((e,{messageId:t})=>{const{chatId:a}=Object(m.y)(e)||{};return a?{message:Object(m.k)(e,a,t)}:{}},(e,t)=>Object(u.l)(t,["clickInlineButton"]))(({isOpen:e,message:t,onClose:a,clickInlineButton:c})=>{const[r,s]=Wn(e,a);if(t&&t.keyboardButtons)return n.a.createElement(Nn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:a,className:"KeyboardMenu",onCloseAnimationEnd:a,onMouseEnter:o.k?void 0:r,onMouseLeave:o.k?void 0:s,noCloseOnBackdrop:!o.k},n.a.createElement("div",{className:"content"},t.keyboardButtons.map(e=>n.a.createElement("div",{className:"row"},e.map(e=>n.a.createElement(x.a,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>c({button:e})},e.text))))))}));a(284);var Oc=Object(n.h)(({isOpen:e,onSilentSend:t,onScheduleSend:a,onClose:c,onCloseAnimationEnd:r})=>{const[s,l]=Wn(e,c),i=Object(T.a)();return n.a.createElement(Nn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",className:"CustomSendMenu",onClose:c,onCloseAnimationEnd:r,onMouseEnter:o.k?void 0:s,onMouseLeave:o.k?void 0:l,noCloseOnBackdrop:!o.k},t&&n.a.createElement(V.a,{icon:"mute",onClick:t},i("SendWithoutSound")),a&&n.a.createElement(V.a,{icon:"schedule",onClick:a},i("ScheduleMessage")))}),fc=a(124),jc=a(153),Cc=a(161);a(285);var yc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),n=a&&Object(m.m)(e,a.id);if(!a||!n)return{};const{query:c,results:r}=Object(m.A)(e)||{},{totalCount:s,foundIds:l}=r||{};return{chat:a,messagesById:n,query:c,totalCount:s,foundIds:l}},(e,t)=>Object(u.l)(t,["searchTextMessagesLocal","focusMessage"]))(({chatId:e,threadId:t,chat:a,messagesById:r,query:s,totalCount:l,foundIds:o,searchTextMessagesLocal:i,focusMessage:h})=>{const b=Object(n.p)(()=>{if(!(s&&o&&o.length&&r))return qe.a;const n=o.map(n=>{const s=r[n];if(!s)return;const l=s.senderId?Object(m.Cb)(Object(c.e)(),s.senderId):void 0;let o;if(a&&Object(d.jb)(a))o=a;else if(s.forwardInfo){const{isChannelPost:e,fromChatId:t}=s.forwardInfo;o=e&&t?Object(m.f)(Object(c.e)(),t):void 0}else o=s.senderId?Object(m.f)(Object(c.e)(),s.senderId):void 0;return{message:s,senderUser:l,senderChat:o,onClick:()=>h({chatId:e,threadId:t,messageId:n})}}).filter(Boolean);return Object(u.k)(n,({message:e})=>e.date,"desc")},[e,t,h,o,a,r,s]);return n.a.createElement(Oe.a,{className:"RightSearch custom-scroll",items:b,preloadBackwards:0,onLoadMore:i,noFastList:!0},n.a.createElement("p",{className:"helper-text"},s?1===l?"1 message found":(b.length&&(l||b.length)||"No")+" messages found":"Search messages"),b.map(({message:e,senderUser:t,senderChat:a,onClick:c})=>{const r=a?Object(d.l)(a):Object(d.Z)(t),l=Object(d.M)(e);return n.a.createElement(fe.a,{className:"chat-item-clickable search-result-message m-0",onClick:c},n.a.createElement(q.a,{chat:a,user:t}),n.a.createElement("div",{className:"info"},n.a.createElement("div",{className:"title"},n.a.createElement("h3",null,r&&Object(G.a)(r)),n.a.createElement(Cc.a,{message:e})),n.a.createElement("div",{className:"subtitle"},Object(G.a)(l,["emoji","highlight"],{highlight:s}))))}))}));var kc=Object(n.h)(Object(c.h)((e,{stickerSetId:t})=>({set:Object(m.tb)(e,t),shouldPlay:Object(m.sb)(e)}),(e,t)=>Object(u.l)(t,["loadStickers","toggleStickerSet"]))(({stickerSetId:e,observeIntersection:t,set:a,shouldPlay:c,loadStickers:r,toggleStickerSet:s,isSomeModalOpen:o,onModalToggle:i})=>{const m=a&&Boolean(a.installedDate),d=Boolean(a&&a.stickers),[u,h,b]=Object(Be.a)();Object(f.a)(()=>{i(u)},[u,i]);const p=Object(n.p)(()=>{if(!a)return[];const e=(a.covers||[]).map(({id:e})=>e),t=a.stickers?a.stickers.filter(({id:t})=>!e.includes(t)):[];return[...a.covers||[],...t].slice(0,5)},[a]);Object(n.n)(()=>{!d&&p.length<5&&r({stickerSetId:e})},[d,p.length,r,e]);const g=Object(n.m)(()=>{s({stickerSetId:e})},[s,e]);if(!a)return;const E=p.length>0;return n.a.createElement("div",{key:a.id,className:"sticker-set"},n.a.createElement("div",{className:"sticker-set-header"},n.a.createElement("div",{className:"title-wrapper"},n.a.createElement("h3",{className:"title"},a.title),n.a.createElement("p",{className:"count"},a.count," stickers")),n.a.createElement(x.a,{className:m?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:g},m?"Added":"Add")),n.a.createElement("div",{className:"sticker-set-main"},!E&&n.a.createElement(D.a,null),E&&p.map(e=>n.a.createElement(ha,{sticker:e,size:l.ob,observeIntersection:t,noAnimate:!c||u||o,onClick:h}))),E&&n.a.createElement(pa.a,{isOpen:u,fromSticker:p[0],onClose:b}))}));a(286);const Nc=Object(K.g)(e=>e(),6e4,!0);var Ic=Object(n.h)(Object(c.h)(e=>{const t=Object(m.z)(e),{query:a,resultIds:n}=t||{},{featured:c}=e.stickers;return{query:a,featuredIds:c.setIds,resultIds:n}},(e,t)=>Object(u.l)(t,["loadFeaturedStickers"]))(({query:e,featuredIds:t,resultIds:a,loadFeaturedStickers:c})=>{const r=Object(n.q)(null),[s,l]=Object(n.r)(!1),{observe:o}=Object(sa.a)({rootRef:r,throttleMs:200});return Object(n.n)(()=>{Nc(()=>{c()})}),n.a.createElement("div",{ref:r,className:"StickerSearch custom-scroll"},function(){if(void 0!==e)return!e&&t?t.map(e=>n.a.createElement(kc,{key:e,stickerSetId:e,observeIntersection:o,isSomeModalOpen:s,onModalToggle:l})):a?a.length?a.map(e=>n.a.createElement(kc,{key:e,stickerSetId:e,observeIntersection:o,isSomeModalOpen:s,onModalToggle:l})):n.a.createElement("p",{className:"helper-text"},"Nothing found."):n.a.createElement(ge.a,null)}())}));a(287);var Sc=Object(n.h)(Object(c.h)(e=>{const t=Object(m.s)(e),{query:a,results:n}=t||{},{chatId:c}=Object(m.y)(e)||{},r=c?Object(m.f)(e,c):void 0;return{query:a,results:n,chat:r,isChatWithBot:r?Object(m.N)(e,r):void 0}},(e,t)=>Object(u.l)(t,["searchMoreGifs","sendMessage","setGifSearchQuery"]))(({query:e,results:t,chat:a,isChatWithBot:c,searchMoreGifs:r,sendMessage:s,setGifSearchQuery:l})=>{const i=Object(n.q)(null),{observe:m}=Object(sa.a)({rootRef:i,debounceMs:300}),{canSendGifs:u}=Object(d.c)(a,c),h=Object(n.m)(e=>{u&&s({gif:e}),o.k&&l({query:void 0})},[u,s,l]),b=Object(T.a)();const p=Boolean(void 0!==e&&t&&t.length);return n.a.createElement("div",{className:"GifSearch"},n.a.createElement(Oe.a,{ref:i,className:Object(le.a)("gif-container custom-scroll",p&&"grid"),items:t,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:r},function(){if(void 0!==e)return t?t.length?t.map(e=>n.a.createElement(oc,{key:e.id,gif:e,observeIntersection:m,onClick:h})):n.a.createElement("p",{className:"helper-text"},b("NoGIFsFound")):n.a.createElement(ge.a,null)}()))}));a(288);let wc,Pc;function Mc(e){return fetch(e).then(e=>e.json())}function Fc(e,t){const a=new Date(t),n=a.getMonth()+1,c=a.getDate();return Mc(`${e}/${`${a.getFullYear()}-${n<10?"0":""}${n}/${c<10?"0":""}${c}`}.json`)}var Lc=Object(n.h)(()=>{const e=Object(n.q)(null),[t,c]=Object(n.r)(!1),[r,s]=Object(n.r)(0);return Object(n.n)(()=>{(async()=>{if(await async function(){return wc||(wc=a.e(6).then(a.bind(null,306)),Pc=await wc),wc}(),!t)return void c(!0);const n=await Mc("./chartDummyData/growth.json");Pc.create(e.current.children[0],n),s(1);const r=await Mc("./chartDummyData/notifications.json");r.onZoom=e=>Fc("chartDummyData/notifications_zoom",e),Pc.create(e.current.children[1],r),s(2);const l=await Mc("./chartDummyData/interactions.json");Pc.create(e.current.children[2],l),s(3);const o=await Mc("./chartDummyData/views.json");o.onZoom=e=>Fc("chartDummyData/views_zoom",e),Pc.create(e.current.children[3],o),s(4);const i=await Mc("./chartDummyData/languages.json");Pc.create(e.current.children[4],i),s(5)})()},[t]),n.a.createElement("div",{className:Object(le.a)("Statistics custom-scroll",t&&"ready"),ref:e},t?n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:Object(le.a)("chat-container",r<1&&"hidden")}),n.a.createElement("div",{className:Object(le.a)("chat-container",r<2&&"hidden")}),n.a.createElement("div",{className:Object(le.a)("chat-container",r<3&&"hidden")}),n.a.createElement("div",{className:Object(le.a)("chat-container",r<4&&"hidden")}),n.a.createElement("div",{className:Object(le.a)("chat-container",r<5&&"hidden")})):n.a.createElement(ge.a,null))});a(289);var Ac=Object(n.h)(Object(c.h)((e,{answer:t})=>{const{voters:a,offsets:n}=e.pollResults;return{voters:a&&a[t.option],offset:n&&n[t.option]||""}},(e,t)=>Object(u.l)(t,["loadPollOptionResults","openChat","closePollResults"]))(({chat:e,message:t,answer:a,answerVote:c,totalVoters:r,voters:s,offset:l,loadPollOptionResults:o,openChat:i,closePollResults:m})=>{const d=Object(y.a)(c.votersCount),[u,h]=Object(n.r)(!0),b=Boolean(s),{option:p,text:g}=a;Object(n.n)(()=>{b&&d===c.votersCount||o({chat:e,messageId:t.id,option:p,offset:l,limit:4,shouldResetVoters:!0})},[c.votersCount,b]);const E=Object(n.m)(()=>{h(!0),o({chat:e,messageId:t.id,option:p,offset:l,limit:50})},[e,o,t.id,l,p]);Object(n.n)(()=>{h(!1)},[s]);const v=Object(n.m)(e=>{i({id:e}),m()},[m,i]);return n.a.createElement("div",{className:"PollAnswerResults"},n.a.createElement("div",{className:"poll-voters"},s?s.map(e=>n.a.createElement(fe.a,{key:e,className:"chat-item-clickable",onClick:()=>v(e)},n.a.createElement(je.a,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}))):n.a.createElement(ge.a,null),s&&function(){const e=c.votersCount-s.length;return c.votersCount>4&&e>0&&n.a.createElement(Xt,{count:e,itemName:"voter",isLoading:u,onClick:E})}()),n.a.createElement("div",{className:"answer-head"},n.a.createElement("span",{className:"answer-title"},g),n.a.createElement("span",{className:"answer-percent"},(O=c.votersCount,(f=r)>0?(O/f*100).toFixed():0),"%")));var O,f}));a(290);var Tc=Object(n.h)(Object(c.h)(e=>{const{pollResults:{chatId:t,messageId:a},lastSyncTime:n}=e;if(!t||!a)return{};return{chat:Object(m.f)(e,t),message:Object(m.k)(e,t,a),lastSyncTime:n}})(({chat:e,message:t,lastSyncTime:a})=>{if(!t||!e)return n.a.createElement(ge.a,null);const{summary:c,results:r}=Object(d.H)(t);if(!r.results)return;const s=Object(u.c)(r.results,"option");return n.a.createElement("div",{className:"PollResults"},n.a.createElement("h3",{className:"poll-question"},c.question),n.a.createElement("div",{className:"poll-results-list custom-scroll"},a&&c.answers.map(a=>n.a.createElement(Ac,{key:`${t.id}-${a.option}`,chat:e,message:t,answer:a,answerVote:s[a.option],totalVoters:r.totalVoters})),!a&&n.a.createElement(ge.a,null)))}));a(155);var Dc=Object(n.h)(Object(c.h)((e,{userId:t})=>{const a=Object(m.Cb)(e,t),n=Object(m.f)(e,t),{progress:c}=e.management;return{user:a,chat:n,progress:c}},(e,t)=>Object(u.l)(t,["updateContact","deleteUser","closeManagement","openChat","deleteHistory"]))(({userId:e,user:t,chat:a,progress:c,updateContact:r,deleteUser:l,deleteHistory:o,closeManagement:i,openChat:m})=>{const[d,u,h]=Object(Be.a)(),[b,p]=Object(n.r)(!1),[g,E]=Object(n.r)(),v=Object(T.a)(),O=t&&t.firstName||"",f=t&&t.lastName||"",j=a?a.isMuted:void 0,[C,y]=Object(n.r)(O),[k,N]=Object(n.r)(f),[I,S]=Object(n.r)(!j);Object(n.n)(()=>{S(!j)},[j]),Object(n.n)(()=>{p(!1),h()},[h,e]),Object(n.n)(()=>{y(O),N(f)},[O,f,t]),Object(n.n)(()=>{c===s.f.Complete&&(p(!1),E(void 0),h())},[h,c]);const w=Object(n.m)(e=>{y(e.target.value),p(!0)},[]),P=Object(n.m)(e=>{N(e.target.value),p(!0)},[]),M=Object(n.m)(e=>{S(e.target.checked),p(!0)},[]),F=Object(n.m)(()=>{const t=C.trim(),a=k.trim();t.length||E("Please provide first name"),r({userId:e,isMuted:!I,firstName:t,lastName:a})},[C,k,r,e,I]),L=Object(n.m)(()=>{a.lastMessage&&o({chatId:a.id,maxId:a.lastMessage.id,shouldDeleteForAll:!1}),l({userId:e}),h(),i(),m({id:void 0})},[a.id,a.lastMessage,h,i,o,l,m,e]);if(!t)return;const A=c===s.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(je.a,{userId:t.id,avatarSize:"jumbo",status:"original name",withMediaViewer:!0,withFullInfo:!0}),n.a.createElement(ve.a,{id:"user-first-name",label:v("UserInfo.FirstNamePlaceholder"),onChange:w,value:C,error:"Please provide first name"===g?g:void 0}),n.a.createElement(ve.a,{id:"user-last-name",label:v("UserInfo.LastNamePlaceholder"),onChange:P,value:k}),n.a.createElement("div",{className:"ListItem no-selection narrow"},n.a.createElement(aa.a,{checked:I,label:v("Notifications"),subLabel:v(I?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:M}))),n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{icon:"delete",ripple:!0,destructive:!0,onClick:u},v("DeleteContact")))),n.a.createElement(qt,{isShown:b,onClick:F,disabled:A,ariaLabel:v("Save")},A?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Bt.a,{isOpen:d,onClose:h,text:v("AreYouSureDeleteContact"),confirmLabel:v("DeleteContact"),confirmHandler:L,confirmIsDestructive:!0}))}));var Bc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),{progress:n}=e.management,c=Boolean(a.fullInfo&&a.fullInfo.linkedChatId);return{chat:a,progress:n,isBasicGroup:Object(d.ib)(a),hasLinkedChannel:c,canChangeInfo:Object(d.q)(a,"changeInfo"),canBanUsers:Object(d.q)(a,"banUsers")}},(e,t)=>Object(u.l)(t,["togglePreHistoryHidden","updateChat","closeManagement","deleteHistory","leaveChannel","deleteChannel","openChat"]))(({chatId:e,chat:t,progress:a,isBasicGroup:c,hasLinkedChannel:l,canChangeInfo:o,canBanUsers:i,onScreenSelect:m,togglePreHistoryHidden:u,updateChat:h,deleteHistory:b,leaveChannel:p,deleteChannel:g,closeManagement:v,openChat:O})=>{const[f,j,C]=Object(Be.a)(),y=t.title,k=t.fullInfo&&t.fullInfo.about||"",[N,I]=Object(n.r)(!1),[S,w]=Object(n.r)(y),[P,M]=Object(n.r)(k),[F,L]=Object(n.r)(),[A,B]=Object(n.r)(),U=Object(d.f)(t),x=Object(E.a)(U,!1,r.ApiMediaFormat.BlobUrl),R=Object(T.a)();Object(n.n)(()=>{a===s.f.Complete&&(I(!1),B(void 0))},[a]);const q=Object(n.m)(()=>{m(s.g.ChatPrivacyType)},[m]),z=Object(n.m)(()=>{m(s.g.Discussion)},[m]),$=Object(n.m)(()=>{m(s.g.GroupPermissions)},[m]),H=Object(n.m)(()=>{m(s.g.ChatAdministrators)},[m]),V=Object(n.m)(e=>{L(e),I(!0)},[]),W=Object(n.m)(e=>{w(e.target.value),I(!0)},[]),Y=Object(n.m)(e=>{M(e.target.value),I(!0)},[]),K=Object(n.m)(()=>{const t=S.trim(),a=P.trim();t.length?h({chatId:e,title:t,about:a,photo:F}):B("Group title can't be empty")},[P,e,F,S,h]),Z=Object(n.m)(()=>{m(s.g.GroupMembers)},[m]),Q=Object(n.m)(()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;u({chatId:t.id,isEnabled:!e})},[t,u]),_=Object(n.p)(()=>{if(!t.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter(e=>!t.defaultBannedRights[e]).length;const{sendStickers:a,sendGifs:n}=t.defaultBannedRights;return a||n||(e+=1),e},[t]),X=t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,J=Object(n.m)(()=>{c?b({chatId:t.id,maxId:t.lastMessage.id,shouldDeleteForAll:!1}):t.isCreator?g({chatId:t.id}):p({chatId:t.id}),C(),v(),O({id:void 0})},[c,t.isCreator,t.id,t.lastMessage,C,v,b,p,g,O]);if(t.isRestricted)return;const ee=a===s.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Gt.a,{currentAvatarBlobUrl:x,onChange:V,disabled:!o}),n.a.createElement(ve.a,{id:"group-title",label:R("GroupName"),onChange:W,value:S,error:"Group title can't be empty"===A?A:void 0,disabled:!o}),n.a.createElement(ve.a,{id:"group-about",className:"mb-2",label:R("DescriptionPlaceholder"),onChange:Y,value:P,disabled:!o}),t.isCreator&&n.a.createElement(fe.a,{icon:"lock",ripple:!0,onClick:q},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},R("GroupType")),n.a.createElement("span",{className:"subtitle"},t.username?R("TypePublic"):R("TypePrivate")))),l&&n.a.createElement(fe.a,{icon:"message",ripple:!0,onClick:z},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},R("LinkedChannel")),n.a.createElement("span",{className:"subtitle"},R("DiscussionUnlink")))),n.a.createElement(fe.a,{icon:"permissions",ripple:!0,onClick:$,disabled:!i},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},R("ChannelPermissions")),n.a.createElement("span",{className:"subtitle"},_,"/",8))),n.a.createElement(fe.a,{icon:"admin",ripple:!0,onClick:H},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},R("ChannelAdministrators")),n.a.createElement("span",{className:"subtitle"},Object(ma.a)(X))))),n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{icon:"group",ripple:!0,onClick:Z},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},R("GroupMembers")),n.a.createElement("span",{className:"subtitle"},Object(ma.a)(t.membersCount)))),t.fullInfo&&n.a.createElement("div",{className:"ListItem narrow no-selection"},n.a.createElement(aa.a,{checked:!t.fullInfo.isPreHistoryHidden,label:R("ChatHistory"),onChange:Q,disabled:!i}))),n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{icon:"delete",ripple:!0,destructive:!0,onClick:j},R("DeleteMega")))),n.a.createElement(qt,{isShown:N,onClick:K,disabled:ee,ariaLabel:R("Save")},ee?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Bt.a,{isOpen:f,onClose:C,textParts:Object(G.a)(c||!t.isCreator?R("AreYouSureDeleteAndExit"):R("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:c||!t.isCreator?R("DeleteMega"):R("DeleteGroupForAll"),confirmHandler:J,confirmIsDestructive:!0}))}));var Uc=Object(n.h)(Object(c.h)((e,{chatId:t})=>({chat:Object(m.f)(e,t),currentUserId:e.currentUserId}),(e,t)=>Object(u.l)(t,["updateChatDefaultBannedRights"]))(({onScreenSelect:e,onChatMemberSelect:t,chat:a,currentUserId:c,updateChatDefaultBannedRights:r})=>{const[l,o]=Object(n.r)({}),[i,m]=Object(n.r)(!1),[d,u]=Object(n.r)(!1),h=Object(T.a)(),b=Object(n.m)(()=>{e(s.g.GroupRemovedUsers)},[e]),p=Object(n.m)(()=>{e(s.g.GroupUserPermissionsCreate)},[e]),g=Object(n.m)(a=>{t(a.userId,a.promotedByUserId===c),e(s.g.GroupUserPermissions)},[c,t,e]);Object(n.n)(()=>{o(a&&a.defaultBannedRights||{}),m(!1),setTimeout(()=>{u(!1)},250)},[a]);const E=Object(n.m)(e=>{const{name:t}=e.target;function a(e){return!e||void 0}o(e=>({...e,[t]:a(e[t]),..."sendStickers"===t&&{sendGifs:a(e[t])}})),m(!0)},[]),v=Object(n.m)(()=>{a&&(u(!0),r({chatId:a.id,bannedRights:l}))},[a,l,r]),O=Object(n.p)(()=>a&&a.fullInfo&&a.fullInfo.kickedMembers?a.fullInfo.kickedMembers.length:0,[a]),f=Object(n.p)(()=>a&&a.fullInfo&&a.fullInfo.members?a.fullInfo.members.filter(({bannedRights:e})=>!!e):[],[a]),j=Object(n.m)(e=>{const{bannedRights:t}=e;if(!t||!a)return;const{defaultBannedRights:n}=a;return Object.keys(t).reduce((e,a)=>{if(!t[a]||n&&n[a]||"sendInline"===a||"viewMessages"===a||"sendGames"===a)return e;const c=function(e){switch(e){case"sendMessages":return"UserRestrictionsNoSend";case"sendMedia":return"UserRestrictionsNoSendMedia";case"sendStickers":return"UserRestrictionsNoSendStickers";case"embedLinks":return"UserRestrictionsNoEmbedLinks";case"sendPolls":return"UserRestrictionsNoSendPolls";case"changeInfo":return"UserRestrictionsNoChangeInfo";case"inviteUsers":return"UserRestrictionsInviteUsers";case"pinMessages":return"UserRestrictionsPinMessages";default:return}}(a);if(!c)return e;const r=h(c);return`${e}${e.length?", "+r:r}`},"")},[a,h]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement("h3",{className:"section-heading"},h("ChannelPermissionsHeader")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendMessages",checked:!l.sendMessages,label:h("UserRestrictionsSend"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendMedia",checked:!l.sendMedia,label:h("UserRestrictionsSendMedia"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendStickers",checked:!l.sendStickers&&!l.sendGifs,label:h("UserRestrictionsSendStickers"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendPolls",checked:!l.sendPolls,label:h("UserRestrictionsSendPolls"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"embedLinks",checked:!l.embedLinks,label:h("UserRestrictionsEmbedLinks"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"inviteUsers",checked:!l.inviteUsers,label:h("UserRestrictionsInviteUsers"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"pinMessages",checked:!l.pinMessages,label:h("UserRestrictionsPinMessages"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!l.changeInfo,label:h("UserRestrictionsChangeInfo"),blocking:!0,onChange:E}))),n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{icon:"delete-user",ripple:!0,narrow:!0,onClick:b},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},h("ChannelBlockedUsers")),n.a.createElement("span",{className:"subtitle"},O)))),n.a.createElement("div",{className:"section"},n.a.createElement("h3",{className:"section-heading"},h("PrivacyExceptions")),n.a.createElement(fe.a,{icon:"add-user",ripple:!0,onClick:p},h("ChannelAddException")),f.map(e=>n.a.createElement(fe.a,{key:e.userId,className:"chat-item-clickable exceptions-member",ripple:!0,onClick:()=>g(e)},n.a.createElement(je.a,{userId:e.userId,status:j(e)}))))),n.a.createElement(qt,{isShown:i,onClick:v,ariaLabel:h("Save"),disabled:d},d?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))}));var xc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),{byId:n}=e.users;return{chat:a,usersById:n}},(e,t)=>Object(u.l)(t,["updateChatMemberBannedRights"]))(({chat:e,usersById:t,updateChatMemberBannedRights:a})=>{const c=Object(T.a)(),r=Object(n.p)(()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[],[e]),s=Object(n.m)(e=>{if(!e.kickedByUserId)return;const a=t[e.kickedByUserId];return a?c("UserRemovedBy",Object(d.Z)(a)):void 0},[c,t]),l=Object(n.m)(t=>{if(e)return[{title:c("Unblock"),icon:"delete",destructive:!0,handler:()=>a({chatId:e.id,userId:t.userId,bannedRights:{}})}]},[c,e,a]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement("p",{className:"text-muted"},c("NoBlockedGroup2")),r.map(e=>n.a.createElement(fe.a,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:l(e)},n.a.createElement(je.a,{userId:e.userId,status:s(e)}))))))}));var Rc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),{progress:n}=e.management;return{chat:a,progress:n,isSignaturesShown:Boolean(a&&a.isSignaturesShown),canChangeInfo:Object(d.q)(a,"changeInfo")}},(e,t)=>Object(u.l)(t,["toggleSignatures","updateChat","closeManagement","leaveChannel","deleteChannel","openChat"]))(({chatId:e,chat:t,progress:a,isSignaturesShown:c,canChangeInfo:l,onScreenSelect:o,updateChat:i,toggleSignatures:m,closeManagement:u,leaveChannel:h,deleteChannel:b,openChat:p})=>{const g=t&&t.title||"",v=t&&t.fullInfo&&t.fullInfo.about||"",O=t&&t.fullInfo&&t.fullInfo.linkedChatId,[f,j,C]=Object(Be.a)(),[y,k]=Object(n.r)(!1),[N,I]=Object(n.r)(g),[S,w]=Object(n.r)(v),[P,M]=Object(n.r)(),[F,L]=Object(n.r)(),A=t&&Object(d.f)(t),B=Object(E.a)(A,!1,r.ApiMediaFormat.BlobUrl),U=Object(T.a)();Object(n.n)(()=>{a===s.f.Complete&&(k(!1),L(void 0))},[a]);const x=t&&t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,R=Object(n.m)(()=>{o(s.g.ChatPrivacyType)},[o]),G=Object(n.m)(()=>{o(s.g.Discussion)},[o]),q=Object(n.m)(()=>{o(s.g.ChatAdministrators)},[o]),z=Object(n.m)(e=>{M(e),k(!0)},[]),$=Object(n.m)(e=>{I(e.target.value),k(!0)},[]),H=Object(n.m)(e=>{w(e.target.value),k(!0)},[]),V=Object(n.m)(()=>{const t=N.trim(),a=S.trim();t.length?i({chatId:e,title:t,about:a,photo:P}):L("Channel title can't be empty")},[S,e,P,N,i]),W=Object(n.m)(()=>{m({chatId:e,isEnabled:!c})},[e,c,m]),Y=Object(n.m)(()=>{o(s.g.ChannelSubscribers)},[o]),K=Object(n.m)(()=>{t.isCreator?b({chatId:t.id}):h({chatId:t.id}),C(),u(),p({id:void 0})},[t.isCreator,t.id,C,u,h,b,p]);if(t.isRestricted)return;const Z=a===s.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Gt.a,{currentAvatarBlobUrl:B,onChange:z,disabled:!l}),n.a.createElement(ve.a,{id:"channel-title",label:U("EnterChannelName"),onChange:$,value:N,error:"Channel title can't be empty"===F?F:void 0,disabled:!l}),n.a.createElement(ve.a,{id:"channel-about",className:"mb-2",label:U("DescriptionPlaceholder"),onChange:H,value:S,disabled:!l}),t.isCreator&&n.a.createElement(fe.a,{icon:"lock",ripple:!0,onClick:R},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},U("ChannelType")),n.a.createElement("span",{className:"subtitle"},t.username?U("TypePublic"):U("TypePrivate")))),n.a.createElement(fe.a,{icon:"message",ripple:!0,onClick:G,disabled:!l},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},U("Discussion")),n.a.createElement("span",{className:"subtitle"},U(O?"DiscussionUnlink":"Add")))),n.a.createElement(fe.a,{icon:"admin",ripple:!0,onClick:q},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},U("ChannelAdministrators")),n.a.createElement("span",{className:"subtitle"},x))),n.a.createElement("div",{className:"ListItem no-selection narrow"},n.a.createElement(aa.a,{checked:c,label:U("ChannelSignMessages"),onChange:W}))),n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{icon:"group",ripple:!0,onClick:Y},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},U("ChannelSubscribers")),n.a.createElement("span",{className:"subtitle"},U("Subscribers",t.membersCount,"i"))))),n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{icon:"delete",ripple:!0,destructive:!0,onClick:j},t.isCreator?U("ChannelDelete"):U("LeaveChannel")))),n.a.createElement(qt,{isShown:y,onClick:V,disabled:Z,ariaLabel:U("Save")},Z?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Bt.a,{isOpen:f,onClose:C,text:t.isCreator?U("ChannelDeleteAlert"):U("ChannelLeaveAlert"),confirmLabel:t.isCreator?U("ChannelDelete"):U("LeaveChannel"),confirmHandler:K,confirmIsDestructive:!0}))})),Gc=a(52);var qc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),{isUsernameAvailable:n}=Object(m.Y)(e,t);return{chat:a,isChannel:Object(d.jb)(a),progress:e.management.progress,isUsernameAvailable:n}},(e,t)=>Object(u.l)(t,["checkPublicLink","updatePublicLink","updatePrivateLink"]))(({chat:e,isChannel:t,progress:a,isUsernameAvailable:c,checkPublicLink:r,updatePublicLink:l,updatePrivateLink:o})=>{const i=Boolean(e.username),m=e.fullInfo&&e.fullInfo.inviteLink,[d,u]=Object(n.r)(i?"public":"private"),[h,b]=Object(n.r)(),[p,g,E]=Object(Be.a)(),v="public"===d&&h&&c||"private"===d&&i;Object(n.n)(()=>{d&&!m&&o()},[d,m,o]);const O=Object(n.m)(e=>{u(e)},[]),f=Object(n.m)(()=>{l({username:"public"===d?h:""})},[d,l,h]),j=Object(n.m)(()=>{E(),o()},[E,o]),C=Object(T.a)(),y=t?"Channel":"Mega",k=t?"Channel":"Group",N=[{value:"private",label:C(y+"Private"),subLabel:C(y+"PrivateInfo")},{value:"public",label:C(y+"Public"),subLabel:C(y+"PublicInfo")}],I=a===s.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement("h3",{className:"section-heading"},C(k+"Type")),n.a.createElement(oa.a,{selected:d,name:"channel-type",options:N,onChange:O})),"private"===d?n.a.createElement("div",{className:"section"},m?n.a.createElement(n.a.Fragment,null,n.a.createElement(Gc.a,{url:m,className:"group-link",text:m}),n.a.createElement("p",{className:"section-info"},C(y+"PrivateLinkHelp")),n.a.createElement(fe.a,{icon:"delete",ripple:!0,destructive:!0,onClick:g},C("RevokeLink")),n.a.createElement(Bt.a,{isOpen:p,onClose:E,text:C("RevokeAlert"),confirmLabel:C("RevokeButton"),confirmHandler:j,confirmIsDestructive:!0})):n.a.createElement(ge.a,null)):n.a.createElement("div",{className:"section no-border"},n.a.createElement(Vt,{asLink:!0,currentUsername:e.username,isLoading:I,isUsernameAvailable:c,checkUsername:r,onChange:b}),n.a.createElement("p",{className:"section-info"},C(k+".Username.CreatePublicLinkHelp")))),n.a.createElement(qt,{isShown:v,disabled:I,ariaLabel:C("Save"),onClick:f},I?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))}));var zc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),{forDiscussionIds:n,byId:c}=e.chats;return{chat:a,chatsByIds:c,forDiscussionIds:n,linkedChat:a&&a.fullInfo&&a.fullInfo.linkedChatId?Object(m.f)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&Object(d.jb)(a)}},(e,t)=>Object(u.l)(t,["loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup"]))(({chat:e,chatId:t,chatsByIds:a,linkedChat:c,forDiscussionIds:r,isChannel:o,onScreenSelect:i,loadGroupsForDiscussion:m,linkDiscussionGroup:d,unlinkDiscussionGroup:u})=>{const[h,b]=Object(n.r)(),[p,g]=Object(n.r)(),[E,v]=Object(n.r)(!1),O=Object(n.m)(()=>v(!0),[]),[f,j,C]=Object(Be.a)(),[y,k,N]=Object(Be.a)(),I=Object(T.a)(),S=c&&c.id;Object(n.n)(()=>{m()},[m]),Object(n.n)(()=>{p||Object(Kt.a)("DiscussionGroups").then(g)},[p]);const w=Object(n.m)(()=>{C(),u({channelId:o?t:S}),o||i(s.g.Initial)},[C,u,o,t,S,i]),P=Object(n.m)(()=>{N(),d({channelId:t,chatId:h})},[N,d,t,h]);function M(){const e=a[h];if(e)return n.a.createElement("div",{className:"modal-header"},n.a.createElement(q.a,{size:"tiny",chat:e}),n.a.createElement("div",{className:"modal-title"},I("Channel.DiscussionGroup.LinkGroup")))}function F(){const t=a[h];if(t)return t.hasPrivateLink?Object(G.a)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):Object(G.a)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"])}return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement("div",{className:"section-icon"},p&&n.a.createElement(Zt.a,{id:"discussionGroupsDucks",size:l.gb,animationData:p,play:E,noLoop:!0,onLoad:O})),c&&n.a.createElement("div",null,n.a.createElement(fe.a,{className:"chat-item-clickable",inactive:!0},n.a.createElement(Ce.a,{chatId:c.id})),n.a.createElement(fe.a,{icon:"delete",ripple:!0,destructive:!0,onClick:j},I(o?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),n.a.createElement(Bt.a,{isOpen:f,onClose:C,header:n.a.createElement("div",{className:"modal-header"},n.a.createElement(q.a,{size:"tiny",chat:c}),n.a.createElement("div",{className:"modal-title"},I(o?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:Object(G.a)(I(o?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",c.title),["br","simple_markdown"]),confirmLabel:I(o?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:w,confirmIsDestructive:!0})),!c&&n.a.createElement("div",null,n.a.createElement("p",{className:"section-help"},I("DiscussionChannelHelp")),n.a.createElement("div",{teactFastList:!0},n.a.createElement(fe.a,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},I("DiscussionCreateGroup")),r?r.map((e,t)=>n.a.createElement(fe.a,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{b(e),k()}},n.a.createElement(Ce.a,{chatId:e}))):n.a.createElement(Xe.a,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),n.a.createElement("p",{className:"mt-4 mb-0 section-help"},I("DiscussionChannelHelp2")),n.a.createElement(Bt.a,{isOpen:y,onClose:N,header:M(),textParts:F(),confirmLabel:I("DiscussionLinkGroup"),confirmHandler:P,isButtonsInOneRow:!0})))))}));var $c=Object(n.h)(Object(c.h)((e,{chatId:t,isPromotedByCurrentUser:a})=>{const n=Object(m.f)(e,t);return{chat:n,isFormFullyDisabled:!(n.isCreator||a)}},(e,t)=>Object(u.l)(t,["updateChatMemberBannedRights"]))(({chat:e,selectedChatMemberId:t,onScreenSelect:a,updateChatMemberBannedRights:c,isFormFullyDisabled:r})=>{const[l,o]=Object(n.r)({}),[i,m]=Object(n.r)(!1),[d,u]=Object(n.r)(!1),[h,b,p]=Object(Be.a)(),g=Object(T.a)(),E=Object(n.p)(()=>{if(e&&e.fullInfo&&e.fullInfo.members)return e.fullInfo.members.find(({userId:e})=>e===t)},[e,t]);Object(n.n)(()=>{e&&e.fullInfo&&t&&!E&&a(s.g.GroupPermissions)},[e,a,E,t]),Object(n.n)(()=>{o(E&&E.bannedRights||e&&e.defaultBannedRights||{}),m(!1),u(!1)},[e,E]);const v=Object(n.m)(e=>{const{name:t}=e.target;function a(e){return!e||void 0}o(e=>({...e,[t]:a(e[t]),..."sendStickers"===t&&{sendGifs:a(e[t])}})),m(!0)},[]),O=Object(n.m)(()=>{e&&t&&(u(!0),c({chatId:e.id,userId:t,bannedRights:l}))},[e,t,l,c]),f=Object(n.m)(()=>{e&&t&&c({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})},[e,t,c]),j=Object(n.m)(t=>!!r||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t],[e,r]);if(E)return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(je.a,{userId:E.userId})),n.a.createElement("h3",{className:"section-heading mt-4"},g("UserRestrictionsCanDo")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendMessages",checked:!l.sendMessages,label:g("UserRestrictionsSend"),blocking:!0,disabled:j("sendMessages"),onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendMedia",checked:!l.sendMedia,label:g("UserRestrictionsSendMedia"),blocking:!0,disabled:j("sendMedia"),onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendStickers",checked:!l.sendStickers&&!l.sendGifs,label:g("UserRestrictionsSendStickers"),blocking:!0,disabled:j("sendStickers"),onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendPolls",checked:!l.sendPolls,label:g("UserRestrictionsSendPolls"),blocking:!0,disabled:j("sendPolls"),onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"embedLinks",checked:!l.embedLinks,label:g("UserRestrictionsEmbedLinks"),blocking:!0,disabled:j("embedLinks"),onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"inviteUsers",checked:!l.inviteUsers,label:g("UserRestrictionsInviteUsers"),blocking:!0,disabled:j("inviteUsers"),onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"pinMessages",checked:!l.pinMessages,label:g("UserRestrictionsPinMessages"),blocking:!0,disabled:j("pinMessages"),onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!l.changeInfo,label:g("UserRestrictionsChangeInfo"),blocking:!0,disabled:j("changeInfo"),onChange:v}))),!r&&n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{icon:"delete-user",ripple:!0,destructive:!0,onClick:b},g("UserRestrictionsBlock")))),n.a.createElement(qt,{isShown:i,onClick:O,ariaLabel:g("Save"),disabled:d},d?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Bt.a,{isOpen:h,onClose:p,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:f,confirmIsDestructive:!0}))}));var Hc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),{byId:n}=e.users;return{chat:a,currentUserId:e.currentUserId,isChannel:Object(d.jb)(a),usersById:n}})(({chat:e,isChannel:t,currentUserId:a,usersById:c,onScreenSelect:r,onChatMemberSelect:l})=>{const o=Object(T.a)();const i=Object(n.p)(()=>e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort((e,t)=>e.isOwner?-1:t.isOwner?1:0):[],[e]),m=Object(n.m)(e=>{l(e.userId,e.promotedByUserId===a),r(s.g.ChatAdminRights)},[a,l,r]),u=Object(n.m)(e=>{if(e.isOwner)return o("ChannelCreator");const t=e.promotedByUserId?c[e.promotedByUserId]:void 0;return t?o("EditAdminPromotedBy",Object(d.Z)(t)):o("ChannelAdmin")},[o,c]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{icon:"recent",ripple:!0,onClick:function(){r(s.g.GroupRecentActions)}},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},o("EventLog")),n.a.createElement("span",{className:"subtitle"},o(t?"EventLogInfoDetailChannel":"EventLogInfoDetail"))))),n.a.createElement("div",{className:"section"},n.a.createElement("p",{className:"text-muted"},t?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),i.map(e=>n.a.createElement(fe.a,{key:e.userId,className:"chat-item-clickable",ripple:!0,onClick:()=>m(e)},n.a.createElement(je.a,{userId:e.userId,status:u(e),forceShowSelf:!0}))))))}));var Vc=Object(n.h)(Object(c.h)((e,{chatId:t})=>({chat:Object(m.f)(e,t)}))(({chat:e})=>{const t=Object(T.a)(),a=Object(n.p)(()=>e&&e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort((e,t)=>e.isOwner?-1:t.isOwner?1:0):[],[e]),c=Object(n.m)(e=>e.isOwner?t("ChannelCreator"):t("ChannelAdmin"),[t]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section not-implemented"},n.a.createElement("h3",{className:"section-heading"},"Actions"),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogAllEvents"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterNewAdmins"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterNewMembers"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterChannelInfo"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterDeletedMessages"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterEditedMessages"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterLeavingMembers"),onChange:void 0}))),n.a.createElement("div",{className:"section not-implemented"},n.a.createElement("h3",{className:"section-heading"},"Admins"),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogAllAdmins"),onChange:void 0})),a.map(e=>n.a.createElement(fe.a,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},n.a.createElement(aa.a,{label:"",checked:!0}),n.a.createElement(je.a,{userId:e.userId,status:c(e),forceShowSelf:!0}))))))}));var Wc=Object(n.h)(Object(c.h)((e,{chatId:t,isPromotedByCurrentUser:a})=>{const n=Object(m.f)(e,t),{byId:c}=e.users,{currentUserId:r}=e;return{chat:n,usersById:c,currentUserId:r,isChannel:Object(d.jb)(n),isFormFullyDisabled:!(n.isCreator||a)}},(e,t)=>Object(u.l)(t,["updateChatAdmin"]))(({selectedChatMemberId:e,onScreenSelect:t,chat:a,usersById:c,currentUserId:r,isChannel:l,isFormFullyDisabled:o,updateChatAdmin:i})=>{const[m,u]=Object(n.r)({}),[h,b]=Object(n.r)(!1),[p,g]=Object(n.r)(!1),[E,v,O]=Object(Be.a)(),[f,j]=Object(n.r)(""),C=Object(T.a)(),y=Object(n.p)(()=>{if(a.fullInfo&&a.fullInfo.adminMembers)return a.fullInfo.adminMembers.find(({userId:t})=>t===e)},[a,e]);Object(n.n)(()=>{a&&a.fullInfo&&e&&!y&&t(s.g.ChatAdministrators)},[a,t,y,e]),Object(n.n)(()=>{u(y&&y.adminRights||{}),j((y&&y.customTitle||"").substr(0,16)),b(!1),g(!1)},[y]);const k=Object(n.m)(e=>{const{name:t}=e.target;u(e=>{return{...e,[t]:(a=e[t],!a||void 0)};var a}),b(!0)},[]),N=Object(n.m)(()=>{e&&(g(!0),i({chatId:a.id,userId:e,adminRights:m,customTitle:f}))},[a,e,m,f,i]),I=Object(n.m)(()=>{e&&(i({chatId:a.id,userId:e,adminRights:{}}),O())},[a.id,O,e,i]),S=Object(n.m)(e=>!Object(d.ib)(a)&&(!(!o&&a.adminRights)||!a.adminRights[e]),[a,o]),w=Object(n.p)(()=>{if(!y)return;if(y.isOwner)return C("ChannelCreator");const e=y.promotedByUserId?c[y.promotedByUserId]:void 0;return e?C("EditAdminPromotedBy",Object(d.Z)(e)):C("ChannelAdmin")},[y,c,C]),P=Object(n.m)(e=>{const{value:t}=e.target;j(t),b(!0)},[]);if(y)return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(fe.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(je.a,{userId:y.userId,status:w,forceShowSelf:!0})),n.a.createElement("h3",{className:"section-heading mt-4"},C("EditAdminWhatCanDo")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!!m.changeInfo,label:C(l?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:S("changeInfo"),onChange:k})),l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"postMessages",checked:!!m.postMessages,label:C("EditAdminPostMessages"),blocking:!0,disabled:S("postMessages"),onChange:k})),l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"editMessages",checked:!!m.editMessages,label:C("EditAdminEditMessages"),blocking:!0,disabled:S("editMessages"),onChange:k})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"deleteMessages",checked:!!m.deleteMessages,label:C(l?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:S("deleteMessages"),onChange:k})),!l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"banUsers",checked:!!m.banUsers,label:C("EditAdminBanUsers"),blocking:!0,disabled:S("banUsers"),onChange:k})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"inviteUsers",checked:!!m.inviteUsers,label:C("EditAdminAddUsers"),blocking:!0,disabled:S("inviteUsers"),onChange:k})),!l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"pinMessages",checked:!!m.pinMessages,label:C("EditAdminPinMessages"),blocking:!0,disabled:S("pinMessages"),onChange:k})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"addAdmins",checked:!!m.addAdmins,label:C("EditAdminAddAdmins"),blocking:!0,disabled:S("addAdmins"),onChange:k})),!l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"anonymous",checked:!!m.anonymous,label:C("EditAdminSendAnonymously"),blocking:!0,disabled:S("anonymous"),onChange:k})),o&&n.a.createElement("p",{className:"section-info mb-4"},C("Channel.EditAdmin.CannotEdit")),!l&&n.a.createElement(ve.a,{id:"admin-title",label:C("EditAdminRank"),onChange:P,value:f,disabled:o,maxLength:16}),r!==e&&!o&&n.a.createElement(fe.a,{icon:"delete",ripple:!0,destructive:!0,onClick:v},C("EditAdminRemoveAdmin")))),n.a.createElement(qt,{isShown:h,onClick:N,ariaLabel:C("Save"),disabled:p},p?n.a.createElement(D.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Bt.a,{isOpen:E,onClose:O,text:"Are you sure you want to dismiss this admin?",confirmLabel:"Dismiss",confirmHandler:I,confirmIsDestructive:!0}))}));var Yc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),{byId:n}=e.users;return{members:a&&a.fullInfo&&a.fullInfo.members,usersById:n,isChannel:a&&Object(d.jb)(a)}},(e,t)=>Object(u.l)(t,["openUserInfo"]))(({members:e,usersById:t,isChannel:a,openUserInfo:c})=>{const r=Object(n.p)(()=>{if(e&&t)return Object(d.W)(e.map(({userId:e})=>e),t)},[e,t]),s=Object(n.m)(e=>{c({id:e})},[c]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",teactFastList:!0},r?r.map((e,t)=>n.a.createElement(fe.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>s(e)},n.a.createElement(je.a,{userId:e,forceShowSelf:!0}))):n.a.createElement(Xe.a,{teactOrderKey:0,key:"nothing-found",text:a?"No subscribers found":"No members found"}))))}));var Kc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.f)(e,t),{byId:n}=e.users;return{members:a&&a.fullInfo&&a.fullInfo.members,usersById:n,isChannel:a&&Object(d.jb)(a)}})(({usersById:e,members:t,isChannel:a,onScreenSelect:c,onChatMemberSelect:r})=>{const l=Object(n.p)(()=>{if(t&&e)return Object(d.W)(t.filter(e=>!e.isOwner).map(({userId:e})=>e),e)},[t,e]),o=Object(n.m)(e=>{r(e),c(s.g.GroupUserPermissions)},[r,c]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",teactFastList:!0},l?l.map((e,t)=>n.a.createElement(fe.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>o(e)},n.a.createElement(je.a,{userId:e,forceShowSelf:!0}))):n.a.createElement(Xe.a,{teactOrderKey:0,key:"nothing-found",text:a?"No subscribers found":"No members found"}))))}));var Zc=Object(n.h)(Object(c.h)(e=>({managementType:Object(m.u)(e)}))(({chatId:e,currentScreen:t,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:r,onChatMemberSelect:l,managementType:o})=>{switch(t){case s.g.Initial:switch(o){case"user":return n.a.createElement(Dc,{key:e,userId:e});case"group":return n.a.createElement(Bc,{key:e,chatId:e,onScreenSelect:r});case"channel":return n.a.createElement(Rc,{key:e,chatId:e,onScreenSelect:r})}break;case s.g.ChatPrivacyType:return n.a.createElement(qc,{chatId:e});case s.g.Discussion:return n.a.createElement(zc,{chatId:e,onScreenSelect:r});case s.g.GroupPermissions:return n.a.createElement(Uc,{chatId:e,onScreenSelect:r,onChatMemberSelect:l});case s.g.GroupRemovedUsers:return n.a.createElement(xc,{chatId:e});case s.g.GroupUserPermissionsCreate:return n.a.createElement(Kc,{chatId:e,onChatMemberSelect:l,onScreenSelect:r});case s.g.GroupUserPermissions:return n.a.createElement($c,{chatId:e,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:r});case s.g.ChatAdministrators:return n.a.createElement(Hc,{chatId:e,onScreenSelect:r,onChatMemberSelect:l});case s.g.GroupRecentActions:return n.a.createElement(Vc,{chatId:e});case s.g.ChatAdminRights:return n.a.createElement(Wc,{chatId:e,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:r});case s.g.ChannelSubscribers:case s.g.GroupMembers:return n.a.createElement(Yc,{chatId:e})}}));const Qc={USD:"$",EUR:"€",GBP:"£",JPY:"¥",RUB:"₽",UAH:"₴",INR:"₹",AED:"د.إ"};function _c(e){return e&&Qc[e]||""}const Xc=/^4[0-9]{12}(?:[0-9]{1,3})?$/,Jc=/^5[1-5][0-9]{11,14}$/,er=/^2[2-7][0-9]{11,14}$/;let tr;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(tr||(tr={}));const ar={[tr.Default]:"",[tr.Visa]:"visa",[tr.Mastercard]:"mastercard"};function nr(e){return e=e.replace(/\s/g,""),Xc.test(e)?tr.Visa:Jc.test(e)||er.test(e)?tr.Mastercard:tr.Default}var cr=a(54);const rr={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},sr=(e,t)=>{switch(t.type){case"changeAddress1":return{...e,streetLine1:t.payload,formErrors:{...e.formErrors,streetLine1:void 0}};case"changeAddress2":return{...e,streetLine2:t.payload,formErrors:{...e.formErrors,streetLine2:void 0}};case"changeCity":return{...e,city:t.payload,formErrors:{...e.formErrors,city:void 0}};case"changeState":return{...e,state:t.payload,formErrors:{...e.formErrors,state:void 0}};case"changeCountry":return{...e,countryIso2:t.payload,billingCountry:lr(t.payload),formErrors:{...e.formErrors,countryIso2:void 0}};case"changePostCode":return{...e,postCode:t.payload,formErrors:{...e.formErrors,postCode:void 0}};case"changeFullName":return{...e,fullName:t.payload,formErrors:{...e.formErrors,fullName:void 0}};case"changeEmail":return{...e,email:t.payload,formErrors:{...e.formErrors,email:void 0}};case"changePhone":return{...e,phone:t.payload,formErrors:{...e.formErrors,phone:void 0}};case"changeShipping":return{...e,shipping:t.payload};case"changeCardNumber":return{...e,cardNumber:t.payload,formErrors:{...e.formErrors,cardNumber:void 0}};case"changeCardholder":return{...e,cardholder:t.payload,formErrors:{...e.formErrors,cardholder:void 0}};case"changeExpiryDate":return{...e,expiry:t.payload,formErrors:{...e.formErrors,expiry:void 0}};case"changeCvvCode":return{...e,cvv:t.payload,formErrors:{...e.formErrors,cvv:void 0}};case"changeBillingCountry":return{...e,billingCountry:t.payload,formErrors:{...e.formErrors,billingCountry:void 0}};case"changeBillingZip":return{...e,billingZip:t.payload,formErrors:{...e.formErrors,billingZip:void 0}};case"changeSaveInfo":return{...e,saveInfo:t.payload};case"changeSaveCredentials":return{...e,saveCredentials:t.payload};case"updateUserInfo":return t.payload.countryIso2?{...e,...t.payload,billingCountry:lr(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function lr(e){const t=xt.a.find(({id:t})=>t===e);return t?t.name:""}function or(e,t=400){Object(n.n)(()=>{o.k||setTimeout(()=>{Object(K.b)(()=>{e.current&&e.current.focus()})},t)},[e,t])}var ir=Object(n.h)(e=>{const{id:t,value:a,label:c,hasArrow:r,error:s,ref:l,placeholder:o,onChange:i,children:m}=e,d=s||c,u=Object(le.a)("input-group",a&&"touched",s&&"error",d&&"with-label",r&&"with-arrow","input-group");return n.a.createElement("div",{className:u},n.a.createElement("select",{className:"form-control",id:t,value:a||"",onChange:i,placeholder:o||c,ref:l},m),d&&t&&n.a.createElement("label",{htmlFor:t},d))});a(291);var mr=Object(n.h)(({state:e,needEmail:t,needPhone:a,needName:c,needAddress:r,dispatch:s})=>{const l=Object(n.q)(null),o=Object(n.q)(null),i=Object(n.q)(null);Object(n.n)(()=>{i.current&&i.current.value!==e.countryIso2&&(i.current.value=e.countryIso2)},[e.countryIso2]);const m=Object(T.a)();or(l);const d=Object(n.m)(e=>{s({type:"changeAddress1",payload:e.target.value})},[s]),u=Object(n.m)(e=>{s({type:"changeAddress2",payload:e.target.value})},[s]),h=Object(n.m)(e=>{s({type:"changeCity",payload:e.target.value})},[s]),b=Object(n.m)(e=>{s({type:"changeState",payload:e.target.value})},[s]),p=Object(n.m)(e=>{s({type:"changeCountry",payload:e.target.value})},[s]),g=Object(n.m)(e=>{s({type:"changePostCode",payload:e.target.value})},[s]),E=Object(n.m)(e=>{s({type:"changeFullName",payload:e.target.value})},[s]),v=Object(n.m)(e=>{s({type:"changeEmail",payload:e.target.value})},[s]),O=Object(n.m)(e=>{let{value:t}=e.target;t="+"+t.replace(/\D/g,""),o.current&&(o.current.value=t),s({type:"changePhone",payload:t})},[s]),f=Object(n.m)(e=>{s({type:"changeSaveInfo",payload:e.target.value})},[s]),{formErrors:j}=e;return n.a.createElement("div",{className:"ShippingInfo"},n.a.createElement("form",null,r?n.a.createElement("div",null,n.a.createElement("h5",null,m("PaymentShippingAddress")),n.a.createElement(ve.a,{ref:l,label:"Address1 (Street)",onChange:d,value:e.streetLine1,inputMode:"text",error:j.streetLine1}),n.a.createElement(ve.a,{label:"Address2 (Street)",onChange:u,value:e.streetLine2,inputMode:"text",error:j.streetLine2}),n.a.createElement(ve.a,{label:"City",onChange:h,value:e.city,inputMode:"text",error:j.city}),n.a.createElement(ve.a,{label:"State",onChange:b,value:e.state,inputMode:"text",error:j.state}),n.a.createElement(ir,{label:"Country",placeholder:"Country",onChange:p,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:j.countryIso2,ref:i},xt.a.map(({name:e,id:t})=>n.a.createElement("option",{value:t,className:"county-item"},e))),n.a.createElement(ve.a,{label:"Post Code",onChange:g,value:e.postCode,inputMode:"text",error:j.postCode})):void 0,c||t||a?n.a.createElement("h5",null,m("PaymentShippingReceiver")):void 0,c&&n.a.createElement(ve.a,{label:"Full name",onChange:E,value:e.fullName,inputMode:"text",error:j.fullName}),t&&n.a.createElement(ve.a,{label:"Email",onChange:v,value:e.email,inputMode:"email",error:j.email}),a&&n.a.createElement(ve.a,{label:"Phone number",onChange:O,value:e.phone,inputMode:"tel",error:j.phone,ref:o}),n.a.createElement(aa.a,{label:m("PaymentShippingSave"),subLabel:m("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:f})))});a(292);var dr=Object(n.h)(({state:e,shippingOptions:t,currency:a,dispatch:c})=>{Object(n.n)(()=>{t&&!e.shipping&&c({type:"changeShipping",payload:t[0].id})},[t,e.shipping,c]);const r=Object(n.m)(e=>{c({type:"changeShipping",payload:e})},[c]),s=Object(n.p)(()=>t.map(({id:e,title:t,amount:n})=>({label:t,subLabel:`${a} ${String(n/100)}`,value:e})),[t,a]);return n.a.createElement("div",{className:"Shipping"},n.a.createElement("form",null,n.a.createElement("p",null,"Select shipping method"),n.a.createElement(oa.a,{name:"shipping-options",options:s,onChange:r,selected:e.shipping})))});a(293);function ur(e,t,a,c=!1){return n.a.createElement("div",{className:"price-info-item "+(c?"price-info-item-main":"")},n.a.createElement("div",{className:"title"},e),n.a.createElement("div",{className:"value"},`${a||""} ${(t/100).toFixed(2)}`))}function hr(e,t,a){return n.a.createElement("div",{className:"checkout-info-item"},n.a.createElement("i",{className:e}," "),n.a.createElement("div",{className:"info"},n.a.createElement("div",{className:"title"},t),n.a.createElement("p",{className:"data"},a)))}var br=Object(n.h)(({invoiceContent:e,prices:t,shippingPrices:a,checkoutInfo:c,currency:r,totalPrice:s})=>{const{photoUrl:l,title:o,text:i}=e||{},{paymentMethod:m,paymentProvider:d,shippingAddress:u,name:h,phone:b,shippingMethod:p}=c||{};return n.a.createElement("div",{className:"Checkout"},n.a.createElement("div",{className:"description has-image"},l&&n.a.createElement("img",{src:l,alt:""}),n.a.createElement("div",{className:"text"},n.a.createElement("h5",null,o),n.a.createElement("p",null,i))),n.a.createElement("div",{className:"price-info"},t&&t.map(e=>ur(e.label,e.amount,r,!1)),a&&a.map(e=>ur(e.label,e.amount,r,!1)),void 0!==s&&ur("Total",s,r,!0)),n.a.createElement("div",{className:"invoice-info"},m&&hr("icon-card",m,"Payment method"),d&&hr("stripe-provider",d,"Payment provider"),u&&hr("icon-location",u,"Shipping address"),h&&hr("icon-user",h,"Name"),b&&hr("icon-phone",b,"Phone number"),p&&hr("icon-truck",p,"Shipping method")))});var pr=Object(n.h)(({value:e,error:t,onChange:a})=>{const c=Object(n.q)(null),r=Object(n.m)(t=>{if("Backspace"===t.key&&"/"===e.charAt(e.length-1)){const t=e.slice(0,e.length-1);c.current&&(c.current.value=t)}},[e]),s=Object(n.m)(e=>{a(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return t&&t[0]&&Number(t[0])>12&&(t[0]="12"),t&&t[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))},[a]);return n.a.createElement(ve.a,{label:"Expiry date",ref:c,onChange:s,onKeyDown:r,value:e,error:t,inputMode:"numeric",maxLength:5})}),gr=(a(294),a.p+"mastercard.4216118edafe23cc2dec7b8807ba4622.svg"),Er=a.p+"visa.e5a7c336e1deb4b92a636e2e053878c4.svg";var vr=Object(n.h)(({value:e,error:t,onChange:a})=>{const c=Object(n.q)(null);or(c);const[r,s]=Object(n.r)(tr.Default);Object(n.n)(()=>{const t=nr(e);s(t)},[]);const l=Object(n.m)(e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),n=nr(e.target.value);s(n),a(t),c.current&&(c.current.value=t)},[a,c]),o=function(e){switch(e){case tr.Mastercard:return n.a.createElement("img",{src:gr,alt:""});case tr.Visa:return n.a.createElement("img",{src:Er,alt:""});default:return}}(r);return n.a.createElement("div",{className:"CardInput"},n.a.createElement("span",{className:"left-addon"},o),n.a.createElement(ve.a,{ref:c,label:"Card number",onChange:l,value:e,inputMode:"numeric",className:r?"has-left-addon":"",error:t,maxLength:23}))});a(295);var Or=Object(n.h)(({state:e,canSaveCredentials:t,needCardholderName:a,needCountry:c,needZip:r,dispatch:s})=>{const l=Object(n.q)(null);Object(n.n)(()=>{l.current&&l.current.value!==e.billingCountry&&(l.current.value=e.billingCountry)},[e.billingCountry]);const o=Object(n.m)(e=>{s({type:"changeCardNumber",payload:e})},[s]),i=Object(n.m)(e=>{s({type:"changeCardholder",payload:e.target.value.toUpperCase()})},[s]),m=Object(n.m)(e=>{s({type:"changeExpiryDate",payload:e})},[s]),d=Object(n.m)(e=>{s({type:"changeCvvCode",payload:e.target.value})},[s]),u=Object(n.m)(e=>{s({type:"changeBillingCountry",payload:e.target.value})},[s]),h=Object(n.m)(e=>{s({type:"changeBillingZip",payload:e.target.value})},[s]),b=Object(n.m)(e=>{s({type:"changeSaveCredentials",payload:e.target.value})},[s]),p=Object(T.a)(),{formErrors:g={}}=e;return n.a.createElement("div",{className:"PaymentInfo"},n.a.createElement("form",null,n.a.createElement("h5",null,p("PaymentCardTitle")),n.a.createElement(vr,{onChange:o,value:e.cardNumber,error:g.cardNumber}),a&&n.a.createElement(ve.a,{label:"Name on card",onChange:i,value:e.cardholder,inputMode:"text",error:g.cardholder}),n.a.createElement("section",{className:"inline-inputs"},n.a.createElement(pr,{value:e.expiry,onChange:m,error:g.expiry}),n.a.createElement(ve.a,{label:"CVV code",onChange:d,value:e.cvv,inputMode:"numeric",maxLength:3,error:g.cvv})),c||r?n.a.createElement("h5",null,p("PaymentBillingAddress")):void 0,c&&n.a.createElement(ir,{label:"Country",placeholder:"Country",onChange:u,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:g.billingCountry,ref:l},xt.a.map(({name:e})=>n.a.createElement("option",{value:e,className:"county-item"},e))),r&&n.a.createElement(ve.a,{label:"Post Code",onChange:h,value:e.billingZip,inputMode:"text",error:g.billingZip}),t&&n.a.createElement(aa.a,{label:p("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:b})))});a(175);var fr=Object(n.h)(Object(c.h)(e=>{const{step:t,shippingOptions:a,savedInfo:n,canSaveCredentials:c,invoice:r,invoiceContent:s,nativeProvider:l,nativeParams:o,passwordMissing:i,error:m}=e.payment,d=Boolean(r&&(!l||"stripe"!==l)),{needCardholderName:u,needCountry:h,needZip:b}=o||{},{nameRequested:p,phoneRequested:g,emailRequested:E,shippingAddressRequested:v,flexible:O,phoneToProvider:f,emailToProvider:j,currency:C,prices:y}=r||{};return{step:t,shippingOptions:a,savedInfo:n,canSaveCredentials:c,nativeProvider:l,passwordMissing:i,nameRequested:p,shippingAddressRequested:v,phoneRequested:g,emailRequested:E,flexible:O,phoneToProvider:f,emailToProvider:j,currency:C,prices:y,isProviderError:d,invoiceContent:s,needCardholderName:u,needCountry:h,needZip:b,error:m,globalErrors:e.errors}},(e,t)=>Object(u.l)(t,["validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError"]))(({isOpen:e,onClose:t,step:a,shippingOptions:c,savedInfo:r,canSaveCredentials:l,nameRequested:o,shippingAddressRequested:i,phoneRequested:m,emailRequested:d,phoneToProvider:u,emailToProvider:h,currency:b,passwordMissing:p,isProviderError:g,invoiceContent:E,nativeProvider:v,prices:O,needCardholderName:f,needCountry:j,needZip:C,error:y,globalErrors:k,validateRequestedInfo:N,sendPaymentForm:I,setPaymentStep:S,sendCredentialsInfo:w,clearPaymentError:P})=>{const[M,F]=Nt(sr,rr),L=_c(b),[A,B]=Object(n.r)(!1),R=Object(T.a)();Object(n.n)(()=>{(a||y||k)&&B(!1)},[a,y,k]),Object(n.n)(()=>{if(y&&y.field)F({type:"setFormErrors",payload:{[y.field]:y.fieldError}});else if(k&&k.length){const e=Object(cr.a)(k);F({type:"setFormErrors",payload:{...e}})}},[y,k,F]),Object(n.n)(()=>{if(r){const{name:e,phone:t,email:a,shippingAddress:n}=r;F({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?"+"+t:t,email:a,...n||{}}})}},[r,F]);const G=Object(n.m)(()=>{P()},[P]),q=Object(n.p)(()=>a!==s.i.Checkout?0:function(e=[],t,a){const n=t?Cr(t,a):[];let c=0;const r=e.concat(n||[]);return c=r.reduce((e,t)=>e+t.amount,c),c}(O,c,M.shipping),[a,M.shipping,O,c]),z=Object(n.p)(()=>{if(a===s.i.Checkout)return function(e,t,a){const n=`${function(e){const t=nr(e);return ar[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,c=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:r,fullName:s}=e,l=t?jr(t,e.shipping):void 0,o=l?l.title:void 0;return{paymentMethod:n,paymentProvider:a,shippingAddress:c,name:s,phone:r,shippingMethod:o}}(M,c,v||"")},[a,M,c,v]);const $=Object(n.m)(()=>{const{saveInfo:e}=M,t=function(e){const{streetLine1:t,streetLine2:a,city:n,state:c,countryIso2:r,postCode:s,fullName:l,phone:o,email:i}=e;return{name:l,phone:o,email:i,shippingAddress:{streetLine1:t,streetLine2:a,city:n,state:c,countryIso2:r,postCode:s}}}(M);N({requestInfo:t,saveInfo:e})},[N,M]),H=Object(n.m)(()=>{const e=function(e){const{cardNumber:t,cardholder:a,expiry:n,cvv:c,billingCountry:r,billingZip:s}=e,[l,o]=n.split("/");return{data:{cardNumber:t,cardholder:a,expiryMonth:l,expiryYear:o,cvv:c,country:r,zip:s}}}(M);w({credentials:e})},[w,M]),V=Object(n.m)(()=>{I({shippingOptionId:M.shipping,saveCredentials:M.saveCredentials})},[I,M]),W=Object(n.m)(e=>{S({step:e})},[S]),Y=Object(n.m)(()=>{switch(B(!0),a){case s.i.ShippingInfo:return $();case s.i.Shipping:return W(s.i.PaymentInfo);case s.i.PaymentInfo:return H();case s.i.Checkout:return V();default:return()=>{}}},[a,$,W,H,V]),K=Object(n.p)(()=>{switch(a){case s.i.ShippingInfo:return R("PaymentShippingInfo");case s.i.Shipping:return R("PaymentShippingMethod");case s.i.PaymentInfo:return R("PaymentCardInfo");case s.i.Checkout:return R("PaymentCheckout");default:return""}},[a,R]),Z=Object(n.p)(()=>{switch(a){case s.i.Checkout:return`Pay ${L}${(q/100).toFixed(2)}`;default:return"Next Step"}},[a,q,L]);return g?n.a.createElement(Ee.a,{className:"error",isOpen:e,onClose:t},"Sorry, Telegram T doesn't support payments with this provider yet. Please use one of our mobile apps to do this.",n.a.createElement(x.a,{isText:!0,onClick:t},"OK")):n.a.createElement(Ee.a,{className:"PaymentModal",isOpen:e,onClose:t},n.a.createElement("div",{className:"header"},n.a.createElement(x.a,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("h3",null,K)),void 0!==a?n.a.createElement(U.a,{name:"slide",activeKey:a},()=>n.a.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case s.i.ShippingInfo:return n.a.createElement(mr,{state:M,dispatch:F,needAddress:Boolean(i),needEmail:Boolean(d||h),needPhone:Boolean(m||u),needName:Boolean(o)});case s.i.Shipping:return n.a.createElement(dr,{state:M,dispatch:F,shippingOptions:c||[],currency:L});case s.i.PaymentInfo:return n.a.createElement(Or,{state:M,dispatch:F,canSaveCredentials:Boolean(!p&&l),needCardholderName:f,needCountry:j,needZip:C});case s.i.Checkout:return n.a.createElement(br,{prices:O,shippingPrices:M.shipping&&c?Cr(c,M.shipping):void 0,totalPrice:q,invoiceContent:E,checkoutInfo:z,currency:L});default:return}}(a))):n.a.createElement("div",{className:"empty-content"},n.a.createElement(D.a,{color:"gray"})),n.a.createElement("div",{className:"footer"},n.a.createElement(x.a,{type:"submit",onClick:Y,disabled:A,isLoading:A},Z)),y&&!y.field&&function(){if(y)return n.a.createElement(Ee.a,{className:"error",isOpen:Boolean(y),onClose:G},n.a.createElement("h4",null,y.description||"Error"),y.description||"Error",n.a.createElement(x.a,{isText:!0,onClick:P},"OK"))}())}));function jr(e,t){return e.find(({id:e})=>e===t)}function Cr(e,t){const a=jr(e,t);return a?a.prices:void 0}var yr=Object(n.h)(Object(c.h)(e=>{const{receipt:t}=e.payment,{currency:a,prices:n,info:c,totalAmount:r,credentialsTitle:s,shippingPrices:l,shippingMethod:o,photoUrl:i,text:m,title:d}=t||{};return{currency:a,prices:n,info:c,totalAmount:r,credentialsTitle:s,shippingPrices:l,shippingMethod:o,photoUrl:i,text:m,title:d}})(({isOpen:e,onClose:t,prices:a,shippingPrices:c,totalAmount:r,currency:s,info:l,photoUrl:o,text:i,title:m,credentialsTitle:d,shippingMethod:u})=>{const h=Object(T.a)(),b=_c(s),p=Object(n.p)(()=>function(e,t,a){if(!t)return{paymentMethod:e};const{shippingAddress:n}=t,c=n&&n.streetLine1?`${n.streetLine1}, ${n.city}, ${n.countryIso2}`:void 0,{phone:r,name:s}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:c,name:s,phone:r,shippingMethod:a}}(d,l,u),[l,u,d]);return n.a.createElement(Ee.a,{className:"PaymentModal PaymentModal-receipt",isOpen:e,onClose:t},n.a.createElement("div",null,n.a.createElement("div",{className:"header"},n.a.createElement(x.a,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("h3",null," ",h("PaymentReceipt")," ")),n.a.createElement("div",{className:"receipt-content custom-scroll"},n.a.createElement(br,{prices:a,shippingPrices:c,totalPrice:r,invoiceContent:{photoUrl:o,text:i,title:m},checkoutInfo:p,currency:b}))))}))},,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(5),c=a(48);const r={MonkeyIdle:a.p+"TwoFactorSetupMonkeyIdle.dea4a492c144df84ddab778dc8a3f0cd.tgs",MonkeyTracking:a.p+"TwoFactorSetupMonkeyTracking.eb5a7a6f166fb7589c12e6248561fb58.tgs",MonkeyClose:a.p+"TwoFactorSetupMonkeyClose.604c4c833d322b7e6c3ea19bef058241.tgs",MonkeyPeek:a.p+"TwoFactorSetupMonkeyPeek.1905436b042520363d7e59f5d7f903ab.tgs",FoldersAll:a.p+"FoldersAll.3f9f9e243d19f0fbf9aaaff11cbd4572.tgs",FoldersNew:a.p+"FoldersNew.9a40d71c0c8be70f5bd14ff2d7bc1593.tgs",DiscussionGroups:a.p+"DiscussionGroupsDucks.9ea453d1be9d1b0ee77a992f8e587485.tgs"};function s(e){const t=r[e].replace(window.location.origin,"");return c.b("file"+t,n.ApiMediaFormat.Lottie)}},,,,function(e,t,a){"use strict";var n=a(0),c=a(8),r=a(1),s=a(14),l=a(93),o=a(31),i=a(98),m=a(16);a(141);const d={type:"blob",quality:.8,format:"jpeg",circle:!1};let u,h,b;var p=Object(n.h)(({file:e,onChange:t,onClose:c})=>{const[p,g]=Object(n.r)(!1);Object(n.n)(()=>{e&&(p?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:a,offsetHeight:n}=t;b=new u(t,{enableZoom:!0,boundary:{width:a,height:n},viewport:{width:a-16,height:n-16,type:"circle"}});const c=await Object(s.a)(e);await b.bind({url:c})}catch(e){r.m&&console.error(e)}}(e):async function(){return h||(h=Promise.all([a.e(5),a.e(8)]).then(a.bind(null,303)),u=(await h).default),h}().then(()=>g(!0)))},[e,p]);const E=Object(l.a)();return n.a.createElement(i.a,{isOpen:Boolean(e),onClose:c,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},p?n.a.createElement("div",{id:"avatar-crop"}):n.a.createElement(m.a,null),n.a.createElement(o.a,{className:"confirm-button",round:!0,color:"primary",onClick:async function(){if(!b)return;const e=await b.result(d),a="string"==typeof e?e:Object(s.b)(e,"avatar.jpg");t(a)},ariaLabel:E("CropImage")},n.a.createElement("i",{className:"icon-check"})))});a(142);t.a=Object(n.h)(({title:e="Change your profile picture",disabled:t,currentAvatarBlobUrl:a,onChange:r})=>{const[s,l]=Object(n.r)(),[o,i]=Object(n.r)(a);Object(n.n)(()=>{i(a)},[a]);const m=Object(c.a)(o&&"filled",t&&"disabled");return n.a.createElement("div",{className:"AvatarEditable"},n.a.createElement("label",{className:m,role:"button",tabIndex:0,title:e},n.a.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(l(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),n.a.createElement("i",{className:"icon-camera-add"}),o&&n.a.createElement("img",{src:o,alt:"Avatar"})),n.a.createElement(p,{file:s,onClose:function(){l(void 0)},onChange:function(e){l(void 0),r(e),o&&URL.revokeObjectURL(o),i(URL.createObjectURL(e))}}))})},,,,,,function(e,t,a){},,,,,,,,,,,,function(e,t,a){"use strict";var n=a(0),c=a(1),r=a(7),s=a(116),l=a(106);a(126);const o=[0,50],i=[0,20],m=[20,0],d=r.f?c.fb:c.eb;t.a=Object(n.h)(({isPasswordVisible:e,isBig:t})=>{const[a,r]=Object(n.r)(),[u,h]=Object(n.r)(),[b,p]=Object(n.r)(!1),[g,E]=Object(n.r)(!1);Object(n.n)(()=>{a?setTimeout(()=>E(!0),2e3):Object(s.a)("MonkeyClose").then(r)},[a]),Object(n.n)(()=>{u||Object(s.a)("MonkeyPeek").then(h)},[u]);const v=Object(n.m)(()=>p(!0),[]);return n.a.createElement("div",{id:"monkey",className:t?"big":""},!b&&n.a.createElement("div",{className:"monkey-preview"}),a&&n.a.createElement(l.a,{id:"closeMonkey",size:t?c.pb:d,className:g?"hidden":"shown",animationData:a,playSegment:o,noLoop:!0,onLoad:v}),u&&n.a.createElement(l.a,{id:"peekMonkey",size:t?c.pb:d,className:g?"shown":"hidden",animationData:u,playSegment:e?i:m,noLoop:!0}))})},function(e,t,a){"use strict";var n=a(0),c=a(1),r=a(7),s=a(8),l=a(31);const o=r.f?550:400;t.a=Object(n.h)(({isLoading:e=!1,isPasswordVisible:t,error:a,hint:i,placeholder:m="Password",submitLabel:d="Next",clearError:u,onChangePasswordVisibility:h,onInputChange:b,onSubmit:p})=>{const g=Object(n.q)(null),[E,v]=Object(n.r)(""),[O,f]=Object(n.r)(!1);return Object(n.n)(()=>{r.k||setTimeout(()=>{g.current.focus()},o)},[]),Object(n.n)(()=>{a&&requestAnimationFrame(()=>{g.current.focus(),g.current.select()})},[a]),n.a.createElement("form",{action:"",onSubmit:function(t){t.preventDefault(),e||O&&p(E)},autoComplete:"off"},n.a.createElement("div",{className:Object(s.a)("input-group password-input",E&&"touched",a&&"error")},n.a.createElement("input",{ref:g,className:"form-control",type:t?"text":"password",id:"sign-in-password",value:E||"",autoComplete:"current-password",onChange:function(e){a&&u();const{target:t}=e;v(t.value),f(t.value.length>=c.Q),b&&b(t.value)}}),n.a.createElement("label",null,a||i||m),n.a.createElement("div",{className:"toggle-password",onClick:function(){h(!t)},role:"button",tabIndex:0,title:"Toggle password visibility"},n.a.createElement("i",{className:t?"icon-eye":"icon-eye-closed"}))),O&&n.a.createElement(l.a,{type:"submit",ripple:!0,isLoading:e},d))})},,function(e,t,a){},function(e,t,a){},,,,,,,,,,,,,function(e,t,a){},,,,,,,,,,,,,,,,,,,function(e,t,a){},function(e,t,a){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){}])]); |