2 lines
349 KiB
JavaScript
2 lines
349 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[3779],{90066:(e,t,n)=>{n.r(t),n.d(t,{ArchivedChats:()=>As,AttachmentModal:()=>No,BotAttachModal:()=>gt,BotCommandMenu:()=>al,BotCommandTooltip:()=>nl,BotTrustModal:()=>Pt,CalendarModal:()=>it,ChatFolderModal:()=>Ls,ContactList:()=>Ss,ContextMenuContainer:()=>eo,CustomSendMenu:()=>ol,DeleteMessageModal:()=>pt,Dialogs:()=>Ke,DropArea:()=>ll.Z,EmojiInteractionAnimation:()=>At,EmojiTooltip:()=>cl,ForwardPicker:()=>He,GifSearch:()=>Il,HeaderMenuContainer:()=>oo,HistoryCalendar:()=>ct,InlineBotTooltip:()=>Pl,LeftSearch:()=>bn,Management:()=>Cr,MediaViewer:()=>Fe,MentionTooltip:()=>Io,MessageSelectToolbar:()=>yt,MessageStatistics:()=>Gl,MobileSearch:()=>io,NewChat:()=>Ms,NewChatStep1:()=>Ns,NewChatStep2:()=>ks,NewContactModal:()=>ut,Notifications:()=>Qe,PaymentModal:()=>Jr,PinMessageModal:()=>Et,PollModal:()=>wo,PollResults:()=>Jl,ReactorListModal:()=>wt,ReceiptModal:()=>Yr,RightSearch:()=>El,SafeLinkModal:()=>nt,SeenByModal:()=>St,SendAsMenu:()=>gl,Settings:()=>ys,Statistics:()=>xl,StickerSearch:()=>bl,StickerSetModal:()=>no,StickerTooltip:()=>sl,SymbolMenu:()=>el,TextFormatter:()=>rl.Z,UnpinAllMessagesModal:()=>Ct,WebAppModal:()=>Zt});var a=n(14050),s=n(6137),o=n(91713),l=n(33555),r=n(75806),i=n(11192),c=n(10396),d=n(23989),m=n(77361),u=n(83716),h=n(74399),v=n(43858),Z=n(3858),P=n(55254);function g(e,t){const n=document.createElement("div");n.classList.add("ghost");const a=new Image;if(a.draggable=!1,a.oncontextmenu=Z.Z,"string"==typeof e?a.src=e:e instanceof HTMLVideoElement?a.src=e.poster:a.src=e.src,n.appendChild(a),t===o.bZ.ProfileAvatar||t===o.bZ.SettingsAvatar){n.classList.add("ProfileInfo"),t===o.bZ.SettingsAvatar&&n.classList.add("self");const e=document.querySelector(t===o.bZ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&n.appendChild(e.cloneNode(!0))}return n}function p(e,t){const n=document.querySelector(".Transition__slide--active > .MessageList");let a=e.offsetTop+t.closest(".content-inner, .WebPage").offsetTop;return e.id.includes("album-media-")&&(a+=e.parentElement.offsetTop+e.closest(".Message").offsetTop),a>n.scrollTop&&a+t.offsetHeight<n.scrollTop+n.offsetHeight}function E(e,t){Object.assign(e.style,t)}function C(e,t){let n,a;switch(e){case o.bZ.Album:case o.bZ.ScheduledAlbum:n=`.Transition__slide--active > .MessageList #album-media-${(0,r.d0)(t.id)}`,a=".full-media";break;case o.bZ.SharedMedia:n=`#shared-media${(0,r.d0)(t.id)}`,a="img";break;case o.bZ.SearchResult:n=`#search-media${(0,r.d0)(t.id)}`,a="img";break;case o.bZ.MiddleHeaderAvatar:n=".MiddleHeader .Transition__slide--active .ChatInfo .Avatar",a=".avatar-media";break;case o.bZ.SettingsAvatar:n="#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto",a=".avatar-media";break;case o.bZ.ProfileAvatar:n="#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto",a=".avatar-media";break;case o.bZ.ScheduledInline:case o.bZ.Inline:default:n=`.Transition__slide--active > .MessageList #${(0,r.d0)(t.id)}`,a=".message-content .full-media, .message-content .thumbnail"}const s=document.querySelector(n),l=s&&s.querySelectorAll(a);return{container:s,mediaEl:null==l?void 0:l[l.length-1]}}function f(e,t){switch(t){case o.bZ.Album:case o.bZ.ScheduledAlbum:case o.bZ.Inline:case o.bZ.ScheduledInline:e.classList.add("rounded-corners");break;case o.bZ.SharedMedia:case o.bZ.SettingsAvatar:case o.bZ.ProfileAvatar:case o.bZ.SearchResult:e.firstChild.style.objectFit="cover";break;case o.bZ.MiddleHeaderAvatar:e.classList.add("circle")}}var b=n(996),I=n(96264),y=n(29290),S=n(71394),N=n(65326);const k=new Map;function w(e){const t=(0,a.sO)();let n=!1;(0,y.Z)((()=>{if(n=!0,t.current=void 0,!e)return;const a=new Image;if(a.src=e,!a.width)return;const s=(0,S.ao)(a);(0,I.Z)(s.getContext("2d"),0,0,s.width,s.height,2,2),t.current=s.toDataURL()}),[e]);const s=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;const s=(0,a.sO)(e?k.get(e):void 0),o=(0,a.sO)(),l=(0,N.Z)();return o.current&&t&&(clearTimeout(o.current),o.current=void 0),(0,a.d4)((()=>{if(!e||s.current||t)return;const a=new Image;a.onload=()=>{const t=(0,S.ao)(a);(0,I.Z)(t.getContext("2d"),0,0,t.width,t.height,2,2);const n=t.toDataURL();s.current=n,l(),k.size>=1e3&&k.clear(),k.set(e,n)},n?o.current=window.setTimeout((()=>{a.src=e}),n):a.src=e}),[e,n,l,t]),s.current}(e||void 0,Boolean(t.current));return t.current||!n&&s||e||void 0}var M=n(60706),T=n(18674),A=n(46590),R=n(59107),L=n(6202),F=n(92566),B=n(87204),x=n(66534),D=n(231),$=n(40126),O=n(2255),_=n(53106),U=n(58964),G=n(39196);const X=(0,a.X$)((0,l.c$)(((e,t)=>{let{message:n}=t;return{isDownloading:!!n&&(0,i.te)(e,n),isProtected:(0,i.EV)(e,n)}}))((e=>{let{mediaData:t,isVideo:n,message:s,fileName:o,isAvatar:i,isDownloading:c,isProtected:d,canReport:u,onReport:h,onCloseMediaViewer:v,zoomLevelChange:Z,setZoomLevelChange:P,onForward:g}=e;const{downloadMessageMedia:p,cancelMessageMediaDownload:E}=(0,l.Sv)(),{loadProgress:C}=(0,F.Z)(s&&(0,r.Ti)(s,"download"),!c),f=(0,a.I4)((()=>{c?E({message:s}):p({message:s})}),[E,p,c,s]),b=(0,a.I4)((()=>{P((Z<0?Z:0)-1)}),[P,Z]),I=(0,a.I4)((()=>{P((Z>0?Z:0)+1)}),[P,Z]),y=(0,R.Z)(),S=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",className:n?"active":void 0,onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]);if(m.wB){if(d)return;return a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(_.Z,{trigger:S,positionX:"right"},!i&&a.ZP.createElement(U.Z,{icon:"forward",onClick:g},y("Forward")),n?a.ZP.createElement(U.Z,{icon:c?"close":"download",onClick:f},c?`${Math.round(100*C)}% Downloading...`:"Download"):a.ZP.createElement(U.Z,{icon:"download",href:t,download:o},y("AccActionDownload")),u&&a.ZP.createElement(U.Z,{icon:"flag",onClick:h},y("ReportPeer.Report"))),c&&a.ZP.createElement(G.Z,{progress:C,size:"s",noCross:!0}))}return a.ZP.createElement("div",{className:"MediaViewerActions"},!i&&!d&&a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("Forward"),onClick:g},a.ZP.createElement("i",{className:"icon-forward"})),function(){if(!d)return n?a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("AccActionDownload"),onClick:f},c?a.ZP.createElement(G.Z,{progress:C,size:"s",onClick:f}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement(D.Z,{href:t,download:o,round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"}))}(),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("MediaZoomOut"),onClick:b},a.ZP.createElement("i",{className:"icon-zoom-out"})),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("MediaZoomIn"),onClick:I},a.ZP.createElement("i",{className:"icon-zoom-in"})),u&&a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y(n?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:h},a.ZP.createElement("i",{className:"icon-flag"})),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("Close"),onClick:v},a.ZP.createElement("i",{className:"icon-close"})))})));var J=n(9933),z=n(275),V=n(46752),Y=n(71174),H=n(28712),q=n(69118),j=n(67360),K=n(28183),W=n(12255),Q=n(49204);const ee=e=>{let{text:t="",isHidden:n,isForVideo:s,onClick:o}=e;const[l,r]=(0,a.eJ)(!1);(0,a.d4)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;r(t>2*h.Gw)};t();const n=(0,q.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const i=(0,V.Z)("MediaViewerFooter",s&&"is-for-video",n&&"is-hidden");return a.ZP.createElement("div",{className:i,onClick:function(e){t&&e.stopPropagation()}},t&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:m.wB?void 0:o},a.ZP.createElement("p",{className:"media-text custom-scroll "+(l?"multiline":""),dir:"auto"},t)))};var te=n(12019);const ne=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var ae=n(31212),se=n(46898),oe=n(74753),le=n(790);const re=["bytes","kB","MB","GB","TB","PB"],ie=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${re[t]}`};var ce=n(18051),de=n(52328);const me=e=>{e.stopPropagation()},ue=[.5,1,1.5,2],he=e=>{let{bufferedRanges:t,bufferedProgress:n,currentTime:s,duration:o,fileSize:l,isForceMobileVersion:r,isPlayed:i,isFullscreenSupported:c,isFullscreen:d,isVisible:u,isBuffered:h,volume:v,isMuted:Z,playbackRate:P,onChangeFullscreen:g,onVolumeClick:p,onVolumeChange:E,onPlaybackRateChange:C,onPlayPause:f,setVisibility:b,onSeek:I}=e;const[y,S,N]=(0,M.Z)(),k=(0,a.sO)(null),w=(0,a.sO)(!1),T=w.current;(0,a.d4)((()=>{let e;if(u&&i&&!T&&!y)return e=window.setTimeout((()=>{b(!1)}),1500),()=>{e&&window.clearTimeout(e)};e&&window.clearTimeout(e)}),[i,u,T,b,y]),(0,a.d4)((()=>(u?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[u]),(0,a.d4)((()=>{u||N()}),[N,u]);const A=(0,R.Z)(),L=(0,a.I4)((e=>{if(w.current&&k.current){const{width:t,left:n}=k.current.getBoundingClientRect(),a=e instanceof MouseEvent?e.clientX:e.targetTouches[0].clientX;I(Math.max(Math.min(o*((a-n)/t),o),0))}}),[o,I]),F=(0,a.I4)((e=>{w.current=!0,L(e)}),[L]),B=(0,a.I4)((()=>{w.current=!1}),[]);(0,a.d4)((()=>{if(k.current&&u)return(0,Y.sf)(k.current,{onCapture:F,onRelease:B,onClick:B,onDrag:L})}),[u,F,L,B]);const x=(0,a.Ye)((()=>0===v||Z?"icon-muted":v<.3?"icon-volume-1":v<.6?"icon-volume-2":"icon-volume-3"),[v,Z]);return a.ZP.createElement("div",{className:(0,V.Z)("VideoPlayerControls",r&&"mobile",u&&"active"),onClick:me},function(e,t,n,s){const o=e/t*100;return a.ZP.createElement("div",{className:"player-seekline",ref:s},a.ZP.createElement("div",{className:"player-seekline-track"},n.map((e=>{let{start:t,end:n}=e;return a.ZP.createElement("div",{className:"player-seekline-buffered",style:`left: ${100*t}%; right: ${100-100*n}%`})})),a.ZP.createElement("div",{className:"player-seekline-played",style:`width: ${o||0}%`})))}(s,o,t,k),a.ZP.createElement("div",{className:"buttons"},a.ZP.createElement(D.Z,{ariaLabel:A("AccActionPlay"),size:"tiny",ripple:!m.wB,color:"translucent-white",className:"play",round:!0,onClick:f},a.ZP.createElement("i",{className:i?"icon-pause":"icon-play"})),a.ZP.createElement(D.Z,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:p},a.ZP.createElement("i",{className:x})),!m.cj&&a.ZP.createElement(ce.Z,{bold:!0,className:"volume-slider",value:Z?0:100*v,onChange:E}),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,le.k9)(e)} / ${(0,le.k9)(t)}`)}(s,o),!h&&($=n,O=l,a.ZP.createElement("div",{className:"player-file-size"},`${ie(O*$)} / ${ie(O)}`)),a.ZP.createElement("div",{className:"spacer"}),a.ZP.createElement(D.Z,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:S},`${P}x`),c&&a.ZP.createElement(D.Z,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:g},a.ZP.createElement("i",{className:d?"icon-smallscreen":"icon-fullscreen"}))),a.ZP.createElement(de.Z,{isOpen:y,className:"playback-rate-menu",positionX:"right",positionY:"bottom",autoClose:!0,onClose:N},ue.map((e=>a.ZP.createElement(U.Z,{disabled:P===e,onClick:()=>C(e)},`${e}x`)))));var $,O};function ve(){return ve=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ve.apply(this,arguments)}const Ze=(0,a.X$)((e=>{let{url:t,isGif:n,posterData:s,posterSize:o,loadProgress:r,fileSize:i,isMediaViewerOpen:c,noPlay:d,volume:u,isMuted:h,playbackRate:v,onClose:Z,toggleControls:P,areControlsVisible:g}=e;const{setMediaViewerVolume:p,setMediaViewerMuted:E,setMediaViewerPlaybackRate:C}=(0,l.Sv)(),f=(0,a.sO)(null),[b,I]=(0,a.eJ)(!m.$b||!m.cj),[y,S]=(0,a.eJ)(0),[N,k,w]=function(e,t){const[n,s]=(0,a.eJ)(Boolean(ne&&document[ne]));return(0,a.bt)((()=>{const n=()=>{s(Boolean(ne&&document[ne]))},a=()=>{s(!0)},o=()=>{s(!1),t(!1)},l=e.current;return document.addEventListener("fullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),l&&(l.addEventListener("webkitbeginfullscreen",a,!1),l.addEventListener("webkitendfullscreen",o,!1)),()=>{document.removeEventListener("fullscreenchange",n,!1),document.removeEventListener("webkitfullscreenchange",n,!1),document.removeEventListener("mozfullscreenchange",n,!1),l&&(l.removeEventListener("webkitbeginfullscreen",a,!1),l.removeEventListener("webkitendfullscreen",o,!1))}}),[]),ne||"iOS"===m.Lt?[n,()=>{e.current&&(ne||"iOS"===m.Lt)&&(e.current.requestFullscreen?e.current.requestFullscreen():e.current.webkitRequestFullscreen?e.current.webkitRequestFullscreen():e.current.webkitEnterFullscreen?e.current.webkitEnterFullscreen():e.current.mozRequestFullScreen&&e.current.mozRequestFullScreen(),s(!0))},()=>{e.current&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),s(!1))}]:[!1]}(f,I),{isBuffered:M,bufferedRanges:T,bufferingHandlers:A,bufferedProgress:R}=(0,te.Z)(),{shouldRender:L,transitionClassNames:F}=(0,ae.Z)(!M,void 0,void 0,"slow"),{shouldRender:B,transitionClassNames:x}=(0,ae.Z)(m.cj&&!b&&!L,void 0,void 0,"slow");(0,a.d4)((()=>{d||!c?f.current.pause():t&&!m.$b&&(0,oe.Z)(f.current)}),[d,c,t]),(0,a.d4)((()=>{f.current.currentTime===f.current.duration?(S(0),I(!1)):S(f.current.currentTime)}),[y]),(0,a.d4)((()=>{f.current.volume=u}),[u]),(0,a.d4)((()=>{f.current.playbackRate=v}),[v]);const $=(0,a.I4)((e=>{e.stopPropagation(),b?(f.current.pause(),I(!1)):((0,oe.Z)(f.current),I(!0))}),[b]);(0,se.Z)(f,[]);const O=(0,a.I4)((()=>{P(!0)}),[P]),_=(0,a.I4)((e=>{e.target===f.current&&P(!1)}),[P]),U=(0,a.I4)((e=>{S(e.currentTarget.currentTime)}),[]),X=(0,a.I4)((()=>{S(0),I(!1),P(!0)}),[P]),J=(0,a.I4)((()=>{N&&w?w():!N&&k&&k()}),[w,N,k]),z=(0,a.I4)((e=>{f.current.currentTime=e}),[]),V=(0,a.I4)((e=>{p({volume:e/100})}),[p]),Y=(0,a.I4)((()=>{E({isMuted:!h})}),[h,E]),H=(0,a.I4)((e=>{C({playbackRate:e})}),[C]);(0,a.d4)((()=>{if(!c)return;const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),$(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[$,c]);const q=o&&`width: ${o.width}px; height: ${o.height}px`,j=`background-image: url(${s})`;return a.ZP.createElement("div",{className:"VideoPlayer",onMouseMove:n||m.$b?void 0:O,onMouseOut:n||m.$b?void 0:_},a.ZP.createElement("div",{style:q},a.ZP.createElement("video",ve({ref:f,autoPlay:m.$b,playsInline:!0,loop:n,muted:n||h,id:"media-viewer-video",style:j,onPlay:m.cj?()=>I(!0):void 0,onEnded:X,onClick:m.wB?void 0:$,onDoubleClick:m.$b?void 0:J},A,{onTimeUpdate:U}),t&&a.ZP.createElement("source",{src:t}))),B&&a.ZP.createElement(D.Z,{round:!0,className:`play-button ${x}`,onClick:$},a.ZP.createElement("i",{className:"icon-play"})),L&&a.ZP.createElement("div",{className:["spinner-container",F].join(" ")},!M&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement(G.Z,{size:"xl",progress:M?1:r,square:!0,onClick:Z})),!n&&!L&&a.ZP.createElement(he,{isPlayed:b,bufferedRanges:T,bufferedProgress:R,isBuffered:M,currentTime:y,isFullscreenSupported:Boolean(k),isFullscreen:N,fileSize:i,duration:f.current&&f.current.duration||0,isVisible:g,setVisibility:P,isForceMobileVersion:o&&o.width<400,onSeek:z,onChangeFullscreen:J,onPlayPause:$,volume:u,playbackRate:v,isMuted:h,onVolumeClick:Y,onVolumeChange:V,onPlaybackRateChange:H}))})),Pe=(0,a.X$)((0,l.c$)(((e,t)=>{const{chatId:n,threadId:a,messageId:s,avatarOwnerId:l,profilePhotoIndex:r,origin:c}=t,{volume:d,isMuted:m,playbackRate:u}=e.mediaViewer;if(c===o.bZ.SearchResult){if(!n||!s)return{volume:d,isMuted:m,playbackRate:u};const t=(0,i.hj)(e,n,s);return t?{chatId:n,messageId:s,senderId:t.senderId,origin:c,message:t,isProtected:(0,i.EV)(e,t),volume:d,isMuted:m,playbackRate:u}:{volume:d,isMuted:m,playbackRate:u}}if(l)return{messageId:-1,senderId:l,avatarOwner:(0,i.dy)(e,l)||(0,i.Z1)(e,l),profilePhotoIndex:r||0,origin:c,volume:d,isMuted:m,playbackRate:u};if(!(n&&a&&s))return{volume:d,isMuted:m,playbackRate:u};let h;return h=c&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(c)?(0,i.Tm)(e,n,s):(0,i.hj)(e,n,s),h?{chatId:n,threadId:a,messageId:s,senderId:h.senderId,origin:c,message:h,isProtected:(0,i.EV)(e,h),volume:d,isMuted:m,playbackRate:u}:{volume:d,isMuted:m,playbackRate:u}}))((e=>{const{messageId:t,isActive:n,avatarOwner:l,chatId:i,message:c,profilePhotoIndex:d,origin:u,animationLevel:v,isFooterHidden:P,isProtected:g,volume:p,playbackRate:E,isMuted:C,onClose:f,onFooterClick:I,setIsFooterHidden:y}=e,S=c?(0,r.O$)(c):void 0,N=c?(0,r.b7)(c):void 0,k=c?(0,r.F$)(c):void 0,M=c?(0,r.Cg)(c):void 0,T=!!c&&(0,r.rl)(c),A=!!c&&(0,r.hC)(c),R=Boolean(N||M||A),B=Boolean(!R&&(S||k||T)),{isGif:x}=N||M||{},D=Boolean(l||t),$=Boolean(l),O=u===o.bZ.SharedMedia,_=u===o.bZ.SearchResult,U=2===v;function G(e){if($&&void 0!==d){const{photos:t}=l;return t&&t[d]?`photo${t[d].id}?size=c`:(0,r.RT)(l,e?"big":"normal")}return c&&(0,r.Ti)(c,e?"viewerFull":"viewerPreview")}const X=(0,L.Z)(c&&(O||_)&&(0,r.Ti)(c,"pictogram"),void 0,s.IU.BlobUrl,void 0,U&&350),J=G(),z=(0,L.Z)(J,void 0,s.IU.BlobUrl,void 0,U&&350),{mediaData:V,loadProgress:Y}=(0,F.Z)(G(!0),void 0,c&&(0,r.kG)(c,"viewerFull"),void 0,U&&350),H=(0,a.I4)((e=>{null==y||y(!e)}),[y]),q=S||N?(S||N).blobUrl:void 0;let j=!R&&(q||V)||z||X;const K=w(!j&&c&&(0,r.DH)(c));j||u===o.bZ.SearchResult||(j=K);const W=c?(0,r.c0)(c):void 0;let te;if(c?T||A?te=(0,r.aE)(c).mediaSize:S||k?te=(0,r.bV)(S||k):(N||M)&&(te=(0,r.jC)(N||M)):te=h.vY,$)return a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},ge(V||z,(0,h.PA)(h.vY,!1),!m.wB&&!g));if(!c)return;const ne=(0,b.X)(c),ae=Boolean(ne);return a.ZP.createElement("div",{className:"MediaViewerContent "+(ae?"has-footer":"")},g&&a.ZP.createElement("div",{onContextMenu:Z.Z,className:"protector"}),B&&ge(q||V||z||X,c&&(0,h.PA)(te,ae),!m.wB&&!g),R&&(!n&&m.$b?function(e,t,n){const s=t&&`width: ${t.width}px; height: ${t.height}px`,o=`background-image: url(${e})`;return e?a.ZP.createElement("div",{className:"VideoPlayer"},a.ZP.createElement("div",{style:s},a.ZP.createElement("video",{style:o,draggable:Boolean(n)}))):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(Q.Z,{color:"white"}))}(j,c&&(0,h.PA)(te,ae,!0),!m.wB&&!g):a.ZP.createElement(Ze,{key:t,url:q||V,isGif:x,posterData:j,posterSize:c&&(0,h.PA)(te,ae,!0),loadProgress:Y,fileSize:W,isMediaViewerOpen:D&&n,areControlsVisible:!P,toggleControls:H,noPlay:!n,onClose:f,isMuted:C,volume:p,playbackRate:E})),ne&&a.ZP.createElement(ee,{text:ne,onClick:I,isHidden:P,isForVideo:R&&!x}))})));function ge(e,t,n){return e?a.ZP.createElement("img",{src:e,alt:"",style:t?`width: ${t.width}px`:"",draggable:Boolean(n)}):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(Q.Z,{color:"white"}))}function pe(){return pe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},pe.apply(this,arguments)}const{easeOutCubic:Ee,easeOutQuart:Ce}=J.M8,fe=m.$b?40:0,be=350;let Ie,ye;var Se;!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(Se||(Se={}));const Ne=(0,a.X$)((e=>{let{messageId:t,getMessageId:n,selectMessage:s,isVideo:o,isGif:l,isPhoto:r,isOpen:i,isActive:c,hasFooter:d,zoomLevelChange:u,animationLevel:h,...v}=e;const Z=(0,a.sO)(null),P=(0,a.sO)(null),g=(0,a.sO)({x:0,y:0,scale:1}),p=(0,a.sO)({x:0,y:0,scale:1}),E=(0,a.sO)(void 0),C=(0,a.sO)(!0),[f,b]=(0,a.eJ)(t),I=(0,B.Z)(u),y=void 0!==I&&I!==u,S=(0,N.Z)(),[k,w]=(0,a.eJ)(!0),[M,T]=(0,a.eJ)(!1),{height:A,width:L,isResizing:F}=(0,W.Z)(),{onClose:x}=v,D=(0,R.Z)(),$=(0,a.I4)((e=>{g.current=e,S()}),[S]),O=(0,j.Z)(s,[],350,!0),_=(0,j.Z)((()=>{E.current=void 0}),[],500,!0),U=(0,j.Z)((e=>{C.current=e,S()}),[S],800,!0),G=l&&!m.cj,X=m.$b?40:L/10,Q=(0,a.I4)((e=>{if(!m.$b)return;const t=A-e.pageY<80;!t&&e.pageX<X||!t&&e.pageX>L-X||w(!k)}),[X,k,A,L]);if((0,K.Z)((()=>w(!1)),200),(0,a.d4)((()=>{if(!Z.current||!f)return;let e=p.current;const t={x:0,y:0},a={x:0,y:0},s={x:0,y:0};let o,l,r=Date.now();const i=(0,q.Ds)((()=>{r=Date.now()}),500,!1,!0),c=t=>{const a=n(f,t);if(a){const n=(L+fe)*t;return g.current.x+=n,C.current=!1,b(a),O(a),U(!0),e={x:0,y:0,scale:1},0===h?($(e),!0):(Ie=(0,J.vr)({from:g.current.x,to:0,duration:be,timing:Ee,onUpdate:e=>$({y:0,x:e,scale:1})}),!0)}return!1},d=e=>{if(1!==g.current.scale)return[!1,!1];let t=0;return A-e.pageY<80?[!1,!1]:(e.pageX<X?t=-1:e.pageX>L-X&&(t=1),[0!==t,c(t)])},u=e=>{if(1===g.current.scale)switch(e.key){case"Left":case"ArrowLeft":c(-1);break;case"Right":case"ArrowRight":c(1)}},v=function(e){let{x:t,y:n,scale:a}=e,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!o)return[{x:t,y:n,scale:a},!0,!0];let l=!0,r=!0;const i=(L-L*a)/2,c=(A-A*a)/2,d=Math.max(-o.left*a,i),m=L-o.right*a;l=(0,H.Kh)(t,m,d),t=(0,H.uZ)(t,m,d);const u=Math.max(-o.top*a+s,c),h=A-o.bottom*a;return r=(0,H.Kh)(n,h,u),n=(0,H.uZ)(n,h,u),[{x:t,y:n,scale:a},l,r]},I=(0,Y.sf)(Z.current,{isNotPassive:!0,withNativeDrag:!0,excludedClosestSelector:".MediaViewerFooter, .ZoomControls",minZoom:1,maxZoom:4,doubleTapZoom:3,onCapture:e=>{if(!Me(e))if("mousedown"!==e.type||(T(!0),1===g.current.scale)){if(r=Date.now(),(0,z.Z)(g.current,{x:0,y:0,scale:1})){if(!P.current)return;if(l=P.current.querySelector("img, video"),!l)return;o=l.getBoundingClientRect()}}else e.preventDefault()},onDrag:(n,a,o,l)=>{let{dragOffsetX:r,dragOffsetY:c}=o;if(Me(n))return;if(m.cj&&"touchstart"===a.type){const{pageX:e}=a.touches[0];if(e<=Y.vJ||e>=L-Y.vJ)return}Ie&&(Ie(),Ie=void 0),s.x=t.x-r,s.y=t.y-c,t.x=r,t.y=c;const d=Math.abs(r),u=Math.abs(c),{scale:h,x:Z,y:P}=g.current,p=10;if(i(),1===h){if(!["wheel","mousemove"].includes(n.type))if(E.current!==Se.Vertical&&(E.current===Se.Horizontal||Math.abs(Z)>p||d>p&&u<p)){E.current=Se.Horizontal,C.current=!1;const e=L+fe;$({x:(0,H.uZ)(r,-e,e),y:0,scale:h})}else if(E.current===Se.Vertical||Math.abs(P)>p||u>p&&d<p){E.current=Se.Vertical;const e=A;$({x:0,y:(0,H.uZ)(c,-e,e),scale:h})}}else{const t=e.x+r,a=e.y+c;if(["wheel","mousemove"].includes(n.type)){const[e,n,s]=v({x:t,y:a,scale:h},60);return l&&l(!n,!s),void $(e)}"touches"in n&&1===n.touches.length&&$({x:t,y:a,scale:h})}},onZoom:(t,n)=>{let{zoom:s,zoomFactor:o,initialCenterX:l,initialCenterY:r,dragOffsetX:i,dragOffsetY:c,currentCenterX:d,currentCenterY:m}=n;Ie&&Ie(),l=l||L/2,r=r||A/2,d=d||L/2,m=m||A/2;const u=null!=s?s:(0,H.uZ)(e.scale*o,.5,12),h=u/e.scale,Z=Math.abs(Math.min(e.x,0)),P=Math.abs(Math.min(e.y,0));a.x=d,a.y=m;const g=Z+l,p=P+r,E=g-h*g,C=p-h*p,[f]=v({x:e.x+E+i,y:e.y+C+c,scale:u});$(f)},onClick(t){const[n,a]=d(t);if(n){if(t.preventDefault(),t.stopPropagation(),m.$b)return;a||x()}else 1!==e.scale||m.$b||!G&&we(t.target,".VideoPlayer")||x()},onDoubleClick(t,n){let{centerX:a,centerY:s}=n;const[o]=d(t);if(o)return t.preventDefault(),void t.stopPropagation();if(!m.$b&&"wheel"!==t.type)return;const l=a-3*a,r=s-3*s,{scale:i,x:c,y:u}=g.current;if(1===i){if(0!==c||0!==u)return;e=v({x:l,y:r,scale:3})[0]}else e={x:0,y:0,scale:1};Ie=(0,J.vr)({from:[c,u,i],to:[e.x,e.y,e.scale],duration:be,timing:Ee,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};$(t)}})},onRelease:o=>{"mouseup"===o.type&&T(!1);const l=Math.abs(g.current.x),i=Math.abs(g.current.y),{scale:c,x:d,y:m}=g.current;if(_(),U(!0),c<1)return e={x:0,y:0,scale:1},void(Ie=(0,J.vr)({from:[d,m,c],to:[0,0,1],duration:be,timing:Ee,onUpdate:e=>$({x:e[0],y:e[1],scale:e[2]})}));if(c>1){const n=Math.min(c,4),l=n/c;let i=d*l+(a.x-l*a.x),u=m*l+(a.y-l*a.y);const h=.15;if("wheel"!==o.type&&e.scale===c){const e=Math.abs(t.x)/(Date.now()-r),n=Math.abs(t.y)/(Date.now()-r);i-=Math.abs(t.x)*e*h*s.x,u-=Math.abs(t.y)*n*h*s.y}return[e]=v({x:i,y:u,scale:n},60),void(Ie=(0,J.vr)({from:[d,m,c],to:[e.x,e.y,e.scale],duration:be,timing:Ee,onUpdate:e=>$({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:d,y:m,scale:c},"wheel"!==o.type&&i>=50)return x();if(i>0)return void(Ie=(0,J.vr)({from:m,to:0,duration:be,timing:Ee,onUpdate:e=>$({x:0,y:e,scale:c})}));const u=d<0?1:-1,h=n(f,d<0?1:-1),Z=s.x<0?-1:1;if(h&&l>=50&&u===Z){const e=(L+fe)*u;g.current.x+=e,b(h),O(h)}Ie=(0,J.vr)({from:g.current.x,to:0,duration:be,timing:Ee,onUpdate:e=>$({y:0,x:e,scale:g.current.scale})})}});return document.addEventListener("keydown",u,!1),()=>{I(),document.removeEventListener("keydown",u,!1)}}),[x,$,n,f,L,A,X,G,O,U,_,h,T]),(0,a.d4)((()=>{if(!Z.current||!y)return;const{scale:e}=g.current,t=u>0?-1:1;let n=0;e<=.5&&t>0||e>=12&&t<0||(ye&&ye(),ye=(0,J.vr)({from:t,to:100*t,duration:be,timing:Ce,onUpdate:e=>{if(!Z.current)return;const t=(0,H.NM)(e-n,2);n=e;const a=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});Z.current.dispatchEvent(a)}}))}),[u,y]),!f)return;const ee=n(f,1),te=n(f,-1),ne=g.current.x,ae=g.current.y,{scale:se}=g.current;return a.ZP.createElement("div",{className:"MediaViewerSlides",ref:Z},te&&1===se&&!F&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:ke(-L+ne-fe)},a.ZP.createElement(Pe,pe({},v,{animationLevel:h,isFooterHidden:k,messageId:te}))),f&&a.ZP.createElement("div",{className:(0,V.Z)("MediaViewerSlide",c&&"MediaViewerSlide--active",M&&se>1&&"MediaViewerSlide--moving"),onClick:Q,ref:P,style:ke(ne,ae,se)},a.ZP.createElement(Pe,pe({},v,{messageId:f,animationLevel:h,isActive:c&&C.current,setIsFooterHidden:w,isFooterHidden:k||1!==se}))),ee&&1===se&&!F&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:ke(L+ne+fe)},a.ZP.createElement(Pe,pe({},v,{animationLevel:h,isFooterHidden:k,messageId:ee}))),te&&1===se&&!m.$b&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${o&&!l&&"inline"}`,"aria-label":D("AccDescrPrevious"),dir:D.isRtl?"rtl":void 0}),ee&&1===se&&!m.$b&&a.ZP.createElement("button",{type:"button",className:`navigation next ${o&&!l&&"inline"}`,"aria-label":D("Next"),dir:D.isRtl?"rtl":void 0}))}));function ke(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return`transform: translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${n.toFixed(3)});`}function we(e,t){return!!e&&(!!e.matches(t)||Boolean(e.closest(t)))}function Me(e){const t=e.target;return!!we(t,".VideoPlayerControls")&&(we(t,".play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu")||e.preventDefault(),!0)}var Te=n(32340),Ae=n(70172);const Re=(0,l.c$)(((e,t)=>{let{chatId:n,messageId:a,isAvatar:s}=t;if(s&&n)return{sender:(0,r.YC)(n)?(0,i.dy)(e,n):(0,i.Z1)(e,n)};if(!a||!n)return{};const o=(0,i.hj)(e,n,a);return{message:o,sender:o&&(0,i.Ur)(e,o)}}))((e=>{let{chatId:t,messageId:n,sender:s,isAvatar:o,message:i}=e;const{closeMediaViewer:c,focusMessage:d,toggleChatInfo:u}=(0,l.Sv)(),h=(0,a.I4)((()=>{c(),m.wB?setTimeout((()=>{u(!1,{forceSyncOnIOs:!0}),d({chatId:t,messageId:n})}),350):d({chatId:t,messageId:n})}),[t,d,u,n,c]),v=(0,R.Z)();if(!s||!i&&!o)return;const Z=(0,r.OU)(v,s);return a.ZP.createElement("div",{className:"SenderInfo",onClick:h},(0,r.YC)(s.id)?a.ZP.createElement(Ae.Z,{key:s.id,size:"medium",user:s}):a.ZP.createElement(Ae.Z,{key:s.id,size:"medium",chat:s}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},Z&&(0,Te.Z)(Z)),a.ZP.createElement("div",{className:"date",dir:"auto"},o?v("lng_mediaview_profile_photo"):(0,le.ZK)(v,1e3*i.date,!0))))})),Le=350,Fe=(0,a.X$)((0,l.c$)((e=>{const{chatId:t,threadId:n,messageId:a,avatarOwnerId:s,profilePhotoIndex:l,origin:r}=e.mediaViewer,{animationLevel:c}=e.settings.byKey;let d,m,u,h=!!t&&(0,i.FM)(e,t);if(r===o.bZ.SearchResult){if(!t||!a)return{animationLevel:c};const n=(0,i.hj)(e,t,a);return n?{chatId:t,messageId:a,senderId:n.senderId,isChatWithSelf:h,origin:r,message:n,animationLevel:c}:{animationLevel:c}}if(s){const t=(0,i.dy)(e,s)||(0,i.Z1)(e,s);return h=(0,i.FM)(e,s),{messageId:-1,senderId:s,avatarOwner:t,isChatWithSelf:h,profilePhotoIndex:l||0,animationLevel:c,origin:r}}if(!(t&&n&&a))return{animationLevel:c};if(d=r&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(r)?(0,i.Tm)(e,t,a):(0,i.hj)(e,t,a),!d)return{animationLevel:c};if(m=r&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(r)?(0,i.Fn)(e,t):(0,i.Zw)(e,t),r===o.bZ.Inline||r===o.bZ.Album)u=(0,i.qC)(e,t,n)||(0,i.gb)(e,t,n);else if(r===o.bZ.SharedMedia){const t=(0,i.we)(e),{foundIds:n}=t&&t.resultsByType&&t.resultsByType.media||{};u=n}return{chatId:t,threadId:n,messageId:a,senderId:d.senderId,isChatWithSelf:h,origin:r,message:d,chatMessages:m,collectionIds:u,animationLevel:c}}))((e=>{var t;let{chatId:n,threadId:i,messageId:Z,senderId:I,isChatWithSelf:y,origin:S,avatarOwner:k,profilePhotoIndex:_,message:U,chatMessages:G,collectionIds:J,animationLevel:z}=e;const{openMediaViewer:V,closeMediaViewer:Y,openForwardMenu:H,focusMessage:q,toggleChatInfo:j}=(0,l.Sv)(),K=Boolean(k||Z),W=S===o.bZ.SharedMedia,Q=S===o.bZ.SearchResult,ee=U?(0,r.O$)(U):void 0,te=U?(0,r.b7)(U):void 0,ne=U?(0,r.F$)(U):void 0,ae=U?(0,r.Cg)(U):void 0,se=!!U&&(0,r.rl)(U),oe=!!U&&(0,r.hC)(U),le=Boolean(te||ae||oe),{isGif:re}=te||ae||{},ie=Boolean(!le&&(ee||ne||se)),ce=Boolean(k),de=ne||ae?Z:void 0,me=(0,a.Ye)((()=>de?[de]:(0,r.N0)(G||{},J||[],W)),[de,G,J,W]),ue=Z?me.indexOf(Z):-1,he=(0,a.sO)(),ve=(0,B.Z)(I);!K||ve&&ve===I&&he.current||(he.current=ue);const Ze=2===z?"slide-fade":"none",Pe=2===z,[ge,pe,Ee]=(0,M.Z)(),[Ce,fe]=(0,a.eJ)(1);function be(e){if(ce&&void 0!==_){const{photos:t}=k;return t&&t[_]?`photo${t[_].id}?size=c`:(0,r.RT)(k,e?"big":"normal")}return U&&(0,r.Ti)(U,e?"viewerFull":"viewerPreview")}const Ie=(0,L.Z)(U&&(W||Q)&&(0,r.Ti)(U,"pictogram"),void 0,s.IU.BlobUrl,void 0,Pe&&Le),ye=be(),Se=(0,L.Z)(ye,void 0,s.IU.BlobUrl,void 0,Pe&&Le),{mediaData:ke}=(0,F.Z)(be(!0),void 0,U&&(0,r.kG)(U,"viewerFull"),void 0,Pe&&Le),we=null==k||null===(t=k.photos)||void 0===t?void 0:t[_],Me=!!we&&_>0&&!y,Te=ee||te?(ee||te).blobUrl:void 0;let Ae=!le&&(Te||ke)||Se||Ie;const Fe=w(!Ae&&U&&(0,r.DH)(U));Ae||S===o.bZ.SearchResult||(Ae=Fe);const Be=U?(0,r.ep)(U):ce?`avatar${k.id}-${_}.jpg`:void 0;let xe;U?se||oe?xe=(0,r.aE)(U).mediaSize:ee||ne?xe=(0,r.bV)(ee||ne):(te||ae)&&(xe=(0,r.jC)(te||ae)):xe=h.vY,(0,a.d4)((()=>{m.wB&&document.body.classList.toggle("is-media-viewer-open",K)}),[K]);const De=(0,N.Z)();(0,a.d4)((()=>{const e=window.matchMedia(h.L6);return"function"==typeof e.addEventListener?e.addEventListener("change",De):"function"==typeof e.addListener&&e.addListener(De),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",De):"function"==typeof e.removeListener&&e.removeListener(De)}}),[De]);const $e=(0,B.Z)(U),Oe=(0,B.Z)(S),_e=(0,B.Z)(k),Ue=(0,B.Z)(Ae),Ge=U?(0,b.X)(U):void 0,Xe=Boolean(Ge);(0,a.d4)((()=>{Pe&&K&&!$e&&!_e&&((0,T.YW)(Le+u.fK),function(e,t,n,a,s,l){const{mediaEl:r}=C(t,l);if(!r)return;const{width:i}=v.Z.get(),{width:c,height:d}=(0,h.fM)(e,s),{width:Z,height:P}=(0,h.jg)(c,d,a.width,a.height),p=(i-Z)/2,b=function(e){const t=window.matchMedia(h.L6);let n=4.125;return e&&!m.$b&&(n+=t.matches?.875:2.125),n*h.Gw}(e)+(d-P)/2;let{top:I,left:y,width:S,height:N}=r.getBoundingClientRect();if([o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,o){if(e===t){const l=Math.max(s,o)*(e/t);a-=(l-s)/2,n-=(l-o)/2,s=l,o=l}else if(e>t){const n=s;a-=((s=o*(e/t))-n)/2}else if(t>e){const a=o;n-=((o=s*(t/e))-a)/2}return{top:n,left:a,width:s,height:o}}(Z,P,I,y,S,N);I=e.top,y=e.left,S=e.width,N=e.height}const k=y+S/2-(p+Z/2),w=I+N/2-(b+P/2),M=S/Z,T=N/P,A=g(n||r);E(A,{top:`${b}px`,left:`${p}px`,width:`${Z}px`,height:`${P}px`,transform:`translate3d(${k}px, ${w}px, 0) scale(${M}, ${T})`}),f(A,t),document.body.classList.add("ghost-animating"),requestAnimationFrame((()=>{document.body.appendChild(A),requestAnimationFrame((()=>{A.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(A),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(A)&&document.body.removeChild(A),document.body.classList.remove("ghost-animating")}))}),200+u.fK)}))}))}(Xe,S,Ae,xe,le,U)),Pe&&!K&&($e||_e)&&((0,T.YW)(Le+u.fK),function(e,t,n){const{container:a,mediaEl:s}=C(e,n);if(!s)return;const l=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!l||!s)return;const{top:r,left:i,width:c,height:d}=l.getBoundingClientRect(),{top:m,left:h,width:Z,height:b}=s.getBoundingClientRect();let I=m;if(!(0,P.P)(a)){const{height:e}=v.Z.get();I=m<r?-b:e}const y=i+c/2-(h+Z/2),S=r+d/2-(I+b/2);let N=c/Z,k=d/b;const w=[o.bZ.Inline,o.bZ.ScheduledInline].includes(e)&&!p(a,s)||[o.bZ.Album,o.bZ.ScheduledAlbum].includes(e)&&!p(a,s);[o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(e)&&(N>k?N=k:k>N&&(k=N));const M=document.getElementsByClassName("ghost")[0],T=M||g(t||s,e);M||E(T,{top:`${I}px`,left:`${h}px`,width:`${Z}px`,height:`${b}px`,transform:`translate3d(${y}px, ${S}px, 0) scale(${N}, ${k})`}),requestAnimationFrame((()=>{if(M){const{top:e,left:t,width:n,height:a}=M.getBoundingClientRect();E(T,{transition:"none",top:`${I}px`,left:`${h}px`,transformOrigin:"top left",transform:`translate3d(${t-h}px, ${e-I}px, 0) scale(${n/Z}, ${a/b})`,width:`${Z}px`,height:`${b}px`})}document.body.classList.add("ghost-animating"),M||document.body.appendChild(T),requestAnimationFrame((()=>{M&&(M.style.transition=""),T.style.transform="",w&&(T.style.opacity="0"),f(T,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(T)&&document.body.removeChild(T),document.body.classList.remove("ghost-animating")}))}),200+u.fK)}))}))}(Oe,Ue,$e||void 0))}),[Pe,K,S,Oe,U,$e,_e,Ae,Ue,xe,le,Xe]);const Je=(0,a.I4)((()=>{Y()}),[Y]),ze=(0,a.I4)((()=>{Je(),m.wB?setTimeout((()=>{j(!1,{forceSyncOnIOs:!0}),q({chatId:n,threadId:i,messageId:Z})}),Le):q({chatId:n,threadId:i,messageId:Z})}),[Je,n,i,q,j,Z]),Ve=(0,a.I4)((()=>{H({fromChatId:n,messageIds:[Z]})}),[H,n,Z]),Ye=(0,a.I4)((e=>V({chatId:n,threadId:i,messageId:e,origin:S},{forceOnHeavyAnimation:!0})),[n,V,S,i]);(0,a.d4)((()=>K?(0,d.Z)((()=>{Je()})):void 0),[Je,K]),(0,a.d4)((()=>{le&&!re&&(0,c.Es)()}),[re,le]),(0,a.d4)((()=>{if(K)return v.Z.disableRefresh(),()=>{v.Z.enableRefresh()}}),[K]);const He=(0,a.I4)(((e,t)=>{if(!e)return;const n=me.indexOf(e);return-1===t&&n>0||1===t&&n<me.length-1?me[n+t]:void 0}),[me]),qe=(0,R.Z)();return(0,A.Z)({isActive:K,onBack:Y}),a.ZP.createElement($.Z,{id:"MediaViewer",isOpen:K},a.ZP.createElement("div",{className:"media-viewer-head",dir:qe.isRtl?"rtl":void 0},m.wB&&a.ZP.createElement(D.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:qe("Close"),onClick:Je},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(O.Z,{activeKey:he.current,name:Ze},ce?a.ZP.createElement(Re,{key:k.id,chatId:k.id,isAvatar:!0}):a.ZP.createElement(Re,{key:Z,chatId:n,messageId:Z})),a.ZP.createElement(X,{mediaData:ke||Se,isVideo:le,message:U,fileName:Be,canReport:Me,onReport:pe,onCloseMediaViewer:Je,onForward:Ve,zoomLevelChange:Ce,setZoomLevelChange:fe,isAvatar:ce}),a.ZP.createElement(x.Z,{isOpen:ge,onClose:Ee,subject:"media",photo:we,chatId:null==k?void 0:k.id})),a.ZP.createElement(Ne,{messageId:Z,getMessageId:He,chatId:n,isPhoto:ie,isGif:re,threadId:i,avatarOwnerId:k&&k.id,profilePhotoIndex:_,origin:S,isOpen:K,hasFooter:Xe,zoomLevelChange:Ce,isActive:!0,isVideo:le,animationLevel:z,onClose:Je,selectMessage:Ye,onFooterClick:ze}))})));var Be=n(60782),xe=n(18360),De=n(27407),$e=n(72313),Oe=n(12515),_e=n(34288),Ue=n(13103),Ge=n(97687),Xe=n(21273),Je=n(31876),ze=n(98799),Ve=n(6058);const Ye=(0,a.X$)((e=>{let{isOpen:t,currentUserId:n,chatOrUserIds:s,filterRef:o,filter:l,filterPlaceholder:i,loadMore:c,onFilterChange:d,onSelectChatOrUser:m,onClose:h,onCloseAnimationEnd:v}=e;const Z=(0,R.Z)(),[P,g]=(0,De.Z)(c,s,Boolean(l)),p=(0,a.I4)((()=>{d("")}),[d]);(0,Oe.Z)(o,t,p);const E=(0,a.sO)(null),C=(0,a.I4)((e=>{d(e.currentTarget.value)}),[d]),f=(0,$e.Z)(E,t,(e=>{P&&P.length>0&&m(P[-1===e?0:e])}),".ListItem-button",!0),b=a.ZP.createElement("div",{className:"modal-header",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:Z("Close"),onClick:h},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Ge.Z,{ref:o,value:l,onChange:C,onKeyDown:f,placeholder:i})),I=s.indexOf(P[0]);return a.ZP.createElement(Ue.Z,{isOpen:t,className:"ChatOrUserPicker",header:b,onClose:h,onCloseAnimationEnd:v},null!=P&&P.length?a.ZP.createElement(Xe.Z,{ref:E,className:"picker-list custom-scroll",items:P,onLoadMore:g,withAbsolutePositioning:!0,maxHeight:s.length*u.rS,onKeyDown:f},P.map(((e,t)=>a.ZP.createElement(Je.Z,{key:e,className:"chat-item-clickable force-rounded-corners",style:`top: ${(I+t)*u.rS}px;`,onClick:()=>m(e)},(0,r.YC)(e)?a.ZP.createElement(Ve.Z,{status:e===n?Z("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(ze.Z,{chatId:e}))))):P&&!P.length?a.ZP.createElement("p",{className:"no-results"},Z("lng_blocked_list_not_found")):a.ZP.createElement(_e.Z,null))})),He=(0,a.X$)((0,l.c$)((e=>{var t;const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:o,switchBotInline:l}=e;return{chatsById:n,activeListIds:a.active,archivedListIds:a.archived,pinnedIds:s.active,contactIds:null===(t=e.contactList)||void 0===t?void 0:t.userIds,currentUserId:o,switchBotInline:l}}))((e=>{let{chatsById:t,activeListIds:n,archivedListIds:o,pinnedIds:i,contactIds:c,currentUserId:d,isOpen:m,switchBotInline:u}=e;const{setForwardChatId:h,exitForwardMode:v,openChatWithText:Z,resetSwitchBotInline:P}=(0,l.Sv)(),g=(0,R.Z)(),[p,E]=(0,a.eJ)(""),C=(0,a.sO)(null),[f,b,I]=(0,M.Z)();(0,a.d4)((()=>{m&&b()}),[m,b]);const y=(0,a.Ye)((()=>{if(!m)return;let e=i||[];d&&(e=(0,Be.Tw)([d,...e]));const a=[...n||[],...o||[]].filter((e=>{const n=t[e];return n&&(0,r.Qm)(n,s._f)})),u=(0,l.Rd)().users.byId;return(0,r.ih)((0,Be.Tw)([...(0,r.$l)(g,a,t,p,d),...c?(0,r.kK)(c,u,p):[]]),t,void 0,e)}),[n,o,t,c,d,p,m,g,i]),S=(0,a.I4)((e=>{if(u){const t=`@${u.botUsername} ${u.query}`;Z({chatId:e,text:t}),P()}else h({id:e})}),[Z,P,h,u]),N=(0,a.I4)((()=>{v(),P()}),[v,P]),k=(0,xe.Z)(y,!0);if(m||f)return a.ZP.createElement(Ye,{currentUserId:d,isOpen:m,chatOrUserIds:k,filterRef:C,filterPlaceholder:g("ForwardTo"),filter:p,onFilterChange:E,onSelectChatOrUser:S,onClose:N,onCloseAnimationEnd:I})})));var qe=n(91947);function je(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const Ke=(0,a.X$)((0,l.c$)((e=>(0,Be.ei)(e,["dialogs"])))((e=>{let{dialogs:t}=e;const{dismissDialog:n,acceptInviteConfirmation:s,sendMessage:o,showNotification:r}=(0,l.Sv)(),[i,c,d]=(0,M.Z)(),m=(0,R.Z)();var u,h,v;if((0,a.d4)((()=>{t.length>0&&c()}),[t,c]),t.length)return a.ZP.createElement("div",{id:"Dialogs"},Boolean(t.length)&&("hash"in(u=t[t.length-1])?(e=>{const{hash:t,title:o,about:l,participantsCount:c,isChannel:u,photo:h,isRequestNeeded:v}=e,P=m(u?"Subscribers":"Members",c,"i"),g=m(u?"ChannelJoin":"JoinGroup"),p=m(u?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup");return a.ZP.createElement(Ue.Z,{isOpen:i,onClose:d,className:"error",header:Z(o,h),onCloseAnimationEnd:n},void 0!==c&&a.ZP.createElement("p",{className:"modal-help"},P),l&&a.ZP.createElement("p",{className:"modal-about"},(0,Te.Z)(l,["br"])),v&&a.ZP.createElement("p",{className:"modal-help"},m(u?"MemberRequests.RequestToJoinDescriptionChannel":"MemberRequests.RequestToJoinDescriptionGroup")),a.ZP.createElement(D.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{s({hash:t}),r({message:m(u?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),d()}},v?p:g),a.ZP.createElement(D.Z,{isText:!0,className:"confirm-dialog-button",onClick:d},m("Cancel")))})(u):"phoneNumber"in u?(h=u,a.ZP.createElement(Ue.Z,{isOpen:i,onClose:d,className:"confirm",title:m("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:n},m("AreYouSureShareMyContactInfoBot"),a.ZP.createElement("div",null,a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:()=>{o({contact:(0,Be.ei)(h,["firstName","lastName","phoneNumber"])}),d()}},m("OK")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},m("Cancel"))))):(v=u,a.ZP.createElement(Ue.Z,{isOpen:i,onClose:d,onCloseAnimationEnd:n,className:"error",title:je(v)},v.hasErrorKey?(0,qe.ZP)(v):(0,Te.Z)(v.message,["emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement(D.Z,{isText:!0,onClick:d},m("OK")))))));function Z(e,t){return a.ZP.createElement("div",{className:"modal-header"},t&&a.ZP.createElement(Ae.Z,{size:"small",photo:t}),a.ZP.createElement("div",{className:"modal-title"},(0,Te.Z)(e)),a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:d},a.ZP.createElement("i",{className:"icon-close"})))}})));var We=n(96937);const Qe=(0,a.X$)((0,l.c$)((e=>(0,Be.ei)(e,["notifications"])))((e=>{let{notifications:t}=e;const{dismissNotification:n}=(0,l.Sv)();if(t.length)return a.ZP.createElement("div",{id:"Notifications"},t.map((e=>{let{message:t,localId:s}=e;return a.ZP.createElement(We.Z,{message:(0,Te.Z)(t,["emoji","br","links","simple_markdown"]),onDismiss:()=>n({localId:s})})})))})));var et=n(81396),tt=n(17551);const nt=(0,a.X$)((e=>{let{url:t}=e;const{toggleSafeLinkModal:n}=(0,l.Sv)(),s=(0,R.Z)(),o=(0,a.I4)((()=>{window.open((0,et.X)(t)),n({url:void 0})}),[n,t]),r=(0,a.I4)((()=>{n({url:void 0})}),[n]),i=(0,xe.Z)(t);return a.ZP.createElement(tt.Z,{isOpen:Boolean(t),onClose:r,title:s("OpenUrlTitle"),textParts:(0,Te.Z)(s("OpenUrlAlert2",i),["links"]),confirmLabel:s("OpenUrlTitle"),confirmHandler:o})})),at=2147483647e3,st=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function ot(e,t,n,a,s){const o=new Date(e,t,n),l=a&&(0,le.$Y)(a),r=s&&(0,le.$Y)(s);return!!(r&&o>r)||!!(l&&o<l)}function lt(e){return String(e).padStart(2,"0")}function rt(e,t,n){return`${e}-${t+1}-${n}`}const it=(0,a.X$)((e=>{let{selectedAt:t,minAt:n,maxAt:s,isFutureMode:o,isPastMode:l,isOpen:r,withTimePicker:i,submitButtonLabel:c,secondButtonLabel:d,onClose:m,onSubmit:u,onSecondButtonClick:h}=e;const v=(0,R.Z)(),Z=new Date,P=(0,a.Ye)((()=>o&&!n?new Date:new Date(Math.max(n||0,0))),[o,n]),g=(0,a.Ye)((()=>l&&!s?new Date:new Date(Math.min(s||at,at))),[l,s]),p=(0,a.Ye)((()=>t?new Date(t):new Date),[t]),E=(0,B.Z)(r),[C,f,b]=(0,M.Z)(!1),[I,y]=(0,a.eJ)(p),[S,N]=(0,a.eJ)(new Date(I.getFullYear(),I.getMonth(),1)),[k,w]=(0,a.eJ)(lt(p.getHours())),[T,A]=(0,a.eJ)(lt(p.getMinutes())),L=rt(I.getFullYear(),I.getMonth(),I.getDate()),F=S.getFullYear(),x=S.getMonth();(0,a.d4)((()=>{!E&&r&&(y(p),N(new Date(p.getFullYear(),p.getMonth(),1)),i&&(w(lt(p.getHours())),A(lt(p.getMinutes()))))}),[p,r,E,i]),(0,a.d4)((()=>{o&&!C&&I.getTime()<P.getTime()&&(y(P),w(lt(P.getHours())),A(lt(P.getMinutes())))}),[o,C,P,I]),(0,a.d4)((()=>{l&&!C&&I.getTime()>g.getTime()&&(y(g),w(lt(g.getHours())),A(lt(g.getMinutes())))}),[o,l,C,g,P,I]),(0,a.d4)((()=>{if(t){const e=new Date(t);y(e),w(lt(e.getHours())),A(lt(e.getMinutes()))}}),[t]);const $=l&&F>=Z.getFullYear()&&x>=Z.getMonth()||g&&F>=g.getFullYear()&&x>=g.getMonth(),O=o&&F<=Z.getFullYear()&&x<=Z.getMonth(),{prevMonthGrid:_,currentMonthGrid:U,nextMonthGrid:G}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],o=new Date;o.setDate(1),o.setMonth(t),o.setFullYear(e);const l=o.getDay()||7,r=new Date(e,t,0).getDate();for(let e=1;e<l;e++)n.push(r-l+e+1);for(;o.getMonth()===t;){const e=o.getDate();a.push(e),o.setDate(e+1)}const i=(a.length+n.length)%7;if(i>0)for(let e=1;e<=7-i;e++)s.push(e);return{prevMonthGrid:n,currentMonthGrid:a,nextMonthGrid:s}}(F,x)),[x,F]),X=(0,a.Ye)((()=>c||function(e,t){const n=(0,le.xH)(t,e.code);return n===(0,le.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,le.mr)(e,t)):e("Conversation.ScheduleMessage.SendOn",[n,(0,le.mr)(e,t)])}(v,I)),[v,I,c]),J=(0,a.I4)((()=>{u(I)}),[u,I]),z=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return w(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(I.getTime());a.setHours(n),y(a);const s=lt(n);w(s),e.target.value=s}),[I]),Y=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return A(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),59)),a=new Date(I.getTime());a.setMinutes(n),y(a);const s=lt(n);A(s),e.target.value=s}),[I]);return a.ZP.createElement(Ue.Z,{isOpen:r,onClose:m,className:"CalendarModal"},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:m},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h4",null,v(`lng_month${x+1}`)," ",F),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",disabled:O,onClick:O?void 0:function(){N((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",disabled:$,onClick:$?void 0:function(){N((e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t}))}},a.ZP.createElement("i",{className:"icon-next"})))),a.ZP.createElement("div",{className:"calendar-wrapper"},a.ZP.createElement("div",{className:"calendar-grid"},st.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,v(e))))),_.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))),U.map((e=>a.ZP.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void y((e=>{const n=new Date(e);return n.setDate(t),n.setMonth(x),n.setFullYear(F),n}));var t},className:(0,V.Z)("day-button",ot(F,x,e,P,g)?"disabled":e?"clickable":"",L===rt(F,x,e)&&"selected")},Boolean(e)&&a.ZP.createElement("span",null,e)))),G.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),i&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:k,onChange:z,onFocus:f,onBlur:b}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:T,onChange:Y,onFocus:f,onBlur:b})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(D.Z,{onClick:J},X),d&&a.ZP.createElement(D.Z,{onClick:h,isText:!0},d)))})),ct=(0,a.X$)((0,l.c$)((e=>({selectedAt:e.historyCalendarSelectedAt})))((e=>{let{isOpen:t,selectedAt:n}=e;const{searchMessagesByDate:s,closeHistoryCalendar:o}=(0,l.Sv)(),r=(0,a.I4)((e=>{s({timestamp:e.valueOf()/1e3}),o()}),[o,s]),i=(0,R.Z)();return a.ZP.createElement(it,{isOpen:t,selectedAt:n,isPastMode:!0,submitButtonLabel:i("JumpToDate"),onClose:o,onSubmit:r})})));var dt=n(6272),mt=n(14605);const ut=(0,a.X$)((0,l.c$)(((e,t)=>{let{userId:n}=t;return{user:n?(0,i.dy)(e,n):void 0,userStatus:n?(0,i.ss)(e,n):void 0,serverTimeOffset:e.serverTimeOffset,phoneCodeList:e.countryList.phoneCodes}}))((e=>{var t,n,s;let{isOpen:o,userId:i,isByPhoneNumber:c,user:d,userStatus:u,phoneCodeList:h,serverTimeOffset:v}=e;const{updateContact:Z,importContact:P,closeNewContactDialog:g}=(0,l.Sv)(),p=(0,R.Z)(),E=(0,xe.Z)(d),C=(0,xe.Z)(c),f=(0,a.sO)(null),[b,I,y]=(0,M.Z)(),[S,N]=(0,a.eJ)(null!==(t=null==E?void 0:E.firstName)&&void 0!==t?t:""),[k,w]=(0,a.eJ)(null!==(n=null==E?void 0:E.lastName)&&void 0!==n?n:""),[T,A]=(0,a.eJ)(null!==(s=null==E?void 0:E.phoneNumber)&&void 0!==s?s:""),[L,F]=(0,a.eJ)(!0),B=Boolean(S&&(!c||T));(0,a.d4)((()=>{var e,t,n;o&&(I(),N(null!==(e=null==E?void 0:E.firstName)&&void 0!==e?e:""),w(null!==(t=null==E?void 0:E.lastName)&&void 0!==t?t:""),A(null!==(n=null==E?void 0:E.phoneNumber)&&void 0!==n?n:""),F(!0))}),[o,I,null==E?void 0:E.firstName,null==E?void 0:E.lastName,null==E?void 0:E.phoneNumber]),(0,a.d4)((()=>{!m.$b&&b&&setTimeout((()=>{var e;null===(e=f.current)||void 0===e||e.focus()}),200)}),[b]);const x=(0,a.I4)((e=>{N(e.target.value)}),[]),$=(0,a.I4)((e=>{A((0,dt.WZ)(h,e.target.value))}),[h]),O=(0,a.I4)((e=>{w(e.target.value)}),[]),_=(0,a.I4)((()=>{g(),N(""),w(""),A("")}),[g]),U=(0,a.I4)((()=>{c||!i?P({firstName:S,lastName:k,phoneNumber:T}):Z({userId:i,firstName:S,lastName:k,shouldSharePhoneNumber:L})}),[S,P,c,k,T,L,Z,i]);if(o||b)return a.ZP.createElement(Ue.Z,{className:"NewContactModal",title:p("NewContact"),isOpen:o,onClose:_,onCloseAnimationEnd:y},E&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"NewContactModal__profile",dir:p.isRtl?"rtl":void 0},a.ZP.createElement(Ae.Z,{size:"jumbo",user:E,text:`${S} ${k}`}),a.ZP.createElement("div",{className:"NewContactModal__profile-info"},a.ZP.createElement("p",{className:"NewContactModal__phone-number"},null!=E&&E.phoneNumber?(0,dt.WZ)(h,E.phoneNumber):p("MobileHidden")),a.ZP.createElement("span",{className:"NewContactModal__user-status",dir:"auto"},(0,r.Tq)(p,E,u,v)))),a.ZP.createElement(Ge.Z,{ref:f,value:S,label:p("FirstName"),tabIndex:0,onChange:x}),a.ZP.createElement(Ge.Z,{value:k,label:p("LastName"),tabIndex:0,onChange:O}),a.ZP.createElement("p",{className:"NewContactModal__help-text"},(0,Te.Z)(p("NewContact.Phone.Hidden.Text",(null==E?void 0:E.firstName)||""),["emoji","simple_markdown"])),a.ZP.createElement(mt.Z,{checked:L,tabIndex:0,onCheck:F,label:p("lng_new_contact_share")}),a.ZP.createElement("p",{className:"NewContactModal__help-text"},(0,Te.Z)(p("AddContact.SharedContactExceptionInfo",null==E?void 0:E.firstName)))),C&&a.ZP.createElement("div",{className:"NewContactModal__new-contact",dir:p.isRtl?"rtl":void 0},a.ZP.createElement(Ae.Z,{size:"jumbo",text:`${S} ${k}`}),a.ZP.createElement("div",{className:"NewContactModal__new-contact-fieldset"},a.ZP.createElement(Ge.Z,{ref:f,value:T,inputMode:"tel",label:p("lng_contact_phone"),tabIndex:0,onChange:$}),a.ZP.createElement(Ge.Z,{value:S,label:p("FirstName"),tabIndex:0,onChange:x}),a.ZP.createElement(Ge.Z,{value:k,label:p("LastName"),tabIndex:0,onChange:O}))),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(D.Z,{isText:!0,className:"confirm-dialog-button",onClick:_},p("Cancel")),a.ZP.createElement(D.Z,{isText:!0,className:"confirm-dialog-button",disabled:!B,onClick:U},p("Done"))))})));var ht=n(18629),vt=n(62357);const Zt=(0,a.X$)((0,l.c$)(((e,t)=>{let{webApp:n}=t;const{bot:a}=n||{};return{isInstalled:Boolean(a&&e.attachMenu.bots[a.id]),chat:(0,i.jr)(e),theme:(0,i.Pu)(e)}}))((e=>{let{webApp:t,chat:n,isInstalled:s,theme:o}=e;const{closeWebApp:r,sendWebViewData:i,prolongWebView:c,toggleBotInAttachMenu:d,openTelegramLink:u,openChat:h}=(0,l.Sv)(),[Z,P]=(0,a.eJ)(),g=(0,R.Z)(),{url:p,bot:E,buttonText:C,queryId:f}=t||{},b=Boolean(p),I=!f,S=(0,a.I4)((e=>{const{eventType:t}=e;if("web_app_close"===t&&r(),"web_app_open_tg_link"===t){const t="https://t.me/"+e.eventData.path_full;u({url:t}),r()}if("web_app_data_send"===t){const{eventData:t}=e;r(),i({bot:E,buttonText:C,data:t.data})}if("web_app_setup_main_button"===t){var n;const{eventData:t}=e,a=(0,ht.B)(),s=!t.color||(0,ht.U)(t.color)?t.color:a.button_color,o=!t.text_color||(0,ht.U)(t.text_color)?t.text_color:a.text_color;P({isVisible:t.is_visible&&Boolean(null===(n=t.text)||void 0===n?void 0:n.trim().length),isActive:t.is_active,text:t.text||"",color:s,textColor:o,isProgressVisible:t.is_progress_visible})}}),[E,C,r,u,i]),{ref:N,reloadFrame:k,sendEvent:w,sendViewport:M,sendTheme:T}=((e,t,n)=>{const s=(0,a.sO)(null),o=(0,a.sO)(!1),l=(0,W.Z)(),r=(0,a.I4)((e=>{if(!s.current)return;const t=s.current;t.src="about:blank",t.addEventListener("load",(()=>{t.src=e}),{once:!0})}),[]),i=(0,a.I4)((e=>{var t;null!==(t=s.current)&&void 0!==t&&t.contentWindow&&s.current.contentWindow.postMessage(JSON.stringify(e),"*")}),[]),c=(0,a.I4)((()=>{if(!s.current)return;const{width:e,height:t}=s.current.getBoundingClientRect();i({eventType:"viewport_changed",eventData:{width:e,height:t,is_expanded:!0}})}),[i]),d=(0,a.I4)((()=>{i({eventType:"theme_changed",eventData:{theme_params:(0,ht.B)()}})}),[i]),m=(0,a.I4)((e=>{i({eventType:"set_custom_style",eventData:e})}),[i]),u=(0,a.I4)((e=>{if(!o.current)try{const a=JSON.parse(e.data);if("web_app_request_viewport"===a.eventType&&c(),"web_app_request_theme"===a.eventType&&d(),"iframe_ready"===a.eventType){const e=getComputedStyle(document.body).getPropertyValue("--color-scrollbar");m("* {\n scrollbar-width: thin;\n scrollbar-color: %SCROLLBAR_COLOR% transparent;\n}\n\n*::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border-radius: 6px;\n background-color: %SCROLLBAR_COLOR%;\n}\n\n*::-webkit-scrollbar-corner {\n background-color: transparent;\n}".replace(/%SCROLLBAR_COLOR%/g,e))}if("web_app_data_send"===a.eventType){if(!t)return;o.current=!0}n(a)}catch(e){}}),[t,n,m,d,c]);return(0,a.d4)((()=>{l&&c()}),[c,l]),(0,a.d4)((()=>(window.addEventListener("message",u),()=>window.removeEventListener("message",u))),[u]),(0,a.d4)((()=>{var t;e&&null!==(t=s.current)&&void 0!==t&&t.contentWindow&&(c(),o.current=!1)}),[e,c]),{ref:s,sendEvent:i,reloadFrame:r,sendViewport:c,sendTheme:d}})(b,I,S),A=(null==Z?void 0:Z.isVisible)&&Z.text.trim().length>0;(0,vt.Z)((()=>{c({bot:E,queryId:f,peer:n})}),f?45e3:void 0,!0);const L=(0,a.I4)((()=>{w({eventType:"main_button_pressed"})}),[w]),F=(0,a.I4)((()=>{k(t.url)}),[k,t]);(0,y.Z)((()=>{setTimeout((()=>{M()}),400)}),[null==Z?void 0:Z.isVisible,M]),(0,y.Z)((()=>{setTimeout((()=>{T()}),400)}),[o,T]),(0,a.d4)((()=>{if(b)return v.Z.disableRefresh(),()=>{v.Z.enableRefresh()}}),[b]);const x=(0,a.I4)((()=>{d({botId:E.id,isEnabled:!s})}),[E,s,d]),$=(0,a.I4)((()=>{h({id:E.id}),r()}),[E,r,h]),O=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(D.Z,{round:!0,ripple:!m.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]),G=(0,a.Ye)((()=>a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:g("Close"),onClick:r},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},null==E?void 0:E.firstName),a.ZP.createElement(_.Z,{className:"web-app-more-menu",trigger:O,positionX:"right"},n&&E&&n.id!==E.id&&a.ZP.createElement(U.Z,{icon:"bots",onClick:$},g("BotWebViewOpenBot")),a.ZP.createElement(U.Z,{icon:"reload",onClick:F},g("WebApp.ReloadPage")),(null==E?void 0:E.isAttachMenuBot)&&a.ZP.createElement(U.Z,{icon:s?"stop":"install",onClick:x,destructive:s},g(s?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd"))))),[g,r,E,O,F,s,x,n,$]),X=(0,B.Z)(null==Z?void 0:Z.color,!0),J=(0,B.Z)(null==Z?void 0:Z.textColor,!0),z=(0,B.Z)(Z&&Boolean(Z.isActive),!0),Y=(0,B.Z)(null==Z?void 0:Z.text,!0),H=(null==Z?void 0:Z.color)||X,q=(null==Z?void 0:Z.textColor)||J,j=void 0!==(null==Z?void 0:Z.isActive)?Z.isActive:z,K=(null==Z?void 0:Z.text)||Y;(0,a.d4)((()=>{b||P(void 0)}),[b]);const[ee,te]=(0,a.eJ)(!1),[ne,ae]=(0,a.eJ)(!0),se=(0,a.sO)();return(0,a.d4)((()=>{se.current&&clearTimeout(se.current),A?(ae(!1),se.current=setTimeout((()=>{te(!0)}),250)):(te(!1),se.current=setTimeout((()=>{ae(!0)}),250))}),[te,A]),a.ZP.createElement(Ue.Z,{className:"WebAppModal",isOpen:b,onClose:r,header:G,hasCloseButton:!0},b&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("iframe",{ref:N,className:(0,V.Z)("web-app-frame",ee&&"with-button"),src:p,title:`${null==E?void 0:E.firstName} Web App`,sandbox:"allow-scripts allow-same-origin allow-popups allow-forms",allow:"camera; microphone; geolocation;",allowFullScreen:!0}),a.ZP.createElement(D.Z,{className:(0,V.Z)("web-app-button",A&&"visible",ne&&"hidden"),style:`background-color: ${H}; color: ${q}`,disabled:!j,onClick:L},K,(null==Z?void 0:Z.isProgressVisible)&&a.ZP.createElement(Q.Z,{color:"white"}))))}))),Pt=(0,a.X$)((e=>{let{bot:t,type:n}=e;const{cancelBotTrustRequest:s,markBotTrusted:o}=(0,l.Sv)(),i=(0,R.Z)(),c=(0,B.Z)(t,!1),d=(0,B.Z)(n,!1),m=t||c,u=n||d,h=(0,a.I4)((()=>{o({botId:t.id})}),[o,t]),v=i("game"===u?"AppName":"BotOpenPageTitle"),Z=i("game"===u?"BotPermissionGameAlert":"BotOpenPageMessage",(0,r.Js)(m));return a.ZP.createElement(tt.Z,{isOpen:Boolean(t),onClose:s,confirmHandler:h,title:v,textParts:(0,Te.Z)(Z,["br","simple_markdown"])})})),gt=e=>{let{bot:t}=e;const{closeBotAttachRequestModal:n,confirmBotAttachRequest:s}=(0,l.Sv)(),o=(0,R.Z)(),r=null==t?void 0:t.firstName;return a.ZP.createElement(tt.Z,{isOpen:Boolean(t),onClose:n,confirmHandler:s,title:r,textParts:o("WebApp.AddToAttachmentText",r)})},pt=(0,a.X$)((0,l.c$)(((e,t)=>{let{message:n,isSchedule:a}=t;const{threadId:s}=(0,i.Bt)(e)||{},{canDeleteForAll:o}=s&&(0,i._k)(e,n,s)||{},l=(0,i.Z1)(e,n.chatId);return{canDeleteForAll:!a&&o,contactName:l&&(0,r.YC)(l.id)?(0,r.Vl)((0,i.dy)(e,(0,r.zX)(l))):void 0,willDeleteForCurrentUserOnly:l&&(0,r.G9)(l)&&!o,willDeleteForAll:l&&(0,r.ZV)(l)}}))((e=>{let{isOpen:t,isSchedule:n,message:s,album:o,canDeleteForAll:r,contactName:i,willDeleteForCurrentUserOnly:c,willDeleteForAll:d,onClose:m}=e;const{deleteMessages:u,deleteScheduledMessages:h}=(0,l.Sv)(),v=(0,a.I4)((()=>{const e=null!=o&&o.messages?o.messages.map((e=>{let{id:t}=e;return t})):[s.id];u({messageIds:e,shouldDeleteForAll:!0}),m()}),[u,s.id,m,o]),Z=(0,a.I4)((()=>{const e=null!=o&&o.messages?o.messages.map((e=>{let{id:t}=e;return t})):[s.id];n?h({messageIds:e}):u({messageIds:e,shouldDeleteForAll:!1}),m()}),[o,s.id,n,m,h,u]),P=(0,R.Z)();return a.ZP.createElement(Ue.Z,{isOpen:t,onClose:m,onEnter:t&&!r?Z:void 0,className:"delete",title:P("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,P("AreYouSureDeleteSingleMessage")),c&&a.ZP.createElement("p",null,P("lng_delete_for_me_chat_hint",1,"i")),d&&a.ZP.createElement("p",null,P("lng_delete_for_everyone_hint",1,"i")),r&&a.ZP.createElement(D.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:v},i&&(0,Te.Z)(P("Conversation.DeleteMessagesFor",i)),!i&&P("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(D.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},P(r?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},P("Cancel")))}))),Et=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,r.YC)(n),s=(0,i.FM)(e,n),o=(0,i.Z1)(e,n),l=Boolean(o)&&(0,r.eA)(o),c=Boolean(o)&&(0,r.G9)(o),d=Boolean(o)&&(0,r.ZV)(o);return{isPrivateChat:a,isChatWithSelf:s,isChannel:l,isGroup:c,isSuperGroup:d,canPinForAll:a&&!s||d||c,contactName:o&&(0,r.YC)(o.id)?(0,r.Vl)((0,i.dy)(e,(0,r.zX)(o))):void 0}}))((e=>{let{isOpen:t,messageId:n,chatId:s,isChannel:o,isGroup:r,isSuperGroup:i,canPinForAll:c,contactName:d,onClose:m}=e;const{pinMessage:u}=(0,l.Sv)(),h=(0,a.I4)((()=>{u({chatId:s,messageId:n,isUnpin:!1}),m()}),[u,s,n,m]),v=(0,a.I4)((()=>{u({chatId:s,messageId:n,isUnpin:!1,isOneSide:!0,isSilent:!0}),m()}),[s,n,m,u]),Z=(0,R.Z)();return a.ZP.createElement(Ue.Z,{isOpen:t,onClose:m,className:"pin",title:Z("PinMessageAlertTitle")},a.ZP.createElement("p",null,Z(o?"PinMessageAlertChannel":r||i?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:v},Z("DialogPin")),c&&a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:h},d?(0,Te.Z)(Z("Conversation.PinMessagesFor",d)):Z("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},Z("Cancel")))}))),Ct=(0,a.X$)((e=>{let{isOpen:t,pinnedMessagesCount:n=0,onClose:s,onUnpin:o}=e;const l=(0,R.Z)();return a.ZP.createElement(Ue.Z,{isOpen:t,onClose:s,className:"unpin-all",title:l("Chat.PanelUnpinAllMessages")},a.ZP.createElement("p",null,l("Chat.UnpinAllMessagesConfirmation",n,"i")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:o},l("DialogUnpin")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},l("Cancel")))}));var ft=n(517),bt=n(73541);const It=(0,a.X$)((0,l.c$)(((e,t)=>{let{isSchedule:n}=t;const{messageIds:a}=e.selectedMessages||{},{canDeleteForAll:s}=(0,i.xl)(e),o=(0,i.jr)(e);return{selectedMessageIds:a,canDeleteForAll:!n&&s,contactName:o&&(0,r.YC)(o.id)?(0,r.Vl)((0,i.dy)(e,(0,r.zX)(o))):void 0,willDeleteForCurrentUserOnly:o&&(0,r.G9)(o)&&!s,willDeleteForAll:o&&(0,r.ZV)(o)}}))((e=>{let{isOpen:t,isSchedule:n,selectedMessageIds:s,canDeleteForAll:o,contactName:r,willDeleteForCurrentUserOnly:i,willDeleteForAll:c,onClose:d}=e;const{deleteMessages:m,deleteScheduledMessages:u,exitMessageSelectMode:h}=(0,l.Sv)(),v=(0,B.Z)(t),Z=(0,a.I4)((()=>{d(),m({messageIds:s,shouldDeleteForAll:!0})}),[m,s,d]),P=(0,a.I4)((()=>{n?u({messageIds:s}):m({messageIds:s,shouldDeleteForAll:!1}),d()}),[n,d,u,s,m]),g=(0,R.Z)();if((0,a.d4)((()=>{!t&&v&&h()}),[h,t,v]),s)return a.ZP.createElement(Ue.Z,{isOpen:t,onClose:d,onEnter:o?void 0:P,className:"delete",title:g("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,g("AreYouSureDeleteFewMessages")),i&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),c&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),o&&a.ZP.createElement(D.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},r?(0,Te.Z)(g("ChatList.DeleteForEveryone",r)):g("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(D.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:P},g(o?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},g("Cancel")))}))),yt=(0,a.X$)((0,l.c$)((e=>{const{type:t,chatId:n}=(0,i.Bt)(e)||{},{canDelete:a}=(0,i.xl)(e),s=(0,i.nB)(e),o=(0,i.Nu)(e),{messageIds:l}=e.selectedMessages||{},r=!!n&&(0,i.ku)(e,n,l);return{isSchedule:"scheduled"===t,selectedMessagesCount:(0,i.D7)(e),canDeleteMessages:a,canReportMessages:s,canDownloadMessages:o,selectedMessageIds:l,hasProtectedMessage:r}}))((e=>{let{canPost:t,isActive:n,messageListType:s,isSchedule:o,selectedMessagesCount:r,canDeleteMessages:i,canReportMessages:c,canDownloadMessages:d,hasProtectedMessage:m,selectedMessageIds:u}=e;const{exitMessageSelectMode:h,openForwardMenuForSelectedMessages:v,downloadSelectedMessages:Z,copySelectedMessages:P,showNotification:g}=(0,l.Sv)(),p=(0,R.Z)(),[E,C,f]=(0,M.Z)(),[b,I,y]=(0,M.Z)();((e,t)=>{(0,bt.y)({"Meta+C":function(n){e&&(n.preventDefault(),t())}})})(Boolean(n),P),(0,a.d4)((()=>!n||E||b?void 0:(0,ft.Z)({onBackspace:C,onDelete:C,onEsc:h})),[n,E,b,C,h]);const S=(0,a.I4)((()=>{P(),g({message:p("Share.Link.Copied")}),h()}),[P,h,p,g]),N=(0,a.I4)((()=>{Z(),h()}),[Z,h]),k=(0,B.Z)(r||void 0,!0),w=p("VoiceOver.Chat.MessagesSelected",n?r:k,"i"),T=(0,V.Z)("MessageSelectToolbar",t&&"with-composer",n&&"shown"),A=(e,t,n,s,o)=>a.ZP.createElement("div",{role:"button",tabIndex:0,className:(0,V.Z)("item",s&&"disabled",o&&"destructive"),onClick:s?void 0:n,title:t},a.ZP.createElement("i",{className:`icon-${e}`}));return a.ZP.createElement("div",{className:T},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(D.Z,{color:"translucent",round:!0,onClick:h,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:w},w),Boolean(r)&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==s&&A("forward",p("Chat.ForwardActionHeader"),v,m),c&&A("flag",p("Conversation.ReportMessages"),I),d&&A("download",p("lng_media_download"),N,m),A("copy",p("lng_context_copy_selected_items"),S,m),A("delete",p("EditAdminGroupDeleteMessages"),C,!i,!0))),a.ZP.createElement(It,{isOpen:E,isSchedule:o,onClose:f}),a.ZP.createElement(x.Z,{isOpen:b,onClose:y,messageIds:u}))}))),St=(0,a.X$)((0,l.c$)((e=>{var t;const{chatId:n,messageId:a}=e.seenByModal||{};return n&&a?{memberIds:null===(t=(0,i.hj)(e,n,a))||void 0===t?void 0:t.seenByUserIds}:{}}))((e=>{let{isOpen:t,memberIds:n}=e;const{openChat:s,closeSeenByModal:o}=(0,l.Sv)(),r=(0,R.Z)(),i=(0,a.I4)((e=>{o(),setTimeout((()=>{s({id:e})}),100)}),[o,s]),c=(0,xe.Z)(n,!0);return a.ZP.createElement(Ue.Z,{isOpen:t,onClose:o,className:"narrow",title:`Seen by ${null==n?void 0:n.length} users`},a.ZP.createElement("div",{dir:r.isRtl?"rtl":void 0},c&&c.map((e=>a.ZP.createElement(Je.Z,{key:e,className:"chat-item-clickable scroll-item small-icon",onClick:()=>i(e)},a.ZP.createElement(Ve.Z,{userId:e,noStatusOrTyping:!0}))))),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:o},r("Close")))})));var Nt=n(2155),kt=n(48198);const wt=(0,a.X$)((0,l.c$)((e=>{const{chatId:t,messageId:n}=e.reactorModal||{},a=t&&n?(0,i.hj)(e,t,n):void 0;return{chatId:t,messageId:n,reactions:null==a?void 0:a.reactions,reactors:null==a?void 0:a.reactors,seenByUserIds:null==a?void 0:a.seenByUserIds}}))((e=>{let{isOpen:t,reactors:n,reactions:s,chatId:i,messageId:c,seenByUserIds:d}=e;const{loadReactors:m,closeReactorListModal:u,openChat:h}=(0,l.Sv)(),v=(0,l.Rd)().users.byId,Z=(0,R.Z)(),[P,g,p]=(0,M.Z)(!1),[E,C]=(0,a.eJ)(void 0),f=n&&s&&n.count>=10&&s.results.length>1,b=(0,a.sO)();(0,a.d4)((()=>{P&&!t&&(p(),C(void 0))}),[P,t,p]);const I=(0,a.I4)((()=>{b.current&&h({id:b.current}),u()}),[u,h]),y=(0,a.I4)((()=>{g()}),[g]),S=(0,a.I4)((e=>{b.current=e,y()}),[y]),N=(0,a.I4)((()=>{m({chatId:i,messageId:c})}),[i,m,c]),k=(0,a.Ye)((()=>null!=n&&n.reactions?(0,Be.Tw)(n.reactions.map((e=>e.reaction))):[]),[null==n?void 0:n.reactions]),w=(0,a.Ye)((()=>E?null==n?void 0:n.reactions.filter((e=>e.reaction===E)).map((e=>e.userId)):(0,Be.Tw)((null==n?void 0:n.reactions.map((e=>e.userId)).concat(d||[]))||[])),[E,null==n?void 0:n.reactions,d]),[T,A]=(0,De.Z)(N,w,n&&void 0===n.nextOffset);return(0,a.d4)((()=>{null==A||A({direction:o.Uq.Backwards})}),[A]),a.ZP.createElement(Ue.Z,{isOpen:t&&!P,onClose:y,className:"ReactorListModal narrow",title:Z("Reactions"),onCloseAnimationEnd:I},f&&a.ZP.createElement("div",{className:"Reactions"},a.ZP.createElement(D.Z,{className:(0,V.Z)(!E&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(void 0)},a.ZP.createElement("i",{className:"icon-heart"}),(null==n?void 0:n.count)&&(0,Nt.bi)(n.count)),k.map((e=>{var t;const n=null==s||null===(t=s.results.find((t=>t.reaction===e)))||void 0===t?void 0:t.count;return a.ZP.createElement(D.Z,{className:(0,V.Z)(E===e&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(e)},a.ZP.createElement(kt.Z,{reaction:e,className:"reaction-filter-emoji"}),n&&(0,Nt.bi)(n))}))),a.ZP.createElement("div",{dir:Z.isRtl?"rtl":void 0},null!=T&&T.length?a.ZP.createElement(Xe.Z,{className:"reactor-list custom-scroll",items:T,onLoadMore:A},null==T?void 0:T.map((e=>{var t;const s=v[e],o=(0,r.Js)(s),l=null==n||null===(t=n.reactions.find((t=>t.userId===e)))||void 0===t?void 0:t.reaction;return a.ZP.createElement(Je.Z,{key:e,className:"chat-item-clickable reactors-list-item",onClick:()=>S(e)},a.ZP.createElement(Ae.Z,{user:s,size:"medium"}),a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},o&&(0,Te.Z)(o))),l&&a.ZP.createElement(kt.Z,{className:"reactors-list-emoji",reaction:l}))}))):a.ZP.createElement(_e.Z,null)),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:u},Z("Close")))})));var Mt=n(15258),Tt=n(97799);const At=(0,a.X$)((0,l.c$)(((e,t)=>{let{activeEmojiInteraction:n}=t;const a=void 0!==n.animatedEffect&&(0,i.tH)(e,n.animatedEffect);return{effectAnimationId:a?a.id:void 0,localEffectAnimation:!a&&n.animatedEffect&&Object.keys(Mt.l).includes(n.animatedEffect)?n.animatedEffect:void 0}}))((e=>{let{effectAnimationId:t,localEffectAnimation:n,activeEmojiInteraction:s}=e;const{stopActiveEmojiInteraction:o}=(0,l.Sv)(),[r,i]=(0,M.Z)(!1),[c,d]=(0,M.Z)(!1),u=(0,a.sO)(),h=(0,a.I4)((()=>{i(),u.current&&clearTimeout(u.current),setTimeout((()=>{o({id:s.id})}),250)}),[s.id,i,o]),v=(0,a.I4)((e=>{var t;null!==(t=e.target)&&void 0!==t&&t.closest(".AnimatedEmoji")||h()}),[h]);(0,a.d4)((()=>(document.addEventListener("touchstart",v),document.addEventListener("touchmove",v),document.addEventListener("mousedown",v),document.addEventListener("wheel",v),()=>{document.removeEventListener("touchstart",v),document.removeEventListener("touchmove",v),document.removeEventListener("mousedown",v),document.removeEventListener("wheel",v)})),[v]),(0,a.bt)((()=>{const e=(0,T.YW)();u.current=setTimeout((()=>{h(),e()}),3e3)}),[h]);const Z=(0,L.Z)(`sticker${t}`,!t);if(!s.startSize)return;const P=(s.startSize||0)/240,g=n&&n in Mt.l?Mt.l[n]:Z;return a.ZP.createElement("div",{className:(0,V.Z)("EmojiInteractionAnimation",r&&"hiding",c&&"playing",s.isReversed&&"reversed"),style:`--scale: ${P}; --start-x: ${s.x}px; --start-y: ${s.y}px;`},a.ZP.createElement(Tt.Z,{key:`effect_${t}`,size:240,tgsUrl:g,play:c,quality:m.wZ?.5:void 0,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:d}))})));var Rt=n(93133),Lt=n(70735),Ft=n(41470);const Bt=e=>{const t=(0,a.sO)(null),n=(0,a.I4)((n=>{"Enter"===n.key&&t.current===document.activeElement&&e()}),[e]);return(0,a.d4)((()=>(window.addEventListener("keydown",n,!1),()=>window.removeEventListener("keydown",n,!1))),[n]),t};var xt=n(40329),Dt=n(50742);const $t=(0,a.X$)((0,l.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,i.Z1)(e,a),o=s&&(0,r.zX)(s);return{chat:s,user:o?(0,i.dy)(e,o):void 0,isPinned:(0,i.ep)(e,a),isMuted:s?(0,r.i4)(s,(0,i.dZ)(e),(0,i.NJ)(e)):void 0,canChangeFolder:Boolean(null===(n=e.chatFolders.orderedIds)||void 0===n?void 0:n.length)}}))((e=>{let{chatId:t,withUsername:n,onClick:s,chat:o,user:l,isPinned:i,isMuted:c,canChangeFolder:d}=e;const[m,u,h]=(0,M.Z)(),[v,Z,P]=(0,M.Z)(),g=(0,Ft.Z)({chat:o,user:l,isPinned:i,isMuted:c,canChangeFolder:d,handleDelete:u,handleChatFolderChange:Z},!0),p=(0,a.I4)((()=>{s(t)}),[t,s]),E=Bt(p);if(o)return a.ZP.createElement(Je.Z,{className:"chat-item-clickable search-result",onClick:p,contextActions:g,buttonRef:E},(0,r.YC)(t)?a.ZP.createElement(Ve.Z,{userId:t,withUsername:n,avatarSize:"large"}):a.ZP.createElement(ze.Z,{chatId:t,withUsername:n,avatarSize:"large"}),a.ZP.createElement(xt.Z,{isOpen:m,onClose:h,chat:o}),a.ZP.createElement(Dt.Z,{isOpen:v,onClose:P,chatId:t}))})));var Ot=n(78781);const _t=(0,q.P2)((e=>e()),6e4,!0),Ut=(0,a.X$)((0,l.c$)((e=>{const{userIds:t}=e.topPeers,n=e.users.byId,{recentlyFoundChatIds:a}=e.globalSearch;return{topUserIds:t,usersById:n,recentlyFoundChatIds:a}}))((e=>{let{topUserIds:t,usersById:n,recentlyFoundChatIds:s,onReset:o}=e;const{loadTopUsers:i,openChat:c,addRecentlyFoundChatId:d,clearRecentlyFoundChats:m}=(0,l.Sv)(),u=(0,a.sO)(null);(0,a.d4)((()=>{_t((()=>{i()}))}),[i]),(0,Ot.Z)(u.current,!t);const h=(0,a.I4)((e=>{c({id:e,shouldReplaceHistory:!0}),o(),setTimeout((()=>{d({id:e})}),250)}),[c,d,o]),v=(0,R.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},t&&a.ZP.createElement("div",{className:"top-peers-section",dir:v.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:u,className:"top-peers no-selection"},t.map((e=>a.ZP.createElement("div",{className:"top-peer-item",onClick:()=>h(e),dir:v.isRtl?"rtl":void 0},a.ZP.createElement(Ae.Z,{user:n[e]}),a.ZP.createElement("div",{className:"top-peer-name"},(0,Te.Z)((0,r.Vl)(n[e])||" "))))))),s&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:v.isRtl?"rtl":void 0},v("Recent"),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:m,isRtl:v.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),s.map((e=>a.ZP.createElement($t,{chatId:e,onClick:h})))))})));var Gt=n(89411),Xt=n(88033),Jt=n(50685);const zt=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,i.Z1)(e,n);if(!a)return{};const s=(0,r.zX)(a);return{chat:a,lastSyncTime:e.lastSyncTime,...s&&{privateChatUser:(0,i.dy)(e,s)}}}))((e=>{let{message:t,searchQuery:n,chatId:s,chat:o,privateChatUser:i,lastSyncTime:c}=e;const{focusMessage:d}=(0,l.Sv)(),u=(0,r.DH)(t),h=(0,L.Z)((0,r.Ti)(t,"micro")),v=Boolean((0,r.Y5)(t)),Z=(0,a.I4)((()=>{d({chatId:s,messageId:t.id,shouldReplaceHistory:!0})}),[s,d,t.id]),P=(0,R.Z)(),g=Bt(Z);if(o)return a.ZP.createElement(Je.Z,{className:"ChatMessage chat-item-clickable",ripple:!m.wB,onClick:Z,buttonRef:g},a.ZP.createElement(Ae.Z,{chat:o,user:i,isSavedMessages:null==i?void 0:i.isSelf,lastSyncTime:c}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"info-row"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},(0,Te.Z)((0,r.U)(P,o,i))),o.isVerified&&a.ZP.createElement(Gt.Z,null),o.fakeType&&a.ZP.createElement(Jt.Z,{fakeType:o.fakeType})),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(Xt.Z,{className:"date"},(0,le.VX)(P,1e3*t.date)))),a.ZP.createElement("div",{className:"subtitle"},a.ZP.createElement("div",{className:"message",dir:"auto"},function(e,t,n,s,o){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:(0,V.Z)("media-preview--image",o&&"round")}),(0,r.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,b.e)(e,t,!0,s)):(0,b.e)(e,t,void 0,s)}(P,t,h||u,n,v)))))}))),Vt=(0,a.X$)((e=>{let{searchDate:t,onSelect:n}=e;const s=(0,a.Ye)((()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,le.xH)(t)}]}const t=[],n=new Date,a=n.getFullYear(),s=n.getTime()>new Date(`${a}-${e}`).getTime()?a:a-1;for(let n=0;n<8;n++){const a=new Date(`${s-n}-${e}`);t.push({date:a,text:(0,le.xH)(a)})}return t}(t)),[t]);return a.ZP.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},s.map((e=>{let{date:t,text:s}=e;return a.ZP.createElement("div",{onClick:()=>n(t),className:"date-item",key:s},a.ZP.createElement("i",{className:"icon-calendar"}),a.ZP.createElement("span",null,s))})))}));var Yt=n(47262),Ht=n(49187);const qt=(0,q.P2)((e=>e()),500,!0),jt=(0,a.X$)((0,l.c$)((e=>{var t;const{byId:n}=e.chats,{userIds:a}=e.contactList||{};if(!a)return{chatsById:n};const{currentUserId:s,messages:o,lastSyncTime:l}=e,{fetchingStatus:r,globalResults:i,localResults:c,resultsByType:d}=e.globalSearch,{chatIds:m,userIds:u}=i||{},{chatIds:h,userIds:v}=c||{},{byChatId:Z}=o;return{currentUserId:s,localContactIds:a,localChatIds:h,localUserIds:v,globalChatIds:m,globalUserIds:u,foundIds:null==d||null===(t=d.text)||void 0===t?void 0:t.foundIds,globalMessagesByChatId:Z,chatsById:n,fetchingStatus:r,lastSyncTime:l}}))((e=>{let{searchQuery:t,searchDate:n,dateSearchQuery:s,currentUserId:i,localContactIds:c,localChatIds:d,localUserIds:u,globalChatIds:h,globalUserIds:v,foundIds:Z,globalMessagesByChatId:P,chatsById:g,fetchingStatus:p,lastSyncTime:E,onReset:C,onSearchDateSelect:f}=e;const{openChat:I,addRecentlyFoundChatId:y,searchMessagesGlobal:S,setGlobalSearchChatId:N}=(0,l.Sv)(),k=(0,R.Z)(),[w,M]=(0,a.eJ)(!1),[T,A]=(0,a.eJ)(!1),L=(0,a.I4)((e=>{let{direction:n}=e;E&&n===o.Uq.Backwards&&qt((()=>{S({type:"text",query:t})}))}),[E,S,t]),F=(0,a.I4)((e=>{I({id:e,shouldReplaceHistory:!0}),e!==i&&y({id:e}),m.wB||C()}),[i,I,y,C]),B=(0,a.I4)((e=>{N({id:e})}),[N]),x=(0,a.Ye)((()=>{if(!t||t.startsWith("@")&&t.length<2)return Lt.D;const e=[...i?[i]:[],...c||[]],n=(0,l.Rd)().users.byId,a=(0,r.kK)(e,n,t,i,k("SavedMessages"));return[...(0,r.ih)((0,Be.Tw)([...a||[],...d||[],...u||[]]),g,void 0,i?[i]:void 0)]}),[t,i,c,k,d,u,g]),D=(0,a.Ye)((()=>!t||t.length<4||!h||!v?Lt.D:(0,r.ih)((0,Be.Tw)([...h,...v]),g,!0)),[g,h,v,t]),$=(0,a.Ye)((()=>(t||n)&&Z&&0!==Z.length?Z.map((e=>{var t;const[n,a]=e.split("_");return null==P||null===(t=P[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Lt.D),[Z,P,t,n]),O=(0,a.I4)((()=>{M(!w)}),[w]),_=(0,a.I4)((()=>{A(!T)}),[T]),U=p&&!p.chats&&!p.messages&&!x.length&&!D.length&&!$.length;return t||n?a.ZP.createElement(Xe.Z,{className:"LeftSearch custom-scroll",items:$,onLoadMore:L,noScrollRestoreOnTop:!0,noFastList:!0},s&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(Vt,{searchDate:s,onSelect:f})),U&&a.ZP.createElement(Yt.Z,{text:k("ChatList.Search.NoResults"),description:k("ChatList.Search.NoResultsDescription")}),Boolean(x.length)&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:k.isRtl?"rtl":void 0},x.map((e=>a.ZP.createElement(Ht.Z,{chatOrUserId:e,onClick:B,clickArg:e})))),Boolean(x.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:k.isRtl?"auto":void 0},x.length>5&&a.ZP.createElement(Xt.Z,{onClick:O},k(w?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),k("DialogList.SearchSectionDialogs")),x.map(((e,t)=>{if(w||!(t>=5))return a.ZP.createElement($t,{chatId:e,onClick:F})}))),Boolean(D.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:k.isRtl?"auto":void 0},D.length>5&&a.ZP.createElement(Xt.Z,{onClick:_},k(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),k("DialogList.SearchSectionGlobal")),D.map(((e,t)=>{if(T||!(t>=5))return a.ZP.createElement($t,{chatId:e,withUsername:!0,onClick:F})}))),Boolean($.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:k.isRtl?"auto":void 0},k("SearchMessages")),$.map((function(e){const n=(0,b.e)(k,e),s=g[e.chatId];if(n&&s)return a.ZP.createElement(zt,{chatId:e.chatId,message:e,searchQuery:t})})))):a.ZP.createElement(Ut,{onReset:C})}))),Kt=(0,q.P2)((e=>e()),500,!0),Wt=(0,a.X$)((0,l.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a},lastSyncTime:s}=e,{fetchingStatus:o,resultsByType:l}=e.globalSearch,{foundIds:r}=(null==l?void 0:l.text)||{};return{currentUserId:n,foundIds:r,globalMessagesByChatId:a,chatsById:t,fetchingStatus:o,lastSyncTime:s}}))((e=>{let{searchQuery:t,currentUserId:n,dateSearchQuery:s,foundIds:r,globalMessagesByChatId:i,chatsById:c,fetchingStatus:d,lastSyncTime:m,onSearchDateSelect:u}=e;const{searchMessagesGlobal:h}=(0,l.Sv)(),v=(0,R.Z)(),Z=(0,a.I4)((e=>{let{direction:a}=e;m&&a===o.Uq.Backwards&&Kt((()=>{h({type:"text",query:t,chatId:n})}))}),[n,m,h,t]),P=(0,a.Ye)((()=>r&&0!==r.length?r.map((e=>{var t;const[n,a]=e.split("_");return null==i||null===(t=i[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Lt.D),[r,i]),g=d&&!d.chats&&!d.messages&&!P.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Xe.Z,{className:"search-content custom-scroll chat-list",items:P,onLoadMore:Z,noFastList:!0},s&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(Vt,{searchDate:s,onSelect:u})),g&&a.ZP.createElement(Yt.Z,{text:v("ChatList.Search.NoResults"),description:v("ChatList.Search.NoResultsDescription")}),P.map((function(e){const n=(0,b.e)(v,e),s=c[e.chatId];if(n&&s)return a.ZP.createElement(zt,{chatId:e.chatId,message:e,searchQuery:t})}))))})));function Qt(e){return(t,n)=>{var a,s;const{byId:o}=t.chats,{byId:l}=t.users,{fetchingStatus:r,resultsByType:c,chatId:d}=t.globalSearch,m="audio"!==e?e:null!=n&&n.isVoice?"voice":"audio",{byChatId:u}=t.messages,h=null==c||null===(a=c[m])||void 0===a?void 0:a.foundIds,v=t.activeDownloads.byChatId;return{theme:(0,i.Pu)(t),isLoading:void 0===h||!!r&&Boolean(r.chats||r.messages),chatsById:o,usersById:l,globalMessagesByChatId:u,foundIds:h,searchChatId:d,activeDownloads:v,isChatProtected:d?null===(s=(0,i.Z1)(t,d))||void 0===s?void 0:s.isProtected:void 0,lastSyncTime:t.lastSyncTime}}}var en=n(17891),tn=n(3657),nn=n(13709);const an="media",sn=(0,q.P2)((e=>e()),500,!0),on=(0,a.X$)((0,l.c$)(Qt(an))((e=>{let{searchQuery:t,searchChatId:n,isLoading:s,globalMessagesByChatId:r,foundIds:i,lastSyncTime:c,isChatProtected:d}=e;const{searchMessagesGlobal:m,openMediaViewer:h}=(0,l.Sv)(),v=(0,a.sO)(null),Z=(0,R.Z)(),{observe:P}=(0,tn.S1)({rootRef:v,throttleMs:500}),g=(0,a.I4)((e=>{let{direction:a}=e;c&&a===o.Uq.Backwards&&sn((()=>{m({type:an,query:t,chatId:n})}))}),[c,m,t,n]),p=(0,a.Ye)((()=>i&&r?i.map((e=>{var t;const[n,a]=e.split("_");return null===(t=r[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):Lt.D),[r,i]),E=(0,a.I4)(((e,t)=>{h({chatId:t,messageId:e,origin:o.bZ.SearchResult})}),[h]),C=(0,en.Z)([t],u.Y)&&!s,f=C&&i&&i.length>0&&!t,b=C&&i&&i.length>0&&t,I=(0,V.Z)("search-content custom-scroll",b&&"chat-list");return a.ZP.createElement("div",{ref:v,className:"LeftSearch"},a.ZP.createElement(Xe.Z,{className:I,items:p,itemSelector:t?".ListItem":".Media",onLoadMore:g,noFastList:!0},!C&&a.ZP.createElement(_e.Z,null),C&&(!i||0===i.length)&&a.ZP.createElement(Yt.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),f&&a.ZP.createElement("div",{className:"media-list",dir:Z.isRtl?"rtl":void 0},p.map((e=>a.ZP.createElement(nn.Z,{key:e.id,idPrefix:"search-media",message:e,isProtected:d||e.isProtected,observeIntersection:P,onClick:E})))),b&&p.map((e=>a.ZP.createElement(zt,{key:e.id,chatId:e.chatId,message:e})))))})));var ln=n(91),rn=n(45418);const cn="links",dn=(0,q.P2)((e=>e()),500,!0),mn=(0,a.X$)((0,l.c$)(Qt(cn))((e=>{let{searchQuery:t,searchChatId:n,isLoading:s,chatsById:r,usersById:i,globalMessagesByChatId:c,foundIds:d,lastSyncTime:m,isChatProtected:h}=e;const{searchMessagesGlobal:v,focusMessage:Z}=(0,l.Sv)(),P=(0,a.sO)(null),g=(0,R.Z)(),{observe:p}=(0,tn.S1)({rootRef:P,throttleMs:500}),E=(0,a.I4)((e=>{let{direction:a}=e;m&&a===o.Uq.Backwards&&dn((()=>{v({type:cn,query:t,chatId:n})}))}),[m,v,t,n]),C=(0,a.Ye)((()=>d&&c?d.map((e=>{var t;const[n,a]=e.split("_");return null===(t=c[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):Lt.D),[c,d]),f=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),b=(0,en.Z)([t],u.Y)&&!s;return a.ZP.createElement("div",{ref:P,className:"LeftSearch"},a.ZP.createElement(Xe.Z,{className:"search-content documents-list custom-scroll",items:C,onLoadMore:E,noFastList:!0},!b&&a.ZP.createElement(_e.Z,null),b&&(!d||0===d.length)&&a.ZP.createElement(Yt.Z,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),b&&d&&d.length>0&&C.map(((e,t)=>{const n=0===t||(0,le.kj)(e.date)!==(0,le.kj)(C[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",dir:g.isRtl?"rtl":void 0,key:e.id},n&&a.ZP.createElement("p",{className:"section-heading",dir:g.isRtl?"rtl":void 0},(0,le.np)(g,new Date(1e3*e.date))),a.ZP.createElement(rn.Z,{key:e.id,message:e,senderTitle:(0,ln.F)(g,e,r,i),isProtected:h||e.isProtected,observeIntersection:p,onMessageClick:f}))}))))})));var un=n(82535);const hn="documents",vn=(0,q.P2)((e=>e()),500,!0),Zn=(0,a.X$)((0,l.c$)(Qt(hn))((e=>{let{searchQuery:t,searchChatId:n,isLoading:s,chatsById:i,usersById:c,globalMessagesByChatId:d,foundIds:m,activeDownloads:h,lastSyncTime:v}=e;const{searchMessagesGlobal:Z,focusMessage:P}=(0,l.Sv)(),g=(0,a.sO)(null),p=(0,R.Z)(),{observe:E}=(0,tn.S1)({rootRef:g,throttleMs:500}),C=(0,a.I4)((e=>{let{direction:a}=e;v&&a===o.Uq.Backwards&&vn((()=>{Z({type:hn,query:t,chatId:n})}))}),[v,Z,t,n]),f=(0,a.Ye)((()=>m&&d?m.map((e=>{var t;const[n,a]=e.split("_"),s=null===(t=d[n])||void 0===t?void 0:t.byId[Number(a)];return s&&(0,r.aE)(s)?s:void 0})).filter(Boolean):Lt.D),[d,m]),b=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),I=(0,en.Z)([t],u.Y)&&!s;return a.ZP.createElement("div",{ref:g,className:"LeftSearch"},a.ZP.createElement(Xe.Z,{className:"search-content documents-list custom-scroll",items:f,onLoadMore:C,noFastList:!0},!I&&a.ZP.createElement(_e.Z,null),I&&(!m||0===m.length)&&a.ZP.createElement(Yt.Z,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),I&&m&&m.length>0&&f.map(((e,t)=>{var n;const s=0===t||(0,le.kj)(e.date)!==(0,le.kj)(f[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},s&&a.ZP.createElement("p",{className:"section-heading"},(0,le.np)(p,new Date(1e3*e.date))),a.ZP.createElement(un.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,ln.F)(p,e,i,c),className:"scroll-item",isDownloading:null===(n=h[e.chatId])||void 0===n?void 0:n.includes(e.id),observeIntersection:E,onDateClick:b}))}))))})));var Pn=n(54752);const gn=(0,q.P2)((e=>e()),500,!0),pn=(0,a.X$)((0,l.c$)(Qt("audio"))((e=>{let{theme:t,isVoice:n,searchQuery:s,searchChatId:r,isLoading:i,chatsById:c,usersById:d,globalMessagesByChatId:m,foundIds:h,lastSyncTime:v,activeDownloads:Z}=e;const{searchMessagesGlobal:P,focusMessage:g,openAudioPlayer:p}=(0,l.Sv)(),E=(0,R.Z)(),C=n?"voice":"audio",f=(0,a.I4)((e=>{let{direction:t}=e;v&&t===o.Uq.Backwards&&gn((()=>{P({type:C,query:s,chatId:r})}))}),[C,v,P,s,r]),b=(0,a.Ye)((()=>h&&m?h.map((e=>{var t;const[n,a]=e.split("_");return null===(t=m[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):Lt.D),[m,h]),I=(0,a.I4)(((e,t)=>{g({chatId:t,messageId:e})}),[g]),y=(0,a.I4)(((e,t)=>{p({chatId:t,messageId:e})}),[p]),S=(0,en.Z)([s],u.Y)&&!i;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Xe.Z,{className:"search-content documents-list custom-scroll",items:b,onLoadMore:f,noFastList:!0},!S&&a.ZP.createElement(_e.Z,null),S&&(!h||0===h.length)&&a.ZP.createElement(Yt.Z,{text:E("ChatList.Search.NoResults"),description:E("ChatList.Search.NoResultsDescription")}),S&&h&&h.length>0&&b.map(((e,n)=>{var s;const l=0===n||(0,le.kj)(e.date)!==(0,le.kj)(b[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},l&&a.ZP.createElement("p",{className:"section-heading",dir:E.isRtl?"rtl":void 0},(0,le.np)(E,new Date(1e3*e.date))),a.ZP.createElement(Pn.Z,{key:e.id,theme:t,message:e,origin:o.Cr.Search,senderTitle:(0,ln.F)(E,e,c,d),date:e.date,lastSyncTime:v,className:"scroll-item",onPlay:y,onDateClick:I,isDownloading:null===(s=Z[e.chatId])||void 0===s?void 0:s.includes(e.id)}))}))))}))),En=[{type:o.nJ.ChatList,title:"SearchAllChatsShort"},{type:o.nJ.Media,title:"SharedMediaTab2"},{type:o.nJ.Links,title:"SharedLinksTab2"},{type:o.nJ.Files,title:"SharedFilesTab2"},{type:o.nJ.Music,title:"SharedMusicTab2"},{type:o.nJ.Voice,title:"SharedVoiceTab2"}],Cn=[{type:o.nJ.ChatList,title:"All Messages"},...En.slice(1)],fn=Object.keys(o.nJ).length/2,bn=(0,a.X$)((0,l.c$)((e=>{const{currentContent:t,chatId:n}=e.globalSearch;return{currentContent:t,chatId:n}}))((e=>{let{searchQuery:t,searchDate:n,isActive:s,currentContent:r=o.nJ.ChatList,chatId:i,onReset:c}=e;const{setGlobalSearchContent:d,setGlobalSearchDate:m}=(0,l.Sv)(),u=(0,R.Z)(),[h,v]=(0,a.eJ)(r),Z=(0,a.Ye)((()=>(0,le.xk)(t)),[t]),P=(0,a.I4)((e=>{const t=En[e];d({content:t.type}),v(e)}),[d]),g=(0,a.I4)((e=>{m({date:e.getTime()/1e3})}),[m]);(0,A.Z)({isActive:s,onBack:c});const p=(0,a.sO)(null),E=(0,$e.Z)(p,s,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:p,onKeyDown:E},a.ZP.createElement(Rt.Z,{activeTab:h,tabs:i?Cn:En,onSwitchTab:P}),a.ZP.createElement(O.Z,{name:u.isRtl?"slide-optimized-rtl":"slide-optimized",renderCount:fn,activeKey:r},(()=>{switch(r){case o.nJ.ChatList:return i?a.ZP.createElement(Wt,{searchQuery:t,dateSearchQuery:Z,onReset:c,onSearchDateSelect:g}):a.ZP.createElement(jt,{searchQuery:t,searchDate:n,dateSearchQuery:Z,onReset:c,onSearchDateSelect:g});case o.nJ.Media:return a.ZP.createElement(on,{searchQuery:t});case o.nJ.Links:return a.ZP.createElement(mn,{searchQuery:t});case o.nJ.Files:return a.ZP.createElement(Zn,{searchQuery:t});case o.nJ.Music:return a.ZP.createElement(pn,{key:"audio",searchQuery:t});case o.nJ.Voice:return a.ZP.createElement(pn,{key:"voice",isVoice:!0,searchQuery:t});default:return}})()))})));var In=n(91090);const yn={currentPassword:"",password:"",hint:"",email:""},Sn=(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 yn;default:return e}},Nn=(0,a.X$)((e=>{let{currentScreen:t,editedFolderId:n,onReset:s,onSaveFilter:r,onScreenSelect:i}=e;const{signOut:c,deleteChatFolder:d}=(0,l.Sv)(),[u,h]=(0,a.eJ)(!1),[v,Z]=(0,a.eJ)(!1),P=(0,a.I4)((()=>{h(!0)}),[]),g=(0,a.I4)((()=>{h(!1)}),[]),p=(0,a.I4)((()=>{Z(!0)}),[]),E=(0,a.I4)((()=>{Z(!1)}),[]),C=(0,a.I4)((()=>{g(),c()}),[g,c]),f=(0,a.I4)((()=>{E(),d({id:n}),s()}),[n,E,d,s]),b=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(D.Z,{round:!0,ripple:!m.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]),I=(0,R.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:s,ariaLabel:I("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(t){case o.MT.EditProfile:return a.ZP.createElement("h3",null,I("lng_settings_information"));case o.MT.General:return a.ZP.createElement("h3",null,I("General"));case o.MT.QuickReaction:return a.ZP.createElement("h3",null,I("DoubleTapSetting"));case o.MT.Notifications:return a.ZP.createElement("h3",null,I("Notifications"));case o.MT.DataStorage:return a.ZP.createElement("h3",null,I("DataSettings"));case o.MT.Privacy:return a.ZP.createElement("h3",null,I("PrivacySettings"));case o.MT.Language:return a.ZP.createElement("h3",null,I("Language"));case o.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,I("ChatBackground"));case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,I("SetColor"));case o.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,I("PrivacyPhone"));case o.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,I("PrivacyLastSeen"));case o.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,I("Privacy.ProfilePhoto"));case o.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,I("PrivacyForwards"));case o.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,I("AutodownloadGroupChats"));case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement("h3",null,I("AlwaysShareWith"));case o.MT.PrivacyPhoneNumberDeniedContacts:case o.MT.PrivacyLastSeenDeniedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:case o.MT.PrivacyForwardingDeniedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement("h3",null,I("NeverShareWith"));case o.MT.ActiveSessions:return a.ZP.createElement("h3",null,I("SessionsTitle"));case o.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,I("BlockedUsers"));case o.MT.TwoFaDisabled:case o.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,I("TwoStepVerification"));case o.MT.TwoFaNewPassword:case o.MT.TwoFaChangePasswordNew:case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,I("PleaseEnterCurrentPassword"));case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,I("PleaseReEnterPassword"));case o.MT.TwoFaNewPasswordHint:case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,I("PasswordHint"));case o.MT.TwoFaNewPasswordEmail:case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,I("RecoveryEmailTitle"));case o.MT.TwoFaNewPasswordEmailCode:case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement("h3",null,"Recovery Email Code");case o.MT.TwoFaCongratulations:return a.ZP.createElement("h3",null,I("TwoStepVerificationPasswordSet"));case o.MT.TwoFaChangePasswordCurrent:case o.MT.TwoFaTurnOff:case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,I("PleaseEnterCurrentPassword"));case o.MT.PasscodeDisabled:case o.MT.PasscodeEnabled:case o.MT.PasscodeNewPasscode:case o.MT.PasscodeNewPasscodeConfirm:case o.MT.PasscodeCongratulations:return a.ZP.createElement("h3",null,I("Passcode"));case o.MT.PasscodeTurnOff:return a.ZP.createElement("h3",null,I("PasscodeController.Disable.Title"));case o.MT.PasscodeChangePasscodeCurrent:case o.MT.PasscodeChangePasscodeNew:return a.ZP.createElement("h3",null,I("PasscodeController.Change.Title"));case o.MT.PasscodeChangePasscodeConfirm:return a.ZP.createElement("h3",null,I("PasscodeController.ReEnterPasscode.Placeholder"));case o.MT.Folders:return a.ZP.createElement("h3",null,I("Filters"));case o.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,I("FilterNew"));case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,I("FilterEdit")),n&&a.ZP.createElement(_.Z,{className:"settings-more-menu",trigger:b,positionX:"right"},a.ZP.createElement(U.Z,{icon:"delete",destructive:!0,onClick:p},I("Delete"))));case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},t===o.MT.FoldersIncludedChats||t===o.MT.FoldersIncludedChatsFromChatList?a.ZP.createElement("h3",null,I("FilterInclude")):a.ZP.createElement("h3",null,I("FilterExclude")),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:r,ariaLabel:I("AutoDeleteConfirm")},a.ZP.createElement("i",{className:"icon-check"})));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,I("SETTINGS")),a.ZP.createElement(D.Z,{round:!0,ripple:!m.wB,size:"smaller",color:"translucent",onClick:()=>i(o.MT.EditProfile),ariaLabel:I("lng_settings_information")},a.ZP.createElement("i",{className:"icon-edit"})),a.ZP.createElement(_.Z,{className:"settings-more-menu",trigger:b,positionX:"right"},a.ZP.createElement(U.Z,{icon:"logout",onClick:P},I("LogOutTitle"))))}}(),a.ZP.createElement(tt.Z,{isOpen:u,onClose:g,text:I("lng_sure_logout"),confirmLabel:I("AccountSettings.Logout"),confirmHandler:C,confirmIsDestructive:!0}),a.ZP.createElement(tt.Z,{isOpen:v,onClose:E,text:I("FilterDeleteAlert"),confirmLabel:I("Delete"),confirmHandler:f,confirmIsDestructive:!0}))}));var kn=n(20787),wn=n(70180);const Mn=(0,a.X$)((0,l.c$)((e=>{const{currentUserId:t,lastSyncTime:n}=e;return{sessionCount:e.activeSessions.orderedHashes.length,currentUser:t?(0,i.dy)(e,t):void 0,lastSyncTime:n}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:s,currentUser:r,sessionCount:i,lastSyncTime:c}=e;const{loadProfilePhotos:d,loadAuthorizations:m}=(0,l.Sv)(),u=(0,R.Z)(),h=null==r?void 0:r.id;return(0,a.d4)((()=>{h&&c&&d({profileId:h})}),[c,h,d]),(0,A.Z)({isActive:t,onBack:s}),(0,a.d4)((()=>{c&&m()}),[c,m]),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-main-menu"},r&&a.ZP.createElement(kn.Z,{userId:r.id,forceShowSelf:!0}),r&&a.ZP.createElement(wn.Z,{chatOrUserId:r.id,forceShowSelf:!0}),a.ZP.createElement(Je.Z,{icon:"settings",onClick:()=>n(o.MT.General)},u("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Je.Z,{icon:"unmute",onClick:()=>n(o.MT.Notifications)},u("Notifications")),a.ZP.createElement(Je.Z,{icon:"data",onClick:()=>n(o.MT.DataStorage)},u("DataSettings")),a.ZP.createElement(Je.Z,{icon:"lock",onClick:()=>n(o.MT.Privacy)},u("PrivacySettings")),a.ZP.createElement(Je.Z,{icon:"folder",onClick:()=>n(o.MT.Folders)},u("Filters")),a.ZP.createElement(Je.Z,{icon:"active-sessions",onClick:()=>n(o.MT.ActiveSessions)},u("SessionsTitle"),i>0&&a.ZP.createElement("span",{className:"settings-item__current-value"},i)),a.ZP.createElement(Je.Z,{icon:"language",onClick:()=>n(o.MT.Language)},u("Language"),a.ZP.createElement("span",{className:"settings-item__current-value"},u.langName))))})));var Tn=n(90710),An=n(41151);const Rn="https://t.me/",Ln=/https:\/\/t\.me\/?/i,Fn=/^([a-zA-Z0-9_]+)$/,Bn=(0,q.Ds)((e=>e()),250,!1),xn=(0,a.X$)((e=>{let{currentUsername:t,asLink:n,isLoading:s,isUsernameAvailable:o,checkUsername:l,onChange:r}=e;const[i,c]=(0,a.eJ)(t||""),d=(0,R.Z)(),m=n?"SetUrl":"Username",u=d(n?"SetUrlPlaceholder":"Username"),[h,v]=(0,a.Ye)((()=>i.length?i.length<5?[void 0,`${u} is too short`]:i.length>32?[void 0,`${u} is too long`]:Fn.test(i)?void 0===o?[]:[o?d(`${m}Available`,"Username"):void 0,!1===o?d(`${m}InUse`):void 0]:[void 0,`${u} contains invalid characters`]:[]),[i,o,d,m,u]);(0,a.d4)((()=>{c(t||"")}),[n,t]);const Z=(0,a.I4)((e=>{const t=e.target.value.trim().replace(Ln,"");c(t),e.target.value=`${n?Rn:""}${t}`;const a=function(e){return e.length>=5&&e.length<=32&&Fn.test(e)}(t);a&&Bn((()=>{l({username:t})})),r&&r(!!a&&t)}),[n,l,r]);return a.ZP.createElement(Ge.Z,{value:`${n?Rn:""}${i}`,onChange:Z,label:u,error:v,success:h,readOnly:s})})),Dn=(0,q.P2)((e=>e()),6e4,!0),$n="Please provide your first name",On="Bio can' be longer than 70 characters",_n=(0,a.X$)((0,l.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a}=e.profileEdit||{},s=t?(0,i.dy)(e,t):void 0;if(!s)return{progress:n,isUsernameAvailable:a};const{firstName:o,lastName:l,username:c,fullInfo:d}=s,{bio:m}=d||{};return{currentAvatarHash:(0,r.RT)(s),currentFirstName:o,currentLastName:l,currentBio:m,currentUsername:c,progress:n,isUsernameAvailable:a}}))((e=>{let{isActive:t,onReset:n,currentAvatarHash:r,currentFirstName:i,currentLastName:c,currentBio:d,currentUsername:m,progress:u,isUsernameAvailable:h}=e;const{loadCurrentUser:v,updateProfile:Z,checkUsername:P}=(0,l.Sv)(),g=(0,R.Z)(),[p,E]=(0,a.eJ)(!1),[C,f]=(0,a.eJ)(!1),[b,I]=(0,a.eJ)(),[y,S]=(0,a.eJ)(),[N,k]=(0,a.eJ)(i||""),[w,M]=(0,a.eJ)(c||""),[T,F]=(0,a.eJ)(d||""),[B,x]=(0,a.eJ)(m||""),D=(0,L.Z)(r,!1,s.IU.BlobUrl),$=u===o.rN.InProgress,O=!1===B,_=(0,a.Ye)((()=>!O&&(Boolean(y)||C||!0===h)),[y,C,O,h]);(0,A.Z)({isActive:t,onBack:n}),(0,a.d4)((()=>{Dn((()=>{v()}))}),[v]),(0,a.d4)((()=>{S(void 0)}),[D]),(0,a.d4)((()=>{k(i||""),M(c||""),F(d||"")}),[i,c,d]),(0,a.d4)((()=>{x(m||"")}),[m]),(0,a.d4)((()=>{u===o.rN.Complete&&(f(!1),E(!1),I(void 0))}),[u]);const U=(0,a.I4)((e=>{S(e)}),[]),G=(0,a.I4)((e=>{k(e.target.value),f(!0)}),[]),X=(0,a.I4)((e=>{M(e.target.value),f(!0)}),[]),J=(0,a.I4)((e=>{F(e.target.value),f(!0)}),[]),z=(0,a.I4)((e=>{x(e),E(!0)}),[]),V=(0,a.I4)((()=>{const e=N.trim(),t=w.trim(),n=T.trim();e.length?n.length>70?I(On):Z({photo:y,...C&&{firstName:e,lastName:t,bio:n},...p&&{username:B}}):I($n)}),[y,N,w,T,C,B,p,Z]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-edit-profile settings-item"},a.ZP.createElement(Tn.Z,{currentAvatarBlobUrl:D,onChange:U,title:"Edit your profile photo",disabled:$}),a.ZP.createElement(Ge.Z,{value:N,onChange:G,label:g("FirstName"),disabled:$,error:b===$n?b:void 0}),a.ZP.createElement(Ge.Z,{value:w,onChange:X,label:g("LastName"),disabled:$}),a.ZP.createElement(Ge.Z,{value:T,onChange:J,label:g("UserBio"),disabled:$,error:b===On?b:void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},(0,Te.Z)(g("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0},g("Username")),a.ZP.createElement(xn,{currentUsername:B||"",isLoading:$,isUsernameAvailable:h,checkUsername:P,onChange:z}),a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},(0,Te.Z)(g("UsernameHelp"),["br","simple_markdown"])),B&&a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},g("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},"https://t.me/",B)))),a.ZP.createElement(An.Z,{isShown:_,onClick:V,disabled:$,ariaLabel:"Save changes"},$?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Un=(0,a.X$)((0,l.c$)((e=>(0,Be.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb"])))((e=>{let{isActive:t,onReset:n,canAutoLoadPhotoFromContacts:s,canAutoLoadPhotoInPrivateChats:o,canAutoLoadPhotoInGroups:r,canAutoLoadPhotoInChannels:i,canAutoLoadVideoFromContacts:c,canAutoLoadVideoInPrivateChats:d,canAutoLoadVideoInGroups:m,canAutoLoadVideoInChannels:h,canAutoLoadFileFromContacts:v,canAutoLoadFileInPrivateChats:Z,canAutoLoadFileInGroups:P,canAutoLoadFileInChannels:g,canAutoPlayGifs:p,canAutoPlayVideos:E,autoLoadFileMaxSizeMb:C}=e;const{setSettingOption:f}=(0,l.Sv)(),b=(0,R.Z)();(0,A.Z)({isActive:t,onBack:n});const I=(0,a.I4)((e=>b("AutodownloadSizeLimitUpTo",b("FileSize.MB",String(u.by[e]),"i"))),[b]),y=(0,a.I4)((e=>{f({autoLoadFileMaxSizeMb:u.by[e]})}),[f]),S=(0,a.I4)((e=>{f({canAutoPlayGifs:e})}),[f]),N=(0,a.I4)((e=>{f({canAutoPlayVideos:e})}),[f]);function k(e,t,n,s,o,l){return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},e),a.ZP.createElement(mt.Z,{label:b("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>f({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(mt.Z,{label:b("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>f({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(mt.Z,{label:b("AutoDownloadSettings.GroupChats"),checked:o,onCheck:e=>f({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(mt.Z,{label:b("AutoDownloadSettings.Channels"),checked:l,onCheck:e=>f({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=u.by.indexOf(C);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(ce.Z,{label:b("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:I,onChange:y}))}())}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},k(b("AutoDownloadPhotosTitle"),"Photo",s,o,r,i),k(b("AutoDownloadVideosTitle"),"Video",c,d,m,h),k("Auto-download files","File",v,Z,P,g),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},b("AutoplayMedia")),a.ZP.createElement(mt.Z,{label:b("GifsTab2"),checked:p,onCheck:S}),a.ZP.createElement(mt.Z,{label:b("DataAndStorage.Autoplay.Videos"),checked:E,onCheck:N})))})));var Gn=n(95616),Xn=n(58912);const Jn=(0,q.P2)((e=>e()),6e4,!0),zn=(0,a.X$)((0,l.c$)((e=>{const{orderedIds:t,byId:n,recommended:a}=e.chatFolders;return{orderedFolderIds:t,foldersById:n,recommendedChatFolders:a}}))((e=>{let{isActive:t,onCreateFolder:n,onEditFolder:s,onReset:o,orderedFolderIds:i,foldersById:c,recommendedChatFolders:d}=e;const{loadRecommendedChatFolders:m,addChatFolder:h,showDialog:v}=(0,l.Sv)();(0,a.d4)((()=>{Jn((()=>{m()}))}),[m]);const Z=(0,a.I4)((()=>{Object.keys(c).length>=10?v({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):n()}),[c,v,n]),P=(0,R.Z)();(0,A.Z)({isActive:t,onBack:o});const g=(0,Gn.mE)(),p=(0,a.Ye)((()=>{if(i)return i.map((e=>{const t=c[e];return{id:t.id,title:t.title,subtitle:(0,r.SB)(P,t,g[t.id])}}))}),[i,c,P,g]),E=(0,a.I4)((e=>{Object.keys(c).length>=10?v({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):h({folder:e})}),[c,h,v]);return a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(Xn.Z,{size:u.ku,tgsUrl:Mt.l.FoldersAll,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},P("CreateNewFilterInfo")),a.ZP.createElement(D.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:Z,isRtl:P.isRtl},a.ZP.createElement("i",{className:"icon-add"}),P("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:P.isRtl?"rtl":void 0},P("Filters")),null!=p&&p.length?p.map((e=>a.ZP.createElement(Je.Z,{className:"mb-2 no-icon",narrow:!0,multiline:!0,onClick:()=>s(c[e.id])},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))):p&&!p.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(_e.Z,null)),d&&Boolean(d.length)&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:P.isRtl?"rtl":void 0},P("FilterRecommended")),d.map((e=>a.ZP.createElement(Je.Z,{className:"mb-2",narrow:!0,onClick:()=>E(e)},a.ZP.createElement("div",{className:"settings-folders-recommended-item"},a.ZP.createElement("div",{className:"multiline-item"},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.description)),a.ZP.createElement(D.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:P.isRtl},P("Add"))))))))})));var Vn=n(53455);const Yn=e=>{let{count:t,itemName:n,itemPluralName:s,isLoading:o,onClick:l}=e;const r=(0,R.Z)();return a.ZP.createElement(D.Z,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:o,isRtl:r.isRtl,onClick:l},a.ZP.createElement("i",{className:"icon-down"}),"Show ",t," more ",t>1?s||`${n}s`:n)},Hn="Please provide a title for this folder.",qn="ChatList.Filter.Error.Empty",jn=(0,a.X$)((0,l.c$)((e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}}))((e=>{let{state:t,dispatch:n,onAddIncludedChats:s,onAddExcludedChats:o,isActive:i,onReset:c,onBack:d,loadedActiveChatIds:m,loadedArchivedChatIds:h}=e;const{editChatFolder:v,addChatFolder:Z}=(0,l.Sv)(),[P,g]=(0,a.eJ)(!1),[p,E]=(0,a.eJ)(!1),{selectedChatIds:C,selectedChatTypes:f}=(0,Vn.vb)(t,"included"),{selectedChatIds:b,selectedChatTypes:I}=(0,Vn.vb)(t,"excluded");(0,a.d4)((()=>{g(!1),E(!1)}),[t.folderId]);const[y,S]=(0,a.Ye)((()=>{const e=new Set([...m||[],...h||[]]),t=(0,Be.eL)(C,e),n=(0,Be.eL)(b,e);return[P?t:t.slice(0,5-f.length),p?n:n.slice(0,5-I.length)]}),[b,C,f,I,p,P,m,h]),N=(0,R.Z)();(0,A.Z)({isActive:i,onBack:d});const k=(0,a.I4)((e=>{const{currentTarget:t}=e;n({type:"setTitle",payload:t.value.trim()})}),[n]),w=(0,a.I4)((()=>{const{title:e}=t.folder;e?C.length||Object.keys(f).length?(n({type:"setIsLoading",payload:!0}),"edit"===t.mode?v({id:t.folderId,folderUpdate:t.folder}):Z({folder:t.folder}),setTimeout((()=>{c()}),500)):n({type:"setError",payload:qn}):n({type:"setError",payload:Hn})}),[Z,n,v,C.length,f,c,t]);function M(e){const t="included"===e?f:I,n="included"===e?y:S,s="included"===e?P:p,o=("included"===e?C:b).length-t.length-n.length,l="included"===e?()=>g(!0):()=>E(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?Vn.fi.find((t=>{let{key:n}=t;return n===e})):Vn.Yy.find((t=>{let{key:n}=t;return n===e}));if(n)return a.ZP.createElement(Je.Z,{key:n.key,className:"settings-folders-list-item mb-1",icon:n.icon,narrow:!0,inactive:!0},N(n.title))}(t,e))),n.map((e=>a.ZP.createElement(Je.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,r.YC)(e)?a.ZP.createElement(Ve.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(ze.Z,{avatarSize:"small",chatId:e})))),!s&&o>0&&a.ZP.createElement(Yn,{count:o,itemName:"chat",onClick:l}))}return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(Xn.Z,{size:u.ku,tgsUrl:Mt.l.FoldersNew,play:String(t.folderId),className:"settings-content-icon"}),"create"===t.mode&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:N.isRtl?"rtl":void 0},N("FilterIncludeInfo")),a.ZP.createElement(Ge.Z,{className:"mb-0",label:N("FilterNameHint"),value:t.folder.title,onChange:k,error:t.error&&t.error===Hn?Hn:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},t.error&&t.error===qn&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:N.isRtl?"rtl":void 0},N(t.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("FilterInclude")),a.ZP.createElement(Je.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:s},N("FilterAddChats")),M("included")),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("FilterExclude")),a.ZP.createElement(Je.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:o},N("FilterAddChats")),M("excluded"))),a.ZP.createElement(An.Z,{isShown:Boolean(t.isTouched),disabled:t.isLoading,onClick:w,ariaLabel:"edit"===t.mode?"Save changes":"Create folder"},t.isLoading?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Kn=(0,a.X$)((e=>{let{mode:t,chatIds:n,selectedIds:s,selectedChatTypes:o,filterValue:l,onSelectedIdsChange:i,onSelectedChatTypesChange:c,onFilterChange:d}=e;const m=(0,a.sO)(null),u="included"===t?Vn.fi:Vn.Yy,h=s.length+o.length>10,v=s.length>=100;(0,a.d4)((()=>{setTimeout((()=>{requestAnimationFrame((()=>{m.current.focus()}))}),500)}),[]);const Z=(0,a.I4)((e=>{const t=[...s];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),i(t)}),[s,i]),P=(0,a.I4)((e=>{const t=[...o];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),c(t)}),[o,c]),g=(0,a.I4)((e=>{const{value:t}=e.currentTarget;d(t)}),[d]),p=(0,R.Z)(),[E,C]=(0,De.Z)(void 0,n,Boolean(l));return a.ZP.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"picker-header custom-scroll"},o.map((function(e){const t=u.find((t=>{let{key:n}=t;return e===n}));if(t)return a.ZP.createElement(Ht.Z,{icon:t.icon,title:p(t.title),isMinimized:h,canClose:!0,onClick:P,clickArg:t.key})})),s.map(((e,t)=>a.ZP.createElement(Ht.Z,{chatOrUserId:e,isMinimized:h&&t<s.length-5,canClose:!0,onClick:Z,clickArg:e}))),v?a.ZP.createElement("p",{className:"max-items-reached",dir:"auto"},"Sorry, you can't add more than 100 chats."):a.ZP.createElement(Ge.Z,{ref:m,value:l,onChange:g,placeholder:p("Search")})),a.ZP.createElement(Xe.Z,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:E,onLoadMore:C},(!E||!E.length||E.includes(n[0]))&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h4",{key:"header1",className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("FilterChatTypes")),u.map((function(e){return a.ZP.createElement(Je.Z,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>P(e.key),ripple:!0},a.ZP.createElement("i",{className:`icon-${e.icon}`}),a.ZP.createElement("h3",{className:"chat-type",dir:"auto"},p(e.title)),a.ZP.createElement(mt.Z,{label:"",checked:o.includes(e.key),round:!0}))})),a.ZP.createElement("div",{key:"divider",className:"picker-list-divider"}),a.ZP.createElement("h4",{key:"header2",className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("FilterChats"))),null!=E&&E.length?E.map((function(e){const t=s.includes(e);return a.ZP.createElement(Je.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>Z(e),ripple:!0,disabled:!t&&v},(0,r.YC)(e)?a.ZP.createElement(Ve.Z,{userId:e}):a.ZP.createElement(ze.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(mt.Z,{label:"",checked:t,round:!0}))})):E&&!E.length?a.ZP.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):a.ZP.createElement(_e.Z,{key:"loading"})))})),Wn=(0,a.X$)((e=>{let{mode:t,state:n,dispatch:s,isActive:o,onReset:i}=e;const{chatFilter:c}=n,{selectedChatIds:d,selectedChatTypes:m}=(0,Vn.vb)(n,t,!0),h=(0,R.Z)(),v=(0,Gn.d7)(u.Nf),Z=(0,Gn.d7)(u.WS),P=(0,a.Ye)((()=>{const e=(0,l.Rd)().chats.byId,t=[...v||[],...Z||[]];return(0,Be.Tw)([...d,...(0,r.$l)(h,t,e,c)])}),[v,Z,d,h,c]),g=(0,a.I4)((e=>{s({type:"setChatFilter",payload:e})}),[s]),p=(0,a.I4)((e=>{s("included"===t?{type:"setIncludeFilters",payload:{...n.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...n.excludeFilters,excludedChatIds:e}})}),[t,n,s]),E=(0,a.I4)((e=>{const n={};e.forEach((e=>{n[e]=!0})),s("included"===t?{type:"setIncludeFilters",payload:{includedChatIds:d,...n}}:{type:"setExcludeFilters",payload:{excludedChatIds:d,...n}})}),[t,d,s]);return(0,A.Z)({isActive:o,onBack:i}),P?a.ZP.createElement(Kn,{mode:t,chatIds:P,selectedIds:d,selectedChatTypes:m,filterValue:c,onSelectedIdsChange:p,onSelectedChatTypesChange:E,onFilterChange:g}):a.ZP.createElement(_e.Z,null)})),Qn=(0,a.X$)((e=>{let{currentScreen:t,shownScreen:n,state:s,dispatch:l,isActive:r,onScreenSelect:i,onReset:c}=e;const d=(0,a.I4)((()=>{t!==o.MT.FoldersCreateFolder&&t!==o.MT.FoldersEditFolder&&t!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{l({type:"reset"})}),200),t!==o.MT.FoldersIncludedChats&&t!==o.MT.FoldersExcludedChats?c():"create"===s.mode?i(o.MT.FoldersCreateFolder):i(o.MT.FoldersEditFolder)}),[s.mode,l,t,c,i]),m=(0,a.I4)((()=>{l({type:"reset"}),i(o.MT.FoldersCreateFolder)}),[i,l]),u=(0,a.I4)((e=>{l({type:"editFolder",payload:e}),i(o.MT.FoldersEditFolder)}),[l,i]),h=(0,a.I4)((()=>{l({type:"editIncludeFilters"}),i(t===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersIncludedChatsFromChatList:o.MT.FoldersIncludedChats)}),[t,l,i]),v=(0,a.I4)((()=>{l({type:"editExcludeFilters"}),i(t===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersExcludedChatsFromChatList:o.MT.FoldersExcludedChats)}),[t,l,i]);switch(t){case o.MT.Folders:return a.ZP.createElement(zn,{onCreateFolder:m,onEditFolder:u,isActive:r||[o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(n),onReset:c});case o.MT.FoldersCreateFolder:case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement(jn,{state:s,dispatch:l,onAddIncludedChats:h,onAddExcludedChats:v,onReset:d,isActive:r||[o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(n),onBack:c});case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(Wn,{mode:"included",state:s,dispatch:l,onReset:d,isActive:r});case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Wn,{mode:"excluded",state:s,dispatch:l,onReset:d,isActive:r});default:return}}));var ea=n(50711),ta=n(14434),na=n(70692);const aa=(0,a.X$)((e=>{let{size:t=u.DC,stickerSet:n,observeIntersection:s}=e;const o=(0,a.sO)(null),l=(0,tn.Op)(o,s),r=`stickerSet${n.id}`,i=(0,L.Z)(r,!l),c=(0,na.Z)(i),d=(0,a.Ye)((()=>{if(!i)return(0,Nt.Xv)(n.title,2)}),[i,n.title]);return a.ZP.createElement("div",{ref:o,className:"sticker-set-cover"},d,i&&a.ZP.createElement(Tt.Z,{size:t,tgsUrl:i,className:c}))})),sa=(0,a.X$)((e=>{let{stickerSet:t,observeIntersection:n}=e;const s=(0,a.sO)(null),o=(0,tn.Op)(s,n),l=(0,L.Z)(t.hasThumbnail&&`stickerSet${t.id}`,!o),r=(0,na.Z)(l),i=t.isVideos,c=(0,a.Ye)((()=>{if(i&&!m.Hh||!l)return(0,Nt.Xv)(t.title,2)}),[i,l,t.title]);return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},c,i?a.ZP.createElement("video",{src:l,className:r,loop:!0,autoPlay:!0}):a.ZP.createElement("img",{src:l,className:r,alt:""}))}));var oa=n(73547);const la=(0,a.X$)((e=>{var t;let{stickerSet:n,observeIntersection:s,onClick:o}=e;const l=(0,R.Z)();if(!n||!n.stickers)return;const r=null===(t=n.stickers)||void 0===t?void 0:t[0];return n.hasThumbnail||!r?a.ZP.createElement(Je.Z,{narrow:!0,className:"SettingsStickerSet",inactive:!r,onClick:()=>r&&o(r)},a.ZP.createElement(D.Z,{ariaLabel:n.title,color:"translucent",isRtl:l.isRtl},n.isLottie?a.ZP.createElement(aa,{size:u.Mw,stickerSet:n,observeIntersection:s}):a.ZP.createElement(sa,{stickerSet:n,observeIntersection:s})),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},n.title),a.ZP.createElement("div",{className:"subtitle"},l("StickerPack.StickerCount",n.count,"i")))):a.ZP.createElement(Je.Z,{narrow:!0,className:"SettingsStickerSet",onClick:()=>o(r)},a.ZP.createElement(oa.Z,{sticker:r,size:u.Mw,title:n.title,observeIntersection:s,clickArg:void 0,noContextMenu:!0}),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},n.title),a.ZP.createElement("div",{className:"subtitle"},l("StickerPack.StickerCount",n.count,"i"))))}));var ra=n(94851),ia=n(27370);const ca=["Solid and Steady","Nice and Fast","Lots of Stuff"],da=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],ma=(0,a.X$)((0,l.c$)((e=>{var t;const{theme:n,shouldUseSystemTheme:a}=e.settings.byKey;return{...(0,Be.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","isSensitiveEnabled","canChangeSensitive","timeFormat"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:null===(t=e.appConfig)||void 0===t?void 0:t.defaultReaction,theme:n,shouldUseSystemTheme:a}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:s,stickerSetIds:r,stickerSetsById:i,defaultReaction:c,messageTextSize:d,animationLevel:h,messageSendKeyCombo:v,shouldSuggestStickers:Z,shouldLoopStickers:P,timeFormat:g,theme:p,shouldUseSystemTheme:E}=e;const{setSettingOption:C}=(0,l.Sv)(),f=(0,a.sO)(null),{observe:b}=(0,tn.S1)({rootRef:f}),[I,y,S]=(0,M.Z)(),[N,k]=(0,a.eJ)(),w=(0,R.Z)(),T=[{label:w("EmptyChat.Appearance.Light"),value:"light"},{label:w("EmptyChat.Appearance.Dark"),value:"dark"},{label:w("EmptyChat.Appearance.System"),value:"auto"}],L=m.$b?void 0:[{value:"enter",label:w("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:w(m.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}],F=(0,a.I4)((e=>{ca.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),C({animationLevel:e})}),[C]),B=(0,a.I4)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,m.cj?16:15)}px`),document.documentElement.style.setProperty("--message-meta-height",`${Math.floor(1.3125*e)}px`),document.documentElement.style.setProperty("--message-text-size",`${e}px`),document.documentElement.setAttribute("data-message-text-size",e.toString()),C({messageTextSize:e})}),[C]),x=(0,a.I4)((e=>{const t="auto"===e?(0,m.vn)():e;C({theme:t}),C({shouldUseSystemTheme:"auto"===e}),t!==p&&(0,ia.Z)(t,h===u.zy)}),[h,C,p]),D=(0,a.I4)((e=>{C({timeFormat:e}),C({wasTimeFormatSetManually:!0}),(0,ea.qf)(e)}),[C]),$=(0,a.I4)((e=>{k(e),y()}),[y]),O=(0,a.I4)((e=>{C({messageSendKeyCombo:e})}),[C]),_=(0,a.I4)((e=>{C({shouldSuggestStickers:e})}),[C]),U=(0,a.I4)((e=>{C({shouldLoopStickers:e})}),[C]),G=r&&r.map((e=>{var t;return!(null==i||null===(t=i[e])||void 0===t||!t.installedDate)&&i[e]})).filter(Boolean);return(0,A.Z)({isActive:t,onBack:s}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},w("SETTINGS")),a.ZP.createElement(ce.Z,{label:w("TextSize"),min:12,max:20,value:d,onChange:B}),a.ZP.createElement(Je.Z,{icon:"photo",onClick:()=>n(o.MT.GeneralChatBackground)},w("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},w("Theme")),a.ZP.createElement(ta.Z,{name:"theme",options:T,selected:E?"auto":p,onChange:x})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(ta.Z,{name:"timeformat",options:da,selected:g,onChange:D})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:w.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(ce.Z,{options:ca,value:h,onChange:F})),L&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},w("VoiceOver.Keyboard")),a.ZP.createElement(ta.Z,{name:"keyboard-send-settings",options:L,onChange:O,selected:v})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},w("AccDescrStickers")),c&&a.ZP.createElement(Je.Z,{className:"SettingsDefaultReaction",onClick:()=>n(o.MT.QuickReaction)},a.ZP.createElement(kt.Z,{reaction:c}),a.ZP.createElement("div",{className:"title"},w("DoubleTapSetting"))),a.ZP.createElement(mt.Z,{label:w("SuggestStickers"),checked:Z,onCheck:_}),a.ZP.createElement(mt.Z,{label:w("LoopAnimatedStickers"),checked:P,onCheck:U}),a.ZP.createElement("div",{className:"mt-4",ref:f},G&&G.map((e=>a.ZP.createElement(la,{key:e.id,stickerSet:e,observeIntersection:b,onClick:$})))),N&&a.ZP.createElement(ra.Z,{isOpen:I,fromSticker:N,onClose:S})))})));var ua=n(85655);function ha(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function va(e){const t=e[0].toString(16),n=e[1].toString(16),a=e[2].toString(16);return(1==t.length?"0"+t:t)+(1==n.length?"0"+n:n)+(1==a.length?"0"+a:a)}function Za(e){let[t,n,a]=e;t/=255,n/=255,a/=255;let s,o,l=Math.max(t,n,a),r=Math.min(t,n,a),i=l,c=l-r;if(o=0==l?0:c/l,l==r)s=0;else{switch(l){case t:s=(n-a)/c+(n<a?6:0);break;case n:s=(a-t)/c+2;break;case a:s=(t-n)/c+4}s/=6}return[s,o,i]}function Pa(e){let t,n,a,[s,o,l]=e,r=Math.floor(6*s),i=6*s-r,c=l*(1-o),d=l*(1-i*o),m=l*(1-(1-i)*o);switch(r%6){case 0:t=l,n=m,a=c;break;case 1:t=d,n=l,a=c;break;case 2:t=c,n=l,a=m;break;case 3:t=c,n=d,a=l;break;case 4:t=m,n=c,a=l;break;case 5:t=l,n=c,a=d}return[Math.round(255*t),Math.round(255*n),Math.round(255*a)]}function ga(e){let[t,n,a]=Za(e);return n=Math.min(1,n+.05+.1*(1-n)),a=a>.5?Math.max(0,.65*a):Math.max(0,Math.min(1,1-.65*a)),`hsla(${360*t}, ${100*n}%, ${100*a}%, .4)`}var pa=n(49524),Ea=n(15866);const Ca=(0,a.X$)((e=>{var t;let{wallpaper:n,theme:s,isSelected:l,onClick:r}=e;const{slug:i,document:c}=n,d=`wallpaper${c.id}`,m=c.previewBlobUrl,h=(0,L.Z)(`${d}?size=m`),v=(0,Ea.Z)(null===(t=c.thumbnail)||void 0===t?void 0:t.dataUri,Boolean(h),!0),{transitionClassNames:Z}=(0,ae.Z)(Boolean(h||m),void 0,void 0,"slow"),[P,g]=(0,a.eJ)(!1),{mediaData:p,loadProgress:E}=(0,F.Z)(d,!P),C=!1===(0,B.Z)(P),{shouldRender:f,transitionClassNames:b}=(0,ae.Z)(P&&!p||i===o.mp,void 0,C,"slow"),I=(0,a.sO)();I.current=s;const y=(0,a.I4)((()=>{(async()=>{const e=await(0,S.gm)(p);await pa.save(u.fo,I.current,e),r(i)})()}),[p,r,i]);(0,a.d4)((()=>{p&&y()}),[p,y]);const N=(0,a.I4)((()=>{p?y():g((e=>!e))}),[p,y]),k=(0,V.Z)("WallpaperTile",l&&"selected");return a.ZP.createElement("div",{className:k,onClick:N},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:v,className:"thumbnail"}),a.ZP.createElement("img",{src:h||m,className:(0,V.Z)("full-media",Z),alt:""}),f&&a.ZP.createElement("div",{className:(0,V.Z)("spinner-container",b)},a.ZP.createElement(G.Z,{progress:E,onClick:N}))))})),fa=(0,q.P2)((e=>e()),6e4,!0),ba=(0,a.X$)((0,l.c$)((e=>{const t=(0,i.Pu)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:s,background:r,isBlurred:i,loadedWallpapers:c,theme:d}=e;const{loadWallpapers:m,uploadWallpaper:h,setThemeSettings:v}=(0,l.Sv)(),Z=(0,a.sO)();Z.current=d,(0,a.d4)((()=>{fa((()=>{m()}))}),[m]);const P=(0,a.I4)((e=>{const{files:t}=e.target;t&&t.length>0&&h(t[0])}),[h]),g=(0,a.I4)((()=>{(0,ua.g)("image/jpeg",P,!0)}),[P]),p=(0,a.I4)((()=>{n(o.MT.GeneralChatBackgroundColor)}),[n]),E=(0,a.I4)((()=>{v({theme:d,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===d?u.Vv:u.g})}),[v,d]),C=(0,a.I4)((e=>{v({theme:Z.current,background:e});const t=c&&c.find((t=>t.slug===e));null!=t&&t.document.thumbnail&&async function(e){const t=[0,0,0];let n,a,s,o,l=-4,r=[0,0,0],i=0;const c=document.createElement("canvas"),d=c.getContext&&c.getContext("2d");if(!d)return t;const m=await(0,S.pt)(e);s=m.naturalHeight||m.offsetHeight||m.height,a=m.naturalWidth||m.offsetWidth||m.width,c.height=s,c.width=a,d.drawImage(m,0,0);try{n=d.getImageData(0,0,a,s)}catch(e){return t}for(o=n.data.length;(l+=20)<o;)++i,r[0]+=n.data[l],r[1]+=n.data[l+1],r[2]+=n.data[l+2];return r[0]=Math.floor(r[0]/i),r[1]=Math.floor(r[1]/i),r[2]=Math.floor(r[2]/i),r}(t.document.thumbnail.dataUri).then((e=>{const t=ga(e),n=`#${va(e)}`;v({theme:Z.current,backgroundColor:n,patternColor:t})}))}),[c,v]),f=(0,a.I4)((e=>{v({theme:Z.current,isBlurred:e.target.checked})}),[v]),b=(0,R.Z)();(0,A.Z)({isActive:t,onBack:s});const I=(null==c?void 0:c[0])&&c[0].slug===o.mp;return a.ZP.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Je.Z,{icon:"camera-add",className:"mb-0",disabled:I,onClick:g},b("UploadImage")),a.ZP.createElement(Je.Z,{icon:"colorize",className:"mb-0",onClick:p},b("SetColor")),a.ZP.createElement(Je.Z,{icon:"favorite",onClick:E},b("ThemeResetToDefaults")),a.ZP.createElement(mt.Z,{label:b("BackgroundBlurred"),checked:Boolean(i),onChange:f})),c?a.ZP.createElement("div",{className:"settings-wallpapers"},c.map((e=>a.ZP.createElement(Ca,{wallpaper:e,theme:d,isSelected:r===e.slug,onClick:C})))):a.ZP.createElement(_e.Z,null))}))),Ia=Za(ha("e6ebee")),ya=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Sa(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 Na(e,t){let{colorPosition:n,huePosition:a}=e;return[a/(t.hueRect.width-1),n[0]/(t.colorRect.width-1),1-n[1]/(t.colorRect.height-1)]}const ka=(0,a.X$)((0,l.c$)((e=>{const t=(0,i.Pu)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}))((e=>{let{isActive:t,onReset:n,theme:s,backgroundColor:o}=e;const{setThemeSettings:r}=(0,l.Sv)(),i=(0,a.sO)();i.current=s;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=(0,a.sO)(null),u=(0,a.sO)(!0),[h,v]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?Za(ha(e.replace("#",""))):Ia}(o)),Z=(0,a.sO)(h);(0,a.d4)((()=>{Z.current=h}),[h]);const[P,g,p]=(0,M.Z)(),[E,C]=(0,a.eJ)(""),[f,b]=(0,a.eJ)(""),I=(0,a.sO)(),y=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:d.current.offsetLeft,...(0,Be.ei)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:m.current.offsetLeft,...(0,Be.ei)(m.current.getBoundingClientRect(),["width"])};function n(t){const n=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+c.current.scrollTop),e.height-1)],{huePosition:a}=Sa(Z.current,I.current);return v(Na({colorPosition:n,huePosition:a},I.current)),g(),!0}function a(e){const{colorPosition:n}=Sa(Z.current,I.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return v(Na({colorPosition:n,huePosition:a},I.current)),g(),!0}I.current={colorRect:e,hueRect:t},(0,Y.sf)(d.current,{onCapture:n,onDrag:n,onRelease:p,onClick:p,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,Y.sf)(m.current,{onCapture:a,onDrag:a,onRelease:p,onClick:p,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[g,p]);const{colorPosition:S=[0,0],huePosition:N=0}=I.current?Sa(h,I.current):{},k=va(Pa(h)),w=h[0],T=va(Pa([w,1,1]));(0,a.d4)((()=>{const e=Pa(h),t=`#${va(e)}`;if(C(e.join(", ")),b(t),!u.current){const n=ga(e);r({theme:i.current,background:void 0,backgroundColor:t,patternColor:n})}u.current=!1}),[h,r]),(0,a.d4)((()=>{!function(e,t,n,a){let s,o,l;n.current&&a.current?(s=a.current.colorRect.width,o=a.current.colorRect.height,l=n.current):(s=e.offsetWidth,o=e.offsetHeight,l=e.getContext("2d"),e.width=s,e.height=o,n.current=l);const r=l.createImageData(s,o),i=r.data,c=Pa([t,1,1]);let d=0;for(let e=0;e<o;e++){const t=1-e/(o-1),n=[255*t,255*t,255*t],a=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<s;e++){const t=e/(s-1);i[d++]=n[0]+(a[0]-n[0])*t,i[d++]=n[1]+(a[1]-n[1])*t,i[d++]=n[2]+(a[2]-n[2])*t,i[d++]=255}}l.putImageData(r,0,0)}(d.current.firstChild,w,y,I)}),[w]),(0,a.d4)((()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const n=e.getContext("2d"),a=n.createImageData(t,1),s=a.data;let o=0;for(let e=0;e<t;e++){const n=Pa([e/(t-1),1,1]);s[o++]=n[0],s[o++]=n[1],s[o++]=n[2],s[o++]=255}n.putImageData(a,0,0)}(m.current.firstChild)}),[]);const R=(0,a.I4)((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())));v(Za(e))}e.currentTarget.value=t}),[]),L=(0,a.I4)((e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&v(Za(ha(t.replace("#","")))),e.currentTarget.value=t}),[]),F=(0,a.I4)((e=>{v(Za(ha(e.currentTarget.dataset.color.replace("#",""))))}),[]),B=(0,V.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",P&&"is-dragging");return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{ref:c,className:B},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:d,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${S[0]}px, ${S[1]}px); background-color: #${k};`})),a.ZP.createElement("div",{ref:m,className:"hue-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translateX(${N}px); background-color: #${T};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(Ge.Z,{value:f,label:"HEX",onChange:L}),a.ZP.createElement(Ge.Z,{value:E,label:"RGB",onChange:R}))),a.ZP.createElement("div",{className:"predefined-colors"},ya.map((e=>a.ZP.createElement("div",{className:e===`#${k}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:F})))))})));var wa=n(88957),Ma=n(28406);const Ta=(0,a.X$)((0,l.c$)((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),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume})))((e=>{let{isActive:t,onReset:n,hasPrivateChatsNotifications:s,hasPrivateChatsMessagePreview:o,hasGroupNotifications:r,hasGroupMessagePreview:i,hasBroadcastNotifications:c,hasBroadcastMessagePreview:d,hasContactJoinedNotifications:m,hasPushNotifications:u,hasWebNotifications:h,notificationSoundVolume:v}=e;const{loadNotificationSettings:Z,updateContactSignUpNotification:P,updateNotificationSettings:g,updateWebNotificationSettings:p}=(0,l.Sv)();(0,a.d4)((()=>{Z()}),[Z]);const E=(0,wa.Z)(500,!0),C=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!s:!("group"===t?r:c),l="contact"===t?o:"group"===t?i:d;g({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:l},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[d,c,i,r,o,s,g]),f=(0,a.I4)((e=>{p({hasWebNotifications:e.target.checked})}),[p]),b=(0,a.I4)((e=>{p({hasPushNotifications:e.target.checked})}),[p]),I=(0,a.I4)((e=>{C(e,"contact","silent")}),[C]),y=(0,a.I4)((e=>{C(e,"contact","showPreviews")}),[C]),S=(0,a.I4)((e=>{C(e,"group","silent")}),[C]),N=(0,a.I4)((e=>{C(e,"group","showPreviews")}),[C]),k=(0,a.I4)((e=>{C(e,"broadcast","silent")}),[C]),w=(0,a.I4)((e=>{C(e,"broadcast","showPreviews")}),[C]),M=(0,a.I4)((e=>{P({isSilent:!e.target.checked})}),[P]),T=(0,a.I4)((e=>{p({notificationSoundVolume:e}),E((()=>(0,Ma.q3)(void 0,e)))}),[E,p]),L=(0,R.Z)();return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(mt.Z,{label:"Web notifications",subLabel:L(h?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:h,onChange:f}),a.ZP.createElement(mt.Z,{label:"Offline notifications",disabled:!h,subLabel:L(u?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:u,onChange:b}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(ce.Z,{label:"Sound",min:0,max:10,value:v,onChange:T}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("AutodownloadPrivateChats")),a.ZP.createElement(mt.Z,{label:L("NotificationsForPrivateChats"),subLabel:L(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:I}),a.ZP.createElement(mt.Z,{label:L("MessagePreview"),disabled:!s,subLabel:L(o?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:o,onChange:y})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("FilterGroups")),a.ZP.createElement(mt.Z,{label:L("NotificationsForGroups"),subLabel:L(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:S}),a.ZP.createElement(mt.Z,{label:L("MessagePreview"),disabled:!r,subLabel:L(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:N})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("FilterChannels")),a.ZP.createElement(mt.Z,{label:L("NotificationsForChannels"),subLabel:L(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:k}),a.ZP.createElement(mt.Z,{label:L("MessagePreview"),disabled:!c,subLabel:L(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:w})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("PhoneOther")),a.ZP.createElement(mt.Z,{label:L("ContactJoined"),checked:m,onChange:M})))}))),Aa=(0,a.X$)((0,l.c$)((e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:n,canChangeSensitive:a},privacy:s},blocked:o,passcode:{hasPasscode:l}}=e;return{hasPassword:t,hasPasscode:Boolean(l),blockedCount:o.totalCount,isSensitiveEnabled:n,canChangeSensitive:a,privacyPhoneNumber:s.phoneNumber,privacyLastSeen:s.lastSeen,privacyProfilePhoto:s.profilePhoto,privacyForwarding:s.forwards,privacyGroupChats:s.chatInvite,privacyPhoneCall:s.phoneCall,privacyPhoneP2P:s.phoneP2P}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:s,hasPassword:r,hasPasscode:i,blockedCount:c,isSensitiveEnabled:d,canChangeSensitive:m,privacyPhoneNumber:u,privacyLastSeen:h,privacyProfilePhoto:v,privacyForwarding:Z,privacyGroupChats:P,privacyPhoneCall:g,privacyPhoneP2P:p}=e;const{loadPrivacySettings:E,loadBlockedContacts:C,loadAuthorizations:f,loadContentSettings:b,updateContentSettings:I}=(0,l.Sv)();(0,a.d4)((()=>{C(),f(),E(),b()}),[C,f,E,b]);const y=(0,R.Z)();function S(e){const{visibility:t}=e||{},n=e?e.blockChatIds.length+e.blockUserIds.length:0,a=e?e.allowChatIds.length+e.allowUserIds.length:0,s=[];n&&s.push(`-${n}`),a&&s.push(`+${a}`);const o=s.length?`(${s.join(",")})`:"";switch(t){case"everybody":return`${y("P2PEverybody")} ${o}`;case"contacts":return`${y("P2PContacts")} ${o}`;case"nobody":return`${y("P2PNobody")} ${o}`}}return(0,A.Z)({isActive:t,onBack:s}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Je.Z,{icon:"delete-user",narrow:!0,onClick:()=>n(o.MT.PrivacyBlockedUsers)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("BlockedUsers")),c>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y("Users",c)))),a.ZP.createElement(Je.Z,{icon:"key",narrow:!0,onClick:()=>n(i?o.MT.PasscodeEnabled:o.MT.PasscodeDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("Passcode")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(i?"PasswordOn":"PasswordOff")))),a.ZP.createElement(Je.Z,{icon:"lock",narrow:!0,onClick:()=>n(r?o.MT.TwoFaEnabled:o.MT.TwoFaDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(r?"PasswordOn":"PasswordOff"))))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:y.isRtl?"rtl":void 0},y("PrivacyTitle")),a.ZP.createElement(Je.Z,{narrow:!0,className:"no-icon",onClick:()=>n(o.MT.PrivacyPhoneNumber)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},S(u)))),a.ZP.createElement(Je.Z,{narrow:!0,className:"no-icon",onClick:()=>n(o.MT.PrivacyLastSeen)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},S(h)))),a.ZP.createElement(Je.Z,{narrow:!0,className:"no-icon",onClick:()=>n(o.MT.PrivacyProfilePhoto)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},S(v)))),a.ZP.createElement(Je.Z,{narrow:!0,className:"no-icon",onClick:()=>n(o.MT.PrivacyPhoneCall)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("WhoCanCallMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},S(g)))),a.ZP.createElement(Je.Z,{narrow:!0,className:"no-icon",onClick:()=>n(o.MT.PrivacyPhoneP2P)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("PrivacyP2P")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},S(p)))),a.ZP.createElement(Je.Z,{narrow:!0,className:"no-icon",onClick:()=>n(o.MT.PrivacyForwarding)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},S(Z)))),a.ZP.createElement(Je.Z,{narrow:!0,className:"no-icon",onClick:()=>n(o.MT.PrivacyGroupChats)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},y("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},S(P))))),m&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("lng_settings_sensitive_title")),a.ZP.createElement(mt.Z,{label:y("lng_settings_sensitive_disable_filtering"),subLabel:y("lng_settings_sensitive_about"),checked:Boolean(d),disabled:!m,onCheck:I})))}))),Ra=(0,a.X$)((0,l.c$)((e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language})))((e=>{let{isActive:t,onReset:n,languages:s,language:o}=e;const{loadLanguages:r,setSettingOption:i}=(0,l.Sv)(),[c,d]=(0,a.eJ)(o),[m,u,h]=(0,M.Z)();(0,a.d4)((()=>{r()}),[r]);const v=(0,a.I4)((e=>{d(e),u(),(0,ea.m0)(e,(()=>{h(),i({language:e})}))}),[u,h,i]),Z=(0,a.Ye)((()=>s?function(e){const t=(window.navigator.language||"en").toLowerCase(),n=t.substr(0,2);return e.map((e=>{let{langCode:t,nativeName:n,name:a}=e;return{value:t,label:n,subLabel:a}})).sort((e=>!t||e.value!==t&&e.value!==n?0:-1))}(s):void 0),[s]);return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content settings-item settings-language custom-scroll settings-item--first"},Z?a.ZP.createElement(ta.Z,{name:"keyboard-send-settings",options:Z,selected:c,loadingOption:m?c:void 0,onChange:v}):a.ZP.createElement(_e.Z,null))})));function La(e){switch(e){case o.MT.PrivacyPhoneNumber:case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case o.MT.PrivacyLastSeen:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyLastSeenDeniedContacts:return"lastSeen";case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case o.MT.PrivacyForwarding:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyForwardingDeniedContacts:return"forwards";case o.MT.PrivacyGroupChats:case o.MT.PrivacyGroupChatsAllowedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return"chatInvite";case o.MT.PrivacyPhoneCall:case o.MT.PrivacyPhoneCallAllowedContacts:case o.MT.PrivacyPhoneCallDeniedContacts:return"phoneCall";case o.MT.PrivacyPhoneP2P:case o.MT.PrivacyPhoneP2PAllowedContacts:case o.MT.PrivacyPhoneP2PDeniedContacts:return"phoneP2P"}}const Fa=(0,a.X$)((0,l.c$)(((e,t)=>{let n,{screen:a}=t;const{chats:{byId:s},settings:{privacy:l}}=e;switch(a){case o.MT.PrivacyPhoneNumber:n=l.phoneNumber;break;case o.MT.PrivacyLastSeen:n=l.lastSeen;break;case o.MT.PrivacyProfilePhoto:n=l.profilePhoto;break;case o.MT.PrivacyPhoneCall:n=l.phoneCall;break;case o.MT.PrivacyPhoneP2P:n=l.phoneP2P;break;case o.MT.PrivacyForwarding:n=l.forwards;break;case o.MT.PrivacyGroupChats:n=l.chatInvite}return n?{...n,chatsById:s}:{}}))((e=>{let{screen:t,isActive:n,onScreenSelect:s,onReset:r,visibility:i,allowUserIds:c,allowChatIds:d,blockUserIds:m,blockChatIds:u,chatsById:h}=e;const{setPrivacyVisibility:v}=(0,l.Sv)(),Z=(0,R.Z)(),P=(0,a.Ye)((()=>{switch(t){case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyGroupChats:return[{value:"everybody",label:Z("P2PEverybody")},{value:"contacts",label:Z("P2PContacts")}];default:return[{value:"everybody",label:Z("P2PEverybody")},{value:"contacts",label:Z("P2PContacts")},{value:"nobody",label:Z("P2PNobody")}]}}),[Z,t]),g={shouldShowDenied:"nobody"!==i,shouldShowAllowed:"everybody"!==i},p=La(t),E=(0,a.Ye)((()=>{switch(t){case o.MT.PrivacyPhoneNumber:return Z("PrivacyPhoneTitle");case o.MT.PrivacyLastSeen:return Z("LastSeenTitle");case o.MT.PrivacyProfilePhoto:return Z("PrivacyProfilePhotoTitle");case o.MT.PrivacyForwarding:return Z("PrivacyForwardsTitle");case o.MT.PrivacyGroupChats:return Z("WhoCanAddMe");case o.MT.PrivacyPhoneCall:return Z("WhoCanCallMe");case o.MT.PrivacyPhoneP2P:return Z("PrivacyP2P");default:return}}),[Z,t]);(0,A.Z)({isActive:n,onBack:r});const C=(0,a.Ye)((()=>{if(t===o.MT.PrivacyLastSeen)return Z("CustomHelp")}),[Z,t]),f=(()=>{switch(t){case o.MT.PrivacyPhoneNumber:return o.MT.PrivacyPhoneNumberAllowedContacts;case o.MT.PrivacyLastSeen:return o.MT.PrivacyLastSeenAllowedContacts;case o.MT.PrivacyProfilePhoto:return o.MT.PrivacyProfilePhotoAllowedContacts;case o.MT.PrivacyForwarding:return o.MT.PrivacyForwardingAllowedContacts;case o.MT.PrivacyPhoneCall:return o.MT.PrivacyPhoneCallAllowedContacts;case o.MT.PrivacyPhoneP2P:return o.MT.PrivacyPhoneP2PAllowedContacts;default:return o.MT.PrivacyGroupChatsAllowedContacts}})(),b=(()=>{switch(t){case o.MT.PrivacyPhoneNumber:return o.MT.PrivacyPhoneNumberDeniedContacts;case o.MT.PrivacyLastSeen:return o.MT.PrivacyLastSeenDeniedContacts;case o.MT.PrivacyProfilePhoto:return o.MT.PrivacyProfilePhotoDeniedContacts;case o.MT.PrivacyForwarding:return o.MT.PrivacyForwardingDeniedContacts;case o.MT.PrivacyPhoneCall:return o.MT.PrivacyPhoneCallDeniedContacts;case o.MT.PrivacyPhoneP2P:return o.MT.PrivacyPhoneP2PDeniedContacts;default:return o.MT.PrivacyGroupChatsDeniedContacts}})(),I=(0,a.Ye)((()=>c&&d&&h?d.reduce(((e,t)=>e+(h[t]?h[t].membersCount:0)),c.length):0),[d,c,h]),y=(0,a.Ye)((()=>m&&u&&h?u.reduce(((e,t)=>e+(h[t]?h[t].membersCount:0)),m.length):0),[u,m,h]),S=(0,a.I4)((e=>{v({privacyKey:p,visibility:e})}),[p,v]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:Z.isRtl?"rtl":void 0},E),a.ZP.createElement(ta.Z,{name:`visibility-${p}`,options:P,onChange:S,selected:i}),C&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:Z.isRtl?"rtl":void 0},C)),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:Z.isRtl?"rtl":void 0},Z("PrivacyExceptions")),g.shouldShowAllowed&&a.ZP.createElement(Je.Z,{narrow:!0,icon:"add-user",onClick:()=>{s(f)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},I>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"+",I),a.ZP.createElement("span",{className:"title"},Z("AlwaysAllow")),a.ZP.createElement("span",{className:"subtitle"},Z("EditAdminAddUsers")))),g.shouldShowDenied&&a.ZP.createElement(Je.Z,{narrow:!0,icon:"delete-user",onClick:()=>{s(b)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},y>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"−",y),a.ZP.createElement("span",{className:"title"},Z("NeverAllow")),a.ZP.createElement("span",{className:"subtitle"},Z("EditAdminAddUsers"))))))})));function Ba(e){const t=e.platform.toLowerCase(),n=e.deviceModel.toLowerCase(),a=e.systemVersion.toLowerCase();return n.includes("xbox")?"xbox":n.includes("chrome")&&!n.includes("chromebook")?"chrome":n.includes("brave")?"brave":n.includes("vivaldi")?"vivaldi":n.includes("safari")?"safari":n.includes("firefox")?"firefox":n.includes("opera")?"opera":n.includes("samsungbrowser")?"samsung":t.includes("android")?"android":n.includes("iphone")||n.includes("ipad")||t.includes("ios")||t.includes("macos")||a.includes("macos")?"apple":t.includes("ubuntu")||a.includes("ubuntu")?"ubuntu":t.includes("linux")||a.includes("linux")?"linux":t.includes("windows")||a.includes("windows")?"windows":"unknown"}var xa=n(83321);const Da={SettingsActiveSession:"src-components-left-settings-SettingsActiveSession-module__SettingsActiveSession",settingsActiveSession:"src-components-left-settings-SettingsActiveSession-module__SettingsActiveSession",iconDevice:"src-components-left-settings-SettingsActiveSession-module__iconDevice",iconDevice__android:"src-components-left-settings-SettingsActiveSession-module__iconDevice__android",iconDeviceAndroid:"src-components-left-settings-SettingsActiveSession-module__iconDevice__android",iconDevice__apple:"src-components-left-settings-SettingsActiveSession-module__iconDevice__apple",iconDeviceApple:"src-components-left-settings-SettingsActiveSession-module__iconDevice__apple",iconDevice__brave:"src-components-left-settings-SettingsActiveSession-module__iconDevice__brave",iconDeviceBrave:"src-components-left-settings-SettingsActiveSession-module__iconDevice__brave",iconDevice__chrome:"src-components-left-settings-SettingsActiveSession-module__iconDevice__chrome",iconDeviceChrome:"src-components-left-settings-SettingsActiveSession-module__iconDevice__chrome",iconDevice__edge:"src-components-left-settings-SettingsActiveSession-module__iconDevice__edge",iconDeviceEdge:"src-components-left-settings-SettingsActiveSession-module__iconDevice__edge",iconDevice__firefox:"src-components-left-settings-SettingsActiveSession-module__iconDevice__firefox",iconDeviceFirefox:"src-components-left-settings-SettingsActiveSession-module__iconDevice__firefox",iconDevice__linux:"src-components-left-settings-SettingsActiveSession-module__iconDevice__linux",iconDeviceLinux:"src-components-left-settings-SettingsActiveSession-module__iconDevice__linux",iconDevice__opera:"src-components-left-settings-SettingsActiveSession-module__iconDevice__opera",iconDeviceOpera:"src-components-left-settings-SettingsActiveSession-module__iconDevice__opera",iconDevice__safari:"src-components-left-settings-SettingsActiveSession-module__iconDevice__safari",iconDeviceSafari:"src-components-left-settings-SettingsActiveSession-module__iconDevice__safari",iconDevice__samsung:"src-components-left-settings-SettingsActiveSession-module__iconDevice__samsung",iconDeviceSamsung:"src-components-left-settings-SettingsActiveSession-module__iconDevice__samsung",iconDevice__ubuntu:"src-components-left-settings-SettingsActiveSession-module__iconDevice__ubuntu",iconDeviceUbuntu:"src-components-left-settings-SettingsActiveSession-module__iconDevice__ubuntu",iconDevice__unknown:"src-components-left-settings-SettingsActiveSession-module__iconDevice__unknown",iconDeviceUnknown:"src-components-left-settings-SettingsActiveSession-module__iconDevice__unknown",iconDevice__vivaldi:"src-components-left-settings-SettingsActiveSession-module__iconDevice__vivaldi",iconDeviceVivaldi:"src-components-left-settings-SettingsActiveSession-module__iconDevice__vivaldi",iconDevice__windows:"src-components-left-settings-SettingsActiveSession-module__iconDevice__windows",iconDeviceWindows:"src-components-left-settings-SettingsActiveSession-module__iconDevice__windows",iconDevice__xbox:"src-components-left-settings-SettingsActiveSession-module__iconDevice__xbox",iconDeviceXbox:"src-components-left-settings-SettingsActiveSession-module__iconDevice__xbox",title:"src-components-left-settings-SettingsActiveSession-module__title",note:"src-components-left-settings-SettingsActiveSession-module__note",date:"src-components-left-settings-SettingsActiveSession-module__date",box:"src-components-left-settings-SettingsActiveSession-module__box",actionHeader:"src-components-left-settings-SettingsActiveSession-module__actionHeader",actionName:"src-components-left-settings-SettingsActiveSession-module__actionName",headerButton:"src-components-left-settings-SettingsActiveSession-module__headerButton"},$a=(0,a.X$)((0,l.c$)(((e,t)=>{let{hash:n}=t;return{session:n?e.activeSessions.byHash[n]:void 0}}))((e=>{let{isOpen:t,session:n,onClose:s}=e;const{changeSessionSettings:o,terminateAuthorization:r}=(0,l.Sv)(),i=(0,R.Z)(),c=(0,xe.Z)(n,!0),d=(0,a.I4)((()=>{o({hash:n.hash,areSecretChatsEnabled:!n.areSecretChatsEnabled})}),[o,n]),m=(0,a.I4)((()=>{o({hash:n.hash,areCallsEnabled:!n.areCallsEnabled})}),[o,n]),u=(0,a.I4)((()=>{r({hash:n.hash}),s()}),[s,n,r]);if(c)return a.ZP.createElement(Ue.Z,{header:a.ZP.createElement("div",{className:"modal-header-condensed",dir:i.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:i("Close"),onClick:s},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},i("SessionPreview.Title")),a.ZP.createElement(D.Z,{color:"danger",onClick:u,className:(0,V.Z)("modal-action-button",Da.headerButton)},i("SessionPreview.TerminateSession"))),isOpen:t,hasCloseButton:!0,onClose:s,className:Da.SettingsActiveSession},a.ZP.createElement("div",{className:(0,V.Z)(Da.iconDevice,c&&Da[`iconDevice__${Ba(c)}`])}),a.ZP.createElement("h3",{className:Da.title,dir:"auto"},null==c?void 0:c.deviceModel),a.ZP.createElement("div",{className:Da.date,"aria-label":i("PrivacySettings.LastSeen")},(0,le.SA)(1e3*c.dateActive,i.code)),a.ZP.createElement("dl",{className:Da.box},a.ZP.createElement("dt",null,i("SessionPreview.App")),a.ZP.createElement("dd",null,null==c?void 0:c.appName," ",null==c?void 0:c.appVersion,","," ",null==c?void 0:c.platform," ",null==c?void 0:c.systemVersion),a.ZP.createElement("dt",null,i("SessionPreview.Ip")),a.ZP.createElement("dd",null,null==c?void 0:c.ip),a.ZP.createElement("dt",null,i("SessionPreview.Location")),a.ZP.createElement("dd",null,c&&function(e){return[e.region,e.country].filter(Boolean).join(", ")}(c))),a.ZP.createElement("p",{className:Da.note},i("SessionPreview.IpDesc")),a.ZP.createElement("h4",{className:Da.actionHeader},i("AuthSessions.View.AcceptTitle")),a.ZP.createElement(Je.Z,{onClick:d},a.ZP.createElement("span",{className:Da.actionName},i("SessionPreview.Accept.Secret")),a.ZP.createElement(xa.Z,{id:"accept_secrets",label:"On",checked:c.areSecretChatsEnabled})),a.ZP.createElement(Je.Z,{onClick:m},a.ZP.createElement("span",{className:Da.actionName},i("SessionPreview.Accept.Calls")),a.ZP.createElement(xa.Z,{id:"accept_calls",label:"On",checked:c.areCallsEnabled})))})));function Oa(e){return[e.region,e.country].filter(Boolean).join(", ")}const _a=(0,a.X$)((0,l.c$)((e=>e.activeSessions))((e=>{let{isActive:t,onReset:n,byHash:s,orderedHashes:o,ttlDays:r}=e;const{terminateAuthorization:i,terminateAllAuthorizations:c,changeSessionTtl:d}=(0,l.Sv)(),m=(0,R.Z)(),[u,h,v]=(0,M.Z)(),[Z,P]=(0,a.eJ)(),[g,p,E]=(0,M.Z)(),C=(0,a.Ye)((()=>{if(void 0!==r)return r<=7?"7":r<=30?"30":r<=90?"90":r<=180?"180":void 0}),[r]),f=(0,a.Ye)((()=>[{label:m("Weeks",1,"i"),value:"7"},{label:m("Months",1,"i"),value:"30"},{label:m("Months",3,"i"),value:"90"},{label:m("Months",6,"i"),value:"180"}]),[m]),b=(0,a.I4)((e=>{i({hash:e})}),[i]),I=(0,a.I4)((()=>{v(),c()}),[v,c]),y=(0,a.I4)((e=>{P(e),p()}),[p]),S=(0,a.I4)((()=>{P(void 0),E()}),[E]),N=(0,a.I4)((e=>{d({days:Number(e)})}),[d]),k=(0,a.Ye)((()=>{const e=o.find((e=>s[e].isCurrent));return e?s[e]:void 0}),[s,o]),w=(0,a.Ye)((()=>o.filter((e=>!s[e].isCurrent))),[s,o]),T=Boolean(w.length);return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content custom-scroll SettingsActiveSessions"},k&&(F=k,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("AuthSessions.CurrentSession")),a.ZP.createElement(Je.Z,{narrow:!0,inactive:!0,icon:`device-${Ba(F)} icon-device`},a.ZP.createElement("div",{className:"multiline-menu-item",dir:"auto"},a.ZP.createElement("span",{className:"title",dir:"auto"},F.deviceModel),a.ZP.createElement("span",{className:"subtitle black tight"},F.appName," ",F.appVersion,", ",F.platform," ",F.systemVersion),a.ZP.createElement("span",{className:"subtitle"},F.ip," - ",Oa(F)))),T&&a.ZP.createElement(Je.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:h},m("TerminateAllSessions")))),T&&(L=w,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("OtherSessions")),L.map((function(e){const t=s[e];return a.ZP.createElement(Je.Z,{key:t.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{b(t.hash)}}],icon:`device-${Ba(t)} icon-device`,onClick:()=>{y(t.hash)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,le.VX)(m,1e3*t.dateActive)),a.ZP.createElement("span",{className:"title"},t.deviceModel),a.ZP.createElement("span",{className:"subtitle black tight"},t.appName," ",t.appVersion,", ",t.platform," ",t.systemVersion),a.ZP.createElement("span",{className:"subtitle"},t.ip," ",Oa(t))))})))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("TerminateOldSessionHeader")),a.ZP.createElement("p",null,m("IfInactiveFor")),a.ZP.createElement(ta.Z,{name:"session_ttl",options:f,selected:C,onChange:N})),T&&a.ZP.createElement(tt.Z,{isOpen:u,onClose:v,text:m("AreYouSureSessions"),confirmLabel:m("TerminateAllSessions"),confirmHandler:I,confirmIsDestructive:!0}),a.ZP.createElement($a,{isOpen:g,hash:Z,onClose:S}));var L,F}))),Ua=(0,a.X$)((0,l.c$)((e=>{const{users:{byId:t},blocked:{ids:n},contactList:a,currentUserId:s}=e;return{usersById:t,blockedIds:n,contactIds:null==a?void 0:a.userIds,localContactIds:e.userSearch.localUserIds,currentUserId:s}}))((e=>{let{usersById:t,blockedIds:n,contactIds:s,localContactIds:o,currentUserId:i,isOpen:c,onClose:d}=e;const{setUserSearchQuery:m,blockContact:u}=(0,l.Sv)(),h=(0,R.Z)(),[v,Z]=(0,a.eJ)(""),P=(0,a.sO)(null);(0,a.d4)((()=>{m({query:v})}),[v,m]);const g=(0,a.Ye)((()=>{const e=(0,Be.Tw)([...s||[],...o||[]].filter((e=>e!==i&&!n.includes(e))));return(0,r.kK)(e,t,v).sort(((e,n)=>{const a=(0,r.Js)(t[e])||"",s=(0,r.Js)(t[n])||"";return a.localeCompare(s)}))}),[n,s,i,v,o,t]),p=(0,a.I4)((e=>{const{id:n,accessHash:a}=t[e]||{};n&&a&&(u({contactId:n,accessHash:a}),d())}),[u,d,t]);return a.ZP.createElement(Ye,{isOpen:c,chatOrUserIds:g,filterRef:P,filterPlaceholder:h("BlockedUsers.BlockUser"),filter:v,onFilterChange:Z,onSelectChatOrUser:p,onClose:d})}))),Ga=(0,a.X$)((0,l.c$)((e=>{const{chats:{byId:t},users:{byId:n},blocked:{ids:a},countryList:{phoneCodes:s}}=e;return{chatsByIds:t,usersByIds:n,blockedIds:a,phoneCodeList:s}}))((e=>{let{isActive:t,onReset:n,chatsByIds:s,usersByIds:o,blockedIds:i,phoneCodeList:c}=e;const{unblockContact:d}=(0,l.Sv)(),m=(0,R.Z)(),[h,v,Z]=(0,M.Z)(),P=(0,a.I4)((e=>{d({contactId:e})}),[d]);return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content infinite-scroll"},a.ZP.createElement("div",{className:"settings-item no-border"},a.ZP.createElement("p",{className:"settings-item-description-larger mt-0 mb-2",dir:m.isRtl?"rtl":void 0},m("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},null!=i&&i.length?a.ZP.createElement("div",{className:"scroll-container"},i.map(((e,t)=>function(e,t,n){const l=(0,r.YC)(e),i=l?o[e]:void 0,d=l?void 0:s[e],h=(0,V.Z)("Chat chat-item-clickable blocked-list-item small-icon",l?"private":"group");return a.ZP.createElement(Je.Z,{key:e,className:h,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{P(e)}}],style:`top: ${(0+t)*u.rS}px;`},a.ZP.createElement(Ae.Z,{size:"medium",user:i,chat:d}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},a.ZP.createElement("h3",{dir:"auto"},(0,Te.Z)((l?(0,r.Js)(i):(0,r.U)(m,d))||"")),(null==i?void 0:i.phoneNumber)&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,dt.WZ)(c,i.phoneNumber)),i&&!i.phoneNumber&&i.username&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",i.username)))}(e,t)))):i&&!i.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},m("NoBlocked")):a.ZP.createElement(_e.Z,{key:"loading"}))),a.ZP.createElement(An.Z,{isShown:!0,onClick:v,ariaLabel:m("BlockContact")},a.ZP.createElement("i",{className:"icon-add"})),a.ZP.createElement(Ua,{isOpen:h,onClose:Z}))})));var Xa=n(21179),Ja=n(2092);const za=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:s}=e;const l=(0,R.Z)();return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Xa.Z,{tgsUrl:Mt.l.Lock,previewUrl:Ja,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,Te.Z)(l("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Je.Z,{icon:"edit",onClick:()=>s(o.MT.TwoFaChangePasswordCurrent)},l("ChangePassword")),a.ZP.createElement(Je.Z,{icon:"password-off",onClick:()=>s(o.MT.TwoFaTurnOff)},l("TurnPasswordOff")),a.ZP.createElement(Je.Z,{icon:"email",onClick:()=>s(o.MT.TwoFaRecoveryEmailCurrentPassword)},l("SetRecoveryEmail"))))}));var Va=n(93490),Ya=n(99364);const Ha=(0,a.X$)((e=>{let{isActive:t,onReset:n,error:s,isLoading:o,shouldDisablePasswordManager:l,expectedPassword:r,placeholder:i="Current Password",hint:c,submitLabel:d,clearError:m,onSubmit:u}=e;const[h,v]=(0,a.eJ)(""),[Z,P]=(0,a.eJ)(!1),g=(0,a.I4)((e=>{r&&e!==r?v("Passwords Should Be Equal"):u(e)}),[u,r]),p=(0,a.I4)((()=>{m&&m(),v("")}),[m]),E=(0,R.Z)();return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content password-form custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Va.Z,{isBig:!0,isPasswordVisible:Z})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Ya.Z,{error:h||s,hint:c,placeholder:i,shouldDisablePasswordManager:l,submitLabel:d||E("Next"),clearError:p,isLoading:o,isPasswordVisible:Z,shouldResetValue:t,onChangePasswordVisibility:P,onSubmit:g})))})),qa=(0,a.X$)((e=>{let{isActive:t,onReset:n,onStart:s}=e;const o=(0,R.Z)();return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Xa.Z,{tgsUrl:Mt.l.Lock,previewUrl:Ja,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},o("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(D.Z,{onClick:s},o("EditAdminTransferSetPassword"))))}));var ja=n(45601);const Ka=m.wB?550:400,Wa=(0,a.X$)((0,l.c$)(((e,t)=>{let{icon:n}=t;return{animatedEmoji:(0,i.zB)(e,"email"===n?"💌":"💡")}}))((e=>{let{animatedEmoji:t,type:n="text",isLoading:s,error:o,placeholder:l,shouldConfirm:r,clearError:i,onSubmit:c,isActive:d,onReset:u}=e;const h=(0,a.sO)(null),[v,Z]=(0,a.eJ)(""),[P,g,p]=(0,M.Z)(!1);(0,a.d4)((()=>{m.$b||setTimeout((()=>{h.current.focus()}),Ka)}),[]);const E=(0,a.I4)((e=>{o&&i&&i(),Z(e.target.value)}),[i,o]),C=(0,a.I4)((()=>{c()}),[c]),f=(0,a.I4)((()=>{p(),c()}),[c,p]),b=(0,R.Z)();return(0,A.Z)({isActive:d,onBack:u}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ja.Z,{sticker:t,size:160,className:"settings-content-icon"})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),h.current&&c(v)}},a.ZP.createElement(Ge.Z,{ref:h,value:v,inputMode:n,label:l,error:o,onChange:E}),v?a.ZP.createElement(D.Z,{type:"submit",isLoading:s,ripple:!0},b("Continue")):a.ZP.createElement(D.Z,{isText:!0,isLoading:s,ripple:!0,onClick:r?g:C},b("YourEmailSkip"))),r&&a.ZP.createElement(Ue.Z,{className:"narrow",isOpen:P,title:b("YourEmailSkipWarning"),onClose:p},(0,Te.Z)(b("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(D.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:f},b("YourEmailSkip")),a.ZP.createElement(D.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:p},b("Cancel"))))))}))),Qa=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:s}=e;const l=(0,R.Z)(),r=(0,a.I4)((()=>{s(o.MT.Privacy)}),[s]);return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Xn.Z,{size:u.K2,tgsUrl:Mt.l.Congratulations,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},l("TwoStepVerificationPasswordSetInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(D.Z,{onClick:r},l("TwoStepVerificationPasswordReturnSettings"))))})),es=m.wB?550:400,ts=(0,a.X$)((0,l.c$)((e=>({animatedEmoji:(0,i.zB)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength})))((e=>{let{animatedEmoji:t,codeLength:n,isLoading:s,error:o,clearError:l,onSubmit:r,isActive:i,onReset:c}=e;const d=(0,a.sO)(null),[u,h]=(0,a.eJ)("");(0,a.d4)((()=>{m.$b||setTimeout((()=>{d.current.focus()}),es)}),[]);const v=(0,R.Z)();(0,A.Z)({isActive:i,onBack:c});const Z=(0,a.I4)((e=>{o&&l&&l();const t=e.target.value.slice(0,n);t.length===n&&r(t),h(t),e.target.value=t}),[l,n,o,r]);return a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ja.Z,{sticker:t,size:160,className:"settings-content-icon"})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Ge.Z,{value:u,ref:d,inputMode:"decimal",label:v("YourEmailCode"),error:o,onChange:Z}),s&&a.ZP.createElement(_e.Z,null)))}))),ns=(0,a.X$)((0,l.c$)((e=>({...e.twoFaSettings})))((e=>{let{currentScreen:t,shownScreen:n,state:s,hint:r,isLoading:i,error:c,waitingEmailCodeLength:d,dispatch:m,isActive:u,onScreenSelect:h,onReset:v}=e;const{updatePassword:Z,checkPassword:P,clearTwoFaError:g,updateRecoveryEmail:p,provideTwoFaEmailCode:E,clearPassword:C}=(0,l.Sv)();(0,a.d4)((()=>{d&&(t===o.MT.TwoFaNewPasswordEmail?h(o.MT.TwoFaNewPasswordEmailCode):t===o.MT.TwoFaRecoveryEmail&&h(o.MT.TwoFaRecoveryEmailCode))}),[t,h,d]);const f=(0,a.I4)((()=>{m({type:"reset"}),h(o.MT.TwoFaNewPassword)}),[m,h]),b=(0,a.I4)((e=>{m({type:"setPassword",payload:e}),h(o.MT.TwoFaNewPasswordConfirm)}),[m,h]),I=(0,a.I4)((()=>{h(o.MT.TwoFaNewPasswordHint)}),[h]),y=(0,a.I4)((e=>{m({type:"setHint",payload:e}),h(o.MT.TwoFaNewPasswordEmail)}),[m,h]),S=(0,a.I4)((e=>{m({type:"setEmail",payload:e}),Z({...s,email:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[m,h,s,Z]),N=(0,a.I4)((e=>{m({type:"setCurrentPassword",payload:e}),P({currentPassword:e,onSuccess:()=>{h(o.MT.TwoFaChangePasswordNew)}})}),[P,m,h]),k=(0,a.I4)((e=>{m({type:"setPassword",payload:e}),h(o.MT.TwoFaChangePasswordConfirm)}),[m,h]),w=(0,a.I4)((()=>{h(o.MT.TwoFaChangePasswordHint)}),[h]),M=(0,a.I4)((e=>{m({type:"setHint",payload:e}),Z({...s,hint:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[m,h,s,Z]),T=(0,a.I4)((e=>{C({currentPassword:e,onSuccess:()=>{h(o.MT.Privacy)}})}),[C,h]),A=(0,a.I4)((e=>{m({type:"setCurrentPassword",payload:e}),P({currentPassword:e,onSuccess:()=>{h(o.MT.TwoFaRecoveryEmail)}})}),[P,m,h]),L=(0,a.I4)((e=>{m({type:"setEmail",payload:e}),p({...s,email:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[m,h,s,p]),F=(0,a.I4)((e=>{E({code:e})}),[E]),B=(0,R.Z)();switch(t){case o.MT.TwoFaDisabled:return a.ZP.createElement(qa,{onStart:f,isActive:u||[o.MT.TwoFaNewPassword,o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaNewPassword:return a.ZP.createElement(Ha,{placeholder:B("PleaseEnterPassword"),submitLabel:B("Continue"),onSubmit:b,isActive:u||[o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(Ha,{expectedPassword:s.password,placeholder:B("PleaseReEnterPassword"),submitLabel:B("Continue"),onSubmit:I,isActive:u||[o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaNewPasswordHint:return a.ZP.createElement(Wa,{icon:"hint",placeholder:B("PasswordHintPlaceholder"),onSubmit:y,isActive:u||[o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(Wa,{icon:"email",type:"email",isLoading:i,error:c,clearError:g,placeholder:B("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:S,isActive:u||[o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(ts,{isLoading:i,error:c,clearError:g,onSubmit:F,isActive:u||n===o.MT.TwoFaCongratulations,onReset:v});case o.MT.TwoFaCongratulations:return a.ZP.createElement(Qa,{onScreenSelect:h,isActive:u,onReset:v});case o.MT.TwoFaEnabled:return a.ZP.createElement(za,{onScreenSelect:h,isActive:u||[o.MT.TwoFaChangePasswordCurrent,o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaTurnOff,o.MT.TwoFaRecoveryEmailCurrentPassword,o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(Ha,{isLoading:i,error:c,clearError:g,hint:r,onSubmit:N,isActive:u||[o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaChangePasswordNew:return a.ZP.createElement(Ha,{placeholder:B("PleaseEnterNewFirstPassword"),onSubmit:k,isActive:u||[o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(Ha,{expectedPassword:s.password,placeholder:B("PleaseReEnterPassword"),onSubmit:w,isActive:u||[o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement(Wa,{isLoading:i,error:c,clearError:g,icon:"hint",placeholder:B("PasswordHintPlaceholder"),onSubmit:M,isActive:u||n===o.MT.TwoFaCongratulations,onReset:v});case o.MT.TwoFaTurnOff:return a.ZP.createElement(Ha,{isLoading:i,error:c,clearError:g,hint:r,onSubmit:T,isActive:u,onReset:v});case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(Ha,{isLoading:i,error:c,clearError:g,hint:r,onSubmit:A,isActive:u||[o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement(Wa,{icon:"email",type:"email",placeholder:B("RecoveryEmailTitle"),onSubmit:L,isActive:u||[o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(n),onReset:v});case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(ts,{isLoading:i,error:c,clearError:g,onSubmit:F,isActive:u||n===o.MT.TwoFaCongratulations,onReset:v});default:return}})));var as=n(11820);function ss(e,t){const{privacy:n}=e.settings;switch(t){case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyPhoneNumberDeniedContacts:return n.phoneNumber;case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyLastSeenDeniedContacts:return n.lastSeen;case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:return n.profilePhoto;case o.MT.PrivacyPhoneCallAllowedContacts:case o.MT.PrivacyPhoneCallDeniedContacts:return n.phoneCall;case o.MT.PrivacyPhoneP2PAllowedContacts:case o.MT.PrivacyPhoneP2PDeniedContacts:return n.phoneP2P;case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyForwardingDeniedContacts:return n.forwards;case o.MT.PrivacyGroupChatsDeniedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const os=(0,a.X$)((0,l.c$)(((e,t)=>{let{screen:n}=t;return{currentUserId:e.currentUserId,settings:ss(e,n)}}))((e=>{let{isAllowList:t,screen:n,isActive:s,onScreenSelect:i,onReset:c,currentUserId:d,settings:m}=e;const{setPrivacySettings:h}=(0,l.Sv)(),v=(0,R.Z)(),Z=(0,a.Ye)((()=>m?t?[...m.allowUserIds,...m.allowChatIds]:[...m.blockUserIds,...m.blockChatIds]:[]),[t,m]),[P,g]=(0,a.eJ)(""),[p,E]=(0,a.eJ)(!1),[C,f]=(0,a.eJ)(Z),b=(0,Gn.d7)(u.Nf),I=(0,Gn.d7)(u.WS),y=(0,a.Ye)((()=>{const e=(0,l.Rd)().chats.byId,t=(0,Be.Tw)([...b||[],...I||[]]).filter((t=>{const n=e[t];return n&&(0,r.YC)(n.id)&&n.id!==d}));return(0,Be.Tw)([...Z,...(0,r.$l)(v,t,e,P)])}),[b,I,Z,v,P,d]),S=(0,a.I4)((e=>{f(e),E(!0)}),[]),N=(0,a.I4)((()=>{h({privacyKey:La(n),isAllowList:Boolean(t),contactsIds:C}),i(o.MT.Privacy)}),[t,C,i,n,h]);return(0,A.Z)({isActive:s,onBack:c}),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(as.Z,{itemIds:y||[],selectedIds:C,filterValue:P,filterPlaceholder:v(t?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:S,onFilterChange:g}),a.ZP.createElement(An.Z,{isShown:p,onClick:N,ariaLabel:v(t?"AlwaysAllow":"NeverAllow")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),ls=(0,a.X$)((0,l.c$)((e=>{const{availableReactions:t,appConfig:n}=e;return{availableReactions:t,selectedReaction:null==n?void 0:n.defaultReaction}}))((e=>{let{isActive:t,onReset:n,availableReactions:s,selectedReaction:o}=e;const{setDefaultReaction:r}=(0,l.Sv)();(0,A.Z)({isActive:t,onBack:n});const i=(null==s?void 0:s.filter((e=>!e.isInactive)).map((e=>({label:a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(kt.Z,{reaction:e.reaction}),e.title),value:e.reaction}))))||[],c=(0,a.I4)((e=>{r({reaction:e})}),[r]);return a.ZP.createElement("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction"},a.ZP.createElement(ta.Z,{name:"quick-reaction-settings",options:i,selected:o,onChange:c}))})));var rs=n(95281);const is=(0,a.X$)((e=>{let{isActive:t,onReset:n,onStart:s}=e;const o=(0,R.Z)();return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Xa.Z,{tgsUrl:Mt.l.Lock,previewUrl:Ja,size:u.Iz,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description",dir:"auto"},"When you set up an additional passcode, a lock icon will appear on the chats page. Tap it to lock and unlock your Telegram WebZ."),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Note: if you forget your local passcode, you'll need to log out of Telegram WebZ and log in again.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(D.Z,{onClick:s},o("EnablePasscode"))))})),cs=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:s}=e;const l=(0,R.Z)();return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Xa.Z,{tgsUrl:Mt.l.Lock,previewUrl:Ja,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Local passcode is enabled.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Je.Z,{icon:"edit",onClick:()=>s(o.MT.PasscodeChangePasscodeCurrent)},l("Passcode.Change")),a.ZP.createElement(Je.Z,{icon:"password-off",onClick:()=>s(o.MT.PasscodeTurnOff)},l("Passcode.TurnOff"))))})),ds=(0,a.X$)((e=>{let{isActive:t,onReset:n}=e;const s=(0,R.Z)(),o=(0,a.I4)((()=>{n(!0)}),[n]);return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Xn.Z,{size:u.Iz,tgsUrl:Mt.l.Congratulations,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Congratulations!"),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Now you can lock the app with a passcode so that others can't open it.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(D.Z,{onClick:o},s("Back"))))})),ms=(0,a.X$)((0,l.c$)((e=>({...e.passcode})))((e=>{let{passcode:t,currentScreen:n,shownScreen:s,error:r,isActive:i,isLoading:c,onScreenSelect:d,onSetPasscode:m,onReset:u}=e;const{setPasscode:h,clearPasscode:v,setPasscodeError:Z,clearPasscodeError:P}=(0,l.Sv)(),g=(0,R.Z)(),p=(0,a.I4)((()=>{m(""),d(o.MT.PasscodeNewPasscode)}),[d,m]),E=(0,a.I4)((e=>{m(e),d(o.MT.PasscodeNewPasscodeConfirm)}),[d,m]),C=(0,a.I4)((()=>{h({passcode:t}),m(""),d(o.MT.PasscodeCongratulations)}),[d,m,t,h]),f=(0,a.I4)((e=>{m(""),(0,rs.so)(e).then((()=>{d(o.MT.PasscodeChangePasscodeNew)}),(()=>{Z({error:g("PasscodeController.Error.Current")})}))}),[g,d,m,Z]),b=(0,a.I4)((e=>{m(e),d(o.MT.PasscodeChangePasscodeConfirm)}),[d,m]),I=(0,a.I4)((e=>{(0,rs.so)(e).then((()=>{v(),d(o.MT.Privacy)}),(()=>{Z({error:g("PasscodeController.Error.Current")})}))}),[v,g,d,Z]);switch(n){case o.MT.PasscodeDisabled:return a.ZP.createElement(is,{onStart:p,isActive:i||[o.MT.PasscodeNewPasscode,o.MT.PasscodeNewPasscodeConfirm,o.MT.PasscodeCongratulations].includes(s),onReset:u});case o.MT.PasscodeNewPasscode:return a.ZP.createElement(Ha,{shouldDisablePasswordManager:!0,placeholder:g("EnterNewPasscode"),submitLabel:g("Continue"),onSubmit:E,isActive:i||[o.MT.PasscodeNewPasscodeConfirm,o.MT.PasscodeCongratulations].includes(s),onReset:u});case o.MT.PasscodeNewPasscodeConfirm:return a.ZP.createElement(Ha,{shouldDisablePasswordManager:!0,expectedPassword:t,placeholder:g("ReEnterYourPasscode"),submitLabel:g("Continue"),isLoading:c,onSubmit:C,isActive:i||[o.MT.PasscodeCongratulations].includes(s),onReset:u});case o.MT.PasscodeCongratulations:return a.ZP.createElement(ds,{isActive:i,onReset:u});case o.MT.PasscodeEnabled:return a.ZP.createElement(cs,{onScreenSelect:d,isActive:i||[o.MT.PasscodeChangePasscodeCurrent,o.MT.PasscodeChangePasscodeNew,o.MT.PasscodeChangePasscodeConfirm,o.MT.PasscodeCongratulations,o.MT.PasscodeTurnOff].includes(s),onReset:u});case o.MT.PasscodeChangePasscodeCurrent:return a.ZP.createElement(Ha,{shouldDisablePasswordManager:!0,error:r,clearError:P,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:f,isActive:i||[o.MT.PasscodeChangePasscodeNew,o.MT.PasscodeChangePasscodeConfirm,o.MT.PasscodeCongratulations].includes(s),onReset:u});case o.MT.PasscodeChangePasscodeNew:return a.ZP.createElement(Ha,{shouldDisablePasswordManager:!0,placeholder:g("PleaseEnterNewFirstPassword"),onSubmit:b,isActive:i||[o.MT.PasscodeChangePasscodeConfirm,o.MT.PasscodeCongratulations].includes(s),onReset:u});case o.MT.PasscodeChangePasscodeConfirm:return a.ZP.createElement(Ha,{shouldDisablePasswordManager:!0,expectedPassword:t,placeholder:g("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:c,onSubmit:C,isActive:i||[o.MT.PasscodeCongratulations].includes(s),onReset:u});case o.MT.PasscodeTurnOff:return a.ZP.createElement(Ha,{shouldDisablePasswordManager:!0,error:r?g(r):void 0,clearError:P,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:I,isActive:i,onReset:u});default:return}}))),us=Object.keys(o.MT).length/2,hs=[o.MT.TwoFaDisabled,o.MT.TwoFaNewPassword,o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations,o.MT.TwoFaEnabled,o.MT.TwoFaChangePasswordCurrent,o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaTurnOff,o.MT.TwoFaRecoveryEmailCurrentPassword,o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode],vs=[o.MT.PasscodeDisabled,o.MT.PasscodeEnabled],Zs=[o.MT.Folders,o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersEditFolderFromChatList,o.MT.FoldersIncludedChats,o.MT.FoldersIncludedChatsFromChatList,o.MT.FoldersExcludedChats,o.MT.FoldersExcludedChatsFromChatList],Ps=[o.MT.PrivacyBlockedUsers,o.MT.ActiveSessions],gs=[o.MT.PrivacyPhoneNumberAllowedContacts,o.MT.PrivacyPhoneNumberDeniedContacts],ps=[o.MT.PrivacyLastSeenAllowedContacts,o.MT.PrivacyLastSeenDeniedContacts],Es=[o.MT.PrivacyProfilePhotoAllowedContacts,o.MT.PrivacyProfilePhotoDeniedContacts],Cs=[o.MT.PrivacyPhoneCallAllowedContacts,o.MT.PrivacyPhoneCallDeniedContacts],fs=[o.MT.PrivacyPhoneP2PAllowedContacts,o.MT.PrivacyPhoneP2PDeniedContacts],bs=[o.MT.PrivacyForwardingAllowedContacts,o.MT.PrivacyForwardingDeniedContacts],Is=[o.MT.PrivacyGroupChatsAllowedContacts,o.MT.PrivacyGroupChatsDeniedContacts],ys=(0,a.X$)((e=>{let{isActive:t,currentScreen:n,foldersState:s,foldersDispatch:l,onScreenSelect:r,onReset:i,shouldSkipTransition:c}=e;const[d,u]=(0,In.Z)(Sn,yn),[h,v]=(0,a.eJ)(""),Z=(0,a.I4)((e=>{!0!==e?(n!==o.MT.FoldersCreateFolder&&n!==o.MT.FoldersEditFolder&&n!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{l({type:"reset"})}),200),n!==o.MT.FoldersIncludedChats&&n!==o.MT.FoldersExcludedChats?i():"create"===s.mode?r(o.MT.FoldersCreateFolder):r(o.MT.FoldersEditFolder)):i(!0)}),[s.mode,l,n,i,r]),P=(0,a.I4)((()=>{l({type:"saveFilters"}),Z()}),[l,Z]);function g(e,i,c){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Nn,{currentScreen:n,onReset:Z,onSaveFilter:P,onScreenSelect:r,editedFolderId:s.folderId}),function(e,i){const c={[o.MT.PrivacyPhoneNumber]:gs.includes(i),[o.MT.PrivacyLastSeen]:ps.includes(i),[o.MT.PrivacyProfilePhoto]:Es.includes(i),[o.MT.PrivacyPhoneCall]:Cs.includes(i),[o.MT.PrivacyPhoneP2P]:fs.includes(i),[o.MT.PrivacyForwarding]:bs.includes(i),[o.MT.PrivacyGroupChats]:Is.includes(i)},m=hs.includes(i),P=vs.includes(i),g=Zs.includes(i),p=Ps.includes(i)||m||P||Object.keys(c).includes(i.toString())||Object.values(c).find((e=>!0===e));switch(n){case o.MT.Main:return a.ZP.createElement(Mn,{onScreenSelect:r,isActive:t,onReset:Z});case o.MT.EditProfile:return a.ZP.createElement(_n,{isActive:t&&e,onReset:Z});case o.MT.General:return a.ZP.createElement(ma,{onScreenSelect:r,isActive:e||i===o.MT.GeneralChatBackgroundColor||i===o.MT.GeneralChatBackground||i===o.MT.QuickReaction||p||g,onReset:Z});case o.MT.QuickReaction:return a.ZP.createElement(ls,{isActive:e,onReset:Z});case o.MT.Notifications:return a.ZP.createElement(Ta,{isActive:e,onReset:Z});case o.MT.DataStorage:return a.ZP.createElement(Un,{isActive:e,onReset:Z});case o.MT.Privacy:return a.ZP.createElement(Aa,{onScreenSelect:r,isActive:e||p,onReset:Z});case o.MT.Language:return a.ZP.createElement(Ra,{isActive:e,onReset:Z});case o.MT.GeneralChatBackground:return a.ZP.createElement(ba,{onScreenSelect:r,isActive:e||i===o.MT.GeneralChatBackgroundColor,onReset:Z});case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement(ka,{isActive:e,onReset:Z});case o.MT.ActiveSessions:return a.ZP.createElement(_a,{isActive:e,onReset:Z});case o.MT.PrivacyBlockedUsers:return a.ZP.createElement(Ga,{isActive:e,onReset:Z});case o.MT.PrivacyPhoneNumber:case o.MT.PrivacyLastSeen:case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyPhoneCall:case o.MT.PrivacyPhoneP2P:case o.MT.PrivacyForwarding:case o.MT.PrivacyGroupChats:return a.ZP.createElement(Fa,{screen:n,onScreenSelect:r,isActive:e||c[n],onReset:Z});case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyPhoneCallAllowedContacts:case o.MT.PrivacyPhoneP2PAllowedContacts:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement(os,{isAllowList:!0,screen:n,onScreenSelect:r,isActive:e||c[n],onReset:Z});case o.MT.PrivacyPhoneNumberDeniedContacts:case o.MT.PrivacyLastSeenDeniedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:case o.MT.PrivacyPhoneCallDeniedContacts:case o.MT.PrivacyPhoneP2PDeniedContacts:case o.MT.PrivacyForwardingDeniedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement(os,{screen:n,onScreenSelect:r,isActive:e,onReset:Z});case o.MT.Folders:case o.MT.FoldersCreateFolder:case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Qn,{currentScreen:n,shownScreen:i,state:s,dispatch:l,isActive:e,onScreenSelect:r,onReset:Z});case o.MT.TwoFaDisabled:case o.MT.TwoFaNewPassword:case o.MT.TwoFaNewPasswordConfirm:case o.MT.TwoFaNewPasswordHint:case o.MT.TwoFaNewPasswordEmail:case o.MT.TwoFaNewPasswordEmailCode:case o.MT.TwoFaCongratulations:case o.MT.TwoFaEnabled:case o.MT.TwoFaChangePasswordCurrent:case o.MT.TwoFaChangePasswordNew:case o.MT.TwoFaChangePasswordConfirm:case o.MT.TwoFaChangePasswordHint:case o.MT.TwoFaTurnOff:case o.MT.TwoFaRecoveryEmailCurrentPassword:case o.MT.TwoFaRecoveryEmail:case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(ns,{currentScreen:n,state:d,dispatch:u,shownScreen:i,isActive:e,onScreenSelect:r,onReset:Z});case o.MT.PasscodeDisabled:case o.MT.PasscodeNewPasscode:case o.MT.PasscodeNewPasscodeConfirm:case o.MT.PasscodeChangePasscodeCurrent:case o.MT.PasscodeChangePasscodeNew:case o.MT.PasscodeChangePasscodeConfirm:case o.MT.PasscodeCongratulations:case o.MT.PasscodeEnabled:case o.MT.PasscodeTurnOff:return a.ZP.createElement(ms,{currentScreen:n,passcode:h,onSetPasscode:v,shownScreen:i,isActive:e,onScreenSelect:r,onReset:Z});default:return}}(e,c))}return a.ZP.createElement(O.Z,{id:"Settings",name:c?"none":m.s0,activeKey:n,renderCount:us},g)})),Ss=(0,a.X$)((0,l.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n,statusesById:a}=e.users;return{usersById:n,userStatusesById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{isActive:t,filter:n,usersById:s,userStatusesById:o,contactIds:i,serverTimeOffset:c,onReset:d}=e;const{openChat:u,openNewContactDialog:h}=(0,l.Sv)(),v=(0,R.Z)();(0,A.Z)({isActive:t,onBack:d});const Z=(0,a.I4)((e=>{u({id:e,shouldReplaceHistory:!0})}),[u]),P=(0,a.Ye)((()=>{if(!i)return;const e=(0,r.kK)(i,s,n);return(0,r.Z0)(e,s,o,void 0,c)}),[i,n,s,o,c]),[g,p]=(0,De.Z)(void 0,P,Boolean(n));return a.ZP.createElement(Xe.Z,{items:g,onLoadMore:p,className:"chat-list custom-scroll"},null!=g&&g.length?g.map((e=>a.ZP.createElement(Je.Z,{key:e,className:"chat-item-clickable",onClick:()=>Z(e),ripple:!m.wB},a.ZP.createElement(Ve.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):g&&!g.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},n.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(_e.Z,{key:"loading"}),a.ZP.createElement(An.Z,{isShown:!0,onClick:h,ariaLabel:v("CreateNewContact")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))}))),Ns=(0,a.X$)((0,l.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.chats,{query:a,fetchingStatus:s,globalResults:o,localResults:l}=e.globalSearch,{userIds:r}=o||{},{userIds:i}=l||{};return{chatsById:n,localContactIds:t,searchQuery:a,isSearching:null==s?void 0:s.chats,globalUserIds:r,localUserIds:i}}))((e=>{let{isChannel:t,isActive:n,selectedMemberIds:s,onSelectedMemberIdsChange:o,onNextStep:i,onReset:c,chatsById:d,localContactIds:m,searchQuery:u,isSearching:h,localUserIds:v,globalUserIds:Z}=e;const{setGlobalSearchQuery:P}=(0,l.Sv)(),g=(0,R.Z)();(0,A.Z)({isActive:n,onBack:c});const p=(0,a.I4)((e=>{P({query:e})}),[P]),E=(0,a.Ye)((()=>{const e=(0,l.Rd)().users.byId,t=m?(0,r.kK)(m,e,u):[];return(0,r.ih)((0,Be.Tw)([...t,...v||[],...Z||[]]).filter((t=>{const n=e[t];return!n||!n.isSelf&&(n.canBeInvitedToGroup||!(0,r.cS)(n))})),d,!1,s)}),[m,d,u,v,Z,s]),C=(0,a.I4)((()=>{(s.length||t)&&(P({query:""}),i())}),[s.length,t,P,i]);return a.ZP.createElement("div",{className:"NewChat step-1"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:c,ariaLabel:"Return to Chat List"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,g("GroupAddMembers"))),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(as.Z,{itemIds:E,selectedIds:s,filterValue:u,filterPlaceholder:g("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:h,onSelectedIdsChange:o,onFilterChange:p}),a.ZP.createElement(An.Z,{isShown:Boolean(s.length||t),onClick:C,ariaLabel:t?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),ks=(0,a.X$)((0,l.c$)((e=>{const{progress:t,error:n}=e.chatCreation||{};return{creationProgress:t,creationError:n}}))((e=>{let{isChannel:t,isActive:n,memberIds:s,onReset:r,creationProgress:i,creationError:c}=e;const{createGroupChat:d,createChannel:m}=(0,l.Sv)(),u=(0,R.Z)();(0,A.Z)({isActive:n,onBack:r});const[h,v]=(0,a.eJ)(""),[Z,P]=(0,a.eJ)(""),[g,p]=(0,a.eJ)(),[E,C]=(0,a.eJ)(),f="Chat title can't be empty",b="Channel title can't be empty",I="Sorry, creating supergroups is not yet supported",y=i===o.Nh.InProgress,S=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");v(n),n!==t&&(e.currentTarget.value=n)}),[]),N=(0,a.I4)((e=>{P(e.currentTarget.value)}),[]),k=(0,a.I4)((()=>{h.length?s.length>199?C(I):d({title:h,photo:g,memberIds:s}):C(f)}),[h,s,d,g,f,I]),w=(0,a.I4)((()=>{h.length?m({title:h,about:Z,photo:g,memberIds:s}):C(b)}),[h,m,Z,g,s,b]);(0,a.d4)((()=>{i===o.Nh.Complete&&r(!0)}),[i,r]);const M=c&&u(c)||(E!==f&&E!==b?E:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>r(),ariaLabel:"Return to member selection"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,u(t?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(Tn.Z,{onChange:p,title:u("AddPhoto")}),a.ZP.createElement(Ge.Z,{value:h,onChange:S,label:u(t?"EnterChannelName":"GroupName"),error:E===f||E===b?E:void 0}),t&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Ge.Z,{value:Z,onChange:N,label:u("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},u("DescriptionInfo"))),M&&a.ZP.createElement("p",{className:"error"},M),s.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},u("GroupInfo.ParticipantCount",s.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},s.map((e=>a.ZP.createElement(Je.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ve.Z,{userId:e}))))))),a.ZP.createElement(An.Z,{isShown:0!==h.length,onClick:t?w:k,disabled:y,ariaLabel:t?u("ChannelIntro.CreateChannel"):"Create Group"},y?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),ws=Object.keys(o.du).length/2,Ms=(0,a.X$)((e=>{let{isActive:t,isChannel:n=!1,content:s,onContentChange:l,onReset:r}=e;const[i,c]=(0,a.eJ)([]),d=(0,a.I4)((()=>{l(n?o.du.NewChannelStep2:o.du.NewGroupStep2)}),[n,l]);return a.ZP.createElement(O.Z,{id:"NewChat",name:m.s0,renderCount:ws,activeKey:s},(e=>{switch(s){case o.du.NewChannelStep1:case o.du.NewGroupStep1:return a.ZP.createElement(Ns,{isChannel:n,isActive:t,selectedMemberIds:i,onSelectedMemberIdsChange:c,onNextStep:d,onReset:r});case o.du.NewChannelStep2:case o.du.NewGroupStep2:return a.ZP.createElement(ks,{isChannel:n,isActive:e&&t,memberIds:i,onReset:r});default:return}}))}));var Ts=n(1080);const As=(0,a.X$)((e=>{let{isActive:t,onReset:n}=e;const s=(0,R.Z)();return(0,A.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"ArchivedChats"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:"Return to chat list"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,s("ArchivedChats"))),a.ZP.createElement(Ts.Z,{folderType:"archived",isActive:t}))}));var Rs=n(51218);const Ls=(0,a.X$)((0,l.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}))((e=>{let{isOpen:t,chatId:n,foldersById:s,folderOrderedIds:o,onClose:r,onCloseAnimationEnd:i}=e;const{editChatFolders:c}=(0,l.Sv)(),d=(0,R.Z)(),m=(0,a.Ye)((()=>s?Object.keys(s).reduce(((e,t)=>{const{includedChatIds:a,pinnedChatIds:o}=s[Number(t)];return(a.includes(n)||null!=o&&o.includes(n))&&e.push(t),e}),[]):[]),[n,s]),[u,h]=(0,a.eJ)(m),v=(0,a.Ye)((()=>(null==o?void 0:o.map((e=>({label:s?s[e].title:"",value:String(e)}))))||[]),[o,s]),Z=(0,a.I4)((()=>{const e=m.filter((e=>!u.includes(e))).map(Number),t=u.filter((e=>!m.includes(e))).map(Number);c({chatId:n,idsToRemove:e,idsToAdd:t}),r()}),[n,c,m,r,u]);if(s&&o)return a.ZP.createElement(Ue.Z,{isOpen:t,onClose:r,onCloseAnimationEnd:i,onEnter:Z,className:"delete",title:d("FilterAddTo")},a.ZP.createElement(Rs.Z,{options:v,selected:u,onChange:h,round:!0}),a.ZP.createElement(D.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:Z},d("FilterAddTo")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},d("Cancel")))})));var Fs=n(64319),Bs=n(40647),xs=n(60998);function Ds(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let $s,Os;const _s={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},Us=e=>"changedTouches"in e?e.changedTouches[0].clientY:0,Gs=e=>{const t="deltaY"in e?e.deltaY:Us(e);if(!$s||!$s.contains(e.target)||$s.scrollTop<=0&&t<=0||$s.scrollTop>=$s.scrollHeight-$s.offsetHeight&&t>=0){if(Os&&e.target.closest(Os))return;e.preventDefault()}};function Xs(e){_s[e.key]&&!function(e){if(!(e&&e instanceof HTMLElement))return!1;const t=e,n=t.tagName.toLowerCase();if("textarea"===n)return!0;if("input"!==n)return!1;const a=t.getAttribute("type");return!!a&&["text","password","number","email","tel","url","search","date","datetime","datetime-local","time","month","week"].indexOf(a.toLowerCase())>-1}(e.target)&&e.preventDefault()}function Js(e,t){$s=e,Os=t,document.addEventListener("wheel",Gs,{passive:!1}),document.addEventListener("touchmove",Gs,{passive:!1}),document.onkeydown=Xs}function zs(){$s=void 0,Os=void 0,document.removeEventListener("wheel",Gs),document.removeEventListener("touchmove",Gs),document.onkeydown=null}var Vs=n(63394);const Ys=m.FW?24:32,Hs=(0,V.y)("ReactionSelectorReaction"),qs=(0,a.X$)((e=>{var t;let{reaction:n,previewIndex:s,onSendReaction:o,isReady:l}=e;const r=(0,a.sO)(null),i=(0,L.Z)(`document${null===(t=n.selectAnimation)||void 0===t?void 0:t.id}`,!l),[c,d,u]=(0,M.Z)(),[h,v]=(0,M.Z)(),Z=Boolean(l&&i),{transitionClassNames:P}=(0,ae.Z)(Z),{shouldRender:g,transitionClassNames:p}=(0,ae.Z)(!l||!h,void 0,!0);return a.ZP.createElement("div",{className:Hs("&",m.FW&&"compact"),onClick:function(){if(!r.current)return;const{x:e,y:t}=r.current.getBoundingClientRect();o(n.reaction,e,t)},ref:r,onMouseEnter:l?d:void 0},g&&a.ZP.createElement("div",{className:Hs("static",l?[p]:void 0),style:`background-position-x: ${s*-Ys}px;`}),Z&&a.ZP.createElement(Tt.Z,{className:Hs("animated",[P]),tgsUrl:i,play:c,noLoop:!0,size:Ys,onLoad:v,onEnded:u}))})),js=(0,V.y)("ReactionSelector"),Ks=(0,a.X$)((e=>{let{availableReactions:t,enabledReactions:n,onSendReaction:s,isPrivate:o,isReady:l}=e;const r=(0,a.sO)(null),[i,c]=(0,M.Z)(!1);(0,Ot.Z)(r.current,!i),(0,a.bt)((()=>{c()}),[c]);const d=e=>{r&&("deltaY"in e?e.deltaY:Us(e))&&e.preventDefault()};if((o||null!=n&&n.length)&&t)return a.ZP.createElement("div",{className:js("&",m.FW&&"compact"),onWheelCapture:d,onTouchMove:d},a.ZP.createElement("div",{className:js("bubble-big")}),a.ZP.createElement("div",{className:js("bubble-small")}),a.ZP.createElement("div",{className:js("items-wrapper")},a.ZP.createElement("div",{className:js("items",["no-scrollbar"]),ref:r},null==t?void 0:t.map(((e,t)=>{if(!e.isInactive&&(o||n&&n.includes(e.reaction)))return a.ZP.createElement(qs,{key:e.reaction,previewIndex:t,isReady:l,onSendReaction:s,reaction:e})})))))})),Ws=(0,a.X$)((e=>{var t,n,o,i,c;let{availableReactions:d,isOpen:u,message:h,isPrivate:v,enabledReactions:Z,anchor:P,canSendNow:g,canReschedule:p,canReply:E,canEdit:C,canPin:f,canUnpin:b,canDelete:I,canReport:y,canForward:S,canFaveSticker:N,canUnfaveSticker:k,canCopy:w,canCopyLink:T,canSelect:A,canDownload:L,canSaveGif:F,isDownloading:B,canShowSeenBy:x,canShowReactionsCount:D,canRemoveReaction:$,canShowReactionList:O,seenByRecentUsers:_,onReply:G,onEdit:X,onPin:J,onUnpin:z,onForward:Y,onDelete:H,onReport:q,onFaveSticker:j,onUnfaveSticker:K,onSelect:W,onSend:Q,onReschedule:ee,onClose:te,onCloseAnimationEnd:ne,onCopyLink:ae,onCopyNumber:se,onDownload:oe,onSaveGif:le,onShowSeenBy:re,onShowReactors:ie,onSendReaction:ce,onCopyMessages:me}=e;const{showNotification:ue}=(0,l.Sv)(),he=(0,a.sO)(null),ve=(0,a.sO)(null),Ze=(0,R.Z)(),Pe=!(v||null!=Z&&Z.length),ge=O&&!Pe,[pe,Ee,Ce]=(0,M.Z)(),fe=(0,a.I4)((()=>{ue({message:Ze("Share.Link.Copied")}),te()}),[Ze,te,ue]),be=function(e,t,n,a,o){const l=[],i=(0,r.UD)(e),c=(0,r.O$)(e)||((0,r.Cg)(e)?void 0:(0,r.F$)(e)),d=(0,r.nl)(e),m=(0,r.Ti)(e,"inline"),u=c&&(m||(0,r.BM)(e))&&Fs.yl,h=window.getSelection();if(u&&l.push({label:"lng_context_copy_image",icon:"copy-media",handler:()=>{Promise.resolve(m?Bs.he(m,s.IU.BlobUrl):c.blobUrl).then(Fs.VP),null==t||t()}}),i){var v;const n=Boolean((null==h||null===(v=h.anchorNode)||void 0===v?void 0:v.parentNode)&&h.anchorNode.parentNode.closest(".Message .content-inner")&&""!==h.toString().replace(/(?:\r\n|\r|\n)/g,""));l.push({label:Ds(n),icon:"copy",handler:()=>{const s=(0,xs.Z)();if(null!=s&&s.length&&a)a(s);else{const t=n&&h?h.toString():(0,r.EU)(e);(0,Fs.TE)(t)}null==t||t()}})}return n&&l.push({label:"lng_context_copy_message_link",icon:"link",handler:()=>{n(),null==t||t()}}),d&&o&&l.push({label:"lng_profile_copy_phone",icon:"copy",handler:()=>{o(),null==t||t()}}),l}(h,fe,T?ae:void 0,me,se),Ie=(0,a.I4)((()=>document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id="${h.id}"]`)),[h.id]),ye=(0,a.I4)((()=>document.querySelector(".Transition__slide--active > .MessageList")),[]),Se=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),Ne=(0,a.I4)((()=>{var e;const t=m.wB&&(null===(e=document.querySelector(".AudioPlayer-content"))||void 0===e?void 0:e.offsetHeight)||0,n=document.querySelector(".HeaderPinnedMessage-wrapper"),a=(m.wB&&!t||!m.wB&&(null==n?void 0:n.classList.contains("full-width")))&&(null==n?void 0:n.offsetHeight)||0;return{extraPaddingX:10,extraTopPadding:document.querySelector(".MiddleHeader").offsetHeight,marginSides:ge?32:void 0,extraMarginTop:a+t}}),[ge]),ke=(0,a.I4)((()=>{ce(void 0,0,0)}),[ce]);(0,a.d4)((()=>{u?setTimeout((()=>{Ee()}),200):Ce()}),[u,Ee,Ce]);const{positionX:we,positionY:Me,transformOriginX:Te,transformOriginY:Re,style:Le,menuStyle:Fe,withScroll:Be}=(0,Vs.Z)(P,Ie,ye,Se,Ne);return(0,a.d4)((()=>(Js(Be?ve.current:void 0,".ReactionSelector"),zs)),[Be]),a.ZP.createElement(de.Z,{ref:he,isOpen:u,transformOriginX:Te,transformOriginY:Re,positionX:we,positionY:Me,style:Le,bubbleStyle:Fe,className:(0,V.Z)("MessageContextMenu","fluid",ge&&"with-reactions"),onClose:te,onCloseAnimationEnd:ne},O&&a.ZP.createElement(Ks,{enabledReactions:Z,onSendReaction:ce,isPrivate:v,availableReactions:d,isReady:pe}),a.ZP.createElement("div",{className:"scrollable-content custom-scroll",style:Fe,ref:ve},$&&a.ZP.createElement(U.Z,{icon:"heart-outline",onClick:ke},"Remove Reaction"),g&&a.ZP.createElement(U.Z,{icon:"send-outline",onClick:Q},Ze("MessageScheduleSend")),p&&a.ZP.createElement(U.Z,{icon:"schedule",onClick:ee},Ze("MessageScheduleEditTime")),E&&a.ZP.createElement(U.Z,{icon:"reply",onClick:G},Ze("Reply")),C&&a.ZP.createElement(U.Z,{icon:"edit",onClick:X},Ze("Edit")),N&&a.ZP.createElement(U.Z,{icon:"favorite",onClick:j},Ze("AddToFavorites")),k&&a.ZP.createElement(U.Z,{icon:"favorite",onClick:K},Ze("Stickers.RemoveFromFavorites")),w&&be.map((e=>a.ZP.createElement(U.Z,{key:e.label,icon:e.icon,onClick:e.handler},Ze(e.label)))),f&&a.ZP.createElement(U.Z,{icon:"pin",onClick:J},Ze("DialogPin")),b&&a.ZP.createElement(U.Z,{icon:"unpin",onClick:z},Ze("DialogUnpin")),F&&a.ZP.createElement(U.Z,{icon:"gifs",onClick:le},Ze("lng_context_save_gif")),L&&a.ZP.createElement(U.Z,{icon:"download",onClick:oe},Ze(B?"lng_context_cancel_download":"lng_media_download")),S&&a.ZP.createElement(U.Z,{icon:"forward",onClick:Y},Ze("Forward")),A&&a.ZP.createElement(U.Z,{icon:"select",onClick:W},Ze("Common.Select")),y&&a.ZP.createElement(U.Z,{icon:"flag",onClick:q},Ze("lng_context_report_msg")),(x||D)&&a.ZP.createElement(U.Z,{className:"MessageContextMenu--seen-by",icon:D?"heart-outline":"group",onClick:D?ie:re,disabled:!(D||null!==(t=h.seenByUserIds)&&void 0!==t&&t.length)},a.ZP.createElement("span",{className:"MessageContextMenu--seen-by-label"},D&&null!==(n=h.reactors)&&void 0!==n&&n.count?x&&null!==(o=h.seenByUserIds)&&void 0!==o&&o.length?Ze("Chat.OutgoingContextMixedReactionCount",[h.reactors.count,h.seenByUserIds.length]):Ze("Chat.ContextReactionCount",h.reactors.count,"i"):1===(null===(i=h.seenByUserIds)||void 0===i?void 0:i.length)&&_?(0,r.Js)(_[0]):null!==(c=h.seenByUserIds)&&void 0!==c&&c.length?Ze("Conversation.ContextMenuSeen",h.seenByUserIds.length,"i"):Ze("Conversation.ContextMenuNoViews")),a.ZP.createElement("div",{className:"avatars"},null==_?void 0:_.map((e=>a.ZP.createElement(Ae.Z,{size:"micro",user:e}))))),I&&a.ZP.createElement(U.Z,{destructive:!0,icon:"delete",onClick:H},Ze("Delete"))))})),Qs=2*h.Gw,eo=(0,a.X$)((0,l.c$)(((e,t)=>{var n,a,s;let{message:o,messageListType:l}=t;const{threadId:c}=(0,i.Bt)(e)||{},d=(0,i.xs)(e,o.chatId),m=(0,i.Z1)(e,o.chatId),{seenByExpiresAt:h,seenByMaxChatMembers:v}=e.appConfig||{},{noOptions:Z,canReply:P,canPin:g,canUnpin:p,canDelete:E,canReport:C,canEdit:f,canForward:b,canFaveSticker:I,canUnfaveSticker:y,canCopy:S,canCopyLink:N,canSelect:k,canDownload:w,canSaveGif:M}=c&&(0,i._k)(e,o,c)||{},T="pinned"===l,A="scheduled"===l,R=m&&(0,r.eA)(m),L=(0,r.CI)(o),F=Boolean(m&&v&&h&&(0,r.Bf)(m)&&(0,r.B4)(o)&&!A&&m.membersCount&&m.membersCount<=v&&o.date>Date.now()/1e3-h),B=m&&(0,r.YC)(m.id),x=(0,r.Lo)(o),D=!L&&!R&&!A&&!x&&!B&&o.reactions&&!(0,r.JE)(o.reactions)&&o.reactions.canSeeList,$=B&&(null===(n=o.reactions)||void 0===n||null===(a=n.results)||void 0===a?void 0:a.some((e=>e.isChosen))),O=(0,i.EV)(e,o),_=Boolean(o.content.contact);return{availableReactions:e.availableReactions,noOptions:Z,canSendNow:A,canReschedule:A,canReply:!T&&!A&&P,canPin:!A&&g,canUnpin:!A&&p,canDelete:E,canReport:C,canEdit:!T&&f,canForward:!O&&!A&&b,canFaveSticker:!A&&I,canUnfaveSticker:!A&&y,canCopy:_||!O&&S,canCopyLink:!O&&!A&&N,canSelect:k,canDownload:!O&&w,canSaveGif:!O&&M,activeDownloads:d,canShowSeenBy:F,enabledReactions:null!=m&&m.isForbidden||null==m||null===(s=m.fullInfo)||void 0===s?void 0:s.enabledReactions,isPrivate:B,hasFullInfo:Boolean(null==m?void 0:m.fullInfo),canShowReactionsCount:D,canShowReactionList:!L&&!x&&!A&&(null==m?void 0:m.id)!==u.aw,canRemoveReaction:$}}))((e=>{var t;let{availableReactions:n,isOpen:s,messageListType:o,chatUsername:i,message:c,album:d,anchor:m,onClose:u,onCloseAnimationEnd:h,noOptions:v,canSendNow:Z,hasFullInfo:P,canReschedule:g,canReply:p,canPin:E,canUnpin:C,canDelete:f,canReport:b,canShowReactionsCount:I,canShowReactionList:y,canRemoveReaction:S,canEdit:N,enabledReactions:k,isPrivate:w,canForward:T,canFaveSticker:A,canUnfaveSticker:R,canCopy:L,canCopyLink:F,canSelect:B,canDownload:D,canSaveGif:$,activeDownloads:O,canShowSeenBy:_}=e;const{setReplyingToId:U,setEditingId:G,pinMessage:X,openForwardMenu:J,faveSticker:z,unfaveSticker:Y,toggleMessageSelection:H,sendScheduledMessages:q,rescheduleMessage:j,downloadMessageMedia:K,cancelMessageMediaDownload:W,loadSeenBy:Q,openSeenByModal:ee,sendReaction:te,openReactorListModal:ne,loadFullChat:se,loadReactors:oe,copyMessagesByIds:re,saveGif:ie}=(0,l.Sv)(),{transitionClassNames:ce}=(0,ae.Z)(s,h,void 0,!1),[de,me]=(0,a.eJ)(!0),[ue,he]=(0,a.eJ)(!1),[ve,Ze]=(0,a.eJ)(!1),[Pe,ge]=(0,a.eJ)(!1),[pe,Ee,Ce]=(0,M.Z)();(0,a.d4)((()=>{_&&s&&Q({chatId:c.chatId,messageId:c.id})}),[Q,s,c.chatId,c.id,_]),(0,a.d4)((()=>{I&&s&&oe({chatId:c.chatId,messageId:c.id})}),[I,s,oe,c.chatId,c.id]),(0,a.d4)((()=>{P||w||!s||se({chatId:c.chatId})}),[P,s,w,se,c.chatId]);const fe=(0,a.Ye)((()=>{var e,t,n;if(null!==(e=c.reactions)&&void 0!==e&&null!==(t=e.recentReactions)&&void 0!==t&&t.length){var a,s;const e=(0,l.Rd)().users.byId;return null===(a=c.reactions)||void 0===a||null===(s=a.recentReactions)||void 0===s?void 0:s.slice(0,3).map((t=>{let{userId:n}=t;return e[n]})).filter(Boolean)}if(!c.seenByUserIds)return;const o=(0,l.Rd)().users.byId;return null===(n=c.seenByUserIds)||void 0===n?void 0:n.slice(0,3).map((e=>o[e])).filter(Boolean)}),[null===(t=c.reactions)||void 0===t?void 0:t.recentReactions,c.seenByUserIds]),be=d?d.messages.some((e=>O.includes(e.id))):O.includes(c.id),Ie=(0,a.I4)((()=>{me(!1),he(!0)}),[]),ye=(0,a.I4)((()=>{me(!1),Ze(!0)}),[]),Se=(0,a.I4)((()=>{me(!1),u()}),[u]),Ne=(0,a.I4)((()=>{he(!1),u()}),[u]),ke=(0,a.I4)((()=>{Ze(!1),u()}),[u]),we=(0,a.I4)((()=>{ge(!1),u()}),[u]),Me=(0,a.I4)((()=>{Ce(),u()}),[Ce,u]),Te=(0,a.I4)((()=>{U({messageId:c.id}),Se()}),[U,c.id,Se]),Ae=(0,a.I4)((()=>{G({messageId:c.id}),Se()}),[G,c.id,Se]),Re=(0,a.I4)((()=>{me(!1),ge(!0)}),[]),Le=(0,a.I4)((()=>{X({messageId:c.id,isUnpin:!0}),Se()}),[X,c.id,Se]),Fe=(0,a.I4)((()=>{if(Se(),null!=d&&d.messages){const e=d.messages.map((e=>{let{id:t}=e;return t}));J({fromChatId:c.chatId,messageIds:e})}else J({fromChatId:c.chatId,messageIds:[c.id]})}),[J,c,Se,d]),Be=(0,a.I4)((()=>{Se(),z({sticker:c.content.sticker})}),[Se,c.content.sticker,z]),xe=(0,a.I4)((()=>{Se(),Y({sticker:c.content.sticker})}),[Se,c.content.sticker,Y]),De=(0,a.I4)((()=>{const e=null!=d&&d.messages?{messageId:c.id,childMessageIds:d.messages.map((e=>{let{id:t}=e;return t})),withShift:!1}:{messageId:c.id,withShift:!1};H(e),Se()}),[Se,c.id,H,d]),$e=(0,a.I4)((()=>{q({chatId:c.chatId,id:c.id}),Se()}),[Se,c.chatId,c.id,q]),Oe=(0,a.I4)((()=>{me(!1),Ee()}),[Ee]),_e=(0,a.I4)((()=>{Se(),ee({chatId:c.chatId,messageId:c.id})}),[Se,c.chatId,c.id,ee]),Ue=(0,a.I4)((()=>{Se(),ne({chatId:c.chatId,messageId:c.id})}),[Se,ne,c.chatId,c.id]),Ge=(0,a.I4)((e=>{j({chatId:c.chatId,messageId:c.id,scheduledAt:Math.round(e.getTime()/1e3)})}),[c.chatId,c.id,j]),Xe=(0,a.I4)((e=>{re({messageIds:e}),Se()}),[Se,re]),Je=(0,a.I4)((()=>{(0,Fs.TE)(`https://t.me/${i||`c/${c.chatId.replace("-","")}`}/${c.id}`),Se()}),[i,Se,c]),ze=(0,a.I4)((()=>{(0,Fs.TE)(c.content.contact.phoneNumber),Se()}),[Se,c]),Ve=(0,a.I4)((()=>{((null==d?void 0:d.messages)||[c]).forEach((e=>{be?W({message:e}):K({message:e})})),Se()}),[d,c,Se,be,W,K]),Ye=(0,a.I4)((()=>{const e=(0,r.b7)(c);ie({gif:e}),Se()}),[Se,c,ie]),He=(0,a.I4)(((e,t,n)=>{te({chatId:c.chatId,messageId:c.id,reaction:e,x:t,y:n,startSize:Qs}),Se()}),[Se,c.chatId,c.id,te]),qe=(0,a.Ye)((()=>(d?d.messages:[c]).map((e=>{let{id:t}=e;return t}))),[d,c]);if(v)return void Se();const je=new Date;return je.setFullYear(je.getFullYear()+1),a.ZP.createElement("div",{className:(0,V.Z)("ContextMenuContainer",ce)},a.ZP.createElement(Ws,{availableReactions:n,message:c,isPrivate:w,isOpen:de,enabledReactions:k,anchor:m,canShowReactionsCount:I,canShowReactionList:y,canRemoveReaction:S,canSendNow:Z,canReschedule:g,canReply:p,canDelete:f,canReport:b,canPin:E,canUnpin:C,canEdit:N,canForward:T,canFaveSticker:A,canUnfaveSticker:R,canCopy:L,canCopyLink:F,canSelect:B,canDownload:D,canSaveGif:$,canShowSeenBy:_,isDownloading:be,seenByRecentUsers:fe,onReply:Te,onEdit:Ae,onPin:Re,onUnpin:Le,onForward:Fe,onDelete:Ie,onReport:ye,onFaveSticker:Be,onUnfaveSticker:xe,onSelect:De,onSend:$e,onReschedule:Oe,onClose:Se,onCopyLink:Je,onCopyMessages:Xe,onCopyNumber:ze,onDownload:Ve,onSaveGif:Ye,onShowSeenBy:_e,onSendReaction:He,onShowReactors:Ue}),a.ZP.createElement(pt,{isOpen:ue,isSchedule:"scheduled"===o,onClose:Ne,album:d,message:c}),a.ZP.createElement(x.Z,{isOpen:ve,onClose:ke,messageIds:qe}),a.ZP.createElement(Et,{isOpen:Pe,messageId:c.id,chatId:c.chatId,onClose:we}),g&&a.ZP.createElement(it,{isOpen:pe,withTimePicker:!0,selectedAt:1e3*c.date,maxAt:(0,le._F)(je),isFutureMode:!0,onClose:Me,onSubmit:Ge}))})));var to=n(33057);const no=(0,a.X$)((0,l.c$)(((e,t)=>{let{fromSticker:n,stickerSetShortName:a}=t;const s=(0,i.Bt)(e),{chatId:o,threadId:l}=s||{},c=o&&(0,i.Z1)(e,o),d=c?(0,r.H5)(c):void 0,m=Boolean(c&&l&&(0,r.Qm)(c,l)&&(null==d?void 0:d.canSendStickers)),u=Boolean(o)&&(0,i.FM)(e,o);return{canScheduleUntilOnline:Boolean(o)&&(0,i.Eh)(e,o),canSendStickers:m,isSavedMessages:u,shouldSchedule:(0,i.Aq)(e),stickerSet:n?(0,i.Ny)(e,n.stickerSetId):a?(0,i.E_)(e,a):void 0}}))((e=>{let{isOpen:t,fromSticker:n,stickerSetShortName:s,stickerSet:o,canSendStickers:r,canScheduleUntilOnline:i,shouldSchedule:c,isSavedMessages:d,onClose:m}=e;const{loadStickers:h,toggleStickerSet:v,sendMessage:Z}=(0,l.Sv)(),P=(0,a.sO)(null),g=(0,R.Z)(),[p,E]=(0,to.Z)(i),{observe:C}=(0,tn.S1)({rootRef:P,throttleMs:200,isDisabled:!t});(0,a.d4)((()=>{if(t)if(n){const{stickerSetId:e,stickerSetAccessHash:t}=n;h({stickerSetId:e,stickerSetAccessHash:t})}else s&&h({stickerSetShortName:s})}),[t,n,h,s]);const f=(0,a.I4)(((e,t,n)=>{e={...e,isPreloadedGlobally:!0},c||n?p((n=>{Z({sticker:e,isSilent:t,scheduledAt:n}),m()})):(Z({sticker:e,isSilent:t}),m())}),[m,p,Z,c]),b=(0,a.I4)((()=>{o&&(v({stickerSetId:o.id}),m())}),[m,o,v]);return a.ZP.createElement(Ue.Z,{className:"StickerSetModal",isOpen:t,onClose:m,hasCloseButton:!0,title:o?(0,Te.Z)(o.title,["emoji","links"]):g("AccDescrStickerSet")},null!=o&&o.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:P,className:"stickers custom-scroll"},o.stickers.map((e=>a.ZP.createElement(oa.Z,{sticker:e,size:u.yK,observeIntersection:C,onClick:r?f:void 0,clickArg:e,isSavedMessages:d})))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(D.Z,{size:"smaller",fluid:!0,color:o.installedDate?"danger":"primary",onClick:b},g(o.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",o.count,"i")))):a.ZP.createElement(_e.Z,null),E)})));var ao=n(62898);const so={settings:{icon:"bots",label:"BotSettings"},privacy:{icon:"info",label:"Privacy"},help:{icon:"help",label:"BotHelp"}},oo=(0,a.X$)((0,l.c$)(((e,t)=>{var n,a,s;let{chatId:o}=t;const l=(0,i.Z1)(e,o);if(!l||l.isRestricted)return{};const c=(0,r.YC)(l.id),d=c?(0,i.dy)(e,o):void 0,m=d&&(0,r.kw)(d),h=(0,r.eA)(l)||(0,r.Bf)(l)||d&&!d.isSelf,v=o!==u.FV?(0,i.IK)(e,o):void 0;return{chat:l,isMuted:(0,r.i4)(l,(0,i.dZ)(e),(0,i.NJ)(e)),isPrivate:c,canAddContact:m,canReportChat:h,canDeleteChat:(0,r.cc)(l),hasLinkedChat:Boolean(null==l||null===(n=l.fullInfo)||void 0===n?void 0:n.linkedChatId),botCommands:null==v||null===(a=v.fullInfo)||void 0===a||null===(s=a.botInfo)||void 0===s?void 0:s.commands}}))((e=>{let{chatId:t,isOpen:n,withExtraActions:s,anchor:o,isChannel:r,botCommands:i,canStartBot:c,canRestartBot:d,canSubscribe:u,canSearch:h,canCall:v,canMute:Z,canViewStatistics:P,canLeave:g,canEnterVoiceChat:p,canCreateVoiceChat:E,chat:C,isPrivate:f,isMuted:b,canReportChat:I,canDeleteChat:y,hasLinkedChat:S,canAddContact:N,onSubscribeChannel:k,onSearchClick:w,onClose:M,onCloseAnimationEnd:T}=e;const{updateChatMutedState:A,enterMessageSelectMode:L,sendBotCommand:F,restartBot:B,joinGroupCall:D,createGroupCall:$,openLinkedChat:O,openAddContactDialog:_,requestCall:G,toggleStatistics:X}=(0,l.Sv)(),[J,z]=(0,a.eJ)(!0),[V,Y]=(0,a.eJ)(!1),[H,q]=(0,a.eJ)(!1),{x:j,y:K}=o;(0,ae.Z)(n,T,void 0,!1);const W=(0,a.I4)((()=>{z(!1),q(!0)}),[]),Q=(0,a.I4)((()=>{q(!1),M()}),[M]),ee=(0,a.I4)((()=>{z(!1),Y(!0)}),[]),te=(0,a.I4)((()=>{z(!1),M()}),[M]),ne=(0,a.I4)((()=>{Y(!1),M()}),[M]),se=(0,a.I4)((()=>{F({command:"/start"})}),[F]),oe=(0,a.I4)((()=>{B({chatId:t})}),[t,B]),le=(0,a.I4)((()=>{A({chatId:t,isMuted:!b}),te()}),[t,te,b,A]),re=(0,a.I4)((()=>{E?$({chatId:t}):D({chatId:t}),te()}),[te,E,t,D,$]),ie=(0,a.I4)((()=>{O({id:t}),te()}),[t,te,O]),ce=(0,a.I4)((()=>{_({userId:t}),te()}),[_,t,te]),me=(0,a.I4)((()=>{k(),te()}),[te,k]),ue=(0,a.I4)((()=>{G({userId:t,isVideo:!0}),te()}),[t,te,G]),he=(0,a.I4)((()=>{G({userId:t}),te()}),[t,te,G]),ve=(0,a.I4)((()=>{w(),te()}),[te,w]),Ze=(0,a.I4)((()=>{X(),te()}),[te,X]),Pe=(0,a.I4)((()=>{L(),te()}),[te,L]);(0,a.d4)((()=>(Js(),zs)),[]);const ge=(0,R.Z)(),pe=(0,a.Ye)((()=>null==i?void 0:i.map((e=>{let{command:t}=e;const n=so[t];if(n)return a.ZP.createElement(U.Z,{key:t,icon:n.icon,onClick:()=>{F({command:`/${t}`}),te()}},ge(n.label))}))),[i,te,ge,F]);return a.ZP.createElement(ao.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(de.Z,{isOpen:J,positionX:"right",style:`left: ${j}px;top: ${K}px;`,onClose:te},s&&c&&a.ZP.createElement(U.Z,{icon:"bots",onClick:se},ge("BotStart")),s&&d&&a.ZP.createElement(U.Z,{icon:"bots",onClick:oe},ge("BotRestart")),s&&u&&a.ZP.createElement(U.Z,{icon:r?"channel":"group",onClick:me},ge(r?"ProfileJoinChannel":"ProfileJoinGroup")),N&&a.ZP.createElement(U.Z,{icon:"add-user",onClick:ce},ge("AddContact")),m.wB&&v&&a.ZP.createElement(U.Z,{icon:"phone",onClick:he},ge("Call")),v&&a.ZP.createElement(U.Z,{icon:"video-outlined",onClick:ue},ge("VideoCall")),m.wB&&h&&a.ZP.createElement(U.Z,{icon:"search",onClick:ve},ge("Search")),Z&&a.ZP.createElement(U.Z,{icon:b?"unmute":"mute",onClick:le},ge(b?"ChatsUnmute":"ChatsMute")),(p||E)&&a.ZP.createElement(U.Z,{icon:"voice-chat",onClick:re},ge(E?"StartVoipChat":"VoipGroupJoinCall")),S&&a.ZP.createElement(U.Z,{icon:r?"comments":"channel",onClick:ie},ge(r?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(U.Z,{icon:"select",onClick:Pe},ge("ReportSelectMessages")),P&&a.ZP.createElement(U.Z,{icon:"stats",onClick:Ze},ge("Statistics")),I&&a.ZP.createElement(U.Z,{icon:"flag",onClick:W},ge("ReportPeer.Report")),pe,g&&a.ZP.createElement(U.Z,{destructive:!0,icon:"delete",onClick:ee},ge(f?"DeleteChatUser":y?"GroupInfo.DeleteAndExit":r?"LeaveChannel":"Group.LeaveGroup"))),C&&a.ZP.createElement(xt.Z,{isOpen:V,onClose:ne,chat:C}),I&&(null==C?void 0:C.id)&&a.ZP.createElement(x.Z,{isOpen:H,onClose:Q,subject:"peer",chatId:C.id})))})));var lo=n(69589);const ro=(0,q.Ds)((e=>e()),200,!1),io=(0,a.X$)((0,l.c$)((e=>{const t=(0,i.jr)(e);if(!t)return{};const{query:n,results:a}=(0,i.n5)(e)||{},{totalCount:s,foundIds:o}=a||{};return{chat:t,query:n,totalCount:s,foundIds:o,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}}))((e=>{let{isActive:t,chat:n,query:s,totalCount:o,foundIds:r,isHistoryCalendarOpen:i}=e;const{setLocalTextSearchQuery:c,searchTextMessagesLocal:d,focusMessage:m,closeLocalTextSearch:u,openHistoryCalendar:h}=(0,l.Sv)(),v=(0,a.sO)(null),[Z,P]=(0,a.eJ)(0);(0,a.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),n=()=>{const{activeElement:n}=document;if(n&&n===v.current){const{pageTop:n,height:a}=e;t.style.transform=`translateY(${n}px)`,t.style.height=`${a}px`,document.documentElement.scrollTop=n}else t.style.transform="",t.style.height=""};return e.addEventListener("resize",n),()=>{e.removeEventListener("resize",n)}}),[]),(0,a.d4)((()=>{null!=n&&n.id&&null!=r&&r.length?(m({chatId:n.id,messageId:r[0]}),P(0)):P(-1)}),[null==n?void 0:n.id,m,r]),(0,a.d4)((()=>{Array.from(document.querySelectorAll("input")).forEach((e=>{e.disabled=Boolean(t&&e!==v.current)})),Array.from(document.querySelectorAll("div[contenteditable]")).forEach((e=>{e.contentEditable=t?"false":"true"}))}),[t]),(0,a.d4)((()=>{t||v.current.blur()}),[t]),(0,a.bt)((()=>{document.querySelector("#MobileSearch input").blur()}),[i]);const g=(0,a.I4)((e=>{c({query:e}),e.length&&ro(d)}),[d,c]),p=(0,a.I4)((()=>{if(n&&r){const e=Z+1;m({chatId:n.id,messageId:r[e]}),P(e)}}),[n,Z,m,r]),E=(0,a.I4)((()=>{if(n&&r){const e=Z-1;m({chatId:n.id,messageId:r[e]}),P(e)}}),[n,Z,m,r]);return a.ZP.createElement("div",{id:"MobileSearch",className:t?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement(D.Z,{size:"smaller",round:!0,color:"translucent",onClick:u},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement(lo.Z,{ref:v,value:s,onChange:g})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},s?null!=r&&r.length?`${Z+1} of ${o}`:r&&!r.length?"No results":"":a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>h({selectedAt:(0,le._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon-calendar"}))),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:p,disabled:!r||!r.length||Z===r.length-1},a.ZP.createElement("i",{className:"icon-up"})),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:E,disabled:!r||!r.length||0===Z},a.ZP.createElement("i",{className:"icon-down"}))))})));var co=n(15376),mo=n(29295),uo=n(72162),ho=n(17240),vo=n(70971),Zo=n(47002),Po=n(13616);function go(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const l=e[o?"scrollLeft":"scrollTop"],r=l+e[o?"offsetWidth":"offsetHeight"],i="string"==typeof t?e.querySelectorAll(t):t,{length:c}=i,d=[];let m=!1;for(let e=0;e<c;e++){const t=i[e],c=t[o?"offsetLeft":"offsetTop"],u=c+t[o?"offsetWidth":"offsetHeight"];if(s?u>=l-n&&u<=r+n:c<=r+n&&u>=l-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:i,visibleIndexes:d}}const po=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=e[n?"scrollLeft":"scrollTop"],s=a+e[n?"offsetWidth":"offsetHeight"],o=t[n?"offsetLeft":"offsetTop"],l=o+t[n?"offsetWidth":"offsetHeight"];return o>a&&l<s};var Eo=n(60539);function Co(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:o}=go(a,e,8,!0,!0);if(!o.length||!o[t])return;const l=s[0];if(!s.includes(t)||t===l&&!po(a,o[l])){const e=t>s[s.length-1]?"start":"end";(0,Eo.Z)(a,o[t],e,10)}}var fo=n(3570);function bo(e){let{isActive:t,isHorizontal:n,shouldSaveSelectionOnUpdateItems:s,shouldRemoveSelectionOnReset:o,noArrowNavigation:l,items:r,shouldSelectOnTab:i,onSelect:c,onClose:d}=e;const[m,u]=(0,a.eJ)(-1),h=(0,a.I4)((e=>r?(0,fo.Z)(r.length,e):-1),[r]),v=(0,a.I4)(((e,t)=>{t.preventDefault(),u((t=>h(t+e)))}),[u,h]),Z=(0,a.I4)((e=>{if(r&&r.length&&m>-1){const t=r[m];t&&(e.preventDefault(),c(t))}}),[r,c,m]),P=!r||m>r.length-1;return(0,a.d4)((()=>{s&&!P||u(o?-1:0)}),[P,o,s]),(0,a.d4)((()=>t?(0,ft.Z)({onEsc:d,onUp:l||n?void 0:e=>v(-1,e),onDown:l||n?void 0:e=>v(1,e),onLeft:l||!n?void 0:e=>v(-1,e),onRight:l||!n?void 0:e=>v(1,e),onTab:i?Z:void 0,onEnter:Z}):void 0),[l,v,Z,t,n,d,i]),m}const Io=(0,a.X$)((e=>{let{isOpen:t,onClose:n,onInsertUserName:s,filteredUsers:o}=e;const r=(0,a.sO)(null),{shouldRender:i,transitionClassNames:c}=(0,ae.Z)(t,void 0,void 0,!1),d=(0,a.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(0,l.Rd)().users.byId,a=n[e];a&&s(a,t)}),[s]),m=(0,a.I4)((e=>{d(e.id,!0)}),[d]),u=bo({isActive:t,items:o,onSelect:m,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:n});(0,a.d4)((()=>{Co(".chat-item-clickable",u,r)}),[u]),(0,a.d4)((()=>{o&&!o.length&&n()}),[o,n]);const h=(0,B.Z)(null!=o&&o.length?o:void 0,i),v=o&&!o.length?h:o;if(!i||v&&!v.length)return;const Z=(0,V.Z)("MentionTooltip composer-tooltip custom-scroll",c);return a.ZP.createElement("div",{className:Z,ref:r},null==v?void 0:v.map(((e,t)=>{let{id:n}=e;return a.ZP.createElement(Je.Z,{key:n,className:"chat-item-clickable scroll-item",onClick:()=>d(n),focus:u===t},a.ZP.createElement(Ve.Z,{userId:n,avatarSize:"small",withUsername:!0}))})))}));var yo=n(19830),So=n(67146);const No=(0,a.X$)((e=>{let{chatId:t,threadId:n,attachments:s,caption:o,canShowCustomSendMenu:l,isReady:r,isChatWithSelf:i,currentUserId:c,groupChatMembers:m,recentEmojis:h,baseEmojiKeywords:v,emojiKeywords:Z,shouldSchedule:P,addRecentEmoji:g,onCaptionUpdate:p,onSend:E,onFileAppend:C,onClear:f,onSendSilent:b,onSendScheduled:I}=e;const y=(0,vo.Y)(o),S=(0,vo.Y)(null),N=(0,a.sO)(),k=(0,B.Z)(s),w=s.length?s:k,T=Boolean(s.length),[A,L,F]=(0,M.Z)(),x=Boolean(w&&w.every((e=>e.quick))),$=(0,R.Z)(),{isMentionTooltipOpen:O,closeMentionTooltip:_,insertMention:U,mentionFilteredUsers:G}=(0,mo.Z)(T,y,p,u.nY,m,void 0,c),{isEmojiTooltipOpen:X,closeEmojiTooltip:J,filteredEmojis:z,insertEmoji:V}=(0,uo.Z)(T,y,h,u.nY,p,v,Z,!r);(0,a.d4)((()=>T?(0,d.Z)(f):void 0),[T,f]);const{isContextMenuOpen:Y,handleContextMenu:H,handleContextMenuClose:q,handleContextMenuHide:j}=(0,ho.Z)(S,!l||!T),K=(0,a.I4)((()=>{T&&(P?I():E())}),[T,I,E,P]),W=(0,a.I4)((e=>{e.preventDefault(),F();const{dataTransfer:{files:t}}=e;if(null!=t&&t.length){const e=x?Array.from(t).filter((e=>e.type&&u.dI.has(e.type))):Array.from(t);C(e,x)}}),[x,C,F]);if(!w)return;const Q=w.every((e=>u.oG.has(e.mimeType))),ee=w.every((e=>u.wG.has(e.mimeType))),te=w.every((e=>u.e7.has(e.mimeType)));let ne="";return ne=$(Q?"PreviewSender.SendPhoto":ee?"PreviewSender.SendVideo":te?"PreviewSender.SendAudio":"PreviewSender.SendFile",w.length,"i"),a.ZP.createElement(Ue.Z,{isOpen:T,onClose:f,header:function(){if(w)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:$.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:f},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},ne),a.ZP.createElement("div",{className:"AttachmentModal--send-wrapper"},a.ZP.createElement(D.Z,{ref:S,color:"primary",size:"smaller",className:"modal-action-button",onClick:K,onContextMenu:l?H:void 0},$("Send")),l&&a.ZP.createElement(So.Z,{isOpen:Y,isOpenToBottom:!0,onSendSilent:i?void 0:b,onSendSchedule:I,onClose:q,onCloseAnimationEnd:j,isSavedMessages:i})))}(),className:"AttachmentModal "+(A?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:L,onDrop:W,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),N.current&&(window.clearTimeout(N.current),N.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(".drop-target")&&!t&&(N.current=window.setTimeout(F,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),F())},"data-attach-description":$("Preview.Dragging.AddItems",10)},x?a.ZP.createElement("div",{className:"media-wrapper custom-scroll"},w.map((e=>e.mimeType.startsWith("image/")?a.ZP.createElement("img",{src:e.blobUrl,alt:""}):a.ZP.createElement("video",{src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0})))):a.ZP.createElement("div",{className:"document-wrapper custom-scroll"},w.map((e=>a.ZP.createElement(Zo.Z,{name:e.filename,extension:(0,co.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(Io,{isOpen:O,onClose:_,onInsertUserName:U,filteredUsers:G}),a.ZP.createElement(yo.Z,{isOpen:X,emojis:z,onClose:J,onEmojiSelect:V,addRecentEmoji:g}),a.ZP.createElement(Po.Z,{id:"caption-input-text",chatId:t,threadId:n,isAttachmentModalInput:!0,html:o,editableInputId:u.nY,placeholder:$("Caption"),onUpdate:p,onSend:K,canAutoFocus:Boolean(r&&s.length)}))))}));var ko=n(83099);const wo=(0,a.X$)((e=>{let{isOpen:t,isQuiz:n,shouldBeAnonimous:s,onSend:o,onClear:l}=e;const r=(0,a.sO)(null),i=(0,a.sO)(null),c=(0,a.sO)(null),[m,u]=(0,a.eJ)(""),[h,v]=(0,a.eJ)([""]),[Z,P]=(0,a.eJ)(!0),[g,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(n||!1),[f,b]=(0,a.eJ)(""),[I,y]=(0,a.eJ)(),[S,N]=(0,a.eJ)(!1),k=(0,R.Z)(),w=(0,a.I4)((e=>{t&&e.current&&e.current.focus()}),[t]);(0,a.d4)((()=>t?(0,d.Z)(l):void 0),[t,l]),(0,a.d4)((()=>{t||(u(""),v([""]),P(!0),p(!1),C(n||!1),b(""),y(""),N(!1))}),[n,t]),(0,a.d4)((()=>w(r)),[w,t]),(0,a.bt)((()=>{const e=c.current;e&&f!==e.innerHTML&&(e.innerHTML=f)}),[f]);const M=(0,a.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];v([...e,""]),requestAnimationFrame((()=>{const e=i.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),T=(0,a.I4)((()=>{if(N(!1),!t)return;const e=m.trim().substring(0,255),n=h.map((e=>e.trim().substring(0,100))).filter((e=>e.length));if(!e||n.length<2)return u(e),n.length?n.length<2?M(n):v(n):M(),void N(!0);if(E&&(!I||!n[Number(I)]))return void N(!0);const a={summary:{question:e,answers:n.map(((e,t)=>({text:e.trim(),option:String(t),...String(t)===I&&{correct:!0}}))),...!Z&&{isPublic:!0},...g&&{multipleChoice:!0},...E&&{quiz:!0}}};if(E){const{text:e,entities:t}=f&&(0,ko.Z)(f.substring(0,200))||{};a.quiz={correctAnswers:[I],...e&&{solution:e},...t&&{solutionEntities:t}}}o(a)}),[t,m,h,E,I,Z,g,o,M,f]),A=(0,a.I4)(((e,t)=>{const n=[...h];n[e]=t,n[n.length-1].trim().length&&n.length<10?M(n):v(n)}),[h,M]),L=(0,a.I4)((e=>{const t=[...h];t.splice(e,1),v(t),requestAnimationFrame((()=>{i.current&&i.current.classList.toggle("overflown",i.current.scrollHeight>320)}))}),[h]),F=(0,a.I4)((e=>{y(e)}),[y]),B=(0,a.I4)((e=>{P(e.target.checked)}),[]),x=(0,a.I4)((e=>{p(e.target.checked)}),[]),$=(0,a.I4)((e=>{C(e.target.checked)}),[]),O=(0,a.I4)((e=>{13===e.keyCode&&T()}),[T]),_=(0,a.I4)((e=>{u(e.target.value)}),[]),U=(0,a.I4)((()=>{if(S&&!m.trim().length)return k("lng_polls_choose_question")}),[S,k,m]),G=(0,a.I4)((e=>{const t=h.map((e=>e.trim())).filter((e=>e.length));if(S&&t.length<2&&!h[e].trim().length)return k("lng_polls_choose_answers")}),[S,k,h]);function X(){return h.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(Ge.Z,{label:t!==h.length-1||10===h.length?k("OptionHint"):k("CreatePoll.AddOption"),error:G(t),value:e,onChange:e=>A(t,e.currentTarget.value),onKeyPress:O}),t!==h.length-1&&a.ZP.createElement(D.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:k("Delete"),onClick:()=>L(t)},a.ZP.createElement("i",{className:"icon-close"})))))}return a.ZP.createElement(Ue.Z,{isOpen:t,onClose:l,header:a.ZP.createElement("div",{className:"modal-header-condensed"},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:l},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},k("NewPoll")),a.ZP.createElement(D.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:T},k("Create"))),className:"PollModal"},a.ZP.createElement(Ge.Z,{ref:r,label:k("AskAQuestion"),value:m,error:U(),onChange:_,onKeyPress:O}),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"options-list custom-scroll",ref:i},a.ZP.createElement("h3",{className:"options-header"},k("PollOptions")),S&&function(){const e=h.map((e=>e.trim())).filter((e=>e.length));return E&&(!I||!e[Number(I)])&&a.ZP.createElement("p",{className:"error"},k("lng_polls_choose_correct"))}(),E?a.ZP.createElement(ta.Z,{name:"correctOption",options:X().map(((e,t)=>({value:String(t),label:e,hidden:t===h.length-1}))),onChange:F}):X()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},!s&&a.ZP.createElement(mt.Z,{label:k("PollAnonymous"),checked:Z,onChange:B}),a.ZP.createElement(mt.Z,{label:k("PollMultiple"),checked:g,disabled:E,onChange:x}),a.ZP.createElement(mt.Z,{label:k("PollQuiz"),checked:E,disabled:g||void 0!==n,onChange:$}),E&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},k("lng_polls_solution_title")),a.ZP.createElement("div",{ref:c,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>b(e.currentTarget.innerHTML)}),a.ZP.createElement("div",{className:"note"},k("CreatePoll.ExplanationInfo")))))}));var Mo=n(56503),To=n(34284),Ao=n(81367);const Ro=(0,a.X$)((e=>{let{emoji:t,focus:n,onClick:s}=e;const o=(0,a.I4)((e=>{e.preventDefault(),s(t.native,t.id)}),[t,s]),l=(0,V.Z)("EmojiButton",n&&"focus"),r=`./img-apple-64/${t.image}.png`,i=To.Uz.has(r);return a.ZP.createElement("div",{className:l,onMouseDown:o,title:`:${t.names[0]}:`},m.op?t.native:a.ZP.createElement("img",{src:r,className:i?void 0:"opacity-transition shown",alt:t.native,loading:"lazy","data-path":r,onLoad:i?void 0:To.mE}))})),Lo=(0,a.X$)((e=>{let{category:t,index:n,allEmojis:s,observeIntersection:o,shouldRender:l,onEmojiSelect:r}=e;const i=(0,a.sO)(null);(0,tn._N)(i,o);const c=(0,na.Z)(l),d=(0,R.Z)(),h=m.wB?Math.floor((v.Z.get().width-8)/44):9,Z=44*Math.ceil(t.emojis.length/h);return a.ZP.createElement("div",{ref:i,key:t.id,id:`emoji-category-${n}`,className:"symbol-set"},a.ZP.createElement("div",{className:"symbol-set-header"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},d(t.id===u.s3?"RecentStickers":`Emoji${n}`))),a.ZP.createElement("div",{className:(0,V.Z)("symbol-set-container",c),style:`height: ${Z}px;`,dir:d.isRtl?"rtl":void 0},l&&t.emojis.map((e=>{const t=s[e];if(!t)return;const n="id"in t?t:t[1];return a.ZP.createElement(Ro,{key:n.id,emoji:n,onClick:r})}))))})),Fo={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"},Bo=[];let xo,Do,$o;const Oo=(0,a.X$)((0,l.c$)((e=>(0,Be.ei)(e,["recentEmojis"])))((e=>{let{className:t,onEmojiSelect:s,recentEmojis:o}=e;const l=(0,a.sO)(null),r=(0,a.sO)(null),[i,c]=(0,a.eJ)(),[d,h]=(0,a.eJ)(),[v,Z]=(0,a.eJ)(0),{observe:P}=(0,tn.S1)({rootRef:l,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const n=Number(t.replace("emoji-category-",""));Bo[n]=e.isIntersecting}));const t=Bo.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&Z(t[Math.floor(t.length/2)].index)}));(0,Ot.Z)(r.current,!m.wB),(0,a.d4)((()=>{if(!i)return;const e=r.current;if(!e)return;const t=42*v-e.offsetWidth/2+21;(0,Ao.Z)(e,t)}),[i,v]);const g=(0,R.Z)(),p=(0,a.Ye)((()=>{if(!i)return Lt.D;const e=[...i];return null!=o&&o.length&&e.unshift({id:u.s3,name:g("RecentStickers"),emojis:o}),e}),[i,g,o]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{c($o.categories),h($o.emojis)};$o?e():async function(){return xo||(xo=n.e(7501).then(n.t.bind(n,47501,19)),Do=(await xo).default,$o=(0,To.NM)(Do)),xo}().then(e)}),200)}),[]);const E=(0,a.I4)((e=>{Z(e);const t=document.getElementById(`emoji-category-${e}`);(0,Eo.Z)(l.current,t,"start",50,800)}),[]),C=(0,a.I4)(((e,t)=>{s(e,t)}),[s]),f=(0,en.Z)([],u.kU),b=(0,V.Z)("EmojiPicker",t);return d&&f?a.ZP.createElement("div",{className:b},a.ZP.createElement("div",{ref:r,className:"EmojiPicker-header",dir:g.isRtl?"rtl":""},p.map((function(e,t){const n=Fo[e.id];return n&&a.ZP.createElement(D.Z,{className:"symbol-set-button "+(t===v?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>E(t),ariaLabel:e.name},a.ZP.createElement("i",{className:n}))}))),a.ZP.createElement("div",{ref:l,className:(0,V.Z)("EmojiPicker-main no-selection",m.$b?"no-scrollbar":"custom-scroll")},p.map(((e,t)=>a.ZP.createElement(Lo,{category:e,index:t,allEmojis:d,observeIntersection:P,shouldRender:v>=t-1&&v<=t+1,onEmojiSelect:C}))))):a.ZP.createElement("div",{className:b},a.ZP.createElement(_e.Z,null))})));var _o=n(56389);const Uo=m.wB?8:16,Go=(0,a.X$)((e=>{let{stickerSet:t,loadAndPlay:n,index:s,shouldRender:o,favoriteStickers:r,isSavedMessages:i,observeIntersection:c,onStickerSelect:d,onStickerUnfave:h,onStickerFave:Z,onStickerRemoveRecent:P}=e;const{clearRecentStickers:g}=(0,l.Sv)(),p=(0,a.sO)(null),[E,C,f]=(0,M.Z)(),b=(0,R.Z)();(0,tn._N)(p,c);const I=(0,na.Z)(o),y=(0,a.I4)((()=>{g(),f()}),[g,f]),S=m.wB?Math.floor((v.Z.get().width-8)/(u.Q+Uo)):5,N=Math.ceil(t.count/S)*(u.Q+Uo),k=(0,a.Ye)((()=>r?new Set(r.map((e=>{let{id:t}=e;return t}))):void 0),[r]),w=t.id===u.s3;return a.ZP.createElement("div",{ref:p,key:t.id,id:`sticker-set-${s}`,className:"symbol-set"},a.ZP.createElement("div",{className:"symbol-set-header"},a.ZP.createElement("p",{className:"symbol-set-name"},t.title),w&&a.ZP.createElement("i",{className:"symbol-set-remove icon-close",onClick:C})),a.ZP.createElement("div",{className:(0,V.Z)("symbol-set-container",I),style:`height: ${N}px;`},o&&t.stickers&&t.stickers.map((e=>a.ZP.createElement(oa.Z,{key:e.id,sticker:e,size:u.Q,observeIntersection:c,noAnimate:!n,onClick:d,clickArg:e,onUnfaveClick:t.id===u.k&&null!=k&&k.has(e.id)?h:void 0,onFaveClick:null!=k&&k.has(e.id)?void 0:Z,onRemoveRecentClick:w?P:void 0,isSavedMessages:i,canViewSet:!0})))),w&&a.ZP.createElement(tt.Z,{text:b("ClearRecentEmoji"),isOpen:E,onClose:f,confirmHandler:y,confirmIsDestructive:!0}))})),Xo=[],Jo=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const{setsById:a,added:s,recent:o,favorite:l}=e.stickers,r=(0,i.FM)(e,n);return{chat:(0,i.Z1)(e,n),recentStickers:o.stickers,favoriteStickers:l.stickers,stickerSetsById:a,addedSetIds:s.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers,isSavedMessages:r}}))((e=>{let{chat:t,threadId:n,className:s,loadAndPlay:o,canSendStickers:r,recentStickers:i,favoriteStickers:c,addedSetIds:d,stickerSetsById:h,shouldPlay:v,isSavedMessages:Z,onStickerSelect:P}=e;const{loadRecentStickers:g,addRecentSticker:p,unfaveSticker:E,faveSticker:C,removeRecentSticker:f}=(0,l.Sv)(),b=(0,a.sO)(null),I=(0,a.sO)(null),[y,S]=(0,a.eJ)(0),N=(0,_o.Z)(t.id,n),{observe:k}=(0,tn.S1)({rootRef:b,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("sticker-set-"))return;const n=Number(t.replace("sticker-set-",""));Xo[n]=e.isIntersecting}));const t=Xo.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&S(t[Math.floor(t.length/2)].index)})),{observe:w}=(0,tn.S1)({rootRef:I}),M=(0,R.Z)(),T=Boolean(d),A=(0,a.Ye)((()=>{var e;if(!d)return Lt.D;const n=[];if(c.length&&n.push({id:u.k,title:M("FavoriteStickers"),stickers:c,count:c.length}),i.length&&n.push({id:u.s3,title:M("RecentStickers"),stickers:i,count:i.length}),null!=t&&null!==(e=t.fullInfo)&&void 0!==e&&e.stickerSet){const e=h[t.fullInfo.stickerSet.id];e&&n.push({id:u.dW,title:M("GroupStickers"),stickers:e.stickers,count:e.stickers.length})}return[...n,...Object.values((0,Be.q0)(h,d))]}),[d,c,i,t,M,h]),L=(0,a.Ye)((()=>T&&0===A.filter((e=>{var t;return null===(t=e.stickers)||void 0===t?void 0:t.length})).length),[A,T]);(0,a.d4)((()=>{o&&(g(),N({type:"chooseSticker"}))}),[o,g,N]),(0,Ot.Z)(I.current),(0,a.d4)((()=>{if(!T)return;const e=I.current;if(!e)return;const t=52*y-(e.offsetWidth/2-26);(0,Ao.Z)(e,t)}),[T,y]);const F=(0,a.I4)((e=>{S(e);const t=document.getElementById(`sticker-set-${e}`);(0,Eo.Z)(b.current,t,"start",void 0,500)}),[]),B=(0,a.I4)(((e,t,n)=>{P(e,t,n),p({sticker:e})}),[p,P]),x=(0,a.I4)((e=>{E({sticker:e})}),[E]),$=(0,a.I4)((e=>{C({sticker:e})}),[C]),O=(0,a.I4)((()=>{N({type:"chooseSticker"})}),[N]),_=(0,a.I4)((e=>{f({sticker:e})}),[f]),U=(0,en.Z)([],u.Y),G=(0,V.Z)("StickerPicker",s);return T&&U&&!L&&r?a.ZP.createElement("div",{className:G},a.ZP.createElement("div",{ref:I,className:"StickerPicker-header no-selection no-scrollbar"},A.map((function(e,n){var s;const o=null===(s=e.stickers)||void 0===s?void 0:s[0],l=(0,V.Z)("symbol-set-button sticker-set-button",n===y&&"activated");return e.id===u.s3||e.id===u.k||e.id===u.dW||e.hasThumbnail||!o?a.ZP.createElement(D.Z,{key:e.id,className:l,ariaLabel:e.title,round:!0,faded:e.id===u.s3||e.id===u.k,color:"translucent",onClick:()=>F(n)},e.id===u.s3?a.ZP.createElement("i",{className:"icon-recent"}):e.id===u.k?a.ZP.createElement("i",{className:"icon-favorite"}):e.id===u.dW?a.ZP.createElement(Ae.Z,{chat:t,size:"small"}):e.isLottie?a.ZP.createElement(aa,{stickerSet:e,observeIntersection:w}):a.ZP.createElement(sa,{stickerSet:e,observeIntersection:w})):a.ZP.createElement(oa.Z,{key:e.id,sticker:o,size:u.DC,title:e.title,className:l,observeIntersection:w,onClick:F,clickArg:n,noContextMenu:!0})}))),a.ZP.createElement("div",{ref:b,onMouseMove:O,className:(0,V.Z)("StickerPicker-main no-selection",m.$b?"no-scrollbar":"custom-scroll")},A.map(((e,t)=>a.ZP.createElement(Go,{key:e.id,stickerSet:e,loadAndPlay:Boolean(v&&o),index:t,observeIntersection:k,shouldRender:y>=t-1&&y<=t+1,onStickerSelect:B,onStickerUnfave:x,onStickerFave:$,onStickerRemoveRecent:_,favoriteStickers:c,isSavedMessages:Z}))))):a.ZP.createElement("div",{className:G},r?L?a.ZP.createElement("div",{className:"picker-disabled"},M("NoStickers")):a.ZP.createElement(_e.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},M("ErrorSendRestrictedStickersAll")))})));var zo=n(30386);function Vo(){return Vo=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Vo.apply(this,arguments)}const Yo=(0,a.X$)((e=>{var t,n;let{gif:o,isDisabled:l,className:r,observeIntersection:i,onClick:c,onUnsaveClick:d,isSavedMessages:u}=e;const h=(0,a.sO)(null),v=(0,a.sO)(null),Z=(0,R.Z)(),P=Boolean(null===(t=o.thumbnail)||void 0===t?void 0:t.dataUri),g=`gif${o.id}`,p=(0,tn.Op)(h,i)&&!l,E=(0,L.Z)(`${g}?size=m`,!p,s.IU.BlobUrl),C=(0,Ea.Z)(null===(n=o.thumbnail)||void 0===n?void 0:n.dataUri,Boolean(E)),f=(0,L.Z)(g,!p,s.IU.BlobUrl),b=Boolean(p&&f),{isBuffered:I,bufferingHandlers:y}=(0,te.Z)(!0),S=p&&!I,N=p&&I;(0,se.Z)(v,[b]);const{isContextMenuOpen:k,contextMenuPosition:w,handleBeforeContextMenu:M,handleContextMenu:T,handleContextMenuClose:A,handleContextMenuHide:F}=(0,ho.Z)(h),B=(0,a.I4)((()=>h.current),[]),x=(0,a.I4)((()=>h.current.closest(".custom-scroll, .no-scrollbar")),[]),$=(0,a.I4)((()=>h.current.querySelector(".gif-context-menu .bubble")),[]),{positionX:O,positionY:_,transformOriginX:G,transformOriginY:X,style:J}=(0,Vs.Z)(w,B,x,$),z=(0,a.I4)((()=>{!k&&c&&c({...o,blobUrl:f})}),[k,c,o,f]),Y=(0,a.I4)((e=>{e.stopPropagation(),e.preventDefault(),d(o)}),[d,o]),H=(0,a.I4)((()=>{null==d||d(o)}),[o,d]),q=(0,a.I4)((()=>{c({...o,blobUrl:f},!0)}),[o,c,f]),j=(0,a.I4)((()=>{c({...o,blobUrl:f},void 0,!0)}),[o,c,f]),K=(0,a.I4)((e=>{(0,zo.b)(e),M(e)}),[M]);(0,a.d4)((()=>{l&&A()}),[A,l]);const W=(0,V.Z)("GifButton",o.width&&o.height&&o.width<o.height?"vertical":"horizontal",c&&"interactive",g,r);return a.ZP.createElement("div",{ref:h,className:W,onMouseDown:K,onClick:z,onContextMenu:T},!m.$b&&d&&a.ZP.createElement(D.Z,{className:"gif-unsave-button",color:"dark",pill:!0,onClick:Y},a.ZP.createElement("i",{className:"icon-close gif-unsave-button-icon"})),P&&a.ZP.createElement("canvas",{ref:C,className:"thumbnail",style:N?"display: none;":void 0}),E&&!N&&a.ZP.createElement("img",{src:E,alt:"",className:"preview"}),b&&a.ZP.createElement("video",Vo({ref:v,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},y),a.ZP.createElement("source",{src:f})),S&&a.ZP.createElement(Q.Z,{color:E||P?"white":"black"}),c&&void 0!==w&&a.ZP.createElement(de.Z,{isOpen:k,transformOriginX:G,transformOriginY:X,positionX:O,positionY:_,style:J,className:"gif-context-menu",autoClose:!0,onClose:A,onCloseAnimationEnd:F},!u&&a.ZP.createElement(U.Z,{onClick:q,icon:"mute"},Z("SendWithoutSound")),a.ZP.createElement(U.Z,{onClick:j,icon:"calendar"},Z(u?"SetReminder":"ScheduleMessage")),d&&a.ZP.createElement(U.Z,{destructive:!0,icon:"delete",onClick:H},Z("Delete"))))})),Ho=(0,a.X$)((0,l.c$)((e=>{const{chatId:t}=(0,i.Bt)(e)||{},n=Boolean(t)&&(0,i.FM)(e,t);return{savedGifs:e.gifs.saved.gifs,isSavedMessages:n}}))((e=>{let{className:t,loadAndPlay:n,canSendGifs:s,savedGifs:o,isSavedMessages:r,onGifSelect:i}=e;const{loadSavedGifs:c,saveGif:d}=(0,l.Sv)(),h=(0,a.sO)(null),{observe:v}=(0,tn.S1)({rootRef:h,debounceMs:300});(0,a.d4)((()=>{n&&c()}),[n,c]);const Z=(0,a.I4)((e=>{d({gif:e,shouldUnsave:!0})}),[d]),P=(0,en.Z)([],u.Y);return a.ZP.createElement("div",{ref:h,className:(0,V.Z)("GifPicker",t,m.$b?"no-scrollbar":"custom-scroll")},s?P&&o&&o.length?o.map((e=>a.ZP.createElement(Yo,{key:e.id,gif:e,observeIntersection:v,isDisabled:!n,onClick:s?i:void 0,onUnsaveClick:Z,isSavedMessages:r}))):P&&o?a.ZP.createElement("div",{className:"picker-disabled"},"No saved GIFs."):a.ZP.createElement(_e.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))})));let qo;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(qo||(qo={}));const jo=Object.values(qo).filter((e=>"string"==typeof e)),Ko={[qo.Emoji]:"icon-smile",[qo.Stickers]:"icon-stickers",[qo.GIFs]:"icon-gifs"},Wo=(0,a.X$)((e=>{let{activeTab:t,onSwitchTab:n,onRemoveSymbol:s,onSearchOpen:o}=e;const l=(0,R.Z)();function r(e){return a.ZP.createElement(D.Z,{className:"symbol-tab-button "+(t===e?"activated":""),onClick:()=>n(e),ariaLabel:jo[e],round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:Ko[e]}))}const i=(0,a.I4)((()=>{o(t===qo.Stickers?"stickers":"gifs")}),[t,o]);return a.ZP.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:l.isRtl?"rtl":void 0},t!==qo.Emoji&&a.ZP.createElement(D.Z,{className:"symbol-search-button",ariaLabel:t===qo.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:i},a.ZP.createElement("i",{className:"icon-search"})),r(qo.Emoji),r(qo.Stickers),r(qo.GIFs),t===qo.Emoji&&a.ZP.createElement(D.Z,{className:"symbol-delete-button",onClick:s,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:"icon-delete-left"})))}));let Qo=!1;const el=(0,a.X$)((0,l.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown})))((e=>{let{chatId:t,threadId:n,isOpen:s,canSendStickers:o,canSendGifs:l,isLeftColumnShown:r,onLoad:i,onClose:c,onEmojiSelect:d,onStickerSelect:u,onGifSelect:h,onRemoveSymbol:v,onSearchOpen:Z,addRecentEmoji:P}=e;const[g,p]=(0,a.eJ)(0),[E,C]=(0,a.eJ)([]),[f,b]=(0,Mo.Z)(s,c,void 0,m.wB),{shouldRender:I,transitionClassNames:y}=(0,ae.Z)(s,c,!1,!1);!Qo&&s&&(Qo=!0),(0,a.d4)((()=>{i()}),[i]),(0,a.bt)((()=>{if(m.wB)return s&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{s&&(0,q.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[s]);const S=(0,a.sO)(E);S.current=E,(0,a.d4)((()=>{S.current.length&&(S.current.forEach((e=>{P({emoji:e})})),C([]))}),[s,g,P]);const N=(0,a.I4)(((e,t)=>{C((e=>[...e,t])),d(e)}),[d]),k=(0,a.I4)((e=>{c(),Z(e)}),[c,Z]),w=(0,a.I4)(((e,t,n)=>{u(e,t,n,!0)}),[u]),M=(0,R.Z)();function T(e,r){switch(g){case qo.Emoji:return a.ZP.createElement(Oo,{className:"picker-tab",onEmojiSelect:N});case qo.Stickers:return a.ZP.createElement(Jo,{className:"picker-tab",loadAndPlay:!!o&&s&&(e||r),canSendStickers:o,onStickerSelect:w,chatId:t,threadId:n});case qo.GIFs:return a.ZP.createElement(Ho,{className:"picker-tab",loadAndPlay:!!l&&s&&(e||r),canSendGifs:l,onGifSelect:h})}}const A=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},Qo&&a.ZP.createElement(O.Z,{name:"slide",activeKey:g,renderCount:jo.length},T)),m.wB&&a.ZP.createElement(D.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:M("Close"),className:"symbol-close-button",size:"tiny",onClick:c},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Wo,{activeTab:g,onSwitchTab:p,onRemoveSymbol:v,onSearchOpen:k}));if(m.wB){if(!I)return;const e=(0,V.Z)("SymbolMenu mobile-menu",y,r&&"left-column-open");return a.ZP.createElement(ao.Z,null,a.ZP.createElement("div",{className:e},A))}return a.ZP.createElement(de.Z,{isOpen:s,positionX:"left",positionY:"bottom",onClose:c,className:"SymbolMenu",onCloseAnimationEnd:c,onMouseEnter:m.$b?void 0:f,onMouseLeave:m.$b?void 0:b,noCloseOnBackdrop:!m.$b,noCompact:!0},A)}))),tl=(0,a.X$)((e=>{let{withAvatar:t,focus:n,botCommand:s,bot:o,onClick:l}=e;return a.ZP.createElement(Je.Z,{key:s.command,className:(0,V.Z)("BotCommand chat-item-clickable scroll-item",t&&"with-avatar"),multiline:!0,onClick:()=>l(s),focus:n},t&&a.ZP.createElement(Ae.Z,{size:"small",user:o}),a.ZP.createElement("div",{className:"content-inner"},a.ZP.createElement("span",{className:"title"},"/",s.command),a.ZP.createElement("span",{className:"subtitle"},(0,Te.Z)(s.description))))})),nl=(0,a.X$)((0,l.c$)((e=>({usersById:e.users.byId})))((e=>{let{usersById:t,isOpen:n,withUsername:s,botCommands:o,onClick:r,onClose:i}=e;const{sendBotCommand:c}=(0,l.Sv)(),d=(0,a.sO)(null),{shouldRender:m,transitionClassNames:u}=(0,ae.Z)(n,void 0,void 0,!1),h=(0,a.I4)((e=>{let{botId:n,command:a}=e;const o=t[n];c({command:`/${a}${s&&o?`@${o.username}`:""}`,botId:n}),r()}),[r,c,t,s]),v=bo({isActive:n,items:o,onSelect:h,onClose:i});(0,a.d4)((()=>{o&&!o.length&&i()}),[o,i]),(0,a.d4)((()=>{Co(".chat-item-clickable",v,d)}),[v]);const Z=(0,B.Z)(o&&o.length?o:void 0,m),P=o&&!o.length?Z:o;if(!m||P&&!P.length)return;const g=(0,V.Z)("BotCommandTooltip composer-tooltip custom-scroll",u);return a.ZP.createElement("div",{className:g,ref:d},P&&P.map(((e,n)=>a.ZP.createElement(tl,{key:`${e.botId}_${e.command}`,botCommand:e,bot:t[e.botId],withAvatar:!0,onClick:h,focus:v===n}))))}))),al=(0,a.X$)((e=>{let{isOpen:t,botCommands:n,onClose:s}=e;const{sendBotCommand:o}=(0,l.Sv)(),[r,i]=(0,Mo.Z)(t,s,void 0,m.wB),c=(0,a.I4)((e=>{o({command:`/${e.command}`,botId:e.botId}),s()}),[s,o]);return a.ZP.createElement(de.Z,{isOpen:t,positionX:"left",positionY:"bottom",onClose:s,className:"BotCommandMenu",onCloseAnimationEnd:s,onMouseEnter:m.$b?void 0:r,onMouseLeave:m.$b?void 0:i,noCloseOnBackdrop:!m.$b,noCompact:!0},n.map((e=>a.ZP.createElement(tl,{key:e.command,botCommand:e,onClick:c}))))})),sl=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const{stickers:a}=e.stickers.forEmoji;return{stickers:a,isSavedMessages:(0,i.FM)(e,n)}}))((e=>{let{chatId:t,threadId:n,isOpen:s,stickers:o,isSavedMessages:r,onStickerSelect:i}=e;const{clearStickersForEmoji:c}=(0,l.Sv)(),m=(0,a.sO)(null),{shouldRender:h,transitionClassNames:v}=(0,ae.Z)(s,void 0,void 0,!1),Z=(0,B.Z)(o,!0),P=o||Z,g=(0,_o.Z)(t,n),{observe:p}=(0,tn.S1)({rootRef:m,throttleMs:200});(0,a.d4)((()=>s?(0,d.Z)(c):void 0),[s,c]);const E=(0,V.Z)("StickerTooltip composer-tooltip custom-scroll",v,!(null!=P&&P.length)&&"hidden");return a.ZP.createElement("div",{ref:m,className:E,onMouseMove:()=>{g({type:"chooseSticker"})}},h&&P?P.map((e=>a.ZP.createElement(oa.Z,{key:e.id,sticker:e,size:u.Q,observeIntersection:p,onClick:i,clickArg:e,isSavedMessages:r,canViewSet:!0}))):h?a.ZP.createElement(_e.Z,null):void 0)}))),ol=(0,a.X$)((e=>{let{isOpen:t,isOpenToBottom:n=!1,isSavedMessages:s,onSendSilent:o,onSendSchedule:l,onClose:r,onCloseAnimationEnd:i}=e;const[c,d]=(0,Mo.Z)(t,r),u=(0,R.Z)();return a.ZP.createElement(de.Z,{isOpen:t,autoClose:!0,positionX:"right",positionY:n?"top":"bottom",className:"CustomSendMenu",onClose:r,onCloseAnimationEnd:i,onMouseEnter:m.$b?void 0:c,onMouseLeave:m.$b?void 0:d,noCloseOnBackdrop:!m.$b},o&&a.ZP.createElement(U.Z,{icon:"mute",onClick:o},u("SendWithoutSound")),l&&a.ZP.createElement(U.Z,{icon:"schedule",onClick:l},u(s?"SetReminder":"ScheduleMessage")))}));var ll=n(12420),rl=n(72087),il=n(52678);const cl=(0,a.X$)((e=>{let{isOpen:t,emojis:n,onClose:s,onEmojiSelect:o,addRecentEmoji:l}=e;const r=(0,a.sO)(null),{shouldRender:i,transitionClassNames:c}=(0,ae.Z)(t,void 0,void 0,!1),d=(0,il.Z)(n.length?n:void 0,350)||[],m=(0,a.I4)((e=>{o(e.native),l({emoji:e.id})}),[l,o]),u=(0,a.I4)(((e,t)=>{o(e),l({emoji:t})}),[l,o]),h=bo({isActive:t,isHorizontal:!0,items:n,onSelect:m,onClose:s});(0,a.d4)((()=>{!function(e,t){const n=t.current;if(!n)return;const{visibleIndexes:a,allElements:s}=go(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const o=a[0];if(!a.includes(e)||e===o&&!po(n,s[o],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,Ao.Z)(n,t)}}(h,r)}),[h]);const v=(0,V.Z)("EmojiTooltip composer-tooltip custom-scroll-x",c);return a.ZP.createElement("div",{ref:r,className:v},i&&d?d.map(((e,t)=>a.ZP.createElement(Ro,{key:e.id,emoji:e,focus:h===t,onClick:u}))):i?a.ZP.createElement(_e.Z,null):void 0)})),dl=(0,a.X$)((e=>{let t,{title:n,description:s,thumbnail:o,thumbUrl:l,focus:r,transitionClassNames:i="",onClick:c}=e;const d=(0,L.Z)(o?`webDocument:${o.url}`:void 0);return l=l||d,l?t=a.ZP.createElement("img",{src:l,className:i,alt:"",decoding:"async",draggable:"false"}):n&&(t=(0,Nt.Xv)(n,1)),a.ZP.createElement(Je.Z,{focus:r,className:"BaseResult chat-item-clickable",onMouseDown:zo.b,onClick:c},a.ZP.createElement("span",{className:"thumb"},"string"==typeof t?(0,Te.Z)(t):t),a.ZP.createElement("div",{className:"content-inner"},n&&a.ZP.createElement("div",{className:"title"},n),s&&a.ZP.createElement("div",{className:"description"},s)))})),ml=(0,a.X$)((e=>{var t;let n,s,o,{focus:l,isForGallery:r,inlineResult:i,onClick:c}=e;"photo"in i&&(n=i.photo),"thumbnail"in i&&(s=i.thumbnail),"webThumbnail"in i&&r&&(o=i.webThumbnail);const d=(0,L.Z)(o?`webDocument:${o.url}`:void 0),m=(0,L.Z)(n&&`photo${n.id}?size=m`),u=(0,na.Z)(m),h=(0,a.I4)((()=>{c(i)}),[i,c]);var v,Z;if(r)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:h},a.ZP.createElement("img",{src:(null===(v=n)||void 0===v||null===(Z=v.thumbnail)||void 0===Z?void 0:Z.dataUri)||d,alt:""}),a.ZP.createElement("img",{src:m,className:(0,V.Z)("full-media",u),alt:""}));const{title:P,description:g}=i;return a.ZP.createElement(dl,{focus:l,thumbUrl:m||(null===(t=s)||void 0===t?void 0:t.dataUri)||d,transitionClassNames:u,title:P,description:g,onClick:h})})),ul=(0,a.X$)((e=>{let{focus:t,inlineResult:n,onClick:s}=e;const{title:o,url:l,description:r,webThumbnail:i}=n,c=(0,a.I4)((()=>{s(n)}),[n,s]);return a.ZP.createElement(dl,{focus:t,thumbnail:i,title:o||l,description:r,onClick:c})})),hl=(0,a.X$)((e=>{let{inlineResult:t,isSavedMessages:n,canSendGifs:s,observeIntersection:o,onClick:l}=e;const{gif:r}=t,i=(0,a.I4)(((e,n,a)=>{l(t,n,a)}),[t,l]);if(r)return a.ZP.createElement(Yo,{gif:r,observeIntersection:o,className:"chat-item-clickable",onClick:s?i:void 0,isSavedMessages:n})})),vl=(0,a.X$)((e=>{let{inlineResult:t,isSavedMessages:n,observeIntersection:s,onClick:o}=e;const{sticker:l}=t;if(l)return a.ZP.createElement(oa.Z,{sticker:l,size:u.zq,observeIntersection:s,title:l.emoji,className:"chat-item-clickable",onClick:o,clickArg:t,isSavedMessages:n,canViewSet:!0})})),Zl=(0,q.P2)((e=>e()),500,!0),Pl=(0,a.X$)((e=>{let{isOpen:t,botId:n,isGallery:s,inlineBotResults:r,switchPm:i,isSavedMessages:c,canSendGifs:d,loadMore:u,onClose:h,onSelectResult:v}=e;const{openChat:Z,startBot:P}=(0,l.Sv)(),g=(0,a.sO)(null),{shouldRender:p,transitionClassNames:E}=(0,ae.Z)(t,void 0,void 0,!1),{observe:C}=(0,tn.S1)({rootRef:g,debounceMs:200,isDisabled:!t}),f=(0,a.I4)((e=>{let{direction:t}=e;t===o.Uq.Backwards&&Zl(u)}),[u]),b=bo({isActive:t,shouldRemoveSelectionOnReset:s,noArrowNavigation:s,items:r,onSelect:v,onClose:h});(0,a.d4)((()=>{Co(".chat-item-clickable",b,g)}),[b]);const I=(0,a.I4)((()=>{Z({id:n}),P({botId:n,param:i.startParam})}),[n,Z,P,i]),y=(0,B.Z)(null!=r&&r.length?r:void 0,p),S=r&&!r.length?y:r;if(!p||!(null!=S&&S.length||i))return;const N=(0,V.Z)("InlineBotTooltip composer-tooltip",m.$b?"no-scrollbar":"custom-scroll",s&&"gallery",E);return a.ZP.createElement(Xe.Z,{ref:g,className:N,items:S,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:f,sensitiveArea:160},i&&a.ZP.createElement(Je.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:I},a.ZP.createElement("span",{className:"title"},i.text)),(null==S?void 0:S.length)&&S.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(hl,{key:e.id,inlineResult:e,observeIntersection:C,onClick:v,isSavedMessages:c,canSendGifs:d});case"photo":return a.ZP.createElement(ml,{key:e.id,isForGallery:s,inlineResult:e,onClick:v});case"sticker":return a.ZP.createElement(vl,{key:e.id,inlineResult:e,observeIntersection:C,onClick:v,isSavedMessages:c});case"video":case"file":case"game":return a.ZP.createElement(ml,{key:e.id,focus:b===t,inlineResult:e,onClick:v});case"article":case"audio":return a.ZP.createElement(ul,{key:e.id,focus:b===t,inlineResult:e,onClick:v});default:return}})))})),gl=(0,a.X$)((e=>{let{isOpen:t,onClose:n,chatId:s,selectedSendAsId:o,sendAsIds:i}=e;const{saveDefaultSendAs:c}=(0,l.Sv)(),d=(0,l.Rd)().users.byId,u=(0,l.Rd)().chats.byId,h=(0,R.Z)(),v=(0,a.sO)(null),[Z,P,g]=(0,Mo.Z)(t,n,void 0);(0,a.d4)((()=>{t&&g()}),[t,g]);const p=(0,a.I4)((e=>{n(),c({chatId:s,sendAsId:e})}),[s,n,c]),E=bo({isActive:t,items:i,onSelect:p,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:n});return(0,a.d4)((()=>{Co(".chat-item-clickable",E,v)}),[E]),(0,a.d4)((()=>{i&&!i.length&&n()}),[i,n]),a.ZP.createElement(de.Z,{isOpen:t,positionX:"left",positionY:"bottom",onClose:n,className:"SendAsMenu",onCloseAnimationEnd:n,onMouseEnter:m.$b?void 0:Z,onMouseLeave:m.$b?void 0:P,noCloseOnBackdrop:!m.$b,noCompact:!0},a.ZP.createElement("div",{className:"send-as-title",dir:"auto"},h("SendMessageAsTitle")),d&&u&&(null==i?void 0:i.map(((e,t)=>{const n=(0,r.YC)(e)?d[e]:void 0,s=n?void 0:u[e],l=n?(0,r.Js)(n):null==s?void 0:s.title;return a.ZP.createElement(Je.Z,{key:e,className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>p(e),focus:E===t},a.ZP.createElement(Ae.Z,{size:"small",user:n,chat:s,className:(0,V.Z)(o===e&&"selected")}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},l&&(0,Te.Z)(l))),a.ZP.createElement("span",{className:"subtitle"},n?h("VoipGroupPersonalAccount"):h("Subscribers",null==s?void 0:s.membersCount,"i"))))}))))}));var pl=n(76844);const El=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,i.Z1)(e,n),s=a&&(0,i.Zw)(e,a.id);if(!a||!s)return{};const{query:o,results:l}=(0,i.n5)(e)||{},{totalCount:r,foundIds:c}=l||{};return{chat:a,messagesById:s,query:o,totalCount:r,foundIds:c}}))((e=>{let{chatId:t,threadId:n,onClose:s,isActive:o,chat:c,messagesById:d,query:m,totalCount:u,foundIds:h}=e;const{searchTextMessagesLocal:v,focusMessage:Z}=(0,l.Sv)(),P=(0,a.sO)(null),g=(0,R.Z)();(0,A.Z)({isActive:o,onBack:s});const[p,E]=(0,De.Z)(v,h),C=(0,a.Ye)((()=>m&&null!=p&&p.length&&d?p.map((e=>{const a=d[e];if(!a)return;const s=a.senderId?(0,i.dy)((0,l.Rd)(),a.senderId):void 0;let o;if(c&&(0,r.eA)(c))o=c;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;o=e&&t?(0,i.Z1)((0,l.Rd)(),t):void 0}else o=a.senderId?(0,i.Z1)((0,l.Rd)(),a.senderId):void 0;return{message:a,senderUser:s,senderChat:o,onClick:()=>Z({chatId:t,threadId:n,messageId:e})}})).filter(Boolean):Lt.D),[m,p,d,c,Z,t,n]),f=(0,$e.Z)(P,!0,(e=>{const t=null==C?void 0:C[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0),I=(null==p?void 0:p[0])===(null==h?void 0:h[0]);return a.ZP.createElement(Xe.Z,{ref:P,className:"RightSearch custom-scroll",items:C,preloadBackwards:0,onLoadMore:E,onKeyDown:f},I&&a.ZP.createElement("p",{key:"helper-text",className:"helper-text",dir:"auto"},m?0!==u&&C.length?1===u?"1 message found":`${C.length&&(u||C.length)} messages found`:g("lng_search_no_results"):g("lng_dlg_search_for_messages")),C.map((e=>{let{message:t,senderUser:n,senderChat:s,onClick:o}=e;const l=s?(0,r.U)(g,s):(0,r.Js)(n),i=(0,b.e)(g,t,void 0,m);return a.ZP.createElement(Je.Z,{key:t.id,teactOrderKey:-t.date,className:"chat-item-clickable search-result-message m-0",onClick:o},a.ZP.createElement(Ae.Z,{chat:s,user:n}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},l&&(0,Te.Z)(l)),a.ZP.createElement(pl.Z,{message:t})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},i)))})))}))),Cl=(0,a.X$)((0,l.c$)(((e,t)=>{let{stickerSetId:n}=t;return{set:(0,i.Ny)(e,n),shouldPlay:(0,i.yB)(e)}}))((e=>{let{stickerSetId:t,observeIntersection:n,set:s,shouldPlay:o,isSomeModalOpen:r,onModalToggle:i}=e;const{loadStickers:c,toggleStickerSet:d}=(0,l.Sv)(),m=(0,R.Z)(),h=s&&Boolean(s.installedDate),v=Boolean(null==s?void 0:s.stickers),[Z,P,g]=(0,M.Z)();(0,y.Z)((()=>{i(Z)}),[Z,i]);const p=(0,a.Ye)((()=>{if(!s)return[];const e=(s.covers||[]).map((e=>{let{id:t}=e;return t})),t=s.stickers?s.stickers.filter((t=>{let{id:n}=t;return!e.includes(n)})):[];return[...s.covers||[],...t].slice(0,5)}),[s]);(0,a.d4)((()=>{!v&&p.length<5&&c({stickerSetId:t})}),[v,p.length,c,t]);const E=(0,a.I4)((()=>{d({stickerSetId:t})}),[d,t]);if(!s)return;const C=p.length>0;return a.ZP.createElement("div",{key:s.id,className:"sticker-set",dir:m.isRtl?"rtl":void 0},a.ZP.createElement("div",{className:"sticker-set-header"},a.ZP.createElement("div",{className:"title-wrapper"},a.ZP.createElement("h3",{className:"title",dir:"auto"},s.title),a.ZP.createElement("p",{className:"count",dir:"auto"},m("Stickers",s.count,"i"))),a.ZP.createElement(D.Z,{className:h?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:E},m(h?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main"},!C&&a.ZP.createElement(Q.Z,null),C&&p.map((e=>a.ZP.createElement(oa.Z,{sticker:e,size:u.Y7,observeIntersection:n,noAnimate:!o||Z||r,clickArg:void 0,onClick:P,noContextMenu:!0})))),C&&a.ZP.createElement(ra.Z,{isOpen:Z,fromSticker:p[0],onClose:g}))}))),fl=(0,q.P2)((e=>e()),6e4,!0),bl=(0,a.X$)((0,l.c$)((e=>{const t=(0,i.y5)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a}}))((e=>{let{onClose:t,isActive:n,query:s,featuredIds:o,resultIds:r}=e;const{loadFeaturedStickers:i}=(0,l.Sv)(),c=(0,a.sO)(null),d=(0,R.Z)(),[m,u]=(0,a.eJ)(!1),{observe:h}=(0,tn.S1)({rootRef:c,throttleMs:200});return(0,a.d4)((()=>{fl((()=>{i()}))})),(0,A.Z)({isActive:n,onBack:t}),a.ZP.createElement("div",{ref:c,className:"StickerSearch custom-scroll",dir:d.isRtl?"rtl":void 0},function(){if(void 0!==s)return!s&&o?o.map((e=>a.ZP.createElement(Cl,{key:e,stickerSetId:e,observeIntersection:h,isSomeModalOpen:m,onModalToggle:u}))):r?r.length?r.map((e=>a.ZP.createElement(Cl,{key:e,stickerSetId:e,observeIntersection:h,isSomeModalOpen:m,onModalToggle:u}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(_e.Z,null)}())}))),Il=(0,a.X$)((0,l.c$)((e=>{const t=(0,i.yN)(e),{query:n,results:a}=t||{},{chatId:s,threadId:o}=(0,i.Bt)(e)||{},l=s?(0,i.Z1)(e,s):void 0;return{query:n,results:a,chat:l,isChatWithBot:l?(0,i.xo)(e,l):void 0,isSavedMessages:Boolean(s)&&(0,i.FM)(e,s),canPostInChat:Boolean(l)&&Boolean(o)&&(0,r.Qm)(l,o),canScheduleUntilOnline:Boolean(s)&&(0,i.Eh)(e,s)}}))((e=>{let{isActive:t,query:n,results:s,chat:o,isChatWithBot:i,canScheduleUntilOnline:c,isSavedMessages:d,canPostInChat:u,onClose:h}=e;const{searchMoreGifs:v,sendMessage:Z,setGifSearchQuery:P}=(0,l.Sv)(),g=(0,a.sO)(null),[p,E]=(0,to.Z)(c),{observe:C}=(0,tn.S1)({rootRef:g,debounceMs:300}),f=u&&(0,r.H5)(o,i).canSendGifs,b=(0,a.I4)(((e,t,n)=>{f&&(n?p((n=>{Z({gif:e,scheduledAt:n,isSilent:t})})):Z({gif:e,isSilent:t})),m.$b&&P({query:void 0})}),[f,p,Z,P]),I=(0,R.Z)();(0,A.Z)({isActive:t,onBack:h});const y=Boolean(void 0!==n&&s&&s.length);return a.ZP.createElement("div",{className:"GifSearch",dir:I.isRtl?"rtl":void 0},a.ZP.createElement(Xe.Z,{ref:g,className:(0,V.Z)("gif-container custom-scroll",y&&"grid"),items:s,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:v},function(){if(void 0!==n)return s?s.length?s.map((e=>a.ZP.createElement(Yo,{key:e.id,gif:e,observeIntersection:C,onClick:f?b:void 0,isSavedMessages:d}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},I("NoGIFsFound")):a.ZP.createElement(_e.Z,null)}()),E)})));var yl=n(71226);const Sl=[[{name:"followers",title:"ChannelStats.Overview.Followers"},{name:"enabledNotifications",title:"ChannelStats.Overview.EnabledNotifications",isPercentage:!0}],[{name:"viewsPerPost",title:"ChannelStats.Overview.ViewsPerPost"},{name:"sharesPerPost",title:"ChannelStats.Overview.SharesPerPost"}]],Nl=[[{name:"members",title:"Stats.GroupMembers"},{name:"messages",title:"Stats.GroupMessages"}],[{name:"viewers",title:"Stats.GroupViewers"},{name:"posters",title:"Stats.GroupPosters"}]],kl=[[{name:"views",title:"Stats.Message.Views",isPlain:!0},{name:"forwards",title:"Stats.Message.PrivateShares",isPlain:!0,isApproximate:!0}],[{name:"publicForwards",title:"Stats.Message.PublicShares",isPlain:!0}]],wl=(0,a.X$)((e=>{let{isGroup:t,isMessage:n,statistics:s}=e;const o=(0,R.Z)(),{period:l}=s;return a.ZP.createElement("div",{className:"StatisticsOverview"},a.ZP.createElement("div",{className:"StatisticsOverview__header"},a.ZP.createElement("div",{className:"StatisticsOverview__title"},o("StatisticOverview")),l&&a.ZP.createElement("div",{className:"StatisticsOverview__caption"},(0,le.Tu)(o,1e3*l.minDate)," — ",(0,le.Tu)(o,1e3*l.maxDate))),a.ZP.createElement("table",{className:"StatisticsOverview__table"},(n?kl:t?Nl:Sl).map((e=>a.ZP.createElement("tr",null,e.map((e=>{const t=s[e.name];return e.isPlain?a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},e.isApproximate?`≈${(0,Nt.kh)(t)}`:(0,Nt.kh)(t)),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},o(e.title))):e.isPercentage?a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},t.percentage,"%"),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},o(e.title))):a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},(0,Nt.bi)(t.current))," ",(e=>{let{change:t,percentage:n}=e;if(!t)return;const s=Number(t)<0;return a.ZP.createElement("span",{className:(0,V.Z)("StatisticsOverview__value",s&&"negative")},s?`-${(0,Nt.bi)(Math.abs(t))}`:`+${(0,Nt.bi)(t)}`,n&&a.ZP.createElement(a.ZP.Fragment,null," ","(",n,"%)"))})(t),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},o(e.title)))})))))))})),Ml=(0,a.X$)((e=>{let{message:t}=e;const n=(0,R.Z)(),{toggleMessageStatistics:s}=(0,l.Sv)(),o=(0,r.DH)(t),i=(0,L.Z)((0,r.Ti)(t,"micro")),c=Boolean((0,r.Y5)(t)),d=(0,a.I4)((()=>{s({messageId:t.id})}),[s,t.id]);return a.ZP.createElement("div",{className:(0,V.Z)("StatisticsRecentMessage",Boolean(i||o)&&"StatisticsRecentMessage--with-image"),onClick:d},a.ZP.createElement("div",{className:"StatisticsRecentMessage__title"},a.ZP.createElement("div",{className:"StatisticsRecentMessage__summary"},function(e,t,n,s){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:(0,V.Z)("media-preview__image",s&&"round")}),(0,r.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,b.e)(e,t,!0)):(0,b.e)(e,t)}(n,t,i||o,c)),a.ZP.createElement("div",{className:"StatisticsRecentMessage__meta"},n("ChannelStats.ViewsCount",t.views,"i"))),a.ZP.createElement("div",{className:"StatisticsRecentMessage__info"},a.ZP.createElement("div",{className:"StatisticsRecentMessage__date"},(0,le.SA)(1e3*t.date,n.code)),a.ZP.createElement("div",{className:"StatisticsRecentMessage__meta"},t.forwards?n("ChannelStats.SharesCount",t.forwards):"No shares")))}));let Tl,Al;const Rl={growthGraph:"ChannelStats.Graph.Growth",followersGraph:"ChannelStats.Graph.Followers",muteGraph:"ChannelStats.Graph.Notifications",topHoursGraph:"ChannelStats.Graph.ViewsByHours",viewsBySourceGraph:"ChannelStats.Graph.ViewsBySource",newFollowersBySourceGraph:"ChannelStats.Graph.NewFollowersBySource",languagesGraph:"ChannelStats.Graph.Language",interactionsGraph:"ChannelStats.Graph.Interactions"},Ll=Object.keys(Rl),Fl={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},Bl=Object.keys(Fl),xl=(0,a.X$)((0,l.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,i.aT)(e,a),o=(0,i.Z1)(e,a);return{statistics:s,dcId:null==o||null===(n=o.fullInfo)||void 0===n?void 0:n.statisticsDcId,isGroup:"chatTypeSuperGroup"===(null==o?void 0:o.type)}}))((e=>{var t;let{chatId:s,statistics:o,dcId:r,isGroup:i}=e;const c=(0,R.Z)(),d=(0,a.sO)(null),[m,u]=(0,a.eJ)(!1),h=(0,a.sO)([]),{loadStatistics:v,loadStatisticsAsyncGraph:Z}=(0,l.Sv)(),P=(0,N.Z)();(0,a.d4)((()=>{v({chatId:s,isGroup:i})}),[s,v,i]);const g=(0,a.Ye)((()=>i?Bl:Ll),[i]),p=(0,a.Ye)((()=>i?Fl:Rl),[i]);return(0,a.d4)((()=>{o&&g.forEach((e=>{const t=o[e];"string"==typeof t&&Z({name:e,chatId:s,token:t,isPercentage:"languagesGraph"===e})}))}),[g,s,o,Z]),(0,a.d4)((()=>{(async()=>{await async function(){return Tl||(Tl=n.e(8878).then(n.bind(n,18878)),Al=await Tl),Tl}(),m?o&&d.current&&(g.forEach(((e,t)=>{const n=o[e];if("string"==typeof n||h.current.includes(e))return;if(!n)return void h.current.push(e);const{zoomToken:a}=n;Al.create(d.current.children[t],{title:c(p[e]),...a?{onZoom:e=>(0,yl.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:c("Graph.ZoomOut")}:{},...n}),h.current.push(e),d.current.children[t].classList.remove("hidden")})),P()):u(!0)})()}),[g,p,m,o,c,s,Z,r,P]),m&&o?a.ZP.createElement("div",{className:(0,V.Z)("Statistics custom-scroll",m&&"ready")},a.ZP.createElement(wl,{statistics:o,isGroup:i}),!h.current.length&&a.ZP.createElement(_e.Z,null),a.ZP.createElement("div",{ref:d},g.map((e=>a.ZP.createElement("div",{key:e,className:"Statistics__graph hidden"})))),Boolean(null===(t=o.recentTopMessages)||void 0===t?void 0:t.length)&&a.ZP.createElement("div",{className:"Statistics__messages"},a.ZP.createElement("h2",{className:"Statistics__messages-title"},c("ChannelStats.Recent.Header")),o.recentTopMessages.map((e=>a.ZP.createElement(Ml,{message:e}))))):a.ZP.createElement(_e.Z,null)}))),Dl=(0,a.X$)((e=>{let{data:t}=e;const n=(0,R.Z)(),{openChatByUsername:s}=(0,l.Sv)(),o=(0,a.I4)((()=>{s({username:t.chat.username,messageId:t.messageId})}),[t,s]);return a.ZP.createElement("div",{className:"StatisticsPublicForward",onClick:o},a.ZP.createElement(Ae.Z,{size:"medium",chat:t.chat}),a.ZP.createElement("div",{className:"StatisticsPublicForward__info"},a.ZP.createElement("div",{className:"StatisticsPublicForward__title"},t.title),a.ZP.createElement("div",{className:"StatisticsPublicForward__views"},n("ChannelStats.ViewsCount",t.views,"i"))))}));let $l,Ol;const _l={viewsGraph:"Stats.MessageInteractionsTitle"},Ul=Object.keys(_l),Gl=(0,a.X$)((0,l.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,i.Z1)(e,a),o=null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.statisticsDcId;return{statistics:e.statistics.currentMessage,dcId:o,messageId:e.statistics.currentMessageId}}))((e=>{let{chatId:t,isActive:s,statistics:o,dcId:r,messageId:i}=e;const c=(0,R.Z)(),d=(0,a.sO)(null),[m,u]=(0,a.eJ)(!1),h=(0,a.sO)([]),{loadMessageStatistics:v,loadStatisticsAsyncGraph:Z}=(0,l.Sv)(),P=(0,N.Z)();return(0,a.d4)((()=>{i&&v({chatId:t,messageId:i})}),[t,v,i]),(0,a.d4)((()=>{s&&!i||(h.current=[],u(!1))}),[s,i]),(0,a.d4)((()=>{o&&Ul.forEach((e=>{const n=o[e];"string"==typeof n&&Z({name:e,chatId:t,token:n})}))}),[t,o,Z]),(0,a.d4)((()=>{(async()=>{await async function(){return $l||($l=n.e(8878).then(n.bind(n,18878)),Ol=await $l),$l}(),m?o&&d.current&&(Ul.forEach(((e,t)=>{const n=o[e];if("string"==typeof n||h.current.includes(e))return;if(!n)return void h.current.push(e);const{zoomToken:a}=n;Ol.create(d.current.children[t],{title:c(_l[e]),...a?{onZoom:e=>(0,yl.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:c("Graph.ZoomOut")}:{},...n}),h.current.push(e)})),P()):u(!0)})()}),[m,o,c,t,i,Z,r,P]),m&&o&&i?a.ZP.createElement("div",{className:(0,V.Z)("Statistics custom-scroll",m&&"ready")},a.ZP.createElement(wl,{statistics:o,isMessage:!0}),!h.current.length&&a.ZP.createElement(_e.Z,null),a.ZP.createElement("div",{ref:d},Ul.map((e=>a.ZP.createElement("div",{className:(0,V.Z)("Statistics__graph",!h.current.includes(e)&&"hidden")})))),Boolean(o.publicForwards)&&a.ZP.createElement("div",{className:"Statistics__public-forwards"},a.ZP.createElement("h2",{className:"Statistics__public-forwards-title"},c("Stats.Message.PublicShares")),o.publicForwardsData.map((e=>a.ZP.createElement(Dl,{data:e}))))):a.ZP.createElement(_e.Z,null)}))),Xl=(0,a.X$)((0,l.c$)(((e,t)=>{let{answer:n}=t;const{voters:a,offsets:s}=e.pollResults;return{voters:null==a?void 0:a[n.option],offset:(null==s?void 0:s[n.option])||""}}))((e=>{let{chat:t,message:n,answer:s,answerVote:o,totalVoters:r,voters:i,offset:c}=e;const{loadPollOptionResults:d,openChat:m,closePollResults:u}=(0,l.Sv)(),h=(0,B.Z)(o.votersCount),[v,Z]=(0,a.eJ)(!0),P=Boolean(i),{option:g,text:p}=s,E=(0,R.Z)();(0,a.d4)((()=>{P&&h===o.votersCount||d({chat:t,messageId:n.id,option:g,offset:c,limit:4,shouldResetVoters:!0})}),[o.votersCount,P]);const C=(0,a.I4)((()=>{Z(!0),d({chat:t,messageId:n.id,option:g,offset:c,limit:50})}),[t,d,n.id,c,g]);(0,a.d4)((()=>{Z(!1)}),[i]);const f=(0,a.I4)((e=>{m({id:e}),u()}),[u,m]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},i?i.map((e=>a.ZP.createElement(Je.Z,{key:e,className:"chat-item-clickable",onClick:()=>f(e)},a.ZP.createElement(Ve.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(_e.Z,null),i&&function(){const e=o.votersCount-i.length;return o.votersCount>4&&e>0&&a.ZP.createElement(Yn,{count:e,itemName:"voter",isLoading:v,onClick:C})}()),a.ZP.createElement("div",{className:"answer-head",dir:E.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},p),a.ZP.createElement("span",{className:"answer-percent",dir:E.isRtl?"auto":void 0},(b=o.votersCount,(I=r)>0?(b/I*100).toFixed():0),"%")));var b,I}))),Jl=(0,a.X$)((0,l.c$)((e=>{const{pollResults:{chatId:t,messageId:n},lastSyncTime:a}=e;return t&&n?{chat:(0,i.Z1)(e,t),message:(0,i.hj)(e,t,n),lastSyncTime:a}:{}}))((e=>{let{onClose:t,isActive:n,chat:s,message:o,lastSyncTime:l}=e;const i=(0,R.Z)();if((0,A.Z)({isActive:n,onBack:t}),!o||!s)return a.ZP.createElement(_e.Z,null);const{summary:c,results:d}=(0,r.t9)(o);if(!d.results)return;const m=(0,Be.ee)(d.results,"option");return a.ZP.createElement("div",{className:"PollResults",dir:i.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"poll-question",dir:"auto"},(0,Te.Z)(c.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},l&&c.answers.map((e=>a.ZP.createElement(Xl,{key:`${o.id}-${e.option}`,chat:s,message:o,answer:e,answerVote:m[e.option],totalVoters:d.totalVoters}))),!l&&a.ZP.createElement(_e.Z,null)))}))),zl="Please provide first name",Vl=(0,a.X$)((0,l.c$)(((e,t)=>{let{userId:n}=t;const a=(0,i.dy)(e,n),s=(0,i.Z1)(e,n),{progress:o}=e.management;return{user:a,progress:o,isMuted:(0,r.i4)(s,(0,i.dZ)(e),(0,i.NJ)(e))}}))((e=>{let{userId:t,user:n,progress:s,isMuted:r,onClose:i,isActive:c}=e;const{updateContact:d,deleteContact:m,closeManagement:u}=(0,l.Sv)(),[h,v,Z]=(0,M.Z)(),[P,g]=(0,a.eJ)(!1),[p,E]=(0,a.eJ)(),C=(0,R.Z)();(0,A.Z)({isActive:c,onBack:i});const f=n&&n.firstName||"",b=n&&n.lastName||"",[I,y]=(0,a.eJ)(f),[S,N]=(0,a.eJ)(b),[k,w]=(0,a.eJ)(!r);(0,a.d4)((()=>{w(!r)}),[r]),(0,a.d4)((()=>{g(!1),Z()}),[Z,t]),(0,a.d4)((()=>{y(f),N(b)}),[f,b,n]),(0,a.d4)((()=>{s===o.wv.Complete&&(g(!1),E(void 0),Z())}),[Z,s]);const T=(0,a.I4)((e=>{y(e.target.value),g(!0)}),[]),L=(0,a.I4)((e=>{N(e.target.value),g(!0)}),[]),F=(0,a.I4)((e=>{w(e.target.checked),g(!0)}),[]),B=(0,a.I4)((()=>{const e=I.trim(),n=S.trim();e.length||E(zl),d({userId:t,isMuted:!k,firstName:e,lastName:n})}),[I,S,d,t,k]),x=(0,a.I4)((()=>{m({userId:t}),Z(),u()}),[Z,u,m,t]);if(!n)return;const D=s===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ve.Z,{userId:n.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(Ge.Z,{id:"user-first-name",label:C("UserInfo.FirstNamePlaceholder"),onChange:T,value:I,error:p===zl?p:void 0}),a.ZP.createElement(Ge.Z,{id:"user-last-name",label:C("UserInfo.LastNamePlaceholder"),onChange:L,value:S}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(mt.Z,{checked:k,label:C("Notifications"),subLabel:C(k?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:F}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:v},C("DeleteContact")))),a.ZP.createElement(An.Z,{isShown:P,onClick:B,disabled:D,ariaLabel:C("Save")},D?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(tt.Z,{isOpen:h,onClose:Z,text:C("AreYouSureDeleteContact"),confirmLabel:C("DeleteContact"),confirmHandler:x,confirmIsDestructive:!0}))}))),Yl="Group title can't be empty",Hl=(0,a.X$)((0,l.c$)(((e,t)=>{var n,a;let{chatId:s}=t;const o=(0,i.Z1)(e,s),{progress:l}=e.management,c=Boolean(null===(n=o.fullInfo)||void 0===n?void 0:n.linkedChatId),d=(0,r.G9)(o),{invites:m}=e.management.byChatId[s]||{};return{chat:o,progress:l,isBasicGroup:d,hasLinkedChannel:c,canChangeInfo:d?o.isCreator:(0,r.VE)(o,"changeInfo"),canBanUsers:d?o.isCreator:(0,r.VE)(o,"banUsers"),canInvite:d?o.isCreator:(0,r.VE)(o,"inviteUsers"),exportedInvites:m,lastSyncTime:e.lastSyncTime,availableReactionsCount:null===(a=e.availableReactions)||void 0===a?void 0:a.filter((e=>!e.isInactive)).length}}))((e=>{var t,n,i,c,d,m;let{chatId:u,chat:h,progress:v,isBasicGroup:Z,hasLinkedChannel:P,canChangeInfo:g,canBanUsers:p,canInvite:E,onScreenSelect:C,onClose:f,isActive:b,exportedInvites:I,lastSyncTime:y,availableReactionsCount:S}=e;const{togglePreHistoryHidden:N,updateChat:k,deleteChat:w,leaveChannel:T,deleteChannel:F,closeManagement:B,openChat:x,loadExportedChatInvites:D,loadChatJoinRequests:$}=(0,l.Sv)(),[O,_,U]=(0,M.Z)(),G=h.title,X=h.fullInfo&&h.fullInfo.about||"",[J,z]=(0,a.eJ)(!1),[V,Y]=(0,a.eJ)(G||""),[H,q]=(0,a.eJ)(X),[j,K]=(0,a.eJ)(),[W,ee]=(0,a.eJ)(),te=(0,r.RT)(h),ne=(0,L.Z)(te,!1,s.IU.BlobUrl),ae=h.username||P,se=(0,R.Z)();(0,A.Z)({isActive:b,onBack:f}),(0,a.d4)((()=>{y&&E&&(D({chatId:u}),D({chatId:u,isRevoked:!0}),$({chatId:u}))}),[u,D,y,E,$]),(0,a.d4)((()=>{v===o.wv.Complete&&(z(!1),ee(void 0))}),[v]);const oe=(0,a.I4)((()=>{C(o.u1.ChatPrivacyType)}),[C]),le=(0,a.I4)((()=>{C(o.u1.Discussion)}),[C]),re=(0,a.I4)((()=>{C(o.u1.Reactions)}),[C]),ie=(0,a.I4)((()=>{C(o.u1.GroupPermissions)}),[C]),ce=(0,a.I4)((()=>{C(o.u1.ChatAdministrators)}),[C]),de=(0,a.I4)((()=>{C(o.u1.Invites)}),[C]),me=(0,a.I4)((()=>{C(o.u1.JoinRequests)}),[C]),ue=(0,a.I4)((e=>{K(e),z(!0)}),[]),he=(0,a.I4)((e=>{Y(e.target.value),z(!0)}),[]),ve=(0,a.I4)((e=>{q(e.target.value),z(!0)}),[]),Ze=(0,a.I4)((()=>{const e=V.trim(),t=H.trim();e.length?k({chatId:u,title:e,about:t,photo:j}):ee(Yl)}),[H,u,j,V,k]),Pe=(0,a.I4)((()=>{C(o.u1.GroupMembers)}),[C]),ge=(0,a.I4)((()=>{if(!h.fullInfo)return;const{isPreHistoryHidden:e}=h.fullInfo;N({chatId:h.id,isEnabled:!e})}),[h,N]),pe=(null===(t=h.fullInfo)||void 0===t||null===(n=t.enabledReactions)||void 0===n?void 0:n.length)||0,Ee=(0,a.Ye)((()=>{if(!h.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter((e=>!h.defaultBannedRights[e])).length;const{sendStickers:t,sendGifs:n}=h.defaultBannedRights;return t||n||(e+=1),e}),[h]),Ce=(null===(i=h.fullInfo)||void 0===i||null===(c=i.adminMembers)||void 0===c?void 0:c.length)||0,fe=(0,a.I4)((()=>{Z?w({chatId:h.id}):h.isCreator?F({chatId:h.id}):T({chatId:h.id}),U(),B(),x({id:void 0})}),[Z,h.isCreator,h.id,U,B,T,F,w,x]);if(h.isRestricted||h.isForbidden)return;const be=v===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Tn.Z,{currentAvatarBlobUrl:ne,onChange:ue,disabled:!g}),a.ZP.createElement(Ge.Z,{id:"group-title",label:se("GroupName"),onChange:he,value:V,error:W===Yl?W:void 0,disabled:!g}),a.ZP.createElement(Ge.Z,{id:"group-about",className:"mb-2",label:se("DescriptionPlaceholder"),onChange:ve,value:H,disabled:!g}),h.isCreator&&a.ZP.createElement(Je.Z,{icon:"lock",multiline:!0,onClick:oe},a.ZP.createElement("span",{className:"title"},se("GroupType")),a.ZP.createElement("span",{className:"subtitle"},h.username?se("TypePublic"):se("TypePrivate"))),P&&a.ZP.createElement(Je.Z,{icon:"message",multiline:!0,onClick:le},a.ZP.createElement("span",{className:"title"},se("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},se("DiscussionUnlink"))),a.ZP.createElement(Je.Z,{icon:"permissions",multiline:!0,onClick:ie,disabled:!p},a.ZP.createElement("span",{className:"title"},se("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},Ee,"/",8)),a.ZP.createElement(Je.Z,{icon:"heart-outline",multiline:!0,onClick:re,disabled:!g},a.ZP.createElement("span",{className:"title"},se("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},pe,"/",S)),a.ZP.createElement(Je.Z,{icon:"admin",multiline:!0,onClick:ce},a.ZP.createElement("span",{className:"title"},se("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,Nt.kh)(Ce))),E&&a.ZP.createElement(Je.Z,{icon:"link",onClick:de,multiline:!0,disabled:!I},a.ZP.createElement("span",{className:"title"},se("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},I?(0,Nt.kh)(I.length):se("Loading"))),Boolean(null===(d=h.joinRequests)||void 0===d?void 0:d.length)&&a.ZP.createElement(Je.Z,{icon:"add-user-filled",onClick:me,multiline:!0},a.ZP.createElement("span",{className:"title"},se("MemberRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,Nt.kh)(h.joinRequests.length)))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{icon:"group",multiline:!0,onClick:Pe},a.ZP.createElement("span",{className:"title"},se("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,Nt.kh)(null!==(m=h.membersCount)&&void 0!==m?m:0))),!ae&&h.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection"},a.ZP.createElement(mt.Z,{checked:!h.fullInfo.isPreHistoryHidden,label:se("ChatHistory"),onChange:ge,disabled:!p}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:_},se("DeleteMega")))),a.ZP.createElement(An.Z,{isShown:J,onClick:Ze,disabled:be,ariaLabel:se("Save")},be?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(tt.Z,{isOpen:O,onClose:U,textParts:(0,Te.Z)(Z||!h.isCreator?se("AreYouSureDeleteAndExit"):se("AreYouSureDeleteThisChatWithGroup",h.title),["br","simple_markdown"]),confirmLabel:Z||!h.isCreator?se("DeleteMega"):se("DeleteGroupForAll"),confirmHandler:fe,confirmIsDestructive:!0}))}))),ql=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;return{chat:(0,i.Z1)(e,n),currentUserId:e.currentUserId}}))((e=>{let{onScreenSelect:t,onChatMemberSelect:n,chat:s,currentUserId:r,onClose:i,isActive:c}=e;const{updateChatDefaultBannedRights:d}=(0,l.Sv)(),[m,u]=(0,a.eJ)({}),[h,v]=(0,a.eJ)(!1),[Z,P]=(0,a.eJ)(!1),g=(0,R.Z)();(0,A.Z)({isActive:c,onBack:i});const p=(0,a.I4)((()=>{t(o.u1.GroupRemovedUsers)}),[t]),E=(0,a.I4)((()=>{t(o.u1.GroupUserPermissionsCreate)}),[t]),C=(0,a.I4)((e=>{n(e.userId,e.promotedByUserId===r),t(o.u1.GroupUserPermissions)}),[r,n,t]);(0,a.d4)((()=>{u((null==s?void 0:s.defaultBannedRights)||{}),v(!1),setTimeout((()=>{P(!1)}),250)}),[s]);const f=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}u((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),v(!0)}),[]),b=(0,a.I4)((()=>{s&&(P(!0),d({chatId:s.id,bannedRights:m}))}),[s,m,d]),I=(0,a.Ye)((()=>s&&s.fullInfo&&s.fullInfo.kickedMembers?s.fullInfo.kickedMembers.length:0),[s]),y=(0,a.Ye)((()=>s&&s.fullInfo&&s.fullInfo.members?s.fullInfo.members.filter((e=>{let{bannedRights:t}=e;return Boolean(t)})):[]),[s]),S=(0,a.I4)((e=>{const{bannedRights:t}=e;if(!t||!s)return;const{defaultBannedRights:n}=s;return Object.keys(t).reduce(((e,a)=>{if(!t[a]||null!=n&&n[a]||"sendInline"===a||"viewMessages"===a||"sendGames"===a)return e;const s=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(!s)return e;const o=g(s);return`${e}${e.length?`, ${o}`:o}`}),"")}),[s,g]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},g("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"sendMessages",checked:!m.sendMessages,label:g("UserRestrictionsSend"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"sendMedia",checked:!m.sendMedia,label:g("UserRestrictionsSendMedia"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"sendStickers",checked:!m.sendStickers&&!m.sendGifs,label:g("UserRestrictionsSendStickers"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"sendPolls",checked:!m.sendPolls,label:g("UserRestrictionsSendPolls"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"embedLinks",checked:!m.embedLinks,label:g("UserRestrictionsEmbedLinks"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"inviteUsers",checked:!m.inviteUsers,label:g("UserRestrictionsInviteUsers"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"pinMessages",checked:!m.pinMessages,label:g("UserRestrictionsPinMessages"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!m.changeInfo,label:g("UserRestrictionsChangeInfo"),blocking:!0,onChange:f}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:p},a.ZP.createElement("span",{className:"title"},g("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},I))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},g("PrivacyExceptions")),a.ZP.createElement(Je.Z,{icon:"add-user",onClick:E},g("ChannelAddException")),y.map((e=>a.ZP.createElement(Je.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>C(e)},a.ZP.createElement(Ve.Z,{userId:e.userId,status:S(e)})))))),a.ZP.createElement(An.Z,{isShown:h,onClick:b,ariaLabel:g("Save"),disabled:Z},Z?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),jl=(0,a.X$)((0,l.c$)((e=>{const{currentUserId:t}=e;return{currentUserId:t}}))((e=>{var t;let{chat:n,currentUserId:s,isOpen:o,onClose:i}=e;const{loadMoreMembers:c,deleteChatMember:d}=(0,l.Sv)(),m=(0,R.Z)(),[u,h]=(0,a.eJ)(""),v=(0,a.sO)(null),Z=(0,a.Ye)((()=>{var e;const t=((null===(e=n.fullInfo)||void 0===e?void 0:e.members)||[]).reduce(((e,t)=>(t.isAdmin||t.isOwner||t.userId===s||e.push(t.userId),e)),[]),a=(0,l.Rd)().users.byId;return(0,r.kK)(t,a,u)}),[null===(t=n.fullInfo)||void 0===t?void 0:t.members,s,u]),P=(0,a.I4)((e=>{d({chatId:n.id,userId:e}),i()}),[n.id,d,i]);return a.ZP.createElement(Ye,{isOpen:o,chatOrUserIds:Z,filterRef:v,filterPlaceholder:m("ChannelBlockUser"),filter:u,onFilterChange:h,loadMore:c,onSelectChatOrUser:P,onClose:i})}))),Kl=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,i.Z1)(e,n),{byId:s}=e.users;return{chat:a,usersById:s,canDeleteMembers:a&&((0,r.VE)(a,"banUsers")||a.isCreator),isChannel:a&&(0,r.eA)(a)}}))((e=>{let{chat:t,usersById:n,canDeleteMembers:s,isChannel:o,onClose:i,isActive:c}=e;const{updateChatMemberBannedRights:d}=(0,l.Sv)(),m=(0,R.Z)(),[u,h,v]=(0,M.Z)();(0,A.Z)({isActive:c,onBack:i});const Z=(0,a.Ye)((()=>t&&t.fullInfo&&t.fullInfo.kickedMembers?t.fullInfo.kickedMembers:[]),[t]),P=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const t=n[e.kickedByUserId];return t?m("UserRemovedBy",(0,r.Js)(t)):void 0}),[m,n]),g=(0,a.I4)((e=>{if(t)return[{title:m("Unblock"),icon:"delete",destructive:!0,handler:()=>d({chatId:t.id,userId:e.userId,bannedRights:{}})}]}),[m,t,d]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:m.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted"},m(o?"NoBlockedChannel2":"NoBlockedGroup2")),Z.map((e=>a.ZP.createElement(Je.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:g(e)},a.ZP.createElement(Ve.Z,{userId:e.userId,status:P(e)})))),s&&a.ZP.createElement(An.Z,{isShown:!0,onClick:h,ariaLabel:m("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon-add-user-filled"})),t&&s&&a.ZP.createElement(jl,{chat:t,isOpen:u,onClose:v}))))}))),Wl="Channel title can't be empty",Ql=(0,a.X$)((0,l.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,i.Z1)(e,a),{progress:o}=e.management,l=Boolean(null==s?void 0:s.isSignaturesShown),{invites:c}=e.management.byChatId[a]||{};return{chat:s,progress:o,isSignaturesShown:l,canChangeInfo:(0,r.VE)(s,"changeInfo"),canInvite:(0,r.VE)(s,"inviteUsers"),lastSyncTime:e.lastSyncTime,exportedInvites:c,availableReactionsCount:null===(n=e.availableReactions)||void 0===n?void 0:n.filter((e=>!e.isInactive)).length}}))((e=>{var t,n,i,c,d,m,u,h,v;let{chatId:Z,chat:P,progress:g,isSignaturesShown:p,canChangeInfo:E,canInvite:C,exportedInvites:f,lastSyncTime:b,availableReactionsCount:I,onScreenSelect:y,onClose:S,isActive:N}=e;const{updateChat:k,toggleSignatures:w,closeManagement:T,leaveChannel:F,deleteChannel:B,openChat:x,loadExportedChatInvites:D,loadChatJoinRequests:$}=(0,l.Sv)(),O=P&&P.title||"",_=null!=P&&P.fullInfo&&P.fullInfo.about||"",U=null==P||null===(t=P.fullInfo)||void 0===t?void 0:t.linkedChatId,[G,X,J]=(0,M.Z)(),[z,V]=(0,a.eJ)(!1),[Y,H]=(0,a.eJ)(O),[q,j]=(0,a.eJ)(_),[K,W]=(0,a.eJ)(),[ee,te]=(0,a.eJ)(),ne=P&&(0,r.RT)(P),ae=(0,L.Z)(ne,!1,s.IU.BlobUrl),se=(0,R.Z)();(0,A.Z)({isActive:N,onBack:S}),(0,a.d4)((()=>{b&&(D({chatId:Z}),D({chatId:Z,isRevoked:!0}),$({chatId:Z}))}),[Z,D,b,$]),(0,a.d4)((()=>{g===o.wv.Complete&&(V(!1),te(void 0))}),[g]);const oe=(null==P||null===(n=P.fullInfo)||void 0===n||null===(i=n.adminMembers)||void 0===i?void 0:i.length)||0,le=(null==P||null===(c=P.fullInfo)||void 0===c||null===(d=c.kickedMembers)||void 0===d?void 0:d.length)||0,re=(0,a.I4)((()=>{y(o.u1.ChatPrivacyType)}),[y]),ie=(0,a.I4)((()=>{y(o.u1.Discussion)}),[y]),ce=(0,a.I4)((()=>{y(o.u1.Reactions)}),[y]),de=(0,a.I4)((()=>{y(o.u1.ChatAdministrators)}),[y]),me=(0,a.I4)((()=>{y(o.u1.Invites)}),[y]),ue=(0,a.I4)((()=>{y(o.u1.JoinRequests)}),[y]),he=(0,a.I4)((e=>{W(e),V(!0)}),[]),ve=(0,a.I4)((e=>{H(e.target.value),V(!0)}),[]),Ze=(0,a.I4)((e=>{j(e.target.value),V(!0)}),[]),Pe=(0,a.I4)((()=>{const e=Y.trim(),t=q.trim();e.length?k({chatId:Z,title:e,about:t,photo:K}):te(Wl)}),[q,Z,K,Y,k]),ge=(0,a.I4)((()=>{w({chatId:Z,isEnabled:!p})}),[Z,p,w]),pe=(0,a.I4)((()=>{y(o.u1.ChannelSubscribers)}),[y]),Ee=(0,a.I4)((()=>{y(o.u1.ChannelRemovedUsers)}),[y]),Ce=(0,a.I4)((()=>{P.isCreator?B({chatId:P.id}):F({chatId:P.id}),J(),T(),x({id:void 0})}),[P.isCreator,P.id,J,T,F,B,x]),fe=(null===(m=P.fullInfo)||void 0===m||null===(u=m.enabledReactions)||void 0===u?void 0:u.length)||0;if(P.isRestricted||P.isForbidden)return;const be=g===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Tn.Z,{currentAvatarBlobUrl:ae,onChange:he,disabled:!E}),a.ZP.createElement(Ge.Z,{id:"channel-title",label:se("EnterChannelName"),onChange:ve,value:Y,error:ee===Wl?ee:void 0,disabled:!E}),a.ZP.createElement(Ge.Z,{id:"channel-about",className:"mb-2",label:se("DescriptionPlaceholder"),onChange:Ze,value:q,disabled:!E}),P.isCreator&&a.ZP.createElement(Je.Z,{icon:"lock",multiline:!0,onClick:re},a.ZP.createElement("span",{className:"title"},se("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},P.username?se("TypePublic"):se("TypePrivate"))),a.ZP.createElement(Je.Z,{icon:"message",multiline:!0,onClick:ie,disabled:!E},a.ZP.createElement("span",{className:"title"},se("Discussion")),a.ZP.createElement("span",{className:"subtitle"},se(U?"DiscussionUnlink":"Add"))),C&&a.ZP.createElement(Je.Z,{icon:"link",onClick:me,multiline:!0,disabled:!f},a.ZP.createElement("span",{className:"title"},se("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},f?(0,Nt.kh)(f.length):se("Loading"))),Boolean(null===(h=P.joinRequests)||void 0===h?void 0:h.length)&&a.ZP.createElement(Je.Z,{icon:"add-user-filled",onClick:ue,multiline:!0},a.ZP.createElement("span",{className:"title"},se("SubscribeRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,Nt.kh)(P.joinRequests.length))),a.ZP.createElement(Je.Z,{icon:"heart-outline",multiline:!0,onClick:ce,disabled:!E},a.ZP.createElement("span",{className:"title"},se("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},fe,"/",I)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(mt.Z,{checked:p,label:se("ChannelSignMessages"),onChange:ge}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{icon:"admin",multiline:!0,onClick:de},a.ZP.createElement("span",{className:"title"},se("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},oe)),a.ZP.createElement(Je.Z,{icon:"group",multiline:!0,onClick:pe},a.ZP.createElement("span",{className:"title",dir:"auto"},se("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},se("Subscribers",null!==(v=P.membersCount)&&void 0!==v?v:0,"i"))),a.ZP.createElement(Je.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:Ee},a.ZP.createElement("span",{className:"title"},se("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},le))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:X},P.isCreator?se("ChannelDelete"):se("LeaveChannel")))),a.ZP.createElement(An.Z,{isShown:z,onClick:Pe,disabled:be,ariaLabel:se("Save")},be?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(tt.Z,{isOpen:G,onClose:J,text:P.isCreator?se("ChannelDeleteAlert"):se("ChannelLeaveAlert"),confirmLabel:P.isCreator?se("ChannelDelete"):se("LeaveChannel"),confirmHandler:Ce,confirmIsDestructive:!0}))})));var er=n(10088);const tr=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,i.Z1)(e,n),{isUsernameAvailable:s}=(0,i.aW)(e,n);return{chat:a,isChannel:(0,r.eA)(a),progress:e.management.progress,isUsernameAvailable:s,isProtected:null==a?void 0:a.isProtected}}))((e=>{var t;let{chat:n,onClose:s,isActive:r,isChannel:i,progress:c,isUsernameAvailable:d,isProtected:m}=e;const{checkPublicLink:u,updatePublicLink:h,updatePrivateLink:v,toggleIsProtected:Z}=(0,l.Sv)(),P=Boolean(n.username),g=null===(t=n.fullInfo)||void 0===t?void 0:t.inviteLink,[p,E]=(0,a.eJ)(P?"public":"private"),[C,f]=(0,a.eJ)(),[b,I,y]=(0,M.Z)(),S=Boolean("public"===p&&C&&d||"private"===p&&P);(0,A.Z)({isActive:r,onBack:s}),(0,a.d4)((()=>{p&&!g&&v()}),[p,g,v]);const N=(0,a.I4)((e=>{E(e)}),[]),k=(0,a.I4)((e=>{Z({chatId:n.id,isProtected:"protected"===e})}),[n.id,Z]),w=(0,a.I4)((()=>{h({username:"public"===p?C:""})}),[p,h,C]),T=(0,a.I4)((()=>{y(),v()}),[y,v]),L=(0,R.Z)(),F=i?"Channel":"Mega",B=i?"Channel":"Group",x=[{value:"private",label:L(`${F}Private`),subLabel:L(`${F}PrivateInfo`)},{value:"public",label:L(`${F}Public`),subLabel:L(`${F}PublicInfo`)}],D=[{value:"allowed",label:L("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:L("ChannelVisibility.Forwarding.Disabled")}],$=c===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:L.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},L(`${B}Type`)),a.ZP.createElement(ta.Z,{selected:p,name:"channel-type",options:x,onChange:N})),"private"===p?a.ZP.createElement("div",{className:"section",dir:L.isRtl?"rtl":void 0},g?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(er.Z,{url:g,className:"group-link",text:g}),a.ZP.createElement("p",{className:"section-info",dir:L.isRtl?"rtl":void 0},L(`${F}PrivateLinkHelp`)),a.ZP.createElement(Je.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:I},L("RevokeLink")),a.ZP.createElement(tt.Z,{isOpen:b,onClose:y,text:L("RevokeAlert"),confirmLabel:L("RevokeButton"),confirmHandler:T,confirmIsDestructive:!0})):a.ZP.createElement(_e.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(xn,{asLink:!0,currentUsername:n.username,isLoading:$,isUsernameAvailable:d,checkUsername:u,onChange:f}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},L(`${B}.Username.CreatePublicLinkHelp`))),a.ZP.createElement("div",{className:"section",dir:L.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},L(i?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")),a.ZP.createElement(ta.Z,{selected:m?"protected":"allowed",name:"forwarding-type",options:D,onChange:k}),a.ZP.createElement("p",{className:"section-info"},L(i?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")))),a.ZP.createElement(An.Z,{isShown:S,disabled:$,ariaLabel:L("Save"),onClick:w},$?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),nr=(0,a.X$)((0,l.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,i.Z1)(e,a),{forDiscussionIds:o,byId:l}=e.chats;return{chat:s,chatsByIds:l,forDiscussionIds:o,linkedChat:null!=s&&null!==(n=s.fullInfo)&&void 0!==n&&n.linkedChatId?(0,i.Z1)(e,s.fullInfo.linkedChatId):void 0,isChannel:s&&(0,r.eA)(s)}}))((e=>{let{chat:t,onClose:n,isActive:s,chatId:r,chatsByIds:i,linkedChat:c,forDiscussionIds:d,isChannel:m,onScreenSelect:h}=e;const{loadGroupsForDiscussion:v,linkDiscussionGroup:Z,unlinkDiscussionGroup:P}=(0,l.Sv)(),[g,p]=(0,a.eJ)(),[E,C,f]=(0,M.Z)(),[b,I,y]=(0,M.Z)(),S=(0,R.Z)(),N=null==c?void 0:c.id;(0,A.Z)({isActive:s,onBack:n}),(0,a.d4)((()=>{v()}),[v]);const k=(0,a.I4)((()=>{f(),P({channelId:m?r:N}),m||h(o.u1.Initial)}),[f,P,m,r,N,h]),w=(0,a.I4)((()=>{y(),Z({channelId:r,chatId:g})}),[y,Z,r,g]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xn.Z,{tgsUrl:Mt.l.DiscussionGroups,size:u.bM,className:"section-icon"}),c&&a.ZP.createElement("div",null,a.ZP.createElement(Je.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(ze.Z,{chatId:c.id})),a.ZP.createElement(Je.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:C},S(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(tt.Z,{isOpen:E,onClose:f,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(Ae.Z,{size:"tiny",chat:c}),a.ZP.createElement("div",{className:"modal-title"},S(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,Te.Z)(S(m?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",c.title),["br","simple_markdown"]),confirmLabel:S(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:k,confirmIsDestructive:!0})),!c&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},S("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Je.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},S("DiscussionCreateGroup")),d?d.map(((e,t)=>a.ZP.createElement(Je.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{p(e),I()}},a.ZP.createElement(ze.Z,{chatId:e})))):a.ZP.createElement(Yt.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},S("DiscussionChannelHelp2")),a.ZP.createElement(tt.Z,{isOpen:b,onClose:y,header:function(){const e=i[g];if(e)return a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(Ae.Z,{size:"tiny",chat:e}),a.ZP.createElement("div",{className:"modal-title"},S("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const e=i[g];if(e)return e.hasPrivateLink?(0,Te.Z)(`Do you want to make **${e.title}** the discussion board for **${t.title}**?`,["br","simple_markdown"]):(0,Te.Z)(`Do you want to make **${e.title}** the discussion board for **${t.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"])}(),confirmLabel:S("DiscussionLinkGroup"),confirmHandler:w,isButtonsInOneRow:!0})))))}))),ar=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n,isPromotedByCurrentUser:a}=t;const s=(0,i.Z1)(e,n);return{chat:s,isFormFullyDisabled:!(s.isCreator||a)}}))((e=>{let{chat:t,selectedChatMemberId:n,onScreenSelect:s,isFormFullyDisabled:r,onClose:i,isActive:c}=e;const{updateChatMemberBannedRights:d}=(0,l.Sv)(),[m,u]=(0,a.eJ)({}),[h,v]=(0,a.eJ)(!1),[Z,P]=(0,a.eJ)(!1),[g,p,E]=(0,M.Z)(),C=(0,R.Z)();(0,A.Z)({isActive:c,onBack:i});const f=(0,a.Ye)((()=>{if(t&&t.fullInfo&&t.fullInfo.members)return t.fullInfo.members.find((e=>{let{userId:t}=e;return t===n}))}),[t,n]);(0,a.d4)((()=>{null!=t&&t.fullInfo&&n&&!f&&s(o.u1.GroupPermissions)}),[t,s,f,n]),(0,a.d4)((()=>{u((null==f?void 0:f.bannedRights)||(null==t?void 0:t.defaultBannedRights)||{}),v(!1),P(!1)}),[t,f]);const b=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}u((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),v(!0)}),[]),I=(0,a.I4)((()=>{t&&n&&(P(!0),d({chatId:t.id,userId:n,bannedRights:m}))}),[t,n,m,d]),y=(0,a.I4)((()=>{t&&n&&d({chatId:t.id,userId:n,bannedRights:{viewMessages:!0}})}),[t,n,d]),S=(0,a.I4)((e=>!!r||!(!t||!t.defaultBannedRights)&&t.defaultBannedRights[e]),[t,r]);if(f)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ve.Z,{userId:f.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},C("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"sendMessages",checked:!m.sendMessages,label:C("UserRestrictionsSend"),blocking:!0,disabled:S("sendMessages"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"sendMedia",checked:!m.sendMedia,label:C("UserRestrictionsSendMedia"),blocking:!0,disabled:S("sendMedia"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"sendStickers",checked:!m.sendStickers&&!m.sendGifs,label:C("UserRestrictionsSendStickers"),blocking:!0,disabled:S("sendStickers"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"sendPolls",checked:!m.sendPolls,label:C("UserRestrictionsSendPolls"),blocking:!0,disabled:S("sendPolls"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"embedLinks",checked:!m.embedLinks,label:C("UserRestrictionsEmbedLinks"),blocking:!0,disabled:S("embedLinks"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"inviteUsers",checked:!m.inviteUsers,label:C("UserRestrictionsInviteUsers"),blocking:!0,disabled:S("inviteUsers"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"pinMessages",checked:!m.pinMessages,label:C("UserRestrictionsPinMessages"),blocking:!0,disabled:S("pinMessages"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!m.changeInfo,label:C("UserRestrictionsChangeInfo"),blocking:!0,disabled:S("changeInfo"),onChange:b}))),!r&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:p},C("UserRestrictionsBlock")))),a.ZP.createElement(An.Z,{isShown:h,onClick:I,ariaLabel:C("Save"),disabled:Z},Z?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(tt.Z,{isOpen:g,onClose:E,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:y,confirmIsDestructive:!0}))}))),sr=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,i.Z1)(e,n);return{chat:a,currentUserId:e.currentUserId,isChannel:(0,r.eA)(a)}}))((e=>{let{chat:t,isChannel:n,currentUserId:s,onScreenSelect:i,onChatMemberSelect:c,onClose:d,isActive:m}=e;const u=(0,R.Z)();(0,A.Z)({isActive:m,onBack:d});const h=(0,a.I4)((()=>{i(o.u1.GroupRecentActions)}),[i]),v=(0,a.Ye)((()=>t.fullInfo&&t.fullInfo.adminMembers?t.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[t]),Z=(0,a.I4)((e=>{c(e.userId,e.promotedByUserId===s),i(o.u1.ChatAdminRights)}),[s,c,i]),P=(0,a.I4)((()=>{i(o.u1.GroupAddAdmins)}),[i]),g=(0,a.I4)((e=>{if(e.isOwner)return u("ChannelCreator");const t=(0,l.Rd)().users.byId,n=e.promotedByUserId?t[e.promotedByUserId]:void 0;return n?u("EditAdminPromotedBy",(0,r.Js)(n)):u("ChannelAdmin")}),[u]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{icon:"recent",multiline:!0,onClick:h},a.ZP.createElement("span",{className:"title"},u("EventLog")),a.ZP.createElement("span",{className:"subtitle"},u(n?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:u.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},n?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),v.map((e=>a.ZP.createElement(Je.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>Z(e)},a.ZP.createElement(Ve.Z,{userId:e.userId,status:g(e),forceShowSelf:!0})))),a.ZP.createElement(An.Z,{isShown:!0,onClick:P,ariaLabel:u("Channel.Management.AddModerator")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))))}))),or=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;return{chat:(0,i.Z1)(e,n)}}))((e=>{let{chat:t,onClose:n,isActive:s}=e;const o=(0,R.Z)();(0,A.Z)({isActive:s,onBack:n});const l=(0,a.Ye)((()=>t&&t.fullInfo&&t.fullInfo.adminMembers?t.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[t]),r=(0,a.I4)((e=>e.isOwner?o("ChannelCreator"):o("ChannelAdmin")),[o]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section not-implemented",dir:o.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},"Actions"),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!0,label:o("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!0,label:o("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!0,label:o("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!0,label:o("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!0,label:o("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!0,label:o("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!0,label:o("EventLogFilterLeavingMembers"),onChange:void 0}))),a.ZP.createElement("div",{className:"section not-implemented",dir:o.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},o("Channel.Management.Title")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:!0,label:o("EventLogAllAdmins"),onChange:void 0})),l.map((e=>a.ZP.createElement(Je.Z,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},a.ZP.createElement(mt.Z,{label:"",checked:!0}),a.ZP.createElement(Ve.Z,{userId:e.userId,status:r(e),forceShowSelf:!0})))))))}))),lr=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n,isPromotedByCurrentUser:a}=t;const s=(0,i.Z1)(e,n),{byId:o}=e.users,{currentUserId:l}=e;return{chat:s,usersById:o,currentUserId:l,isChannel:(0,r.eA)(s),isFormFullyDisabled:!(s.isCreator||a),defaultRights:s.adminRights}}))((e=>{var t;let{isNewAdmin:n,selectedUserId:s,defaultRights:i,onScreenSelect:c,chat:d,usersById:m,currentUserId:u,isChannel:h,isFormFullyDisabled:v,onClose:Z,isActive:P}=e;const{updateChatAdmin:g}=(0,l.Sv)(),[p,E]=(0,a.eJ)({}),[C,f]=(0,a.eJ)(Boolean(n)),[b,I]=(0,a.eJ)(!1),[y,S,N]=(0,M.Z)(),[k,w]=(0,a.eJ)(""),T=(0,R.Z)();(0,A.Z)({isActive:P,onBack:Z});const L=(0,a.Ye)((()=>{var e,t;const a=null===(e=d.fullInfo)||void 0===e||null===(t=e.adminMembers)||void 0===t?void 0:t.find((e=>{let{userId:t}=e;return t===s}));if(!n||!a&&s){if(n){const e=(0,l.Rd)().users.byId[s];return e?{userId:e.id,adminRights:i,customTitle:T("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return a}}),[null===(t=d.fullInfo)||void 0===t?void 0:t.adminMembers,i,n,T,s]);(0,a.d4)((()=>{null!=d&&d.fullInfo&&s&&!L&&c(o.u1.ChatAdministrators)}),[d,c,L,s]),(0,a.d4)((()=>{E((null==L?void 0:L.adminRights)||{}),w(((null==L?void 0:L.customTitle)||"").substr(0,16)),f(Boolean(n)),I(!1)}),[i,n,L]);const F=(0,a.I4)((e=>{const{name:t}=e.target;E((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),f(!0)}),[]),B=(0,a.I4)((()=>{s&&(I(!0),g({chatId:d.id,userId:s,adminRights:p,customTitle:k}))}),[s,g,d.id,p,k]),x=(0,a.I4)((()=>{s&&(g({chatId:d.id,userId:s,adminRights:{}}),N())}),[d.id,N,s,g]),D=(0,a.I4)((e=>!((0,r.G9)(d)||!v&&d.adminRights&&d.adminRights[e])),[d,v]),$=(0,a.Ye)((()=>{if(n||!L)return;if(L.isOwner)return T("ChannelCreator");const e=L.promotedByUserId?m[L.promotedByUserId]:void 0;return e?T("EditAdminPromotedBy",(0,r.Js)(e)):T("ChannelAdmin")}),[n,L,m,T]),O=(0,a.I4)((e=>{const{value:t}=e.target;w(t),f(!0)}),[]);if(L)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Je.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ve.Z,{userId:L.userId,status:$,forceShowSelf:!0})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},T("EditAdminWhatCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"changeInfo",checked:Boolean(p.changeInfo),label:T(h?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:D("changeInfo"),onChange:F})),h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"postMessages",checked:Boolean(p.postMessages),label:T("EditAdminPostMessages"),blocking:!0,disabled:D("postMessages"),onChange:F})),h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"editMessages",checked:Boolean(p.editMessages),label:T("EditAdminEditMessages"),blocking:!0,disabled:D("editMessages"),onChange:F})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"deleteMessages",checked:Boolean(p.deleteMessages),label:T(h?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:D("deleteMessages"),onChange:F})),!h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"banUsers",checked:Boolean(p.banUsers),label:T("EditAdminBanUsers"),blocking:!0,disabled:D("banUsers"),onChange:F})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"inviteUsers",checked:Boolean(p.inviteUsers),label:T("EditAdminAddUsers"),blocking:!0,disabled:D("inviteUsers"),onChange:F})),!h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"pinMessages",checked:Boolean(p.pinMessages),label:T("EditAdminPinMessages"),blocking:!0,disabled:D("pinMessages"),onChange:F})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"addAdmins",checked:Boolean(p.addAdmins),label:T("EditAdminAddAdmins"),blocking:!0,disabled:D("addAdmins"),onChange:F})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"manageCall",checked:Boolean(p.manageCall),label:T("StartVoipChatPermission"),blocking:!0,disabled:D("manageCall"),onChange:F})),!h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"anonymous",checked:Boolean(p.anonymous),label:T("EditAdminSendAnonymously"),blocking:!0,disabled:D("anonymous"),onChange:F})),v&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},T("Channel.EditAdmin.CannotEdit")),!h&&a.ZP.createElement(Ge.Z,{id:"admin-title",label:T("EditAdminRank"),onChange:O,value:k,disabled:v,maxLength:16}),u!==s&&!v&&!n&&a.ZP.createElement(Je.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:S},T("EditAdminRemoveAdmin")))),a.ZP.createElement(An.Z,{isShown:C,onClick:B,ariaLabel:T("Save"),disabled:b},b?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),!n&&a.ZP.createElement(tt.Z,{isOpen:y,onClose:N,text:"Are you sure you want to dismiss this admin?",confirmLabel:T("Channel.Admin.Dismiss"),confirmHandler:x,confirmIsDestructive:!0}))}))),rr=(0,a.X$)((0,l.c$)(((e,t)=>{var n,a;let{chatId:s}=t;const o=(0,i.Z1)(e,s),{statusesById:l}=e.users,c=null==o||null===(n=o.fullInfo)||void 0===n?void 0:n.members,d=null==o||null===(a=o.fullInfo)||void 0===a?void 0:a.adminMembers,m=o&&(0,r.eA)(o),{userIds:u}=e.contactList||{},{query:h,fetchingStatus:v,globalUserIds:Z,localUserIds:P}=e.userSearch;return{members:c,adminMembers:d,userStatusesById:l,isChannel:m,localContactIds:u,searchQuery:h,isSearching:v,globalUserIds:Z,localUserIds:P,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{noAdmins:t,members:n,adminMembers:s,userStatusesById:i,isChannel:c,isActive:d,globalUserIds:m,localContactIds:u,localUserIds:h,isSearching:v,searchQuery:Z,serverTimeOffset:P,onClose:g,onScreenSelect:p,onChatMemberSelect:E}=e;const{openChat:C,setUserSearchQuery:f,closeManagement:b}=(0,l.Sv)(),I=(0,R.Z)(),y=(0,a.sO)(null),S=(0,a.sO)(null),N=(0,a.Ye)((()=>t&&(null==s?void 0:s.map((e=>{let{userId:t}=e;return t})))||[]),[s,t]),k=(0,a.Ye)((()=>{const e=(0,l.Rd)().users.byId;if(!n||!e)return[];const a=(0,r.Z0)(n.map((e=>{let{userId:t}=e;return t})),e,i,void 0,P);return t?a.filter((e=>!N.includes(e))):a}),[n,i,P,t,N]),w=(0,a.Ye)((()=>{const e=(0,l.Rd)().users.byId,n=(0,l.Rd)().chats.byId,a=Boolean(Z),s=a?u?(0,r.kK)(u,e,Z):[]:k;return(0,r.ih)((0,Be.Tw)([...s,...a&&h||[],...a&&m||[]]).filter((n=>{const a=e[n];return!a||(c||a.canBeInvitedToGroup||!(0,r.cS)(a))&&(!t||!N.includes(n))})),n,!0)}),[k,u,Z,h,m,c,t,N]),[M,T]=(0,De.Z)(void 0,w,Boolean(Z)),L=(0,a.I4)((e=>{t?(E(e,!1),p(o.u1.ChatNewAdminRights)):(b(),C({id:e}))}),[b,t,E,p,C]),F=(0,a.I4)((e=>{f({query:e.target.value})}),[f]),B=(0,$e.Z)(S,d,(e=>{M&&M.length>0&&L(M[-1===e?0:e])}),".ListItem-button",!0);return(0,A.Z)({isActive:d,onBack:g}),a.ZP.createElement("div",{className:"Management"},t&&a.ZP.createElement("div",{className:"Management__filter",dir:I.isRtl?"rtl":void 0},a.ZP.createElement(Ge.Z,{ref:y,value:Z,onChange:F,placeholder:I("Search")})),a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},null!=M&&M.length?a.ZP.createElement(Xe.Z,{className:"picker-list custom-scroll",items:w,onLoadMore:T,noScrollRestore:Boolean(Z),ref:S,onKeyDown:B},M.map((e=>a.ZP.createElement(Je.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>L(e)},a.ZP.createElement(Ve.Z,{userId:e,forceShowSelf:!0}))))):v||!M||M.length?a.ZP.createElement(_e.Z,null):a.ZP.createElement(Yt.Z,{teactOrderKey:0,key:"nothing-found",text:c?"No subscribers found":"No members found"}))))}))),ir=(0,a.X$)((0,l.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,i.Z1)(e,a),{byId:o,statusesById:l}=e.users;return{members:null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.members,usersById:o,userStatusesById:l,isChannel:s&&(0,r.eA)(s),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{usersById:t,userStatusesById:n,members:s,isChannel:l,onScreenSelect:i,onChatMemberSelect:c,onClose:d,isActive:m,serverTimeOffset:u}=e;(0,A.Z)({isActive:m,onBack:d});const h=(0,a.Ye)((()=>{if(s&&t)return(0,r.Z0)(s.filter((e=>!e.isOwner)).map((e=>{let{userId:t}=e;return t})),t,n,void 0,u)}),[s,u,t,n]),v=(0,a.I4)((e=>{c(e),i(o.u1.GroupUserPermissions)}),[c,i]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},h?h.map(((e,t)=>a.ZP.createElement(Je.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>v(e)},a.ZP.createElement(Ve.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(Yt.Z,{teactOrderKey:0,key:"nothing-found",text:l?"No subscribers found":"No members found"}))))})));var cr=n(82267);function dr(e,t){const{isPermanent:n,usage:a=0,date:s}=e,{isPermanent:o,usage:l=0,date:r}=t;return n||o?Number(n)-Number(o):a||l?l-a:r-s}const mr=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const{invites:a,revokedInvites:s}=e.management.byChatId[n],o=(0,i.Z1)(e,n),l=o&&(0,r.eA)(o);return{exportedInvites:a,revokedExportedInvites:s,chat:o,serverTimeOffset:e.serverTimeOffset,isChannel:l}}))((e=>{let{chatId:t,chat:n,exportedInvites:s,revokedExportedInvites:r,isActive:i,isChannel:c,serverTimeOffset:d,onClose:h,onScreenSelect:v}=e;const{setEditingExportedInvite:Z,showNotification:P,editExportedChatInvite:g,deleteExportedChatInvite:p,deleteRevokedExportedChatInvites:E,setOpenedInviteInfo:C}=(0,l.Sv)(),f=(0,R.Z)(),[b,I,y]=(0,M.Z)(),[S,k,w]=(0,M.Z)(),[T,L]=(0,a.eJ)(),[F,B,x]=(0,M.Z)(),[$,O]=(0,a.eJ)();(0,A.Z)({isActive:i,onBack:h});const G=(0,a.Ye)((()=>{if(s)return s.some((e=>{let{expireDate:t}=e;return t&&t-(0,cr.b)(d)<le.xR/1e3}))}),[s,d]),X=(0,N.Z)();(0,vt.Z)((()=>{X()}),G?1e3:void 0);const J=null==s?void 0:s.find((e=>{let{isPermanent:t}=e;return t})),z=null!=n&&n.username?`t.me/${n.username}`:null==J?void 0:J.link,V=(0,a.Ye)((()=>{const e=null!=n&&n.username?s:null==s?void 0:s.filter((e=>{let{isPermanent:t}=e;return!t}));return null==e?void 0:e.sort(dr)}),[null==n?void 0:n.username,s]),Y=(0,a.I4)((e=>{const{link:n,title:a,isRequestNeeded:s,expireDate:o,usageLimit:l}=e;g({chatId:t,link:n,title:a,isRequestNeeded:s,expireDate:o,usageLimit:l,isRevoked:!0})}),[t,g]),H=(0,a.I4)((e=>{L(e),k()}),[k]),q=(0,a.I4)((()=>{T&&(Y(T),L(void 0),w())}),[w,Y,T]),j=(0,a.I4)((()=>{v(o.u1.EditInvite)}),[v]),K=(0,a.I4)((()=>{J&&H(J)}),[H,J]),W=(0,a.I4)((()=>{E({chatId:t}),y()}),[t,y,E]),Q=(0,a.I4)((e=>{C({chatId:t,invite:e}),v(o.u1.InviteInfo)}),[t,v,C]),ee=(0,a.I4)((e=>{p({chatId:t,link:e.link})}),[t,p]),te=(0,a.I4)((e=>{O(e),B()}),[B]),ne=(0,a.I4)((()=>{$&&(ee($),O(void 0),x())}),[x,ee,$]),ae=(0,a.I4)((e=>{(0,Fs.TE)(e),P({message:f("LinkCopied")})}),[f,P]),se=(0,a.I4)((()=>{ae(z)}),[ae,z]),oe=e=>{const{usage:t=0,usageLimit:n,expireDate:a,isPermanent:s,requested:o,isRevoked:l}=e;let r="";if(r=!l&&n&&t<n?f("CanJoin",n-t):t?f("PeopleJoined",t):f("NoOneJoined"),l)return r+=` • ${f("Revoked")}`,r;if(o&&(r+=` • ${f("JoinRequests",o)}`),void 0!==n&&t===n)r+=` • ${f("LinkLimitReached")}`;else if(a){const e=1e3*(a-(0,cr.b)(d));r+=" • ",r+=e>0?f("InviteLink.ExpiresIn",(0,le.D)(f,e)):f("InviteLink.Expired")}else s&&(r+=` • ${f("Permanent")}`);return r},re=e=>{const n=[];return n.push({title:f("Copy"),icon:"copy",handler:()=>ae(e.link)}),e.isPermanent||e.isRevoked||n.push({title:f("Edit"),icon:"edit",handler:()=>(e=>{Z({chatId:t,invite:e}),v(o.u1.EditInvite)})(e)}),e.isRevoked?n.push({title:f("DeleteLink"),icon:"delete",handler:()=>te(e),destructive:!0}):n.push({title:f("RevokeButton"),icon:"delete",handler:()=>H(e),destructive:!0}),n},ie=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(D.Z,{round:!0,ripple:!m.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"Actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]);return a.ZP.createElement("div",{className:"Management ManageInvites"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xn.Z,{tgsUrl:Mt.l.Invite,size:u.jV,className:"section-icon"}),a.ZP.createElement("p",{className:"text-muted"},f(c?"PrimaryLinkHelpChannel":"PrimaryLinkHelp"))),z&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",{className:"text-muted"},null!=n&&n.username?f("PublicLink"):f("lng_create_permanent_link_title")),a.ZP.createElement("div",{className:"primary-link"},a.ZP.createElement("input",{className:"form-control primary-link-input",value:z,readOnly:!0,onClick:se}),a.ZP.createElement(_.Z,{className:"primary-link-more-menu",trigger:ie,positionX:"right"},a.ZP.createElement(U.Z,{icon:"copy",onClick:se},f("Copy")),!(null!=n&&n.username)&&a.ZP.createElement(U.Z,{icon:"delete",onClick:K,destructive:!0},f("RevokeButton")))),a.ZP.createElement(D.Z,{onClick:se},f("CopyLink"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement(D.Z,{isText:!0,key:"create",className:"create-link",onClick:j},f("CreateNewLink")),(!V||!V.length)&&a.ZP.createElement(Yt.Z,{text:"No links found",key:"nothing"}),null==V?void 0:V.map((e=>a.ZP.createElement(Je.Z,{icon:"link",secondaryIcon:"more",multiline:!0,onClick:()=>Q(e),contextActions:re(e),key:e.link},a.ZP.createElement("span",{className:"title invite-title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},oe(e))))),a.ZP.createElement("p",{className:"text-muted hint",key:"links-hint"},f("ManageLinksInfoHelp"))),r&&Boolean(r.length)&&a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{className:"text-muted",key:"title"},f("RevokedLinks")),a.ZP.createElement(Je.Z,{icon:"delete",destructive:!0,key:"delete",onClick:I},a.ZP.createElement("span",{className:"title"},f("DeleteAllRevokedLinks"))),null==r?void 0:r.map((e=>a.ZP.createElement(Je.Z,{icon:"link",secondaryIcon:"more",multiline:!0,onClick:()=>Q(e),contextActions:re(e),key:e.link},a.ZP.createElement("span",{className:"title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},oe(e))))))),a.ZP.createElement(tt.Z,{isOpen:b,onClose:y,title:f("DeleteAllRevokedLinks"),text:f("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:f("DeleteAll"),confirmHandler:W}),a.ZP.createElement(tt.Z,{isOpen:S,onClose:w,title:f("RevokeLink"),text:f("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:f("RevokeButton"),confirmHandler:q}),a.ZP.createElement(tt.Z,{isOpen:F,onClose:x,title:f("DeleteLink"),text:f("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:f("Delete"),confirmHandler:ne}))}))),ur=[1,10,100],hr={hour:36e5,day:864e5,week:6048e5},vr=hr.hour,Zr=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const{editingInvite:a}=e.management.byChatId[n];return{editingInvite:a,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{chatId:t,editingInvite:n,isActive:s,serverTimeOffset:r,onClose:i,onScreenSelect:c}=e;const{editExportedChatInvite:d,exportChatInvite:m}=(0,l.Sv)(),u=(0,R.Z)(),[h,v,Z]=(0,M.Z)(),[P,g]=(0,a.eJ)(!1),[p,E]=(0,a.eJ)(""),[C,f]=(0,a.eJ)(Date.now()+vr),[b,I]=(0,a.eJ)("unlimited"),[S,N]=(0,a.eJ)(10),[k,w]=(0,a.eJ)("0"),[T,L]=(0,a.eJ)(!1);(0,A.Z)({isActive:s,onBack:i}),(0,y.Z)((e=>{let[t]=e;if(t!==n)if(n){const{title:e,usageLimit:t,expireDate:a,isRequestNeeded:s}=n;if(e&&E(e),t&&(w(ur.includes(t)?t.toString():"custom"),N(t)),a){const e=(0,cr.b)(r)+vr;I("custom"),f(1e3*Math.max(a,e))}s&&g(!0)}else E(""),I("unlimited"),w("0"),f(1e3*(0,cr.b)(r)+vr),N(10),g(!1)}),[n,r]);const F=(0,a.I4)((e=>{g(e.target.checked)}),[]),B=(0,a.I4)((e=>{E(e.target.value)}),[]),x=(0,a.I4)((e=>{N(Number.parseInt(e.target.value,10))}),[]),$=(0,a.I4)((e=>{f(e.getTime()),Z()}),[Z]),O=(0,a.I4)((()=>{L(!0);const e="custom"===k?S:k;let a;switch(b){case"custom":a=(0,cr.b)(r)+(C-Date.now())/1e3;break;case"hour":case"day":case"week":a=(0,cr.b)(r)+hr[b]/1e3;break;case"unlimited":a=0;break;default:a=void 0}n?d({link:n.link,chatId:t,title:p,isRequestNeeded:P,expireDate:a,usageLimit:e}):m({chatId:t,title:p,isRequestNeeded:P,expireDate:a,usageLimit:e}),c(o.u1.Invites)}),[t,C,S,d,n,m,P,b,k,p,c,r]);return a.ZP.createElement("div",{className:"Management ManageInvite"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(mt.Z,{label:u("ApproveNewMembers"),subLabel:u("ApproveNewMembersDescription"),checked:P,onChange:F})),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{className:"link-name",placeholder:u("LinkNameHint"),value:p,onChange:B}),a.ZP.createElement("p",{className:"text-muted hint"},u("LinkNameHelp"))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},u("LimitByPeriod")),a.ZP.createElement(ta.Z,{name:"expireOptions",options:[{value:"hour",label:u("Hours",1)},{value:"day",label:u("Days",1)},{value:"week",label:u("Weeks",1)},{value:"unlimited",label:u("NoLimit")},{value:"custom",label:u("lng_group_invite_expire_custom")}],onChange:I,selected:b}),"custom"===b&&a.ZP.createElement(D.Z,{className:"expire-limit",isText:!0,onClick:v},(0,le.Tu)(u,C)," ",(0,le.mr)(u,C)),a.ZP.createElement("p",{className:"text-muted hint"},u("TimeLimitHelp"))),!P&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},u("LimitNumberOfUses")),a.ZP.createElement(ta.Z,{name:"usageOptions",options:[...ur.map((e=>({value:e.toString(),label:e}))),{value:"0",label:u("NoLimit")},{value:"custom",label:u("lng_group_invite_usage_custom")}],onChange:w,selected:k}),"custom"===k&&a.ZP.createElement("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:S,onChange:x}),a.ZP.createElement("p",{className:"text-muted hint"},u("UsesLimitHelp"))),a.ZP.createElement(An.Z,{isShown:!0,onClick:O,disabled:T,ariaLabel:u(n?"SaveLink":"CreateLink")},a.ZP.createElement("i",{className:"icon-check"}))),a.ZP.createElement(it,{isOpen:h,isFutureMode:!0,withTimePicker:!0,onClose:Z,onSubmit:$,selectedAt:C,submitButtonLabel:u("Save")}))}))),Pr=(0,a.X$)((0,l.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,i.Z1)(e,a);return{enabledReactions:null===(n=s.fullInfo)||void 0===n?void 0:n.enabledReactions,availableReactions:e.availableReactions,chat:s}}))((e=>{let{availableReactions:t,enabledReactions:n,chat:s,isActive:o,onClose:r}=e;const{setChatEnabledReactions:i}=(0,l.Sv)(),c=(0,R.Z)(),[d,m]=(0,a.eJ)(!1),[u,h]=(0,a.eJ)(!1),[v,Z]=(0,a.eJ)(n||[]);(0,A.Z)({isActive:o,onBack:r});const P=(0,a.I4)((()=>{s&&(h(!0),i({chatId:s.id,enabledReactions:v}))}),[s,v,i]);(0,a.d4)((()=>{n&&(h(!1),m(!1),Z(n))}),[n]);const g=(0,a.I4)((e=>{if(!s||!t)return;const{name:n,checked:a}=e.currentTarget,o="all"===n?a?t.map((e=>e.reaction)):[]:a?[...v,n]:v.filter((e=>e!==n));Z(o),m(!0)}),[t,s,v]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:"all",checked:!v||v.length>0,label:c("EnableReactions"),onChange:g})),null==t?void 0:t.filter((e=>!e.isInactive)).map((e=>{let{reaction:t,title:n}=e;return a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(mt.Z,{name:t,checked:!v||(null==v?void 0:v.includes(t)),disabled:0===(null==v?void 0:v.length),label:a.ZP.createElement("div",{className:"Reaction"},a.ZP.createElement(kt.Z,{reaction:t}),n),onChange:g}))})))),a.ZP.createElement(An.Z,{isShown:d,onClick:P,ariaLabel:c("Save"),disabled:u},u?a.ZP.createElement(Q.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),gr=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const{inviteInfo:a}=e.management.byChatId[n],{invite:s,importers:o,requesters:l}=a||{},c=(0,i.Z1)(e,n);return{invite:s,importers:o,requesters:l,isChannel:c&&(0,r.eA)(c),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{chatId:t,invite:n,importers:s,requesters:o,isChannel:r,isActive:i,serverTimeOffset:c,onClose:d}=e;const{showNotification:m,loadChatInviteImporters:u,loadChatInviteRequesters:h,openChat:v}=(0,l.Sv)(),Z=(0,R.Z)(),{usage:P=0,usageLimit:g,link:p,adminId:E}=n||{},C=(null==n?void 0:n.expireDate)&&1e3*(n.expireDate-(0,cr.b)(c))+Date.now(),f=((null==n?void 0:n.expireDate)||0)-(0,cr.b)(c)<0;(0,a.d4)((()=>{p&&(u({chatId:t,link:p}),h({chatId:t,link:p}))}),[t,p,u,h]);const b=(0,a.I4)((()=>{(0,Fs.TE)(n.link),m({message:Z("LinkCopied")})}),[n,Z,m]);return(0,A.Z)({isActive:i,onBack:d}),a.ZP.createElement("div",{className:"Management ManageInviteInfo"},a.ZP.createElement("div",{className:"custom-scroll"},!n&&a.ZP.createElement("p",{className:"text-muted"},Z("Loading")),n&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"link-title"},n.title||n.link),a.ZP.createElement("input",{className:"form-control",value:n.link,readOnly:!0,onClick:b}),a.ZP.createElement(D.Z,{className:"copy-link",onClick:b},Z("CopyLink")),C&&a.ZP.createElement("p",{className:"text-muted"},f?Z("ExpiredLink"):Z("LinkExpiresIn",`${(0,le.Tu)(Z,C)} ${(0,le.mr)(Z,C)}`))),E&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,Z("LinkCreatedeBy")),a.ZP.createElement(Je.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>v({id:E})},a.ZP.createElement(Ve.Z,{userId:E,status:(0,le.ZK)(Z,1e3*n.date,!0),forceShowSelf:!0}))),(()=>{if(null!=s&&s.length||null==o||!o.length)return s?a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,s.length?Z("PeopleJoined",P):Z("NoOneJoined")),a.ZP.createElement("p",{className:"text-muted"},!s.length&&(g?Z("PeopleCanJoinViaLinkCount",g-P):Z("NoOneJoinedYet")),s.map((e=>a.ZP.createElement(Je.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>v({id:e.userId})},a.ZP.createElement(Ve.Z,{userId:e.userId,status:(0,le.ZK)(Z,1e3*e.date,!0),forceShowSelf:!0})))))):a.ZP.createElement(Q.Z,null)})(),(()=>{if(null==n||!n.isRevoked){if(!o&&s)return a.ZP.createElement(Q.Z,null);if(null!=o&&o.length)return a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,Z(r?"SubscribeRequests":"MemberRequests")),a.ZP.createElement("p",{className:"text-muted"},o.map((e=>a.ZP.createElement(Je.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>v({id:e.userId})},a.ZP.createElement(Ve.Z,{userId:e.userId,status:(0,le.ZK)(Z,1e3*e.date,!0),forceShowSelf:!0}))))))}})())))}))),pr=(0,a.X$)((0,l.c$)(((e,t)=>{let{userId:n}=t;return{user:(0,i.dy)(e,n),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{userId:t,about:n,date:s,isChannel:o,user:i,serverTimeOffset:c,chatId:d}=e;const{openChat:m,hideChatJoinRequest:u}=(0,l.Sv)(),h=(0,V.y)("JoinRequest"),v=(0,R.Z)(),Z=(0,r.Js)(i),P=1e3*(s-(0,cr.b)(c))+Date.now(),g=(0,le.zk)(new Date(P))?(0,le.mr)(v,P):(0,le.j1)(v,P,!0,!1,!0),p=(0,a.I4)((()=>{u({chatId:d,userId:t,isApproved:!0})}),[d,u,t]),E=(0,a.I4)((()=>{u({chatId:d,userId:t,isApproved:!1})}),[d,u,t]);return a.ZP.createElement("div",{className:h("&")},a.ZP.createElement("div",{className:h("top")},a.ZP.createElement("div",{className:h("user"),onClick:()=>{m({id:t})}},a.ZP.createElement(Ae.Z,{key:t,size:"medium",user:i}),a.ZP.createElement("div",{className:h("user-info")},a.ZP.createElement("div",{className:h("user-name")},Z),a.ZP.createElement("div",{className:h("user-subtitle")},n))),a.ZP.createElement("div",{className:h("date")},g)),a.ZP.createElement("div",{className:h("buttons")},a.ZP.createElement(D.Z,{className:h("button"),onClick:p},v(o?"ChannelAddToChannel":"ChannelAddToGroup")),a.ZP.createElement(D.Z,{className:h("button"),isText:!0,onClick:E},v("DismissRequest"))))}))),Er=(0,a.X$)((0,l.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,i.Z1)(e,n);return{chat:a,serverTimeOffset:e.serverTimeOffset,isChannel:a&&(0,r.eA)(a)}}))((e=>{var t,n,s;let{chat:o,chatId:i,isActive:c,isChannel:d,onClose:m}=e;const{hideAllChatJoinRequests:h,loadChatJoinRequests:v}=(0,l.Sv)(),[Z,P,g]=(0,M.Z)(),[p,E,C]=(0,M.Z)(),f=(0,R.Z)();(0,A.Z)({isActive:c,onBack:m}),(0,a.d4)((()=>{null!=o&&o.joinRequests||(0,r.YC)(i)||v({chatId:i})}),[o,i,v]);const b=(0,a.I4)((()=>{h({chatId:i,isApproved:!0}),g()}),[h,i,g]),I=(0,a.I4)((()=>{h({chatId:i,isApproved:!1}),C()}),[h,i,C]);return a.ZP.createElement("div",{className:"Management ManageJoinRequests"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xn.Z,{tgsUrl:Mt.l.JoinRequest,size:u.PM,className:"section-icon"}),Boolean(null==o||null===(t=o.joinRequests)||void 0===t?void 0:t.length)&&a.ZP.createElement("div",{className:"bulk-actions"},a.ZP.createElement(D.Z,{className:"bulk-action-button",onClick:P},"Accept all"),a.ZP.createElement(D.Z,{className:"bulk-action-button",onClick:E,isText:!0},"Dismiss all"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{key:"title"},null!=o&&o.joinRequests?o.joinRequests.length?f("JoinRequests",o.joinRequests.length):f("NoMemberRequests"):f("Loading")),!(null!=o&&o.joinRequests)&&a.ZP.createElement(Q.Z,{key:"loading"}),0===(null==o||null===(n=o.joinRequests)||void 0===n?void 0:n.length)&&a.ZP.createElement("p",{className:"text-muted",key:"empty"},f(d?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")),null==o||null===(s=o.joinRequests)||void 0===s?void 0:s.map((e=>{let{userId:t,about:n,date:s}=e;return a.ZP.createElement(pr,{userId:t,about:n,date:s,isChannel:d,chatId:i,key:t})})))),a.ZP.createElement(tt.Z,{isOpen:Z,onClose:g,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:b}),a.ZP.createElement(tt.Z,{isOpen:p,onClose:C,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:I}))}))),Cr=(0,a.X$)((0,l.c$)((e=>({managementType:(0,i.pP)(e)})))((e=>{let{chatId:t,currentScreen:n,selectedChatMemberId:s,isPromotedByCurrentUser:l,onScreenSelect:r,onChatMemberSelect:i,onClose:c,isActive:d,managementType:m}=e;switch(n){case o.u1.Initial:switch(m){case"user":return a.ZP.createElement(Vl,{key:t,userId:t,onClose:c,isActive:d});case"group":return a.ZP.createElement(Hl,{key:t,chatId:t,onScreenSelect:r,onClose:c,isActive:d||[o.u1.ChatPrivacyType,o.u1.Discussion,o.u1.GroupPermissions,o.u1.ChatAdministrators,o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions,o.u1.ChatAdminRights,o.u1.ChatNewAdminRights,o.u1.GroupRecentActions].includes(n)});case"channel":return a.ZP.createElement(Ql,{key:t,chatId:t,onScreenSelect:r,onClose:c,isActive:d||[o.u1.ChannelSubscribers,o.u1.ChatAdministrators,o.u1.ChannelRemovedUsers,o.u1.Discussion,o.u1.ChatPrivacyType,o.u1.ChatAdminRights,o.u1.ChatNewAdminRights,o.u1.GroupRecentActions].includes(n)})}break;case o.u1.ChatPrivacyType:return a.ZP.createElement(tr,{chatId:t,isActive:d,onClose:c});case o.u1.Discussion:return a.ZP.createElement(nr,{chatId:t,onScreenSelect:r,isActive:d,onClose:c});case o.u1.GroupPermissions:return a.ZP.createElement(ql,{chatId:t,onScreenSelect:r,onChatMemberSelect:i,isActive:d||[o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions].includes(n),onClose:c});case o.u1.ChannelRemovedUsers:case o.u1.GroupRemovedUsers:return a.ZP.createElement(Kl,{chatId:t,isActive:d,onClose:c});case o.u1.GroupUserPermissionsCreate:return a.ZP.createElement(ir,{chatId:t,onChatMemberSelect:i,onScreenSelect:r,isActive:d||[o.u1.GroupUserPermissions].includes(n),onClose:c});case o.u1.GroupUserPermissions:return a.ZP.createElement(ar,{chatId:t,selectedChatMemberId:s,isPromotedByCurrentUser:l,onScreenSelect:r,isActive:d,onClose:c});case o.u1.ChatAdministrators:return a.ZP.createElement(sr,{chatId:t,onScreenSelect:r,onChatMemberSelect:i,isActive:d||[o.u1.ChatAdminRights,o.u1.ChatNewAdminRights,o.u1.GroupRecentActions].includes(n),onClose:c});case o.u1.GroupRecentActions:return a.ZP.createElement(or,{chatId:t,isActive:d,onClose:c});case o.u1.ChatNewAdminRights:case o.u1.ChatAdminRights:return a.ZP.createElement(lr,{chatId:t,isNewAdmin:n===o.u1.ChatNewAdminRights,selectedUserId:s,isPromotedByCurrentUser:l,onScreenSelect:r,isActive:d,onClose:c});case o.u1.ChannelSubscribers:case o.u1.GroupMembers:return a.ZP.createElement(rr,{chatId:t,isActive:d,onClose:c});case o.u1.Invites:return a.ZP.createElement(mr,{chatId:t,isActive:d,onClose:c,onScreenSelect:r});case o.u1.EditInvite:return a.ZP.createElement(Zr,{chatId:t,isActive:d,onClose:c,onScreenSelect:r});case o.u1.GroupAddAdmins:return a.ZP.createElement(rr,{chatId:t,noAdmins:!0,isActive:d,onClose:c,onScreenSelect:r,onChatMemberSelect:i});case o.u1.Reactions:return a.ZP.createElement(Pr,{chatId:t,isActive:d,onClose:c});case o.u1.InviteInfo:return a.ZP.createElement(gr,{chatId:t,isActive:d,onClose:c});case o.u1.JoinRequests:return a.ZP.createElement(Er,{chatId:t,isActive:d,onClose:c})}})));var fr=n(9937);const br=/^4[0-9]{12}(?:[0-9]{1,3})?$/,Ir=/^5[1-5][0-9]{11,14}$/,yr=/^2[2-7][0-9]{11,14}$/;let Sr;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(Sr||(Sr={}));const Nr={[Sr.Default]:"",[Sr.Visa]:"visa",[Sr.Mastercard]:"mastercard"};function kr(e){return e=e.replace(/\s/g,""),br.test(e)?Sr.Visa:Ir.test(e)||yr.test(e)?Sr.Mastercard:Sr.Default}const wr={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},Mr=(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.iso2,billingCountry:t.payload.defaultName,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.country?{...e,...t.payload,billingCountry:t.payload.country}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function Tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400;(0,a.d4)((()=>{m.$b||setTimeout((()=>{(0,q.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const Ar=(0,a.X$)((e=>{const{id:t,value:n,label:s,hasArrow:o,error:l,ref:r,placeholder:i,onChange:c,children:d}=e,m=l||s,u=(0,V.Z)("input-group",n&&"touched",l&&"error",m&&"with-label",o&&"with-arrow","input-group");return a.ZP.createElement("div",{className:u},a.ZP.createElement("select",{className:"form-control",id:t,value:n||"",onChange:c,placeholder:i||s,ref:r},d),m&&t&&a.ZP.createElement("label",{htmlFor:t},m))})),Rr=(0,a.X$)((e=>{let{state:t,needEmail:n,needPhone:s,needName:o,needAddress:l,countryList:r,dispatch:i}=e;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=(0,a.sO)(null);(0,a.d4)((()=>{m.current&&m.current.value!==t.countryIso2&&(m.current.value=t.countryIso2)}),[t.countryIso2]);const u=(0,R.Z)();Tr(c);const h=(0,a.I4)((e=>{i({type:"changeAddress1",payload:e.target.value})}),[i]),v=(0,a.I4)((e=>{i({type:"changeAddress2",payload:e.target.value})}),[i]),Z=(0,a.I4)((e=>{i({type:"changeCity",payload:e.target.value})}),[i]),P=(0,a.I4)((e=>{i({type:"changeState",payload:e.target.value})}),[i]),g=(0,a.I4)((e=>{i({type:"changeCountry",payload:r.find((t=>t.iso2===e.target.value))})}),[r,i]),p=(0,a.I4)((e=>{i({type:"changePostCode",payload:e.target.value})}),[i]),E=(0,a.I4)((e=>{i({type:"changeFullName",payload:e.target.value})}),[i]),C=(0,a.I4)((e=>{i({type:"changeEmail",payload:e.target.value})}),[i]),f=(0,a.I4)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,d.current&&(d.current.value=t),i({type:"changePhone",payload:t})}),[i]),b=(0,a.I4)((e=>{i({type:"changeSaveInfo",payload:e.target.value})}),[i]),{formErrors:I}=t;return a.ZP.createElement("div",{className:"ShippingInfo"},a.ZP.createElement("form",null,l?a.ZP.createElement("div",null,a.ZP.createElement("h5",null,u("PaymentShippingAddress")),a.ZP.createElement(Ge.Z,{ref:c,label:u("PaymentShippingAddress1Placeholder"),onChange:h,value:t.streetLine1,inputMode:"text",error:I.streetLine1}),a.ZP.createElement(Ge.Z,{label:u("PaymentShippingAddress2Placeholder"),onChange:v,value:t.streetLine2,inputMode:"text",error:I.streetLine2}),a.ZP.createElement(Ge.Z,{label:u("PaymentShippingCityPlaceholder"),onChange:Z,value:t.city,inputMode:"text",error:I.city}),a.ZP.createElement(Ge.Z,{label:u("PaymentShippingStatePlaceholder"),onChange:P,value:t.state,inputMode:"text",error:I.state}),a.ZP.createElement(Ar,{label:u("PaymentShippingCountry"),placeholder:u("PaymentShippingCountry"),onChange:g,value:t.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:I.countryIso2,ref:m},r.map((e=>{let{defaultName:t,name:n,iso2:s}=e;return a.ZP.createElement("option",{value:s,className:"county-item"},t||n)}))),a.ZP.createElement(Ge.Z,{label:u("PaymentShippingZipPlaceholder"),onChange:p,value:t.postCode,inputMode:"text",error:I.postCode})):void 0,o||n||s?a.ZP.createElement("h5",null,u("PaymentShippingReceiver")):void 0,o&&a.ZP.createElement(Ge.Z,{label:u("PaymentShippingName"),onChange:E,value:t.fullName,inputMode:"text",error:I.fullName}),n&&a.ZP.createElement(Ge.Z,{label:u("PaymentShippingEmailPlaceholder"),onChange:C,value:t.email,inputMode:"email",error:I.email}),s&&a.ZP.createElement(Ge.Z,{label:u("PaymentShippingPhoneNumber"),onChange:f,value:t.phone,inputMode:"tel",error:I.phone,ref:d}),a.ZP.createElement(mt.Z,{label:u("PaymentShippingSave"),subLabel:u("PaymentShippingSaveInfo"),checked:Boolean(t.saveInfo),onChange:b})))})),Lr=(0,a.X$)((e=>{let{state:t,shippingOptions:n,currency:s,dispatch:o}=e;const l=(0,R.Z)();(0,a.d4)((()=>{n&&!t.shipping&&o({type:"changeShipping",payload:n[0].id})}),[n,t.shipping,o]);const r=(0,a.I4)((e=>{o({type:"changeShipping",payload:e})}),[o]),i=(0,a.Ye)((()=>n.map((e=>{let{id:t,title:n,amount:a}=e;return{label:n,subLabel:(0,fr.x)(a,s,l.code),value:t}}))),[n,s,l.code]);return a.ZP.createElement("div",{className:"Shipping"},a.ZP.createElement("form",null,a.ZP.createElement("p",null,l("PaymentShippingMethod")),a.ZP.createElement(ta.Z,{name:"shipping-options",options:i,onChange:r,selected:t.shipping})))}));function Fr(e,t,n,s){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return a.ZP.createElement("div",{className:"price-info-item "+(o?"price-info-item-main":"")},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("div",{className:"value"},(0,fr.x)(n,s,e)))}function Br(e,t,n){return a.ZP.createElement("div",{className:"checkout-info-item"},a.ZP.createElement("i",{className:e}," "),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("p",{className:"data"},n)))}const xr=(0,a.X$)((e=>{let{invoiceContent:t,prices:n,shippingPrices:s,checkoutInfo:o,currency:l,totalPrice:r}=e;const i=(0,R.Z)(),{photoUrl:c,title:d,text:m}=t||{},{paymentMethod:u,paymentProvider:h,shippingAddress:v,name:Z,phone:P,shippingMethod:g}=o||{};return a.ZP.createElement("div",{className:"Checkout"},a.ZP.createElement("div",{className:"description has-image"},c&&a.ZP.createElement("img",{src:c,alt:""}),a.ZP.createElement("div",{className:"text"},a.ZP.createElement("h5",null,d),a.ZP.createElement("p",null,m))),a.ZP.createElement("div",{className:"price-info"},n&&n.map((e=>Fr(i.code,e.label,e.amount,l))),s&&s.map((e=>Fr(i.code,e.label,e.amount,l))),void 0!==r&&Fr(i.code,i("Checkout.TotalAmount"),r,l,!0)),a.ZP.createElement("div",{className:"invoice-info"},u&&Br("icon-card",u,i("PaymentCheckoutMethod")),h&&Br((0,V.Z)("provider",h.toLowerCase()),h,i("PaymentCheckoutProvider")),v&&Br("icon-location",v,i("PaymentShippingAddress")),Z&&Br("icon-user",Z,i("PaymentCheckoutName")),P&&Br("icon-phone",P,i("PaymentCheckoutPhoneNumber")),g&&Br("icon-truck",g,i("PaymentCheckoutShippingMethod"))))})),Dr=(0,a.X$)((e=>{let{value:t,error:n,onChange:s}=e;const o=(0,R.Z)(),l=(0,a.sO)(null),r=(0,a.I4)((e=>{if("Backspace"===e.key&&"/"===t.charAt(t.length-1)){const e=t.slice(0,t.length-1);l.current&&(l.current.value=e)}}),[t]),i=(0,a.I4)((e=>{s(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return null!=t&&t[0]&&Number(t[0])>12&&(t[0]="12"),null!=t&&t[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))}),[s]);return a.ZP.createElement(Ge.Z,{label:o("PaymentCardExpireDate"),ref:l,onChange:i,onKeyDown:r,value:t,error:n,inputMode:"numeric",maxLength:5})})),$r=n.p+"mastercard.790db81f7978635f77d8..svg",Or=n.p+"visa.538e537ba818f53b0a8f..svg",_r=(0,a.X$)((e=>{let{value:t,error:n,onChange:s}=e;const o=(0,R.Z)(),l=(0,a.sO)(null);Tr(l);const[r,i]=(0,a.eJ)(Sr.Default);(0,a.d4)((()=>{const e=kr(t);i(e)}),[]);const c=(0,a.I4)((e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),n=kr(e.target.value);i(n),s(t),l.current&&(l.current.value=t)}),[s,l]),d=function(e){switch(e){case Sr.Mastercard:return a.ZP.createElement("img",{src:$r,alt:""});case Sr.Visa:return a.ZP.createElement("img",{src:Or,alt:""});default:return}}(r);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement("span",{className:"left-addon"},d),a.ZP.createElement(Ge.Z,{ref:l,label:o("PaymentCardNumber"),onChange:c,value:t,inputMode:"numeric",className:r?"has-left-addon":"",error:n,maxLength:23}))})),Ur=(0,a.X$)((e=>{let{state:t,canSaveCredentials:n,needCardholderName:s,needCountry:o,needZip:l,countryList:r,dispatch:i}=e;const c=(0,a.sO)(null);(0,a.d4)((()=>{c.current&&c.current.value!==t.billingCountry&&(c.current.value=t.billingCountry)}),[t.billingCountry]);const d=(0,a.I4)((e=>{i({type:"changeCardNumber",payload:e})}),[i]),m=(0,a.I4)((e=>{i({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[i]),u=(0,a.I4)((e=>{i({type:"changeExpiryDate",payload:e})}),[i]),h=(0,a.I4)((e=>{i({type:"changeCvvCode",payload:e.target.value})}),[i]),v=(0,a.I4)((e=>{i({type:"changeBillingCountry",payload:e.target.value})}),[i]),Z=(0,a.I4)((e=>{i({type:"changeBillingZip",payload:e.target.value})}),[i]),P=(0,a.I4)((e=>{i({type:"changeSaveCredentials",payload:e.target.value})}),[i]),g=(0,R.Z)(),{formErrors:p={}}=t;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,g("PaymentCardTitle")),a.ZP.createElement(_r,{onChange:d,value:t.cardNumber,error:p.cardNumber}),s&&a.ZP.createElement(Ge.Z,{label:g("PaymentCardName"),onChange:m,value:t.cardholder,inputMode:"text",error:p.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(Dr,{value:t.expiry,onChange:u,error:p.expiry}),a.ZP.createElement(Ge.Z,{label:g("lng_payments_card_cvc"),onChange:h,value:t.cvv,inputMode:"numeric",maxLength:3,error:p.cvv})),o||l?a.ZP.createElement("h5",null,g("PaymentBillingAddress")):void 0,o&&a.ZP.createElement(Ar,{label:g("PaymentShippingCountry"),placeholder:g("PaymentShippingCountry"),onChange:v,value:t.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:p.billingCountry,ref:c},r.map((e=>{let{defaultName:t,name:n}=e;return a.ZP.createElement("option",{value:t,className:"county-item"},t||n)}))),l&&a.ZP.createElement(Ge.Z,{label:g("PaymentShippingZipPlaceholder"),onChange:Z,value:t.billingZip,inputMode:"text",error:p.billingZip}),n&&a.ZP.createElement(mt.Z,{label:g("PaymentCardSavePaymentInformation"),checked:t.saveCredentials,onChange:P})))})),Gr=(0,a.X$)((e=>{let{url:t}=e;const n=(0,R.Z)();return a.ZP.createElement("div",{className:"ConfirmPayment"},a.ZP.createElement("iframe",{src:t,title:n("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-forms allow-scripts allow-same-origin allow-top-navigation",className:"ConfirmPayment__content"}))})),Xr=new Set(["stripe","smartglocal"]),Jr=(0,a.X$)((0,l.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:o,invoiceContent:l,nativeProvider:r,nativeParams:i,passwordMissing:c,error:d,confirmPaymentUrl:m}=e.payment,u=Boolean(o&&(!r||!Xr.has(r))),{needCardholderName:h,needCountry:v,needZip:Z}=i||{},{nameRequested:P,phoneRequested:g,emailRequested:p,shippingAddressRequested:E,flexible:C,phoneToProvider:f,emailToProvider:b,currency:I,prices:y}=o||{};return{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:r,passwordMissing:c,nameRequested:P,shippingAddressRequested:E,phoneRequested:g,emailRequested:p,flexible:C,phoneToProvider:f,emailToProvider:b,currency:I,prices:y,isProviderError:u,invoiceContent:l,needCardholderName:h,needCountry:v,needZip:Z,error:d,confirmPaymentUrl:m,countryList:e.countryList.general}}))((e=>{let{isOpen:t,onClose:n,step:s,shippingOptions:r,savedInfo:i,canSaveCredentials:c,nameRequested:d,shippingAddressRequested:m,phoneRequested:u,emailRequested:h,phoneToProvider:v,emailToProvider:Z,currency:P,passwordMissing:g,isProviderError:p,invoiceContent:E,nativeProvider:C,prices:f,needCardholderName:b,needCountry:I,needZip:y,confirmPaymentUrl:S,error:N,countryList:k}=e;const{validateRequestedInfo:w,sendPaymentForm:M,setPaymentStep:T,sendCredentialsInfo:A,clearPaymentError:L}=(0,l.Sv)(),[F,B]=(0,In.Z)(Mr,wr),[x,$]=(0,a.eJ)(!1),_=(0,R.Z)(),U=s!==o.KB.ConfirmPayment;(0,a.d4)((()=>{(s||N)&&$(!1)}),[s,N]),(0,a.d4)((()=>{null!=N&&N.field&&B({type:"setFormErrors",payload:{[N.field]:N.message}})}),[N,B]),(0,a.d4)((()=>{if(i){const{name:e,phone:t,email:n,shippingAddress:a}=i,{countryIso2:s,...o}=a||{},l=s&&k.find((e=>{let{iso2:t}=e;return t===s})).defaultName;B({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...l&&{country:l,...o}}})}}),[i,B,k]);const G=(0,a.I4)((()=>{L()}),[L]),X=(0,a.Ye)((()=>s!==o.KB.Checkout?0:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;const a=t?Vr(t,n):[];let s=0;const o=e.concat(a||[]);return s=o.reduce(((e,t)=>e+t.amount),s),s}(f,r,F.shipping)),[s,F.shipping,f,r]),J=(0,a.Ye)((()=>{if(s===o.KB.Checkout)return function(e,t,n){const a=`${function(e){const t=kr(e);return Nr[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,s=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:o,fullName:l}=e,r=t?zr(t,e.shipping):void 0;return{paymentMethod:a,paymentProvider:n,shippingAddress:s,name:l,phone:o,shippingMethod:null==r?void 0:r.title}}(F,r,C||"")}),[s,F,r,C]),z=(0,a.I4)((()=>{const{saveInfo:e}=F,t=function(e){const{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:o,postCode:l,fullName:r,phone:i,email:c}=e;return{name:r,phone:i,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:o,postCode:l}}}(F);w({requestInfo:t,saveInfo:e})}),[w,F]),V=(0,a.I4)((()=>{const e=function(e){const{cardNumber:t,cardholder:n,expiry:a,cvv:s,billingCountry:o,billingZip:l}=e,[r,i]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:r,expiryYear:i,cvv:s,country:o,zip:l}}}(F);A({credentials:e})}),[A,F]),Y=(0,a.I4)((()=>{M({shippingOptionId:F.shipping,saveCredentials:F.saveCredentials})}),[M,F]),H=(0,a.I4)((e=>{T({step:e})}),[T]),q=(0,a.I4)((()=>{switch($(!0),s){case o.KB.ShippingInfo:return z();case o.KB.Shipping:return H(o.KB.PaymentInfo);case o.KB.PaymentInfo:return V();case o.KB.Checkout:return Y();default:return()=>{}}}),[s,z,H,V,Y]),j=(0,a.Ye)((()=>{switch(s){case o.KB.ShippingInfo:return _("PaymentShippingInfo");case o.KB.Shipping:return _("PaymentShippingMethod");case o.KB.PaymentInfo:return _("PaymentCardInfo");case o.KB.Checkout:return _("PaymentCheckout");case o.KB.ConfirmPayment:return _("Checkout.WebConfirmation.Title");default:return""}}),[s,_]),K=(0,a.Ye)((()=>s===o.KB.Checkout?_("Checkout.PayPrice",(0,fr.x)(X,P,_.code)):_("Next")),[s,_,P,X]);return p?a.ZP.createElement(Ue.Z,{className:"error",isOpen:t,onClose:n},a.ZP.createElement("p",null,"Sorry, Telegram WebZ doesn't support payments with this provider yet. ",a.ZP.createElement("br",null),"Please use one of our mobile apps to do this."),a.ZP.createElement(D.Z,{isText:!0,onClick:n},_("OK"))):a.ZP.createElement(Ue.Z,{className:"PaymentModal",isOpen:t,onClose:n},a.ZP.createElement("div",{className:"header",dir:_.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:n,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null,j)),void 0!==s?a.ZP.createElement(O.Z,{name:"slide",activeKey:s},a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case o.KB.ShippingInfo:return a.ZP.createElement(Rr,{state:F,dispatch:B,needAddress:Boolean(m),needEmail:Boolean(h||Z),needPhone:Boolean(u||v),needName:Boolean(d),countryList:k});case o.KB.Shipping:return a.ZP.createElement(Lr,{state:F,dispatch:B,shippingOptions:r||[],currency:P});case o.KB.PaymentInfo:return a.ZP.createElement(Ur,{state:F,dispatch:B,canSaveCredentials:Boolean(!g&&c),needCardholderName:b,needCountry:I,needZip:y,countryList:k});case o.KB.Checkout:return a.ZP.createElement(xr,{prices:f,shippingPrices:F.shipping&&r?Vr(r,F.shipping):void 0,totalPrice:X,invoiceContent:E,checkoutInfo:J,currency:P});case o.KB.ConfirmPayment:return a.ZP.createElement(Gr,{url:S});default:return}}(s))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(Q.Z,{color:"gray"})),U&&a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(D.Z,{type:"submit",onClick:q,disabled:x,isLoading:x},K)),N&&!N.field&&function(){if(N)return a.ZP.createElement(Ue.Z,{className:"error",isOpen:Boolean(N),onClose:G},a.ZP.createElement("h4",null,N.description||"Error"),a.ZP.createElement("p",null,N.description||"Error"),a.ZP.createElement(D.Z,{isText:!0,onClick:L},_("OK")))}())})));function zr(e,t){return e.find((e=>{let{id:n}=e;return n===t}))}function Vr(e,t){const n=zr(e,t);return null==n?void 0:n.prices}const Yr=(0,a.X$)((0,l.c$)((e=>{const{receipt:t}=e.payment,{currency:n,prices:a,info:s,totalAmount:o,credentialsTitle:l,shippingPrices:r,shippingMethod:i,photoUrl:c,text:d,title:m}=t||{};return{currency:n,prices:a,info:s,totalAmount:o,credentialsTitle:l,shippingPrices:r,shippingMethod:i,photoUrl:c,text:d,title:m}}))((e=>{let{isOpen:t,onClose:n,prices:s,shippingPrices:o,totalAmount:l,currency:r,info:i,photoUrl:c,text:d,title:m,credentialsTitle:u,shippingMethod:h}=e;const v=(0,R.Z)(),Z=(0,a.Ye)((()=>function(e,t,n){if(!t)return{paymentMethod:e};const{shippingAddress:a}=t,s=null!=a&&a.streetLine1?`${a.streetLine1}, ${a.city}, ${a.countryIso2}`:void 0,{phone:o,name:l}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:s,name:l,phone:o,shippingMethod:n}}(u,i,h)),[i,h,u]);return a.ZP.createElement(Ue.Z,{className:"PaymentModal PaymentModal-receipt",isOpen:t,onClose:n},a.ZP.createElement("div",null,a.ZP.createElement("div",{className:"header",dir:v.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:n,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null," ",v("PaymentReceipt")," ")),a.ZP.createElement("div",{className:"receipt-content custom-scroll"},a.ZP.createElement(xr,{prices:s,shippingPrices:o,totalPrice:l,invoiceContent:{photoUrl:c,text:d,title:m},checkoutInfo:Z,currency:r}))))})))},93490:(e,t,n)=>{n.d(t,{Z:()=>v});var a=n(14050),s=n(83716),o=n(77361),l=n(15258),r=n(97799),i=n(28183),c=n(60706);const d=[0,50],m=[0,20],u=[20,0],h=o.wB?s.qp:s.z7,v=(0,a.X$)((e=>{let{isPasswordVisible:t,isBig:n}=e;const[o,v]=(0,c.Z)(!1),[Z,P]=(0,c.Z)(!1);(0,i.Z)(P,2e3);const g=(0,a.I4)(v,[v]);return a.ZP.createElement("div",{id:"monkey",className:n?"big":""},!o&&a.ZP.createElement("div",{className:"monkey-preview"}),a.ZP.createElement(r.Z,{size:n?s.K2:h,className:Z?"hidden":"shown",tgsUrl:l.l.MonkeyClose,playSegment:d,noLoop:!0,onLoad:g}),a.ZP.createElement(r.Z,{size:n?s.K2:h,className:Z?"shown":"hidden",tgsUrl:l.l.MonkeyPeek,playSegment:t?m:u,noLoop:!0}))}))},90710:(e,t,n)=>{n.d(t,{Z:()=>P});var a=n(14050),s=n(46752),o=n(83716),l=n(71394),r=n(59107),i=n(231),c=n(13103),d=n(34288);const m={type:"blob",quality:1,format:"jpeg",circle:!1,size:{width:1024,height:1024}};let u,h,v;const Z=(0,a.X$)((e=>{let{file:t,onChange:s,onClose:Z}=e;const[P,g]=(0,a.eJ)(!1);(0,a.d4)((()=>{t&&(P?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:n,offsetHeight:a}=t;v=new u(t,{enableZoom:!0,boundary:{width:n,height:a},viewport:{width:n-16,height:a-16,type:"circle"}});const s=await(0,l.YJ)(e);await v.bind({url:s})}catch(e){o.eM&&console.error(e)}}(t):async function(){return h||(h=Promise.all([n.e(5099),n.e(3472)]).then(n.bind(n,23472)),u=(await h).default),h}().then((()=>g(!0))))}),[t,P]);const p=(0,r.Z)(),E=(0,a.I4)((async()=>{if(!v)return;const e=await v.result(m),t="string"==typeof e?e:(0,l.hl)(e,"avatar.jpg");s(t)}),[s]);return a.ZP.createElement(c.Z,{isOpen:Boolean(t),onClose:Z,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},P?a.ZP.createElement("div",{id:"avatar-crop"}):a.ZP.createElement(d.Z,null),a.ZP.createElement(i.Z,{className:"confirm-button",round:!0,color:"primary",onClick:E,ariaLabel:p("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),P=(0,a.X$)((e=>{let{title:t="Change your profile picture",disabled:n,currentAvatarBlobUrl:o,onChange:l}=e;const[r,i]=(0,a.eJ)(),[c,d]=(0,a.eJ)(o);(0,a.d4)((()=>{d(o)}),[o]);const m=(0,a.I4)((e=>{i(void 0),l(e),c&&URL.revokeObjectURL(c),d(URL.createObjectURL(e))}),[c,l]),u=(0,a.I4)((()=>{i(void 0)}),[]),h=(0,s.Z)(c&&"filled",n&&"disabled");return a.ZP.createElement("div",{className:"AvatarEditable"},a.ZP.createElement("label",{className:h,role:"button",tabIndex:0,title:t},a.ZP.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(i(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),a.ZP.createElement("i",{className:"icon-camera-add"}),c&&a.ZP.createElement("img",{src:c,alt:"Avatar"})),a.ZP.createElement(Z,{file:r,onClose:u,onChange:m}))}))}}]);
|
||
//# sourceMappingURL=3779.aa4f1e01a60ca2b8a401.js.map
|