telegram-tt/dist/3.4fb864b3e2b33dcf0b8a.js
Alexander Zinchuk 49c53817ce [Build]
2021-07-26 17:38:03 +03:00

2 lines
260 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window.webpackJsonp=window.webpackJsonp||[]).push([[3],Array(105).concat([function(e,t,a){"use strict";a.r(t),a.d(t,"MediaViewer",(function(){return me})),a.d(t,"ForwardPicker",(function(){return Ce})),a.d(t,"Dialogs",(function(){return Ne})),a.d(t,"Notifications",(function(){return Se})),a.d(t,"SafeLinkModal",(function(){return Me})),a.d(t,"HistoryCalendar",(function(){return Te})),a.d(t,"CalendarModal",(function(){return Re})),a.d(t,"DeleteMessageModal",(function(){return De})),a.d(t,"PinMessageModal",(function(){return Be})),a.d(t,"UnpinAllMessagesModal",(function(){return xe})),a.d(t,"MessageSelectToolbar",(function(){return He})),a.d(t,"LeftSearch",(function(){return It})),a.d(t,"Settings",(function(){return En})),a.d(t,"ContactList",(function(){return jn})),a.d(t,"NewChat",(function(){return wn})),a.d(t,"NewChatStep1",(function(){return yn})),a.d(t,"NewChatStep2",(function(){return kn})),a.d(t,"ArchivedChats",(function(){return In})),a.d(t,"ContextMenuContainer",(function(){return Gn})),a.d(t,"StickerSetModal",(function(){return qn})),a.d(t,"HeaderMenuContainer",(function(){return _n})),a.d(t,"MobileSearch",(function(){return Vn})),a.d(t,"AttachmentModal",(function(){return sc})),a.d(t,"PollModal",(function(){return oc})),a.d(t,"SymbolMenu",(function(){return Ac})),a.d(t,"AttachMenu",(function(){return Lc})),a.d(t,"MentionTooltip",(function(){return nc})),a.d(t,"StickerTooltip",(function(){return Rc})),a.d(t,"BotKeyboardMenu",(function(){return Tc})),a.d(t,"CustomSendMenu",(function(){return Dc})),a.d(t,"DropArea",(function(){return Bc.b})),a.d(t,"TextFormatter",(function(){return xc.a})),a.d(t,"EmojiTooltip",(function(){return Gc})),a.d(t,"InlineBotTooltip",(function(){return Wc})),a.d(t,"RightSearch",(function(){return Yc})),a.d(t,"StickerSearch",(function(){return Xc})),a.d(t,"GifSearch",(function(){return es})),a.d(t,"PollResults",(function(){return as})),a.d(t,"Management",(function(){return vs})),a.d(t,"PaymentModal",(function(){return zs})),a.d(t,"ReceiptModal",(function(){return $s}));var n=a(0),c=a(1),s=a(8),r=a(13),o=a(2),l=a(6),i=a(54),d=a(118),m=a(7),u=a(4),b=a(3),h=a(136),g=a(48),p=a(181),v=a(31),O=a(110),E=a(123),f=a(196),j=a(30),C=a(51),y=a(149);function k(e,t,a,n,c,s){const{mediaEl:l}=P(t,s);if(!l)return;const{width:m}=i.a.get(),{width:u,height:b}=Object(d.l)(e,c),{width:h,height:g}=Object(d.f)(u,b,n.width,n.height),p=(m-h)/2,v=function(e){const t=window.matchMedia(d.c);let a=4.125;e&&(a+=t.matches?.875:3.375);return a*d.d}(e)+(b-g)/2;let{top:O,left:E,width:f,height:j}=l.getBoundingClientRect();if([r.h.SharedMedia,r.h.Album,r.h.ScheduledAlbum,r.h.SearchResult].includes(t)){const e=function(e,t,a,n,c,s){if(e===t){const r=Math.max(c,s)*(e/t);n-=(r-c)/2,a-=(r-s)/2,c=r,s=r}else if(e>t){const a=c;n-=((c=s*(e/t))-a)/2}else if(t>e){const n=s;a-=((s=c*(t/e))-n)/2}return{top:a,left:n,width:c,height:s}}(h,g,O,E,f,j);O=e.top,E=e.left,f=e.width,j=e.height}const C=E+f/2-(p+h/2),y=O+j/2-(v+g/2),k=f/h,N=j/g,S=w(a||l);I(S,{top:v+"px",left:p+"px",width:h+"px",height:g+"px",transform:`translate3d(${C}px, ${y}px, 0) scale(${k}, ${N})`}),M(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.contains(S)&&document.body.removeChild(S),document.body.classList.remove("ghost-animating")})},200+o.c)})})}function N(e,t,a){const{container:n,mediaEl:c}=P(e,a);if(!c)return;const s=document.getElementById("MediaViewer").querySelector(".active .media-viewer-content img, .active .media-viewer-content video");if(!s||!c)return;const{top:l,left:d,width:m,height:u}=s.getBoundingClientRect(),{top:b,left:h,width:g,height:p}=c.getBoundingClientRect();let v=b;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();v=b<l?-p:e}const O=d+m/2-(h+g/2),E=l+u/2-(v+p/2);let f=m/g,j=u/p;const C=[r.h.Inline,r.h.ScheduledInline].includes(e)&&!S(n,c)||[r.h.Album,r.h.ScheduledAlbum].includes(e)&&!S(n,c);[r.h.SharedMedia,r.h.Album,r.h.ScheduledAlbum,r.h.SearchResult].includes(e)&&(f>j?f=j:j>f&&(j=f));const y=document.getElementsByClassName("ghost")[0],k=y||w(t||c,e===r.h.ProfileAvatar);y||I(k,{top:v+"px",left:h+"px",width:g+"px",height:p+"px",transform:`translate3d(${O}px, ${E}px, 0) scale(${f}, ${j})`}),requestAnimationFrame(()=>{if(y){const{top:e,left:t,width:a,height:n}=y.getBoundingClientRect();I(k,{transition:"none",top:v+"px",left:h+"px",transformOrigin:"top left",transform:`translate3d(${t-h}px, ${e-v}px, 0) scale(${a/g}, ${n/p})`,width:g+"px",height:p+"px"})}document.body.classList.add("ghost-animating"),y||document.body.appendChild(k),requestAnimationFrame(()=>{y&&(y.style.transition=""),k.style.transform="",C&&(k.style.opacity="0"),M(k,e),setTimeout(()=>{requestAnimationFrame(()=>{document.body.contains(k)&&document.body.removeChild(k),document.body.classList.remove("ghost-animating")})},200+o.c)})})}function w(e,t=!1){const a=document.createElement("div");a.classList.add("ghost");const n=new Image;if("string"==typeof e?n.src=e:e instanceof HTMLVideoElement?n.src=e.poster:n.src=e.src,a.appendChild(n),t){a.classList.add("ProfileInfo");const e=document.querySelector("#RightColumn .ProfileInfo .info");e&&a.appendChild(e.cloneNode(!0))}return a}function S(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 I(e,t){Object.assign(e.style,t)}function P(e,t){let a,n;switch(e){case r.h.Album:case r.h.ScheduledAlbum:a=".active > .MessageList #album-media-"+t.id,n=".full-media";break;case r.h.SharedMedia:a="#shared-media"+t.id,n="img";break;case r.h.SearchResult:a="#search-media"+t.id,n="img";break;case r.h.MiddleHeaderAvatar:a=".MiddleHeader .ChatInfo .Avatar",n="img.avatar-media";break;case r.h.ProfileAvatar:a="#RightColumn .ProfileInfo .active .ProfilePhoto",n="img.avatar-media";break;case r.h.ScheduledInline:case r.h.Inline:default:a=".active > .MessageList #message"+t.id,n=".message-content .full-media, .message-content .thumbnail"}const c=document.querySelector(a),s=c&&c.querySelectorAll(n);return{container:c,mediaEl:s&&s[s.length-1]}}function M(e,t){switch(t){case r.h.Album:case r.h.ScheduledAlbum:case r.h.Inline:case r.h.ScheduledInline:e.classList.add("rounded-corners");break;case r.h.SharedMedia:case r.h.ProfileAvatar:case r.h.SearchResult:e.firstChild.style.objectFit="cover";break;case r.h.MiddleHeaderAvatar:e.classList.add("circle")}}var F=a(16),A=a(38),L=a(26),R=a(161),T=a(113),D=a(21),B=a(29),x=a(22),U=a(114);a(259);var G=Object(c.h)((e,{chatId:t,messageId:a,isAvatar:n})=>{if(n&&t)return{sender:Object(u.ob)(t)?Object(m.Jb)(e,t):Object(m.g)(e,t)};if(!a||!t)return{};const c=Object(m.l)(e,t,a);return{message:c,sender:c&&Object(m.vb)(e,c)}},(e,t)=>Object(b.l)(t,["closeMediaViewer","focusMessage"]))(({chatId:e,messageId:t,sender:a,isAvatar:c,message:s,closeMediaViewer:r,focusMessage:o})=>{const l=Object(n.m)(()=>{r(),o({chatId:e,messageId:t})},[e,o,t,r]),i=Object(F.a)();if(!a||!s&&!c)return;const d=a.id<0,m=Object(u.X)(i,a);return n.a.createElement("div",{className:"SenderInfo",onClick:l},d?n.a.createElement(U.a,{key:a.id,size:"medium",chat:a}):n.a.createElement(U.a,{key:a.id,size:"medium",user:a}),n.a.createElement("div",{className:"meta"},n.a.createElement("div",{className:"title",dir:"auto"},m&&Object(x.a)(m)),n.a.createElement("div",{className:"date",dir:"auto"},c?i("lng_mediaview_profile_photo"):Object(B.d)(i,1e3*s.date))))}),q=a(184),z=a(63),_=a(42),H=a(124);a(260);var $=({mediaData:e,isVideo:t,isZoomed:a,message:c,fileName:s,isAvatar:r,onCloseMediaViewer:o,onForward:i,onZoomToggle:d})=>{const{isDownloadStarted:m,downloadProgress:b,handleDownloadClick:h}=Object(q.a)(c&&t?Object(u.E)(c,"download"):void 0,s),g=Object(F.a)(),p=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(D.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 l.l?n.a.createElement("div",{className:"MediaViewerActions-mobile"},n.a.createElement(z.a,{trigger:p,positionX:"right"},!r&&n.a.createElement(_.a,{icon:"forward",onClick:i},g("Forward")),t?n.a.createElement(_.a,{icon:m?"close":"download",onClick:h},m?Math.round(100*b)+"% Downloading...":"Download"):n.a.createElement(_.a,{icon:"download",href:e,download:s},g("AccActionDownload"))),m&&n.a.createElement(H.a,{progress:b,size:"s",noCross:!0})):n.a.createElement("div",{className:"MediaViewerActions"},!r&&n.a.createElement(n.a.Fragment,null,n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:g("Forward"),onClick:i},n.a.createElement("i",{className:"icon-forward"}))),t?n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:g("AccActionDownload"),onClick:h},m?n.a.createElement(H.a,{progress:b,size:"s",onClick:h}):n.a.createElement("i",{className:"icon-download"})):n.a.createElement(D.a,{href:e,download:s,round:!0,size:"smaller",color:"translucent-white",ariaLabel:g("AccActionDownload")},n.a.createElement("i",{className:"icon-download"})),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:a?"Zoom Out":"Zoom In",onClick:d},n.a.createElement("i",{className:a?"icon-zoom-out":"icon-zoom-in"})),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:g("Close"),onClick:o},n.a.createElement("i",{className:"icon-close"})))},V=a(10),W=a(9);a(261);var K=({text:e="",isHidden:t,isForVideo:a,onClick:c})=>{const[s,r]=Object(n.r)(!1);Object(n.n)(()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;r(t>2*d.d)};t();const a=Object(V.h)(t,500,!0);return window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}},[]);const o=Object(W.a)("MediaViewerFooter",a&&"is-for-video",t&&"is-hidden");return n.a.createElement("div",{className:o,onClick:function(t){e&&t.stopPropagation()}},e&&n.a.createElement("div",{className:"media-viewer-footer-content",onClick:l.l?void 0:c},n.a.createElement("p",{className:"media-text custom-scroll "+(s?"multiline":""),dir:"auto"},e)))},Y=a(39),Q=a(140);const J=function(){if(void 0!==document.fullscreenElement)return"fullscreenElement";if(void 0!==document.mozFullScreenElement)return"mozFullScreenElement";if(void 0!==document.webkitFullscreenElement)return"webkitFullscreenElement";return""}();var Z=a(150),X=a(139);const ee=["bytes","kB","MB","GB","TB","PB"];var te=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${ee[t]}`};a(262);const ae=e=>{e.stopPropagation()};var ne=({bufferedProgress:e,currentTime:t,duration:a,fileSize:c,isForceVisible:s,isForceMobileVersion:r,isPlayed:o,isFullscreenSupported:i,isFullscreen:d,onChangeFullscreen:m,onPlayPause:u,onSeek:b})=>{const[h,g]=Object(n.r)(!0);Object(n.n)(()=>{s&&g(s)},[s]),Object(n.n)(()=>{let e;return s||(l.l?g(!1):e=window.setTimeout(()=>{g(!1)},800)),()=>{e&&window.clearTimeout(e)}},[s]),Object(n.n)(()=>((h||s)&&document.body.classList.add("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")}),[s,h]);const p=Object(F.a)();var v,O;if(h||s)return n.a.createElement("div",{className:"VideoPlayerControls "+(r?"mobile":""),onClick:ae},function(e,t,a,c){const s=e/t*100,r=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: ${r||0}%`}),n.a.createElement("div",{className:"player-seekline-played",style:`width: ${s||0}%`}),n.a.createElement("input",{min:"0",max:"100",step:.01,type:"range",onInput:c,className:"player-seekline-input",value:s||0})))}(t,a,e,b),n.a.createElement(D.a,{ariaLabel:p("AccActionPlay"),size:"tiny",ripple:!l.l,color:"translucent-white",className:"play",onClick:u},n.a.createElement("i",{className:o?"icon-pause":"icon-play"})),function(e,t){return n.a.createElement("div",{className:"player-time"},`${Object(B.e)(e)} / ${Object(B.e)(t)}`)}(t,a),e<1&&(v=e,O=c,n.a.createElement("div",{className:"player-file-size"},`${te(O*v)} / ${te(O)}`)),i&&n.a.createElement(D.a,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",onClick:m},n.a.createElement("i",{className:""+(d?"icon-smallscreen":"icon-fullscreen")})))};a(263);function ce(){return(ce=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:s,fileSize:r,isMediaViewerOpen:o,noPlay:i,onClose:d})=>{const m=Object(n.q)(null),[u,b]=Object(n.r)(!l.n||!l.e),[h,g]=Object(n.r)(0),[p,v]=Object(n.r)(!0),[O,E,f]=function(e,t){const[a,c]=Object(n.r)(Boolean(J&&document[J]));return Object(n.o)(()=>{const a=()=>{c(Boolean(J&&document[J]))},n=()=>{c(!0)},s=()=>{c(!1),t(!1)},r=e.current;return document.addEventListener("fullscreenchange",a,!1),document.addEventListener("webkitfullscreenchange",a,!1),document.addEventListener("mozfullscreenchange",a,!1),r&&(r.addEventListener("webkitbeginfullscreen",n,!1),r.addEventListener("webkitendfullscreen",s,!1)),()=>{document.removeEventListener("fullscreenchange",a,!1),document.removeEventListener("webkitfullscreenchange",a,!1),document.removeEventListener("mozfullscreenchange",a,!1),r&&(r.removeEventListener("webkitbeginfullscreen",n,!1),r.removeEventListener("webkitendfullscreen",s,!1))}},[]),J||"iOS"===l.r?[a,()=>{e.current&&(J||"iOS"===l.r)&&(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]}(m,b),{isBuffered:j,bufferedProgress:C,bufferingHandlers:y}=Object(Q.a)(),{shouldRender:k,transitionClassNames:N}=Object(Y.a)(!j,void 0,void 0,"slow"),{shouldRender:w,transitionClassNames:S}=Object(Y.a)(l.e&&!u&&!k,void 0,void 0,"slow");Object(n.n)(()=>{i||!o?m.current.pause():e&&!l.n&&Object(X.a)(m.current)},[i,o,e]),Object(n.n)(()=>{m.current.currentTime===m.current.duration?(g(0),b(!1)):g(m.current.currentTime)},[h]);const I=Object(n.m)(e=>{e.stopPropagation(),u?(m.current.pause(),b(!1)):(m.current.play(),b(!0))},[u]);Object(Z.a)(m,[]);const P=Object(n.m)(()=>{v(!0)},[]),M=Object(n.m)(()=>{v(!1)},[]),F=Object(n.m)(e=>{g(e.currentTarget.currentTime)},[]),A=Object(n.m)(()=>{g(0),b(!1)},[]),L=Object(n.m)(()=>{O&&f?f():!O&&E&&E()},[f,O,E]),R=Object(n.m)(e=>{e.stopPropagation(),m.current.currentTime=Number(e.target.value)*m.current.duration/100},[]),T=Object(n.m)(e=>{e.stopPropagation(),v(!p)},[p]);Object(n.n)(()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),I(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}},[I]);const B=c&&`width: ${c.width}px; height: ${c.height}px`,x=`background-image: url(${a})`;return n.a.createElement("div",{className:"VideoPlayer",onClick:!t&&l.l?T:void 0,onMouseOver:t?void 0:P,onMouseOut:t?void 0:M},n.a.createElement("div",{style:B},n.a.createElement("video",ce({ref:m,autoPlay:l.n,playsInline:!0,loop:t,muted:t,id:"media-viewer-video",style:x,onEnded:A,onClick:l.l?void 0:I,onDoubleClick:L},y,{onTimeUpdate:F}),e&&n.a.createElement("source",{src:e}))),w&&n.a.createElement(D.a,{round:!0,className:"play-button "+S,onClick:I},n.a.createElement("i",{className:"icon-play"})),k&&n.a.createElement("div",{className:["spinner-container",N].join(" ")},!j&&n.a.createElement("div",{className:"buffering"},"Buffering..."),n.a.createElement(H.a,{size:"xl",progress:j?1:s,square:!0,onClick:d})),!t&&!k&&n.a.createElement(ne,{isPlayed:u,bufferedProgress:C,currentTime:h,isFullscreenSupported:Boolean(E),isFullscreen:O,fileSize:r,duration:m.current?m.current.duration:0,isForceVisible:!u||p,isForceMobileVersion:c&&c.width<400,onSeek:R,onChangeFullscreen:L,onPlayPause:I}))});a(264);var re=Object(n.h)(({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:a}=Object(Y.a)(e),c=Object(j.a)(e),s=Object(n.q)(null),[r,o]=Object(n.r)(1),i=Object(n.q)(!1);Object(n.n)(()=>{e&&!c&&o(1.5)},[e,c]);const d=Object(n.m)(()=>{i.current=!0},[]),m=Object(n.m)(()=>{i.current=!1,1===r&&t(r,!i.current)},[t,r]);Object(n.n)(()=>{t(r,!i.current)},[r,t]);const u=Object(F.a)(),b=Object(W.a)("ZoomControls",a);return n.a.createElement("div",{className:b},n.a.createElement(D.a,{disabled:1===r,size:"tiny",color:"translucent-white",ariaLabel:u("ZoomOut"),className:"zoom-out",ripple:!l.l,onClick:()=>{s.current&&o(Math.max(1,r-.5))}},n.a.createElement("i",{className:"icon-zoom-out"})),n.a.createElement(D.a,{disabled:3===r,size:"tiny",color:"translucent-white",ariaLabel:"Zoom In",className:"zoom-in",ripple:!l.l,onClick:()=>{s.current&&o(Math.min(3,r+.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*(r-1)}%`}),n.a.createElement("input",{ref:s,min:1,max:3,step:"0.5",value:r,type:"range",className:"seekline-input",onChange:e=>{o(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown:d,onMouseUp:m}))))});a(265);const oe=[1,0,0,1,0,0],le={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5};var ie=Object(n.h)(({children:e,className:t,noWrap:a,canPan:c,zoomLevel:s,panDeltaX:r,panDeltaY:o,onPan:l})=>{const i=le[s]||s,[d,m]=Object(n.r)(!1),[u,h]=Object(n.r)({dx:r,dy:o,x:0,y:0}),[g,p]=Object(n.r)(oe),v=Object(n.q)(null),O=Object(n.q)(null);Object(n.n)(()=>{const e=i||g[0],t=r||g[4],a=o||g[5],n=[...g];g[0]!==e&&(n[0]=e||n[0],n[3]=e||n[3]),g[4]!==t&&(n[4]=t),g[5]!==a&&(n[5]=a),Object(b.a)(g,n)||p(function(e,t,a){const n=a&&a.querySelector(".active img");if(!a||!n)return t;const c=a.getBoundingClientRect(),s=n.getBoundingClientRect(),r=s.width/e*t[0],o=s.height/e*t[3],l=(c.width-r)/2+t[4],i=(c.height-o)/2+t[5];return c.width&&c.width-150<l?t[4]-=l+c.width-150:r&&r+l<150&&(t[4]-=r+l-150),c.height&&c.height-150<i?t[5]-=i+c.height-150:o&&o+i<150&&(t[5]-=o+i-150),t}(g[0],n,v.current))},[r,o,i]),Object(n.n)(()=>{c||p(oe)},[c]),Object(n.n)(()=>{O.current&&(O.current.style.transform=`matrix(${g.toString()})`)},[a,g]);return a?e:n.a.createElement("div",{ref:v,className:"pan-wrapper "+(t||""),onMouseDown:e=>{if(!c)return;e.stopPropagation(),e.preventDefault();const t={dx:g[4],dy:g[5],x:e.pageX,y:e.pageY};h(t),m(!0),v.current&&v.current.classList.add("move")},onMouseUp:()=>{m(!1),v.current&&v.current.classList.remove("move"),l&&l(g[4],g[5])},onMouseMove:e=>{if(d){const t=function(e,t){const a=[...g],n=u.x-e,c=u.y-t;return a[4]=u.dx-n,a[5]=u.dy-c,a}(e.pageX,e.pageY);p(t),O.current&&(O.current.style.transform=`matrix(${g.toString()})`)}}},n.a.createElement("div",{ref:O,className:"pan-container"},e))});a(266);function de(e,t,a){return e?n.a.createElement("img",{src:e,alt:"",style:t?`width: ${t.width}px`:"",draggable:Boolean(a)}):n.a.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},n.a.createElement(L.a,{color:"white"}))}var me=Object(n.h)(Object(c.h)(e=>{const{chatId:t,threadId:a,messageId:n,avatarOwnerId:c,profilePhotoIndex:s,origin:o}=e.mediaViewer,{animationLevel:l}=e.settings.byKey;if(o===r.h.SearchResult){if(!t||!n)return{animationLevel:l};const a=Object(m.l)(e,t,n);return a?{chatId:t,messageId:n,senderId:a.senderId,origin:o,message:a,animationLevel:l}:{animationLevel:l}}if(c){return{messageId:-1,senderId:c,avatarOwner:Object(m.Jb)(e,c)||Object(m.g)(e,c),profilePhotoIndex:s||0,animationLevel:l,origin:o}}if(!(t&&a&&n))return{animationLevel:l};let i,d,u;if(i=o&&[r.h.ScheduledAlbum,r.h.ScheduledInline].includes(o)?Object(m.rb)(e,t,n):Object(m.l)(e,t,n),!i)return{animationLevel:l};if(d=o&&[r.h.ScheduledAlbum,r.h.ScheduledInline].includes(o)?Object(m.sb)(e,t):Object(m.n)(e,t),o===r.h.Inline||o===r.h.Album)u=Object(m.hb)(e,t,a)||Object(m.Z)(e,t,a);else if(o===r.h.SharedMedia){const t=Object(m.w)(e),{foundIds:a}=t&&t.resultsByType&&t.resultsByType.media||{};u=a}return{chatId:t,threadId:a,messageId:n,senderId:i.senderId,origin:o,message:i,chatMessages:d,collectionIds:u,animationLevel:l}},(e,t)=>Object(b.l)(t,["openMediaViewer","closeMediaViewer","openForwardMenu","focusMessage"]))(({chatId:e,threadId:t,messageId:a,senderId:c,origin:m,avatarOwner:b,profilePhotoIndex:w,message:S,chatMessages:I,collectionIds:P,openMediaViewer:M,closeMediaViewer:L,openForwardMenu:B,focusMessage:x,animationLevel:U})=>{const q=Boolean(b||a),z=m===r.h.SharedMedia,_=m===r.h.SearchResult,H=S?Object(u.H)(S):void 0,V=S?Object(u.Q)(S):void 0,W=S?Object(u.S)(S):void 0,Y=S?Object(u.T)(S):void 0,Q=!!S&&Object(u.vb)(S),J=!!S&&Object(u.wb)(S),Z=Boolean(V||Y||J),X=Boolean(!Z&&(H||W||Q)),{isGif:ee}=V||Y||{},te=Boolean(b),ae=Boolean(W||Y),ne=Object(n.p)(()=>ae&&a?[a]:Object(u.h)(I||{},P||[],z),[ae,a,I,P,z]),ce=a?ne.indexOf(a):-1,oe=0===ce||-1===ce,le=ce===ne.length-1||-1===ce,me=Object(n.q)(),ue=Object(j.a)(c);!q||ue&&ue===c&&me.current||(me.current=ce);const be=U>=1?"mv-slide":"none",he=2===U?"slide-fade":"none",ge=2===U,[pe,ve]=Object(n.r)(!1),[Oe,Ee]=Object(n.r)(!1),[fe,je]=Object(n.r)(!1),[Ce,ye]=Object(n.r)(1),[ke,Ne]=Object(n.r)({x:0,y:0});function we(e){if(te&&void 0!==w){const{photos:t}=b;return t&&t[w]?`photo${t[w].id}?size=c`:Object(u.e)(b,e?"big":"normal")}return S&&Object(u.E)(S,e?"viewerFull":"viewerPreview")}const Se=Object(O.a)(S&&(z||_)&&Object(u.E)(S,"pictogram"),void 0,s.ApiMediaFormat.BlobUrl,void 0,ge&&350),Ie=we(),Pe=Object(O.a)(Ie,void 0,te&&Ie&&Ie.startsWith("profilePhoto")?s.ApiMediaFormat.DataUri:s.ApiMediaFormat.BlobUrl,void 0,ge&&350),{mediaData:Me,downloadProgress:Fe}=Object(E.a)(we(!0),void 0,S&&Object(u.D)(S,"viewerFull"),void 0,ge&&350),Ae=H||V?(H||V).blobUrl:void 0;let Le=!Z&&(Ae||Me)||Pe||Se;const Re=Object(f.a)(!Le&&S&&Object(u.F)(S));Le||m===r.h.SearchResult||(Le=Re);const Te=S?Object(u.A)(S):void 0,De=S?Object(u.z)(S):te?`avatar${b.id}-${w}.jpg`:void 0;let Be;S?Q||J?Be=Object(u.y)(S).mediaSize:H||W?Be=Object(u.U)(H||W):(V||Y)&&(Be=Object(u.db)(V||Y)):Be=d.a,Object(n.n)(()=>{l.l&&document.body.classList.toggle("is-media-viewer-open",q)},[q]);const xe=Object(v.a)();Object(n.n)(()=>{const e=window.matchMedia(d.c);return"function"==typeof e.addEventListener?e.addEventListener("change",xe):"function"==typeof e.addListener&&e.addListener(xe),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",xe):"function"==typeof e.removeListener&&e.removeListener(xe)}},[xe]);const Ue=Object(j.a)(S),Ge=Object(j.a)(m),qe=Object(j.a)(b),ze=Object(j.a)(Le);Object(n.n)(()=>{if(ge&&q&&!Ue&&!qe){Object(C.b)(350+o.c);const e=S?Object(y.a)(S):void 0;k(Boolean(e),m,Le,Be,Z,S)}ge&&!q&&(Ue||qe)&&(Object(C.b)(350+o.c),N(Ge,ze,Ue||void 0))},[ge,q,m,Ge,S,Ue,qe,Le,ze,Be,Z]),Object(n.n)(()=>{let e;return fe?Ee(!0):e=window.setTimeout(()=>{Ee(!1)},350),()=>{e&&window.clearTimeout(e)}},[fe]);const _e=()=>{je(!1),ye(1),Ne({x:0,y:0})},He=Object(n.m)(()=>{je(!fe),ye(fe?1:1.5),fe&&Ne({x:0,y:0})},[fe]),$e=Object(n.m)((e,t=!1)=>{ye(e),1===e&&t&&_e()},[]),Ve=Object(n.m)(()=>{L(),_e()},[L]),We=Object(n.m)(()=>{Ve(),x({chatId:e,threadId:t,messageId:a})},[Ve,e,t,x,a]),Ke=Object(n.m)(()=>{B({fromChatId:e,messageIds:[a]}),_e()},[B,e,a]);Object(n.n)(()=>q?Object(g.a)(()=>{fe?_e():Ve()}):void 0,[Ve,q,fe]),Object(n.n)(()=>{Z&&!ee&&Object(p.b)()},[ee,Z]),Object(n.n)(()=>{if(q)return i.a.disableRefresh(),()=>{i.a.enableRefresh()}},[q]);const Ye=Object(n.m)((e,t)=>{let a=ne.indexOf(e);return(-1===t&&a>0||1===t&&a<ne.length-1)&&(a+=t),ne[a]},[ne]),Qe=Object(n.m)(()=>{oe||M({chatId:e,threadId:t,messageId:a?Ye(a,-1):void 0,origin:m})},[e,t,Ye,oe,a,M,m]),Je=Object(n.m)(()=>{le||M({chatId:e,threadId:t,messageId:a?Ye(a,1):void 0,origin:m})},[e,t,Ye,le,a,M,m]);Object(n.n)(()=>{const e=e=>{switch(e.key){case"Left":case"ArrowLeft":Qe();break;case"Right":case"ArrowRight":Je()}};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=ee&&!l.e;return Object(h.b)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:()=>{fe||l.n||Ve()},onSwipe:l.n?(e,t)=>{t===h.a.Right?Qe():t===h.a.Left?Je():e.target&&e.target.closest(".MediaViewerFooter")||Ve()}:void 0})},[Ve,pe,ee,X,fe,Je,Qe]);const Ze=Object(n.m)((e,t)=>{Ne({x:e,y:t})},[]),Xe=Object(n.m)(()=>{l.n&&(X||ee)&&ve(!pe)},[pe,ee,X]),et=Object(F.a)();function tt(t){if(te)return n.a.createElement("div",{key:e,className:"media-viewer-content"},de(Me||Pe,Object(d.h)(d.a,!1),!l.l&&!fe));if(S){const e=Object(y.a)(S),c=Boolean(e);return n.a.createElement("div",{key:a,className:"media-viewer-content "+(c?"has-footer":""),onClick:Xe},X&&de(Ae||Me||Pe||Se,S&&Object(d.h)(Be,c),!l.l&&!fe),Z&&n.a.createElement(se,{key:a,url:Ae||Me,isGif:ee,posterData:Le,posterSize:S&&Object(d.h)(Be,c,!0),downloadProgress:Fe,fileSize:Te,isMediaViewerOpen:q,noPlay:!t,onClose:Ve}),e&&n.a.createElement(K,{text:e,onClick:We,isHidden:pe&&(!Z||ee),isForVideo:Z&&!ee}))}}function at(){return te?n.a.createElement(G,{key:b.id,chatId:b.id,isAvatar:!0}):n.a.createElement(G,{key:a,chatId:e,messageId:a})}return Object(A.a)(q,L,M,{chatId:e,threadId:t,messageId:a,origin:m,avatarOwnerId:b&&b.id}),n.a.createElement(R.a,{id:"MediaViewer",className:fe?"zoomed":"",isOpen:q},()=>n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"media-viewer-head",dir:et.isRtl?"rtl":void 0},l.l&&n.a.createElement(D.a,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:et("Close"),onClick:Ve},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(T.a,{activeKey:me.current,name:he},at),n.a.createElement($,{mediaData:Me||Pe,isVideo:Z,isZoomed:fe,message:S,fileName:De,onCloseMediaViewer:Ve,onForward:Ke,onZoomToggle:He,isAvatar:te})),n.a.createElement(ie,{noWrap:!Oe,canPan:fe,panDeltaX:ke.x,panDeltaY:ke.y,zoomLevel:Ce,onPan:Ze},n.a.createElement(T.a,{className:"slide-container",activeKey:ce,name:be},tt)),!oe&&n.a.createElement("button",{type:"button",className:"navigation prev "+(Z&&!ee&&"inline"),"aria-label":et("AccDescrPrevious"),dir:et.isRtl?"rtl":void 0,onClick:Qe}),!le&&n.a.createElement("button",{type:"button",className:"navigation next "+(Z&&!ee&&"inline"),"aria-label":et("Next"),dir:et.isRtl?"rtl":void 0,onClick:Je}),n.a.createElement(re,{isShown:fe,onChangeZoom:$e})))})),ue=a(53),be=a(131),he=a(64),ge=a(20),pe=a(112),ve=a(46),Oe=a(115),Ee=a(108),fe=a(111),je=a(128);a(267);var Ce=Object(n.h)(Object(c.h)(e=>{const{chats:{byId:t,listIds:a,orderedPinnedIds:n},currentUserId:c}=e;return{chatsById:t,pinnedIds:n.active,activeListIds:a.active,archivedListIds:a.archived,currentUserId:c}},(e,t)=>Object(b.l)(t,["setForwardChatId","exitForwardMode","loadMoreChats"]))(({chatsById:e,pinnedIds:t,activeListIds:a,archivedListIds:c,currentUserId:r,isOpen:o,setForwardChatId:i,exitForwardMode:d,loadMoreChats:m})=>{const[h,g]=Object(n.r)(""),p=Object(n.q)(null),v=Object(F.a)();Object(n.n)(()=>{o?l.l||setTimeout(()=>{requestAnimationFrame(()=>{p.current&&p.current.focus()})},500):(p.current&&p.current.blur(),setTimeout(()=>{g("")},300))},[o]);const O=Object(n.p)(()=>{const n=[...a||[],...c||[]];let o=t||[];return r&&(o=Object(b.o)([r,...o])),Object(u.Ib)([...n.filter(t=>{const a=e[t];return!a||!!Object(u.d)(a,s.MAIN_THREAD_ID)&&(!h||Object(ue.a)(Object(u.k)(v,e[t],void 0,t===r),h))})],e,void 0,o)},[a,c,e,r,h,v,t]),[E,f]=Object(be.a)(m,O,Boolean(h)),j=Object(n.m)(e=>{g(e.currentTarget.value)},[]),C=Object(n.q)(null),y=Object(he.a)(C,o,e=>{E&&E.length>0&&i({id:E[-1===e?0:e]})},".ListItem-button",!0),k=n.a.createElement("div",{className:"modal-header",dir:v.isRtl?"rtl":void 0},n.a.createElement(D.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:v("Close"),onClick:d},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(ve.a,{ref:p,value:h,onChange:j,onKeyDown:y,placeholder:v("ForwardTo")}));return n.a.createElement(pe.a,{isOpen:o,onClose:d,className:"ForwardPicker",header:k},E&&E.length?n.a.createElement(Oe.a,{className:"picker-list custom-scroll",items:E,onLoadMore:f,noScrollRestore:Boolean(h),ref:C,onKeyDown:y},E.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>i({id:e})},Object(u.ob)(e)?n.a.createElement(fe.a,{status:e===r?v("SavedMessagesInfo"):void 0,userId:e}):n.a.createElement(je.a,{chatId:e})))):E&&!E.length?n.a.createElement("p",{className:"no-results"},"Sorry, nothing found."):n.a.createElement(ge.a,null))})),ye=a(174);a(268);function ke(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}var Ne=Object(n.h)(Object(c.h)(e=>Object(b.l)(e,["dialogs"]),(e,t)=>Object(b.l)(t,["dismissDialog","acceptInviteConfirmation"]))(({dialogs:e,dismissDialog:t,acceptInviteConfirmation:a})=>{const c=Object(F.a)();if(!e.length)return;return n.a.createElement("div",{id:"Dialogs"},e.map(e=>{return"hash"in e?(e=>{const{hash:s,title:r,participantsCount:o,isChannel:l}=e,i=c(l?"Subscribers":"Members",o,"i"),d=c(l?"ChannelJoin":"JoinGroup");return n.a.createElement(pe.a,{isOpen:!0,onClose:t,className:"error",title:r},void 0!==o&&n.a.createElement("p",null,i),n.a.createElement(D.a,{isText:!0,className:"confirm-dialog-button",onClick:()=>{a({hash:s}),t()}},d),n.a.createElement(D.a,{isText:!0,className:"confirm-dialog-button",onClick:t},c("Cancel")))})(e):(s=e,n.a.createElement(pe.a,{isOpen:!0,onClose:t,className:"error",title:ke(s)},s.hasErrorKey?Object(ye.a)(s):Object(x.a)(s.message,["emoji","br"]),n.a.createElement("div",null,n.a.createElement(D.a,{isText:!0,onClick:t},c("OK")))));var s}))})),we=a(185);var Se=Object(n.h)(Object(c.h)(e=>Object(b.l)(e,["notifications"]),(e,t)=>Object(b.l)(t,["dismissNotification"]))(({notifications:e,dismissNotification:t})=>{if(e.length)return n.a.createElement("div",{id:"Notifications"},e.map(({message:e})=>n.a.createElement(we.a,{message:Object(x.a)(e,["emoji","br","links","simple_markdown"]),onDismiss:t})))})),Ie=a(138),Pe=a(120);var Me=Object(n.h)(Object(c.h)(void 0,(e,t)=>Object(b.l)(t,["toggleSafeLinkModal"]))(({url:e,toggleSafeLinkModal:t})=>{const a=Object(F.a)(),c=Object(n.m)(()=>{window.open(e),t({url:void 0})},[t,e]),s=Object(n.m)(()=>{t({url:void 0})},[t]),r=Object(Ie.a)(e);return n.a.createElement(Pe.a,{isOpen:Boolean(e),onClose:s,title:a("OpenUrlTitle"),textParts:Object(x.a)(a("OpenUrlAlert2",r),["links"]),confirmLabel:a("OpenUrlTitle"),confirmHandler:c})}));a(269);const Fe=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function Ae(e,t,a,n,c){const s=new Date(e,t,a,0,0,0,0),r=n&&new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0),o=c&&new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0);return!!(o&&s>o)||!!(r&&s<r)}function Le(e){return String(e).padStart(2,"0")}var Re=Object(n.h)(({selectedAt:e,maxAt:t,isFutureMode:a,isPastMode:c,isOpen:s,withTimePicker:r,submitButtonLabel:o,secondButtonLabel:l,onClose:i,onSubmit:d,onSecondButtonClick:m})=>{const u=Object(F.a)(),b=new Date,h=Object(n.p)(()=>e?new Date(e):new Date,[e]),g=t?new Date(t):void 0,p=Object(j.a)(s),[v,O]=Object(n.r)(h),[E,f]=Object(n.r)(Le(h.getHours())),[C,y]=Object(n.r)(Le(h.getMinutes())),k=v.getFullYear(),N=v.getMonth(),w=v.getDate();Object(n.n)(()=>{!p&&s&&O(h)},[s,h,p]);const S=c&&k>=b.getFullYear()&&N>=b.getMonth()||g&&k>=g.getFullYear()&&N>=g.getMonth(),I=a&&k<=b.getFullYear()&&N<=b.getMonth(),P=Object(n.p)(()=>function(e,t){const a=[],n=new Date;n.setFullYear(e),n.setMonth(t),n.setDate(1);const c=n.getDay()||7;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}(k,N),[N,k]);const M=Object(n.m)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return f(""),void(e.target.value="");const a=Math.max(0,Math.min(Number(t),23)),n=new Date(v.getTime());n.setHours(a),O(n);const c=Le(a);f(c),e.target.value=c},[v]),A=Object(n.m)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return y(""),void(e.target.value="");const a=Math.max(0,Math.min(Number(t),59)),n=new Date(v.getTime());n.setMinutes(a),O(n);const c=Le(a);y(c),e.target.value=c},[v]);return n.a.createElement(pe.a,{isOpen:s,onClose:i,className:"CalendarModal"},n.a.createElement("div",{className:"container"},n.a.createElement("div",{className:"month-selector"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:i},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("h4",null,u("lng_month"+(v.getMonth()+1))," ",v.getFullYear()),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",disabled:I,onClick:I?void 0:function(){O(e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t})}},n.a.createElement("i",{className:"icon-previous"})),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",disabled:S,onClick:S?void 0:function(){O(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"},Fe.map(e=>n.a.createElement("div",{className:"day-button faded weekday"},n.a.createElement("span",null,u(e)))),P.map(e=>n.a.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void O(e=>{const a=new Date(e);return a.setDate(t),a});var t},className:Object(W.a)("day-button",Ae(k,N,e,a?b:void 0,c?b:g)?"disabled":""+(e?"clickable":""),e===w&&"selected")},!!e&&n.a.createElement("span",null,e))))),r&&n.a.createElement("div",{className:"timepicker"},n.a.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:E,onChange:M}),":",n.a.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:C,onChange:A})),n.a.createElement("div",{className:"footer"},n.a.createElement(D.a,{onClick:function(){d(v)}},r?function(e,t){const a=Object(B.a)(t,e.code),n=Object(B.a)(new Date,e.code);if(a===n)return e("Conversation.ScheduleMessage.SendToday",Object(B.h)(t));return e("Conversation.ScheduleMessage.SendOn",[a,Object(B.h)(t)])}(u,v):o),l&&n.a.createElement(D.a,{onClick:m,isText:!0},l)))});var Te=Object(n.h)(Object(c.h)(e=>({selectedAt:e.historyCalendarSelectedAt}),(e,t)=>Object(b.l)(t,["searchMessagesByDate","closeHistoryCalendar"]))(({isOpen:e,selectedAt:t,searchMessagesByDate:a,closeHistoryCalendar:c})=>{const s=Object(n.m)(e=>{a({timestamp:e.valueOf()/1e3}),c()},[c,a]),r=Object(F.a)();return n.a.createElement(Re,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:r("JumpToDate"),onClose:c,onSubmit:s})}));var De=Object(n.h)(Object(c.h)((e,{message:t,isSchedule:a})=>{const{threadId:n}=Object(m.z)(e)||{},{canDeleteForAll:c}=n&&Object(m.b)(e,t,n)||{},s=Object(m.g)(e,t.chatId);return{canDeleteForAll:!a&&c,contactName:s&&Object(u.ob)(s.id)?Object(u.ab)(Object(m.Jb)(e,Object(u.W)(s))):void 0,willDeleteForCurrentUserOnly:s&&Object(u.lb)(s)&&!c,willDeleteForAll:s&&Object(u.qb)(s)}},(e,t)=>Object(b.l)(t,["deleteMessages","deleteScheduledMessages"]))(({isOpen:e,isSchedule:t,message:a,album:c,canDeleteForAll:s,contactName:r,willDeleteForCurrentUserOnly:o,willDeleteForAll:l,onClose:i,deleteMessages:d,deleteScheduledMessages:m})=>{const u=Object(n.m)(()=>{const e=c&&c.messages?c.messages.map(({id:e})=>e):[a.id];d({messageIds:e,shouldDeleteForAll:!0}),i()},[d,a.id,i,c]),b=Object(n.m)(()=>{const e=c&&c.messages?c.messages.map(({id:e})=>e):[a.id];t?m({messageIds:e}):d({messageIds:e,shouldDeleteForAll:!1}),i()},[c,a.id,t,i,m,d]),h=Object(F.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:i,onEnter:e&&!s?b:void 0,className:"delete",title:h("DeleteSingleMessagesTitle")},n.a.createElement("p",null,h("AreYouSureDeleteSingleMessage")),o&&n.a.createElement("p",null,h("lng_delete_for_me_chat_hint",1,"i")),l&&n.a.createElement("p",null,h("lng_delete_for_everyone_hint",1,"i")),s&&n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},r&&Object(x.a)(h("Conversation.DeleteMessagesFor",r)),!r&&h("Conversation.DeleteMessagesForEveryone")),n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:b},h(s?"ChatList.DeleteForCurrentUser":"Delete")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:i},h("Cancel")))}));var Be=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(u.ob)(t),n=Object(m.P)(e,t),c=Object(m.g)(e,t),s=!!c&&Object(u.mb)(c),r=!!c&&Object(u.lb)(c),o=!!c&&Object(u.qb)(c);return{isPrivateChat:a,isChatWithSelf:n,isChannel:s,isGroup:r,isSuperGroup:o,canPinForAll:a&&!n||o||r,contactName:c&&Object(u.ob)(c.id)?Object(u.ab)(Object(m.Jb)(e,Object(u.W)(c))):void 0}},(e,t)=>Object(b.l)(t,["pinMessage"]))(({isOpen:e,messageId:t,chatId:a,isChannel:c,isGroup:s,isSuperGroup:r,canPinForAll:o,contactName:l,onClose:i,pinMessage:d})=>{const m=Object(n.m)(()=>{d({chatId:a,messageId:t,isUnpin:!1}),i()},[d,a,t,i]),u=Object(n.m)(()=>{d({chatId:a,messageId:t,isUnpin:!1,isOneSide:!0,isSilent:!0}),i()},[a,t,i,d]),b=Object(F.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:i,className:"pin",title:b("PinMessageAlertTitle")},n.a.createElement("p",null,b(c?"PinMessageAlertChannel":s||r?"PinMessageAlert":"PinMessageAlertChat")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:u},b("DialogPin")),o&&n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:m},l?Object(x.a)(b("Conversation.PinMessagesFor",l)):b("Conversation.PinMessageAlert.PinAndNotifyMembers")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:i},b("Cancel")))}));var xe=Object(n.h)(({isOpen:e,pinnedMessagesCount:t=0,onClose:a,onUnpin:c})=>{const s=Object(F.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:a,className:"unpin-all",title:s("Chat.PanelUnpinAllMessages")},n.a.createElement("p",null,s("Chat.UnpinAllMessagesConfirmation",t,"i")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:c},s("DialogUnpin")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:a},s("Cancel")))}),Ue=a(25),Ge=a(56);var qe=Object(n.h)(Object(c.h)((e,{isSchedule:t})=>{const{messageIds:a}=e.selectedMessages||{},{canDeleteForAll:n}=Object(m.e)(e),c=Object(m.s)(e);return{selectedMessageIds:a,canDeleteForAll:!t&&n,contactName:c&&Object(u.ob)(c.id)?Object(u.ab)(Object(m.Jb)(e,Object(u.W)(c))):void 0,willDeleteForCurrentUserOnly:c&&Object(u.lb)(c)&&!n,willDeleteForAll:c&&Object(u.qb)(c)}},(e,t)=>Object(b.l)(t,["deleteMessages","deleteScheduledMessages","exitMessageSelectMode"]))(({isOpen:e,isSchedule:t,selectedMessageIds:a,canDeleteForAll:c,contactName:s,willDeleteForCurrentUserOnly:r,willDeleteForAll:o,onClose:l,deleteMessages:i,deleteScheduledMessages:d,exitMessageSelectMode:m})=>{const u=Object(n.m)(()=>{i({messageIds:a,shouldDeleteForAll:!0}),m(),l()},[i,m,a,l]),b=Object(n.m)(()=>{t?d({messageIds:a}):i({messageIds:a,shouldDeleteForAll:!1}),m(),l()},[t,m,l,d,a,i]),h=Object(F.a)();if(a)return n.a.createElement(pe.a,{isOpen:e,onClose:l,onEnter:c?void 0:b,className:"delete",title:h("Conversation.DeleteManyMessages")},n.a.createElement("p",null,h("AreYouSureDeleteFewMessages")),r&&n.a.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),o&&n.a.createElement("p",null,"This will delete them for everyone in this chat."),c&&n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},s?Object(x.a)(h("ChatList.DeleteForEveryone",s)):h("Conversation.DeleteMessagesForEveryone")),n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:b},h(c?"ChatList.DeleteForCurrentUser":"Delete")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:l},h("Cancel")))})),ze=a(125);var _e=Object(n.h)(Object(c.h)(void 0,(e,t)=>Object(b.l)(t,["reportMessages","exitMessageSelectMode"]))(({isOpen:e,messageIds:t,reportMessages:a,exitMessageSelectMode:c,onClose:s})=>{const[r,o]=Object(n.r)("spam"),[l,i]=Object(n.r)(""),d=()=>{a({messageIds:t,reason:r,description:l}),c(),s()},m=Object(n.m)(e=>{o(e)},[]),u=Object(n.m)(e=>{i(e.target.value)},[]),b=Object(F.a)(),h=[{value:"spam",label:b("lng_report_reason_spam")},{value:"violence",label:b("lng_report_reason_violence")},{value:"pornography",label:b("lng_report_reason_pornography")},{value:"childAbuse",label:b("lng_report_reason_child_abuse")},{value:"copyright",label:b("ReportPeer.ReasonCopyright")},{value:"other",label:b("lng_report_reason_other")}];if(t)return n.a.createElement(pe.a,{isOpen:e,onClose:s,onEnter:e?d:void 0,className:"report",title:b("lng_report_message_title")},n.a.createElement(ze.a,{name:"report-message",options:h,onChange:m,selected:r}),n.a.createElement(ve.a,{label:b("lng_report_reason_description"),value:l,onChange:u}),n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:d},b("lng_report_button")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:s},b("Cancel")))}));a(270);var He=Object(n.h)(Object(c.h)(e=>{const{type:t}=Object(m.z)(e)||{},{canDelete:a}=Object(m.e)(e),n=Object(m.f)(e),{messageIds:c}=e.selectedMessages||{};return{isSchedule:"scheduled"===t,selectedMessagesCount:Object(m.ub)(e),canDeleteMessages:a,canReportMessages:n,selectedMessageIds:c}},(e,t)=>Object(b.l)(t,["exitMessageSelectMode","openForwardMenuForSelectedMessages"]))(({canPost:e,isActive:t,messageListType:a,isSchedule:c,selectedMessagesCount:s,canDeleteMessages:r,canReportMessages:o,selectedMessageIds:l,exitMessageSelectMode:i,openForwardMenuForSelectedMessages:d})=>{const[m,u,b]=Object(Ue.a)(),[h,g,p]=Object(Ue.a)();Object(n.n)(()=>!t||m||h?void 0:Object(Ge.a)({onBackspace:u,onDelete:u,onEsc:i}),[t,m,h,u,i]);const v=Object(j.a)(s||void 0,!0),O=t?s:v,E=Object(F.a)(),f=E("VoiceOver.Chat.MessagesSelected",O),C=Object(W.a)("MessageSelectToolbar",e&&"with-composer",t&&"shown");return n.a.createElement("div",{className:C},n.a.createElement("div",{className:"MessageSelectToolbar-inner"},n.a.createElement(D.a,{color:"translucent",round:!0,onClick:i,ariaLabel:"Exit select mode"},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("span",{className:"MessageSelectToolbar-count",title:f},f),!!s&&n.a.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==a&&n.a.createElement(_.a,{icon:"forward",ariaLabel:"Forward Messages",onClick:d},n.a.createElement("span",{className:"item-text"},E("Forward"))),o&&n.a.createElement(_.a,{icon:"flag",onClick:g,disabled:!o,ariaLabel:E("Conversation.ReportMessages")},n.a.createElement("span",{className:"item-text"},E("Report"))),n.a.createElement(_.a,{destructive:!0,icon:"delete",onClick:u,disabled:!r,ariaLabel:E("EditAdminGroupDeleteMessages")},n.a.createElement("span",{className:"item-text"},E("Delete"))))),n.a.createElement(qe,{isOpen:m,isSchedule:c,onClose:b}),n.a.createElement(_e,{isOpen:h,onClose:p,messageIds:l}))})),$e=a(173),Ve=a(50),We=a(175),Ke=e=>{const t=Object(n.q)(null),a=Object(n.m)(a=>{if("Enter"!==a.key)return;t.current===document.activeElement&&e()},[e]);return Object(n.n)(()=>(window.addEventListener("keydown",a,!1),()=>window.removeEventListener("keydown",a)),[a]),t},Ye=a(160);var Qe=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),n=a&&Object(u.W)(a);return{chat:a,privateChatUser:n?Object(m.Jb)(e,n):void 0,isPinned:Object(m.N)(e,t),isMuted:a?Object(u.Hb)(a,Object(m.fb)(e),Object(m.eb)(e)):void 0}})(({chatId:e,chat:t,privateChatUser:a,isPinned:c,isMuted:s,withUsername:r,onClick:o})=>{const[l,i,d]=Object(Ue.a)(),m=Object(We.a)({chat:t,privateChatUser:a,isPinned:c,isMuted:s,handleDelete:i}),b=()=>{o(e)},h=Ke(b);if(t)return n.a.createElement(Ee.a,{className:"chat-item-clickable search-result",onClick:b,contextActions:m,buttonRef:h},Object(u.ob)(e)?n.a.createElement(fe.a,{userId:e,withUsername:r,avatarSize:"large"}):n.a.createElement(je.a,{chatId:e,withUsername:r,avatarSize:"large"}),n.a.createElement(Ye.a,{isOpen:l,onClose:d,chat:t}))})),Je=a(146);a(271);const Ze=Object(V.h)(e=>e(),6e4,!0);var Xe=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(b.l)(t,["loadTopUsers","loadContactList","openChat","addRecentlyFoundChatId","clearRecentlyFoundChats"]))(({topUserIds:e,usersById:t,recentlyFoundChatIds:a,onReset:c,loadTopUsers:s,loadContactList:r,openChat:o,addRecentlyFoundChatId:l,clearRecentlyFoundChats:i})=>{const d=Object(n.q)(null);Object(n.n)(()=>{Ze(()=>{s(),r()})},[s,r]),Object(Je.a)(d.current,!e);const m=Object(n.m)(e=>{o({id:e}),c(),setTimeout(()=>{l({id:e})},250)},[o,l,c]),b=Object(F.a)();return n.a.createElement("div",{className:"RecentContacts custom-scroll"},e&&n.a.createElement("div",{className:"top-peers-section",dir:b.isRtl?"rtl":void 0},n.a.createElement("div",{ref:d,className:"top-peers no-selection"},e.map(e=>n.a.createElement("div",{className:"top-peer-item",onClick:()=>m(e),dir:b.isRtl?"rtl":void 0},n.a.createElement(U.a,{user:t[e]}),n.a.createElement("div",{className:"top-peer-name"},Object(x.a)(Object(u.ab)(t[e])||" ")))))),a&&n.a.createElement("div",{className:"search-section pt-1"},n.a.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:b.isRtl?"rtl":void 0},b("Recent"),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:i,isRtl:b.isRtl},n.a.createElement("i",{className:"icon-close"}))),a.map(e=>n.a.createElement(Qe,{chatId:e,onClick:m}))))})),et=a(137),tt=a(32);a(272);var at=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t);if(!a)return{};const n=Object(u.W)(a);return{chat:a,...n&&{privateChatUser:Object(m.Jb)(e,n)},lastSyncTime:e.lastSyncTime}},(e,t)=>Object(b.l)(t,["focusMessage"]))(({message:e,searchQuery:t,chatId:a,chat:c,privateChatUser:s,focusMessage:r,lastSyncTime:o})=>{const i=Object(u.F)(e),d=Object(O.a)(Object(u.E)(e,"micro")),m=Boolean(Object(u.J)(e)),b=Object(n.m)(()=>{r({chatId:a,messageId:e.id})},[a,r,e.id]),h=Object(F.a)(),g=Ke(b);if(c)return n.a.createElement(Ee.a,{className:"ChatMessage chat-item-clickable",ripple:!l.l,onClick:b,buttonRef:g},n.a.createElement(U.a,{chat:c,user:s,withOnlineStatus:!0,isSavedMessages:s&&s.isSelf,lastSyncTime:o}),n.a.createElement("div",{className:"info"},n.a.createElement("div",{className:"info-row"},n.a.createElement("div",{className:"title"},n.a.createElement("h3",{dir:"auto"},Object(x.a)(Object(u.k)(h,c,s))),c.isVerified&&n.a.createElement(et.a,null)),n.a.createElement("div",{className:"message-date"},n.a.createElement(tt.a,{className:"date"},Object(B.g)(h,1e3*e.date)))),n.a.createElement("div",{className:"subtitle"},n.a.createElement("div",{className:"message",dir:"auto"},function(e,t,a,c,s){if(!a)return Object(x.a)(Object(u.O)(e,t));return n.a.createElement("span",{className:"media-preview"},n.a.createElement("img",{src:a,alt:"",className:s?"round":void 0}),Object(u.Q)(t)&&n.a.createElement("i",{className:"icon-play"}),Object(x.a)(Object(u.O)(e,t,!0),["emoji","highlight"],{highlight:c}))}(h,e,d||i,t,m)))))}));a(273);var nt=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(B.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(B.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))))}),ct=a(121),st=a(144);const rt=Object(V.h)(e=>e(),500,!0);var ot=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:s,lastSyncTime:r}=e,{fetchingStatus:o,globalResults:l,localResults:i,resultsByType:d}=e.globalSearch,{chatIds:m,userIds:u}=l||{},{chatIds:b,userIds:h}=i||{},{byChatId:g}=s,{foundIds:p}=d&&d.text||{};return{currentUserId:c,localContactIds:n,localChatIds:b,localUserIds:h,globalChatIds:m,globalUserIds:u,foundIds:p,globalMessagesByChatId:g,chatsById:t,usersById:a,fetchingStatus:o,lastSyncTime:r}},(e,t)=>Object(b.l)(t,["openChat","addRecentlyFoundChatId","searchMessagesGlobal","setGlobalSearchChatId"]))(({searchQuery:e,searchDate:t,dateSearchQuery:a,currentUserId:c,localContactIds:s,localChatIds:o,localUserIds:i,globalChatIds:d,globalUserIds:m,foundIds:h,globalMessagesByChatId:g,chatsById:p,usersById:v,fetchingStatus:O,lastSyncTime:E,onReset:f,onSearchDateSelect:j,openChat:C,addRecentlyFoundChatId:y,searchMessagesGlobal:k,setGlobalSearchChatId:N})=>{const w=Object(F.a)(),[S,I]=Object(n.r)(!1),[P,M]=Object(n.r)(!1),A=Object(n.m)(({direction:t})=>{E&&t===r.e.Backwards&&rt(()=>{k({type:"text",query:e})})},[E,k,e]),L=Object(n.m)(e=>{C({id:e}),e!==c&&y({id:e}),l.l||f()},[c,C,y,f]),R=Object(n.m)(e=>{N({id:e})},[N]),T=Object(n.p)(()=>{if(!e||e.startsWith("@")&&e.length<2)return Ve.a;const t=s?s.filter(t=>{const a=v[t];if(!a)return!1;const n=Object(u.bb)(a);return n&&Object(ue.a)(n,e)||Object(ue.a)(a.username,e)}):[];return[...c&&Object(ue.a)(w("SavedMessages"),e)?[c]:[],...Object(u.Ib)(Object(b.o)([...t,...o||[],...i||[]]),p)]},[e,s,c,w,o,i,p,v]),D=Object(n.p)(()=>!e||e.length<4||!d||!m?Ve.a:Object(u.Ib)(Object(b.o)([...d,...m]),p,!0),[p,d,m,e]),B=Object(n.p)(()=>(e||t)&&h&&0!==h.length?h.map(e=>{const[t,a]=e.split("_").map(Number);return g&&g[t]&&g[t].byId[a]}).filter(Boolean).sort((e,t)=>t.date-e.date):Ve.a,[h,g,e,t]),x=Object(n.m)(()=>{I(!S)},[S]),U=Object(n.m)(()=>{M(!P)},[P]);const G=O&&!O.chats&&!O.messages&&!T.length&&!D.length&&!B.length;return e||t?n.a.createElement(Oe.a,{className:"LeftSearch custom-scroll",items:B,onLoadMore:A,noScrollRestoreOnTop:!0,noFastList:!0},a&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},n.a.createElement(nt,{searchDate:a,onSelect:j})),G&&n.a.createElement(ct.a,{text:w("ChatList.Search.NoResults"),description:w("ChatList.Search.NoResultsDescription")}),!!T.length&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:w.isRtl?"rtl":void 0},T.map(e=>n.a.createElement(st.a,{chatOrUserId:e,onClick:R,clickArg:e}))),!!T.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},T.length>3&&n.a.createElement(tt.a,{onClick:x},w(S?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionDialogs")),T.map((e,t)=>{if(S||!(t>=3))return n.a.createElement(Qe,{chatId:e,onClick:L})})),!!D.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},D.length>3&&n.a.createElement(tt.a,{onClick:U},w(P?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionGlobal")),D.map((e,t)=>{if(P||!(t>=3))return n.a.createElement(Qe,{chatId:e,withUsername:!0,onClick:L})})),!!B.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},w("SearchMessages")),B.map((function(t){const a=Object(u.O)(w,t),c=p[t.chatId];if(a&&c)return n.a.createElement(at,{chatId:t.chatId,message:t,searchQuery:e})})))):n.a.createElement(Xe,{onReset:f})}));const lt=Object(V.h)(e=>e(),500,!0);var it=Object(n.h)(Object(c.h)(e=>{const{byId:t}=e.chats,{currentUserId:a,messages:{byChatId:n},lastSyncTime:c}=e,{fetchingStatus:s,resultsByType:r}=e.globalSearch,{foundIds:o}=r&&r.text||{};return{currentUserId:a,foundIds:o,globalMessagesByChatId:n,chatsById:t,fetchingStatus:s,lastSyncTime:c}},(e,t)=>Object(b.l)(t,["searchMessagesGlobal"]))(({searchQuery:e,currentUserId:t,dateSearchQuery:a,foundIds:c,globalMessagesByChatId:s,chatsById:o,fetchingStatus:l,lastSyncTime:i,searchMessagesGlobal:d,onSearchDateSelect:m})=>{const b=Object(F.a)(),h=Object(n.m)(({direction:a})=>{i&&a===r.e.Backwards&&lt(()=>{d({type:"text",query:e,chatId:t})})},[t,i,d,e]),g=Object(n.p)(()=>c&&0!==c.length?c.map(e=>{const[t,a]=e.split("_").map(Number);return s&&s[t]&&s[t].byId[a]}).filter(Boolean).sort((e,t)=>t.date-e.date):Ve.a,[c,s]);const p=l&&!l.chats&&!l.messages&&!g.length;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content custom-scroll chat-list",items:g,onLoadMore:h,noFastList:!0},a&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},n.a.createElement(nt,{searchDate:a,onSelect:m})),p&&n.a.createElement(ct.a,{text:b("ChatList.Search.NoResults"),description:b("ChatList.Search.NoResultsDescription")}),!!g.length&&g.map((function(t){const a=Object(u.O)(b,t),c=o[t.chatId];if(a&&c)return n.a.createElement(at,{chatId:t.chatId,message:t,searchQuery:e})}))))}));function dt(e){return(t,a)=>{const{byId:n}=t.chats,{byId:c}=t.users,{fetchingStatus:s,resultsByType:r,chatId:o}=t.globalSearch,l="audio"!==e?e:a&&a.isVoice?"voice":"audio",{byChatId:i}=t.messages,{foundIds:d}=r&&r[l]||{};return{theme:Object(m.Db)(t),isLoading:void 0===d||!!s&&Boolean(s.chats||s.messages),chatsById:n,usersById:c,globalMessagesByChatId:i,foundIds:d,searchChatId:o,lastSyncTime:t.lastSyncTime}}}var mt=a(122),ut=a(169);const bt=Object(V.h)(e=>e(),500,!0);var ht=Object(n.h)(Object(c.h)(dt("media"),(e,t)=>Object(b.l)(t,["searchMessagesGlobal","openMediaViewer"]))(({searchQuery:e,searchChatId:t,isLoading:a,globalMessagesByChatId:c,foundIds:s,lastSyncTime:l,searchMessagesGlobal:i,openMediaViewer:d})=>{const m=Object(F.a)(),u=Object(n.m)(({direction:a})=>{l&&a===r.e.Backwards&&bt(()=>{i({type:"media",query:e,chatId:t})})},[l,i,e,t]),b=Object(n.p)(()=>s&&c?s.map(e=>{const[t,a]=e.split("_").map(Number);return c[t]&&c[t].byId[a]}).filter(Boolean):Ve.a,[c,s]),h=Object(n.m)((e,t)=>{d({chatId:t,messageId:e,origin:r.h.SearchResult})},[d]);const g=Object(mt.a)([e],o.yb)&&!a,p=g&&s&&s.length>0&&!e,v=g&&s&&s.length>0&&e,O=Object(W.a)("search-content custom-scroll",v&&"chat-list");return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:O,items:b,itemSelector:e?".ListItem":".Media",onLoadMore:u,noFastList:!0},!g&&n.a.createElement(ge.a,null),g&&(!s||0===s.length)&&n.a.createElement(ct.a,{text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),p&&n.a.createElement("div",{className:"media-list",dir:m.isRtl?"rtl":void 0},b.map(e=>n.a.createElement(ut.a,{key:e.id,idPrefix:"search-media",message:e,onClick:h}))),v&&b.map(e=>n.a.createElement(at,{key:e.id,chatId:e.chatId,message:e}))))}));function gt(e,t,a,n){const{senderId:c}=t;if(!c)return;const s=Object(u.ob)(c)?n[c]:a[c];let r=Object(u.X)(e,s);const o=a[t.chatId];return o&&(Object(u.ob)(c)&&s.isSelf?r=`${e("FromYou")}${Object(u.k)(e,o)}`:Object(u.nb)(o)&&(r+=" → "+Object(u.k)(e,o))),r}var pt=a(190);const vt=Object(V.h)(e=>e(),500,!0);var Ot=Object(n.h)(Object(c.h)(dt("links"),(e,t)=>Object(b.l)(t,["searchMessagesGlobal","focusMessage"]))(({searchQuery:e,searchChatId:t,isLoading:a,chatsById:c,usersById:s,globalMessagesByChatId:l,foundIds:i,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:u})=>{const b=Object(F.a)(),h=Object(n.m)(({direction:a})=>{d&&a===r.e.Backwards&&vt(()=>{m({type:"links",query:e,chatId:t})})},[d,m,e,t]),g=Object(n.p)(()=>i&&l?i.map(e=>{const[t,a]=e.split("_").map(Number);return l[t]&&l[t].byId[a]}).filter(Boolean):Ve.a,[l,i]),p=Object(n.m)((e,t)=>{u({chatId:t,messageId:e})},[u]);const v=Object(mt.a)([e],o.yb)&&!a;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:g,onLoadMore:h,noFastList:!0},!v&&n.a.createElement(ge.a,null),v&&(!i||0===i.length)&&n.a.createElement(ct.a,{text:b("ChatList.Search.NoResults"),description:b("ChatList.Search.NoResultsDescription")}),v&&i&&i.length>0&&g.map((e,t)=>{const a=0===t||Object(B.n)(e.date)!==Object(B.n)(g[t-1].date);return n.a.createElement("div",{className:"ListItem",dir:b.isRtl?"rtl":void 0,key:e.id},a&&n.a.createElement("p",{className:"section-heading",dir:b.isRtl?"rtl":void 0},Object(B.f)(b,new Date(1e3*e.date))),n.a.createElement(pt.a,{key:e.id,message:e,senderTitle:gt(b,e,c,s),onMessageClick:p}))})))})),Et=a(164);const ft=Object(V.h)(e=>e(),500,!0);var jt=Object(n.h)(Object(c.h)(dt("documents"),(e,t)=>Object(b.l)(t,["searchMessagesGlobal","focusMessage"]))(({searchQuery:e,searchChatId:t,isLoading:a,chatsById:c,usersById:s,globalMessagesByChatId:l,foundIds:i,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:b})=>{const h=Object(F.a)(),g=Object(n.m)(({direction:a})=>{d&&a===r.e.Backwards&&ft(()=>{m({type:"documents",query:e,chatId:t})})},[d,m,e,t]),p=Object(n.p)(()=>i&&l?i.map(e=>{const[t,a]=e.split("_").map(Number),n=l[t]&&l[t].byId[a];return n&&Object(u.y)(n)?n:void 0}).filter(Boolean):Ve.a,[l,i]),v=Object(n.m)((e,t)=>{b({chatId:t,messageId:e})},[b]);const O=Object(mt.a)([e],o.yb)&&!a;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:p,onLoadMore:g,noFastList:!0},!O&&n.a.createElement(ge.a,null),O&&(!i||0===i.length)&&n.a.createElement(ct.a,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),O&&i&&i.length>0&&p.map((e,t)=>{const a=0===t||Object(B.n)(e.date)!==Object(B.n)(p[t-1].date);return n.a.createElement("div",{className:"ListItem",key:e.id},a&&n.a.createElement("p",{className:"section-heading"},Object(B.f)(h,new Date(1e3*e.date))),n.a.createElement(Et.a,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:gt(h,e,c,s),className:"scroll-item",onDateClick:v}))})))})),Ct=a(172);const yt=Object(V.h)(e=>e(),500,!0);var kt=Object(n.h)(Object(c.h)(dt("audio"),(e,t)=>Object(b.l)(t,["searchMessagesGlobal","focusMessage","openAudioPlayer"]))(({theme:e,isVoice:t,searchQuery:a,searchChatId:c,isLoading:s,chatsById:l,usersById:i,globalMessagesByChatId:d,foundIds:m,lastSyncTime:u,searchMessagesGlobal:b,focusMessage:h,openAudioPlayer:g})=>{const p=Object(F.a)(),v=t?"voice":"audio",O=Object(n.m)(({direction:e})=>{u&&e===r.e.Backwards&&yt(()=>{b({type:v,query:a,chatId:c})})},[v,u,b,a,c]),E=Object(n.p)(()=>m&&d?m.map(e=>{const[t,a]=e.split("_").map(Number);return d[t]&&d[t].byId[a]}).filter(Boolean):Ve.a,[d,m]),f=Object(n.m)((e,t)=>{h({chatId:t,messageId:e})},[h]),j=Object(n.m)((e,t)=>{g({chatId:t,messageId:e})},[g]);const C=Object(mt.a)([a],o.yb)&&!s;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:E,onLoadMore:O,noFastList:!0},!C&&n.a.createElement(ge.a,null),C&&(!m||0===m.length)&&n.a.createElement(ct.a,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),C&&m&&m.length>0&&E.map((t,a)=>{const c=0===a||Object(B.n)(t.date)!==Object(B.n)(E[a-1].date);return n.a.createElement("div",{className:"ListItem",key:t.id},c&&n.a.createElement("p",{className:"section-heading",dir:p.isRtl?"rtl":void 0},Object(B.f)(p,new Date(1e3*t.date))),n.a.createElement(Ct.a,{key:t.id,theme:e,message:t,target:"searchResult",senderTitle:gt(p,t,l,i),date:t.date,lastSyncTime:u,className:"scroll-item",onPlay:j,onDateClick:f}))})))}));a(274);const Nt=[{type:r.c.ChatList,title:"SearchAllChatsShort"},{type:r.c.Media,title:"SharedMediaTab2"},{type:r.c.Links,title:"SharedLinksTab2"},{type:r.c.Files,title:"SharedFilesTab2"},{type:r.c.Music,title:"SharedMusicTab2"},{type:r.c.Voice,title:"SharedVoiceTab2"}],wt=[{type:r.c.ChatList,title:"All Messages"},...Nt.slice(1)],St=Object.keys(r.c).length/2;var It=Object(n.h)(Object(c.h)(e=>{const{currentContent:t,chatId:a}=e.globalSearch;return{currentContent:t,chatId:a}},(e,t)=>Object(b.l)(t,["setGlobalSearchContent","setGlobalSearchDate"]))(({searchQuery:e,searchDate:t,isActive:a,currentContent:c=r.c.ChatList,chatId:s,setGlobalSearchContent:o,setGlobalSearchDate:l,onReset:i})=>{const d=Object(F.a)(),[m,u]=Object(n.r)(c),b=Object(n.p)(()=>Object(B.l)(e),[e]),h=Object(n.m)(e=>{const t=Nt[e];o({content:t.type}),u(e)},[o]),g=Object(n.m)(e=>{l({date:e.getTime()/1e3})},[l]);Object(A.a)(a,i,void 0,void 0,!0);const p=Object(n.q)(null),v=Object(he.a)(p,a,void 0,".ListItem-button",!0);return n.a.createElement("div",{className:"LeftSearch",ref:p,onKeyDown:v},n.a.createElement($e.a,{activeTab:m,tabs:s?wt:Nt,onSwitchTab:h}),n.a.createElement(T.a,{name:d.isRtl?"slide-reversed":"slide",renderCount:St,activeKey:c},()=>{switch(c){case r.c.ChatList:return s?n.a.createElement(it,{searchQuery:e,dateSearchQuery:b,onReset:i,onSearchDateSelect:g}):n.a.createElement(ot,{searchQuery:e,searchDate:t,dateSearchQuery:b,onReset:i,onSearchDateSelect:g});case r.c.Media:return n.a.createElement(ht,{searchQuery:e});case r.c.Links:return n.a.createElement(Ot,{searchQuery:e});case r.c.Files:return n.a.createElement(jt,{searchQuery:e});case r.c.Music:return n.a.createElement(kt,{key:"audio",searchQuery:e});case r.c.Voice:return n.a.createElement(kt,{key:"voice",isVoice:!0,searchQuery:e});default:return}}))}));function Pt(e,t){const a=Object(n.q)(e),[c,s]=Object(n.r)(t);return[c,Object(n.m)(e=>{s(t=>a.current(t,e))},[])]}const Mt=[{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"}],Ft=[{icon:"mute",title:"FilterMuted",key:"excludeMuted"},{icon:"archive",title:"FilterArchived",key:"excludeArchived"},{icon:"readchats",title:"FilterRead",key:"excludeRead"}],At=["includedChatIds","bots","channels","groups","contacts","nonContacts"],Lt=["excludedChatIds","excludeArchived","excludeMuted","excludeRead"];function Rt(e,t,a){let n=[],c=[];if("included"===t){const{includedChatIds:t,...s}=a?e.includeFilters||{}:Object(b.l)(e.folder,At);n=t||[],c=Object.keys(s).filter(e=>Boolean(s[e]))}else{const{excludedChatIds:t,...s}=a?e.excludeFilters||{}:Object(b.l)(e.folder,Lt);n=t||[],c=Object.keys(s).filter(e=>Boolean(s[e]))}return{selectedChatIds:n,selectedChatTypes:c}}function Tt(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 Dt={mode:"create",chatFilter:"",folder:{title:"",includedChatIds:[],excludedChatIds:[]}},Bt=(e,t)=>{switch(t.type){case"setTitle":return{...e,folder:{...e.folder,title:t.payload},isTouched:!0};case"editIncludeFilters":return{...e,includeFilters:Object(b.l)(e.folder,At)};case"editExcludeFilters":return{...e,excludeFilters:Object(b.l)(e.folder,Lt)};case"setIncludeFilters":return{...e,includeFilters:t.payload,chatFilter:""};case"setExcludeFilters":return{...e,excludeFilters:t.payload,chatFilter:""};case"saveFilters":return e.includeFilters?{...e,folder:{...Object(b.j)(e.folder,At),title:e.folder.title?e.folder.title:Tt(e.includeFilters),...e.includeFilters},includeFilters:void 0,chatFilter:"",isTouched:!0}:e.excludeFilters?{...e,folder:{...Object(b.j)(e.folder,Lt),...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 Dt;default:return e}};const xt={currentPassword:"",password:"",hint:"",email:""},Ut=(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 xt;default:return e}};var Gt=Object(n.h)(Object(c.h)(void 0,(e,t)=>Object(b.l)(t,["signOut","deleteChatFolder"]))(({currentScreen:e,editedFolderId:t,onReset:a,onSaveFilter:c,signOut:s,deleteChatFolder:o})=>{const[i,d]=Object(n.r)(!1),[m,u]=Object(n.r)(!1),b=Object(n.m)(()=>{d(!0)},[]),h=Object(n.m)(()=>{d(!1)},[]),g=Object(n.m)(()=>{u(!0)},[]),p=Object(n.m)(()=>{u(!1)},[]),v=Object(n.m)(()=>{h(),s()},[h,s]),O=Object(n.m)(()=>{p(),o({id:t}),a()},[t,p,o,a]),E=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(D.a,{round:!0,ripple:!l.l,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},n.a.createElement("i",{className:"icon-more"})),[]),f=Object(F.a)();return n.a.createElement("div",{className:"left-header"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:a,ariaLabel:f("AccDescrGoBack")},n.a.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){case r.n.EditProfile:return n.a.createElement("h3",null,f("lng_settings_information"));case r.n.General:return n.a.createElement("h3",null,f("General"));case r.n.Notifications:return n.a.createElement("h3",null,f("Notifications"));case r.n.Privacy:return n.a.createElement("h3",null,f("PrivacySettings"));case r.n.Language:return n.a.createElement("h3",null,f("Language"));case r.n.GeneralChatBackground:return n.a.createElement("h3",null,f("ChatBackground"));case r.n.GeneralChatBackgroundColor:return n.a.createElement("h3",null,f("SetColor"));case r.n.PrivacyPhoneNumber:return n.a.createElement("h3",null,f("PrivacyPhone"));case r.n.PrivacyLastSeen:return n.a.createElement("h3",null,f("PrivacyLastSeen"));case r.n.PrivacyProfilePhoto:return n.a.createElement("h3",null,f("Privacy.ProfilePhoto"));case r.n.PrivacyForwarding:return n.a.createElement("h3",null,f("PrivacyForwards"));case r.n.PrivacyGroupChats:return n.a.createElement("h3",null,f("AutodownloadGroupChats"));case r.n.PrivacyPhoneNumberAllowedContacts:case r.n.PrivacyLastSeenAllowedContacts:case r.n.PrivacyProfilePhotoAllowedContacts:case r.n.PrivacyForwardingAllowedContacts:case r.n.PrivacyGroupChatsAllowedContacts:return n.a.createElement("h3",null,f("AlwaysShareWith"));case r.n.PrivacyPhoneNumberDeniedContacts:case r.n.PrivacyLastSeenDeniedContacts:case r.n.PrivacyProfilePhotoDeniedContacts:case r.n.PrivacyForwardingDeniedContacts:case r.n.PrivacyGroupChatsDeniedContacts:return n.a.createElement("h3",null,f("NeverShareWith"));case r.n.PrivacyActiveSessions:return n.a.createElement("h3",null,f("SessionsTitle"));case r.n.PrivacyBlockedUsers:return n.a.createElement("h3",null,f("BlockedUsers"));case r.n.TwoFaDisabled:case r.n.TwoFaEnabled:return n.a.createElement("h3",null,f("TwoStepVerification"));case r.n.TwoFaNewPassword:case r.n.TwoFaChangePasswordNew:case r.n.TwoFaChangePasswordConfirm:return n.a.createElement("h3",null,f("PleaseEnterCurrentPassword"));case r.n.TwoFaNewPasswordConfirm:return n.a.createElement("h3",null,f("PleaseReEnterPassword"));case r.n.TwoFaNewPasswordHint:case r.n.TwoFaChangePasswordHint:return n.a.createElement("h3",null,f("PasswordHint"));case r.n.TwoFaNewPasswordEmail:case r.n.TwoFaRecoveryEmail:return n.a.createElement("h3",null,f("RecoveryEmailTitle"));case r.n.TwoFaNewPasswordEmailCode:case r.n.TwoFaRecoveryEmailCode:return n.a.createElement("h3",null,"Recovery Email Code");case r.n.TwoFaCongratulations:return n.a.createElement("h3",null,f("TwoStepVerificationPasswordSet"));case r.n.TwoFaChangePasswordCurrent:case r.n.TwoFaTurnOff:case r.n.TwoFaRecoveryEmailCurrentPassword:return n.a.createElement("h3",null,f("PleaseEnterCurrentPassword"));case r.n.Folders:return n.a.createElement("h3",null,f("Filters"));case r.n.FoldersCreateFolder:return n.a.createElement("h3",null,f("FilterNew"));case r.n.FoldersEditFolder:return n.a.createElement("div",{className:"settings-main-header"},n.a.createElement("h3",null,f("FilterEdit")),t&&n.a.createElement(z.a,{className:"settings-more-menu",trigger:E,positionX:"right"},n.a.createElement(_.a,{icon:"delete",destructive:!0,onClick:g},"Delete Folder")));case r.n.FoldersIncludedChats:case r.n.FoldersExcludedChats:return n.a.createElement("div",{className:"settings-main-header"},e===r.n.FoldersIncludedChats?n.a.createElement("h3",null,f("FilterInclude")):n.a.createElement("h3",null,f("FilterExclude")),n.a.createElement(D.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(z.a,{className:"settings-more-menu",trigger:E,positionX:"right"},n.a.createElement(_.a,{icon:"logout",onClick:b},f("LogOutTitle"))))}}(),n.a.createElement(Pe.a,{isOpen:i,onClose:h,text:"Are you sure you want to log out?",confirmLabel:"Log Out",confirmHandler:v,confirmIsDestructive:!0}),n.a.createElement(Pe.a,{isOpen:m,onClose:p,text:"Are you sure you want to delete this folder?",confirmLabel:"Delete",confirmHandler:O,confirmIsDestructive:!0}))})),qt=a(23);var zt=Object(n.h)(Object(c.h)(e=>{const{currentUserId:t}=e;return{currentUser:t?Object(m.Jb)(e,t):void 0}})(({isActive:e,onScreenSelect:t,onReset:a,currentUser:c})=>{const s=Object(F.a)(),o=Object(u.bb)(c);return Object(A.a)(e,a,t,r.n.Main),n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-main-menu"},c&&n.a.createElement("div",{className:"settings-current-user"},n.a.createElement(U.a,{user:c,size:"jumbo"}),n.a.createElement("p",{className:"name"},o&&Object(x.a)(o)),n.a.createElement("p",{className:"phone"},Object(qt.c)(c.phoneNumber))),n.a.createElement(Ee.a,{icon:"edit",onClick:()=>t(r.n.EditProfile)},s("lng_settings_information")),n.a.createElement(Ee.a,{icon:"folder",onClick:()=>t(r.n.Folders)},s("Filters")),n.a.createElement(Ee.a,{icon:"settings",onClick:()=>t(r.n.General)},s("Telegram.GeneralSettingsViewController")),n.a.createElement(Ee.a,{icon:"unmute",onClick:()=>t(r.n.Notifications)},s("Notifications")),n.a.createElement(Ee.a,{icon:"lock",onClick:()=>t(r.n.Privacy)},s("PrivacySettings")),n.a.createElement(Ee.a,{icon:"language",onClick:()=>t(r.n.Language)},s("Language"))))})),_t=a(135),Ht=a(116);const $t=/https:\/\/t\.me\/?/i,Vt=/^([a-zA-Z0-9_]+)$/,Wt=Object(V.a)(e=>e(),250,!1);var Kt=Object(n.h)(({currentUsername:e,asLink:t,isLoading:a,isUsernameAvailable:c,checkUsername:s,onChange:r})=>{const[o,l]=Object(n.r)(e||""),i=Object(F.a)(),d=t?"SetUrl":"Username",m=i(t?"SetUrlPlaceholder":"Username"),[u,b]=Object(n.p)(()=>o.length?o.length<5?[void 0,m+" is too short"]:o.length>32?[void 0,m+" is too long"]:Vt.test(o)?void 0===c?[]:[c?i(d+"Available","Username"):void 0,!1===c?i(d+"InUse"):void 0]:[void 0,m+" contains invalid characters"]:[],[o,c,i,d,m]);Object(n.n)(()=>{l(e||"")},[t,e]);const h=Object(n.m)(e=>{const a=e.target.value.trim().replace($t,"");l(a),e.target.value=`${t?"https://t.me/":""}${a}`;const n=function(e){return e.length>=5&&e.length<=32&&Vt.test(e)}(a);n&&Wt(()=>{s({username:a})}),r&&r(!!n&&a)},[t,s,r]);return n.a.createElement(ve.a,{value:`${t?"https://t.me/":""}${o}`,onChange:h,label:m,error:b,success:u,readOnly:a})});const Yt=Object(V.h)(e=>e(),6e4,!0);var Qt=Object(n.h)(Object(c.h)(e=>{const{currentUserId:t}=e,{progress:a,isUsernameAvailable:n}=e.profileEdit||{},c=t?Object(m.Jb)(e,t):void 0;if(!c)return{progress:a,isUsernameAvailable:n};const{firstName:s,lastName:r,username:o,fullInfo:l}=c,{bio:i}=l||{};return{currentAvatarHash:Object(u.e)(c),currentFirstName:s,currentLastName:r,currentBio:i,currentUsername:o,progress:a,isUsernameAvailable:n}},(e,t)=>Object(b.l)(t,["loadCurrentUser","updateProfile","checkUsername"]))(({isActive:e,onScreenSelect:t,onReset:a,currentAvatarHash:c,currentFirstName:o,currentLastName:l,currentBio:i,currentUsername:d,progress:m,isUsernameAvailable:u,loadCurrentUser:b,updateProfile:h,checkUsername:g})=>{const p=Object(F.a)(),[v,E]=Object(n.r)(!1),[f,j]=Object(n.r)(!1),[C,y]=Object(n.r)(),[k,N]=Object(n.r)(),[w,S]=Object(n.r)(o||""),[I,P]=Object(n.r)(l||""),[M,R]=Object(n.r)(i||""),[T,D]=Object(n.r)(d||""),B=Object(O.a)(c,!1,s.ApiMediaFormat.BlobUrl),U=m===r.k.InProgress,G=!1===T,q=Object(n.p)(()=>!G&&(Boolean(k)||f||!0===u),[k,f,G,u]);Object(A.a)(e,a,t,r.n.EditProfile),Object(n.n)(()=>{Yt(()=>{b()})},[b]),Object(n.n)(()=>{N(void 0)},[B]),Object(n.n)(()=>{S(o||""),P(l||""),R(i||"")},[o,l,i]),Object(n.n)(()=>{D(d||"")},[d]),Object(n.n)(()=>{m===r.k.Complete&&(j(!1),E(!1),y(void 0))},[m]);const z=Object(n.m)(e=>{N(e)},[]),_=Object(n.m)(e=>{S(e.target.value),j(!0)},[]),H=Object(n.m)(e=>{P(e.target.value),j(!0)},[]),$=Object(n.m)(e=>{R(e.target.value),j(!0)},[]),V=Object(n.m)(e=>{D(e),E(!0)},[]),W=Object(n.m)(()=>{const e=w.trim(),t=I.trim(),a=M.trim();e.length?a.length>70?y("Bio can' be longer than 70 characters"):h({photo:k,...f&&{firstName:e,lastName:t,bio:a},...v&&{username:T}}):y("Please provide your first name")},[k,w,I,M,f,T,v,h]);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(_t.a,{currentAvatarBlobUrl:B,onChange:z,title:"Edit your profile photo",disabled:U}),n.a.createElement(ve.a,{value:w,onChange:_,label:p("FirstName"),disabled:U,error:"Please provide your first name"===C?C:void 0}),n.a.createElement(ve.a,{value:I,onChange:H,label:p("LastName"),disabled:U}),n.a.createElement(ve.a,{value:M,onChange:$,label:p("UserBio"),disabled:U,error:"Bio can' be longer than 70 characters"===C?C:void 0}),n.a.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},Object(x.a)(p("lng_settings_about_bio"),["br","simple_markdown"]))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("Username")),n.a.createElement(Kt,{currentUsername:T||"",isLoading:U,isUsernameAvailable:u,checkUsername:g,onChange:V}),n.a.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},Object(x.a)(p("UsernameHelp"),["br","simple_markdown"])),T&&n.a.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},p("lng_username_link"),n.a.createElement("br",null),n.a.createElement("span",{className:"username-link"},"https://t.me/",T)))),n.a.createElement(Ht.a,{isShown:q,onClick:W,disabled:U,ariaLabel:"Save changes"},U?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))})),Jt=a(130),Zt=a(119);const Xt=Object(V.h)(e=>e(),6e4,!0);var ea=Object(n.h)(Object(c.h)(e=>{const{chats:{byId:t},users:{byId:a}}=e,{orderedIds:n,byId:c,recommended:s}=e.chatFolders;return{chatsById:t,usersById:a,orderedFolderIds:n,foldersById:c,recommendedChatFolders:s,notifySettings:Object(m.fb)(e),notifyExceptions:Object(m.eb)(e)}},(e,t)=>Object(b.l)(t,["loadRecommendedChatFolders","addChatFolder","showDialog"]))(({onCreateFolder:e,onEditFolder:t,isActive:a,onScreenSelect:c,onReset:s,chatsById:l,usersById:i,orderedFolderIds:d,foldersById:m,recommendedChatFolders:b,notifySettings:h,notifyExceptions:g,loadRecommendedChatFolders:p,addChatFolder:v,showDialog:O})=>{const[E,f]=Object(n.r)(),[j,C]=Object(n.r)(!1),y=Object(n.m)(()=>C(!0),[]);Object(n.n)(()=>{E||Object(Jt.a)("FoldersAll").then(f)},[E]),Object(n.n)(()=>{Xt(()=>{p()})},[p]);const k=Object(n.m)(()=>{Object.keys(m).length>=10?O({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):e()},[m,O,e]),N=Object(F.a)();Object(A.a)(a,s,c,r.n.Folders);const w=Object(n.p)(()=>{if(!d)return;const e=Object.keys(l).map(Number);return d.map(t=>{const a=m[t];return{id:a.id,title:a.title,subtitle:Object(u.n)(N,l,i,a,e,h,g)}})},[d,l,m,i,h,g,N]),S=Object(n.m)(e=>{Object.keys(m).length>=10?O({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):v({folder:e})},[m,v,O]);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"},E&&n.a.createElement(Zt.a,{id:"settingsFoldersMain",size:o.Cb,animationData:E,play:j,noLoop:!0,onLoad:y})),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},N("CreateNewFilterInfo")),n.a.createElement(D.a,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:k,isRtl:N.isRtl},n.a.createElement("i",{className:"icon-add"}),N("CreateNewFilter"))),n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("Filters")),w&&w.length?w.map(e=>n.a.createElement(Ee.a,{className:"mb-2",narrow:!0,multiline:!0,onClick:()=>t(m[e.id])},n.a.createElement("span",{className:"title"},e.title),n.a.createElement("span",{className:"subtitle"},e.subtitle))):w&&!w.length?n.a.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):n.a.createElement(ge.a,null)),b&&!!b.length&&n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("FilterRecommended")),b.map(e=>n.a.createElement(Ee.a,{className:"mb-2",narrow:!0,onClick:()=>S(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(D.a,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:N.isRtl},N("Add")))))))}));a(275);var ta=({count:e,itemName:t,itemPluralName:a,isLoading:c,onClick:s})=>{const r=Object(F.a)();return n.a.createElement(D.a,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:c,isRtl:r.isRtl,onClick:s},n.a.createElement("i",{className:"icon-down"}),"Show ",e," more ",e>1?a||t+"s":t)};const aa="Please provide a title for this folder.",na="Please select at least one chat for this folder.";var ca=Object(n.h)(Object(c.h)(e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}},(e,t)=>Object(b.l)(t,["editChatFolder","addChatFolder","loadMoreChats"]))(({state:e,dispatch:t,onAddIncludedChats:a,onAddExcludedChats:c,isActive:s,onScreenSelect:l,onReset:i,onBack:d,loadedActiveChatIds:m,loadedArchivedChatIds:h,editChatFolder:g,addChatFolder:p,loadMoreChats:v})=>{const[O,E]=Object(n.r)(),[f,j]=Object(n.r)(!1),C=Object(n.m)(()=>j(!0),[]),[y,k]=Object(n.r)(!1),[N,w]=Object(n.r)(!1),{selectedChatIds:S,selectedChatTypes:I}=Rt(e,"included"),{selectedChatIds:P,selectedChatTypes:M}=Rt(e,"excluded");Object(n.n)(()=>{O||Object(Jt.a)("FoldersNew").then(E)},[O]),Object(n.n)(()=>{k(!1),w(!1)},[e.folderId]);const[R,T]=Object(n.p)(()=>{const e=new Set([...m||[],...h||[]]),t=Object(b.f)(S,e),a=Object(b.f)(P,e);return[y?t:t.slice(0,5-I.length),N?a:a.slice(0,5-M.length)]},[P,S,I,M,N,y,m,h]);Object(n.n)(()=>{(R.length<S.length||T.length<P.length)&&v({listType:"active"})},[v,P.length,S.length,T.length,R.length]);const D=Object(F.a)();function B(e){const t="included"===e?I:M,a="included"===e?R:T,c="included"===e?y:N,s=("included"===e?S:P).length-t.length-a.length,r="included"===e?()=>k(!0):()=>w(!0);return n.a.createElement(n.a.Fragment,null,t.map(t=>function(e,t){const a="included"===t?Mt.find(({key:t})=>t===e):Ft.find(({key:t})=>t===e);if(a)return n.a.createElement(Ee.a,{key:a.key,className:"settings-folders-list-item mb-1",icon:a.icon,narrow:!0,inactive:!0},D(a.title))}(t,e)),a.map(e=>n.a.createElement(Ee.a,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},Object(u.ob)(e)?n.a.createElement(fe.a,{avatarSize:"small",userId:e}):n.a.createElement(je.a,{avatarSize:"small",chatId:e}))),!c&&s>0&&n.a.createElement(ta,{count:s,itemName:"chat",onClick:r}))}return Object(A.a)(s,d,l,"edit"===e.mode?r.n.FoldersEditFolder:r.n.FoldersCreateFolder),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"},O&&n.a.createElement(Zt.a,{id:"settingsFoldersEdit",size:o.Cb,animationData:O,play:f&&String(e.folderId),noLoop:!0,onLoad:C})),"create"===e.mode&&n.a.createElement("p",{className:"settings-item-description mb-3",dir:D.isRtl?"rtl":void 0},D("FilterIncludeInfo")),n.a.createElement(ve.a,{className:"mb-0",label:D("FilterNameHint"),value:e.folder.title,onChange:function(e){const{currentTarget:a}=e;t({type:"setTitle",payload:a.value.trim()})},error:e.error&&e.error===aa?aa:void 0})),n.a.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===na&&n.a.createElement("p",{className:"settings-item-description color-danger mb-2",dir:D.isRtl?"rtl":void 0},e.error),n.a.createElement("h4",{className:"settings-item-header mb-3",dir:D.isRtl?"rtl":void 0},D("FilterInclude")),n.a.createElement(Ee.a,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:a},D("FilterAddChats")),B("included")),n.a.createElement("div",{className:"settings-item no-border pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:D.isRtl?"rtl":void 0},D("FilterExclude")),n.a.createElement(Ee.a,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:c},D("FilterAddChats")),B("excluded"))),n.a.createElement(Ht.a,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:a}=e.folder;a?S.length||Object.keys(I).length?(t({type:"setIsLoading",payload:!0}),"edit"===e.mode?g({id:e.folderId,folderUpdate:e.folder}):p({folder:e.folder}),setTimeout(()=>{i()},500)):t({type:"setError",payload:na}):t({type:"setError",payload:aa})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))})),sa=a(47);a(191),a(276);var ra=Object(n.h)(({mode:e,chatIds:t,selectedIds:a,selectedChatTypes:c,filterValue:s,onSelectedIdsChange:r,onSelectedChatTypesChange:o,onFilterChange:l,onLoadMore:i})=>{const d=Object(n.q)(null),m="included"===e?Mt:Ft,b=a.length+c.length>10,h=a.length>=100;Object(n.n)(()=>{setTimeout(()=>{requestAnimationFrame(()=>{d.current.focus()})},500)},[]);const g=Object(n.m)(e=>{const t=[...a];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),r(t)},[a,r]),p=Object(n.m)(e=>{const t=[...c];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),o(t)},[c,o]),v=Object(n.m)(e=>{const{value:t}=e.currentTarget;l(t)},[l]),O=Object(F.a)();const[E,f]=Object(be.a)(i,t,Boolean(s));return n.a.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},n.a.createElement("div",{className:"picker-header custom-scroll"},c.map((function(e){const t=m.find(({key:t})=>e===t);if(t)return n.a.createElement(st.a,{icon:t.icon,title:O(t.title),isMinimized:b,canClose:!0,onClick:p,clickArg:t.key})})),a.map((e,t)=>n.a.createElement(st.a,{chatOrUserId:e,isMinimized:b&&t<a.length-5,canClose:!0,onClick:g,clickArg:e})),h?n.a.createElement("p",{className:"max-items-reached",dir:"auto"},"Sorry, you can't add more than 100 chats."):n.a.createElement(ve.a,{ref:d,value:s,onChange:v,placeholder:O("Search")})),n.a.createElement(Oe.a,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:E,onLoadMore:f},(!E||!E.length||E.includes(t[0]))&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h4",{key:"header1",className:"settings-item-header",dir:O.isRtl?"rtl":void 0},O("FilterChatTypes")),m.map((function(e){return n.a.createElement(Ee.a,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>p(e.key),ripple:!0},n.a.createElement("i",{className:"icon-"+e.icon}),n.a.createElement("h3",{className:"chat-type",dir:"auto"},O(e.title)),n.a.createElement(sa.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",dir:O.isRtl?"rtl":void 0},O("FilterChats"))),E&&E.length?E.map((function(e){const t=a.includes(e);return n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>g(e),ripple:!0,disabled:!t&&h},Object(u.ob)(e)?n.a.createElement(fe.a,{userId:e}):n.a.createElement(je.a,{chatId:e,withChatType:!0}),n.a.createElement(sa.a,{label:"",checked:t,round:!0}))})):E&&!E.length?n.a.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):n.a.createElement(ge.a,{key:"loading"})))});var oa=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(b.l)(t,["loadMoreChats"]))(({isActive:e,onScreenSelect:t,onReset:a,mode:c,state:s,dispatch:o,chatsById:l,listIds:i,orderedPinnedIds:d,archivedListIds:m,archivedPinnedIds:b,loadMoreChats:h})=>{const{chatFilter:g}=s,{selectedChatIds:p,selectedChatTypes:v}=Rt(s,c,!0),O=Object(F.a)(),E=Object(n.p)(()=>{const e=i?Object(u.Fb)(l,i,d,"all"):void 0,t=m?Object(u.Fb)(l,m,b,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]},[l,i,d,m,b]),f=Object(n.p)(()=>{if(E)return E.filter(e=>!g||Object(ue.a)(Object(u.k)(O,e),g)||p.includes(e.id)).map(({id:e})=>e)},[E,g,O,p]),j=Object(n.m)(e=>{o({type:"setChatFilter",payload:e})},[o]),C=Object(n.m)(e=>{o("included"===c?{type:"setIncludeFilters",payload:{...s.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...s.excludeFilters,excludedChatIds:e}})},[c,s,o]),y=Object(n.m)(e=>{const t={};e.forEach(e=>{t[e]=!0}),o("included"===c?{type:"setIncludeFilters",payload:{includedChatIds:p,...t}}:{type:"setExcludeFilters",payload:{excludedChatIds:p,...t}})},[c,p,o]);return Object(A.a)(e,a,t,"included"===c?r.n.FoldersIncludedChats:r.n.FoldersExcludedChats),f?n.a.createElement(ra,{mode:c,chatIds:f,selectedIds:p,selectedChatTypes:v,filterValue:g,onSelectedIdsChange:C,onSelectedChatTypesChange:y,onFilterChange:j,onLoadMore:h}):n.a.createElement(ge.a,null)}));a(277);var la=Object(n.h)(({currentScreen:e,shownScreen:t,state:a,dispatch:c,isActive:s,onScreenSelect:o,onReset:l})=>{const i=Object(n.m)(()=>{e!==r.n.FoldersCreateFolder&&e!==r.n.FoldersEditFolder||setTimeout(()=>{c({type:"reset"})},200),e!==r.n.FoldersIncludedChats&&e!==r.n.FoldersExcludedChats?l():"create"===a.mode?o(r.n.FoldersCreateFolder):o(r.n.FoldersEditFolder)},[a.mode,c,e,l,o]),d=Object(n.m)(()=>{c({type:"reset"}),o(r.n.FoldersCreateFolder)},[o,c]),m=Object(n.m)(e=>{c({type:"editFolder",payload:e}),o(r.n.FoldersEditFolder)},[c,o]),u=Object(n.m)(()=>{c({type:"editIncludeFilters"}),o(r.n.FoldersIncludedChats)},[c,o]),b=Object(n.m)(()=>{c({type:"editExcludeFilters"}),o(r.n.FoldersExcludedChats)},[c,o]);switch(e){case r.n.Folders:return n.a.createElement(ea,{onCreateFolder:d,onEditFolder:m,onScreenSelect:o,isActive:s||[r.n.FoldersCreateFolder,r.n.FoldersEditFolder,r.n.FoldersIncludedChats,r.n.FoldersExcludedChats].includes(t),onReset:l});case r.n.FoldersCreateFolder:case r.n.FoldersEditFolder:return n.a.createElement(ca,{state:a,dispatch:c,onAddIncludedChats:u,onAddExcludedChats:b,onReset:i,onScreenSelect:o,isActive:s||[r.n.FoldersIncludedChats,r.n.FoldersExcludedChats].includes(t),onBack:l});case r.n.FoldersIncludedChats:return n.a.createElement(oa,{mode:"included",state:a,dispatch:c,onReset:i,onScreenSelect:o,isActive:s});case r.n.FoldersExcludedChats:return n.a.createElement(oa,{mode:"excluded",state:a,dispatch:c,onReset:i,onScreenSelect:o,isActive:s});default:return}}),ia=a(109);a(278);var da=Object(n.h)(({options:e,range:t,label:a,value:c,disabled:s,onChange:r})=>{const o=Object(F.a)(),l=Object(n.m)(e=>{r(Number(e.currentTarget.value))},[r]),i=Object(W.a)("RangeSlider",s&&"disabled"),d=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,u,b]=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:i},a&&n.a.createElement("div",{className:"slider-top-row",dir:o.isRtl?"rtl":void 0},n.a.createElement("span",{className:"label",dir:"auto"},a),t&&n.a.createElement("span",{className:"value",dir:"auto"},c)),n.a.createElement("div",{className:"slider-main"},n.a.createElement("div",{className:"slider-fill-track",style:`width: ${d}%`}),n.a.createElement("input",{min:m,max:u,value:c,step:b,type:"range",onChange:l}),e&&n.a.createElement("div",{className:"slider-options"},e.map((e,t)=>n.a.createElement("div",{className:Object(W.a)("slider-option no-selection",t===c&&"active"),onClick:()=>r(t)},e)))))}),ma=a(117),ua=a(49);var ba=Object(n.h)(({size:e=o.Jb,stickerSet:t,observeIntersection:a})=>{const c=Object(n.q)(null),r=Object(ia.b)(c,a),l="stickerSet"+t.id,i=Object(O.a)(l,!r,s.ApiMediaFormat.Lottie),{shouldRenderFullMedia:d,transitionClassNames:m}=Object(ma.a)(i,"slow");return n.a.createElement("div",{ref:c,className:"sticker-set-cover"},!d&&Object(ua.c)(t.title,2),d&&i&&n.a.createElement(Zt.a,{id:l,size:e,animationData:i,className:m}))});var ha=Object(n.h)(({stickerSet:e,observeIntersection:t})=>{const a=Object(n.q)(null),c=Object(ia.b)(a,t),s=Object(O.a)(e.hasThumbnail&&"stickerSet"+e.id,!c),{shouldRenderFullMedia:r,transitionClassNames:o}=Object(ma.a)(s,"slow");return n.a.createElement("div",{ref:a,className:"sticker-set-cover"},!r&&Object(ua.c)(e.title,2),r&&n.a.createElement("img",{src:s,className:o,alt:""}))});a(279);var ga=Object(n.h)(({sticker:e,size:t,observeIntersection:a,noAnimate:c,title:r,className:o,onClick:l,clickArg:i,onUnfaveClick:d})=>{const m=Object(n.q)(null),u="sticker"+e.id,b="sticker-button-"+e.id,h=Object(ia.b)(m,a),g=e.thumbnail?e.thumbnail.dataUri:void 0,p=Object(O.a)(u+"?size=m",!h,s.ApiMediaFormat.BlobUrl),v=h&&!c,E=Object(O.a)(e.isAnimated&&u,!v,s.ApiMediaFormat.Lottie),[f,j,C]=Object(Ue.a)(Boolean(E)),y=f&&v,{shouldRenderThumb:k,shouldRenderFullMedia:N,transitionClassNames:w}=Object(ma.a)(p||y,"slow");Object(n.n)(()=>{v||C()},[C,v]);const S=Object(W.a)("StickerButton",e.isAnimated&&"animated",b,o),I=k&&g?`background-image: url('${g}');`:"";return n.a.createElement("div",{ref:m,className:S,title:r||e&&e.emoji,style:I,"data-sticker-id":e.id,onClick:function(){l&&l(i)}},N&&!y&&n.a.createElement("img",{src:p,className:w}),v&&E&&n.a.createElement(Zt.a,{id:u,animationData:E,play:!0,size:t,isLowPriority:!0,onLoad:j}),d&&n.a.createElement(D.a,{className:"sticker-unfave-button",color:"dark",round:!0,onClick:function(t){t.stopPropagation(),t.preventDefault(),d(e)}},n.a.createElement("i",{className:"icon-close"})))});a(280);var pa=Object(n.h)(({stickerSet:e,observeIntersection:t,onClick:a})=>{const c=Object(F.a)();if(!e||!e.stickers)return;const s=e.stickers&&e.stickers[0];return e.hasThumbnail||!s?n.a.createElement(Ee.a,{narrow:!0,className:"SettingsStickerSet",inactive:!s,onClick:()=>s&&a(s)},n.a.createElement(D.a,{ariaLabel:e.title,color:"translucent",isRtl:c.isRtl},e.isAnimated?n.a.createElement(ba,{size:o.Db,stickerSet:e,observeIntersection:t}):n.a.createElement(ha,{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(Ee.a,{narrow:!0,className:"SettingsStickerSet",onClick:()=>a(s)},n.a.createElement(ga,{sticker:s,size:o.Db,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"))))}),va=a(165);const Oa=["Solid and Steady","Nice and Fast","Lots of Stuff"];var Ea=Object(n.h)(Object(c.h)(e=>({...Object(b.l)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldAutoDownloadMediaFromContacts","shouldAutoDownloadMediaInPrivateChats","shouldAutoDownloadMediaInGroups","shouldAutoDownloadMediaInChannels","shouldAutoPlayGifs","shouldAutoPlayVideos","shouldSuggestStickers","shouldLoopStickers","isSensitiveEnabled","canChangeSensitive"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById}),(e,t)=>Object(b.l)(t,["setSettingOption","loadStickerSets","loadAddedStickers"]))(({isActive:e,onScreenSelect:t,onReset:a,stickerSetIds:c,stickerSetsById:s,messageTextSize:o,animationLevel:i,messageSendKeyCombo:d,shouldAutoDownloadMediaFromContacts:m,shouldAutoDownloadMediaInPrivateChats:u,shouldAutoDownloadMediaInGroups:b,shouldAutoDownloadMediaInChannels:h,shouldAutoPlayGifs:g,shouldAutoPlayVideos:p,shouldSuggestStickers:v,shouldLoopStickers:O,setSettingOption:E,loadStickerSets:f,loadAddedStickers:j})=>{const C=Object(n.q)(null),{observe:y}=Object(ia.a)({rootRef:C}),[k,N,w]=Object(Ue.a)(),[S,I]=Object(n.r)(),P=Object(F.a)(),M=l.n?void 0:[{value:"enter",label:P("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:P(l.f?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}];Object(n.n)(()=>{f()},[f]),Object(n.n)(()=>{c&&c.length&&j()},[c,j]);const L=Object(n.m)(e=>{Oa.forEach((t,a)=>{document.body.classList.toggle("animation-level-"+a,e===a)}),E({animationLevel:e})},[E]),R=Object(n.m)(e=>{document.documentElement.style.setProperty("--message-text-size",e+"px"),E({messageTextSize:e})},[E]),T=Object(n.m)(e=>{I(e),N()},[N]),D=c&&c.map(e=>!!(s&&s[e]&&s[e].installedDate)&&s[e]).filter(Boolean);return Object(A.a)(e,a,t,r.n.General),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",dir:P.isRtl?"rtl":void 0},P("SETTINGS")),n.a.createElement(da,{label:P("TextSize"),range:{min:12,max:20},value:o,onChange:R}),n.a.createElement(Ee.a,{icon:"photo",onClick:()=>t(r.n.GeneralChatBackground)},P("ChatBackground"))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},"Animation Level"),n.a.createElement("p",{className:"settings-item-description",dir:P.isRtl?"rtl":void 0},"Choose the desired animations amount."),n.a.createElement(da,{options:Oa,value:i,onChange:L})),M&&n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("VoiceOver.Keyboard")),n.a.createElement(ze.a,{name:"keyboard-send-settings",options:M,onChange:e=>E({messageSendKeyCombo:e}),selected:d})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("AutoDownloadMedia")),n.a.createElement(sa.a,{label:P("Contacts"),checked:m,onCheck:e=>E({shouldAutoDownloadMediaFromContacts:e})}),n.a.createElement(sa.a,{label:P("AutodownloadPrivateChats"),checked:u,onCheck:e=>E({shouldAutoDownloadMediaInPrivateChats:e})}),n.a.createElement(sa.a,{label:P("AutodownloadGroupChats"),checked:b,onCheck:e=>E({shouldAutoDownloadMediaInGroups:e})}),n.a.createElement(sa.a,{label:P("FilterChannels"),checked:h,onCheck:e=>E({shouldAutoDownloadMediaInChannels:e})})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("AutoplayMedia")),n.a.createElement(sa.a,{label:P("GifsTab2"),checked:g,onCheck:e=>E({shouldAutoPlayGifs:e})}),n.a.createElement(sa.a,{label:P("DataAndStorage.Autoplay.Videos"),checked:p,onCheck:e=>E({shouldAutoPlayVideos:e})})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("AccDescrStickers")),n.a.createElement(sa.a,{label:P("SuggestStickers"),checked:v,onCheck:e=>E({shouldSuggestStickers:e})}),n.a.createElement(sa.a,{label:P("LoopAnimatedStickers"),checked:O,onCheck:e=>E({shouldLoopStickers:e})}),n.a.createElement("div",{className:"mt-4",ref:C},D&&D.map(e=>n.a.createElement(pa,{key:e.id,stickerSet:e,observeIntersection:y,onClick:T}))),S&&n.a.createElement(va.a,{isOpen:k,fromSticker:S,onClose:w})))}));let fa;function ja(e="*",t,a=!1){fa||(fa=document.createElement("input"),fa.setAttribute("type","file")),fa.setAttribute("accept",e),a?fa.removeAttribute("multiple"):fa.setAttribute("multiple","multiple"),fa.onchange=null,fa.value="",fa.onchange=t,fa.click()}var Ca=a(17);function ya(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function ka(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 Na([e,t,a]){e/=255,t/=255,a/=255;let n,c,s=Math.max(e,t,a),r=Math.min(e,t,a),o=s,l=s-r;if(c=0==s?0:l/s,s==r)n=0;else{switch(s){case e:n=(t-a)/l+(t<a?6:0);break;case t:n=(a-e)/l+2;break;case a:n=(e-t)/l+4}n/=6}return[n,c,o]}function wa([e,t,a]){let n,c,s,r=Math.floor(6*e),o=6*e-r,l=a*(1-t),i=a*(1-o*t),d=a*(1-(1-o)*t);switch(r%6){case 0:n=a,c=d,s=l;break;case 1:n=i,c=a,s=l;break;case 2:n=l,c=a,s=d;break;case 3:n=l,c=i,s=a;break;case 4:n=d,c=l,s=a;break;case 5:n=a,c=l,s=i}return[Math.round(255*n),Math.round(255*c),Math.round(255*s)]}function Sa(e){let[t,a,n]=Na(e);return a=Math.min(1,a+.05+.1*(1-a)),n=n>.5?Math.max(0,.65*n):Math.max(0,Math.min(1,1-.65*n)),`hsla(${360*t}, ${100*a}%, ${100*n}%, .4)`}var Ia=a(12),Pa=a(166);a(281);var Ma=Object(n.h)(({wallpaper:e,theme:t,isSelected:a,onClick:c})=>{const{slug:s,document:l}=e,i="wallpaper"+l.id,d=l.previewBlobUrl,m=Object(O.a)(i+"?size=m"),u=Object(Pa.a)(l.thumbnail&&l.thumbnail.dataUri,Boolean(m),!0),{shouldRenderThumb:b,shouldRenderFullMedia:h,transitionClassNames:g}=Object(ma.a)(m||d,"slow"),[p,v]=Object(n.r)(!1),{mediaData:f,downloadProgress:C}=Object(E.a)(i,!p),y=!1===Object(j.a)(p),{shouldRender:k,transitionClassNames:N}=Object(Y.a)(p&&!f||s===r.o,void 0,y,"slow"),w=Object(n.q)();w.current=t;const S=Object(n.m)(()=>{(async()=>{const e=await Object(Ca.e)(f);await Ia.d(o.o,w.current,e),c(s)})()},[f,c,s]);Object(n.n)(()=>{f&&S()},[f,S]);const I=Object(n.m)(()=>{f?S():v(e=>!e)},[f,S]),P=Object(W.a)("WallpaperTile",a&&"selected");return n.a.createElement("div",{className:P,onClick:I},n.a.createElement("div",{className:"media-inner"},b&&n.a.createElement("canvas",{ref:u,className:"thumbnail"}),h&&n.a.createElement("img",{src:m||d,className:"full-media "+g,alt:""}),k&&n.a.createElement("div",{className:Object(W.a)("spinner-container",N)},n.a.createElement(H.a,{progress:C,onClick:I}))))});a(282);const Fa=Object(V.h)(e=>e(),6e4,!0);var Aa=Object(n.h)(Object(c.h)(e=>{const t=Object(m.Db)(e),{background:a,isBlurred:n}=e.settings.themes[t]||{},{loadedWallpapers:c}=e.settings;return{background:a,isBlurred:n,loadedWallpapers:c,theme:t}},(e,t)=>Object(b.l)(t,["loadWallpapers","uploadWallpaper","setThemeSettings"]))(({isActive:e,onScreenSelect:t,onReset:a,background:c,isBlurred:s,loadedWallpapers:l,theme:i,loadWallpapers:d,uploadWallpaper:m,setThemeSettings:u})=>{const b=Object(n.q)();b.current=i,Object(n.n)(()=>{Fa(()=>{d()})},[d]);const h=Object(n.m)(e=>{const{files:t}=e.target;t&&t.length>0&&m(t[0])},[m]),g=Object(n.m)(()=>{ja("image/jpeg",h,!0)},[h]),p=Object(n.m)(()=>{t(r.n.GeneralChatBackgroundColor)},[t]),v=Object(n.m)(()=>{u({theme:i,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===i?o.q:o.x})},[u,i]),O=Object(n.m)(e=>{u({theme:b.current,background:e});const t=l&&l.find(t=>t.slug===e);t&&t.document.thumbnail&&async function(e){const t=[0,0,0];let a,n,c,s,r=-4,o=[0,0,0],l=0;const i=document.createElement("canvas"),d=i.getContext&&i.getContext("2d");if(!d)return t;const m=await Object(Ca.g)(e);c=m.naturalHeight||m.offsetHeight||m.height,n=m.naturalWidth||m.offsetWidth||m.width,i.height=c,i.width=n,d.drawImage(m,0,0);try{a=d.getImageData(0,0,n,c)}catch(e){return t}for(s=a.data.length;(r+=20)<s;)++l,o[0]+=a.data[r],o[1]+=a.data[r+1],o[2]+=a.data[r+2];return o[0]=Math.floor(o[0]/l),o[1]=Math.floor(o[1]/l),o[2]=Math.floor(o[2]/l),o}(t.document.thumbnail.dataUri).then(e=>{const t=Sa(e),a="#"+ka(e);u({theme:b.current,backgroundColor:a,patternColor:t})})},[l,u]),E=Object(n.m)(e=>{u({theme:b.current,isBlurred:e.target.checked})},[u]),f=Object(F.a)();Object(A.a)(e,a,t,r.n.GeneralChatBackground);const j=l&&l[0]&&l[0].slug===r.o;return n.a.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement(Ee.a,{icon:"camera-add",className:"mb-0",disabled:j,onClick:g},f("UploadImage")),n.a.createElement(Ee.a,{icon:"colorize",className:"mb-0",onClick:p},f("SetColor")),n.a.createElement(Ee.a,{icon:"favorite",onClick:v},f("ThemeResetToDefaults")),n.a.createElement(sa.a,{label:f("BackgroundBlurred"),checked:Boolean(s),onChange:E})),l?n.a.createElement("div",{className:"settings-wallpapers"},l.map(e=>n.a.createElement(Ma,{wallpaper:e,theme:i,isSelected:c===e.slug,onClick:O}))):n.a.createElement(ge.a,null))}));a(283);const La=Na(ya("e6ebee")),Ra=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Ta(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 Da({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 Ba=Object(n.h)(Object(c.h)(e=>{const t=Object(m.Db)(e),{backgroundColor:a}=e.settings.themes[t]||{};return{backgroundColor:a,theme:t}},(e,t)=>Object(b.l)(t,["setThemeSettings"]))(({isActive:e,onScreenSelect:t,onReset:a,theme:c,backgroundColor:s,setThemeSettings:o})=>{const l=Object(n.q)();l.current=c;const i=Object(n.q)(null),d=Object(n.q)(null),m=Object(n.q)(null),u=Object(n.q)(!0),[g,p]=Object(n.r)(function(e){return e&&e.startsWith("#")?Na(ya(e.replace("#",""))):La}(s)),v=Object(n.q)(g);Object(n.n)(()=>{v.current=g},[g]);const[O,E,f]=Object(Ue.a)(),[j,C]=Object(n.r)(""),[y,k]=Object(n.r)(""),N=Object(n.q)(),w=Object(n.q)();Object(n.n)(()=>{const e={offsetLeft:d.current.offsetLeft,...Object(b.l)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:m.current.offsetLeft,...Object(b.l)(m.current.getBoundingClientRect(),["width"])};function a(t){const a=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+i.current.scrollTop),e.height-1)],{huePosition:n}=Ta(v.current,N.current);p(Da({colorPosition:a,huePosition:n},N.current)),E()}function n(e){const{colorPosition:a}=Ta(v.current,N.current),n=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);p(Da({colorPosition:a,huePosition:n},N.current)),E()}N.current={colorRect:e,hueRect:t},Object(h.b)(d.current,{onCapture:a,onDrag:a,onRelease:f,onClick:f,withCursor:!0}),Object(h.b)(m.current,{onCapture:n,onDrag:n,onRelease:f,onClick:f,withCursor:!0})},[E,f]);const{colorPosition:S=[0,0],huePosition:I=0}=N.current?Ta(g,N.current):{},P=ka(wa(g)),M=g[0],F=ka(wa([M,1,1]));Object(n.n)(()=>{const e=wa(g),t="#"+ka(e);if(C(e.join(", ")),k(t),!u.current){const a=Sa(e);o({theme:l.current,background:void 0,backgroundColor:t,patternColor:a})}u.current=!1},[g,o]),Object(n.n)(()=>{!function(e,t,a,n){let c,s,r;a.current&&n.current?(c=n.current.colorRect.width,s=n.current.colorRect.height,r=a.current):(c=e.offsetWidth,s=e.offsetHeight,r=e.getContext("2d"),e.width=c,e.height=s,a.current=r);const o=r.createImageData(c,s),l=o.data,i=wa([t,1,1]);let d=0;for(let e=0;e<s;e++){const t=1-e/(s-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);l[d++]=a[0]+(n[0]-a[0])*t,l[d++]=a[1]+(n[1]-a[1])*t,l[d++]=a[2]+(n[2]-a[2])*t,l[d++]=255}}r.putImageData(o,0,0)}(d.current.firstChild,M,w,N)},[M]),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 s=0;for(let e=0;e<t;e++){const a=wa([e/(t-1),1,1]);c[s++]=a[0],c[s++]=a[1],c[s++]=a[2],c[s++]=255}a.putImageData(n,0,0)}(m.current.firstChild)},[]);const L=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()));p(Na(e))}e.currentTarget.value=t},[]),R=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}$/)&&p(Na(ya(t.replace("#","")))),e.currentTarget.value=t},[]),T=Object(n.m)(e=>{p(Na(ya(e.currentTarget.dataset.color.replace("#",""))))},[]),D=Object(W.a)("SettingsGeneralBackgroundColor settings-content custom-scroll",O&&"is-dragging");return Object(A.a)(e,a,t,r.n.GeneralChatBackgroundColor),n.a.createElement("div",{ref:i,className:D},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("div",{ref:d,className:"color-picker"},n.a.createElement("canvas",null),n.a.createElement("div",{className:"handle",style:`transform: translate(${S[0]}px, ${S[1]}px); background-color: #${P};`})),n.a.createElement("div",{ref:m,className:"hue-picker"},n.a.createElement("canvas",null),n.a.createElement("div",{className:"handle",style:`transform: translateX(${I}px); background-color: #${F};`})),n.a.createElement("div",{className:"tools"},n.a.createElement(ve.a,{value:y,label:"HEX",onChange:R}),n.a.createElement(ve.a,{value:j,label:"RGB",onChange:L}))),n.a.createElement("div",{className:"predefined-colors"},Ra.map(e=>n.a.createElement("div",{className:e==="#"+P?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:T}))))}));var xa=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(b.l)(t,["loadNotificationSettings","updateContactSignUpNotification","updateNotificationSettings"]))(({isActive:e,onScreenSelect:t,onReset:a,hasPrivateChatsNotifications:c,hasPrivateChatsMessagePreview:s,hasGroupNotifications:o,hasGroupMessagePreview:l,hasBroadcastNotifications:i,hasBroadcastMessagePreview:d,hasContactJoinedNotifications:m,loadNotificationSettings:u,updateContactSignUpNotification:b,updateNotificationSettings:h})=>{Object(n.n)(()=>{u()},[u]);const g=Object(n.m)((e,t,a)=>{const n="contact"===t?!c:!("group"===t?o:i),r="contact"===t?s:"group"===t?l:d;h({peerType:t,..."silent"===a&&{isSilent:!e.target.checked,shouldShowPreviews:r},..."showPreviews"===a&&{shouldShowPreviews:e.target.checked,isSilent:n}})},[d,i,l,o,s,c,h]),p=Object(n.m)(e=>{b({isSilent:!e.target.checked})},[b]),v=Object(F.a)();return Object(A.a)(e,a,t,r.n.Notifications),n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("AutodownloadPrivateChats")),n.a.createElement(sa.a,{label:v("NotificationsForPrivateChats"),subLabel:v(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{g(e,"contact","silent")}}),n.a.createElement(sa.a,{label:v("MessagePreview"),subLabel:v(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:e=>{g(e,"contact","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("FilterGroups")),n.a.createElement(sa.a,{label:v("NotificationsForGroups"),subLabel:v(o?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:o,onChange:e=>{g(e,"group","silent")}}),n.a.createElement(sa.a,{label:v("MessagePreview"),subLabel:v(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:e=>{g(e,"group","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("FilterChannels")),n.a.createElement(sa.a,{label:v("NotificationsForChannels"),subLabel:v(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:e=>{g(e,"broadcast","silent")}}),n.a.createElement(sa.a,{label:v("MessagePreview"),subLabel:v(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:e=>{g(e,"broadcast","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("PhoneOther")),n.a.createElement(sa.a,{label:v("ContactJoined"),checked:m,onChange:p})))}));var Ua=Object(n.h)(Object(c.h)(e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:a,canChangeSensitive:n},privacy:c},blocked:s,activeSessions:r}=e;return{hasPassword:t,blockedCount:s.totalCount,sessionsCount:r.length,isSensitiveEnabled:a,canChangeSensitive:n,visibilityPrivacyPhoneNumber:c.phoneNumber&&c.phoneNumber.visibility,visibilityPrivacyLastSeen:c.lastSeen&&c.lastSeen.visibility,visibilityPrivacyProfilePhoto:c.profilePhoto&&c.profilePhoto.visibility,visibilityPrivacyForwarding:c.forwards&&c.forwards.visibility,visibilityPrivacyGroupChats:c.chatInvite&&c.chatInvite.visibility}},(e,t)=>Object(b.l)(t,["loadBlockedContacts","loadAuthorizations","loadPrivacySettings","loadContentSettings","updateContentSettings"]))(({isActive:e,onScreenSelect:t,onReset:a,hasPassword:c,blockedCount:s,sessionsCount:o,isSensitiveEnabled:l,canChangeSensitive:i,visibilityPrivacyPhoneNumber:d,visibilityPrivacyLastSeen:m,visibilityPrivacyProfilePhoto:u,visibilityPrivacyForwarding:b,visibilityPrivacyGroupChats:h,loadPrivacySettings:g,loadBlockedContacts:p,loadAuthorizations:v,loadContentSettings:O,updateContentSettings:E})=>{Object(n.n)(()=>{p(),v(),g(),O()},[p,v,g,O]);const f=Object(F.a)();function j(e){switch(e){case"everybody":return f("P2PEverybody");case"contacts":return f("P2PContacts");case"nobody":return f("P2PNobody")}}return Object(A.a)(e,a,t,r.n.Privacy),n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement(Ee.a,{icon:"delete-user",narrow:!0,onClick:()=>t(r.n.PrivacyBlockedUsers)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},f("BlockedUsers")),s>0&&n.a.createElement("span",{className:"subtitle",dir:"auto"},f("Users",s)))),n.a.createElement(Ee.a,{icon:"lock",narrow:!0,onClick:()=>t(c?r.n.TwoFaEnabled:r.n.TwoFaDisabled)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},f("TwoStepVerification")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(c?"PasswordOn":"PasswordOff")))),n.a.createElement(Ee.a,{icon:"active-sessions",narrow:!0,onClick:()=>t(r.n.PrivacyActiveSessions)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},f("SessionsTitle")),o>0&&n.a.createElement("span",{className:"subtitle",dir:"auto"},1===o?"1 session":o+" sessions")))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:f.isRtl?"rtl":void 0},f("PrivacyTitle")),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyPhoneNumber)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},f("PrivacyPhoneTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},j(d)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyLastSeen)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},f("LastSeenTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},j(m)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyProfilePhoto)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},f("PrivacyProfilePhotoTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},j(u)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyForwarding)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},f("PrivacyForwardsTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},j(b)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyGroupChats)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},f("WhoCanAddMe")),n.a.createElement("span",{className:"subtitle",dir:"auto"},j(h))))),i&&n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0},f("lng_settings_sensitive_title")),n.a.createElement(sa.a,{label:f("lng_settings_sensitive_disable_filtering"),subLabel:f("lng_settings_sensitive_about"),checked:Boolean(l),disabled:!i,onCheck:E})))})),Ga=a(14);var qa=Object(n.h)(Object(c.h)(e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language}),(e,t)=>Object(b.l)(t,["loadLanguages","setSettingOption"]))(({isActive:e,onScreenSelect:t,onReset:a,languages:c,language:s,loadLanguages:o,setSettingOption:l})=>{const[i,d]=Object(n.r)(s),[m,u,b]=Object(Ue.a)();Object(n.n)(()=>{o()},[o]);const h=Object(n.m)(e=>{d(e),u(),Object(Ga.d)(e,()=>{b(),l({language:e})})},[u,b,l]),g=Object(n.p)(()=>c?function(e){const t=(window.navigator.language||"en").toLowerCase(),a=t.substr(0,2);return e.map(({langCode:e,nativeName:t,name:a})=>({value:e,label:t,subLabel:a})).sort(e=>!t||e.value!==t&&e.value!==a?0:-1)}(c):void 0,[c]);return Object(A.a)(e,a,t,r.n.Language),n.a.createElement("div",{className:"settings-content settings-item settings-language custom-scroll"},g?n.a.createElement(ze.a,{name:"keyboard-send-settings",options:g,selected:i,loadingOption:m?i:void 0,onChange:h}):n.a.createElement(ge.a,null))}));function za(e){switch(e){case r.n.PrivacyPhoneNumber:case r.n.PrivacyPhoneNumberAllowedContacts:case r.n.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case r.n.PrivacyLastSeen:case r.n.PrivacyLastSeenAllowedContacts:case r.n.PrivacyLastSeenDeniedContacts:return"lastSeen";case r.n.PrivacyProfilePhoto:case r.n.PrivacyProfilePhotoAllowedContacts:case r.n.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case r.n.PrivacyForwarding:case r.n.PrivacyForwardingAllowedContacts:case r.n.PrivacyForwardingDeniedContacts:return"forwards";case r.n.PrivacyGroupChats:case r.n.PrivacyGroupChatsAllowedContacts:case r.n.PrivacyGroupChatsDeniedContacts:return"chatInvite"}}var _a=Object(n.h)(Object(c.h)((e,{screen:t})=>{let a;const{chats:{byId:n},settings:{privacy:c}}=e;switch(t){case r.n.PrivacyPhoneNumber:a=c.phoneNumber;break;case r.n.PrivacyLastSeen:a=c.lastSeen;break;case r.n.PrivacyProfilePhoto:a=c.profilePhoto;break;case r.n.PrivacyForwarding:a=c.forwards;break;case r.n.PrivacyGroupChats:a=c.chatInvite}return a?{...a,chatsById:n}:{}},(e,t)=>Object(b.l)(t,["setPrivacyVisibility"]))(({screen:e,isActive:t,onScreenSelect:a,onReset:c,visibility:s,allowUserIds:o,allowChatIds:l,blockUserIds:i,blockChatIds:d,chatsById:m,setPrivacyVisibility:u})=>{const b=Object(F.a)(),h=Object(n.p)(()=>{switch(e){case r.n.PrivacyProfilePhoto:case r.n.PrivacyGroupChats:return[{value:"everybody",label:b("P2PEverybody")},{value:"contacts",label:b("P2PContacts")}];default:return[{value:"everybody",label:b("P2PEverybody")},{value:"contacts",label:b("P2PContacts")},{value:"nobody",label:b("P2PNobody")}]}},[b,e]),g={shouldShowDenied:"nobody"!==s,shouldShowAllowed:"everybody"!==s},p=za(e),v=Object(n.p)(()=>{switch(e){case r.n.PrivacyPhoneNumber:return b("PrivacyPhoneTitle");case r.n.PrivacyLastSeen:return b("LastSeenTitle");case r.n.PrivacyProfilePhoto:return b("PrivacyProfilePhotoTitle");case r.n.PrivacyForwarding:return b("PrivacyForwardsTitle");case r.n.PrivacyGroupChats:return b("WhoCanAddMe");default:return}},[b,e]);Object(A.a)(t,c,a,e);const O=Object(n.p)(()=>{switch(e){case r.n.PrivacyLastSeen:return b("CustomHelp");default:return}},[b,e]),E=(()=>{switch(e){case r.n.PrivacyPhoneNumber:return r.n.PrivacyPhoneNumberAllowedContacts;case r.n.PrivacyLastSeen:return r.n.PrivacyLastSeenAllowedContacts;case r.n.PrivacyProfilePhoto:return r.n.PrivacyProfilePhotoAllowedContacts;case r.n.PrivacyForwarding:return r.n.PrivacyForwardingAllowedContacts;default:return r.n.PrivacyGroupChatsAllowedContacts}})(),f=(()=>{switch(e){case r.n.PrivacyPhoneNumber:return r.n.PrivacyPhoneNumberDeniedContacts;case r.n.PrivacyLastSeen:return r.n.PrivacyLastSeenDeniedContacts;case r.n.PrivacyProfilePhoto:return r.n.PrivacyProfilePhotoDeniedContacts;case r.n.PrivacyForwarding:return r.n.PrivacyForwardingDeniedContacts;default:return r.n.PrivacyGroupChatsDeniedContacts}})(),j=Object(n.p)(()=>o&&l&&m?l.reduce((e,t)=>e+(m[t]?m[t].membersCount:0),o.length):0,[l,o,m]),C=Object(n.p)(()=>i&&d&&m?d.reduce((e,t)=>e+(m[t]?m[t].membersCount:0),i.length):0,[d,i,m]),y=Object(n.m)(e=>{u({privacyKey:p,visibility:e})},[p,u]);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",dir:b.isRtl?"rtl":void 0},v),n.a.createElement(ze.a,{name:"visibility-"+p,options:h,onChange:y,selected:s}),O&&n.a.createElement("p",{className:"settings-item-description-larger",dir:b.isRtl?"rtl":void 0},O)),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:b.isRtl?"rtl":void 0},b("PrivacyExceptions")),g.shouldShowAllowed&&n.a.createElement(Ee.a,{narrow:!0,icon:"add-user",onClick:()=>{a(E)}},n.a.createElement("div",{className:"multiline-menu-item full-size"},j>0&&n.a.createElement("span",{className:"date",dir:"auto"},"+",j),n.a.createElement("span",{className:"title"},b("AlwaysShareWith")),n.a.createElement("span",{className:"subtitle"},b("EditAdminAddUsers")))),g.shouldShowDenied&&n.a.createElement(Ee.a,{narrow:!0,icon:"delete-user",onClick:()=>{a(f)}},n.a.createElement("div",{className:"multiline-menu-item full-size"},C>0&&n.a.createElement("span",{className:"date",dir:"auto"},"",C),n.a.createElement("span",{className:"title"},b("NeverShareWith")),n.a.createElement("span",{className:"subtitle"},b("EditAdminAddUsers"))))))}));function Ha(e){return[e.region,e.country].filter(Boolean).join(", ")}function $a(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}var Va=Object(n.h)(Object(c.h)(e=>({activeSessions:e.activeSessions}),(e,t)=>Object(b.l)(t,["loadAuthorizations","terminateAuthorization","terminateAllAuthorizations"]))(({isActive:e,onScreenSelect:t,onReset:a,activeSessions:c,loadAuthorizations:s,terminateAuthorization:o,terminateAllAuthorizations:l})=>{const[i,d,m]=Object(Ue.a)();Object(n.n)(()=>{s()},[s]);const u=Object(n.m)(e=>{o({hash:e})},[o]),b=Object(n.m)(()=>{m(),l()},[m,l]),h=Object(n.p)(()=>c.find(e=>e.isCurrent),[c]),g=Object(n.p)(()=>c.filter(e=>!e.isCurrent),[c]),p=Object(F.a)();function v(e){return n.a.createElement(Ee.a,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{u(e.hash)}}]},n.a.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},n.a.createElement("span",{className:"date"},Object(B.g)(p,1e3*e.dateActive)),n.a.createElement("span",{className:"title"},e.appName),n.a.createElement("span",{className:"subtitle black tight"},$a(e)),n.a.createElement("span",{className:"subtitle"},e.ip," - ",Ha(e))))}return Object(A.a)(e,a,t,r.n.PrivacyActiveSessions),n.a.createElement("div",{className:"settings-content custom-scroll"},h&&(E=h,n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:p.isRtl?"rtl":void 0},p("AuthSessions.CurrentSession")),n.a.createElement(Ee.a,{narrow:!0,inactive:!0},n.a.createElement("div",{className:"multiline-menu-item",dir:"auto"},n.a.createElement("span",{className:"title",dir:"auto"},E.appName),n.a.createElement("span",{className:"subtitle black tight"},$a(E)),n.a.createElement("span",{className:"subtitle"},E.ip," - ",Ha(E)))),n.a.createElement(Ee.a,{className:"destructive mb-0",icon:"stop",ripple:!0,narrow:!0,onClick:d},p("TerminateAllSessions")))),g&&(O=g,n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:p.isRtl?"rtl":void 0},"Other Sessions"),O.map(v))),g&&n.a.createElement(Pe.a,{isOpen:i,onClose:m,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:b,confirmIsDestructive:!0}));var O,E}));var Wa=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(b.l)(t,["unblockContact"]))(({isActive:e,onScreenSelect:t,onReset:a,chatsByIds:c,usersByIds:s,blockedIds:l,unblockContact:i})=>{const d=Object(n.m)(e=>{i({contactId:e})},[i]),m=Object(F.a)();return Object(A.a)(e,a,t,r.n.PrivacyBlockedUsers),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",dir:m.isRtl?"rtl":void 0},m("BlockedUsersInfo"))),n.a.createElement("div",{className:"chat-list custom-scroll"},l&&l.length?n.a.createElement("div",{className:"scroll-container"},l.map((e,t)=>function(e,t,a){const r=Object(u.ob)(e),l=r?s[e]:void 0,i=r?void 0:c[e],b=Object(W.a)("Chat chat-item-clickable blocked-list-item",r?"private":"group");return n.a.createElement(Ee.a,{key:e,className:b,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{d(e)}}],style:`top: ${(a+t)*o.k}px;`},n.a.createElement(U.a,{size:"medium",user:l,chat:i}),n.a.createElement("div",{className:"contact-info",dir:"auto"},n.a.createElement("h3",{dir:"auto"},Object(x.a)((r?Object(u.bb)(l):Object(u.k)(m,i))||"")),l&&l.phoneNumber&&n.a.createElement("div",{className:"contact-phone",dir:"auto"},Object(qt.c)(l.phoneNumber)),l&&!l.phoneNumber&&l.username&&n.a.createElement("div",{className:"contact-username",dir:"auto"},"@",l.username)))}(e,t,0))):l&&!l.length?n.a.createElement("div",{className:"no-results",dir:"auto"},"List is empty"):n.a.createElement(ge.a,{key:"loading"}))),n.a.createElement(Ht.a,{isShown:!0,onClick:()=>{},className:"not-implemented",ariaLabel:"Add a blocked user"},n.a.createElement("i",{className:"icon-add"})))})),Ka=a(133);var Ya=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(m.c)(e,"🔐")}))(({isActive:e,onReset:t,animatedEmoji:a,onScreenSelect:c})=>{const s=Object(F.a)();return Object(A.a)(e,t,c,r.n.TwoFaEnabled),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ka.a,{sticker:a}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},Object(x.a)(s("EnabledPasswordText"),["br"]))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(Ee.a,{icon:"edit",onClick:()=>c(r.n.TwoFaChangePasswordCurrent)},s("ChangePassword")),n.a.createElement(Ee.a,{icon:"password-off",onClick:()=>c(r.n.TwoFaTurnOff)},s("TurnPasswordOff")),n.a.createElement(Ee.a,{icon:"email",onClick:()=>c(r.n.TwoFaRecoveryEmailCurrentPassword)},s("SetRecoveryEmail"))))})),Qa=a(151),Ja=a(152);var Za=Object(n.h)(({screen:e,isActive:t,onScreenSelect:a,onReset:c,error:s,isLoading:r,expectedPassword:o,placeholder:l="Current Password",hint:i,submitLabel:d,clearError:m,onSubmit:u})=>{const[b,h]=Object(n.r)(""),[g,p]=Object(n.r)(!1),v=Object(n.m)(e=>{o&&e!==o?h("Passwords Should Be Equal"):u(e)},[u,o]),O=Object(n.m)(()=>{m&&m(),h("")},[m]),E=Object(F.a)();return Object(A.a)(t,c,a,e),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Qa.a,{isBig:!0,isPasswordVisible:g})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(Ja.a,{error:b||s,hint:i,placeholder:l,submitLabel:d||E("Next"),clearError:O,isLoading:r,isPasswordVisible:g,onChangePasswordVisibility:p,onSubmit:v})))});var Xa=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(m.c)(e,"🔐")}))(({isActive:e,onScreenSelect:t,onReset:a,animatedEmoji:c,onStart:s})=>{const o=Object(F.a)();return Object(A.a)(e,a,t,r.n.TwoFaDisabled),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ka.a,{sticker:c}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},o("SetAdditionalPasswordInfo"))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(D.a,{onClick:s},o("EditAdminTransferSetPassword"))))}));const en=l.l?550:400;var tn=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:s,shouldConfirm:r,clearError:o,onSubmit:i,isActive:d,onScreenSelect:m,onReset:u,screen:b})=>{const h=Object(n.q)(null),[g,p]=Object(n.r)(""),[v,O,E]=Object(Ue.a)(!1);Object(n.n)(()=>{l.n||setTimeout(()=>{h.current.focus()},en)},[]);const f=Object(F.a)();return Object(A.a)(d,u,m,b),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ka.a,{sticker:e})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),h.current&&i(g)}},n.a.createElement(ve.a,{ref:h,value:g,inputMode:t,label:s,error:c,onChange:e=>{c&&o&&o(),p(e.target.value)}}),g?n.a.createElement(D.a,{type:"submit",isLoading:a,ripple:!0},f("Continue")):n.a.createElement(D.a,{isText:!0,isLoading:a,ripple:!0,onClick:r?O:()=>{i()}},f("YourEmailSkip"))),r&&n.a.createElement(pe.a,{className:"narrow",isOpen:v,title:f("YourEmailSkipWarning"),onClose:E},Object(x.a)(f("YourEmailSkipWarningText"),["br","simple_markdown"]),n.a.createElement("div",{className:"dialog-buttons"},n.a.createElement(D.a,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{E(),i()}},f("YourEmailSkip")),n.a.createElement(D.a,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:E},f("Cancel"))))))}));var an=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(m.c)(e,"🥳")}))(({isActive:e,onReset:t,animatedEmoji:a,onScreenSelect:c})=>{const s=Object(F.a)();return Object(A.a)(e,t,c,r.n.TwoFaCongratulations),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ka.a,{sticker:a}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},s("TwoStepVerificationPasswordSetInfo"))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(D.a,{onClick:()=>{c(r.n.Privacy)}},s("TwoStepVerificationPasswordReturnSettings"))))}));const nn=l.l?550:400;var cn=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:s,onSubmit:r,isActive:o,onScreenSelect:i,onReset:d,screen:m})=>{const u=Object(n.q)(null),[b,h]=Object(n.r)("");Object(n.n)(()=>{l.n||setTimeout(()=>{u.current.focus()},nn)},[]);const g=Object(F.a)();Object(A.a)(o,d,i,m);return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ka.a,{sticker:e})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(ve.a,{value:b,ref:u,inputMode:"decimal",label:g("YourEmailCode"),error:c,onChange:e=>{c&&s&&s();const a=e.target.value.slice(0,t);a.length===t&&r(a),h(a),e.target.value=a}}),a&&n.a.createElement(ge.a,null)))}));var sn=Object(n.h)(Object(c.h)(e=>({...e.twoFaSettings}),(e,t)=>Object(b.l)(t,["updatePassword","updateRecoveryEmail","clearPassword","provideTwoFaEmailCode","checkPassword","clearTwoFaError"]))(({currentScreen:e,shownScreen:t,state:a,hint:c,isLoading:s,error:o,waitingEmailCodeLength:l,dispatch:i,isActive:d,onScreenSelect:m,onReset:u,updatePassword:b,checkPassword:h,clearTwoFaError:g,updateRecoveryEmail:p,provideTwoFaEmailCode:v,clearPassword:O})=>{Object(n.n)(()=>{l&&(e===r.n.TwoFaNewPasswordEmail?m(r.n.TwoFaNewPasswordEmailCode):e===r.n.TwoFaRecoveryEmail&&m(r.n.TwoFaRecoveryEmailCode))},[e,m,l]);const E=Object(n.m)(()=>{i({type:"reset"}),m(r.n.TwoFaNewPassword)},[i,m]),f=Object(n.m)(e=>{i({type:"setPassword",payload:e}),m(r.n.TwoFaNewPasswordConfirm)},[i,m]),j=Object(n.m)(()=>{m(r.n.TwoFaNewPasswordHint)},[m]),C=Object(n.m)(e=>{i({type:"setHint",payload:e}),m(r.n.TwoFaNewPasswordEmail)},[i,m]),y=Object(n.m)(e=>{i({type:"setEmail",payload:e}),b({...a,email:e,onSuccess:()=>{m(r.n.TwoFaCongratulations)}})},[i,m,a,b]),k=Object(n.m)(e=>{i({type:"setCurrentPassword",payload:e}),h({currentPassword:e,onSuccess:()=>{m(r.n.TwoFaChangePasswordNew)}})},[h,i,m]),N=Object(n.m)(e=>{i({type:"setPassword",payload:e}),m(r.n.TwoFaChangePasswordConfirm)},[i,m]),w=Object(n.m)(()=>{m(r.n.TwoFaChangePasswordHint)},[m]),S=Object(n.m)(e=>{i({type:"setHint",payload:e}),b({...a,hint:e,onSuccess:()=>{m(r.n.TwoFaCongratulations)}})},[i,m,a,b]),I=Object(n.m)(e=>{O({currentPassword:e,onSuccess:()=>{m(r.n.Privacy)}})},[O,m]),P=Object(n.m)(e=>{i({type:"setCurrentPassword",payload:e}),h({currentPassword:e,onSuccess:()=>{m(r.n.TwoFaRecoveryEmail)}})},[h,i,m]),M=Object(n.m)(e=>{i({type:"setEmail",payload:e}),p({...a,email:e,onSuccess:()=>{m(r.n.TwoFaCongratulations)}})},[i,m,a,p]),A=Object(n.m)(e=>{v({code:e})},[v]),L=Object(F.a)();switch(e){case r.n.TwoFaDisabled:return n.a.createElement(Xa,{onStart:E,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPassword,r.n.TwoFaNewPasswordConfirm,r.n.TwoFaNewPasswordHint,r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPassword:return n.a.createElement(Za,{screen:e,placeholder:L("PleaseEnterPassword"),submitLabel:L("Continue"),onSubmit:f,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPasswordConfirm,r.n.TwoFaNewPasswordHint,r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPasswordConfirm:return n.a.createElement(Za,{screen:e,expectedPassword:a.password,placeholder:L("PleaseReEnterPassword"),submitLabel:L("Continue"),onSubmit:j,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPasswordHint,r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPasswordHint:return n.a.createElement(tn,{icon:"hint",placeholder:L("PasswordHintPlaceholder"),onSubmit:C,screen:e,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPasswordEmail:return n.a.createElement(tn,{icon:"email",type:"email",isLoading:s,error:o,clearError:g,placeholder:L("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:y,screen:e,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPasswordEmailCode:return n.a.createElement(cn,{isLoading:s,error:o,clearError:g,onSubmit:A,screen:e,onScreenSelect:m,isActive:d||t===r.n.TwoFaCongratulations,onReset:u});case r.n.TwoFaCongratulations:return n.a.createElement(an,{onScreenSelect:m,isActive:d,onReset:u});case r.n.TwoFaEnabled:return n.a.createElement(Ya,{onScreenSelect:m,isActive:d||[r.n.TwoFaChangePasswordCurrent,r.n.TwoFaChangePasswordNew,r.n.TwoFaChangePasswordConfirm,r.n.TwoFaChangePasswordHint,r.n.TwoFaTurnOff,r.n.TwoFaRecoveryEmailCurrentPassword,r.n.TwoFaRecoveryEmail,r.n.TwoFaRecoveryEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaChangePasswordCurrent:return n.a.createElement(Za,{screen:e,isLoading:s,error:o,clearError:g,hint:c,onSubmit:k,onScreenSelect:m,isActive:d||[r.n.TwoFaChangePasswordNew,r.n.TwoFaChangePasswordConfirm,r.n.TwoFaChangePasswordHint,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaChangePasswordNew:return n.a.createElement(Za,{screen:e,placeholder:L("PleaseEnterNewFirstPassword"),onSubmit:N,onScreenSelect:m,isActive:d||[r.n.TwoFaChangePasswordConfirm,r.n.TwoFaChangePasswordHint,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaChangePasswordConfirm:return n.a.createElement(Za,{screen:e,expectedPassword:a.password,placeholder:L("PleaseReEnterPassword"),onSubmit:w,onScreenSelect:m,isActive:d||[r.n.TwoFaChangePasswordHint,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaChangePasswordHint:return n.a.createElement(tn,{isLoading:s,error:o,clearError:g,icon:"hint",placeholder:L("PasswordHintPlaceholder"),onSubmit:S,onScreenSelect:m,isActive:d||t===r.n.TwoFaCongratulations,onReset:u,screen:e});case r.n.TwoFaTurnOff:return n.a.createElement(Za,{isLoading:s,error:o,clearError:g,hint:c,onSubmit:I,onScreenSelect:m,isActive:d,onReset:u,screen:e});case r.n.TwoFaRecoveryEmailCurrentPassword:return n.a.createElement(Za,{screen:e,isLoading:s,error:o,clearError:g,hint:c,onSubmit:P,onScreenSelect:m,isActive:d||[r.n.TwoFaRecoveryEmail,r.n.TwoFaRecoveryEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaRecoveryEmail:return n.a.createElement(tn,{screen:e,icon:"email",type:"email",placeholder:L("RecoveryEmailTitle"),onSubmit:M,onScreenSelect:m,isActive:d||[r.n.TwoFaRecoveryEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaRecoveryEmailCode:return n.a.createElement(cn,{screen:e,isLoading:s,error:o,clearError:g,onSubmit:A,onScreenSelect:m,isActive:d||t===r.n.TwoFaCongratulations,onReset:u});default:return}})),rn=a(170);function on(e,t){const{privacy:a}=e.settings;switch(t){case r.n.PrivacyPhoneNumberAllowedContacts:case r.n.PrivacyPhoneNumberDeniedContacts:return a.phoneNumber;case r.n.PrivacyLastSeenAllowedContacts:case r.n.PrivacyLastSeenDeniedContacts:return a.lastSeen;case r.n.PrivacyProfilePhotoAllowedContacts:case r.n.PrivacyProfilePhotoDeniedContacts:return a.profilePhoto;case r.n.PrivacyForwardingAllowedContacts:case r.n.PrivacyForwardingDeniedContacts:return a.forwards;case r.n.PrivacyGroupChatsDeniedContacts:case r.n.PrivacyGroupChatsAllowedContacts:return a.chatInvite}}var ln=Object(n.h)(Object(c.h)((e,{screen:t})=>{const{chats:{byId:a,listIds:n,orderedPinnedIds:c},currentUserId:s}=e;return{currentUserId:s,chatsById:a,listIds:n.active,orderedPinnedIds:c.active,archivedPinnedIds:c.archived,archivedListIds:n.archived,settings:on(e,t)}},(e,t)=>Object(b.l)(t,["setPrivacySettings"]))(({currentUserId:e,isAllowList:t,screen:a,settings:c,chatsById:s,listIds:o,orderedPinnedIds:l,archivedListIds:i,archivedPinnedIds:d,setPrivacySettings:m,isActive:b,onScreenSelect:h,onReset:g})=>{const p=Object(F.a)(),v=Object(n.p)(()=>c?t?[...c.allowUserIds,...c.allowChatIds]:[...c.blockUserIds,...c.blockChatIds]:[],[t,c]),[O,E]=Object(n.r)(""),[f,j]=Object(n.r)(!1),[C,y]=Object(n.r)(v),k=Object(n.p)(()=>{const e=o?Object(u.Fb)(s,o,l,"all"):void 0,t=i?Object(u.Fb)(s,i,d,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]},[s,o,l,i,d]),N=Object(n.p)(()=>{if(k)return k.filter(t=>(Object(u.ob)(t.id)&&t.id!==e||Object(u.nb)(t))&&(!O||Object(ue.a)(Object(u.k)(p,t),O)||v.includes(t.id))).map(({id:e})=>e)},[k,e,p,O,v]),w=Object(n.m)(e=>{y(e),j(!0)},[]),S=Object(n.m)(()=>{m({privacyKey:za(a),isAllowList:Boolean(t),contactsIds:C}),h(r.n.Privacy)},[t,C,h,a,m]);return Object(A.a)(b,g,h,a),n.a.createElement("div",{className:"NewChat-inner step-1"},n.a.createElement(rn.a,{itemIds:N||[],selectedIds:C,filterValue:O,filterPlaceholder:p(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:w,onFilterChange:E}),n.a.createElement(Ht.a,{isShown:f,onClick:S,ariaLabel:p(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},n.a.createElement("i",{className:"icon-arrow-right"})))}));a(284);const dn=Object.keys(r.n).length/2,mn=[r.n.TwoFaDisabled,r.n.TwoFaNewPassword,r.n.TwoFaNewPasswordConfirm,r.n.TwoFaNewPasswordHint,r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations,r.n.TwoFaEnabled,r.n.TwoFaChangePasswordCurrent,r.n.TwoFaChangePasswordNew,r.n.TwoFaChangePasswordConfirm,r.n.TwoFaChangePasswordHint,r.n.TwoFaTurnOff,r.n.TwoFaRecoveryEmailCurrentPassword,r.n.TwoFaRecoveryEmail,r.n.TwoFaRecoveryEmailCode],un=[r.n.Folders,r.n.FoldersCreateFolder,r.n.FoldersEditFolder,r.n.FoldersIncludedChats,r.n.FoldersExcludedChats],bn=[r.n.PrivacyBlockedUsers,r.n.PrivacyActiveSessions],hn=[r.n.PrivacyPhoneNumberAllowedContacts,r.n.PrivacyPhoneNumberDeniedContacts],gn=[r.n.PrivacyLastSeenAllowedContacts,r.n.PrivacyLastSeenDeniedContacts],pn=[r.n.PrivacyProfilePhotoAllowedContacts,r.n.PrivacyProfilePhotoDeniedContacts],vn=[r.n.PrivacyForwardingAllowedContacts,r.n.PrivacyForwardingDeniedContacts],On=[r.n.PrivacyGroupChatsAllowedContacts,r.n.PrivacyGroupChatsDeniedContacts];var En=Object(n.h)(({isActive:e,currentScreen:t,onScreenSelect:a,onReset:c,shouldSkipTransition:s})=>{const[o,i]=Pt(Bt,Dt),[d,m]=Pt(Ut,xt),u=Object(n.m)(()=>{t!==r.n.FoldersCreateFolder&&t!==r.n.FoldersEditFolder||setTimeout(()=>{i({type:"reset"})},200),t!==r.n.FoldersIncludedChats&&t!==r.n.FoldersExcludedChats?c():"create"===o.mode?a(r.n.FoldersCreateFolder):a(r.n.FoldersEditFolder)},[o.mode,i,t,c,a]),b=Object(n.m)(()=>{i({type:"saveFilters"}),u()},[i,u]);function h(c,s,l){return n.a.createElement(n.a.Fragment,null,n.a.createElement(Gt,{currentScreen:t,onReset:u,onSaveFilter:b,editedFolderId:o.folderId}),function(c,s){const l={[r.n.PrivacyPhoneNumber]:hn.includes(s),[r.n.PrivacyLastSeen]:gn.includes(s),[r.n.PrivacyProfilePhoto]:pn.includes(s),[r.n.PrivacyForwarding]:vn.includes(s),[r.n.PrivacyGroupChats]:On.includes(s)},b=mn.includes(s),h=un.includes(s),g=bn.includes(s)||b||Object.keys(l).includes(s.toString())||Object.values(l).find(e=>!0===e);switch(t){case r.n.Main:return n.a.createElement(zt,{onScreenSelect:a,isActive:e,onReset:u});case r.n.EditProfile:return n.a.createElement(Qt,{onScreenSelect:a,isActive:e&&c,onReset:u});case r.n.General:return n.a.createElement(Ea,{onScreenSelect:a,isActive:c||s===r.n.GeneralChatBackgroundColor||s===r.n.GeneralChatBackground||g||h,onReset:u});case r.n.Notifications:return n.a.createElement(xa,{onScreenSelect:a,isActive:c,onReset:u});case r.n.Privacy:return n.a.createElement(Ua,{onScreenSelect:a,isActive:c||g||b,onReset:u});case r.n.Language:return n.a.createElement(qa,{onScreenSelect:a,isActive:c,onReset:u});case r.n.GeneralChatBackground:return n.a.createElement(Aa,{onScreenSelect:a,isActive:c||s===r.n.GeneralChatBackgroundColor,onReset:u});case r.n.GeneralChatBackgroundColor:return n.a.createElement(Ba,{onScreenSelect:a,isActive:c,onReset:u});case r.n.PrivacyActiveSessions:return n.a.createElement(Va,{onScreenSelect:a,isActive:c,onReset:u});case r.n.PrivacyBlockedUsers:return n.a.createElement(Wa,{onScreenSelect:a,isActive:c,onReset:u});case r.n.PrivacyPhoneNumber:case r.n.PrivacyLastSeen:case r.n.PrivacyProfilePhoto:case r.n.PrivacyForwarding:case r.n.PrivacyGroupChats:return n.a.createElement(_a,{screen:t,onScreenSelect:a,isActive:c||l[t],onReset:u});case r.n.PrivacyPhoneNumberAllowedContacts:case r.n.PrivacyLastSeenAllowedContacts:case r.n.PrivacyProfilePhotoAllowedContacts:case r.n.PrivacyForwardingAllowedContacts:case r.n.PrivacyGroupChatsAllowedContacts:return n.a.createElement(ln,{isAllowList:!0,screen:t,onScreenSelect:a,isActive:c||l[t],onReset:u});case r.n.PrivacyPhoneNumberDeniedContacts:case r.n.PrivacyLastSeenDeniedContacts:case r.n.PrivacyProfilePhotoDeniedContacts:case r.n.PrivacyForwardingDeniedContacts:case r.n.PrivacyGroupChatsDeniedContacts:return n.a.createElement(ln,{screen:t,onScreenSelect:a,isActive:c,onReset:u});case r.n.Folders:case r.n.FoldersCreateFolder:case r.n.FoldersEditFolder:case r.n.FoldersIncludedChats:case r.n.FoldersExcludedChats:return n.a.createElement(la,{currentScreen:t,shownScreen:s,state:o,dispatch:i,isActive:c,onScreenSelect:a,onReset:u});case r.n.TwoFaDisabled:case r.n.TwoFaNewPassword:case r.n.TwoFaNewPasswordConfirm:case r.n.TwoFaNewPasswordHint:case r.n.TwoFaNewPasswordEmail:case r.n.TwoFaNewPasswordEmailCode:case r.n.TwoFaCongratulations:case r.n.TwoFaEnabled:case r.n.TwoFaChangePasswordCurrent:case r.n.TwoFaChangePasswordNew:case r.n.TwoFaChangePasswordConfirm:case r.n.TwoFaChangePasswordHint:case r.n.TwoFaTurnOff:case r.n.TwoFaRecoveryEmailCurrentPassword:case r.n.TwoFaRecoveryEmail:case r.n.TwoFaRecoveryEmailCode:return n.a.createElement(sn,{currentScreen:t,state:d,dispatch:m,shownScreen:s,isActive:c,onScreenSelect:a,onReset:u});default:return}}(c,l))}return n.a.createElement(T.a,{id:"Settings",name:s?"none":l.p,activeKey:t,renderCount:dn},h)});const fn=Object(V.h)(e=>e(),6e4,!0);var jn=Object(n.h)(Object(c.h)(e=>{const{userIds:t}=e.contactList||{},{byId:a}=e.users;return{usersById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(b.l)(t,["loadContactList","openChat"]))(({isActive:e,onReset:t,filter:a,usersById:c,contactIds:s,loadContactList:r,openChat:o,serverTimeOffset:i})=>{Object(n.n)(()=>{fn(()=>{r()})}),Object(A.a)(e,t);const d=Object(n.m)(e=>{o({id:e})},[o]),m=Object(n.p)(()=>{if(!s)return;const e=a?s.filter(e=>{const t=c[e];if(!t)return!1;const n=Object(u.bb)(t);return n&&Object(ue.a)(n,a)}):s;return Object(u.Jb)(e,c,void 0,i)},[s,a,c,i]),[b,h]=Object(be.a)(void 0,m,Boolean(a));return n.a.createElement(Oe.a,{items:b,onLoadMore:h,className:"chat-list custom-scroll"},b&&b.length?b.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable",onClick:()=>d(e),ripple:!l.l},n.a.createElement(fe.a,{userId:e,forceShowSelf:!0,avatarSize:"large"}))):b&&!b.length?n.a.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},a.length?"No contacts matched your search.":"Contact list is empty."):n.a.createElement(ge.a,{key:"loading"}))}));const Cn=Object(V.h)(e=>e(),6e4,!0);var yn=Object(n.h)(Object(c.h)(e=>{const{userIds:t}=e.contactList||{},{byId:a}=e.users,{byId:n}=e.chats,{currentUserId:c}=e,{query:s,fetchingStatus:r,globalResults:o,localResults:l}=e.globalSearch,{userIds:i}=o||{},{userIds:d}=l||{};return{currentUserId:c,usersById:a,chatsById:n,localContactIds:t,searchQuery:s,isSearching:r&&r.chats,globalUserIds:i,localUserIds:d}},(e,t)=>Object(b.l)(t,["loadContactList","setGlobalSearchQuery"]))(({isChannel:e,isActive:t,selectedMemberIds:a,onSelectedMemberIdsChange:c,onNextStep:s,onReset:r,currentUserId:o,usersById:l,chatsById:i,localContactIds:d,searchQuery:m,isSearching:h,localUserIds:g,globalUserIds:p,loadContactList:v,setGlobalSearchQuery:O})=>{Object(n.n)(()=>{Cn(()=>{v()})});const E=Object(F.a)();Object(A.a)(t,r);const f=Object(n.m)(e=>{O({query:e})},[O]),j=Object(n.p)(()=>{const e=d?Object(u.Ib)(d.filter(e=>e!==o),i):[];if(!m)return e;const t=e.filter(e=>{const t=l[e];if(!t)return!1;const a=Object(u.bb)(t);return a&&Object(ue.a)(a,m)});return Object(u.Ib)(Object(b.o)([...t,...g||[],...p||[]]).filter(e=>{const t=l[e];return!t||!Object(u.Bb)(t)||t.canBeInvitedToGroup}),i,!1,a)},[d,i,m,g,p,a,o,l]),C=Object(n.m)(()=>{(a.length||e)&&(O({query:""}),s())},[a.length,e,O,s]);return n.a.createElement("div",{className:"NewChat step-1"},n.a.createElement("div",{className:"left-header"},n.a.createElement(D.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,E("GroupAddMembers"))),n.a.createElement("div",{className:"NewChat-inner step-1"},n.a.createElement(rn.a,{itemIds:j,selectedIds:a,filterValue:m,filterPlaceholder:E("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:h,onSelectedIdsChange:c,onFilterChange:f}),n.a.createElement(Ht.a,{isShown:Boolean(a.length||e),onClick:C,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},n.a.createElement("i",{className:"icon-arrow-right"}))))}));var kn=Object(n.h)(Object(c.h)(e=>{const{progress:t,error:a}=e.chatCreation||{};return{creationProgress:t,creationError:a}},(e,t)=>Object(b.l)(t,["createGroupChat","createChannel"]))(({isChannel:e,isActive:t,memberIds:a,onReset:c,creationProgress:s,creationError:o,createGroupChat:l,createChannel:i})=>{const d=Object(F.a)();Object(A.a)(t,c);const[m,u]=Object(n.r)(""),[b,h]=Object(n.r)(""),[g,p]=Object(n.r)(),[v,O]=Object(n.r)(),E=s===r.a.InProgress,f=Object(n.m)(e=>{const{value:t}=e.currentTarget,a=t.replace(/^\s+/,"");u(a),a!==t&&(e.currentTarget.value=a)},[]),j=Object(n.m)(e=>{h(e.currentTarget.value)},[]),C=Object(n.m)(()=>{m.length?a.length>199?O("Sorry, creating supergroups is not yet supported"):l({title:m,photo:g,memberIds:a}):O("Chat title can't be empty")},[m,a,l,g,"Chat title can't be empty","Sorry, creating supergroups is not yet supported"]),y=Object(n.m)(()=>{m.length?i({title:m,about:b,photo:g,memberIds:a}):O("Channel title can't be empty")},[m,i,b,g,a,"Channel title can't be empty"]);Object(n.n)(()=>{s===r.a.Complete&&c(!0)},[s,c]);const k=o||("Chat title can't be empty"!==v&&"Channel title can't be empty"!==v?v:void 0);return n.a.createElement("div",{className:"NewChat"},n.a.createElement("div",{className:"left-header"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>c(),ariaLabel:"Return to member selection"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,d(e?"NewChannel":"NewGroup"))),n.a.createElement("div",{className:"NewChat-inner step-2"},n.a.createElement(_t.a,{onChange:p,title:d("AddPhoto")}),n.a.createElement(ve.a,{value:m,onChange:f,label:d(e?"EnterChannelName":"GroupName"),error:"Chat title can't be empty"===v||"Channel title can't be empty"===v?v:void 0}),e&&n.a.createElement(n.a.Fragment,null,n.a.createElement(ve.a,{value:b,onChange:j,label:d("DescriptionOptionalPlaceholder")}),n.a.createElement("p",{className:"note"},d("DescriptionInfo"))),k&&n.a.createElement("p",{className:"error"},k),a.length>0&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h3",{className:"chat-members-heading"},d("GroupInfo.ParticipantCount",a.length,"i")),n.a.createElement("div",{className:"chat-members-list custom-scroll"},a.map(e=>n.a.createElement(Ee.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(fe.a,{userId:e})))))),n.a.createElement(Ht.a,{isShown:0!==m.length,onClick:e?y:C,disabled:E,ariaLabel:e?d("ChannelIntro.CreateChannel"):"Create Group"},E?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-arrow-right"})))}));a(285);const Nn=Object.keys(r.d).length/2;var wn=Object(n.h)(({isActive:e,isChannel:t=!1,content:a,onContentChange:c,onReset:s})=>{const[o,i]=Object(n.r)([]),d=Object(n.m)(()=>{c(t?r.d.NewChannelStep2:r.d.NewGroupStep2)},[t,c]);return n.a.createElement(T.a,{id:"NewChat",name:l.p,renderCount:Nn,activeKey:a},c=>{switch(a){case r.d.NewChannelStep1:case r.d.NewGroupStep1:return n.a.createElement(yn,{isChannel:t,isActive:e,selectedMemberIds:o,onSelectedMemberIdsChange:i,onNextStep:d,onReset:s});case r.d.NewChannelStep2:case r.d.NewGroupStep2:return n.a.createElement(kn,{isChannel:t,isActive:c&&e,memberIds:o,onReset:s});default:return}})}),Sn=a(194);a(286);var In=Object(n.h)(({isActive:e,onReset:t,onContentChange:a})=>{const c=Object(F.a)();return Object(A.a)(e,t,a,r.d.Archived),n.a.createElement("div",{className:"ArchivedChats"},n.a.createElement("div",{className:"left-header"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:t,ariaLabel:"Return to chat list"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,c("ArchivedChats"))),n.a.createElement(Sn.a,{folderType:"archived",noChatsText:"Archive is empty.",isActive:e}))});const Pn={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};const Mn=e=>{e.preventDefault()};function Fn(e){Pn[e.key]&&!function(e){if(!(e&&e instanceof HTMLElement))return!1;const t=e,a=t.tagName.toLowerCase();if("textarea"===a)return!0;if("input"!==a)return!1;const n=t.getAttribute("type");return!!n&&["text","password","number","email","tel","url","search","date","datetime","datetime-local","time","month","week"].indexOf(n.toLowerCase())>-1}(e.target)&&Mn(e)}function An(){document.addEventListener("wheel",Mn,{passive:!1}),window.ontouchmove=Mn,document.onkeydown=Fn}function Ln(){document.removeEventListener("wheel",Mn),window.ontouchmove=null,document.onkeydown=null}var Rn=a(57),Tn=a(156);function Dn(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}var Bn=a(178),xn=a(55);a(287);var Un=({isOpen:e,message:t,anchor:a,canSendNow:c,canReschedule:r,canReply:o,canEdit:l,canPin:i,canUnpin:d,canDelete:m,canReport:b,canForward:h,canFaveSticker:g,canUnfaveSticker:p,canCopy:v,canCopyLink:O,canSelect:E,onReply:f,onEdit:j,onPin:C,onUnpin:y,onForward:k,onDelete:N,onReport:w,onFaveSticker:S,onUnfaveSticker:I,onSelect:P,onSend:M,onReschedule:A,onClose:L,onCloseAnimationEnd:R,onCopyLink:T})=>{const D=function(e,t,a){const n=[],c=Object(u.P)(e),r=Object(u.H)(e)||(Object(u.T)(e)?void 0:Object(u.S)(e)),o=Object(u.E)(e,"inline"),l=r&&(o||Object(u.eb)(e))&&Tn.a,i=window.getSelection();if(l&&n.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(o?Rn.b(o,s.ApiMediaFormat.BlobUrl):r.blobUrl).then(Tn.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:Dn(e),handler:()=>{const a=e&&i?i.toString():c;Object(Tn.c)(a),t&&t()}})}return a&&n.push({label:"lng_context_copy_message_link",handler:()=>{a(),t&&t()}}),n}(t,L,O?T:void 0),B=Object(n.m)(()=>document.querySelector(`.active > .MessageList div[data-message-id="${t.id}"]`),[t.id]),x=Object(n.m)(()=>document.querySelector(".active > .MessageList"),[]),U=Object(n.m)(()=>document.querySelector(".MessageContextMenu .bubble"),[]),{positionX:G,positionY:q,style:z}=Object(Bn.a)(a,B,x,U,10,document.querySelector(".MiddleHeader").offsetHeight),H=Object(F.a)();return n.a.createElement(xn.a,{isOpen:e,positionX:G,positionY:q,style:z,className:"MessageContextMenu fluid",onClose:L,onCloseAnimationEnd:R},c&&n.a.createElement(_.a,{icon:"send-outline",onClick:M},H("MessageScheduleSend")),r&&n.a.createElement(_.a,{icon:"schedule",onClick:A},H("MessageScheduleEditTime")),o&&n.a.createElement(_.a,{icon:"reply",onClick:f},H("Reply")),l&&n.a.createElement(_.a,{icon:"edit",onClick:j},H("Edit")),g&&n.a.createElement(_.a,{icon:"favorite",onClick:S},H("AddToFavorites")),p&&n.a.createElement(_.a,{icon:"favorite",onClick:I},H("Stickers.RemoveFromFavorites")),v&&D.map(e=>n.a.createElement(_.a,{key:e.label,icon:"copy",onClick:e.handler},H(e.label))),i&&n.a.createElement(_.a,{icon:"pin",onClick:C},H("DialogPin")),d&&n.a.createElement(_.a,{icon:"unpin",onClick:y},H("DialogUnpin")),h&&n.a.createElement(_.a,{icon:"forward",onClick:k},H("Forward")),E&&n.a.createElement(_.a,{icon:"select",onClick:P},H("Common.Select")),b&&n.a.createElement(_.a,{icon:"flag",onClick:w},H("lng_context_report_msg")),m&&n.a.createElement(_.a,{destructive:!0,icon:"delete",onClick:N},H("Delete")))};var Gn=Object(n.h)(Object(c.h)((e,{message:t,messageListType:a})=>{const{threadId:n}=Object(m.z)(e)||{},{noOptions:c,canReply:s,canPin:r,canUnpin:o,canDelete:l,canReport:i,canEdit:d,canForward:u,canFaveSticker:b,canUnfaveSticker:h,canCopy:g,canCopyLink:p,canSelect:v}=n&&Object(m.b)(e,t,n)||{},O="pinned"===a,E="scheduled"===a;return{noOptions:c,canSendNow:E,canReschedule:E,canReply:!O&&!E&&s,canPin:!E&&r,canUnpin:!E&&o,canDelete:l,canReport:i,canEdit:!O&&d,canForward:!E&&u,canFaveSticker:!E&&b,canUnfaveSticker:!E&&h,canCopy:g,canCopyLink:!E&&p,canSelect:v}},(e,t)=>Object(b.l)(t,["setReplyingToId","setEditingId","pinMessage","openForwardMenu","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","loadMessageLink"]))(({isOpen:e,messageListType:t,message:a,album:c,anchor:s,onClose:r,onCloseAnimationEnd:o,noOptions:l,canSendNow:i,canReschedule:d,canReply:m,canPin:u,canUnpin:b,canDelete:h,canReport:g,canEdit:p,canForward:v,canFaveSticker:O,canUnfaveSticker:E,canCopy:f,canCopyLink:j,canSelect:C,setReplyingToId:y,setEditingId:k,pinMessage:N,openForwardMenu:w,faveSticker:S,unfaveSticker:I,toggleMessageSelection:P,sendScheduledMessages:M,rescheduleMessage:F,loadMessageLink:A})=>{const{transitionClassNames:L}=Object(Y.a)(e,o,void 0,!1),[R,T]=Object(n.r)(!0),[D,x]=Object(n.r)(!1),[U,G]=Object(n.r)(!1),[q,z]=Object(n.r)(!1),[_,H,$]=Object(Ue.a)(),V=Object(n.m)(()=>{T(!1),x(!0)},[]),W=Object(n.m)(()=>{T(!1),G(!0)},[]),K=Object(n.m)(()=>{T(!1),r()},[r]),Q=Object(n.m)(()=>{x(!1),r()},[r]),J=Object(n.m)(()=>{G(!1),r()},[r]),Z=Object(n.m)(()=>{z(!1),r()},[r]),X=Object(n.m)(()=>{$(),r()},[$,r]),ee=Object(n.m)(()=>{y({messageId:a.id}),K()},[y,a.id,K]),te=Object(n.m)(()=>{k({messageId:a.id}),K()},[k,a.id,K]),ae=Object(n.m)(()=>{T(!1),z(!0)},[]),ne=Object(n.m)(()=>{N({messageId:a.id,isUnpin:!0}),K()},[N,a.id,K]),ce=Object(n.m)(()=>{if(K(),c&&c.messages){const e=c.messages.map(({id:e})=>e);w({fromChatId:a.chatId,messageIds:e})}else w({fromChatId:a.chatId,messageIds:[a.id]})},[w,a,K,c]),se=Object(n.m)(()=>{K(),S({sticker:a.content.sticker})},[K,a.content.sticker,S]),re=Object(n.m)(()=>{K(),I({sticker:a.content.sticker})},[K,a.content.sticker,I]),oe=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};P(e),K()},[K,a.id,P,c]),le=Object(n.m)(()=>{M({chatId:a.chatId,id:a.id}),K()},[K,a.chatId,a.id,M]),ie=Object(n.m)(()=>{T(!1),H()},[H]),de=Object(n.m)(e=>{F({chatId:a.chatId,messageId:a.id,scheduledAt:Math.round(e.getTime()/1e3)})},[a.chatId,a.id,F]),me=Object(n.m)(()=>{A({messageId:a.id,chatId:a.chatId}),K()},[K,A,a.chatId,a.id]);Object(n.n)(()=>(An(),Ln),[]);const ue=Object(n.p)(()=>(c?c.messages:[a]).map(({id:e})=>e),[c,a]);if(l)return void K();const be=new Date;return be.setFullYear(be.getFullYear()+1),n.a.createElement("div",{className:["ContextMenuContainer",L].join(" ")},n.a.createElement(Un,{message:a,isOpen:R,anchor:s,canSendNow:i,canReschedule:d,canReply:m,canDelete:h,canReport:g,canPin:u,canUnpin:b,canEdit:p,canForward:v,canFaveSticker:O,canUnfaveSticker:E,canCopy:f,canCopyLink:j,canSelect:C,onReply:ee,onEdit:te,onPin:ae,onUnpin:ne,onForward:ce,onDelete:V,onReport:W,onFaveSticker:se,onUnfaveSticker:re,onSelect:oe,onSend:le,onReschedule:ie,onClose:K,onCopyLink:me}),n.a.createElement(De,{isOpen:D,isSchedule:"scheduled"===t,onClose:Q,album:c,message:a}),n.a.createElement(_e,{isOpen:U,onClose:J,messageIds:ue}),n.a.createElement(Be,{isOpen:q,messageId:a.id,chatId:a.chatId,onClose:Z}),n.a.createElement(Re,{isOpen:_,withTimePicker:!0,selectedAt:1e3*a.date,maxAt:Object(B.k)(be),isFutureMode:!0,onClose:X,onSubmit:de}))}));a(288);var qn=Object(n.h)(Object(c.h)((e,{fromSticker:t})=>({stickerSet:Object(m.zb)(e,t.stickerSetId)}),(e,t)=>Object(b.l)(t,["loadStickers","toggleStickerSet","sendMessage"]))(({isOpen:e,fromSticker:t,stickerSet:a,onClose:c,loadStickers:s,toggleStickerSet:r,sendMessage:l})=>{const i=Object(n.q)(null),d=Object(F.a)(),{observe:m}=Object(ia.a)({rootRef:i,throttleMs:200,isDisabled:!e});Object(n.n)(()=>{if(e){const{stickerSetId:e,stickerSetAccessHash:a}=t;s({stickerSetId:e,stickerSetAccessHash:a})}},[e,t,s]);const u=Object(n.m)(e=>{e={...e,isPreloadedGlobally:!0},l({sticker:e}),c()},[c,l]),b=Object(n.m)(()=>{r({stickerSetId:t.stickerSetId}),c()},[t.stickerSetId,c,r]);return n.a.createElement(pe.a,{className:"StickerSetModal",isOpen:e,onClose:c,hasCloseButton:!0,title:a?Object(x.a)(a.title,["emoji","links"]):d("AccDescrStickerSet")},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(ga,{sticker:e,size:o.Hb,observeIntersection:m,onClick:u,clickArg:e}))),n.a.createElement("div",{className:"button-wrapper"},n.a.createElement(D.a,{size:"smaller",fluid:!0,color:a.installedDate?"danger":"primary",onClick:b},d(a.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",a.count,"i")))):n.a.createElement(ge.a,null))})),zn=a(127);a(289);var _n=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t);return!a||a.isRestricted?{}:{chat:a,isMuted:Object(u.Hb)(a,Object(m.fb)(e),Object(m.eb)(e)),isPrivate:Object(u.ob)(a.id),canDeleteChat:Object(u.c)(a)}},(e,t)=>Object(b.l)(t,["updateChatMutedState","enterMessageSelectMode","sendBotCommand","restartBot"]))(({chatId:e,isOpen:t,anchor:a,isChannel:c,canStartBot:s,canRestartBot:r,canSubscribe:o,canSearch:i,canMute:d,canSelect:m,canLeave:u,chat:b,isPrivate:h,isMuted:g,canDeleteChat:p,onSubscribeChannel:v,onSearchClick:O,onClose:E,onCloseAnimationEnd:f,updateChatMutedState:j,enterMessageSelectMode:C,sendBotCommand:y,restartBot:k})=>{const[N,w]=Object(n.r)(!0),[S,I]=Object(n.r)(!1),{x:P,y:M}=a;Object(Y.a)(t,f,void 0,!1);const A=Object(n.m)(()=>{w(!1),I(!0)},[]),L=Object(n.m)(()=>{w(!1),E()},[E]),R=Object(n.m)(()=>{I(!1),E()},[E]),T=Object(n.m)(()=>{y({command:"/start"})},[y]),D=Object(n.m)(()=>{k({chatId:e})},[e,k]),B=Object(n.m)(()=>{j({chatId:e,isMuted:!g}),L()},[e,L,g,j]),x=Object(n.m)(()=>{v(),L()},[L,v]),U=Object(n.m)(()=>{O(),L()},[L,O]),G=Object(n.m)(()=>{C(),L()},[L,C]);Object(n.n)(()=>(An(),Ln),[]);const q=Object(F.a)();return n.a.createElement(zn.a,null,n.a.createElement("div",{className:"HeaderMenuContainer"},n.a.createElement(xn.a,{isOpen:N,positionX:"right",style:`left: ${P}px;top: ${M}px;`,onClose:L},l.l&&s&&n.a.createElement(_.a,{icon:"bots",onClick:T},q("BotStart")),l.l&&r&&n.a.createElement(_.a,{icon:"bots",onClick:D},q("BotRestart")),l.l&&o&&n.a.createElement(_.a,{icon:c?"channel":"group",onClick:x},q(c?"Subscribe":"Join Group")),l.l&&i&&n.a.createElement(_.a,{icon:"search",onClick:U},q("Search")),d&&n.a.createElement(_.a,{icon:g?"unmute":"mute",onClick:B},q(g?"ChatsUnmute":"ChatsMute")),m&&n.a.createElement(_.a,{icon:"select",onClick:G},q("ReportSelectMessages")),u&&n.a.createElement(_.a,{destructive:!0,icon:"delete",onClick:A},q(h?"Delete":p?"GroupInfo.DeleteAndExit":c?"LeaveChannel":"Group.LeaveGroup"))),b&&n.a.createElement(Ye.a,{isOpen:S,onClose:R,chat:b})))})),Hn=a(157);a(290);const $n=Object(V.a)(e=>e(),200,!1);var Vn=Object(n.h)(Object(c.h)(e=>{const t=Object(m.s)(e);if(!t)return{};const{query:a,results:n}=Object(m.B)(e)||{},{totalCount:c,foundIds:s}=n||{};return{chat:t,query:a,totalCount:c,foundIds:s,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}},(e,t)=>Object(b.l)(t,["setLocalTextSearchQuery","searchTextMessagesLocal","focusMessage","closeLocalTextSearch","openHistoryCalendar"]))(({isActive:e,chat:t,query:a,totalCount:c,foundIds:s,isHistoryCalendarOpen:r,setLocalTextSearchQuery:o,searchTextMessagesLocal:l,focusMessage:i,closeLocalTextSearch:d,openHistoryCalendar:m})=>{const u=Object(n.q)(null),[b,h]=Object(n.r)(0);Object(n.n)(()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),a=()=>{const{activeElement:a}=document;if(a&&a===u.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&&s&&s.length?(i({chatId:t.id,messageId:s[s.length-1]}),h(0)):h(-1)},[t,i,s]),Object(n.n)(()=>{Array.from(document.querySelectorAll("input")).forEach(t=>{t.disabled=Boolean(e&&t!==u.current)}),Array.from(document.querySelectorAll("div[contenteditable]")).forEach(t=>{t.contentEditable=e?"false":"true"})},[e]),Object(n.n)(()=>{e||u.current.blur()},[e]),Object(n.o)(()=>{document.querySelector("#MobileSearch input").blur()},[r]);const g=Object(n.m)(e=>{o({query:e}),e.length&&$n(l)},[l,o]),p=Object(n.m)(()=>{if(t&&s){const e=b+1;i({chatId:t.id,messageId:s[s.length-1-e]}),h(e)}},[t,b,i,s]),v=Object(n.m)(()=>{if(t&&s){const e=b-1;i({chatId:t.id,messageId:s[s.length-1-e]}),h(e)}},[t,b,i,s]);return n.a.createElement("div",{id:"MobileSearch",className:e?"active":""},n.a.createElement("div",{className:"header"},n.a.createElement(D.a,{size:"smaller",round:!0,color:"translucent",onClick:d},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement(Hn.a,{ref:u,value:a,onChange:g})),n.a.createElement("div",{className:"footer"},n.a.createElement("div",{className:"counter"},a?s&&s.length?`${b+1} of ${c}`:s&&!s.length?"No results":"":n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>m({selectedAt:Object(B.k)(Date.now())}),ariaLabel:"Search messages by date"},n.a.createElement("i",{className:"icon-calendar"}))),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:p,disabled:!s||!s.length||b===s.length-1},n.a.createElement("i",{className:"icon-up"})),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:v,disabled:!s||!s.length||0===b},n.a.createElement("i",{className:"icon-down"}))))})),Wn=a(60),Kn=a(195),Yn=a(187),Qn=a(183),Jn=a(189);function Zn(e,t,a=0,n=!1,c=!1,s=!1){const r=e[s?"scrollLeft":"scrollTop"],o=r+e[s?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:i}=l,d=[];let m=!1;for(let e=0;e<i;e++){const t=l[e],i=t[s?"offsetLeft":"offsetTop"],u=i+t[s?"offsetWidth":"offsetHeight"];if(c?u>=r-a&&u<=o+a:i<=o+a&&u>=r-a)d.push(e),m=!0;else if(m&&!n)break}return{allElements:l,visibleIndexes:d}}var Xn=function(e,t,a=!1){const n=e[a?"scrollLeft":"scrollTop"],c=n+e[a?"offsetWidth":"offsetHeight"],s=t[a?"offsetLeft":"offsetTop"],r=s+t[a?"offsetWidth":"offsetHeight"];return s>n&&r<c},ec=a(129);function tc(e,t,a){const n=a.current;if(!n||t<0)return;const{visibleIndexes:c,allElements:s}=Zn(n,e,8,!0,!0);if(!s.length||!s[t])return;const r=c[0];if(!c.includes(t)||t===r&&!Xn(n,s[r])){const e=t>c[c.length-1]?"start":"end";Object(ec.a)(n,s[t],e,10)}}var ac=a(132);a(291);var nc=Object(n.h)(({isOpen:e,filter:t,onClose:a,onInsertUserName:c,usersById:s,filteredUsers:r})=>{const o=Object(n.q)(null),{shouldRender:l,transitionClassNames:i}=Object(Y.a)(e,void 0,void 0,!1),d=Object(n.m)(e=>{if(!r)return-1;const t=r.length;return Object(ac.a)(t,e)},[r]),[m,u]=Object(n.r)(-1),b=Object(n.m)((e,t)=>{t.preventDefault(),u(t=>d(t+e))},[u,d]),h=Object(n.m)((e,t=!1)=>{const a=s&&s[e];a&&c(a,t)},[s,c]),g=Object(n.m)(e=>{if(r&&r.length&&m>-1){const t=r[m];t&&(e.preventDefault(),h(t.id,!0))}},[r,m,h]);Object(n.n)(()=>e?Object(Ge.a)({onEsc:a,onUp:e=>b(-1,e),onDown:e=>b(1,e),onEnter:g,onTab:g}):void 0,[e,a,b,g]),Object(n.n)(()=>{r&&!r.length&&a()},[r,a]),Object(n.n)(()=>{u(0)},[t]),Object(n.n)(()=>{tc(".chat-item-clickable",m,o)},[m]);const p=Object(j.a)(r&&r.length?r:void 0,l),v=r&&!r.length?p:r;if(!l||v&&!v.length)return;const O=Object(W.a)("MentionTooltip composer-tooltip custom-scroll",i);return n.a.createElement("div",{className:O,ref:o},v&&v.map(({id:e},t)=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>h(e),focus:m===t},n.a.createElement(fe.a,{userId:e,avatarSize:"small",withUsername:!0}))))}),cc=a(188);a(292);var sc=Object(n.h)(({attachments:e,caption:t,groupChatMembers:a,currentUserId:c,usersById:s,recentEmojis:r,baseEmojiKeywords:l,emojiKeywords:i,onCaptionUpdate:d,addRecentEmoji:m,onSend:u,onFileAppend:b,onClear:h})=>{const p=Object(n.q)(null),v=Object(j.a)(e),O=e.length?e:v,E=Boolean(e.length),[f,C,y]=Object(Ue.a)(),k=Boolean(O&&O.every(e=>e.quick)),N=Object(F.a)(),{isMentionTooltipOpen:w,mentionFilter:S,closeMentionTooltip:I,insertMention:P,mentionFilteredUsers:M}=Object(Kn.a)(E,t,d,o.A,a,void 0,c,s),{isEmojiTooltipOpen:A,closeEmojiTooltip:L,filteredEmojis:R,insertEmoji:T}=Object(Yn.a)(E,t,r,o.A,d,l,i);Object(n.n)(()=>E?Object(g.a)(h):void 0,[E,h]);const B=Object(n.m)(()=>{E&&u()},[E,u]),x=Object(n.m)(e=>{e.preventDefault(),y();const{dataTransfer:{files:t}}=e;if(t&&t.length){const e=k?Array.from(t).filter(e=>e.type&&o.n.has(e.type)):Array.from(t);b(e,k)}},[k,b,y]);if(!O)return;const U=O.every(e=>e.mimeType.startsWith("image/")),G=O.every(e=>e.mimeType.startsWith("video/"));let q="";return q=N(U?"PreviewSender.SendPhoto":G?"PreviewSender.SendVideo":"PreviewSender.SendFile",O.length,"i"),n.a.createElement(pe.a,{isOpen:E,onClose:h,header:function(){if(O)return n.a.createElement("div",{className:"modal-header-condensed",dir:N.isRtl?"rtl":void 0},n.a.createElement(D.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:h},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("div",{className:"modal-title"},q),n.a.createElement(D.a,{color:"primary",size:"smaller",className:"modal-action-button",onClick:B},N("Send")))}(),className:"AttachmentModal "+(f?"hovered":"")},n.a.createElement("div",{className:"drop-target",onDragEnter:C,onDrop:x,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),p.current&&window.clearTimeout(p.current)},onDragLeave:e=>{const{relatedTarget:t,target:a}=e;a.matches(".drop-target")&&!t&&(p.current=window.setTimeout(y,150)),a&&a.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),y())},"data-attach-description":N("Preview.Dragging.AddItems",10)},k?n.a.createElement("div",{className:"media-wrapper custom-scroll"},O.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"},O.map(e=>n.a.createElement(Qn.a,{name:e.filename,extension:Object(Wn.d)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0}))),n.a.createElement("div",{className:"attachment-caption-wrapper"},n.a.createElement(nc,{isOpen:w,onClose:I,filter:S,onInsertUserName:P,filteredUsers:M,usersById:s}),n.a.createElement(cc.a,{isOpen:A,emojis:R,onClose:L,onEmojiSelect:T,addRecentEmoji:m}),n.a.createElement(Jn.a,{id:"caption-input-text",isAttachmentModalInput:!0,html:t,editableInputId:o.A,placeholder:N("Caption"),onUpdate:d,onSend:u,shouldSetFocus:E}))))}),rc=a(141);a(293);var oc=Object(n.h)(({isOpen:e,onSend:t,onClear:a})=>{const c=Object(n.q)(null),s=Object(n.q)(null),r=Object(n.q)(null),[o,l]=Object(n.r)(""),[i,d]=Object(n.r)([""]),[m,u]=Object(n.r)(!0),[b,h]=Object(n.r)(!1),[p,v]=Object(n.r)(!1),[O,E]=Object(n.r)(),[f,j]=Object(n.r)(),[C,y]=Object(n.r)(!1),k=Object(F.a)(),N=Object(n.m)(t=>{e&&t.current&&t.current.focus()},[e]);Object(n.n)(()=>e?Object(g.a)(a):void 0,[e,a]),Object(n.n)(()=>{e||(l(""),d([""]),u(!0),h(!1),v(!1),E(""),j(""),y(!1))},[e]),Object(n.n)(()=>N(c),[N,e]),Object(n.o)(()=>{const e=r.current;e&&O!==e.innerHTML&&(e.innerHTML=O)},[O]);const w=Object(n.m)((e=[])=>{d([...e,""]),requestAnimationFrame(()=>{const e=s.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))})},[]),S=Object(n.m)(()=>{if(y(!1),!e)return;const a=o.trim().substring(0,255),n=i.map(e=>e.trim().substring(0,100)).filter(e=>e.length);if(!a||n.length<2)return l(a),n.length?n.length<2?w(n):d(n):w(),void y(!0);if(p&&(!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}})),...!m&&{isPublic:!0},...b&&{multipleChoice:!0},...p&&{quiz:!0}}};if(p){const{text:e,entities:t}=O&&Object(rc.a)(O.substring(0,200))||{};c.quiz={correctAnswers:[f],...e&&{solution:e},...t&&{solutionEntities:t}}}t(c)},[e,o,i,p,f,m,b,t,w,O]),I=Object(n.m)((e,t)=>{const a=[...i];a[e]=t,a[a.length-1].trim().length&&a.length<10?w(a):d(a)},[i,w]),P=Object(n.m)(e=>{const t=[...i];t.splice(e,1),d(t),requestAnimationFrame(()=>{s.current&&s.current.classList.toggle("overflown",s.current.scrollHeight>320)})},[i]),M=Object(n.m)(e=>{j(e)},[j]),A=Object(n.m)(e=>{u(e.target.checked)},[]),L=Object(n.m)(e=>{h(e.target.checked)},[]),R=Object(n.m)(e=>{v(e.target.checked)},[]),T=Object(n.m)(e=>{13===e.keyCode&&S()},[S]),B=Object(n.m)(()=>{if(C&&!o.trim().length)return k("lng_polls_choose_question")},[C,k,o]),x=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 k("lng_polls_choose_answers")},[C,k,i]);function U(){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?k("OptionHint"):k("CreatePoll.AddOption"),error:x(t),value:e,onChange:e=>I(t,e.currentTarget.value),onKeyPress:T}),t!==i.length-1&&n.a.createElement(D.a,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:k("Delete"),onClick:()=>P(t)},n.a.createElement("i",{className:"icon-close"}))))}return n.a.createElement(pe.a,{isOpen:e,onClose:a,header:n.a.createElement("div",{className:"modal-header-condensed"},n.a.createElement(D.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"},k("NewPoll")),n.a.createElement(D.a,{color:"primary",size:"smaller",className:"modal-action-button",onClick:S},k("Create"))),className:"PollModal"},n.a.createElement(ve.a,{ref:c,label:k("AskAQuestion"),value:o,error:B(),onChange:e=>l(e.currentTarget.value),onKeyPress:T}),n.a.createElement("div",{className:"options-divider"}),n.a.createElement("div",{className:"options-list custom-scroll",ref:s},n.a.createElement("h3",{className:"options-header"},k("PollOptions")),C&&function(){const e=i.map(e=>e.trim()).filter(e=>e.length);return p&&(!f||!e[Number(f)])&&n.a.createElement("p",{className:"error"},k("lng_polls_choose_correct"))}(),p?n.a.createElement(ze.a,{name:"correctOption",options:U().map((e,t)=>({value:String(t),label:e,hidden:t===i.length-1})),onChange:M}):U()),n.a.createElement("div",{className:"options-divider"}),n.a.createElement("div",{className:"quiz-mode"},n.a.createElement(sa.a,{label:k("PollAnonymous"),checked:m,onChange:A}),n.a.createElement(sa.a,{label:k("PollMultiple"),checked:b,disabled:p,onChange:L}),n.a.createElement(sa.a,{label:k("PollQuiz"),checked:p,disabled:b,onChange:R}),p&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h3",{className:"options-header"},k("lng_polls_solution_title")),n.a.createElement("div",{ref:r,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>E(e.currentTarget.innerHTML)}),n.a.createElement("div",{className:"note"},k("CreatePoll.ExplanationInfo")))))});let lc;function ic(e,t,a=250,c=!1){const s=Object(n.q)(!1);Object(n.n)(()=>{lc&&(clearTimeout(lc),lc=void 0),!e||l.n||c||(lc=window.setTimeout(()=>{s.current||t()},2*a))},[c,e,a,t]);return[Object(n.m)(()=>{s.current=!0},[]),Object(n.m)(()=>{s.current=!1,lc&&(clearTimeout(lc),lc=void 0),lc=window.setTimeout(()=>{s.current||t()},a)},[a,t])]}var dc=a(66),mc=a(145);a(294);var uc=Object(n.h)(({emoji:e,focus:t,onClick:a})=>{const c=Object(n.m)(t=>{t.preventDefault(),a(e.native,e.id)},[e,a]);return n.a.createElement("div",{className:"EmojiButton "+(t?"focus":""),onMouseDown:c,title:`:${e.names[0]}:`},l.d?e.native:n.a.createElement("img",{src:`./img-apple-64/${e.image}.png`,alt:"",loading:"lazy"}))});var bc=Object(n.h)(({category:e,index:t,allEmojis:a,observeIntersection:c,shouldRender:s,onEmojiSelect:r})=>{const o=Object(n.q)(null);Object(ia.c)(o,c);const{transitionClassNames:d}=Object(Y.a)(s,void 0,void 0,"slow"),m=Object(F.a)(),u=l.l?Math.floor((i.a.get().width-8)/44):9,b=44*Math.ceil(e.emojis.length/u);return n.a.createElement("div",{ref:o,key:e.id,id:"emoji-category-"+t,className:"symbol-set"},n.a.createElement("p",{className:"symbol-set-name",dir:"auto"},m("recent"===e.id?"RecentStickers":"Emoji"+t)),n.a.createElement("div",{className:Object(W.a)("symbol-set-container",d),style:`height: ${b}px;`,dir:m.isRtl?"rtl":void 0},s&&e.emojis.map(e=>{const t=a[e],c="id"in t?t:t[1];return n.a.createElement(uc,{key:c.id,emoji:c,onClick:r})})))});a(295);const hc={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"},gc=[];let pc,vc,Oc;var Ec=Object(n.h)(Object(c.h)(e=>Object(b.l)(e,["recentEmojis"]))(({className:e,onEmojiSelect:t,recentEmojis:c})=>{const s=Object(n.q)(null),r=Object(n.q)(null),[i,d]=Object(n.r)(),[m,u]=Object(n.r)(),[b,h]=Object(n.r)(0),{observe:g}=Object(ia.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-",""));gc[a]=e.isIntersecting});const t=gc.map((e,t)=>({index:t,isIntersecting:e})).filter(({isIntersecting:e})=>e);t.length&&h(t[Math.floor(t.length/2)].index)});Object(Je.a)(r.current,!l.l),Object(n.n)(()=>{if(!i)return;const e=r.current;if(!e)return;const t=42*b-e.offsetWidth/2+21;Object(mc.a)(e,t)},[i,b]);const p=Object(F.a)(),v=Object(n.p)(()=>{if(!i)return Ve.a;const e=[...i];return c&&c.length&&e.unshift({id:"recent",name:p("RecentStickers"),emojis:c}),e},[i,p,c]);Object(n.n)(()=>{setTimeout(()=>{const e=()=>{d(Oc.categories),u(Oc.emojis)};Oc?e():async function(){pc||(pc=a.e(1).then(a.t.bind(null,324,3)),vc=(await pc).default,Oc=Object(dc.b)(vc));return pc}().then(e)},200)},[]);const O=Object(n.m)(e=>{h(e);const t=document.getElementById("emoji-category-"+e);Object(ec.a)(s.current,t,"start",50,800)},[]),E=Object(n.m)((e,a)=>{t(e,a)},[t]),f=Object(mt.a)([],o.bb);const j=Object(W.a)("EmojiPicker",e);return m&&f?n.a.createElement("div",{className:j},n.a.createElement("div",{ref:r,className:"EmojiPicker-header",dir:p.isRtl?"rtl":""},v.map((function(e,t){const a=hc[e.id];return a&&n.a.createElement(D.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:Object(W.a)("EmojiPicker-main no-selection",l.n?"no-scrollbar":"custom-scroll")},v.map((e,t)=>n.a.createElement(bc,{category:e,index:t,allEmojis:m,observeIntersection:g,shouldRender:b>=t-1&&b<=t+1,onEmojiSelect:E})))):n.a.createElement("div",{className:j},n.a.createElement(ge.a,null))}));const fc=l.l?8:16;var jc=Object(n.h)(({stickerSet:e,loadAndPlay:t,index:a,observeIntersection:c,shouldRender:s,onStickerSelect:r,onStickerUnfave:d})=>{const m=Object(n.q)(null);Object(ia.c)(m,c);const{transitionClassNames:u}=Object(Y.a)(s,void 0,void 0,"slow"),b=l.l?Math.floor((i.a.get().width-8)/(o.Ib+fc)):5,h=Math.ceil(e.count/b)*(o.Ib+fc);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(W.a)("symbol-set-container",u),style:`height: ${h}px;`},s&&e.stickers&&e.stickers.map(a=>n.a.createElement(ga,{key:a.id,sticker:a,size:o.Ib,observeIntersection:c,noAnimate:!t,onClick:r,clickArg:a,onUnfaveClick:"favorite"===e.id?d:void 0}))))});a(296);const Cc=[];var yc=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(b.l)(t,["loadStickerSets","loadRecentStickers","loadFavoriteStickers","loadAddedStickers","addRecentSticker","unfaveSticker"]))(({className:e,loadAndPlay:t,canSendStickers:a,recentStickers:c,favoriteStickers:s,addedSetIds:r,stickerSetsById:i,shouldPlay:d,onStickerSelect:m,loadStickerSets:u,loadRecentStickers:b,loadFavoriteStickers:h,loadAddedStickers:g,addRecentSticker:p,unfaveSticker:v})=>{const O=Object(n.q)(null),E=Object(n.q)(null),[f,j]=Object(n.r)(0),{observe:C}=Object(ia.a)({rootRef:O,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-",""));Cc[a]=e.isIntersecting});const t=Cc.map((e,t)=>({index:t,isIntersecting:e})).filter(({isIntersecting:e})=>e);t.length&&j(t[Math.floor(t.length/2)].index)}),{observe:y}=Object(ia.a)({rootRef:E}),k=Object(F.a)(),N=Boolean(r),w=Object(n.p)(()=>r?[{id:"recent",title:k("RecentStickers"),stickers:c,count:c.length},{id:"favorite",title:k("FavoriteStickers"),stickers:s,count:s.length},...r.map(e=>i[e]).filter(Boolean)]:Ve.a,[r,k,c,s,i]),S=Object(n.p)(()=>N&&0===w.filter(e=>e.stickers&&e.stickers.length).length,[w,N]);Object(n.n)(()=>{t&&(u(),b(),h())},[t,h,b,u]),Object(n.n)(()=>{r&&r.length&&g()},[r,g]),Object(Je.a)(E.current),Object(n.n)(()=>{if(!N)return;const e=E.current;if(!e)return;const t=52*f-(e.offsetWidth/2-26);Object(mc.a)(e,t)},[N,f]);const I=Object(n.m)(e=>{j(e);const t=document.getElementById("sticker-set-"+e);Object(ec.a)(O.current,t,"start",void 0,500)},[]),P=Object(n.m)(e=>{m(e),p({sticker:e})},[p,m]),M=Object(n.m)(e=>{v({sticker:e})},[v]),A=Object(mt.a)([],o.yb);const L=Object(W.a)("StickerPicker",e);return N&&A&&!S&&a?n.a.createElement("div",{className:L},n.a.createElement("div",{ref:E,className:"StickerPicker-header no-selection no-scrollbar"},w.map((function(e,t){const a=e.stickers&&e.stickers[0],c=Object(W.a)("symbol-set-button sticker-set-button",t===f&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!a?n.a.createElement(D.a,{key:e.id,className:c,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>I(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(ba,{stickerSet:e,observeIntersection:y}):n.a.createElement(ha,{stickerSet:e,observeIntersection:y})):n.a.createElement(ga,{key:e.id,sticker:a,size:o.Jb,title:e.title,className:c,observeIntersection:y,onClick:I,clickArg:t})}))),n.a.createElement("div",{ref:O,className:Object(W.a)("StickerPicker-main no-selection",l.n?"no-scrollbar":"custom-scroll")},w.map((e,a)=>n.a.createElement(jc,{key:e.id,stickerSet:e,loadAndPlay:Boolean(d&&t),index:a,observeIntersection:C,shouldRender:f>=a-1&&f<=a+1,onStickerSelect:P,onStickerUnfave:M})))):n.a.createElement("div",{className:L},a?S?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(297);function kc(){return(kc=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 Nc=Object(n.h)(({gif:e,observeIntersection:t,isDisabled:a,className:c,onClick:r})=>{const o=Object(n.q)(null),l=Object(n.q)(null),i=e.thumbnail&&!!e.thumbnail.dataUri,d="gif"+e.id,m=Object(ia.b)(o,t)&&!a,u=Object(O.a)(d+"?size=m",!m,s.ApiMediaFormat.BlobUrl),b=Object(Pa.a)(e.thumbnail&&e.thumbnail.dataUri,Boolean(u)),h=Object(O.a)(d,!m,s.ApiMediaFormat.BlobUrl),g=Boolean(m&&h),{transitionClassNames:p}=Object(ma.a)(i||u||h,"slow"),{isBuffered:v,bufferingHandlers:E}=Object(Q.a)(!0),f=m&&!v;Object(Z.a)(l,[g]);const j=Object(n.m)(()=>r({...e,blobUrl:h}),[r,e,h]),C=Object(W.a)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",p,d,c);return n.a.createElement("div",{ref:o,className:C,onClick:j},i&&n.a.createElement("canvas",{ref:b,className:"thumbnail"}),!i&&u&&n.a.createElement("img",{src:u,alt:"",className:"thumbnail"}),(g||u)&&n.a.createElement("video",kc({ref:l,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},E),n.a.createElement("source",{src:h})),f&&n.a.createElement(L.a,{color:u||i?"white":"black"}))});a(298);var wc=Object(n.h)(Object(c.h)(e=>({savedGifs:e.gifs.saved.gifs}),(e,t)=>Object(b.l)(t,["loadSavedGifs"]))(({className:e,loadAndPlay:t,canSendGifs:a,savedGifs:c,onGifSelect:s,loadSavedGifs:r})=>{const i=Object(n.q)(null),{observe:d}=Object(ia.a)({rootRef:i,debounceMs:300});Object(n.n)(()=>{t&&r()},[t,r]);const m=Object(mt.a)([],o.yb);return n.a.createElement("div",{ref:i,className:Object(W.a)("GifPicker",e,l.n?"no-scrollbar":"custom-scroll")},a?m&&c&&c.length?c.map(e=>n.a.createElement(Nc,{key:e.id,gif:e,observeIntersection:d,isDisabled:!t,onClick:s})):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 Sc;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(Sc||(Sc={}));const Ic=Object.values(Sc).filter(e=>"string"==typeof e),Pc={[Sc.Emoji]:"icon-smile",[Sc.Stickers]:"icon-stickers",[Sc.GIFs]:"icon-gifs"};var Mc=Object(n.h)(({activeTab:e,onSwitchTab:t,onRemoveSymbol:a,onSearchOpen:c})=>{const s=Object(F.a)();function r(a){return n.a.createElement(D.a,{className:"symbol-tab-button "+(e===a?"activated":""),onClick:()=>t(a),ariaLabel:Ic[a],round:!0,faded:!0,color:"translucent"},n.a.createElement("i",{className:Pc[a]}))}const o=Object(n.m)(()=>{c(e===Sc.Stickers?"stickers":"gifs")},[e,c]);return n.a.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:s.isRtl?"rtl":void 0},e!==Sc.Emoji&&n.a.createElement(D.a,{className:"symbol-search-button",ariaLabel:e===Sc.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:o},n.a.createElement("i",{className:"icon-search"})),r(Sc.Emoji),r(Sc.Stickers),r(Sc.GIFs),e===Sc.Emoji&&n.a.createElement(D.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(299);let Fc=!1;var Ac=Object(n.h)(Object(c.h)(e=>({isLeftColumnShown:e.isLeftColumnShown}))(({isOpen:e,allowedAttachmentOptions:t,isLeftColumnShown:a,onLoad:c,onClose:s,onEmojiSelect:r,onStickerSelect:o,onGifSelect:i,onRemoveSymbol:d,onSearchOpen:m,addRecentEmoji:u})=>{const[b,h]=Object(n.r)(0),[g,p]=Object(n.r)([]),[v,O]=ic(e,s,void 0,l.l),{shouldRender:E,transitionClassNames:f}=Object(Y.a)(e,s,!1,!1);!Fc&&e&&(Fc=!0),Object(n.n)(()=>{c()},[c]),Object(n.o)(()=>{if(l.l)return e&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{e&&Object(V.b)(()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout(()=>{document.body.classList.remove("enable-symbol-menu-transforms")},350)})}},[e]);const j=Object(n.q)(g);j.current=g,Object(n.n)(()=>{j.current.length&&(j.current.forEach(e=>{u({emoji:e})}),p([]))},[e,b,u]);const C=Object(n.m)((e,t)=>{p(e=>[...e,t]),r(e)},[r]),y=Object(n.m)(e=>{s(),m(e)},[s,m]),k=Object(n.m)(e=>{o(e,!0)},[o]),N=Object(F.a)(),{canSendStickers:w,canSendGifs:S}=t;function I(t,a){switch(b){case Sc.Emoji:return n.a.createElement(Ec,{className:"picker-tab",onEmojiSelect:C});case Sc.Stickers:return n.a.createElement(yc,{className:"picker-tab",loadAndPlay:!!w&&(e&&(t||a)),canSendStickers:w,onStickerSelect:k});case Sc.GIFs:return n.a.createElement(wc,{className:"picker-tab",loadAndPlay:!!S&&(e&&(t||a)),canSendGifs:S,onGifSelect:i})}}const P=n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},Fc&&n.a.createElement(T.a,{name:"slide",activeKey:b,renderCount:Ic.length},I)),l.l&&n.a.createElement(D.a,{round:!0,faded:!0,color:"translucent",ariaLabel:N("Close"),className:"symbol-close-button",size:"tiny",onClick:s},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(Mc,{activeTab:b,onSwitchTab:h,onRemoveSymbol:d,onSearchOpen:y}));if(l.l){if(!E)return;const e=Object(W.a)("SymbolMenu mobile-menu",f,!a&&"middle-column-open");return n.a.createElement(zn.a,null,n.a.createElement("div",{className:e},P))}return n.a.createElement(xn.a,{isOpen:e,positionX:"left",positionY:"bottom",onClose:s,className:"SymbolMenu",onCloseAnimationEnd:s,onMouseEnter:l.n?void 0:v,onMouseLeave:l.n?void 0:O,noCloseOnBackdrop:!l.n},P)}));a(300);var Lc=Object(n.h)(({isOpen:e,allowedAttachmentOptions:t,onFileSelect:a,onPollCreate:c,onClose:s})=>{const[r,i]=ic(e,s),d=Object(n.m)((e,t)=>{const{files:n}=e.target;n&&n.length>0&&a(Array.from(n),t)},[a]),m=Object(n.m)(()=>{ja(Array.from(o.n).join(","),e=>d(e,!0))},[d]),u=Object(n.m)(()=>{ja("*",e=>d(e,!1))},[d]),b=Object(F.a)(),{canAttachMedia:h,canAttachPolls:g}=t;return n.a.createElement(xn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:s,className:"AttachMenu fluid",onCloseAnimationEnd:s,onMouseEnter:l.n?void 0:r,onMouseLeave:l.n?void 0:i,noCloseOnBackdrop:!l.n},!h&&n.a.createElement(_.a,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),h&&n.a.createElement(n.a.Fragment,null,n.a.createElement(_.a,{icon:"photo",onClick:m},b("AttachmentMenu.PhotoOrVideo")),n.a.createElement(_.a,{icon:"document",onClick:u},b("AttachDocument"))),g&&n.a.createElement(_.a,{icon:"poll",onClick:c},b("Poll")))});a(301);var Rc=Object(n.h)(Object(c.h)(e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}},(e,t)=>Object(b.l)(t,["clearStickersForEmoji"]))(({isOpen:e,onStickerSelect:t,stickers:a,clearStickersForEmoji:c})=>{const s=Object(n.q)(null),{shouldRender:r,transitionClassNames:i}=Object(Y.a)(e,void 0,void 0,!1),d=Object(j.a)(a,!0),m=a||d,{observe:u}=Object(ia.a)({rootRef:s,throttleMs:200});Object(n.n)(()=>e?Object(g.a)(c):void 0,[e,c]);const b=Object(W.a)("StickerTooltip composer-tooltip custom-scroll",i,!(m&&m.length)&&"hidden");return n.a.createElement("div",{ref:s,className:b,onMouseEnter:l.n?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:l.n?void 0:()=>{document.body.classList.remove("no-select")}},r&&m?m.map(e=>n.a.createElement(ga,{key:e.id,sticker:e,size:o.Ib,observeIntersection:u,onClick:t,clickArg:e})):r?n.a.createElement(ge.a,null):void 0)}));a(302);var Tc=Object(n.h)(Object(c.h)((e,{messageId:t})=>{const{chatId:a}=Object(m.z)(e)||{};return a?{message:Object(m.l)(e,a,t)}:{}},(e,t)=>Object(b.l)(t,["clickInlineButton"]))(({isOpen:e,message:t,onClose:a,clickInlineButton:c})=>{const[s,r]=ic(e,a);if(t&&t.keyboardButtons)return n.a.createElement(xn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:a,className:"KeyboardMenu",onCloseAnimationEnd:a,onMouseEnter:l.n?void 0:s,onMouseLeave:l.n?void 0:r,noCloseOnBackdrop:!l.n},n.a.createElement("div",{className:"content"},t.keyboardButtons.map(e=>n.a.createElement("div",{className:"row"},e.map(e=>n.a.createElement(D.a,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>c({button:e})},e.text))))))}));a(303);var Dc=Object(n.h)(({isOpen:e,onSilentSend:t,onScheduleSend:a,onClose:c,onCloseAnimationEnd:s})=>{const[r,o]=ic(e,c),i=Object(F.a)();return n.a.createElement(xn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",className:"CustomSendMenu",onClose:c,onCloseAnimationEnd:s,onMouseEnter:l.n?void 0:r,onMouseLeave:l.n?void 0:o,noCloseOnBackdrop:!l.n},t&&n.a.createElement(_.a,{icon:"mute",onClick:t},i("SendWithoutSound")),a&&n.a.createElement(_.a,{icon:"schedule",onClick:a},i("ScheduleMessage")))}),Bc=a(142),xc=a(168),Uc=a(179);a(304);var Gc=Object(n.h)(({isOpen:e,emojis:t,onClose:a,onEmojiSelect:c,addRecentEmoji:s})=>{const r=Object(n.q)(null),{shouldRender:o,transitionClassNames:i}=Object(Y.a)(e,void 0,void 0,!1),d=Object(Uc.a)(t.length?t:void 0,350)||[],[m,u]=Object(n.r)(-1);Object(n.n)(()=>{u(0)},[t]),Object(n.n)(()=>{!function(e,t){const a=t.current;if(!a)return;const{visibleIndexes:n,allElements:c}=Zn(a,".EmojiButton",8,!0,!0,!0);if(!c.length||!c[e])return;const s=n[0];if(!n.includes(e)||e===s&&!Xn(a,c[s],!0)){const t="start"===(e>n[n.length-1]?"start":"end")?44*e:0;Object(mc.a)(a,t)}}(m,r)},[m]);const b=Object(n.m)(e=>{if(!t.length)return-1;const a=t.length;return Object(ac.a)(a,e)},[t]),h=Object(n.m)((e,t)=>{t.preventDefault(),u(t=>b(t+e))},[u,b]),g=Object(n.m)(e=>{if(t.length&&m>-1){const a=t[m];a&&(e.preventDefault(),c(a.native),s({emoji:a.id}))}},[s,t,c,m]),p=Object(n.m)((e,t)=>{c(e),s({emoji:t})},[s,c]);Object(n.n)(()=>e?Object(Ge.a)({onEsc:a,onLeft:e=>h(-1,e),onRight:e=>h(1,e),onEnter:g}):void 0,[h,g,e,a]);const v=Object(W.a)("EmojiTooltip composer-tooltip custom-scroll-x",i);return n.a.createElement("div",{ref:r,className:v,onMouseEnter:l.n?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:l.n?void 0:()=>{document.body.classList.remove("no-select")}},o&&d?d.map((e,t)=>n.a.createElement(uc,{key:e.id,emoji:e,focus:m===t,onClick:p})):o?n.a.createElement(ge.a,null):void 0)});a(305);var qc=Object(n.h)(({title:e,description:t,thumbnail:a,thumbUrl:c,focus:s,transitionClassNames:r="",onClick:o})=>{let l="";const i=Object(O.a)(a?"webDocument:"+a.url:void 0);return(c=c||i)?l=n.a.createElement("img",{src:c,className:r,alt:"",decoding:"async",draggable:"false"}):e&&(l=Object(ua.c)(e,1)),n.a.createElement(Ee.a,{focus:s,className:"BaseResult chat-item-clickable",onClick:o},n.a.createElement("span",{className:"thumb"},"string"==typeof l?Object(x.a)(l):l),n.a.createElement("div",{className:"content-inner"},e&&n.a.createElement("div",{className:"title"},e),t&&n.a.createElement("div",{className:"description"},t)))});a(306);var zc=Object(n.h)(({focus:e,isForGallery:t,inlineResult:a,onClick:c})=>{let s,r,o;"photo"in a&&(s=a.photo),"thumbnail"in a&&(r=a.thumbnail),"webThumbnail"in a&&t&&(o=a.webThumbnail);const l=Object(O.a)(o?"webDocument:"+o.url:void 0),i=Object(O.a)(s&&`photo${s.id}?size=m`),{shouldRenderThumb:d,shouldRenderFullMedia:m,transitionClassNames:u}=Object(ma.a)(i,"slow"),b=Object(n.m)(()=>{c(a)},[a,c]);if(t)return n.a.createElement("div",{className:"MediaResult chat-item-clickable",onClick:b},d&&n.a.createElement("img",{src:s&&s.thumbnail&&s.thumbnail.dataUri||l,alt:""}),m&&n.a.createElement("img",{src:i,className:u+" full-media",alt:""}));const{title:h,description:g}=a;return n.a.createElement(qc,{focus:e,thumbUrl:m?i:r&&r.dataUri||l,transitionClassNames:m?u:void 0,title:h,description:g,onClick:b})});var _c=Object(n.h)(({focus:e,inlineResult:t,onClick:a})=>{const{title:c,url:s,description:r,webThumbnail:o}=t,l=Object(n.m)(()=>{a(t)},[t,a]);return n.a.createElement(qc,{focus:e,thumbnail:o,title:c||s,description:r,onClick:l})});var Hc=Object(n.h)(({inlineResult:e,observeIntersection:t,onClick:a})=>{const{gif:c}=e,s=Object(n.m)(()=>{a(e)},[e,a]);if(c)return n.a.createElement(Nc,{gif:c,observeIntersection:t,className:"chat-item-clickable",onClick:s})});var $c=Object(n.h)(({inlineResult:e,observeIntersection:t,onClick:a})=>{const{sticker:c}=e;if(c)return n.a.createElement(ga,{sticker:c,size:o.Eb,observeIntersection:t,title:c.emoji,className:"chat-item-clickable",onClick:a,clickArg:e})});a(307);const Vc=Object(V.h)(e=>e(),500,!0);var Wc=Object(n.h)(Object(c.h)(void 0,(e,t)=>Object(b.l)(t,["sendBotCommand","openChat","sendInlineBotResult"]))(({isOpen:e,botId:t,isGallery:a,inlineBotResults:c,switchPm:s,loadMore:o,onClose:i,openChat:d,sendBotCommand:m,onSelectResult:u})=>{const b=Object(n.q)(null),{shouldRender:h,transitionClassNames:g}=Object(Y.a)(e,void 0,void 0,!1),[p,v]=Object(n.r)(-1),{observe:O}=Object(ia.a)({rootRef:b,debounceMs:200,isDisabled:!e});Object(n.n)(()=>{v(a?-1:0)},[c,a]),Object(n.n)(()=>{tc(".chat-item-clickable",p,b)},[p]);const E=Object(n.m)(e=>c&&c.length?Object(ac.a)(c.length,e):-1,[c]),f=Object(n.m)((e,t)=>{a||(t.preventDefault(),v(t=>E(t+e)))},[a,E]),C=Object(n.m)(e=>{if(c&&c.length&&p>-1){const t=c[p];t&&(e.preventDefault(),u(t))}},[c,u,p]),y=Object(n.m)(({direction:e})=>{e===r.e.Backwards&&Vc(o)},[o]);Object(n.n)(()=>e?Object(Ge.a)({onEsc:i,onUp:e=>f(-1,e),onDown:e=>f(1,e),onEnter:C}):void 0,[f,C,a,e,i]);const k=Object(n.m)(()=>{d({id:t}),m({chatId:t,command:"/start "+s.startParam})},[t,d,m,s]),N=Object(j.a)(c&&c.length?c:void 0,h),w=c&&!c.length?N:c;if(!h||!w||!w.length&&!s)return;const S=Object(W.a)("InlineBotTooltip composer-tooltip",l.n?"no-scrollbar":"custom-scroll",a&&"gallery",g);return n.a.createElement(Oe.a,{ref:b,className:S,items:w,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:y,sensitiveArea:160},s&&n.a.createElement(Ee.a,{ripple:!0,className:"switch-pm scroll-item",onClick:k},n.a.createElement("span",{className:"title"},s.text)),w.map((e,t)=>{switch(e.type){case"gif":return n.a.createElement(Hc,{key:e.id,inlineResult:e,observeIntersection:O,onClick:u});case"photo":return n.a.createElement(zc,{key:e.id,isForGallery:a,inlineResult:e,onClick:u});case"sticker":return n.a.createElement($c,{key:e.id,inlineResult:e,observeIntersection:O,onClick:u});case"video":case"game":return n.a.createElement(zc,{key:e.id,focus:p===t,inlineResult:e,onClick:u});case"article":case"audio":return n.a.createElement(_c,{key:e.id,focus:p===t,inlineResult:e,onClick:u});default:return}}))})),Kc=a(176);a(308);var Yc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),n=a&&Object(m.n)(e,a.id);if(!a||!n)return{};const{query:c,results:s}=Object(m.B)(e)||{},{totalCount:r,foundIds:o}=s||{};return{chat:a,messagesById:n,query:c,totalCount:r,foundIds:o}},(e,t)=>Object(b.l)(t,["searchTextMessagesLocal","focusMessage"]))(({chatId:e,threadId:t,onClose:a,isActive:s,chat:r,messagesById:o,query:l,totalCount:i,foundIds:d,searchTextMessagesLocal:h,focusMessage:g})=>{const p=Object(F.a)(),v=Object(n.p)(()=>{if(!(l&&d&&d.length&&o))return Ve.a;const a=d.map(a=>{const n=o[a];if(!n)return;const s=n.senderId?Object(m.Jb)(Object(c.e)(),n.senderId):void 0;let l;if(r&&Object(u.mb)(r))l=r;else if(n.forwardInfo){const{isChannelPost:e,fromChatId:t}=n.forwardInfo;l=e&&t?Object(m.g)(Object(c.e)(),t):void 0}else l=n.senderId?Object(m.g)(Object(c.e)(),n.senderId):void 0;return{message:n,senderUser:s,senderChat:l,onClick:()=>g({chatId:e,threadId:t,messageId:a})}}).filter(Boolean);return Object(b.k)(a,({message:e})=>e.date,"desc")},[e,t,g,d,r,o,l]);Object(A.a)(s,a);const O=Object(n.q)(null),E=Object(he.a)(O,!0,e=>{const t=v&&v[-1===e?0:e];t&&t.onClick()},".ListItem-button",!0);return n.a.createElement(Oe.a,{className:"RightSearch custom-scroll",items:v,preloadBackwards:0,onLoadMore:h,noFastList:!0,onKeyDown:E,ref:O},n.a.createElement("p",{className:"helper-text",dir:"auto"},l?0!==i&&v.length?1===i?"1 message found":(v.length&&(i||v.length))+" messages found":p("lng_search_no_results"):p("lng_dlg_search_for_messages")),v.map(({message:e,senderUser:t,senderChat:a,onClick:c})=>{const s=a?Object(u.k)(p,a):Object(u.bb)(t),r=Object(u.O)(p,e);return n.a.createElement(Ee.a,{className:"chat-item-clickable search-result-message m-0",onClick:c},n.a.createElement(U.a,{chat:a,user:t}),n.a.createElement("div",{className:"info"},n.a.createElement("div",{className:"title"},n.a.createElement("h3",{dir:"auto"},s&&Object(x.a)(s)),n.a.createElement(Kc.a,{message:e})),n.a.createElement("div",{className:"subtitle",dir:"auto"},Object(x.a)(r,["emoji","highlight"],{highlight:l}))))}))})),Qc=a(52);var Jc=Object(n.h)(Object(c.h)((e,{stickerSetId:t})=>({set:Object(m.zb)(e,t),shouldPlay:Object(m.yb)(e)}),(e,t)=>Object(b.l)(t,["loadStickers","toggleStickerSet"]))(({stickerSetId:e,observeIntersection:t,set:a,shouldPlay:c,loadStickers:s,toggleStickerSet:r,isSomeModalOpen:l,onModalToggle:i})=>{const d=Object(F.a)(),m=a&&Boolean(a.installedDate),u=Boolean(a&&a.stickers),[b,h,g]=Object(Ue.a)();Object(Qc.a)(()=>{i(b)},[b,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)(()=>{!u&&p.length<5&&s({stickerSetId:e})},[u,p.length,s,e]);const v=Object(n.m)(()=>{r({stickerSetId:e})},[r,e]);if(!a)return;const O=p.length>0;return n.a.createElement("div",{key:a.id,className:"sticker-set",dir:d.isRtl?"rtl":void 0},n.a.createElement("div",{className:"sticker-set-header"},n.a.createElement("div",{className:"title-wrapper"},n.a.createElement("h3",{className:"title",dir:"auto"},a.title),n.a.createElement("p",{className:"count",dir:"auto"},d("Stickers",a.count,"i"))),n.a.createElement(D.a,{className:m?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:v},d(m?"Stickers.Installed":"Stickers.Install"))),n.a.createElement("div",{className:"sticker-set-main"},!O&&n.a.createElement(L.a,null),O&&p.map(e=>n.a.createElement(ga,{sticker:e,size:o.Kb,observeIntersection:t,noAnimate:!c||b||l,onClick:h}))),O&&n.a.createElement(va.a,{isOpen:b,fromSticker:p[0],onClose:g}))}));a(309);const Zc=Object(V.h)(e=>e(),6e4,!0);var Xc=Object(n.h)(Object(c.h)(e=>{const t=Object(m.A)(e),{query:a,resultIds:n}=t||{},{featured:c}=e.stickers;return{query:a,featuredIds:c.setIds,resultIds:n}},(e,t)=>Object(b.l)(t,["loadFeaturedStickers"]))(({onClose:e,isActive:t,query:a,featuredIds:c,resultIds:s,loadFeaturedStickers:r})=>{const o=Object(n.q)(null),l=Object(F.a)(),[i,d]=Object(n.r)(!1),{observe:m}=Object(ia.a)({rootRef:o,throttleMs:200});return Object(n.n)(()=>{Zc(()=>{r()})}),Object(A.a)(t,e),n.a.createElement("div",{ref:o,className:"StickerSearch custom-scroll",dir:l.isRtl?"rtl":void 0},function(){if(void 0!==a)return!a&&c?c.map(e=>n.a.createElement(Jc,{key:e,stickerSetId:e,observeIntersection:m,isSomeModalOpen:i,onModalToggle:d})):s?s.length?s.map(e=>n.a.createElement(Jc,{key:e,stickerSetId:e,observeIntersection:m,isSomeModalOpen:i,onModalToggle:d})):n.a.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):n.a.createElement(ge.a,null)}())}));a(310);var es=Object(n.h)(Object(c.h)(e=>{const t=Object(m.t)(e),{query:a,results:n}=t||{},{chatId:c}=Object(m.z)(e)||{},s=c?Object(m.g)(e,c):void 0;return{query:a,results:n,chat:s,isChatWithBot:s?Object(m.O)(e,s):void 0}},(e,t)=>Object(b.l)(t,["searchMoreGifs","sendMessage","setGifSearchQuery"]))(({onClose:e,isActive:t,query:a,results:c,chat:s,isChatWithBot:r,searchMoreGifs:o,sendMessage:i,setGifSearchQuery:d})=>{const m=Object(n.q)(null),{observe:b}=Object(ia.a)({rootRef:m,debounceMs:300}),{canSendGifs:h}=Object(u.b)(s,r),g=Object(n.m)(e=>{h&&i({gif:e}),l.n&&d({query:void 0})},[h,i,d]),p=Object(F.a)();Object(A.a)(t,e);const v=Boolean(void 0!==a&&c&&c.length);return n.a.createElement("div",{className:"GifSearch",dir:p.isRtl?"rtl":void 0},n.a.createElement(Oe.a,{ref:m,className:Object(W.a)("gif-container custom-scroll",v&&"grid"),items:c,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:o},function(){if(void 0!==a)return c?c.length?c.map(e=>n.a.createElement(Nc,{key:e.id,gif:e,observeIntersection:b,onClick:g})):n.a.createElement("p",{className:"helper-text",dir:"auto"},p("NoGIFsFound")):n.a.createElement(ge.a,null)}()))}));a(311);var ts=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(b.l)(t,["loadPollOptionResults","openChat","closePollResults"]))(({chat:e,message:t,answer:a,answerVote:c,totalVoters:s,voters:r,offset:o,loadPollOptionResults:l,openChat:i,closePollResults:d})=>{const m=Object(j.a)(c.votersCount),[u,b]=Object(n.r)(!0),h=Boolean(r),{option:g,text:p}=a,v=Object(F.a)();Object(n.n)(()=>{h&&m===c.votersCount||l({chat:e,messageId:t.id,option:g,offset:o,limit:4,shouldResetVoters:!0})},[c.votersCount,h]);const O=Object(n.m)(()=>{b(!0),l({chat:e,messageId:t.id,option:g,offset:o,limit:50})},[e,l,t.id,o,g]);Object(n.n)(()=>{b(!1)},[r]);const E=Object(n.m)(e=>{i({id:e}),d()},[d,i]);return n.a.createElement("div",{className:"PollAnswerResults"},n.a.createElement("div",{className:"poll-voters"},r?r.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable",onClick:()=>E(e)},n.a.createElement(fe.a,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}))):n.a.createElement(ge.a,null),r&&function(){const e=c.votersCount-r.length;return c.votersCount>4&&e>0&&n.a.createElement(ta,{count:e,itemName:"voter",isLoading:u,onClick:O})}()),n.a.createElement("div",{className:"answer-head",dir:v.isRtl?"rtl":void 0},n.a.createElement("span",{className:"answer-title",dir:"auto"},p),n.a.createElement("span",{className:"answer-percent",dir:v.isRtl?"auto":void 0},(f=c.votersCount,(C=s)>0?(f/C*100).toFixed():0),"%")));var f,C}));a(312);var as=Object(n.h)(Object(c.h)(e=>{const{pollResults:{chatId:t,messageId:a},lastSyncTime:n}=e;if(!t||!a)return{};return{chat:Object(m.g)(e,t),message:Object(m.l)(e,t,a),lastSyncTime:n}})(({onClose:e,isActive:t,chat:a,message:c,lastSyncTime:s})=>{const r=Object(F.a)();if(Object(A.a)(t,e),!c||!a)return n.a.createElement(ge.a,null);const{summary:o,results:l}=Object(u.I)(c);if(!l.results)return;const i=Object(b.c)(l.results,"option");return n.a.createElement("div",{className:"PollResults",dir:r.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"poll-question",dir:"auto"},o.question),n.a.createElement("div",{className:"poll-results-list custom-scroll"},s&&o.answers.map(e=>n.a.createElement(ts,{key:`${c.id}-${e.option}`,chat:a,message:c,answer:e,answerVote:i[e.option],totalVoters:l.totalVoters})),!s&&n.a.createElement(ge.a,null)))}));a(171);var ns=Object(n.h)(Object(c.h)((e,{userId:t})=>{const a=Object(m.Jb)(e,t),n=Object(m.g)(e,t),{progress:c}=e.management;return{user:a,chat:n,progress:c,isMuted:Object(u.Hb)(n,Object(m.fb)(e),Object(m.eb)(e))}},(e,t)=>Object(b.l)(t,["updateContact","deleteUser","closeManagement","openChat","deleteHistory"]))(({userId:e,user:t,chat:a,progress:c,isMuted:s,updateContact:o,deleteUser:l,deleteHistory:i,closeManagement:d,openChat:m,onClose:u,isActive:b})=>{const[h,g,p]=Object(Ue.a)(),[v,O]=Object(n.r)(!1),[E,f]=Object(n.r)(),j=Object(F.a)();Object(A.a)(b,u);const C=t&&t.firstName||"",y=t&&t.lastName||"",[k,N]=Object(n.r)(C),[w,S]=Object(n.r)(y),[I,P]=Object(n.r)(!s);Object(n.n)(()=>{P(!s)},[s]),Object(n.n)(()=>{O(!1),p()},[p,e]),Object(n.n)(()=>{N(C),S(y)},[C,y,t]),Object(n.n)(()=>{c===r.f.Complete&&(O(!1),f(void 0),p())},[p,c]);const M=Object(n.m)(e=>{N(e.target.value),O(!0)},[]),R=Object(n.m)(e=>{S(e.target.value),O(!0)},[]),T=Object(n.m)(e=>{P(e.target.checked),O(!0)},[]),D=Object(n.m)(()=>{const t=k.trim(),a=w.trim();t.length||f("Please provide first name"),o({userId:e,isMuted:!I,firstName:t,lastName:a})},[k,w,o,e,I]),B=Object(n.m)(()=>{i({chatId:a.id,shouldDeleteForAll:!1}),l({userId:e}),p(),d(),m({id:void 0})},[a.id,p,d,i,l,m,e]);if(!t)return;const x=c===r.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(fe.a,{userId:t.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),n.a.createElement(ve.a,{id:"user-first-name",label:j("UserInfo.FirstNamePlaceholder"),onChange:M,value:k,error:"Please provide first name"===E?E:void 0}),n.a.createElement(ve.a,{id:"user-last-name",label:j("UserInfo.LastNamePlaceholder"),onChange:R,value:w}),n.a.createElement("div",{className:"ListItem no-selection narrow"},n.a.createElement(sa.a,{checked:I,label:j("Notifications"),subLabel:j(I?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:T}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:g},j("DeleteContact")))),n.a.createElement(Ht.a,{isShown:v,onClick:D,disabled:x,ariaLabel:j("Save")},x?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:h,onClose:p,text:j("AreYouSureDeleteContact"),confirmLabel:j("DeleteContact"),confirmHandler:B,confirmIsDestructive:!0}))}));var cs=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{progress:n}=e.management,c=Boolean(a.fullInfo&&a.fullInfo.linkedChatId),s=Object(u.lb)(a);return{chat:a,progress:n,isBasicGroup:s,hasLinkedChannel:c,canChangeInfo:s?a.isCreator:Object(u.p)(a,"changeInfo"),canBanUsers:s?a.isCreator:Object(u.p)(a,"banUsers")}},(e,t)=>Object(b.l)(t,["togglePreHistoryHidden","updateChat","closeManagement","leaveChannel","deleteChannel","deleteChat","openChat"]))(({chatId:e,chat:t,progress:a,isBasicGroup:c,hasLinkedChannel:o,canChangeInfo:l,canBanUsers:i,onScreenSelect:d,togglePreHistoryHidden:m,updateChat:b,deleteChat:h,leaveChannel:g,deleteChannel:p,closeManagement:v,openChat:E,onClose:f,isActive:j})=>{const[C,y,k]=Object(Ue.a)(),N=t.title,w=t.fullInfo&&t.fullInfo.about||"",[S,I]=Object(n.r)(!1),[P,M]=Object(n.r)(N),[R,T]=Object(n.r)(w),[D,B]=Object(n.r)(),[U,G]=Object(n.r)(),q=Object(u.e)(t),z=Object(O.a)(q,!1,s.ApiMediaFormat.BlobUrl),_=Object(F.a)();Object(A.a)(j,f),Object(n.n)(()=>{a===r.f.Complete&&(I(!1),G(void 0))},[a]);const H=Object(n.m)(()=>{d(r.g.ChatPrivacyType)},[d]),$=Object(n.m)(()=>{d(r.g.Discussion)},[d]),V=Object(n.m)(()=>{d(r.g.GroupPermissions)},[d]),W=Object(n.m)(()=>{d(r.g.ChatAdministrators)},[d]),K=Object(n.m)(e=>{B(e),I(!0)},[]),Y=Object(n.m)(e=>{M(e.target.value),I(!0)},[]),Q=Object(n.m)(e=>{T(e.target.value),I(!0)},[]),J=Object(n.m)(()=>{const t=P.trim(),a=R.trim();t.length?b({chatId:e,title:t,about:a,photo:D}):G("Group title can't be empty")},[R,e,D,P,b]),Z=Object(n.m)(()=>{d(r.g.GroupMembers)},[d]),X=Object(n.m)(()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;m({chatId:t.id,isEnabled:!e})},[t,m]),ee=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]),te=t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,ae=Object(n.m)(()=>{c?h({chatId:t.id}):t.isCreator?p({chatId:t.id}):g({chatId:t.id}),k(),v(),E({id:void 0})},[c,t.isCreator,t.id,k,v,g,p,h,E]);if(t.isRestricted)return;const ne=a===r.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(_t.a,{currentAvatarBlobUrl:z,onChange:K,disabled:!l}),n.a.createElement(ve.a,{id:"group-title",label:_("GroupName"),onChange:Y,value:P,error:"Group title can't be empty"===U?U:void 0,disabled:!l}),n.a.createElement(ve.a,{id:"group-about",className:"mb-2",label:_("DescriptionPlaceholder"),onChange:Q,value:R,disabled:!l}),t.isCreator&&n.a.createElement(Ee.a,{icon:"lock",multiline:!0,onClick:H},n.a.createElement("span",{className:"title"},_("GroupType")),n.a.createElement("span",{className:"subtitle"},t.username?_("TypePublic"):_("TypePrivate"))),o&&n.a.createElement(Ee.a,{icon:"message",multiline:!0,onClick:$},n.a.createElement("span",{className:"title"},_("LinkedChannel")),n.a.createElement("span",{className:"subtitle"},_("DiscussionUnlink"))),n.a.createElement(Ee.a,{icon:"permissions",multiline:!0,onClick:V,disabled:!i},n.a.createElement("span",{className:"title"},_("ChannelPermissions")),n.a.createElement("span",{className:"subtitle",dir:"auto"},ee,"/",8)),n.a.createElement(Ee.a,{icon:"admin",multiline:!0,onClick:W},n.a.createElement("span",{className:"title"},_("ChannelAdministrators")),n.a.createElement("span",{className:"subtitle"},Object(ua.a)(te)))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"group",multiline:!0,onClick:Z},n.a.createElement("span",{className:"title"},_("GroupMembers")),n.a.createElement("span",{className:"subtitle"},Object(ua.a)(t.membersCount))),t.fullInfo&&n.a.createElement("div",{className:"ListItem narrow no-selection"},n.a.createElement(sa.a,{checked:!t.fullInfo.isPreHistoryHidden,label:_("ChatHistory"),onChange:X,disabled:!i}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:y},_("DeleteMega")))),n.a.createElement(Ht.a,{isShown:S,onClick:J,disabled:ne,ariaLabel:_("Save")},ne?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:C,onClose:k,textParts:Object(x.a)(c||!t.isCreator?_("AreYouSureDeleteAndExit"):_("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:c||!t.isCreator?_("DeleteMega"):_("DeleteGroupForAll"),confirmHandler:ae,confirmIsDestructive:!0}))}));var ss=Object(n.h)(Object(c.h)((e,{chatId:t})=>({chat:Object(m.g)(e,t),currentUserId:e.currentUserId}),(e,t)=>Object(b.l)(t,["updateChatDefaultBannedRights"]))(({onScreenSelect:e,onChatMemberSelect:t,chat:a,currentUserId:c,updateChatDefaultBannedRights:s,onClose:o,isActive:l})=>{const[i,d]=Object(n.r)({}),[m,u]=Object(n.r)(!1),[b,h]=Object(n.r)(!1),g=Object(F.a)();Object(A.a)(l,o);const p=Object(n.m)(()=>{e(r.g.GroupRemovedUsers)},[e]),v=Object(n.m)(()=>{e(r.g.GroupUserPermissionsCreate)},[e]),O=Object(n.m)(a=>{t(a.userId,a.promotedByUserId===c),e(r.g.GroupUserPermissions)},[c,t,e]);Object(n.n)(()=>{d(a&&a.defaultBannedRights||{}),u(!1),setTimeout(()=>{h(!1)},250)},[a]);const E=Object(n.m)(e=>{const{name:t}=e.target;function a(e){return!e||void 0}d(e=>({...e,[t]:a(e[t]),..."sendStickers"===t&&{sendGifs:a(e[t])}})),u(!0)},[]),f=Object(n.m)(()=>{a&&(h(!0),s({chatId:a.id,bannedRights:i}))},[a,i,s]),j=Object(n.p)(()=>a&&a.fullInfo&&a.fullInfo.kickedMembers?a.fullInfo.kickedMembers.length:0,[a]),C=Object(n.p)(()=>a&&a.fullInfo&&a.fullInfo.members?a.fullInfo.members.filter(({bannedRights:e})=>!!e):[],[a]),y=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 s=g(c);return`${e}${e.length?", "+s:s}`},"")},[a,g]);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",dir:"auto"},g("ChannelPermissionsHeader")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"sendMessages",checked:!i.sendMessages,label:g("UserRestrictionsSend"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"sendMedia",checked:!i.sendMedia,label:g("UserRestrictionsSendMedia"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"sendStickers",checked:!i.sendStickers&&!i.sendGifs,label:g("UserRestrictionsSendStickers"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"sendPolls",checked:!i.sendPolls,label:g("UserRestrictionsSendPolls"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"embedLinks",checked:!i.embedLinks,label:g("UserRestrictionsEmbedLinks"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"inviteUsers",checked:!i.inviteUsers,label:g("UserRestrictionsInviteUsers"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"pinMessages",checked:!i.pinMessages,label:g("UserRestrictionsPinMessages"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!i.changeInfo,label:g("UserRestrictionsChangeInfo"),blocking:!0,onChange:E}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete-user",multiline:!0,narrow:!0,onClick:p},n.a.createElement("span",{className:"title"},g("ChannelBlockedUsers")),n.a.createElement("span",{className:"subtitle"},j))),n.a.createElement("div",{className:"section"},n.a.createElement("h3",{className:"section-heading",dir:"auto"},g("PrivacyExceptions")),n.a.createElement(Ee.a,{icon:"add-user",onClick:v},g("ChannelAddException")),C.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>O(e)},n.a.createElement(fe.a,{userId:e.userId,status:y(e)}))))),n.a.createElement(Ht.a,{isShown:m,onClick:f,ariaLabel:g("Save"),disabled:b},b?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))}));var rs=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{byId:n}=e.users;return{chat:a,usersById:n}},(e,t)=>Object(b.l)(t,["updateChatMemberBannedRights"]))(({chat:e,usersById:t,updateChatMemberBannedRights:a,onClose:c,isActive:s})=>{const r=Object(F.a)();Object(A.a)(s,c);const o=Object(n.p)(()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[],[e]),l=Object(n.m)(e=>{if(!e.kickedByUserId)return;const a=t[e.kickedByUserId];return a?r("UserRemovedBy",Object(u.bb)(a)):void 0},[r,t]),i=Object(n.m)(t=>{if(e)return[{title:r("Unblock"),icon:"delete",destructive:!0,handler:()=>a({chatId:e.id,userId:t.userId,bannedRights:{}})}]},[r,e,a]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",dir:r.isRtl?"rtl":void 0},n.a.createElement("p",{className:"text-muted"},r("NoBlockedGroup2")),o.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:i(e)},n.a.createElement(fe.a,{userId:e.userId,status:l(e)}))))))}));var os=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{progress:n}=e.management;return{chat:a,progress:n,isSignaturesShown:Boolean(a&&a.isSignaturesShown),canChangeInfo:Object(u.p)(a,"changeInfo")}},(e,t)=>Object(b.l)(t,["toggleSignatures","updateChat","closeManagement","leaveChannel","deleteChannel","openChat"]))(({chatId:e,chat:t,progress:a,isSignaturesShown:c,canChangeInfo:o,onScreenSelect:l,updateChat:i,toggleSignatures:d,closeManagement:m,leaveChannel:b,deleteChannel:h,openChat:g,onClose:p,isActive:v})=>{const E=t&&t.title||"",f=t&&t.fullInfo&&t.fullInfo.about||"",j=t&&t.fullInfo&&t.fullInfo.linkedChatId,[C,y,k]=Object(Ue.a)(),[N,w]=Object(n.r)(!1),[S,I]=Object(n.r)(E),[P,M]=Object(n.r)(f),[R,T]=Object(n.r)(),[D,B]=Object(n.r)(),x=t&&Object(u.e)(t),U=Object(O.a)(x,!1,s.ApiMediaFormat.BlobUrl),G=Object(F.a)();Object(A.a)(v,p),Object(n.n)(()=>{a===r.f.Complete&&(w(!1),B(void 0))},[a]);const q=t&&t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,z=Object(n.m)(()=>{l(r.g.ChatPrivacyType)},[l]),_=Object(n.m)(()=>{l(r.g.Discussion)},[l]),H=Object(n.m)(()=>{l(r.g.ChatAdministrators)},[l]),$=Object(n.m)(e=>{T(e),w(!0)},[]),V=Object(n.m)(e=>{I(e.target.value),w(!0)},[]),W=Object(n.m)(e=>{M(e.target.value),w(!0)},[]),K=Object(n.m)(()=>{const t=S.trim(),a=P.trim();t.length?i({chatId:e,title:t,about:a,photo:R}):B("Channel title can't be empty")},[P,e,R,S,i]),Y=Object(n.m)(()=>{d({chatId:e,isEnabled:!c})},[e,c,d]),Q=Object(n.m)(()=>{l(r.g.ChannelSubscribers)},[l]),J=Object(n.m)(()=>{t.isCreator?h({chatId:t.id}):b({chatId:t.id}),k(),m(),g({id:void 0})},[t.isCreator,t.id,k,m,b,h,g]);if(t.isRestricted)return;const Z=a===r.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(_t.a,{currentAvatarBlobUrl:U,onChange:$,disabled:!o}),n.a.createElement(ve.a,{id:"channel-title",label:G("EnterChannelName"),onChange:V,value:S,error:"Channel title can't be empty"===D?D:void 0,disabled:!o}),n.a.createElement(ve.a,{id:"channel-about",className:"mb-2",label:G("DescriptionPlaceholder"),onChange:W,value:P,disabled:!o}),t.isCreator&&n.a.createElement(Ee.a,{icon:"lock",multiline:!0,onClick:z},n.a.createElement("span",{className:"title"},G("ChannelType")),n.a.createElement("span",{className:"subtitle"},t.username?G("TypePublic"):G("TypePrivate"))),n.a.createElement(Ee.a,{icon:"message",multiline:!0,onClick:_,disabled:!o},n.a.createElement("span",{className:"title"},G("Discussion")),n.a.createElement("span",{className:"subtitle"},G(j?"DiscussionUnlink":"Add"))),n.a.createElement(Ee.a,{icon:"admin",multiline:!0,onClick:H},n.a.createElement("span",{className:"title"},G("ChannelAdministrators")),n.a.createElement("span",{className:"subtitle"},q)),n.a.createElement("div",{className:"ListItem no-selection narrow"},n.a.createElement(sa.a,{checked:c,label:G("ChannelSignMessages"),onChange:Y}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"group",multiline:!0,onClick:Q},n.a.createElement("span",{className:"title",dir:"auto"},G("ChannelSubscribers")),n.a.createElement("span",{className:"subtitle",dir:"auto"},G("Subscribers",t.membersCount,"i")))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:y},t.isCreator?G("ChannelDelete"):G("LeaveChannel")))),n.a.createElement(Ht.a,{isShown:N,onClick:K,disabled:Z,ariaLabel:G("Save")},Z?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:C,onClose:k,text:t.isCreator?G("ChannelDeleteAlert"):G("ChannelLeaveAlert"),confirmLabel:t.isCreator?G("ChannelDelete"):G("LeaveChannel"),confirmHandler:J,confirmIsDestructive:!0}))})),ls=a(59);var is=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{isUsernameAvailable:n}=Object(m.ab)(e,t);return{chat:a,isChannel:Object(u.mb)(a),progress:e.management.progress,isUsernameAvailable:n}},(e,t)=>Object(b.l)(t,["checkPublicLink","updatePublicLink","updatePrivateLink"]))(({chat:e,onClose:t,isActive:a,isChannel:c,progress:s,isUsernameAvailable:o,checkPublicLink:l,updatePublicLink:i,updatePrivateLink:d})=>{const m=Boolean(e.username),u=e.fullInfo&&e.fullInfo.inviteLink,[b,h]=Object(n.r)(m?"public":"private"),[g,p]=Object(n.r)(),[v,O,E]=Object(Ue.a)(),f="public"===b&&g&&o||"private"===b&&m;Object(A.a)(a,t),Object(n.n)(()=>{b&&!u&&d()},[b,u,d]);const j=Object(n.m)(e=>{h(e)},[]),C=Object(n.m)(()=>{i({username:"public"===b?g:""})},[b,i,g]),y=Object(n.m)(()=>{E(),d()},[E,d]),k=Object(F.a)(),N=c?"Channel":"Mega",w=c?"Channel":"Group",S=[{value:"private",label:k(N+"Private"),subLabel:k(N+"PrivateInfo")},{value:"public",label:k(N+"Public"),subLabel:k(N+"PublicInfo")}],I=s===r.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",dir:k.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"section-heading"},k(w+"Type")),n.a.createElement(ze.a,{selected:b,name:"channel-type",options:S,onChange:j})),"private"===b?n.a.createElement("div",{className:"section",dir:k.isRtl?"rtl":void 0},u?n.a.createElement(n.a.Fragment,null,n.a.createElement(ls.a,{url:u,className:"group-link",text:u}),n.a.createElement("p",{className:"section-info",dir:k.isRtl?"rtl":void 0},k(N+"PrivateLinkHelp")),n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:O},k("RevokeLink")),n.a.createElement(Pe.a,{isOpen:v,onClose:E,text:k("RevokeAlert"),confirmLabel:k("RevokeButton"),confirmHandler:y,confirmIsDestructive:!0})):n.a.createElement(ge.a,null)):n.a.createElement("div",{className:"section no-border"},n.a.createElement(Kt,{asLink:!0,currentUsername:e.username,isLoading:I,isUsernameAvailable:o,checkUsername:l,onChange:p}),n.a.createElement("p",{className:"section-info",dir:"auto"},k(w+".Username.CreatePublicLinkHelp")))),n.a.createElement(Ht.a,{isShown:f,disabled:I,ariaLabel:k("Save"),onClick:C},I?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))}));var ds=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{forDiscussionIds:n,byId:c}=e.chats;return{chat:a,chatsByIds:c,forDiscussionIds:n,linkedChat:a&&a.fullInfo&&a.fullInfo.linkedChatId?Object(m.g)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&Object(u.mb)(a)}},(e,t)=>Object(b.l)(t,["loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup"]))(({chat:e,onClose:t,isActive:a,chatId:c,chatsByIds:s,linkedChat:l,forDiscussionIds:i,isChannel:d,onScreenSelect:m,loadGroupsForDiscussion:u,linkDiscussionGroup:b,unlinkDiscussionGroup:h})=>{const[g,p]=Object(n.r)(),[v,O]=Object(n.r)(),[E,f]=Object(n.r)(!1),j=Object(n.m)(()=>f(!0),[]),[C,y,k]=Object(Ue.a)(),[N,w,S]=Object(Ue.a)(),I=Object(F.a)(),P=l&&l.id;Object(A.a)(a,t),Object(n.n)(()=>{u()},[u]),Object(n.n)(()=>{v||Object(Jt.a)("DiscussionGroups").then(O)},[v]);const M=Object(n.m)(()=>{k(),h({channelId:d?c:P}),d||m(r.g.Initial)},[k,h,d,c,P,m]),L=Object(n.m)(()=>{S(),b({channelId:c,chatId:g})},[S,b,c,g]);function R(){const e=s[g];if(e)return n.a.createElement("div",{className:"modal-header"},n.a.createElement(U.a,{size:"tiny",chat:e}),n.a.createElement("div",{className:"modal-title"},I("Channel.DiscussionGroup.LinkGroup")))}function T(){const t=s[g];if(t)return t.hasPrivateLink?Object(x.a)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):Object(x.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"},v&&n.a.createElement(Zt.a,{id:"discussionGroupsDucks",size:o.Bb,animationData:v,play:E,noLoop:!0,onLoad:j})),l&&n.a.createElement("div",null,n.a.createElement(Ee.a,{className:"chat-item-clickable",inactive:!0},n.a.createElement(je.a,{chatId:l.id})),n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:y},I(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),n.a.createElement(Pe.a,{isOpen:C,onClose:k,header:n.a.createElement("div",{className:"modal-header"},n.a.createElement(U.a,{size:"tiny",chat:l}),n.a.createElement("div",{className:"modal-title"},I(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:Object(x.a)(I(d?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",l.title),["br","simple_markdown"]),confirmLabel:I(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:M,confirmIsDestructive:!0})),!l&&n.a.createElement("div",null,n.a.createElement("p",{className:"section-help",dir:"auto"},I("DiscussionChannelHelp")),n.a.createElement("div",{teactFastList:!0},n.a.createElement(Ee.a,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},I("DiscussionCreateGroup")),i?i.map((e,t)=>n.a.createElement(Ee.a,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{p(e),w()}},n.a.createElement(je.a,{chatId:e}))):n.a.createElement(ct.a,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),n.a.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},I("DiscussionChannelHelp2")),n.a.createElement(Pe.a,{isOpen:N,onClose:S,header:R(),textParts:T(),confirmLabel:I("DiscussionLinkGroup"),confirmHandler:L,isButtonsInOneRow:!0})))))}));var ms=Object(n.h)(Object(c.h)((e,{chatId:t,isPromotedByCurrentUser:a})=>{const n=Object(m.g)(e,t);return{chat:n,isFormFullyDisabled:!(n.isCreator||a)}},(e,t)=>Object(b.l)(t,["updateChatMemberBannedRights"]))(({chat:e,selectedChatMemberId:t,onScreenSelect:a,updateChatMemberBannedRights:c,isFormFullyDisabled:s,onClose:o,isActive:l})=>{const[i,d]=Object(n.r)({}),[m,u]=Object(n.r)(!1),[b,h]=Object(n.r)(!1),[g,p,v]=Object(Ue.a)(),O=Object(F.a)();Object(A.a)(l,o);const 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(r.g.GroupPermissions)},[e,a,E,t]),Object(n.n)(()=>{d(E&&E.bannedRights||e&&e.defaultBannedRights||{}),u(!1),h(!1)},[e,E]);const f=Object(n.m)(e=>{const{name:t}=e.target;function a(e){return!e||void 0}d(e=>({...e,[t]:a(e[t]),..."sendStickers"===t&&{sendGifs:a(e[t])}})),u(!0)},[]),j=Object(n.m)(()=>{e&&t&&(h(!0),c({chatId:e.id,userId:t,bannedRights:i}))},[e,t,i,c]),C=Object(n.m)(()=>{e&&t&&c({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})},[e,t,c]),y=Object(n.m)(t=>!!s||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t],[e,s]);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(Ee.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(fe.a,{userId:E.userId})),n.a.createElement("h3",{className:"section-heading mt-4",dir:"auto"},O("UserRestrictionsCanDo")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"sendMessages",checked:!i.sendMessages,label:O("UserRestrictionsSend"),blocking:!0,disabled:y("sendMessages"),onChange:f})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"sendMedia",checked:!i.sendMedia,label:O("UserRestrictionsSendMedia"),blocking:!0,disabled:y("sendMedia"),onChange:f})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"sendStickers",checked:!i.sendStickers&&!i.sendGifs,label:O("UserRestrictionsSendStickers"),blocking:!0,disabled:y("sendStickers"),onChange:f})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"sendPolls",checked:!i.sendPolls,label:O("UserRestrictionsSendPolls"),blocking:!0,disabled:y("sendPolls"),onChange:f})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"embedLinks",checked:!i.embedLinks,label:O("UserRestrictionsEmbedLinks"),blocking:!0,disabled:y("embedLinks"),onChange:f})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"inviteUsers",checked:!i.inviteUsers,label:O("UserRestrictionsInviteUsers"),blocking:!0,disabled:y("inviteUsers"),onChange:f})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"pinMessages",checked:!i.pinMessages,label:O("UserRestrictionsPinMessages"),blocking:!0,disabled:y("pinMessages"),onChange:f})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!i.changeInfo,label:O("UserRestrictionsChangeInfo"),blocking:!0,disabled:y("changeInfo"),onChange:f}))),!s&&n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete-user",ripple:!0,destructive:!0,onClick:p},O("UserRestrictionsBlock")))),n.a.createElement(Ht.a,{isShown:m,onClick:j,ariaLabel:O("Save"),disabled:b},b?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:g,onClose:v,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:C,confirmIsDestructive:!0}))}));var us=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{byId:n}=e.users;return{chat:a,currentUserId:e.currentUserId,isChannel:Object(u.mb)(a),usersById:n}})(({chat:e,isChannel:t,currentUserId:a,usersById:c,onScreenSelect:s,onChatMemberSelect:o,onClose:l,isActive:i})=>{const d=Object(F.a)();Object(A.a)(i,l);const m=Object(n.p)(()=>e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort((e,t)=>e.isOwner?-1:t.isOwner?1:0):[],[e]),b=Object(n.m)(e=>{o(e.userId,e.promotedByUserId===a),s(r.g.ChatAdminRights)},[a,o,s]),h=Object(n.m)(e=>{if(e.isOwner)return d("ChannelCreator");const t=e.promotedByUserId?c[e.promotedByUserId]:void 0;return t?d("EditAdminPromotedBy",Object(u.bb)(t)):d("ChannelAdmin")},[d,c]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"recent",multiline:!0,onClick:function(){s(r.g.GroupRecentActions)}},n.a.createElement("span",{className:"title"},d("EventLog")),n.a.createElement("span",{className:"subtitle"},d(t?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),n.a.createElement("div",{className:"section",dir:d.isRtl?"rtl":void 0},n.a.createElement("p",{className:"text-muted",dir:"auto"},t?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),m.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable",onClick:()=>b(e)},n.a.createElement(fe.a,{userId:e.userId,status:h(e),forceShowSelf:!0}))))))}));var bs=Object(n.h)(Object(c.h)((e,{chatId:t})=>({chat:Object(m.g)(e,t)}))(({chat:e,onClose:t,isActive:a})=>{const c=Object(F.a)();Object(A.a)(a,t);const s=Object(n.p)(()=>e&&e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort((e,t)=>e.isOwner?-1:t.isOwner?1:0):[],[e]),r=Object(n.m)(e=>e.isOwner?c("ChannelCreator"):c("ChannelAdmin"),[c]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section not-implemented",dir:c.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"section-heading",dir:"auto"},"Actions"),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!0,label:c("EventLogAllEvents"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!0,label:c("EventLogFilterNewAdmins"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!0,label:c("EventLogFilterNewMembers"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!0,label:c("EventLogFilterChannelInfo"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!0,label:c("EventLogFilterDeletedMessages"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!0,label:c("EventLogFilterEditedMessages"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!0,label:c("EventLogFilterLeavingMembers"),onChange:void 0}))),n.a.createElement("div",{className:"section not-implemented",dir:c.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"section-heading",dir:"auto"},c("Channel.Management.Title")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!0,label:c("EventLogAllAdmins"),onChange:void 0})),s.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},n.a.createElement(sa.a,{label:"",checked:!0}),n.a.createElement(fe.a,{userId:e.userId,status:r(e),forceShowSelf:!0}))))))}));var hs=Object(n.h)(Object(c.h)((e,{chatId:t,isPromotedByCurrentUser:a})=>{const n=Object(m.g)(e,t),{byId:c}=e.users,{currentUserId:s}=e;return{chat:n,usersById:c,currentUserId:s,isChannel:Object(u.mb)(n),isFormFullyDisabled:!(n.isCreator||a)}},(e,t)=>Object(b.l)(t,["updateChatAdmin"]))(({selectedChatMemberId:e,onScreenSelect:t,chat:a,usersById:c,currentUserId:s,isChannel:o,isFormFullyDisabled:l,updateChatAdmin:i,onClose:d,isActive:m})=>{const[b,h]=Object(n.r)({}),[g,p]=Object(n.r)(!1),[v,O]=Object(n.r)(!1),[E,f,j]=Object(Ue.a)(),[C,y]=Object(n.r)(""),k=Object(F.a)();Object(A.a)(m,d);const N=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&&!N&&t(r.g.ChatAdministrators)},[a,t,N,e]),Object(n.n)(()=>{h(N&&N.adminRights||{}),y((N&&N.customTitle||"").substr(0,16)),p(!1),O(!1)},[N]);const w=Object(n.m)(e=>{const{name:t}=e.target;h(e=>{return{...e,[t]:(a=e[t],!a||void 0)};var a}),p(!0)},[]),S=Object(n.m)(()=>{e&&(O(!0),i({chatId:a.id,userId:e,adminRights:b,customTitle:C}))},[a,e,b,C,i]),I=Object(n.m)(()=>{e&&(i({chatId:a.id,userId:e,adminRights:{}}),j())},[a.id,j,e,i]),P=Object(n.m)(e=>!Object(u.lb)(a)&&(!(!l&&a.adminRights)||!a.adminRights[e]),[a,l]),M=Object(n.p)(()=>{if(!N)return;if(N.isOwner)return k("ChannelCreator");const e=N.promotedByUserId?c[N.promotedByUserId]:void 0;return e?k("EditAdminPromotedBy",Object(u.bb)(e)):k("ChannelAdmin")},[N,c,k]),R=Object(n.m)(e=>{const{value:t}=e.target;y(t),p(!0)},[]);if(N)return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(fe.a,{userId:N.userId,status:M,forceShowSelf:!0})),n.a.createElement("h3",{className:"section-heading mt-4",dir:"auto"},k("EditAdminWhatCanDo")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"changeInfo",checked:!!b.changeInfo,label:k(o?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:P("changeInfo"),onChange:w})),o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"postMessages",checked:!!b.postMessages,label:k("EditAdminPostMessages"),blocking:!0,disabled:P("postMessages"),onChange:w})),o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"editMessages",checked:!!b.editMessages,label:k("EditAdminEditMessages"),blocking:!0,disabled:P("editMessages"),onChange:w})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"deleteMessages",checked:!!b.deleteMessages,label:k(o?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:P("deleteMessages"),onChange:w})),!o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"banUsers",checked:!!b.banUsers,label:k("EditAdminBanUsers"),blocking:!0,disabled:P("banUsers"),onChange:w})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"inviteUsers",checked:!!b.inviteUsers,label:k("EditAdminAddUsers"),blocking:!0,disabled:P("inviteUsers"),onChange:w})),!o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"pinMessages",checked:!!b.pinMessages,label:k("EditAdminPinMessages"),blocking:!0,disabled:P("pinMessages"),onChange:w})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"addAdmins",checked:!!b.addAdmins,label:k("EditAdminAddAdmins"),blocking:!0,disabled:P("addAdmins"),onChange:w})),!o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(sa.a,{name:"anonymous",checked:!!b.anonymous,label:k("EditAdminSendAnonymously"),blocking:!0,disabled:P("anonymous"),onChange:w})),l&&n.a.createElement("p",{className:"section-info mb-4",dir:"auto"},k("Channel.EditAdmin.CannotEdit")),!o&&n.a.createElement(ve.a,{id:"admin-title",label:k("EditAdminRank"),onChange:R,value:C,disabled:l,maxLength:16}),s!==e&&!l&&n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:f},k("EditAdminRemoveAdmin")))),n.a.createElement(Ht.a,{isShown:g,onClick:S,ariaLabel:k("Save"),disabled:v},v?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:E,onClose:j,text:"Are you sure you want to dismiss this admin?",confirmLabel:"Dismiss",confirmHandler:I,confirmIsDestructive:!0}))}));var gs=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{byId:n}=e.users;return{members:a&&a.fullInfo&&a.fullInfo.members,usersById:n,isChannel:a&&Object(u.mb)(a),serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(b.l)(t,["openUserInfo"]))(({members:e,usersById:t,isChannel:a,openUserInfo:c,onClose:s,isActive:r,serverTimeOffset:o})=>{const l=Object(n.p)(()=>{if(e&&t)return Object(u.Jb)(e.map(({userId:e})=>e),t,void 0,o)},[e,o,t]),i=Object(n.m)(e=>{c({id:e})},[c]);return Object(A.a)(r,s),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(Ee.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>i(e)},n.a.createElement(fe.a,{userId:e,forceShowSelf:!0}))):n.a.createElement(ct.a,{teactOrderKey:0,key:"nothing-found",text:a?"No subscribers found":"No members found"}))))}));var ps=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{byId:n}=e.users;return{members:a&&a.fullInfo&&a.fullInfo.members,usersById:n,isChannel:a&&Object(u.mb)(a),serverTimeOffset:e.serverTimeOffset}})(({usersById:e,members:t,isChannel:a,onScreenSelect:c,onChatMemberSelect:s,onClose:o,isActive:l,serverTimeOffset:i})=>{Object(A.a)(l,o);const d=Object(n.p)(()=>{if(t&&e)return Object(u.Jb)(t.filter(e=>!e.isOwner).map(({userId:e})=>e),e,void 0,i)},[t,i,e]),m=Object(n.m)(e=>{s(e),c(r.g.GroupUserPermissions)},[s,c]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",teactFastList:!0},d?d.map((e,t)=>n.a.createElement(Ee.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>m(e)},n.a.createElement(fe.a,{userId:e,forceShowSelf:!0}))):n.a.createElement(ct.a,{teactOrderKey:0,key:"nothing-found",text:a?"No subscribers found":"No members found"}))))}));var vs=Object(n.h)(Object(c.h)(e=>({managementType:Object(m.v)(e)}))(({chatId:e,currentScreen:t,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:s,onChatMemberSelect:o,onClose:l,isActive:i,managementType:d})=>{switch(t){case r.g.Initial:switch(d){case"user":return n.a.createElement(ns,{key:e,userId:e,onClose:l,isActive:i});case"group":return n.a.createElement(cs,{key:e,chatId:e,onScreenSelect:s,onClose:l,isActive:i||[r.g.ChatPrivacyType,r.g.Discussion,r.g.GroupPermissions,r.g.ChatAdministrators,r.g.GroupRemovedUsers,r.g.GroupUserPermissionsCreate,r.g.GroupUserPermissions,r.g.ChatAdminRights,r.g.GroupRecentActions].includes(t)});case"channel":return n.a.createElement(os,{key:e,chatId:e,onScreenSelect:s,onClose:l,isActive:i||[r.g.ChannelSubscribers,r.g.ChatAdministrators,r.g.Discussion,r.g.ChatPrivacyType,r.g.ChatAdminRights,r.g.GroupRecentActions].includes(t)})}break;case r.g.ChatPrivacyType:return n.a.createElement(is,{chatId:e,isActive:i,onClose:l});case r.g.Discussion:return n.a.createElement(ds,{chatId:e,onScreenSelect:s,isActive:i,onClose:l});case r.g.GroupPermissions:return n.a.createElement(ss,{chatId:e,onScreenSelect:s,onChatMemberSelect:o,isActive:i||[r.g.GroupRemovedUsers,r.g.GroupUserPermissionsCreate,r.g.GroupUserPermissions].includes(t),onClose:l});case r.g.GroupRemovedUsers:return n.a.createElement(rs,{chatId:e,isActive:i,onClose:l});case r.g.GroupUserPermissionsCreate:return n.a.createElement(ps,{chatId:e,onChatMemberSelect:o,onScreenSelect:s,isActive:i||[r.g.GroupUserPermissions].includes(t),onClose:l});case r.g.GroupUserPermissions:return n.a.createElement(ms,{chatId:e,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:s,isActive:i,onClose:l});case r.g.ChatAdministrators:return n.a.createElement(us,{chatId:e,onScreenSelect:s,onChatMemberSelect:o,isActive:i||[r.g.ChatAdminRights,r.g.GroupRecentActions].includes(t),onClose:l});case r.g.GroupRecentActions:return n.a.createElement(bs,{chatId:e,isActive:i,onClose:l});case r.g.ChatAdminRights:return n.a.createElement(hs,{chatId:e,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:s,isActive:i,onClose:l});case r.g.ChannelSubscribers:case r.g.GroupMembers:return n.a.createElement(gs,{chatId:e,isActive:i,onClose:l})}}));const Os={USD:"$",EUR:"€",GBP:"£",JPY:"¥",RUB:"₽",UAH:"₴",INR:"₹",AED:"د.إ"};function Es(e){return e&&Os[e]||""}const fs=/^4[0-9]{12}(?:[0-9]{1,3})?$/,js=/^5[1-5][0-9]{11,14}$/,Cs=/^2[2-7][0-9]{11,14}$/;let ys;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(ys||(ys={}));const ks={[ys.Default]:"",[ys.Visa]:"visa",[ys.Mastercard]:"mastercard"};function Ns(e){return e=e.replace(/\s/g,""),fs.test(e)?ys.Visa:js.test(e)||Cs.test(e)?ys.Mastercard:ys.Default}var ws=a(61);const Ss={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},Is=(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:Ps(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:Ps(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function Ps(e){const t=qt.a.find(({id:t})=>t===e);return t?t.name:""}function Ms(e,t=400){Object(n.n)(()=>{l.n||setTimeout(()=>{Object(V.b)(()=>{e.current&&e.current.focus()})},t)},[e,t])}var Fs=Object(n.h)(e=>{const{id:t,value:a,label:c,hasArrow:s,error:r,ref:o,placeholder:l,onChange:i,children:d}=e,m=r||c,u=Object(W.a)("input-group",a&&"touched",r&&"error",m&&"with-label",s&&"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:l||c,ref:o},d),m&&t&&n.a.createElement("label",{htmlFor:t},m))});a(313);var As=Object(n.h)(({state:e,needEmail:t,needPhone:a,needName:c,needAddress:s,dispatch:r})=>{const o=Object(n.q)(null),l=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 d=Object(F.a)();Ms(o);const m=Object(n.m)(e=>{r({type:"changeAddress1",payload:e.target.value})},[r]),u=Object(n.m)(e=>{r({type:"changeAddress2",payload:e.target.value})},[r]),b=Object(n.m)(e=>{r({type:"changeCity",payload:e.target.value})},[r]),h=Object(n.m)(e=>{r({type:"changeState",payload:e.target.value})},[r]),g=Object(n.m)(e=>{r({type:"changeCountry",payload:e.target.value})},[r]),p=Object(n.m)(e=>{r({type:"changePostCode",payload:e.target.value})},[r]),v=Object(n.m)(e=>{r({type:"changeFullName",payload:e.target.value})},[r]),O=Object(n.m)(e=>{r({type:"changeEmail",payload:e.target.value})},[r]),E=Object(n.m)(e=>{let{value:t}=e.target;t="+"+t.replace(/\D/g,""),l.current&&(l.current.value=t),r({type:"changePhone",payload:t})},[r]),f=Object(n.m)(e=>{r({type:"changeSaveInfo",payload:e.target.value})},[r]),{formErrors:j}=e;return n.a.createElement("div",{className:"ShippingInfo"},n.a.createElement("form",null,s?n.a.createElement("div",null,n.a.createElement("h5",null,d("PaymentShippingAddress")),n.a.createElement(ve.a,{ref:o,label:"Address1 (Street)",onChange:m,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:b,value:e.city,inputMode:"text",error:j.city}),n.a.createElement(ve.a,{label:"State",onChange:h,value:e.state,inputMode:"text",error:j.state}),n.a.createElement(Fs,{label:"Country",placeholder:"Country",onChange:g,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:j.countryIso2,ref:i},qt.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:p,value:e.postCode,inputMode:"text",error:j.postCode})):void 0,c||t||a?n.a.createElement("h5",null,d("PaymentShippingReceiver")):void 0,c&&n.a.createElement(ve.a,{label:"Full name",onChange:v,value:e.fullName,inputMode:"text",error:j.fullName}),t&&n.a.createElement(ve.a,{label:"Email",onChange:O,value:e.email,inputMode:"email",error:j.email}),a&&n.a.createElement(ve.a,{label:"Phone number",onChange:E,value:e.phone,inputMode:"tel",error:j.phone,ref:l}),n.a.createElement(sa.a,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:f})))});a(314);var Ls=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 s=Object(n.m)(e=>{c({type:"changeShipping",payload:e})},[c]),r=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(ze.a,{name:"shipping-options",options:r,onChange:s,selected:e.shipping})))});a(315);function Rs(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 Ts(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 Ds=Object(n.h)(({invoiceContent:e,prices:t,shippingPrices:a,checkoutInfo:c,currency:s,totalPrice:r})=>{const{photoUrl:o,title:l,text:i}=e||{},{paymentMethod:d,paymentProvider:m,shippingAddress:u,name:b,phone:h,shippingMethod:g}=c||{};return n.a.createElement("div",{className:"Checkout"},n.a.createElement("div",{className:"description has-image"},o&&n.a.createElement("img",{src:o,alt:""}),n.a.createElement("div",{className:"text"},n.a.createElement("h5",null,l),n.a.createElement("p",null,i))),n.a.createElement("div",{className:"price-info"},t&&t.map(e=>Rs(e.label,e.amount,s,!1)),a&&a.map(e=>Rs(e.label,e.amount,s,!1)),void 0!==r&&Rs("Total",r,s,!0)),n.a.createElement("div",{className:"invoice-info"},d&&Ts("icon-card",d,"Payment method"),m&&Ts("stripe-provider",m,"Payment provider"),u&&Ts("icon-location",u,"Shipping address"),b&&Ts("icon-user",b,"Name"),h&&Ts("icon-phone",h,"Phone number"),g&&Ts("icon-truck",g,"Shipping method")))});var Bs=Object(n.h)(({value:e,error:t,onChange:a})=>{const c=Object(n.q)(null),s=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]),r=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:r,onKeyDown:s,value:e,error:t,inputMode:"numeric",maxLength:5})}),xs=(a(316),a.p+"mastercard.4216118edafe23cc2dec7b8807ba4622.svg"),Us=a.p+"visa.e5a7c336e1deb4b92a636e2e053878c4.svg";var Gs=Object(n.h)(({value:e,error:t,onChange:a})=>{const c=Object(n.q)(null);Ms(c);const[s,r]=Object(n.r)(ys.Default);Object(n.n)(()=>{const t=Ns(e);r(t)},[]);const o=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=Ns(e.target.value);r(n),a(t),c.current&&(c.current.value=t)},[a,c]),l=function(e){switch(e){case ys.Mastercard:return n.a.createElement("img",{src:xs,alt:""});case ys.Visa:return n.a.createElement("img",{src:Us,alt:""});default:return}}(s);return n.a.createElement("div",{className:"CardInput"},n.a.createElement("span",{className:"left-addon"},l),n.a.createElement(ve.a,{ref:c,label:"Card number",onChange:o,value:e,inputMode:"numeric",className:s?"has-left-addon":"",error:t,maxLength:23}))});a(317);var qs=Object(n.h)(({state:e,canSaveCredentials:t,needCardholderName:a,needCountry:c,needZip:s,dispatch:r})=>{const o=Object(n.q)(null);Object(n.n)(()=>{o.current&&o.current.value!==e.billingCountry&&(o.current.value=e.billingCountry)},[e.billingCountry]);const l=Object(n.m)(e=>{r({type:"changeCardNumber",payload:e})},[r]),i=Object(n.m)(e=>{r({type:"changeCardholder",payload:e.target.value.toUpperCase()})},[r]),d=Object(n.m)(e=>{r({type:"changeExpiryDate",payload:e})},[r]),m=Object(n.m)(e=>{r({type:"changeCvvCode",payload:e.target.value})},[r]),u=Object(n.m)(e=>{r({type:"changeBillingCountry",payload:e.target.value})},[r]),b=Object(n.m)(e=>{r({type:"changeBillingZip",payload:e.target.value})},[r]),h=Object(n.m)(e=>{r({type:"changeSaveCredentials",payload:e.target.value})},[r]),g=Object(F.a)(),{formErrors:p={}}=e;return n.a.createElement("div",{className:"PaymentInfo"},n.a.createElement("form",null,n.a.createElement("h5",null,g("PaymentCardTitle")),n.a.createElement(Gs,{onChange:l,value:e.cardNumber,error:p.cardNumber}),a&&n.a.createElement(ve.a,{label:"Name on card",onChange:i,value:e.cardholder,inputMode:"text",error:p.cardholder}),n.a.createElement("section",{className:"inline-inputs"},n.a.createElement(Bs,{value:e.expiry,onChange:d,error:p.expiry}),n.a.createElement(ve.a,{label:"CVV code",onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,error:p.cvv})),c||s?n.a.createElement("h5",null,g("PaymentBillingAddress")):void 0,c&&n.a.createElement(Fs,{label:"Country",placeholder:"Country",onChange:u,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:p.billingCountry,ref:o},qt.a.map(({name:e})=>n.a.createElement("option",{value:e,className:"county-item"},e))),s&&n.a.createElement(ve.a,{label:"Post Code",onChange:b,value:e.billingZip,inputMode:"text",error:p.billingZip}),t&&n.a.createElement(sa.a,{label:g("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:h})))});a(192);var zs=Object(n.h)(Object(c.h)(e=>{const{step:t,shippingOptions:a,savedInfo:n,canSaveCredentials:c,invoice:s,invoiceContent:r,nativeProvider:o,nativeParams:l,passwordMissing:i,error:d}=e.payment,m=Boolean(s&&(!o||"stripe"!==o)),{needCardholderName:u,needCountry:b,needZip:h}=l||{},{nameRequested:g,phoneRequested:p,emailRequested:v,shippingAddressRequested:O,flexible:E,phoneToProvider:f,emailToProvider:j,currency:C,prices:y}=s||{};return{step:t,shippingOptions:a,savedInfo:n,canSaveCredentials:c,nativeProvider:o,passwordMissing:i,nameRequested:g,shippingAddressRequested:O,phoneRequested:p,emailRequested:v,flexible:E,phoneToProvider:f,emailToProvider:j,currency:C,prices:y,isProviderError:m,invoiceContent:r,needCardholderName:u,needCountry:b,needZip:h,error:d,globalDialogs:e.dialogs}},(e,t)=>Object(b.l)(t,["validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError"]))(({isOpen:e,onClose:t,step:a,shippingOptions:c,savedInfo:s,canSaveCredentials:o,nameRequested:l,shippingAddressRequested:i,phoneRequested:d,emailRequested:m,phoneToProvider:u,emailToProvider:b,currency:h,passwordMissing:g,isProviderError:p,invoiceContent:v,nativeProvider:O,prices:E,needCardholderName:f,needCountry:j,needZip:C,error:y,globalDialogs:k,validateRequestedInfo:N,sendPaymentForm:w,setPaymentStep:S,sendCredentialsInfo:I,clearPaymentError:P})=>{const[M,A]=Pt(Is,Ss),R=Es(h),[B,x]=Object(n.r)(!1),U=Object(F.a)();Object(n.n)(()=>{(a||y||k)&&x(!1)},[a,y,k]),Object(n.n)(()=>{if(y&&y.field)A({type:"setFormErrors",payload:{[y.field]:y.fieldError}});else if(k&&k.length){const e=Object(ws.a)(k);A({type:"setFormErrors",payload:{...e}})}},[y,k,A]),Object(n.n)(()=>{if(s){const{name:e,phone:t,email:a,shippingAddress:n}=s;A({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?"+"+t:t,email:a,...n||{}}})}},[s,A]);const G=Object(n.m)(()=>{P()},[P]),q=Object(n.p)(()=>a!==r.j.Checkout?0:function(e=[],t,a){const n=t?Hs(t,a):[];let c=0;const s=e.concat(n||[]);return c=s.reduce((e,t)=>e+t.amount,c),c}(E,c,M.shipping),[a,M.shipping,E,c]),z=Object(n.p)(()=>{if(a===r.j.Checkout)return function(e,t,a){const n=`${function(e){const t=Ns(e);return ks[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,c=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:s,fullName:r}=e,o=t?_s(t,e.shipping):void 0,l=o?o.title:void 0;return{paymentMethod:n,paymentProvider:a,shippingAddress:c,name:r,phone:s,shippingMethod:l}}(M,c,O||"")},[a,M,c,O]);const _=Object(n.m)(()=>{const{saveInfo:e}=M,t=function(e){const{streetLine1:t,streetLine2:a,city:n,state:c,countryIso2:s,postCode:r,fullName:o,phone:l,email:i}=e;return{name:o,phone:l,email:i,shippingAddress:{streetLine1:t,streetLine2:a,city:n,state:c,countryIso2:s,postCode:r}}}(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:s,billingZip:r}=e,[o,l]=n.split("/");return{data:{cardNumber:t,cardholder:a,expiryMonth:o,expiryYear:l,cvv:c,country:s,zip:r}}}(M);I({credentials:e})},[I,M]),$=Object(n.m)(()=>{w({shippingOptionId:M.shipping,saveCredentials:M.saveCredentials})},[w,M]),V=Object(n.m)(e=>{S({step:e})},[S]),W=Object(n.m)(()=>{switch(x(!0),a){case r.j.ShippingInfo:return _();case r.j.Shipping:return V(r.j.PaymentInfo);case r.j.PaymentInfo:return H();case r.j.Checkout:return $();default:return()=>{}}},[a,_,V,H,$]),K=Object(n.p)(()=>{switch(a){case r.j.ShippingInfo:return U("PaymentShippingInfo");case r.j.Shipping:return U("PaymentShippingMethod");case r.j.PaymentInfo:return U("PaymentCardInfo");case r.j.Checkout:return U("PaymentCheckout");default:return""}},[a,U]),Y=Object(n.p)(()=>{switch(a){case r.j.Checkout:return U("Checkout.PayPrice",`${R}${(q/100).toFixed(2)}`);default:return U("Next")}},[a,U,R,q]);return p?n.a.createElement(pe.a,{className:"error",isOpen:e,onClose:t},n.a.createElement("p",null,"Sorry, Telegram WebZ doesn't support payments with this provider yet. ",n.a.createElement("br",null),"Please use one of our mobile apps to do this."),n.a.createElement(D.a,{isText:!0,onClick:t},U("OK"))):n.a.createElement(pe.a,{className:"PaymentModal",isOpen:e,onClose:t},n.a.createElement("div",{className:"header",dir:U.isRtl?"rtl":void 0},n.a.createElement(D.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(T.a,{name:"slide",activeKey:a},()=>n.a.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case r.j.ShippingInfo:return n.a.createElement(As,{state:M,dispatch:A,needAddress:Boolean(i),needEmail:Boolean(m||b),needPhone:Boolean(d||u),needName:Boolean(l)});case r.j.Shipping:return n.a.createElement(Ls,{state:M,dispatch:A,shippingOptions:c||[],currency:R});case r.j.PaymentInfo:return n.a.createElement(qs,{state:M,dispatch:A,canSaveCredentials:Boolean(!g&&o),needCardholderName:f,needCountry:j,needZip:C});case r.j.Checkout:return n.a.createElement(Ds,{prices:E,shippingPrices:M.shipping&&c?Hs(c,M.shipping):void 0,totalPrice:q,invoiceContent:v,checkoutInfo:z,currency:R});default:return}}(a))):n.a.createElement("div",{className:"empty-content"},n.a.createElement(L.a,{color:"gray"})),n.a.createElement("div",{className:"footer"},n.a.createElement(D.a,{type:"submit",onClick:W,disabled:B,isLoading:B},Y)),y&&!y.field&&function(){if(y)return n.a.createElement(pe.a,{className:"error",isOpen:Boolean(y),onClose:G},n.a.createElement("h4",null,y.description||"Error"),n.a.createElement("p",null,y.description||"Error"),n.a.createElement(D.a,{isText:!0,onClick:P},U("OK")))}())}));function _s(e,t){return e.find(({id:e})=>e===t)}function Hs(e,t){const a=_s(e,t);return a?a.prices:void 0}var $s=Object(n.h)(Object(c.h)(e=>{const{receipt:t}=e.payment,{currency:a,prices:n,info:c,totalAmount:s,credentialsTitle:r,shippingPrices:o,shippingMethod:l,photoUrl:i,text:d,title:m}=t||{};return{currency:a,prices:n,info:c,totalAmount:s,credentialsTitle:r,shippingPrices:o,shippingMethod:l,photoUrl:i,text:d,title:m}})(({isOpen:e,onClose:t,prices:a,shippingPrices:c,totalAmount:s,currency:r,info:o,photoUrl:l,text:i,title:d,credentialsTitle:m,shippingMethod:u})=>{const b=Object(F.a)(),h=Es(r),g=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:s,name:r}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:c,name:r,phone:s,shippingMethod:a}}(m,o,u),[o,u,m]);return n.a.createElement(pe.a,{className:"PaymentModal PaymentModal-receipt",isOpen:e,onClose:t},n.a.createElement("div",null,n.a.createElement("div",{className:"header",dir:b.isRtl?"rtl":void 0},n.a.createElement(D.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," ",b("PaymentReceipt")," ")),n.a.createElement("div",{className:"receipt-content custom-scroll"},n.a.createElement(Ds,{prices:a,shippingPrices:c,totalPrice:s,invoiceContent:{photoUrl:l,text:i,title:d},checkoutInfo:g,currency:h}))))}))},,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(8),c=a(57);const s={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 r(e){const t=s[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(9),s=a(2),r=a(17),o=a(16),l=a(21),i=a(112),d=a(20);a(154);const m={type:"blob",quality:.8,format:"jpeg",circle:!1};let u,b,h;var g=Object(n.h)(({file:e,onChange:t,onClose:c})=>{const[g,p]=Object(n.r)(!1);Object(n.n)(()=>{e&&(g?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:a,offsetHeight:n}=t;h=new u(t,{enableZoom:!0,boundary:{width:a,height:n},viewport:{width:a-16,height:n-16,type:"circle"}});const c=await Object(r.a)(e);await h.bind({url:c})}catch(e){s.r&&console.error(e)}}(e):async function(){return b||(b=Promise.all([a.e(6),a.e(8)]).then(a.bind(null,326)),u=(await b).default),b}().then(()=>p(!0)))},[e,g]);const v=Object(o.a)();return n.a.createElement(i.a,{isOpen:Boolean(e),onClose:c,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},g?n.a.createElement("div",{id:"avatar-crop"}):n.a.createElement(d.a,null),n.a.createElement(l.a,{className:"confirm-button",round:!0,color:"primary",onClick:async function(){if(!h)return;const e=await h.result(m),a="string"==typeof e?e:Object(r.b)(e,"avatar.jpg");t(a)},ariaLabel:v("CropImage")},n.a.createElement("i",{className:"icon-check"})))});a(155);t.a=Object(n.h)(({title:e="Change your profile picture",disabled:t,currentAvatarBlobUrl:a,onChange:s})=>{const[r,o]=Object(n.r)(),[l,i]=Object(n.r)(a);Object(n.n)(()=>{i(a)},[a]);const d=Object(c.a)(l&&"filled",t&&"disabled");return n.a.createElement("div",{className:"AvatarEditable"},n.a.createElement("label",{className:d,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]&&(o(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),n.a.createElement("i",{className:"icon-camera-add"}),l&&n.a.createElement("img",{src:l,alt:"Avatar"})),n.a.createElement(g,{file:r,onClose:function(){o(void 0)},onChange:function(e){o(void 0),s(e),l&&URL.revokeObjectURL(l),i(URL.createObjectURL(e))}}))})},,,,,,,,function(e,t,a){},,,,,,,,function(e,t,a){"use strict";var n=a(0),c=a(2),s=a(6),r=a(130),o=a(119);a(143);const l=[0,50],i=[0,20],d=[20,0],m=s.l?c.Ab:c.zb;t.a=Object(n.h)(({isPasswordVisible:e,isBig:t})=>{const[a,s]=Object(n.r)(),[u,b]=Object(n.r)(),[h,g]=Object(n.r)(!1),[p,v]=Object(n.r)(!1);Object(n.n)(()=>{a?setTimeout(()=>v(!0),2e3):Object(r.a)("MonkeyClose").then(s)},[a]),Object(n.n)(()=>{u||Object(r.a)("MonkeyPeek").then(b)},[u]);const O=Object(n.m)(()=>g(!0),[]);return n.a.createElement("div",{id:"monkey",className:t?"big":""},!h&&n.a.createElement("div",{className:"monkey-preview"}),a&&n.a.createElement(o.a,{id:"closeMonkey",size:t?c.Lb:m,className:p?"hidden":"shown",animationData:a,playSegment:l,noLoop:!0,onLoad:O}),u&&n.a.createElement(o.a,{id:"peekMonkey",size:t?c.Lb:m,className:p?"shown":"hidden",animationData:u,playSegment:e?i:d,noLoop:!0}))})},function(e,t,a){"use strict";var n=a(0),c=a(2),s=a(6),r=a(9),o=a(16),l=a(21);const i=s.l?550:400;t.a=Object(n.h)(({isLoading:e=!1,isPasswordVisible:t,error:a,hint:d,placeholder:m="Password",submitLabel:u="Next",clearError:b,onChangePasswordVisibility:h,onInputChange:g,onSubmit:p})=>{const v=Object(n.q)(null),O=Object(o.a)(),[E,f]=Object(n.r)(""),[j,C]=Object(n.r)(!1);return Object(n.n)(()=>{s.n||setTimeout(()=>{v.current.focus()},i)},[]),Object(n.n)(()=>{a&&requestAnimationFrame(()=>{v.current.focus(),v.current.select()})},[a]),n.a.createElement("form",{action:"",onSubmit:function(t){t.preventDefault(),e||j&&p(E)},autoComplete:"off"},n.a.createElement("div",{className:Object(r.a)("input-group password-input",E&&"touched",a&&"error"),dir:O.isRtl?"rtl":void 0},n.a.createElement("input",{ref:v,className:"form-control",type:t?"text":"password",id:"sign-in-password",value:E||"",autoComplete:"current-password",onChange:function(e){a&&b();const{target:t}=e;f(t.value),C(t.value.length>=c.gb),g&&g(t.value)},dir:"auto"}),n.a.createElement("label",null,a||d||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"}))),j&&n.a.createElement(l.a,{type:"submit",ripple:!0,isLoading:e},u))})},,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){},function(e,t,a){}])]);
//# sourceMappingURL=3.4fb864b3e2b33dcf0b8a.js.map