telegram-tt/dist/126.8100af6cdae9295c7269.js
Alexander Zinchuk e5062ef42c [Build]
2022-01-28 21:02:07 +01:00

2 lines
311 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[126],{9126:(e,t,n)=>{n.r(t),n.d(t,{ArchivedChats:()=>ts,AttachMenu:()=>Er,AttachmentModal:()=>zs,BotCommandMenu:()=>br,BotCommandTooltip:()=>fr,CalendarModal:()=>qe,ChatFolderModal:()=>as,ContactList:()=>Va,ContextMenuContainer:()=>Is,CustomSendMenu:()=>yr,DeleteMessageModal:()=>We,Dialogs:()=>Ue,DropArea:()=>Nr.Z,EmojiInteractionAnimation:()=>ut,EmojiTooltip:()=>wr,ForwardPicker:()=>Be,GifSearch:()=>Xr,HeaderMenuContainer:()=>ks,HistoryCalendar:()=>Ke,InlineBotTooltip:()=>Br,LeftSearch:()=>en,Management:()=>Io,MediaViewer:()=>be,MentionTooltip:()=>Js,MessageSelectToolbar:()=>rt,MobileSearch:()=>Ms,NewChat:()=>Qa,NewChatStep1:()=>qa,NewChatStep2:()=>Ka,Notifications:()=>Ge,PaymentModal:()=>jo,PinMessageModal:()=>Qe,PollModal:()=>Ys,PollResults:()=>_r,ReactorListModal:()=>ct,ReceiptModal:()=>Wo,RightSearch:()=>Dr,SafeLinkModal:()=>ze,SeenByModal:()=>ot,SendAsMenu:()=>$r,Settings:()=>Ya,StickerSearch:()=>Jr,StickerSetModal:()=>ys,StickerTooltip:()=>Ir,SymbolMenu:()=>pr,TextFormatter:()=>kr.Z,UnpinAllMessagesModal:()=>et});var a=n(4050),s=n(5116),r=n(6137),o=n(1713),i=n(3716),l=n(2937),c=n(5326),d=n(8674),m=n(6590),u=n(9107),h=n(6202),Z=n(2566),v=n(7204),P=n(8415),g=n(1638),p=n(396),E=n(3989),C=n(1174),f=n(7361),b=n(3858),I=n(4399),y=n(1265),N=n(3227);function k(e,t){const n=document.createElement("div");n.classList.add("ghost");const a=new Image;if(a.draggable=!1,a.oncontextmenu=N.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 S(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 w(e,t){Object.assign(e.style,t)}function M(e,t){let n,a;switch(e){case o.bZ.Album:case o.bZ.ScheduledAlbum:n=`.Transition__slide--active > .MessageList #album-media-${t.id}`,a=".full-media";break;case o.bZ.SharedMedia:n=`#shared-media${t.id}`,a="img";break;case o.bZ.SearchResult:n=`#search-media${t.id}`,a="img";break;case o.bZ.MiddleHeaderAvatar:n=".MiddleHeader .Transition__slide--active .ChatInfo .Avatar",a="img.avatar-media";break;case o.bZ.SettingsAvatar:n="#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto",a="img.avatar-media";break;case o.bZ.ProfileAvatar:n="#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto",a="img.avatar-media";break;case o.bZ.ScheduledInline:case o.bZ.Inline:default:n=`.Transition__slide--active > .MessageList #message${t.id}`,a=".message-content .full-media, .message-content .thumbnail"}const s=document.querySelector(n),r=s&&s.querySelectorAll(a);return{container:s,mediaEl:null==r?void 0:r[r.length-1]}}function T(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 R=n(231),L=n(126),A=n(2255),F=n(3106),B=n(8964),$=n(9196);const x=(0,a.X$)((0,s.c$)(((e,{message:t})=>({isDownloading:!!t&&(0,g.te)(e,t),isProtected:(0,g.EV)(e,t)})))((({mediaData:e,isVideo:t,isZoomed:n,message:r,fileName:o,isAvatar:i,isDownloading:l,isProtected:c,onCloseMediaViewer:d,onForward:m,onZoomToggle:h})=>{const{downloadMessageMedia:v,cancelMessageMediaDownload:g}=(0,s.uC)(),{loadProgress:p}=(0,Z.Z)(r&&(0,P.Ti)(r,"download"),!l),E=(0,a.I4)((()=>{l?g({message:r}):v({message:r})}),[g,v,l,r]),C=(0,u.Z)(),b=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]);if(f.wB){if(c)return;return a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(F.Z,{trigger:b,positionX:"right"},!i&&a.ZP.createElement(B.Z,{icon:"forward",onClick:m},C("Forward")),t?a.ZP.createElement(B.Z,{icon:l?"close":"download",onClick:E},l?`${Math.round(100*p)}% Downloading...`:"Download"):a.ZP.createElement(B.Z,{icon:"download",href:e,download:o},C("AccActionDownload"))),l&&a.ZP.createElement($.Z,{progress:p,size:"s",noCross:!0}))}return a.ZP.createElement("div",{className:"MediaViewerActions"},!i&&!c&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:C("Forward"),onClick:m},a.ZP.createElement("i",{className:"icon-forward"}))),function(){if(!c)return t?a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:C("AccActionDownload"),onClick:E},l?a.ZP.createElement($.Z,{progress:p,size:"s",onClick:E}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement(R.Z,{href:e,download:o,round:!0,size:"smaller",color:"translucent-white",ariaLabel:C("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"}))}(),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:n?"Zoom Out":"Zoom In",onClick:h},a.ZP.createElement("i",{className:n?"icon-zoom-out":"icon-zoom-in"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:C("Close"),onClick:d},a.ZP.createElement("i",{className:"icon-close"})))})));var D=n(2202),U=n(9933),O=n(275),G=n(9118),J=n(9204),X=n(6752);const z=({text:e="",isHidden:t,isForVideo:n,onClick:s})=>{const[r,o]=(0,a.eJ)(!1);(0,a.d4)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;o(t>2*I.Gw)};t();const n=(0,G.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const i=(0,X.Z)("MediaViewerFooter",n&&"is-for-video",t&&"is-hidden");return a.ZP.createElement("div",{className:i,onClick:function(t){e&&t.stopPropagation()}},e&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:f.wB?void 0:s},a.ZP.createElement("p",{className:"media-text custom-scroll "+(r?"multiline":""),dir:"auto"},e)))};var _=n(1212),Y=n(2019);const H=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var V=n(6898),j=n(4753),q=n(790);const K=["bytes","kB","MB","GB","TB","PB"],W=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${K[t]}`},Q=e=>{e.stopPropagation()},ee=({bufferedProgress:e,currentTime:t,duration:n,fileSize:s,isForceVisible:r,isForceMobileVersion:o,isPlayed:i,isFullscreenSupported:l,isFullscreen:c,onChangeFullscreen:d,onPlayPause:m,onSeek:h})=>{const[Z,v]=(0,a.eJ)(!0),P=(0,a.sO)(null),g=(0,a.sO)(!1);(0,a.d4)((()=>{r&&v(r)}),[r]),(0,a.d4)((()=>{let e;return r||(f.wB?v(!1):e=window.setTimeout((()=>{v(!1)}),800)),()=>{e&&window.clearTimeout(e)}}),[r]),(0,a.d4)((()=>((Z||r)&&document.body.classList.add("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[r,Z]);const p=(0,u.Z)(),E=(0,a.I4)((e=>{if(g.current&&P.current){const{width:t,left:a}=P.current.getBoundingClientRect(),s=e instanceof MouseEvent?e.clientX:e.targetTouches[0].clientX;h(Math.max(Math.min(n*((s-a)/t),n),0))}}),[n,h]),b=(0,a.I4)((e=>{g.current=!0,E(e)}),[E]),I=(0,a.I4)((()=>{g.current=!1}),[]);(0,a.d4)((()=>{if(P.current&&Z)return(0,C.sf)(P.current,{onCapture:b,onRelease:I,onClick:I,onDrag:E})}),[Z,b,E,I]);const y=Z||r;return a.ZP.createElement("div",{className:(0,X.Z)("VideoPlayerControls",o&&"mobile",y&&"active"),onClick:Q},function(e,t,n,s){const r=e/t*100,o=100*n;return a.ZP.createElement("div",{className:"player-seekline",ref:s},a.ZP.createElement("div",{className:"player-seekline-track"},a.ZP.createElement("div",{className:"player-seekline-buffered",style:`width: ${o||0}%`}),a.ZP.createElement("div",{className:"player-seekline-played",style:`width: ${r||0}%`})))}(t,n,e,P),a.ZP.createElement(R.Z,{ariaLabel:p("AccActionPlay"),size:"tiny",ripple:!f.wB,color:"translucent-white",className:"play",onClick:m},a.ZP.createElement("i",{className:i?"icon-pause":"icon-play"})),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,q.k9)(e)} / ${(0,q.k9)(t)}`)}(t,n),e<1&&(N=e,k=s,a.ZP.createElement("div",{className:"player-file-size"},`${W(k*N)} / ${W(k)}`)),l&&a.ZP.createElement(R.Z,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",onClick:d},a.ZP.createElement("i",{className:c?"icon-smallscreen":"icon-fullscreen"})));var N,k};function te(){return(te=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}).apply(this,arguments)}const ne=(0,a.X$)((({url:e,isGif:t,posterData:n,posterSize:s,loadProgress:r,fileSize:o,isMediaViewerOpen:i,noPlay:l,onClose:c})=>{const d=(0,a.sO)(null),[m,u]=(0,a.eJ)(!f.$b||!f.cj),[h,Z]=(0,a.eJ)(0),[v,P]=(0,a.eJ)(!0),[g,p,E]=function(e,t){const[n,s]=(0,a.eJ)(Boolean(H&&document[H]));return(0,a.bt)((()=>{const n=()=>{s(Boolean(H&&document[H]))},a=()=>{s(!0)},r=()=>{s(!1),t(!1)},o=e.current;return document.addEventListener("fullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),o&&(o.addEventListener("webkitbeginfullscreen",a,!1),o.addEventListener("webkitendfullscreen",r,!1)),()=>{document.removeEventListener("fullscreenchange",n,!1),document.removeEventListener("webkitfullscreenchange",n,!1),document.removeEventListener("mozfullscreenchange",n,!1),o&&(o.removeEventListener("webkitbeginfullscreen",a,!1),o.removeEventListener("webkitendfullscreen",r,!1))}}),[]),H||"iOS"===f.Lt?[n,()=>{e.current&&(H||"iOS"===f.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]}(d,u),{isBuffered:C,bufferedProgress:b,bufferingHandlers:I}=(0,Y.Z)(),{shouldRender:y,transitionClassNames:N}=(0,_.Z)(!C,void 0,void 0,"slow"),{shouldRender:k,transitionClassNames:S}=(0,_.Z)(f.cj&&!m&&!y,void 0,void 0,"slow");(0,a.d4)((()=>{l||!i?d.current.pause():e&&!f.$b&&(0,j.Z)(d.current)}),[l,i,e]),(0,a.d4)((()=>{d.current.currentTime===d.current.duration?(Z(0),u(!1)):Z(d.current.currentTime)}),[h]);const w=(0,a.I4)((e=>{e.stopPropagation(),m?(d.current.pause(),u(!1)):((0,j.Z)(d.current),u(!0),f.wB&&P(!1))}),[m]);(0,V.Z)(d,[]);const M=(0,a.I4)((()=>{P(!0)}),[]),T=(0,a.I4)((()=>{P(!1)}),[]),L=(0,a.I4)((e=>{Z(e.currentTarget.currentTime)}),[]),A=(0,a.I4)((()=>{Z(0),u(!1),P(!0)}),[]),F=(0,a.I4)((()=>{g&&E?E():!g&&p&&p()}),[E,g,p]),B=(0,a.I4)((e=>{d.current.currentTime=e}),[]),x=(0,a.I4)((e=>{e.stopPropagation(),P(!v)}),[v]);(0,a.d4)((()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),w(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[w]);const D=s&&`width: ${s.width}px; height: ${s.height}px`,U=`background-image: url(${n})`;return a.ZP.createElement("div",{className:"VideoPlayer",onClick:!t&&f.wB?x:void 0,onMouseOver:t||f.$b?void 0:M,onMouseOut:t||f.$b?void 0:T},a.ZP.createElement("div",{style:D},a.ZP.createElement("video",te({ref:d,autoPlay:f.$b,playsInline:!0,loop:t,muted:t,id:"media-viewer-video",style:U,onPlay:f.cj?()=>u(!0):void 0,onEnded:A,onClick:f.wB?void 0:w,onDoubleClick:F},I,{onTimeUpdate:L}),e&&a.ZP.createElement("source",{src:e}))),k&&a.ZP.createElement(R.Z,{round:!0,className:`play-button ${S}`,onClick:w},a.ZP.createElement("i",{className:"icon-play"})),y&&a.ZP.createElement("div",{className:["spinner-container",N].join(" ")},!C&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement($.Z,{size:"xl",progress:C?1:r,square:!0,onClick:c})),!t&&!y&&a.ZP.createElement(ee,{isPlayed:m,bufferedProgress:b,currentTime:h,isFullscreenSupported:Boolean(p),isFullscreen:g,fileSize:o,duration:d.current&&d.current.duration||0,isForceVisible:v,isForceMobileVersion:s&&s.width<400,onSeek:B,onChangeFullscreen:F,onPlayPause:w}))})),ae=(0,a.X$)((0,s.c$)(((e,t)=>{const{chatId:n,threadId:a,messageId:s,avatarOwnerId:r,profilePhotoIndex:i,origin:l}=t;if(l===o.bZ.SearchResult){if(!n||!s)return{};const t=(0,g.hj)(e,n,s);return t?{chatId:n,messageId:s,senderId:t.senderId,origin:l,message:t,isProtected:(0,g.EV)(e,t)}:{}}if(r)return{messageId:-1,senderId:r,avatarOwner:(0,g.dy)(e,r)||(0,g.Z1)(e,r),profilePhotoIndex:i||0,origin:l};if(!(n&&a&&s))return{};let c;return c=l&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(l)?(0,g.Tm)(e,n,s):(0,g.hj)(e,n,s),c?{chatId:n,threadId:a,messageId:s,senderId:c.senderId,origin:l,message:c,isProtected:(0,g.EV)(e,c)}:{}}))((e=>{const{messageId:t,isActive:n,avatarOwner:s,chatId:i,message:c,profilePhotoIndex:d,origin:m,animationLevel:u,onClose:v,onFooterClick:g,isFooterHidden:p,isProtected:E}=e,C=c?(0,P.O$)(c):void 0,b=c?(0,P.b7)(c):void 0,k=c?(0,P.F$)(c):void 0,S=c?(0,P.Cg)(c):void 0,w=!!c&&(0,P.rl)(c),M=!!c&&(0,P.hC)(c),T=Boolean(b||S||M),R=Boolean(!T&&(C||k||w)),{isGif:L}=b||S||{},A=Boolean(s||t),F=Boolean(s),B=m===o.bZ.SharedMedia,$=m===o.bZ.SearchResult,x=2===u;function D(e){if(F&&void 0!==d){const{photos:t}=s;return t&&t[d]?`photo${t[d].id}?size=c`:(0,P.RT)(s,e?"big":"normal")}return c&&(0,P.Ti)(c,e?"viewerFull":"viewerPreview")}const U=(0,h.Z)(c&&(B||$)&&(0,P.Ti)(c,"pictogram"),void 0,r.IU.BlobUrl,void 0,x&&350),O=D(),G=(0,h.Z)(O,void 0,r.IU.BlobUrl,void 0,x&&350),{mediaData:X,loadProgress:_}=(0,Z.Z)(D(!0),void 0,c&&(0,P.kG)(c,"viewerFull"),void 0,x&&350),Y=C||b?(C||b).blobUrl:void 0;let H=!T&&(Y||X)||G||U;const V=(0,l.Z)(!H&&c&&(0,P.DH)(c));H||m===o.bZ.SearchResult||(H=V);const j=c?(0,P.c0)(c):void 0;let q;if(c?w||M?q=(0,P.aE)(c).mediaSize:C||k?q=(0,P.bV)(C||k):(b||S)&&(q=(0,P.jC)(b||S)):q=I.vY,F)return a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},se(X||G,(0,I.PA)(I.vY,!1),!f.wB&&!E));if(!c)return;const K=(0,y.X2)(c),W=Boolean(K);return a.ZP.createElement("div",{className:"MediaViewerContent "+(W?"has-footer":"")},E&&a.ZP.createElement("div",{onContextMenu:N.Z,className:"protector"}),R&&se(Y||X||G||U,c&&(0,I.PA)(q,W),!f.wB&&!E),T&&(n?a.ZP.createElement(ne,{key:t,url:Y||X,isGif:L,posterData:H,posterSize:c&&(0,I.PA)(q,W,!1),loadProgress:_,fileSize:j,isMediaViewerOpen:A&&n,noPlay:!n,onClose:v}):function(e,t,n){const s=t&&`width: ${t.width}px; height: ${t.height}px`,r=`background-image: url(${e})`;return e?a.ZP.createElement("div",{className:"VideoPlayer"},a.ZP.createElement("div",{style:s},a.ZP.createElement("video",{style:r,draggable:Boolean(n)}))):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(J.Z,{color:"white"}))}(H,c&&(0,I.PA)(q,W,!1),!f.wB&&!E)),K&&a.ZP.createElement(z,{text:K,onClick:g,isHidden:p,isForVideo:T&&!L}))})));function se(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(J.Z,{color:"white"}))}function re(){return(re=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}).apply(this,arguments)}const oe=350;let ie;var le;!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(le||(le={}));const ce=(0,a.X$)((({messageId:e,getMessageId:t,selectMessage:n,isVideo:s,isGif:r,isPhoto:o,isOpen:i,isActive:l,hasFooter:d,...m})=>{const u=(0,a.sO)(null),h=(0,a.sO)(null),Z=(0,a.sO)({x:0,y:0,scale:1}),v=(0,a.sO)(void 0),P=(0,a.sO)(!0),[g,p]=(0,a.eJ)(e),E=(0,c.Z)(),[b,I]=(0,a.eJ)(!0),{isZoomed:y,onClose:N}=m,k=(0,a.I4)((e=>{Z.current=e,E()}),[E]),S=(0,a.I4)((e=>{P.current=e,E()}),[E]),w=(0,D.Z)(350,!0),M=(0,D.Z)(500,!0),T=(0,D.Z)(800,!0),R=(0,a.I4)((e=>{f.$b&&d&&(o||r)&&(e.pageX<40||e.pageX>window.innerWidth-40||I(!b))}),[d,b,r,o]);if(function(e,t){const n=(0,a.sO)(e);(0,a.bt)((()=>{n.current=e}),[e]),(0,a.d4)((()=>{if("number"!=typeof t)return;const e=setTimeout((()=>n.current()),t);return()=>clearTimeout(e)}),[t])}((()=>I(!1)),200),(0,a.d4)((()=>{if(!f.$b||!u.current||y||!g)return;let e={x:0,y:0,scale:1};const a={x:0,y:0},s={x:0,y:0},r={x:0,y:0};let o,i,l=Date.now();const c=(0,G.Ds)((()=>{l=Date.now()}),500,!1,!0),d=a=>{if(1!==Z.current.scale)return!1;let s=0;a.pageX<40?s=-1:a.pageX>window.innerWidth-40&&(s=1);const r=t(g,s);if(r){const t=(window.innerWidth+40)*s;Z.current.x+=t,P.current=!1,p(r),w((()=>n(r))),T((()=>{S(!0)})),e={x:0,y:0,scale:1},ie=(0,U.vr)({from:Z.current.x,to:0,duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>k({y:0,x:e,scale:1})})}return 0!==s};return(0,C.sf)(u.current,{isNotPassive:!0,excludedClosestSelector:".VideoPlayerControls, .MediaViewerFooter",onCapture:()=>{if(l=Date.now(),(0,O.Z)(Z.current,{x:0,y:0,scale:1})){if(!h.current)return;if(i=h.current.querySelector("img, video"),!i)return;o=i.getBoundingClientRect()}},onDrag:(t,n,{dragOffsetX:s,dragOffsetY:o})=>{if(f.cj){const{pageX:e}=n.touches[0];if(e<=C.vJ||e>=window.innerWidth-C.vJ)return}ie&&(ie(),ie=void 0),r.x=a.x-s,r.y=a.y-o,a.x=s,a.y=o;const i=Math.abs(s),l=Math.abs(o),{scale:d,x:m,y:u}=Z.current,h=10;if(c(),1===d)return v.current!==le.Vertical&&(v.current===le.Horizontal||Math.abs(m)>h||i>h&&l<h)?(v.current=le.Horizontal,P.current=!1,void k({x:s,y:0,scale:d})):void((v.current===le.Vertical||Math.abs(u)>h||l>h&&i<h)&&(v.current=le.Vertical,k({x:0,y:o,scale:d})));"touches"in t&&1===t.touches.length&&k({x:e.x+s,y:e.y+o,scale:d})},onZoom:(t,{zoomFactor:n,initialCenterX:a,initialCenterY:r,dragOffsetX:o,dragOffsetY:i,currentCenterX:l,currentCenterY:c})=>{const d=Math.min(12,Math.max(e.scale*n,.6)),m=d/e.scale,u=Math.abs(Math.min(e.x,0))+a,h=Math.abs(Math.min(e.y,0))+r;s.x=l,s.y=c;const Z=u-m*u,v=h-m*h;k({x:e.x+Z+o,y:e.y+v+i,scale:d})},onClick(e){d(e)&&(e.preventDefault(),e.stopPropagation())},onDoubleClick(t,{centerX:n,centerY:a}){if(d(t))return t.preventDefault(),void t.stopPropagation();const s=n-3*n,r=a-3*a,{scale:o,x:i,y:l}=Z.current;if(1===o){if(0!==i||0!==l)return;e={x:s,y:r,scale:3}}else e={x:0,y:0,scale:1};return(0,U.vr)({from:[i,l,o],to:[e.x,e.y,e.scale],duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>k({x:e[0],y:e[1],scale:e[2]})})},onRelease:()=>{const c=Math.abs(Z.current.x),d=Math.abs(Z.current.y),{scale:m,x:u,y:h}=Z.current;if(M((()=>{v.current=void 0})),T((()=>{S(!0)})),m<1)return e={x:0,y:0,scale:1},(0,U.vr)({from:[u,h,m],to:[0,0,1],duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>k({x:e[0],y:e[1],scale:e[2]})});if(m>1){if(!i||!o)return void(e={x:u,y:h,scale:m});const t=i.getBoundingClientRect(),n=Math.min(m,4),c=n/m;let d=u*c+(s.x-c*s.x),Z=h*c+(s.y-c*s.y);const v=.15;if(e.scale===m){const e=Math.abs(a.x)/(Date.now()-l),t=Math.abs(a.y)/(Date.now()-l);d-=Math.abs(a.x)*e*v*r.x,Z-=Math.abs(a.y)*t*v*r.y}if(t.width>window.innerWidth){const e=-o.left*n,t=window.innerWidth-o.right*n;d=Math.min(e,Math.max(t,d))}else d=(window.innerWidth-window.innerWidth*n)/2;if(t.height>window.innerHeight){const e=-o.top*n,t=window.innerHeight-o.bottom*n;Z=Math.min(e,Math.max(t,Z))}else Z=(window.innerHeight-window.innerHeight*n)/2;return e={x:d,y:Z,scale:n},void(ie=(0,U.vr)({from:[u,h,m],to:[d,Z,n],duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>k({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:u,y:h,scale:m},d>=50)return N();if(d>0)return(0,U.vr)({from:h,to:0,duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>k({x:0,y:e,scale:m})});const P=u<0?1:-1,E=t(g,u<0?1:-1),C=r.x<0?-1:1;if(E&&c>=50&&P===C){const e=(window.innerWidth+40)*P;Z.current.x+=e,p(E),w((()=>n(E)))}ie=(0,U.vr)({from:Z.current.x,to:0,duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>k({y:0,x:e,scale:Z.current.scale})})}})}),[y,N,k,t,g,S]),!g)return;const L=t(g,1),A=t(g,-1),F=Z.current.x,B=Z.current.y,{scale:$}=Z.current;return a.ZP.createElement("div",{className:"MediaViewerSlides",ref:u},A&&1===$&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:de(-window.innerWidth+F-40)},a.ZP.createElement(ae,re({},m,{messageId:A,isFooterHidden:b}))),g&&a.ZP.createElement("div",{className:"MediaViewerSlide "+(l?"MediaViewerSlide--active":""),onClick:R,ref:h,style:de(F,B,$)},a.ZP.createElement(ae,re({},m,{messageId:g,isActive:P.current,isFooterHidden:b||y||1!==$}))),L&&1===$&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:de(window.innerWidth+F+40)},a.ZP.createElement(ae,re({},m,{messageId:L,isFooterHidden:b}))))}));function de(e=0,t=0,n=1){return`transform: translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${n.toFixed(3)});`}var me=n(782);const ue=[1,0,0,1,0,0],he={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5},Ze=150,ve=(0,a.X$)((({children:e,className:t,noWrap:n,canPan:s,zoomLevel:r,panDeltaX:o,panDeltaY:i,onPan:l})=>{const c=he[r]||r,[d,m]=(0,a.eJ)(!1),[u,h]=(0,a.eJ)({dx:o,dy:i,x:0,y:0}),[Z,v]=(0,a.eJ)(ue),P=(0,a.sO)(null),g=(0,a.sO)(null);return(0,a.d4)((()=>{const e=c||Z[0],t=o||Z[4],n=i||Z[5],a=[...Z];Z[0]!==e&&(a[0]=e||a[0],a[3]=e||a[3]),Z[4]!==t&&(a[4]=t),Z[5]!==n&&(a[5]=n),(0,me.et)(Z,a)||v(function(e,t,n){const a=n&&n.querySelector(".Transition__slide--active img");if(!n||!a)return t;const s=n.getBoundingClientRect(),r=a.getBoundingClientRect(),o=r.width/e*t[0],i=r.height/e*t[3],l=(s.width-o)/2+t[4],c=(s.height-i)/2+t[5];return s.width&&s.width-Ze<l?t[4]-=l+s.width-Ze:o&&o+l<Ze&&(t[4]-=o+l-Ze),s.height&&s.height-Ze<c?t[5]-=c+s.height-Ze:i&&i+c<Ze&&(t[5]-=i+c-Ze),t}(Z[0],a,P.current))}),[o,i,c]),(0,a.d4)((()=>{s||v(ue)}),[s]),(0,a.d4)((()=>{g.current&&(g.current.style.transform=`matrix(${Z.toString()})`)}),[n,Z]),n?e:a.ZP.createElement("div",{ref:P,className:`pan-wrapper ${t||""}`,onMouseDown:e=>{if(!s)return;e.stopPropagation(),e.preventDefault();const t={dx:Z[4],dy:Z[5],x:e.pageX,y:e.pageY};h(t),m(!0),P.current&&P.current.classList.add("move")},onMouseUp:()=>{m(!1),P.current&&P.current.classList.remove("move"),l&&l(Z[4],Z[5])},onMouseMove:e=>{if(d){const t=function(e,t){const n=[...Z],a=u.x-e,s=u.y-t;return n[4]=u.dx-a,n[5]=u.dy-s,n}(e.pageX,e.pageY);v(t),g.current&&(g.current.style.transform=`matrix(${Z.toString()})`)}}},a.ZP.createElement("div",{ref:g,className:"pan-container"},e))}));var Pe=n(2340),ge=n(172);const pe=(0,s.c$)(((e,{chatId:t,messageId:n,isAvatar:a})=>{if(a&&t)return{sender:(0,P.YC)(t)?(0,g.dy)(e,t):(0,g.Z1)(e,t)};if(!n||!t)return{};const s=(0,g.hj)(e,t,n);return{message:s,sender:s&&(0,g.Ur)(e,s)}}))((({chatId:e,messageId:t,sender:n,isAvatar:r,message:o})=>{const{closeMediaViewer:i,focusMessage:l}=(0,s.uC)(),c=(0,a.I4)((()=>{i(),l({chatId:e,messageId:t})}),[e,l,t,i]),d=(0,u.Z)();if(!n||!o&&!r)return;const m=(0,P.OU)(d,n);return a.ZP.createElement("div",{className:"SenderInfo",onClick:c},(0,P.YC)(n.id)?a.ZP.createElement(ge.Z,{key:n.id,size:"medium",user:n}):a.ZP.createElement(ge.Z,{key:n.id,size:"medium",chat:n}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},m&&(0,Pe.Z)(m)),a.ZP.createElement("div",{className:"date",dir:"auto"},r?d("lng_mediaview_profile_photo"):(0,q.ZK)(d,1e3*o.date,!0))))})),Ee=({children:e,...t})=>f.$b?e(!0,!0,1):a.ZP.createElement(A.Z,t,e),Ce=(0,a.X$)((({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:n}=(0,_.Z)(e),s=(0,v.Z)(e),r=(0,a.sO)(null),[o,i]=(0,a.eJ)(1),l=(0,a.sO)(!1);(0,a.d4)((()=>{e&&!s&&i(1.5)}),[e,s]);const c=(0,a.I4)((()=>{l.current=!0}),[]),d=(0,a.I4)((()=>{l.current=!1,1===o&&t(o,!l.current)}),[t,o]);(0,a.d4)((()=>{t(o,!l.current)}),[o,t]);const m=(0,u.Z)(),h=(0,X.Z)("ZoomControls",n);return a.ZP.createElement("div",{className:h},a.ZP.createElement(R.Z,{disabled:1===o,size:"tiny",color:"translucent-white",ariaLabel:m("ZoomOut"),className:"zoom-out",ripple:!f.wB,onClick:()=>{r.current&&i(Math.max(1,o-.5))}},a.ZP.createElement("i",{className:"icon-zoom-out"})),a.ZP.createElement(R.Z,{disabled:3===o,size:"tiny",color:"translucent-white",ariaLabel:"Zoom In",className:"zoom-in",ripple:!f.wB,onClick:()=>{r.current&&i(Math.min(3,o+.5))}},a.ZP.createElement("i",{className:"icon-zoom-in"})),a.ZP.createElement("div",{className:"seekline"},a.ZP.createElement("div",{className:"seekline-track"},a.ZP.createElement("div",{className:"seekline-played",style:`width: ${50*(o-1)}%`}),a.ZP.createElement("input",{ref:r,min:1,max:3,step:"0.5",value:o,type:"range",className:"seekline-input",onChange:e=>{i(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown:c,onMouseUp:d}))))})),fe=350,be=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n,messageId:a,avatarOwnerId:s,profilePhotoIndex:r,origin:i}=e.mediaViewer,{animationLevel:l}=e.settings.byKey;if(i===o.bZ.SearchResult){if(!t||!a)return{animationLevel:l};const n=(0,g.hj)(e,t,a);return n?{chatId:t,messageId:a,senderId:n.senderId,origin:i,message:n,animationLevel:l}:{animationLevel:l}}if(s)return{messageId:-1,senderId:s,avatarOwner:(0,g.dy)(e,s)||(0,g.Z1)(e,s),profilePhotoIndex:r||0,animationLevel:l,origin:i};if(!(t&&n&&a))return{animationLevel:l};let c,d,m;if(c=i&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(i)?(0,g.Tm)(e,t,a):(0,g.hj)(e,t,a),!c)return{animationLevel:l};if(d=i&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(i)?(0,g.Fn)(e,t):(0,g.Zw)(e,t),i===o.bZ.Inline||i===o.bZ.Album)m=(0,g.qC)(e,t,n)||(0,g.gb)(e,t,n);else if(i===o.bZ.SharedMedia){const t=(0,g.we)(e),{foundIds:n}=t&&t.resultsByType&&t.resultsByType.media||{};m=n}return{chatId:t,threadId:n,messageId:a,senderId:c.senderId,origin:i,message:c,chatMessages:d,collectionIds:m,animationLevel:l}}))((({chatId:e,threadId:t,messageId:n,senderId:g,origin:N,avatarOwner:F,profilePhotoIndex:B,message:$,chatMessages:D,collectionIds:U,animationLevel:O})=>{const{openMediaViewer:G,closeMediaViewer:J,openForwardMenu:X,focusMessage:z}=(0,s.uC)(),_=Boolean(F||n),Y=N===o.bZ.SharedMedia,H=N===o.bZ.SearchResult,V=$?(0,P.O$)($):void 0,j=$?(0,P.b7)($):void 0,q=$?(0,P.F$)($):void 0,K=$?(0,P.Cg)($):void 0,W=!!$&&(0,P.rl)($),Q=!!$&&(0,P.hC)($),ee=Boolean(j||K||Q),{isGif:te}=j||K||{},ne=Boolean(!ee&&(V||q||W)),ae=Boolean(F),se=q||K?n:void 0,re=(0,a.Ye)((()=>se?[se]:(0,P.N0)(D||{},U||[],Y)),[se,D,U,Y]),oe=n?re.indexOf(n):-1,ie=0===oe||-1===oe,le=oe===re.length-1||-1===oe,de=(0,a.sO)(),me=(0,v.Z)(g);!_||me&&me===g&&de.current||(de.current=oe);const ue=O>=1&&!f.$b?"mv-slide":"none",he=2===O?"slide-fade":"none",Ze=2===O,[Pe,ge]=(0,a.eJ)(!1),[be,Ie]=(0,a.eJ)(!1),[ye,Ne]=(0,a.eJ)(1),[ke,Se]=(0,a.eJ)({x:0,y:0});function we(e){if(ae&&void 0!==B){const{photos:t}=F;return t&&t[B]?`photo${t[B].id}?size=c`:(0,P.RT)(F,e?"big":"normal")}return $&&(0,P.Ti)($,e?"viewerFull":"viewerPreview")}const Me=(0,h.Z)($&&(Y||H)&&(0,P.Ti)($,"pictogram"),void 0,r.IU.BlobUrl,void 0,Ze&&fe),Te=we(),Re=(0,h.Z)(Te,void 0,r.IU.BlobUrl,void 0,Ze&&fe),{mediaData:Le}=(0,Z.Z)(we(!0),void 0,$&&(0,P.kG)($,"viewerFull"),void 0,Ze&&fe),Ae=V||j?(V||j).blobUrl:void 0;let Fe=!ee&&(Ae||Le)||Re||Me;const Be=(0,l.Z)(!Fe&&$&&(0,P.DH)($));Fe||N===o.bZ.SearchResult||(Fe=Be);const $e=$?(0,P.ep)($):ae?`avatar${F.id}-${B}.jpg`:void 0;let xe;$?W||Q?xe=(0,P.aE)($).mediaSize:V||q?xe=(0,P.bV)(V||q):(j||K)&&(xe=(0,P.jC)(j||K)):xe=I.vY,(0,a.d4)((()=>{f.wB&&document.body.classList.toggle("is-media-viewer-open",_)}),[_]);const De=(0,c.Z)();(0,a.d4)((()=>{const e=window.matchMedia(I.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 Ue=(0,v.Z)($),Oe=(0,v.Z)(N),Ge=(0,v.Z)(F),Je=(0,v.Z)(Fe),Xe=$?(0,y.X2)($):void 0,ze=Boolean(Xe);(0,a.d4)((()=>{Ze&&_&&!Ue&&!Ge&&((0,d.YW)(fe+i.fK),function(e,t,n,a,s,r){const{mediaEl:l}=M(t,r);if(!l)return;const{width:c}=b.Z.get(),{width:d,height:m}=(0,I.fM)(e,s),{width:u,height:h}=(0,I.jg)(d,m,a.width,a.height),Z=(c-u)/2,v=function(e){const t=window.matchMedia(I.L6);let n=4.125;return e&&!f.$b&&(n+=t.matches?.875:2.125),n*I.Gw}(e)+(m-h)/2;let{top:P,left:g,width:p,height:E}=l.getBoundingClientRect();if([o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,r){if(e===t){const o=Math.max(s,r)*(e/t);a-=(o-s)/2,n-=(o-r)/2,s=o,r=o}else if(e>t){const n=s;a-=((s=r*(e/t))-n)/2}else if(t>e){const a=r;n-=((r=s*(t/e))-a)/2}return{top:n,left:a,width:s,height:r}}(u,h,P,g,p,E);P=e.top,g=e.left,p=e.width,E=e.height}const C=g+p/2-(Z+u/2),y=P+E/2-(v+h/2),N=p/u,S=E/h,R=k(n||l);w(R,{top:`${v}px`,left:`${Z}px`,width:`${u}px`,height:`${h}px`,transform:`translate3d(${C}px, ${y}px, 0) scale(${N}, ${S})`}),T(R,t),document.body.classList.add("ghost-animating"),requestAnimationFrame((()=>{document.body.appendChild(R),requestAnimationFrame((()=>{R.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(R),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(R)&&document.body.removeChild(R),document.body.classList.remove("ghost-animating")}))}),200+i.fK)}))}))}(ze,N,Fe,xe,ee,$)),Ze&&!_&&(Ue||Ge)&&((0,d.YW)(fe+i.fK),function(e,t,n){const{container:a,mediaEl:s}=M(e,n);if(!s)return;const r=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!r||!s)return;const{top:l,left:c,width:d,height:m}=r.getBoundingClientRect(),{top:u,left:h,width:Z,height:v}=s.getBoundingClientRect();let P=u;if(!function(e){if("none"===e.style.display)return!1;const t=e.getBoundingClientRect(),{height:n}=b.Z.get();return t.top<=n&&t.top+t.height>=0}(a)){const{height:e}=b.Z.get();P=u<l?-v:e}const g=c+d/2-(h+Z/2),p=l+m/2-(P+v/2);let E=d/Z,C=m/v;const f=[o.bZ.Inline,o.bZ.ScheduledInline].includes(e)&&!S(a,s)||[o.bZ.Album,o.bZ.ScheduledAlbum].includes(e)&&!S(a,s);[o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(e)&&(E>C?E=C:C>E&&(C=E));const I=document.getElementsByClassName("ghost")[0],y=I||k(t||s,e);I||w(y,{top:`${P}px`,left:`${h}px`,width:`${Z}px`,height:`${v}px`,transform:`translate3d(${g}px, ${p}px, 0) scale(${E}, ${C})`}),requestAnimationFrame((()=>{if(I){const{top:e,left:t,width:n,height:a}=I.getBoundingClientRect();w(y,{transition:"none",top:`${P}px`,left:`${h}px`,transformOrigin:"top left",transform:`translate3d(${t-h}px, ${e-P}px, 0) scale(${n/Z}, ${a/v})`,width:`${Z}px`,height:`${v}px`})}document.body.classList.add("ghost-animating"),I||document.body.appendChild(y),requestAnimationFrame((()=>{I&&(I.style.transition=""),y.style.transform="",f&&(y.style.opacity="0"),T(y,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(y)&&document.body.removeChild(y),document.body.classList.remove("ghost-animating")}))}),200+i.fK)}))}))}(Oe,Je,Ue||void 0))}),[Ze,_,N,Oe,$,Ue,Ge,Fe,Je,xe,ee,ze]),(0,a.d4)((()=>{let e;return be?ge(!0):e=window.setTimeout((()=>{ge(!1)}),fe),()=>{e&&window.clearTimeout(e)}}),[be]);const _e=()=>{Ie(!1),Ne(1),Se({x:0,y:0})},Ye=(0,a.I4)((()=>{Ie(!be),Ne(be?1:1.5),be&&Se({x:0,y:0})}),[be]),He=(0,a.I4)(((e,t=!1)=>{Ne(e),1===e&&t&&_e()}),[]),Ve=(0,a.I4)((()=>{J(),_e()}),[J]),je=(0,a.I4)((()=>{Ve(),z({chatId:e,threadId:t,messageId:n})}),[Ve,e,t,z,n]),qe=(0,a.I4)((()=>{X({fromChatId:e,messageIds:[n]}),_e()}),[X,e,n]),Ke=(0,a.I4)((n=>G({chatId:e,threadId:t,messageId:n,origin:N},{forceOnHeavyAnimation:!0})),[e,G,N,t]);(0,a.d4)((()=>_?(0,E.Z)((()=>{be?_e():Ve()})):void 0),[Ve,_,be]),(0,a.d4)((()=>{ee&&!te&&(0,p.Es)()}),[te,ee]),(0,a.d4)((()=>{if(_)return b.Z.disableRefresh(),()=>{b.Z.enableRefresh()}}),[_]);const We=(0,a.I4)(((e,t)=>{if(!e)return;const n=re.indexOf(e);return-1===t&&n>0||1===t&&n<re.length-1?re[n+t]:void 0}),[re]),Qe=We(n,1),et=We(n,-1),tt=(0,a.I4)(((e,t)=>{Se({x:e,y:t})}),[]),nt=(0,u.Z)();function at(){return ae?a.ZP.createElement(pe,{key:F.id,chatId:F.id,isAvatar:!0}):a.ZP.createElement(pe,{key:n,chatId:e,messageId:n})}return(0,m.ZP)(_,J,G,{chatId:e,threadId:t,messageId:n,origin:N,avatarOwnerId:F&&F.id}),(0,a.d4)((()=>{if(_)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){switch(e.key){case"Left":case"ArrowLeft":Ke(et);break;case"Right":case"ArrowRight":Ke(Qe)}}}),[_,Qe,et,Ke]),(0,a.d4)((()=>{if(be||f.$b)return;const e=document.querySelector(".MediaViewerSlide--active");if(!e)return;const t=te&&!f.cj;return(0,C.sf)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .Spoiler, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:Ve})}),[Ve,te,be,n]),a.ZP.createElement(L.Z,{id:"MediaViewer",className:be?"zoomed":"",isOpen:_},(()=>a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"media-viewer-head",dir:nt.isRtl?"rtl":void 0},f.wB&&a.ZP.createElement(R.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:nt("Close"),onClick:Ve},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(A.Z,{activeKey:de.current,name:he},at),a.ZP.createElement(x,{mediaData:Le||Re,isVideo:ee,isZoomed:be,message:$,fileName:$e,onCloseMediaViewer:Ve,onForward:qe,onZoomToggle:Ye,isAvatar:ae})),a.ZP.createElement(ve,{noWrap:!Pe,canPan:be,panDeltaX:ke.x,panDeltaY:ke.y,zoomLevel:ye,onPan:tt},a.ZP.createElement(Ee,{activeKey:oe,name:ue},(s=>a.ZP.createElement(ce,{messageId:n,getMessageId:We,chatId:e,isPhoto:ne,isGif:te,threadId:t,avatarOwnerId:F&&F.id,profilePhotoIndex:B,origin:N,isOpen:_,hasFooter:ze,isZoomed:be,isActive:s,isVideo:ee,animationLevel:O,onClose:Ve,selectMessage:Ke,onFooterClick:je})))),!ie&&!f.$b&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${ee&&!te&&"inline"}`,"aria-label":nt("AccDescrPrevious"),dir:nt.isRtl?"rtl":void 0,onClick:()=>Ke(et)}),!le&&!f.$b&&a.ZP.createElement("button",{type:"button",className:`navigation next ${ee&&!te&&"inline"}`,"aria-label":nt("Next"),dir:nt.isRtl?"rtl":void 0,onClick:()=>Ke(Qe)}),a.ZP.createElement(Ce,{isShown:be,onChangeZoom:He}))))})));var Ie=n(8360),ye=n(7407),Ne=n(2313),ke=n(2515),Se=n(4288),we=n(3103),Me=n(7687),Te=n(1273),Re=n(1876),Le=n(8799),Ae=n(6058);const Fe=(0,a.X$)((({isOpen:e,currentUserId:t,chatOrUserIds:n,filterRef:s,filter:r,filterPlaceholder:o,onFilterChange:i,onClose:l,loadMore:c,onSelectChatOrUser:d})=>{const m=(0,u.Z)(),[h,Z]=(0,ye.Z)(c,n,Boolean(r)),v=(0,a.I4)((()=>{i("")}),[i]);(0,ke.Z)(s,e,v);const g=(0,a.sO)(null),p=(0,a.I4)((e=>{i(e.currentTarget.value)}),[i]),E=(0,Ne.Z)(g,e,(e=>{h&&h.length>0&&d(h[-1===e?0:e])}),".ListItem-button",!0),C=a.ZP.createElement("div",{className:"modal-header",dir:m.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:l},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Me.Z,{ref:s,value:r,onChange:p,onKeyDown:E,placeholder:o}));return a.ZP.createElement(we.Z,{isOpen:e,onClose:l,className:"ChatOrUserPicker",header:C},null!=h&&h.length?a.ZP.createElement(Te.Z,{className:"picker-list custom-scroll",items:h,onLoadMore:Z,noScrollRestore:Boolean(r),ref:g,onKeyDown:E},h.map((e=>a.ZP.createElement(Re.Z,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>d(e)},(0,P.YC)(e)?a.ZP.createElement(Ae.Z,{status:e===t?m("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(Le.Z,{chatId:e}))))):h&&!h.length?a.ZP.createElement("p",{className:"no-results"},m("lng_blocked_list_not_found")):a.ZP.createElement(Se.Z,null))})),Be=(0,a.X$)((0,s.c$)((e=>{var t;const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:r}=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:r}}))((({chatsById:e,activeListIds:t,archivedListIds:n,pinnedIds:o,contactIds:i,currentUserId:l,isOpen:c})=>{const{setForwardChatId:d,exitForwardMode:m,loadMoreChats:h}=(0,s.uC)(),Z=(0,u.Z)(),[v,g]=(0,a.eJ)(""),p=(0,a.sO)(null),E=(0,a.Ye)((()=>{if(!c)return;let a=o||[];l&&(a=(0,me.Tw)([l,...a]));const d=[...t||[],...n||[]].filter((t=>{const n=e[t];return n&&(0,P.Qm)(n,r._f)})),m=(0,s.Rd)().users.byId;return(0,P.ih)((0,me.Tw)([...(0,P.$l)(Z,d,e,v,l),...i?(0,P.kK)(i,m,v):[]]),e,void 0,a)}),[t,n,e,i,l,v,c,Z,o]),C=(0,a.I4)((e=>{d({id:e})}),[d]),f=(0,Ie.Z)(E);return a.ZP.createElement(Fe,{currentUserId:l,isOpen:c,chatOrUserIds:f,filterRef:p,filterPlaceholder:Z("ForwardTo"),filter:v,onFilterChange:g,loadMore:h,onSelectChatOrUser:C,onClose:m})})));var $e=n(1947),xe=n(706);function De(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const Ue=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["dialogs"])))((({dialogs:e})=>{const{dismissDialog:t,acceptInviteConfirmation:n,sendMessage:r}=(0,s.uC)(),[o,i,l]=(0,xe.Z)(),c=(0,u.Z)();var d,m,h;if((0,a.d4)((()=>{e.length>0&&i()}),[e,i]),e.length)return a.ZP.createElement("div",{id:"Dialogs"},Boolean(e.length)&&("hash"in(d=e[e.length-1])?(e=>{const{hash:s,title:r,about:i,participantsCount:d,isChannel:m,photo:u,isRequestNeeded:h}=e,v=c(m?"Subscribers":"Members",d,"i"),P=c(m?"ChannelJoin":"JoinGroup"),g=c(m?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup");return a.ZP.createElement(we.Z,{isOpen:o,onClose:l,className:"error",header:Z(r,u),onCloseAnimationEnd:t},i&&a.ZP.createElement("p",{className:"modal-about"},(0,Pe.Z)(i)),void 0!==d&&a.ZP.createElement("p",null,v),h&&a.ZP.createElement("p",{className:"modal-help"},c(m?"MemberRequests.RequestToJoinDescriptionChannel":"MemberRequests.RequestToJoinDescriptionGroup")),a.ZP.createElement(R.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{n({hash:s}),l()}},h?g:P),a.ZP.createElement(R.Z,{isText:!0,className:"confirm-dialog-button",onClick:l},c("Cancel")))})(d):"phoneNumber"in d?(m=d,a.ZP.createElement(we.Z,{isOpen:o,onClose:l,className:"confirm",title:c("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:t},c("AreYouSureShareMyContactInfoBot"),a.ZP.createElement("div",null,a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:()=>{r({contact:(0,me.ei)(m,["firstName","lastName","phoneNumber"])}),l()}},c("OK")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:l},c("Cancel"))))):(h=d,a.ZP.createElement(we.Z,{isOpen:o,onClose:l,onCloseAnimationEnd:t,className:"error",title:De(h)},h.hasErrorKey?(0,$e.ZP)(h):(0,Pe.Z)(h.message,["emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement(R.Z,{isText:!0,onClick:l},c("OK")))))));function Z(e,t){return a.ZP.createElement("div",{className:"modal-header"},t&&a.ZP.createElement(ge.Z,{size:"small",photo:t}),a.ZP.createElement("div",{className:"modal-title"},(0,Pe.Z)(e)),a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:c("Close"),onClick:l},a.ZP.createElement("i",{className:"icon-close"})))}})));var Oe=n(6937);const Ge=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["notifications"])))((({notifications:e})=>{const{dismissNotification:t}=(0,s.uC)();if(e.length)return a.ZP.createElement("div",{id:"Notifications"},e.map((({message:e,localId:n})=>a.ZP.createElement(Oe.Z,{message:(0,Pe.Z)(e,["emoji","br","links","simple_markdown"]),onDismiss:()=>t({localId:n})}))))})));var Je=n(1396),Xe=n(7551);const ze=(0,a.X$)((({url:e})=>{const{toggleSafeLinkModal:t}=(0,s.uC)(),n=(0,u.Z)(),r=(0,a.I4)((()=>{window.open((0,Je.X)(e)),t({url:void 0})}),[t,e]),o=(0,a.I4)((()=>{t({url:void 0})}),[t]),i=(0,Ie.Z)(e);return a.ZP.createElement(Xe.Z,{isOpen:Boolean(e),onClose:o,title:n("OpenUrlTitle"),textParts:(0,Pe.Z)(n("OpenUrlAlert2",i),["links"]),confirmLabel:n("OpenUrlTitle"),confirmHandler:r})})),_e=2147483647e3,Ye=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function He(e,t,n,a,s){const r=new Date(e,t,n),o=a&&(0,q.$Y)(a),i=s&&(0,q.$Y)(s);return!!(i&&r>i)||!!(o&&r<o)}function Ve(e){return String(e).padStart(2,"0")}function je(e,t,n){return`${e}-${t+1}-${n}`}const qe=(0,a.X$)((({selectedAt:e,minAt:t,maxAt:n,isFutureMode:s,isPastMode:r,isOpen:o,withTimePicker:i,submitButtonLabel:l,secondButtonLabel:c,onClose:d,onSubmit:m,onSecondButtonClick:h})=>{const Z=(0,u.Z)(),P=new Date,g=(0,a.Ye)((()=>s&&!t?new Date:new Date(Math.max(t||0,0))),[s,t]),p=(0,a.Ye)((()=>r&&!n?new Date:new Date(Math.min(n||_e,_e))),[r,n]),E=(0,a.Ye)((()=>e?new Date(e):new Date),[e]),C=(0,v.Z)(o),[f,b,I]=(0,xe.Z)(!1),[y,N]=(0,a.eJ)(E),[k,S]=(0,a.eJ)(new Date(y.getFullYear(),y.getMonth(),1)),[w,M]=(0,a.eJ)(Ve(E.getHours())),[T,L]=(0,a.eJ)(Ve(E.getMinutes())),A=je(y.getFullYear(),y.getMonth(),y.getDate()),F=k.getFullYear(),B=k.getMonth();(0,a.d4)((()=>{!C&&o&&(N(E),S(new Date(E.getFullYear(),E.getMonth(),1)),i&&(M(Ve(E.getHours())),L(Ve(E.getMinutes()))))}),[E,o,C,i]),(0,a.d4)((()=>{s&&!f&&y.getTime()<g.getTime()&&(N(g),M(Ve(g.getHours())),L(Ve(g.getMinutes())))}),[s,f,g,y]),(0,a.d4)((()=>{r&&!f&&y.getTime()>p.getTime()&&(N(p),M(Ve(p.getHours())),L(Ve(p.getMinutes())))}),[s,r,f,p,g,y]),(0,a.d4)((()=>{if(e){const t=new Date(e);N(t),M(Ve(t.getHours())),L(Ve(t.getMinutes()))}}),[e]);const $=r&&F>=P.getFullYear()&&B>=P.getMonth()||p&&F>=p.getFullYear()&&B>=p.getMonth(),x=s&&F<=P.getFullYear()&&B<=P.getMonth(),{prevMonthGrid:D,currentMonthGrid:U,nextMonthGrid:O}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],r=new Date;r.setDate(1),r.setMonth(t),r.setFullYear(e);const o=r.getDay(),i=new Date(e,t,0).getDate();for(let e=1;e<o;e++)n.push(i-o+e+1);for(;r.getMonth()===t;){const e=r.getDate();a.push(e),r.setDate(e+1)}const l=(a.length+n.length)%7;if(l>0)for(let e=1;e<=7-l;e++)s.push(e);return{prevMonthGrid:n,currentMonthGrid:a,nextMonthGrid:s}}(F,B)),[B,F]),G=(0,a.Ye)((()=>l||function(e,t){const n=(0,q.xH)(t,e.code);return n===(0,q.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,q.mr)(e,t)):e("Conversation.ScheduleMessage.SendOn",[n,(0,q.mr)(e,t)])}(Z,y)),[Z,y,l]),J=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return M(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(y.getTime());a.setHours(n),N(a);const s=Ve(n);M(s),e.target.value=s}),[y]),z=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return L(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),59)),a=new Date(y.getTime());a.setMinutes(n),N(a);const s=Ve(n);L(s),e.target.value=s}),[y]);return a.ZP.createElement(we.Z,{isOpen:o,onClose:d,className:"CalendarModal"},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:d},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h4",null,Z(`lng_month${B+1}`)," ",F),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",disabled:x,onClick:x?void 0:function(){S((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",disabled:$,onClick:$?void 0:function(){S((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"},Ye.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,Z(e))))),D.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 N((e=>{const n=new Date(e);return n.setDate(t),n.setMonth(B),n.setFullYear(F),n}));var t},className:(0,X.Z)("day-button",He(F,B,e,g,p)?"disabled":e?"clickable":"",A===je(F,B,e)&&"selected")},!!e&&a.ZP.createElement("span",null,e)))),O.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:w,onChange:J,onFocus:b,onBlur:I}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:T,onChange:z,onFocus:b,onBlur:I})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(R.Z,{onClick:function(){m(y)}},G),c&&a.ZP.createElement(R.Z,{onClick:h,isText:!0},c)))})),Ke=(0,a.X$)((0,s.c$)((e=>({selectedAt:e.historyCalendarSelectedAt})))((({isOpen:e,selectedAt:t})=>{const{searchMessagesByDate:n,closeHistoryCalendar:r}=(0,s.uC)(),o=(0,a.I4)((e=>{n({timestamp:e.valueOf()/1e3}),r()}),[r,n]),i=(0,u.Z)();return a.ZP.createElement(qe,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:i("JumpToDate"),onClose:r,onSubmit:o})}))),We=(0,a.X$)((0,s.c$)(((e,{message:t,isSchedule:n})=>{const{threadId:a}=(0,g.Bt)(e)||{},{canDeleteForAll:s}=a&&(0,g._k)(e,t,a)||{},r=(0,g.Z1)(e,t.chatId);return{canDeleteForAll:!n&&s,contactName:r&&(0,P.YC)(r.id)?(0,P.Vl)((0,g.dy)(e,(0,P.zX)(r))):void 0,willDeleteForCurrentUserOnly:r&&(0,P.G9)(r)&&!s,willDeleteForAll:r&&(0,P.ZV)(r)}}))((({isOpen:e,isSchedule:t,message:n,album:r,canDeleteForAll:o,contactName:i,willDeleteForCurrentUserOnly:l,willDeleteForAll:c,onClose:d})=>{const{deleteMessages:m,deleteScheduledMessages:h}=(0,s.uC)(),Z=(0,a.I4)((()=>{const e=null!=r&&r.messages?r.messages.map((({id:e})=>e)):[n.id];m({messageIds:e,shouldDeleteForAll:!0}),d()}),[m,n.id,d,r]),v=(0,a.I4)((()=>{const e=null!=r&&r.messages?r.messages.map((({id:e})=>e)):[n.id];t?h({messageIds:e}):m({messageIds:e,shouldDeleteForAll:!1}),d()}),[r,n.id,t,d,h,m]),P=(0,u.Z)();return a.ZP.createElement(we.Z,{isOpen:e,onClose:d,onEnter:e&&!o?v:void 0,className:"delete",title:P("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,P("AreYouSureDeleteSingleMessage")),l&&a.ZP.createElement("p",null,P("lng_delete_for_me_chat_hint",1,"i")),c&&a.ZP.createElement("p",null,P("lng_delete_for_everyone_hint",1,"i")),o&&a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},i&&(0,Pe.Z)(P("Conversation.DeleteMessagesFor",i)),!i&&P("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:v},P(o?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},P("Cancel")))}))),Qe=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,P.YC)(t),a=(0,g.FM)(e,t),s=(0,g.Z1)(e,t),r=!!s&&(0,P.eA)(s),o=!!s&&(0,P.G9)(s),i=!!s&&(0,P.ZV)(s);return{isPrivateChat:n,isChatWithSelf:a,isChannel:r,isGroup:o,isSuperGroup:i,canPinForAll:n&&!a||i||o,contactName:s&&(0,P.YC)(s.id)?(0,P.Vl)((0,g.dy)(e,(0,P.zX)(s))):void 0}}))((({isOpen:e,messageId:t,chatId:n,isChannel:r,isGroup:o,isSuperGroup:i,canPinForAll:l,contactName:c,onClose:d})=>{const{pinMessage:m}=(0,s.uC)(),h=(0,a.I4)((()=>{m({chatId:n,messageId:t,isUnpin:!1}),d()}),[m,n,t,d]),Z=(0,a.I4)((()=>{m({chatId:n,messageId:t,isUnpin:!1,isOneSide:!0,isSilent:!0}),d()}),[n,t,d,m]),v=(0,u.Z)();return a.ZP.createElement(we.Z,{isOpen:e,onClose:d,className:"pin",title:v("PinMessageAlertTitle")},a.ZP.createElement("p",null,v(r?"PinMessageAlertChannel":o||i?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:Z},v("DialogPin")),l&&a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:h},c?(0,Pe.Z)(v("Conversation.PinMessagesFor",c)):v("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},v("Cancel")))}))),et=(0,a.X$)((({isOpen:e,pinnedMessagesCount:t=0,onClose:n,onUnpin:s})=>{const r=(0,u.Z)();return a.ZP.createElement(we.Z,{isOpen:e,onClose:n,className:"unpin-all",title:r("Chat.PanelUnpinAllMessages")},a.ZP.createElement("p",null,r("Chat.UnpinAllMessagesConfirmation",t,"i")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},r("DialogUnpin")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},r("Cancel")))}));var tt=n(517);const nt=(0,a.X$)((0,s.c$)(((e,{isSchedule:t})=>{const{messageIds:n}=e.selectedMessages||{},{canDeleteForAll:a}=(0,g.xl)(e),s=(0,g.jr)(e);return{selectedMessageIds:n,canDeleteForAll:!t&&a,contactName:s&&(0,P.YC)(s.id)?(0,P.Vl)((0,g.dy)(e,(0,P.zX)(s))):void 0,willDeleteForCurrentUserOnly:s&&(0,P.G9)(s)&&!a,willDeleteForAll:s&&(0,P.ZV)(s)}}))((({isOpen:e,isSchedule:t,selectedMessageIds:n,canDeleteForAll:r,contactName:o,willDeleteForCurrentUserOnly:i,willDeleteForAll:l,onClose:c})=>{const{deleteMessages:d,deleteScheduledMessages:m,exitMessageSelectMode:h}=(0,s.uC)(),Z=(0,v.Z)(e),P=(0,a.I4)((()=>{c(),d({messageIds:n,shouldDeleteForAll:!0})}),[d,n,c]),g=(0,a.I4)((()=>{t?m({messageIds:n}):d({messageIds:n,shouldDeleteForAll:!1}),c()}),[t,c,m,n,d]),p=(0,u.Z)();if((0,a.d4)((()=>{!e&&Z&&h()}),[h,e,Z]),n)return a.ZP.createElement(we.Z,{isOpen:e,onClose:c,onEnter:r?void 0:g,className:"delete",title:p("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,p("AreYouSureDeleteFewMessages")),i&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),l&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),r&&a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:P},o?(0,Pe.Z)(p("ChatList.DeleteForEveryone",o)):p("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:g},p(r?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},p("Cancel")))})));var at=n(4434);const st=(0,a.X$)((({isOpen:e,messageIds:t,onClose:n})=>{const{reportMessages:r,exitMessageSelectMode:o}=(0,s.uC)(),[i,l]=(0,a.eJ)("spam"),[c,d]=(0,a.eJ)(""),m=()=>{r({messageIds:t,reason:i,description:c}),o(),n()},h=(0,a.I4)((e=>{l(e)}),[]),Z=(0,a.I4)((e=>{d(e.target.value)}),[]),v=(0,u.Z)(),P=[{value:"spam",label:v("lng_report_reason_spam")},{value:"violence",label:v("lng_report_reason_violence")},{value:"pornography",label:v("lng_report_reason_pornography")},{value:"childAbuse",label:v("lng_report_reason_child_abuse")},{value:"copyright",label:v("ReportPeer.ReasonCopyright")},{value:"other",label:v("lng_report_reason_other")}];if(t)return a.ZP.createElement(we.Z,{isOpen:e,onClose:n,onEnter:e?m:void 0,className:"report",title:v("lng_report_message_title")},a.ZP.createElement(at.Z,{name:"report-message",options:P,onChange:h,selected:i}),a.ZP.createElement(Me.Z,{label:v("lng_report_reason_description"),value:c,onChange:Z}),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:m},v("lng_report_button")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},v("Cancel")))})),rt=(0,a.X$)((0,s.c$)((e=>{const{type:t,chatId:n}=(0,g.Bt)(e)||{},{canDelete:a}=(0,g.xl)(e),s=(0,g.nB)(e),r=(0,g.Nu)(e),{messageIds:o}=e.selectedMessages||{},i=!!n&&(0,g.ku)(e,n,o);return{isSchedule:"scheduled"===t,selectedMessagesCount:(0,g.D7)(e),canDeleteMessages:a,canReportMessages:s,canDownloadMessages:r,selectedMessageIds:o,hasProtectedMessage:i}}))((({canPost:e,isActive:t,messageListType:n,isSchedule:r,selectedMessagesCount:o,canDeleteMessages:i,canReportMessages:l,canDownloadMessages:c,hasProtectedMessage:d,selectedMessageIds:m})=>{const{exitMessageSelectMode:h,openForwardMenuForSelectedMessages:Z,downloadSelectedMessages:P}=(0,s.uC)(),[g,p,E]=(0,xe.Z)(),[C,f,b]=(0,xe.Z)();(0,a.d4)((()=>!t||g||C?void 0:(0,tt.Z)({onBackspace:p,onDelete:p,onEsc:h})),[t,g,C,p,h]);const I=(0,a.I4)((()=>{P(),h()}),[P,h]),y=(0,v.Z)(o||void 0,!0),N=t?o:y,k=(0,u.Z)(),S=k("VoiceOver.Chat.MessagesSelected",N,"i"),w=(0,X.Z)("MessageSelectToolbar",e&&"with-composer",t&&"shown"),M=(e,t,n,s,r)=>a.ZP.createElement("div",{role:"button",tabIndex:0,className:(0,X.Z)("item",s&&"disabled",r&&"destructive"),onClick:s?void 0:n,title:t},a.ZP.createElement("i",{className:`icon-${e}`}));return a.ZP.createElement("div",{className:w},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(R.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:S},S),!!o&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==n&&M("forward",k("Chat.ForwardActionHeader"),Z,d),l&&M("flag",k("Conversation.ReportMessages"),f),c&&M("download",k("lng_media_download"),I,d),M("delete",k("EditAdminGroupDeleteMessages"),p,!i,!0))),a.ZP.createElement(nt,{isOpen:g,isSchedule:r,onClose:E}),a.ZP.createElement(st,{isOpen:C,onClose:b,messageIds:m}))}))),ot=(0,a.X$)((0,s.c$)((e=>{var t;const{chatId:n,messageId:a}=e.seenByModal||{};return n&&a?{memberIds:null===(t=(0,g.hj)(e,n,a))||void 0===t?void 0:t.seenByUserIds}:{}}))((({isOpen:e,memberIds:t})=>{const{openChat:n,closeSeenByModal:r}=(0,s.uC)(),o=(0,u.Z)(),i=(0,a.I4)((e=>{r(),setTimeout((()=>{n({id:e})}),100)}),[r,n]),l=(0,Ie.Z)(t,!0);return a.ZP.createElement(we.Z,{isOpen:e,onClose:r,className:"narrow",title:"Which users read the message"},a.ZP.createElement("div",{dir:o.isRtl?"rtl":void 0},l&&l.map((e=>a.ZP.createElement(Re.Z,{key:e,className:"chat-item-clickable scroll-item small-icon",onClick:()=>i(e)},a.ZP.createElement(Ae.Z,{userId:e,noStatusOrTyping:!0}))))),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},o("Close")))})));var it=n(2155),lt=n(8198);const ct=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,messageId:n}=e.reactorModal||{},a=t&&n?(0,g.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}}))((({isOpen:e,reactors:t,reactions:n,chatId:r,messageId:i,seenByUserIds:l})=>{const{loadReactors:c,closeReactorListModal:d,openChat:m}=(0,s.uC)(),h=(0,s.Rd)().users.byId,Z=(0,u.Z)(),[v,g,p]=(0,xe.Z)(!1),[E,C]=(0,a.eJ)(void 0),f=t&&n&&t.count>=10&&n.results.length>1,b=(0,a.sO)();(0,a.d4)((()=>{v&&!e&&(p(),C(void 0))}),[v,e,p]);const I=(0,a.I4)((()=>{b.current&&m({id:b.current}),d()}),[d,m]),y=(0,a.I4)((()=>{g()}),[g]),N=(0,a.I4)((e=>{b.current=e,y()}),[y]),k=(0,a.I4)((()=>{c({chatId:r,messageId:i})}),[r,c,i]),S=(0,a.Ye)((()=>null!=t&&t.reactions?(0,me.Tw)(t.reactions.map((e=>e.reaction))):[]),[null==t?void 0:t.reactions]),w=(0,a.Ye)((()=>E?null==t?void 0:t.reactions.filter((e=>e.reaction===E)).map((e=>e.userId)):(0,me.Tw)((null==t?void 0:t.reactions.map((e=>e.userId)).concat(l||[]))||[])),[E,null==t?void 0:t.reactions,l]),[M,T]=(0,ye.Z)(k,w,t&&void 0===t.nextOffset);return(0,a.d4)((()=>{null==T||T({direction:o.Uq.Backwards})}),[T]),a.ZP.createElement(we.Z,{isOpen:e&&!v,onClose:y,className:"ReactorListModal narrow",title:Z("Reactions"),onCloseAnimationEnd:I},f&&a.ZP.createElement("div",{className:"Reactions"},a.ZP.createElement(R.Z,{className:(0,X.Z)(!E&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(void 0)},a.ZP.createElement("i",{className:"icon-reaction-filled"}),(null==t?void 0:t.count)&&(0,it.bi)(t.count)),S.map((e=>{var t;const s=null==n||null===(t=n.results.find((t=>t.reaction===e)))||void 0===t?void 0:t.count;return a.ZP.createElement(R.Z,{className:(0,X.Z)(E===e&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(e)},a.ZP.createElement(lt.Z,{reaction:e,className:"reaction-filter-emoji"}),s&&(0,it.bi)(s))}))),a.ZP.createElement("div",{dir:Z.isRtl?"rtl":void 0},null!=M&&M.length?a.ZP.createElement(Te.Z,{className:"reactor-list custom-scroll",items:M,onLoadMore:T},null==M?void 0:M.map((e=>{var n;const s=h[e],r=(0,P.Js)(s),o=null==t||null===(n=t.reactions.find((t=>t.userId===e)))||void 0===n?void 0:n.reaction;return a.ZP.createElement(Re.Z,{key:e,className:"chat-item-clickable reactors-list-item",onClick:()=>N(e)},a.ZP.createElement(ge.Z,{user:s,size:"medium"}),a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},r&&(0,Pe.Z)(r))),o&&a.ZP.createElement(lt.Z,{className:"reactors-list-emoji",reaction:o}))}))):a.ZP.createElement(Se.Z,null)),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},Z("Close")))})));var dt=n(7324),mt=n(7799);const ut=(0,a.X$)((0,s.c$)(((e,{emojiInteraction:t})=>{const n=void 0!==t.animatedEffect&&(0,g.tH)(e,t.animatedEffect);return{effectAnimationId:n?n.id:void 0,localEffectAnimation:!n&&t.animatedEffect&&Object.keys(dt.x).includes(t.animatedEffect)?t.animatedEffect:void 0,isReversed:t.isReversed}}))((({emojiInteraction:e,effectAnimationId:t,localEffectAnimation:n,isReversed:o})=>{const{stopActiveEmojiInteraction:i}=(0,s.uC)(),[l,c]=(0,xe.Z)(!1),[m,u]=(0,xe.Z)(!1),Z=(0,a.I4)((()=>{c(),setTimeout((()=>{i()}),250)}),[c,i]);(0,a.d4)((()=>(document.addEventListener("touchstart",Z),document.addEventListener("touchmove",Z),document.addEventListener("mousedown",Z),document.addEventListener("wheel",Z),()=>{document.removeEventListener("touchstart",Z),document.removeEventListener("touchmove",Z),document.removeEventListener("mousedown",Z),document.removeEventListener("wheel",Z)})),[Z]),(0,a.bt)((()=>{const e=(0,d.YW)();setTimeout((()=>{Z(),e()}),3e3)}),[Z]);const v=(0,h.Z)(`sticker${t}`,!t,r.IU.Lottie),[P,g]=(0,a.eJ)();(0,a.d4)((()=>{n&&(0,dt.Z)(n).then((e=>{g(e)}))}),[n]);const p=(e.startSize||0)/240;return a.ZP.createElement("div",{className:(0,X.Z)("EmojiInteractionAnimation",l&&"hiding",m&&"playing",o&&"reversed"),style:`--scale: ${p}; --start-x: ${e.x}px; --start-y: ${e.y}px;`},a.ZP.createElement(mt.Z,{id:`effect_${t}`,size:240,animationData:P||v,play:m,quality:f.wZ?.5:void 0,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:u}))})));var ht=n(3133),Zt=n(735),vt=n(1470);const Pt=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))),[n]),t};var gt=n(329),pt=n(742);const Et=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t),a=n&&(0,P.zX)(n);return{chat:n,user:a?(0,g.dy)(e,a):void 0,isPinned:(0,g.ep)(e,t),isMuted:n?(0,P.i4)(n,(0,g.dZ)(e),(0,g.NJ)(e)):void 0}}))((({chatId:e,chat:t,user:n,isPinned:s,isMuted:r,withUsername:o,onClick:i})=>{const[l,c,d]=(0,xe.Z)(),[m,u,h]=(0,xe.Z)(),Z=(0,vt.Z)({chat:t,user:n,isPinned:s,isMuted:r,handleDelete:c,handleChatFolderChange:u},!0),v=()=>{i(e)},g=Pt(v);if(t)return a.ZP.createElement(Re.Z,{className:"chat-item-clickable search-result",onClick:v,contextActions:Z,buttonRef:g},(0,P.YC)(e)?a.ZP.createElement(Ae.Z,{userId:e,withUsername:o,avatarSize:"large"}):a.ZP.createElement(Le.Z,{chatId:e,withUsername:o,avatarSize:"large"}),a.ZP.createElement(gt.Z,{isOpen:l,onClose:d,chat:t}),a.ZP.createElement(pt.Z,{isOpen:m,onClose:h,chatId:e}))})));var Ct=n(8781);const ft=(0,G.P2)((e=>e()),6e4,!0),bt=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.topPeers,n=e.users.byId,{recentlyFoundChatIds:a}=e.globalSearch;return{topUserIds:t,usersById:n,recentlyFoundChatIds:a}}))((({topUserIds:e,usersById:t,recentlyFoundChatIds:n,onReset:r})=>{const{loadTopUsers:o,loadContactList:i,openChat:l,addRecentlyFoundChatId:c,clearRecentlyFoundChats:d}=(0,s.uC)(),m=(0,a.sO)(null);(0,a.d4)((()=>{ft((()=>{o(),i()}))}),[o,i]),(0,Ct.Z)(m.current,!e);const h=(0,a.I4)((e=>{l({id:e,shouldReplaceHistory:!0}),r(),setTimeout((()=>{c({id:e})}),250)}),[l,c,r]),Z=(0,u.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},e&&a.ZP.createElement("div",{className:"top-peers-section",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:m,className:"top-peers no-selection"},e.map((e=>a.ZP.createElement("div",{className:"top-peer-item",onClick:()=>h(e),dir:Z.isRtl?"rtl":void 0},a.ZP.createElement(ge.Z,{user:t[e]}),a.ZP.createElement("div",{className:"top-peer-name"},(0,Pe.Z)((0,P.Vl)(t[e])||" "))))))),n&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:Z.isRtl?"rtl":void 0},Z("Recent"),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:d,isRtl:Z.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),n.map((e=>a.ZP.createElement(Et,{chatId:e,onClick:h})))))})));var It=n(9411),yt=n(8033);const Nt=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t);if(!n)return{};const a=(0,P.zX)(n);return{chat:n,lastSyncTime:e.lastSyncTime,...a&&{privateChatUser:(0,g.dy)(e,a)}}}))((({message:e,searchQuery:t,chatId:n,chat:r,privateChatUser:o,lastSyncTime:i})=>{const{focusMessage:l}=(0,s.uC)(),c=(0,P.DH)(e),d=(0,h.Z)((0,P.Ti)(e,"micro")),m=Boolean((0,P.Y5)(e)),Z=(0,a.I4)((()=>{l({chatId:n,messageId:e.id})}),[n,l,e.id]),v=(0,u.Z)(),g=Pt(Z);if(r)return a.ZP.createElement(Re.Z,{className:"ChatMessage chat-item-clickable",ripple:!f.wB,onClick:Z,buttonRef:g},a.ZP.createElement(ge.Z,{chat:r,user:o,isSavedMessages:null==o?void 0:o.isSelf,lastSyncTime:i}),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,Pe.Z)((0,P.U)(v,r,o))),r.isVerified&&a.ZP.createElement(It.Z,null)),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(yt.Z,{className:"date"},(0,q.VX)(v,1e3*e.date)))),a.ZP.createElement("div",{className:"subtitle"},a.ZP.createElement("div",{className:"message",dir:"auto"},function(e,t,n,s,r){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:r?"round":void 0}),(0,P.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,y.eK)(e,t,!0,s)):(0,y.eK)(e,t,void 0,s)}(v,e,d||c,t,m)))))}))),kt=(0,a.X$)((({searchDate:e,onSelect:t})=>{const n=(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,q.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,q.xH)(a)})}return t}(e)),[e]);return a.ZP.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},n.map((({date:e,text:n})=>a.ZP.createElement("div",{onClick:()=>t(e),className:"date-item",key:n},a.ZP.createElement("i",{className:"icon-calendar"}),a.ZP.createElement("span",null,n)))))}));var St=n(7262),wt=n(9187);const Mt=(0,G.P2)((e=>e()),500,!0),Tt=(0,a.X$)((0,s.c$)((e=>{var t;const{byId:n}=e.chats,{userIds:a}=e.contactList||{};if(!a)return{chatsById:n};const{currentUserId:s,messages:r,lastSyncTime:o}=e,{fetchingStatus:i,globalResults:l,localResults:c,resultsByType:d}=e.globalSearch,{chatIds:m,userIds:u}=l||{},{chatIds:h,userIds:Z}=c||{},{byChatId:v}=r;return{currentUserId:s,localContactIds:a,localChatIds:h,localUserIds:Z,globalChatIds:m,globalUserIds:u,foundIds:null==d||null===(t=d.text)||void 0===t?void 0:t.foundIds,globalMessagesByChatId:v,chatsById:n,fetchingStatus:i,lastSyncTime:o}}))((({searchQuery:e,searchDate:t,dateSearchQuery:n,currentUserId:r,localContactIds:i,localChatIds:l,localUserIds:c,globalChatIds:d,globalUserIds:m,foundIds:h,globalMessagesByChatId:Z,chatsById:v,fetchingStatus:g,lastSyncTime:p,onReset:E,onSearchDateSelect:C})=>{const{openChat:b,addRecentlyFoundChatId:I,searchMessagesGlobal:N,setGlobalSearchChatId:k}=(0,s.uC)(),S=(0,u.Z)(),[w,M]=(0,a.eJ)(!1),[T,R]=(0,a.eJ)(!1),L=(0,a.I4)((({direction:t})=>{p&&t===o.Uq.Backwards&&Mt((()=>{N({type:"text",query:e})}))}),[p,N,e]),A=(0,a.I4)((e=>{b({id:e,shouldReplaceHistory:!0}),e!==r&&I({id:e}),f.wB||E()}),[r,b,I,E]),F=(0,a.I4)((e=>{k({id:e})}),[k]),B=(0,a.Ye)((()=>{if(!e||e.startsWith("@")&&e.length<2)return Zt.D;const t=[...r?[r]:[],...i||[]],n=(0,s.Rd)().users.byId,a=(0,P.kK)(t,n,e,r,S("SavedMessages"));return[...(0,P.ih)((0,me.Tw)([...a||[],...l||[],...c||[]]),v,void 0,r?[r]:void 0)]}),[e,r,i,S,l,c,v]),$=(0,a.Ye)((()=>!e||e.length<4||!d||!m?Zt.D:(0,P.ih)((0,me.Tw)([...d,...m]),v,!0)),[v,d,m,e]),x=(0,a.Ye)((()=>(e||t)&&h&&0!==h.length?h.map((e=>{var t;const[n,a]=e.split("_");return null==Z||null===(t=Z[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Zt.D),[h,Z,e,t]),D=(0,a.I4)((()=>{M(!w)}),[w]),U=(0,a.I4)((()=>{R(!T)}),[T]),O=g&&!g.chats&&!g.messages&&!B.length&&!$.length&&!x.length;return e||t?a.ZP.createElement(Te.Z,{className:"LeftSearch custom-scroll",items:x,onLoadMore:L,noScrollRestoreOnTop:!0,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(kt,{searchDate:n,onSelect:C})),O&&a.ZP.createElement(St.Z,{text:S("ChatList.Search.NoResults"),description:S("ChatList.Search.NoResultsDescription")}),!!B.length&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:S.isRtl?"rtl":void 0},B.map((e=>a.ZP.createElement(wt.Z,{chatOrUserId:e,onClick:F,clickArg:e})))),!!B.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},B.length>5&&a.ZP.createElement(yt.Z,{onClick:D},S(w?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),S("DialogList.SearchSectionDialogs")),B.map(((e,t)=>{if(w||!(t>=5))return a.ZP.createElement(Et,{chatId:e,onClick:A})}))),!!$.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},$.length>5&&a.ZP.createElement(yt.Z,{onClick:U},S(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),S("DialogList.SearchSectionGlobal")),$.map(((e,t)=>{if(T||!(t>=5))return a.ZP.createElement(Et,{chatId:e,withUsername:!0,onClick:A})}))),!!x.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},S("SearchMessages")),x.map((function(t){const n=(0,y.eK)(S,t),s=v[t.chatId];if(n&&s)return a.ZP.createElement(Nt,{chatId:t.chatId,message:t,searchQuery:e})})))):a.ZP.createElement(bt,{onReset:E})}))),Rt=(0,G.P2)((e=>e()),500,!0),Lt=(0,a.X$)((0,s.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a},lastSyncTime:s}=e,{fetchingStatus:r,resultsByType:o}=e.globalSearch,{foundIds:i}=(null==o?void 0:o.text)||{};return{currentUserId:n,foundIds:i,globalMessagesByChatId:a,chatsById:t,fetchingStatus:r,lastSyncTime:s}}))((({searchQuery:e,currentUserId:t,dateSearchQuery:n,foundIds:r,globalMessagesByChatId:i,chatsById:l,fetchingStatus:c,lastSyncTime:d,onSearchDateSelect:m})=>{const{searchMessagesGlobal:h}=(0,s.uC)(),Z=(0,u.Z)(),v=(0,a.I4)((({direction:n})=>{d&&n===o.Uq.Backwards&&Rt((()=>{h({type:"text",query:e,chatId:t})}))}),[t,d,h,e]),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)):Zt.D),[r,i]),g=c&&!c.chats&&!c.messages&&!P.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:"search-content custom-scroll chat-list",items:P,onLoadMore:v,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(kt,{searchDate:n,onSelect:m})),g&&a.ZP.createElement(St.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),!!P.length&&P.map((function(t){const n=(0,y.eK)(Z,t),s=l[t.chatId];if(n&&s)return a.ZP.createElement(Nt,{chatId:t.chatId,message:t,searchQuery:e})}))))})));function At(e){return(t,n)=>{var a,s;const{byId:r}=t.chats,{byId:o}=t.users,{fetchingStatus:i,resultsByType:l,chatId:c}=t.globalSearch,d="audio"!==e?e:null!=n&&n.isVoice?"voice":"audio",{byChatId:m}=t.messages,u=null==l||null===(a=l[d])||void 0===a?void 0:a.foundIds,h=t.activeDownloads.byChatId;return{theme:(0,g.Pu)(t),isLoading:void 0===u||!!i&&Boolean(i.chats||i.messages),chatsById:r,usersById:o,globalMessagesByChatId:m,foundIds:u,searchChatId:c,activeDownloads:h,isChatProtected:c?null===(s=(0,g.Z1)(t,c))||void 0===s?void 0:s.isProtected:void 0,lastSyncTime:t.lastSyncTime}}}var Ft=n(7891),Bt=n(3709);const $t="media",xt=(0,G.P2)((e=>e()),500,!0),Dt=(0,a.X$)((0,s.c$)(At($t))((({searchQuery:e,searchChatId:t,isLoading:n,globalMessagesByChatId:r,foundIds:l,lastSyncTime:c,isChatProtected:d})=>{const{searchMessagesGlobal:m,openMediaViewer:h}=(0,s.uC)(),Z=(0,u.Z)(),v=(0,a.I4)((({direction:n})=>{c&&n===o.Uq.Backwards&&xt((()=>{m({type:$t,query:e,chatId:t})}))}),[c,m,e,t]),P=(0,a.Ye)((()=>l&&r?l.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):Zt.D),[r,l]),g=(0,a.I4)(((e,t)=>{h({chatId:t,messageId:e,origin:o.bZ.SearchResult})}),[h]),p=(0,Ft.Z)([e],i.Y)&&!n,E=p&&l&&l.length>0&&!e,C=p&&l&&l.length>0&&e,f=(0,X.Z)("search-content custom-scroll",C&&"chat-list");return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:f,items:P,itemSelector:e?".ListItem":".Media",onLoadMore:v,noFastList:!0},!p&&a.ZP.createElement(Se.Z,null),p&&(!l||0===l.length)&&a.ZP.createElement(St.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),E&&a.ZP.createElement("div",{className:"media-list",dir:Z.isRtl?"rtl":void 0},P.map((e=>a.ZP.createElement(Bt.Z,{key:e.id,idPrefix:"search-media",message:e,isProtected:d||e.isProtected,onClick:g})))),C&&P.map((e=>a.ZP.createElement(Nt,{key:e.id,chatId:e.chatId,message:e})))))})));var Ut=n(91),Ot=n(5418);const Gt="links",Jt=(0,G.P2)((e=>e()),500,!0),Xt=(0,a.X$)((0,s.c$)(At(Gt))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:r,usersById:l,globalMessagesByChatId:c,foundIds:d,lastSyncTime:m,isChatProtected:h})=>{const{searchMessagesGlobal:Z,focusMessage:v}=(0,s.uC)(),P=(0,u.Z)(),g=(0,a.I4)((({direction:n})=>{m&&n===o.Uq.Backwards&&Jt((()=>{Z({type:Gt,query:e,chatId:t})}))}),[m,Z,e,t]),p=(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):Zt.D),[c,d]),E=(0,a.I4)(((e,t)=>{v({chatId:t,messageId:e})}),[v]),C=(0,Ft.Z)([e],i.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:"search-content documents-list custom-scroll",items:p,onLoadMore:g,noFastList:!0},!C&&a.ZP.createElement(Se.Z,null),C&&(!d||0===d.length)&&a.ZP.createElement(St.Z,{text:P("ChatList.Search.NoResults"),description:P("ChatList.Search.NoResultsDescription")}),C&&d&&d.length>0&&p.map(((e,t)=>{const n=0===t||(0,q.kj)(e.date)!==(0,q.kj)(p[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",dir:P.isRtl?"rtl":void 0,key:e.id},n&&a.ZP.createElement("p",{className:"section-heading",dir:P.isRtl?"rtl":void 0},(0,q.np)(P,new Date(1e3*e.date))),a.ZP.createElement(Ot.Z,{key:e.id,message:e,senderTitle:(0,Ut.F)(P,e,r,l),isProtected:h||e.isProtected,onMessageClick:E}))}))))})));var zt=n(2535);const _t="documents",Yt=(0,G.P2)((e=>e()),500,!0),Ht=(0,a.X$)((0,s.c$)(At(_t))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:r,usersById:l,globalMessagesByChatId:c,foundIds:d,activeDownloads:m,lastSyncTime:h})=>{const{searchMessagesGlobal:Z,focusMessage:v}=(0,s.uC)(),g=(0,u.Z)(),p=(0,a.I4)((({direction:n})=>{h&&n===o.Uq.Backwards&&Yt((()=>{Z({type:_t,query:e,chatId:t})}))}),[h,Z,e,t]),E=(0,a.Ye)((()=>d&&c?d.map((e=>{var t;const[n,a]=e.split("_"),s=null===(t=c[n])||void 0===t?void 0:t.byId[Number(a)];return s&&(0,P.aE)(s)?s:void 0})).filter(Boolean):Zt.D),[c,d]),C=(0,a.I4)(((e,t)=>{v({chatId:t,messageId:e})}),[v]),f=(0,Ft.Z)([e],i.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:"search-content documents-list custom-scroll",items:E,onLoadMore:p,noFastList:!0},!f&&a.ZP.createElement(Se.Z,null),f&&(!d||0===d.length)&&a.ZP.createElement(St.Z,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),f&&d&&d.length>0&&E.map(((e,t)=>{var n;const s=0===t||(0,q.kj)(e.date)!==(0,q.kj)(E[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},s&&a.ZP.createElement("p",{className:"section-heading"},(0,q.np)(g,new Date(1e3*e.date))),a.ZP.createElement(zt.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,Ut.F)(g,e,r,l),className:"scroll-item",onDateClick:C,isDownloading:null===(n=m[e.chatId])||void 0===n?void 0:n.includes(e.id)}))}))))})));var Vt=n(4752);const jt=(0,G.P2)((e=>e()),500,!0),qt=(0,a.X$)((0,s.c$)(At("audio"))((({theme:e,isVoice:t,searchQuery:n,searchChatId:r,isLoading:l,chatsById:c,usersById:d,globalMessagesByChatId:m,foundIds:h,lastSyncTime:Z,activeDownloads:v})=>{const{searchMessagesGlobal:P,focusMessage:g,openAudioPlayer:p}=(0,s.uC)(),E=(0,u.Z)(),C=t?"voice":"audio",f=(0,a.I4)((({direction:e})=>{Z&&e===o.Uq.Backwards&&jt((()=>{P({type:C,query:n,chatId:r})}))}),[C,Z,P,n,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):Zt.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]),N=(0,Ft.Z)([n],i.Y)&&!l;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:"search-content documents-list custom-scroll",items:b,onLoadMore:f,noFastList:!0},!N&&a.ZP.createElement(Se.Z,null),N&&(!h||0===h.length)&&a.ZP.createElement(St.Z,{text:E("ChatList.Search.NoResults"),description:E("ChatList.Search.NoResultsDescription")}),N&&h&&h.length>0&&b.map(((t,n)=>{var s;const r=0===n||(0,q.kj)(t.date)!==(0,q.kj)(b[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:t.id},r&&a.ZP.createElement("p",{className:"section-heading",dir:E.isRtl?"rtl":void 0},(0,q.np)(E,new Date(1e3*t.date))),a.ZP.createElement(Vt.Z,{key:t.id,theme:e,message:t,origin:o.Cr.Search,senderTitle:(0,Ut.F)(E,t,c,d),date:t.date,lastSyncTime:Z,className:"scroll-item",onPlay:y,onDateClick:I,isDownloading:null===(s=v[t.chatId])||void 0===s?void 0:s.includes(t.id)}))}))))}))),Kt=[{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"}],Wt=[{type:o.nJ.ChatList,title:"All Messages"},...Kt.slice(1)],Qt=Object.keys(o.nJ).length/2,en=(0,a.X$)((0,s.c$)((e=>{const{currentContent:t,chatId:n}=e.globalSearch;return{currentContent:t,chatId:n}}))((({searchQuery:e,searchDate:t,isActive:n,currentContent:r=o.nJ.ChatList,chatId:i,onReset:l})=>{const{setGlobalSearchContent:c,setGlobalSearchDate:d}=(0,s.uC)(),h=(0,u.Z)(),[Z,v]=(0,a.eJ)(r),P=(0,a.Ye)((()=>(0,q.xk)(e)),[e]),g=(0,a.I4)((e=>{const t=Kt[e];c({content:t.type}),v(e)}),[c]),p=(0,a.I4)((e=>{d({date:e.getTime()/1e3})}),[d]);(0,m.ZP)(n,l,void 0,void 0,!0);const E=(0,a.sO)(null),C=(0,Ne.Z)(E,n,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:E,onKeyDown:C},a.ZP.createElement(ht.Z,{activeTab:Z,tabs:i?Wt:Kt,onSwitchTab:g}),a.ZP.createElement(A.Z,{name:h.isRtl?"slide-optimized-rtl":"slide-optimized",renderCount:Qt,activeKey:r},(()=>{switch(r){case o.nJ.ChatList:return i?a.ZP.createElement(Lt,{searchQuery:e,dateSearchQuery:P,onReset:l,onSearchDateSelect:p}):a.ZP.createElement(Tt,{searchQuery:e,searchDate:t,dateSearchQuery:P,onReset:l,onSearchDateSelect:p});case o.nJ.Media:return a.ZP.createElement(Dt,{searchQuery:e});case o.nJ.Links:return a.ZP.createElement(Xt,{searchQuery:e});case o.nJ.Files:return a.ZP.createElement(Ht,{searchQuery:e});case o.nJ.Music:return a.ZP.createElement(qt,{key:"audio",searchQuery:e});case o.nJ.Voice:return a.ZP.createElement(qt,{key:"voice",isVoice:!0,searchQuery:e});default:return}})))})));var tn=n(1090);const nn={currentPassword:"",password:"",hint:"",email:""},an=(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 nn;default:return e}},sn=(0,a.X$)((({currentScreen:e,editedFolderId:t,onReset:n,onSaveFilter:r,onScreenSelect:i})=>{const{signOut:l,deleteChatFolder:c}=(0,s.uC)(),[d,m]=(0,a.eJ)(!1),[h,Z]=(0,a.eJ)(!1),v=(0,a.I4)((()=>{m(!0)}),[]),P=(0,a.I4)((()=>{m(!1)}),[]),g=(0,a.I4)((()=>{Z(!0)}),[]),p=(0,a.I4)((()=>{Z(!1)}),[]),E=(0,a.I4)((()=>{P(),l()}),[P,l]),C=(0,a.I4)((()=>{p(),c({id:t}),n()}),[t,p,c,n]),b=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(R.Z,{round:!0,ripple:!f.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]),I=(0,u.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:I("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){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.PrivacyActiveSessions: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.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")),t&&a.ZP.createElement(F.Z,{className:"settings-more-menu",trigger:b,positionX:"right"},a.ZP.createElement(B.Z,{icon:"delete",destructive:!0,onClick:g},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"},e===o.MT.FoldersIncludedChats||e===o.MT.FoldersIncludedChatsFromChatList?a.ZP.createElement("h3",null,I("FilterInclude")):a.ZP.createElement("h3",null,I("FilterExclude")),a.ZP.createElement(R.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(R.Z,{round:!0,ripple:!f.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(F.Z,{className:"settings-more-menu",trigger:b,positionX:"right"},a.ZP.createElement(B.Z,{icon:"logout",onClick:v},I("LogOutTitle"))))}}(),a.ZP.createElement(Xe.Z,{isOpen:d,onClose:P,text:I("lng_sure_logout"),confirmLabel:I("AccountSettings.Logout"),confirmHandler:E,confirmIsDestructive:!0}),a.ZP.createElement(Xe.Z,{isOpen:h,onClose:p,text:I("FilterDeleteAlert"),confirmLabel:I("Delete"),confirmHandler:C,confirmIsDestructive:!0}))}));var rn=n(787),on=n(180);const ln=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t,lastSyncTime:n}=e;return{currentUser:t?(0,g.dy)(e,t):void 0,lastSyncTime:n}}))((({isActive:e,onScreenSelect:t,onReset:n,currentUser:r,lastSyncTime:i})=>{const{loadProfilePhotos:l}=(0,s.uC)(),c=(0,u.Z)(),d=null==r?void 0:r.id;return(0,a.d4)((()=>{d&&i&&l({profileId:d})}),[i,d,l]),(0,m.ZP)(e,n,t,o.MT.Main),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-main-menu"},r&&a.ZP.createElement(rn.Z,{userId:r.id,forceShowSelf:!0}),r&&a.ZP.createElement(on.Z,{chatOrUserId:r.id,forceShowSelf:!0}),a.ZP.createElement(Re.Z,{icon:"settings",onClick:()=>t(o.MT.General)},c("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Re.Z,{icon:"unmute",onClick:()=>t(o.MT.Notifications)},c("Notifications")),a.ZP.createElement(Re.Z,{icon:"lock",onClick:()=>t(o.MT.Privacy)},c("PrivacySettings")),a.ZP.createElement(Re.Z,{icon:"data",onClick:()=>t(o.MT.DataStorage)},c("DataSettings")),a.ZP.createElement(Re.Z,{icon:"folder",onClick:()=>t(o.MT.Folders)},c("Filters")),a.ZP.createElement(Re.Z,{icon:"language",onClick:()=>t(o.MT.Language)},c("Language"))))})));var cn=n(710),dn=n(1151);const mn="https://t.me/",un=/https:\/\/t\.me\/?/i,hn=/^([a-zA-Z0-9_]+)$/,Zn=(0,G.Ds)((e=>e()),250,!1),vn=(0,a.X$)((({currentUsername:e,asLink:t,isLoading:n,isUsernameAvailable:s,checkUsername:r,onChange:o})=>{const[i,l]=(0,a.eJ)(e||""),c=(0,u.Z)(),d=t?"SetUrl":"Username",m=c(t?"SetUrlPlaceholder":"Username"),[h,Z]=(0,a.Ye)((()=>i.length?i.length<5?[void 0,`${m} is too short`]:i.length>32?[void 0,`${m} is too long`]:hn.test(i)?void 0===s?[]:[s?c(`${d}Available`,"Username"):void 0,!1===s?c(`${d}InUse`):void 0]:[void 0,`${m} contains invalid characters`]:[]),[i,s,c,d,m]);(0,a.d4)((()=>{l(e||"")}),[t,e]);const v=(0,a.I4)((e=>{const n=e.target.value.trim().replace(un,"");l(n),e.target.value=`${t?mn:""}${n}`;const a=function(e){return e.length>=5&&e.length<=32&&hn.test(e)}(n);a&&Zn((()=>{r({username:n})})),o&&o(!!a&&n)}),[t,r,o]);return a.ZP.createElement(Me.Z,{value:`${t?mn:""}${i}`,onChange:v,label:m,error:Z,success:h,readOnly:n})})),Pn=(0,G.P2)((e=>e()),6e4,!0),gn="Please provide your first name",pn="Bio can' be longer than 70 characters",En=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a}=e.profileEdit||{},s=t?(0,g.dy)(e,t):void 0;if(!s)return{progress:n,isUsernameAvailable:a};const{firstName:r,lastName:o,username:i,fullInfo:l}=s,{bio:c}=l||{};return{currentAvatarHash:(0,P.RT)(s),currentFirstName:r,currentLastName:o,currentBio:c,currentUsername:i,progress:n,isUsernameAvailable:a}}))((({isActive:e,onScreenSelect:t,onReset:n,currentAvatarHash:i,currentFirstName:l,currentLastName:c,currentBio:d,currentUsername:Z,progress:v,isUsernameAvailable:P})=>{const{loadCurrentUser:g,updateProfile:p,checkUsername:E}=(0,s.uC)(),C=(0,u.Z)(),[f,b]=(0,a.eJ)(!1),[I,y]=(0,a.eJ)(!1),[N,k]=(0,a.eJ)(),[S,w]=(0,a.eJ)(),[M,T]=(0,a.eJ)(l||""),[R,L]=(0,a.eJ)(c||""),[A,F]=(0,a.eJ)(d||""),[B,$]=(0,a.eJ)(Z||""),x=(0,h.Z)(i,!1,r.IU.BlobUrl),D=v===o.rN.InProgress,U=!1===B,O=(0,a.Ye)((()=>!U&&(Boolean(S)||I||!0===P)),[S,I,U,P]);(0,m.ZP)(e,n,t,o.MT.EditProfile),(0,a.d4)((()=>{Pn((()=>{g()}))}),[g]),(0,a.d4)((()=>{w(void 0)}),[x]),(0,a.d4)((()=>{T(l||""),L(c||""),F(d||"")}),[l,c,d]),(0,a.d4)((()=>{$(Z||"")}),[Z]),(0,a.d4)((()=>{v===o.rN.Complete&&(y(!1),b(!1),k(void 0))}),[v]);const G=(0,a.I4)((e=>{w(e)}),[]),X=(0,a.I4)((e=>{T(e.target.value),y(!0)}),[]),z=(0,a.I4)((e=>{L(e.target.value),y(!0)}),[]),_=(0,a.I4)((e=>{F(e.target.value),y(!0)}),[]),Y=(0,a.I4)((e=>{$(e),b(!0)}),[]),H=(0,a.I4)((()=>{const e=M.trim(),t=R.trim(),n=A.trim();e.length?n.length>70?k(pn):p({photo:S,...I&&{firstName:e,lastName:t,bio:n},...f&&{username:B}}):k(gn)}),[S,M,R,A,I,B,f,p]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-edit-profile"},a.ZP.createElement(cn.Z,{currentAvatarBlobUrl:x,onChange:G,title:"Edit your profile photo",disabled:D}),a.ZP.createElement(Me.Z,{value:M,onChange:X,label:C("FirstName"),disabled:D,error:N===gn?N:void 0}),a.ZP.createElement(Me.Z,{value:R,onChange:z,label:C("LastName"),disabled:D}),a.ZP.createElement(Me.Z,{value:A,onChange:_,label:C("UserBio"),disabled:D,error:N===pn?N:void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:C.isRtl?"rtl":void 0},(0,Pe.Z)(C("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("Username")),a.ZP.createElement(vn,{currentUsername:B||"",isLoading:D,isUsernameAvailable:P,checkUsername:E,onChange:Y}),a.ZP.createElement("p",{className:"settings-item-description",dir:C.isRtl?"rtl":void 0},(0,Pe.Z)(C("UsernameHelp"),["br","simple_markdown"])),B&&a.ZP.createElement("p",{className:"settings-item-description",dir:C.isRtl?"rtl":void 0},C("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},"https://t.me/",B)))),a.ZP.createElement(dn.Z,{isShown:O,onClick:H,disabled:D,ariaLabel:"Save changes"},D?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var Cn=n(4605),fn=n(8051);const bn=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb"])))((({isActive:e,onScreenSelect:t,onReset:n,canAutoLoadPhotoFromContacts:r,canAutoLoadPhotoInPrivateChats:l,canAutoLoadPhotoInGroups:c,canAutoLoadPhotoInChannels:d,canAutoLoadVideoFromContacts:h,canAutoLoadVideoInPrivateChats:Z,canAutoLoadVideoInGroups:v,canAutoLoadVideoInChannels:P,canAutoLoadFileFromContacts:g,canAutoLoadFileInPrivateChats:p,canAutoLoadFileInGroups:E,canAutoLoadFileInChannels:C,canAutoPlayGifs:f,canAutoPlayVideos:b,autoLoadFileMaxSizeMb:I})=>{const{setSettingOption:y}=(0,s.uC)(),N=(0,u.Z)();(0,m.ZP)(e,n,t,o.MT.General);const k=(0,a.I4)((e=>N("AutodownloadSizeLimitUpTo",N("FileSize.MB",String(i.by[e]),"i"))),[N]),S=(0,a.I4)((e=>{y({autoLoadFileMaxSizeMb:i.by[e]})}),[y]);function w(e,t,n,s,r,o){return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},e),a.ZP.createElement(Cn.Z,{label:N("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>y({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(Cn.Z,{label:N("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>y({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(Cn.Z,{label:N("AutoDownloadSettings.GroupChats"),checked:r,onCheck:e=>y({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(Cn.Z,{label:N("AutoDownloadSettings.Channels"),checked:o,onCheck:e=>y({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=i.by.indexOf(I);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(fn.Z,{label:N("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:k,onChange:S}))}())}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},w(N("AutoDownloadPhotosTitle"),"Photo",r,l,c,d),w(N("AutoDownloadVideosTitle"),"Video",h,Z,v,P),w("Auto-download files","File",g,p,E,C),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("AutoplayMedia")),a.ZP.createElement(Cn.Z,{label:N("GifsTab2"),checked:f,onCheck:e=>y({canAutoPlayGifs:e})}),a.ZP.createElement(Cn.Z,{label:N("DataAndStorage.Autoplay.Videos"),checked:b,onCheck:e=>y({canAutoPlayVideos:e})})))}))),In=(0,G.P2)((e=>e()),6e4,!0),yn=(0,a.X$)((0,s.c$)((e=>{const{chats:{listIds:t,byId:n},users:{byId:a}}=e,{orderedIds:s,byId:r,recommended:o}=e.chatFolders;return{allListIds:t,chatsById:n,usersById:a,orderedFolderIds:s,foldersById:r,recommendedChatFolders:o,notifySettings:(0,g.dZ)(e),notifyExceptions:(0,g.NJ)(e)}}))((({isActive:e,allListIds:t,chatsById:n,usersById:r,orderedFolderIds:l,foldersById:c,recommendedChatFolders:d,notifySettings:h,notifyExceptions:Z,onCreateFolder:v,onEditFolder:g,onScreenSelect:p,onReset:E})=>{const{loadRecommendedChatFolders:C,addChatFolder:f,showDialog:b}=(0,s.uC)(),[I,y]=(0,a.eJ)(),[N,k]=(0,a.eJ)(!1),S=(0,a.I4)((()=>k(!0)),[]);(0,a.d4)((()=>{I||(0,dt.Z)("FoldersAll").then(y)}),[I]),(0,a.d4)((()=>{In((()=>{C()}))}),[C]);const w=(0,a.I4)((()=>{Object.keys(c).length>=10?b({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):v()}),[c,b,v]),M=(0,u.Z)();(0,m.ZP)(e,E,p,o.MT.Folders);const T=(0,a.Ye)((()=>{if(l)return l.map((e=>{const a=c[e];return{id:a.id,title:a.title,subtitle:(0,P.SB)(M,t,n,r,a,h,Z)}}))}),[M,t,c,n,r,l,h,Z]),L=(0,a.I4)((e=>{Object.keys(c).length>=10?b({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):f({folder:e})}),[c,f,b]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement("div",{className:"settings-content-icon"},I&&a.ZP.createElement(mt.Z,{id:"settingsFoldersMain",size:i.ku,animationData:I,play:N,noLoop:!0,onLoad:S})),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},M("CreateNewFilterInfo")),a.ZP.createElement(R.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:w,isRtl:M.isRtl},a.ZP.createElement("i",{className:"icon-add"}),M("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:M.isRtl?"rtl":void 0},M("Filters")),null!=T&&T.length?T.map((e=>a.ZP.createElement(Re.Z,{className:"mb-2 no-icon",narrow:!0,multiline:!0,onClick:()=>g(c[e.id])},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))):T&&!T.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(Se.Z,null)),d&&!!d.length&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:M.isRtl?"rtl":void 0},M("FilterRecommended")),d.map((e=>a.ZP.createElement(Re.Z,{className:"mb-2",narrow:!0,onClick:()=>L(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(R.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:M.isRtl},M("Add"))))))))})));var Nn=n(3455);const kn=({count:e,itemName:t,itemPluralName:n,isLoading:s,onClick:r})=>{const o=(0,u.Z)();return a.ZP.createElement(R.Z,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:s,isRtl:o.isRtl,onClick:r},a.ZP.createElement("i",{className:"icon-down"}),"Show ",e," more ",e>1?n||`${t}s`:t)},Sn="Please provide a title for this folder.",wn="ChatList.Filter.Error.Empty",Mn=(0,a.X$)((0,s.c$)((e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}}))((({state:e,dispatch:t,onAddIncludedChats:n,onAddExcludedChats:r,isActive:l,onScreenSelect:c,onReset:d,onBack:h,loadedActiveChatIds:Z,loadedArchivedChatIds:v})=>{const{editChatFolder:g,addChatFolder:p,loadMoreChats:E}=(0,s.uC)(),[C,f]=(0,a.eJ)(),[b,I]=(0,a.eJ)(!1),y=(0,a.I4)((()=>I(!0)),[]),[N,k]=(0,a.eJ)(!1),[S,w]=(0,a.eJ)(!1),{selectedChatIds:M,selectedChatTypes:T}=(0,Nn.vb)(e,"included"),{selectedChatIds:R,selectedChatTypes:L}=(0,Nn.vb)(e,"excluded");(0,a.d4)((()=>{C||(0,dt.Z)("FoldersNew").then(f)}),[C]),(0,a.d4)((()=>{k(!1),w(!1)}),[e.folderId]);const[A,F]=(0,a.Ye)((()=>{const e=new Set([...Z||[],...v||[]]),t=(0,me.eL)(M,e),n=(0,me.eL)(R,e);return[N?t:t.slice(0,5-T.length),S?n:n.slice(0,5-L.length)]}),[R,M,T,L,S,N,Z,v]);(0,a.d4)((()=>{(A.length<M.length||F.length<R.length)&&E({listType:"active"})}),[E,R.length,M.length,F.length,A.length]);const B=(0,u.Z)();function $(e){const t="included"===e?T:L,n="included"===e?A:F,s="included"===e?N:S,r=("included"===e?M:R).length-t.length-n.length,o="included"===e?()=>k(!0):()=>w(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?Nn.fi.find((({key:t})=>t===e)):Nn.Yy.find((({key:t})=>t===e));if(n)return a.ZP.createElement(Re.Z,{key:n.key,className:"settings-folders-list-item mb-1",icon:n.icon,narrow:!0,inactive:!0},B(n.title))}(t,e))),n.map((e=>a.ZP.createElement(Re.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,P.YC)(e)?a.ZP.createElement(Ae.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(Le.Z,{avatarSize:"small",chatId:e})))),!s&&r>0&&a.ZP.createElement(kn,{count:r,itemName:"chat",onClick:o}))}return(0,m.ZP)(l,h,c,"edit"===e.mode?o.MT.FoldersEditFolder:o.MT.FoldersCreateFolder),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement("div",{className:"settings-content-icon"},C&&a.ZP.createElement(mt.Z,{id:"settingsFoldersEdit",size:i.ku,animationData:C,play:b&&String(e.folderId),noLoop:!0,onLoad:y})),"create"===e.mode&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:B.isRtl?"rtl":void 0},B("FilterIncludeInfo")),a.ZP.createElement(Me.Z,{className:"mb-0",label:B("FilterNameHint"),value:e.folder.title,onChange:function(e){const{currentTarget:n}=e;t({type:"setTitle",payload:n.value.trim()})},error:e.error&&e.error===Sn?Sn:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===wn&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:B.isRtl?"rtl":void 0},B(e.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:B.isRtl?"rtl":void 0},B("FilterInclude")),a.ZP.createElement(Re.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:n},B("FilterAddChats")),$("included")),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:B.isRtl?"rtl":void 0},B("FilterExclude")),a.ZP.createElement(Re.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:r},B("FilterAddChats")),$("excluded"))),a.ZP.createElement(dn.Z,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:n}=e.folder;n?M.length||Object.keys(T).length?(t({type:"setIsLoading",payload:!0}),"edit"===e.mode?g({id:e.folderId,folderUpdate:e.folder}):p({folder:e.folder}),setTimeout((()=>{d()}),500)):t({type:"setError",payload:wn}):t({type:"setError",payload:Sn})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var Tn=n(5765);const Rn=(0,a.X$)((({mode:e,chatIds:t,selectedIds:n,selectedChatTypes:s,filterValue:r,onSelectedIdsChange:o,onSelectedChatTypesChange:i,onFilterChange:l,onLoadMore:c})=>{const d=(0,a.sO)(null),m="included"===e?Nn.fi:Nn.Yy,h=n.length+s.length>10,Z=n.length>=100;(0,a.d4)((()=>{setTimeout((()=>{requestAnimationFrame((()=>{d.current.focus()}))}),500)}),[]);const v=(0,a.I4)((e=>{const t=[...n];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),o(t)}),[n,o]),g=(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{value:t}=e.currentTarget;l(t)}),[l]),E=(0,u.Z)(),[C,f]=(0,ye.Z)(c,t,Boolean(r));return a.ZP.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"picker-header custom-scroll"},s.map((function(e){const t=m.find((({key:t})=>e===t));if(t)return a.ZP.createElement(wt.Z,{icon:t.icon,title:E(t.title),isMinimized:h,canClose:!0,onClick:g,clickArg:t.key})})),n.map(((e,t)=>a.ZP.createElement(wt.Z,{chatOrUserId:e,isMinimized:h&&t<n.length-5,canClose:!0,onClick:v,clickArg:e}))),Z?a.ZP.createElement("p",{className:"max-items-reached",dir:"auto"},"Sorry, you can't add more than 100 chats."):a.ZP.createElement(Me.Z,{ref:d,value:r,onChange:p,placeholder:E("Search")})),a.ZP.createElement(Te.Z,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:C,onLoadMore:f},(!C||!C.length||C.includes(t[0]))&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h4",{key:"header1",className:"settings-item-header",dir:E.isRtl?"rtl":void 0},E("FilterChatTypes")),m.map((function(e){return a.ZP.createElement(Re.Z,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>g(e.key),ripple:!0},a.ZP.createElement("i",{className:`icon-${e.icon}`}),a.ZP.createElement("h3",{className:"chat-type",dir:"auto"},E(e.title)),a.ZP.createElement(Cn.Z,{label:"",checked:s.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:E.isRtl?"rtl":void 0},E("FilterChats"))),null!=C&&C.length?C.map((function(e){const t=n.includes(e);return a.ZP.createElement(Re.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>v(e),ripple:!0,disabled:!t&&Z},(0,P.YC)(e)?a.ZP.createElement(Ae.Z,{userId:e}):a.ZP.createElement(Le.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(Cn.Z,{label:"",checked:t,round:!0}))})):C&&!C.length?a.ZP.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):a.ZP.createElement(Se.Z,{key:"loading"})))})),Ln=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t,listIds:n,orderedPinnedIds:a}}=e;return{chatsById:t,listIds:n.active,orderedPinnedIds:a.active,archivedPinnedIds:a.archived,archivedListIds:n.archived}}))((({isActive:e,onScreenSelect:t,onReset:n,mode:r,state:i,dispatch:l,chatsById:c,listIds:d,orderedPinnedIds:h,archivedListIds:Z,archivedPinnedIds:v})=>{const{loadMoreChats:g}=(0,s.uC)(),{chatFilter:p}=i,{selectedChatIds:E,selectedChatTypes:C}=(0,Nn.vb)(i,r,!0),f=(0,u.Z)(),b=(0,a.Ye)((()=>{const e=d?(0,P.O)(c,d,h,"all"):void 0,t=Z?(0,P.O)(c,Z,v,"archived"):void 0;if(e||t)return[...(null==e?void 0:e.pinnedChats)||[],...(null==e?void 0:e.otherChats)||[],...(null==t?void 0:t.otherChats)||[]]}),[c,d,h,Z,v]),I=(0,a.Ye)((()=>{if(b)return b.filter((e=>!p||(0,Tn.Z)((0,P.U)(f,e),p)||E.includes(e.id))).map((({id:e})=>e))}),[b,p,f,E]),y=(0,a.I4)((e=>{l({type:"setChatFilter",payload:e})}),[l]),N=(0,a.I4)((e=>{l("included"===r?{type:"setIncludeFilters",payload:{...i.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...i.excludeFilters,excludedChatIds:e}})}),[r,i,l]),k=(0,a.I4)((e=>{const t={};e.forEach((e=>{t[e]=!0})),l("included"===r?{type:"setIncludeFilters",payload:{includedChatIds:E,...t}}:{type:"setExcludeFilters",payload:{excludedChatIds:E,...t}})}),[r,E,l]);return(0,m.ZP)(e,n,t,"included"===r?o.MT.FoldersIncludedChats:o.MT.FoldersExcludedChats),I?a.ZP.createElement(Rn,{mode:r,chatIds:I,selectedIds:E,selectedChatTypes:C,filterValue:p,onSelectedIdsChange:N,onSelectedChatTypesChange:k,onFilterChange:y,onLoadMore:g}):a.ZP.createElement(Se.Z,null)}))),An=(0,a.X$)((({currentScreen:e,shownScreen:t,state:n,dispatch:s,isActive:r,onScreenSelect:i,onReset:l})=>{const c=(0,a.I4)((()=>{e!==o.MT.FoldersCreateFolder&&e!==o.MT.FoldersEditFolder&&e!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{s({type:"reset"})}),200),e!==o.MT.FoldersIncludedChats&&e!==o.MT.FoldersExcludedChats?l():"create"===n.mode?i(o.MT.FoldersCreateFolder):i(o.MT.FoldersEditFolder)}),[n.mode,s,e,l,i]),d=(0,a.I4)((()=>{s({type:"reset"}),i(o.MT.FoldersCreateFolder)}),[i,s]),m=(0,a.I4)((e=>{s({type:"editFolder",payload:e}),i(o.MT.FoldersEditFolder)}),[s,i]),u=(0,a.I4)((()=>{s({type:"editIncludeFilters"}),i(e===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersIncludedChatsFromChatList:o.MT.FoldersIncludedChats)}),[e,s,i]),h=(0,a.I4)((()=>{s({type:"editExcludeFilters"}),i(e===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersExcludedChatsFromChatList:o.MT.FoldersExcludedChats)}),[e,s,i]);switch(e){case o.MT.Folders:return a.ZP.createElement(yn,{onCreateFolder:d,onEditFolder:m,onScreenSelect:i,isActive:r||[o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(t),onReset:l});case o.MT.FoldersCreateFolder:case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement(Mn,{state:n,dispatch:s,onAddIncludedChats:u,onAddExcludedChats:h,onReset:c,onScreenSelect:i,isActive:r||[o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(t),onBack:l});case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(Ln,{mode:"included",state:n,dispatch:s,onReset:c,onScreenSelect:i,isActive:r});case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Ln,{mode:"excluded",state:n,dispatch:s,onReset:c,onScreenSelect:i,isActive:r});default:return}}));var Fn=n(711),Bn=n(3657),$n=n(692);const xn=(0,a.X$)((({size:e=i.DC,stickerSet:t,observeIntersection:n})=>{const s=(0,a.sO)(null),o=(0,Bn.Op)(s,n),l=`stickerSet${t.id}`,c=(0,h.Z)(l,!o,r.IU.Lottie),d=(0,$n.Z)(c),m=(0,a.Ye)((()=>{if(!c)return(0,it.Xv)(t.title,2)}),[c,t.title]);return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},m,c&&a.ZP.createElement(mt.Z,{id:l,size:e,animationData:c,className:d}))})),Dn=(0,a.X$)((({stickerSet:e,observeIntersection:t})=>{const n=(0,a.sO)(null),s=(0,Bn.Op)(n,t),r=(0,h.Z)(e.hasThumbnail&&`stickerSet${e.id}`,!s),o=(0,$n.Z)(r),i=(0,a.Ye)((()=>{if(!r)return(0,it.Xv)(e.title,2)}),[r,e.title]);return a.ZP.createElement("div",{ref:n,className:"sticker-set-cover"},i,a.ZP.createElement("img",{src:r,className:o,alt:""}))}));var Un=n(3547);const On=(0,a.X$)((({stickerSet:e,observeIntersection:t,onClick:n})=>{var s;const r=(0,u.Z)();if(!e||!e.stickers)return;const o=null===(s=e.stickers)||void 0===s?void 0:s[0];return e.hasThumbnail||!o?a.ZP.createElement(Re.Z,{narrow:!0,className:"SettingsStickerSet",inactive:!o,onClick:()=>o&&n(o)},a.ZP.createElement(R.Z,{ariaLabel:e.title,color:"translucent",isRtl:r.isRtl},e.isAnimated?a.ZP.createElement(xn,{size:i.Mw,stickerSet:e,observeIntersection:t}):a.ZP.createElement(Dn,{stickerSet:e,observeIntersection:t})),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},e.title),a.ZP.createElement("div",{className:"subtitle"},r("StickerPack.StickerCount",e.count,"i")))):a.ZP.createElement(Re.Z,{narrow:!0,className:"SettingsStickerSet",onClick:()=>n(o)},a.ZP.createElement(Un.Z,{sticker:o,size:i.Mw,title:e.title,observeIntersection:t}),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},e.title),a.ZP.createElement("div",{className:"subtitle"},r("StickerPack.StickerCount",e.count,"i"))))}));var Gn=n(4851);const Jn=["Solid and Steady","Nice and Fast","Lots of Stuff"],Xn=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],zn=(0,a.X$)((0,s.c$)((e=>{var t;return{...(0,me.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}}))((({isActive:e,onScreenSelect:t,onReset:n,stickerSetIds:r,stickerSetsById:i,defaultReaction:l,messageTextSize:c,animationLevel:d,messageSendKeyCombo:h,shouldSuggestStickers:Z,shouldLoopStickers:v,timeFormat:P})=>{const{setSettingOption:g}=(0,s.uC)(),p=(0,a.sO)(null),{observe:E}=(0,Bn.S1)({rootRef:p}),[C,b,I]=(0,xe.Z)(),[y,N]=(0,a.eJ)(),k=(0,u.Z)(),S=f.$b?void 0:[{value:"enter",label:k("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:k(f.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}],w=(0,a.I4)((e=>{Jn.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),g({animationLevel:e})}),[g]),M=(0,a.I4)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,f.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()),g({messageTextSize:e})}),[g]),T=(0,a.I4)((e=>{g({timeFormat:e}),g({wasTimeFormatSetManually:!0}),(0,Fn.qf)(e)}),[g]),R=(0,a.I4)((e=>{N(e),b()}),[b]),L=r&&r.map((e=>{var t;return!(null==i||null===(t=i[e])||void 0===t||!t.installedDate)&&i[e]})).filter(Boolean);return(0,m.ZP)(e,n,t,o.MT.General),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:k.isRtl?"rtl":void 0},k("SETTINGS")),a.ZP.createElement(fn.Z,{label:k("TextSize"),min:12,max:20,value:c,onChange:M}),a.ZP.createElement(Re.Z,{icon:"photo",onClick:()=>t(o.MT.GeneralChatBackground)},k("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(at.Z,{name:"timeformat",options:Xn,selected:P,onChange:T})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:k.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(fn.Z,{options:Jn,value:d,onChange:w})),S&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},k("VoiceOver.Keyboard")),a.ZP.createElement(at.Z,{name:"keyboard-send-settings",options:S,onChange:e=>g({messageSendKeyCombo:e}),selected:h})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:k.isRtl?"rtl":void 0},k("AccDescrStickers")),l&&a.ZP.createElement(Re.Z,{className:"SettingsDefaultReaction",onClick:()=>t(o.MT.QuickReaction)},a.ZP.createElement(lt.Z,{reaction:l}),a.ZP.createElement("div",{className:"title"},k("DoubleTapSetting"))),a.ZP.createElement(Cn.Z,{label:k("SuggestStickers"),checked:Z,onCheck:e=>g({shouldSuggestStickers:e})}),a.ZP.createElement(Cn.Z,{label:k("LoopAnimatedStickers"),checked:v,onCheck:e=>g({shouldLoopStickers:e})}),a.ZP.createElement("div",{className:"mt-4",ref:p},L&&L.map((e=>a.ZP.createElement(On,{key:e.id,stickerSet:e,observeIntersection:E,onClick:R})))),y&&a.ZP.createElement(Gn.Z,{isOpen:C,fromSticker:y,onClose:I})))})));let _n;function Yn(e="*",t,n=!1){_n||(_n=document.createElement("input"),_n.setAttribute("type","file")),_n.setAttribute("accept",e),n?_n.removeAttribute("multiple"):_n.setAttribute("multiple","multiple"),_n.onchange=null,_n.value="",_n.onchange=t,_n.click()}var Hn=n(1394);function Vn(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function jn(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 qn([e,t,n]){e/=255,t/=255,n/=255;let a,s,r=Math.max(e,t,n),o=Math.min(e,t,n),i=r,l=r-o;if(s=0==r?0:l/r,r==o)a=0;else{switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;case n:a=(e-t)/l+4}a/=6}return[a,s,i]}function Kn([e,t,n]){let a,s,r,o=Math.floor(6*e),i=6*e-o,l=n*(1-t),c=n*(1-i*t),d=n*(1-(1-i)*t);switch(o%6){case 0:a=n,s=d,r=l;break;case 1:a=c,s=n,r=l;break;case 2:a=l,s=n,r=d;break;case 3:a=l,s=c,r=n;break;case 4:a=d,s=l,r=n;break;case 5:a=n,s=l,r=c}return[Math.round(255*a),Math.round(255*s),Math.round(255*r)]}function Wn(e){let[t,n,a]=qn(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 Qn=n(9524),ea=n(5866);const ta=(0,a.X$)((({wallpaper:e,theme:t,isSelected:n,onClick:s})=>{var r;const{slug:l,document:c}=e,d=`wallpaper${c.id}`,m=c.previewBlobUrl,u=(0,h.Z)(`${d}?size=m`),P=(0,ea.Z)(null===(r=c.thumbnail)||void 0===r?void 0:r.dataUri,Boolean(u),!0),{transitionClassNames:g}=(0,_.Z)(Boolean(u||m),void 0,void 0,"slow"),[p,E]=(0,a.eJ)(!1),{mediaData:C,loadProgress:f}=(0,Z.Z)(d,!p),b=!1===(0,v.Z)(p),{shouldRender:I,transitionClassNames:y}=(0,_.Z)(p&&!C||l===o.mp,void 0,b,"slow"),N=(0,a.sO)();N.current=t;const k=(0,a.I4)((()=>{(async()=>{const e=await(0,Hn.gm)(C);await Qn.save(i.fo,N.current,e),s(l)})()}),[C,s,l]);(0,a.d4)((()=>{C&&k()}),[C,k]);const S=(0,a.I4)((()=>{C?k():E((e=>!e))}),[C,k]),w=(0,X.Z)("WallpaperTile",n&&"selected");return a.ZP.createElement("div",{className:w,onClick:S},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:P,className:"thumbnail"}),a.ZP.createElement("img",{src:u||m,className:(0,X.Z)("full-media",g),alt:""}),I&&a.ZP.createElement("div",{className:(0,X.Z)("spinner-container",y)},a.ZP.createElement($.Z,{progress:f,onClick:S}))))})),na=(0,G.P2)((e=>e()),6e4,!0),aa=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.Pu)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}))((({isActive:e,onScreenSelect:t,onReset:n,background:r,isBlurred:l,loadedWallpapers:c,theme:d})=>{const{loadWallpapers:h,uploadWallpaper:Z,setThemeSettings:v}=(0,s.uC)(),P=(0,a.sO)();P.current=d,(0,a.d4)((()=>{na((()=>{h()}))}),[h]);const g=(0,a.I4)((e=>{const{files:t}=e.target;t&&t.length>0&&Z(t[0])}),[Z]),p=(0,a.I4)((()=>{Yn("image/jpeg",g,!0)}),[g]),E=(0,a.I4)((()=>{t(o.MT.GeneralChatBackgroundColor)}),[t]),C=(0,a.I4)((()=>{v({theme:d,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===d?i.Vv:i.g})}),[v,d]),f=(0,a.I4)((e=>{v({theme:P.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,r,o=-4,i=[0,0,0],l=0;const c=document.createElement("canvas"),d=c.getContext&&c.getContext("2d");if(!d)return t;const m=await(0,Hn.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(r=n.data.length;(o+=20)<r;)++l,i[0]+=n.data[o],i[1]+=n.data[o+1],i[2]+=n.data[o+2];return i[0]=Math.floor(i[0]/l),i[1]=Math.floor(i[1]/l),i[2]=Math.floor(i[2]/l),i}(t.document.thumbnail.dataUri).then((e=>{const t=Wn(e),n=`#${jn(e)}`;v({theme:P.current,backgroundColor:n,patternColor:t})}))}),[c,v]),b=(0,a.I4)((e=>{v({theme:P.current,isBlurred:e.target.checked})}),[v]),I=(0,u.Z)();(0,m.ZP)(e,n,t,o.MT.GeneralChatBackground);const y=(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(Re.Z,{icon:"camera-add",className:"mb-0",disabled:y,onClick:p},I("UploadImage")),a.ZP.createElement(Re.Z,{icon:"colorize",className:"mb-0",onClick:E},I("SetColor")),a.ZP.createElement(Re.Z,{icon:"favorite",onClick:C},I("ThemeResetToDefaults")),a.ZP.createElement(Cn.Z,{label:I("BackgroundBlurred"),checked:Boolean(l),onChange:b})),c?a.ZP.createElement("div",{className:"settings-wallpapers"},c.map((e=>a.ZP.createElement(ta,{wallpaper:e,theme:d,isSelected:r===e.slug,onClick:f})))):a.ZP.createElement(Se.Z,null))}))),sa=qn(Vn("e6ebee")),ra=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function oa(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 ia({colorPosition:e,huePosition:t},n){return[t/(n.hueRect.width-1),e[0]/(n.colorRect.width-1),1-e[1]/(n.colorRect.height-1)]}const la=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.Pu)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}))((({isActive:e,onScreenSelect:t,onReset:n,theme:r,backgroundColor:i})=>{const{setThemeSettings:l}=(0,s.uC)(),c=(0,a.sO)();c.current=r;const d=(0,a.sO)(null),u=(0,a.sO)(null),h=(0,a.sO)(null),Z=(0,a.sO)(!0),[v,P]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?qn(Vn(e.replace("#",""))):sa}(i)),g=(0,a.sO)(v);(0,a.d4)((()=>{g.current=v}),[v]);const[p,E,f]=(0,xe.Z)(),[b,I]=(0,a.eJ)(""),[y,N]=(0,a.eJ)(""),k=(0,a.sO)(),S=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:u.current.offsetLeft,...(0,me.ei)(u.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:h.current.offsetLeft,...(0,me.ei)(h.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+d.current.scrollTop),e.height-1)],{huePosition:a}=oa(g.current,k.current);return P(ia({colorPosition:n,huePosition:a},k.current)),E(),!0}function a(e){const{colorPosition:n}=oa(g.current,k.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return P(ia({colorPosition:n,huePosition:a},k.current)),E(),!0}k.current={colorRect:e,hueRect:t},(0,C.sf)(u.current,{onCapture:n,onDrag:n,onRelease:f,onClick:f,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,C.sf)(h.current,{onCapture:a,onDrag:a,onRelease:f,onClick:f,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[E,f]);const{colorPosition:w=[0,0],huePosition:M=0}=k.current?oa(v,k.current):{},T=jn(Kn(v)),R=v[0],L=jn(Kn([R,1,1]));(0,a.d4)((()=>{const e=Kn(v),t=`#${jn(e)}`;if(I(e.join(", ")),N(t),!Z.current){const n=Wn(e);l({theme:c.current,background:void 0,backgroundColor:t,patternColor:n})}Z.current=!1}),[v,l]),(0,a.d4)((()=>{!function(e,t,n,a){let s,r,o;n.current&&a.current?(s=a.current.colorRect.width,r=a.current.colorRect.height,o=n.current):(s=e.offsetWidth,r=e.offsetHeight,o=e.getContext("2d"),e.width=s,e.height=r,n.current=o);const i=o.createImageData(s,r),l=i.data,c=Kn([t,1,1]);let d=0;for(let e=0;e<r;e++){const t=1-e/(r-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);l[d++]=n[0]+(a[0]-n[0])*t,l[d++]=n[1]+(a[1]-n[1])*t,l[d++]=n[2]+(a[2]-n[2])*t,l[d++]=255}}o.putImageData(i,0,0)}(u.current.firstChild,R,S,k)}),[R]),(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 r=0;for(let e=0;e<t;e++){const n=Kn([e/(t-1),1,1]);s[r++]=n[0],s[r++]=n[1],s[r++]=n[2],s[r++]=255}n.putImageData(a,0,0)}(h.current.firstChild)}),[]);const A=(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())));P(qn(e))}e.currentTarget.value=t}),[]),F=(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}$/)&&P(qn(Vn(t.replace("#","")))),e.currentTarget.value=t}),[]),B=(0,a.I4)((e=>{P(qn(Vn(e.currentTarget.dataset.color.replace("#",""))))}),[]),$=(0,X.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",p&&"is-dragging");return(0,m.ZP)(e,n,t,o.MT.GeneralChatBackgroundColor),a.ZP.createElement("div",{ref:d,className:$},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:u,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${w[0]}px, ${w[1]}px); background-color: #${T};`})),a.ZP.createElement("div",{ref:h,className:"hue-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translateX(${M}px); background-color: #${L};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(Me.Z,{value:y,label:"HEX",onChange:F}),a.ZP.createElement(Me.Z,{value:b,label:"RGB",onChange:A}))),a.ZP.createElement("div",{className:"predefined-colors"},ra.map((e=>a.ZP.createElement("div",{className:e===`#${T}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:B})))))})));var ca=n(8406);const da=(0,a.X$)((0,s.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})))((({isActive:e,onScreenSelect:t,onReset:n,hasPrivateChatsNotifications:r,hasPrivateChatsMessagePreview:i,hasGroupNotifications:l,hasGroupMessagePreview:c,hasBroadcastNotifications:d,hasBroadcastMessagePreview:h,hasContactJoinedNotifications:Z,hasPushNotifications:v,hasWebNotifications:P,notificationSoundVolume:g})=>{const{loadNotificationSettings:p,updateContactSignUpNotification:E,updateNotificationSettings:C,updateWebNotificationSettings:f}=(0,s.uC)();(0,a.d4)((()=>{p()}),[p]);const b=(0,D.Z)(500,!0),I=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!r:!("group"===t?l:d),s="contact"===t?i:"group"===t?c:h;C({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:s},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[h,d,c,l,i,r,C]),y=(0,a.I4)((e=>{E({isSilent:!e.target.checked})}),[E]),N=(0,u.Z)();return(0,m.ZP)(e,n,t,o.MT.Notifications),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:N.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(Cn.Z,{label:"Web notifications",subLabel:N(P?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:P,onChange:e=>{f({hasWebNotifications:e.target.checked})}}),a.ZP.createElement(Cn.Z,{label:"Offline notifications",disabled:!P,subLabel:N(v?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:v,onChange:e=>{f({hasPushNotifications:e.target.checked})}}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(fn.Z,{label:"Sound",min:0,max:10,value:g,onChange:e=>{f({notificationSoundVolume:e}),b((()=>(0,ca.q3)(void 0,e)))}}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("AutodownloadPrivateChats")),a.ZP.createElement(Cn.Z,{label:N("NotificationsForPrivateChats"),subLabel:N(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:e=>{I(e,"contact","silent")}}),a.ZP.createElement(Cn.Z,{label:N("MessagePreview"),disabled:!r,subLabel:N(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:e=>{I(e,"contact","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("FilterGroups")),a.ZP.createElement(Cn.Z,{label:N("NotificationsForGroups"),subLabel:N(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:e=>{I(e,"group","silent")}}),a.ZP.createElement(Cn.Z,{label:N("MessagePreview"),disabled:!l,subLabel:N(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{I(e,"group","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("FilterChannels")),a.ZP.createElement(Cn.Z,{label:N("NotificationsForChannels"),subLabel:N(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:e=>{I(e,"broadcast","silent")}}),a.ZP.createElement(Cn.Z,{label:N("MessagePreview"),disabled:!d,subLabel:N(h?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:h,onChange:e=>{I(e,"broadcast","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("PhoneOther")),a.ZP.createElement(Cn.Z,{label:N("ContactJoined"),checked:Z,onChange:y})))}))),ma=(0,a.X$)((0,s.c$)((e=>{var t,n,a,s,r;const{settings:{byKey:{hasPassword:o,isSensitiveEnabled:i,canChangeSensitive:l},privacy:c},blocked:d,activeSessions:m}=e;return{hasPassword:o,blockedCount:d.totalCount,sessionsCount:m.length,isSensitiveEnabled:i,canChangeSensitive:l,visibilityPrivacyPhoneNumber:null===(t=c.phoneNumber)||void 0===t?void 0:t.visibility,visibilityPrivacyLastSeen:null===(n=c.lastSeen)||void 0===n?void 0:n.visibility,visibilityPrivacyProfilePhoto:null===(a=c.profilePhoto)||void 0===a?void 0:a.visibility,visibilityPrivacyForwarding:null===(s=c.forwards)||void 0===s?void 0:s.visibility,visibilityPrivacyGroupChats:null===(r=c.chatInvite)||void 0===r?void 0:r.visibility}}))((({isActive:e,onScreenSelect:t,onReset:n,hasPassword:r,blockedCount:i,sessionsCount:l,isSensitiveEnabled:c,canChangeSensitive:d,visibilityPrivacyPhoneNumber:h,visibilityPrivacyLastSeen:Z,visibilityPrivacyProfilePhoto:v,visibilityPrivacyForwarding:P,visibilityPrivacyGroupChats:g})=>{const{loadPrivacySettings:p,loadBlockedContacts:E,loadAuthorizations:C,loadContentSettings:f,updateContentSettings:b}=(0,s.uC)();(0,a.d4)((()=>{E(),C(),p(),f()}),[E,C,p,f]);const I=(0,u.Z)();function y(e){switch(e){case"everybody":return I("P2PEverybody");case"contacts":return I("P2PContacts");case"nobody":return I("P2PNobody")}}return(0,m.ZP)(e,n,t,o.MT.Privacy),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Re.Z,{icon:"delete-user",narrow:!0,onClick:()=>t(o.MT.PrivacyBlockedUsers)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("BlockedUsers")),i>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I("Users",i)))),a.ZP.createElement(Re.Z,{icon:"lock",narrow:!0,onClick:()=>t(r?o.MT.TwoFaEnabled:o.MT.TwoFaDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I(r?"PasswordOn":"PasswordOff")))),a.ZP.createElement(Re.Z,{icon:"active-sessions",narrow:!0,onClick:()=>t(o.MT.PrivacyActiveSessions)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("SessionsTitle")),l>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},1===l?"1 session":`${l} sessions`)))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:I.isRtl?"rtl":void 0},I("PrivacyTitle")),a.ZP.createElement(Re.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyPhoneNumber)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(h)))),a.ZP.createElement(Re.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyLastSeen)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(Z)))),a.ZP.createElement(Re.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyProfilePhoto)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(v)))),a.ZP.createElement(Re.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyForwarding)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(P)))),a.ZP.createElement(Re.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyGroupChats)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(g))))),d&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:I.isRtl?"rtl":void 0},I("lng_settings_sensitive_title")),a.ZP.createElement(Cn.Z,{label:I("lng_settings_sensitive_disable_filtering"),subLabel:I("lng_settings_sensitive_about"),checked:Boolean(c),disabled:!d,onCheck:b})))}))),ua=(0,a.X$)((0,s.c$)((e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language})))((({isActive:e,onScreenSelect:t,onReset:n,languages:r,language:i})=>{const{loadLanguages:l,setSettingOption:c}=(0,s.uC)(),[d,u]=(0,a.eJ)(i),[h,Z,v]=(0,xe.Z)();(0,a.d4)((()=>{l()}),[l]);const P=(0,a.I4)((e=>{u(e),Z(),(0,Fn.m0)(e,(()=>{v(),c({language:e})}))}),[Z,v,c]),g=(0,a.Ye)((()=>r?function(e){const t=(window.navigator.language||"en").toLowerCase(),n=t.substr(0,2);return e.map((({langCode:e,nativeName:t,name:n})=>({value:e,label:t,subLabel:n}))).sort((e=>!t||e.value!==t&&e.value!==n?0:-1))}(r):void 0),[r]);return(0,m.ZP)(e,n,t,o.MT.Language),a.ZP.createElement("div",{className:"settings-content settings-item settings-language custom-scroll"},g?a.ZP.createElement(at.Z,{name:"keyboard-send-settings",options:g,selected:d,loadingOption:h?d:void 0,onChange:P}):a.ZP.createElement(Se.Z,null))})));function ha(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"}}const Za=(0,a.X$)((0,s.c$)(((e,{screen:t})=>{let n;const{chats:{byId:a},settings:{privacy:s}}=e;switch(t){case o.MT.PrivacyPhoneNumber:n=s.phoneNumber;break;case o.MT.PrivacyLastSeen:n=s.lastSeen;break;case o.MT.PrivacyProfilePhoto:n=s.profilePhoto;break;case o.MT.PrivacyForwarding:n=s.forwards;break;case o.MT.PrivacyGroupChats:n=s.chatInvite}return n?{...n,chatsById:a}:{}}))((({screen:e,isActive:t,onScreenSelect:n,onReset:r,visibility:i,allowUserIds:l,allowChatIds:c,blockUserIds:d,blockChatIds:h,chatsById:Z})=>{const{setPrivacyVisibility:v}=(0,s.uC)(),P=(0,u.Z)(),g=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyGroupChats:return[{value:"everybody",label:P("P2PEverybody")},{value:"contacts",label:P("P2PContacts")}];default:return[{value:"everybody",label:P("P2PEverybody")},{value:"contacts",label:P("P2PContacts")},{value:"nobody",label:P("P2PNobody")}]}}),[P,e]),p={shouldShowDenied:"nobody"!==i,shouldShowAllowed:"everybody"!==i},E=ha(e),C=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyPhoneNumber:return P("PrivacyPhoneTitle");case o.MT.PrivacyLastSeen:return P("LastSeenTitle");case o.MT.PrivacyProfilePhoto:return P("PrivacyProfilePhotoTitle");case o.MT.PrivacyForwarding:return P("PrivacyForwardsTitle");case o.MT.PrivacyGroupChats:return P("WhoCanAddMe");default:return}}),[P,e]);(0,m.ZP)(t,r,n,e);const f=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyLastSeen:return P("CustomHelp");default:return}}),[P,e]),b=(()=>{switch(e){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;default:return o.MT.PrivacyGroupChatsAllowedContacts}})(),I=(()=>{switch(e){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;default:return o.MT.PrivacyGroupChatsDeniedContacts}})(),y=(0,a.Ye)((()=>l&&c&&Z?c.reduce(((e,t)=>e+(Z[t]?Z[t].membersCount:0)),l.length):0),[c,l,Z]),N=(0,a.Ye)((()=>d&&h&&Z?h.reduce(((e,t)=>e+(Z[t]?Z[t].membersCount:0)),d.length):0),[h,d,Z]),k=(0,a.I4)((e=>{v({privacyKey:E,visibility:e})}),[E,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:P.isRtl?"rtl":void 0},C),a.ZP.createElement(at.Z,{name:`visibility-${E}`,options:g,onChange:k,selected:i}),f&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:P.isRtl?"rtl":void 0},f)),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:P.isRtl?"rtl":void 0},P("PrivacyExceptions")),p.shouldShowAllowed&&a.ZP.createElement(Re.Z,{narrow:!0,icon:"add-user",onClick:()=>{n(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"},P("AlwaysShareWith")),a.ZP.createElement("span",{className:"subtitle"},P("EditAdminAddUsers")))),p.shouldShowDenied&&a.ZP.createElement(Re.Z,{narrow:!0,icon:"delete-user",onClick:()=>{n(I)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},N>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"",N),a.ZP.createElement("span",{className:"title"},P("NeverShareWith")),a.ZP.createElement("span",{className:"subtitle"},P("EditAdminAddUsers"))))))})));function va(e){return[e.region,e.country].filter(Boolean).join(", ")}function Pa(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}const ga=(0,a.X$)((0,s.c$)((e=>({activeSessions:e.activeSessions})))((({isActive:e,onScreenSelect:t,onReset:n,activeSessions:r})=>{const{loadAuthorizations:i,terminateAuthorization:l,terminateAllAuthorizations:c}=(0,s.uC)(),[d,h,Z]=(0,xe.Z)();(0,a.d4)((()=>{i()}),[i]);const v=(0,a.I4)((e=>{l({hash:e})}),[l]),P=(0,a.I4)((()=>{Z(),c()}),[Z,c]),g=(0,a.Ye)((()=>r.find((e=>e.isCurrent))),[r]),p=(0,a.Ye)((()=>r.filter((e=>!e.isCurrent))),[r]),E=(0,u.Z)();return(0,m.ZP)(e,n,t,o.MT.PrivacyActiveSessions),a.ZP.createElement("div",{className:"settings-content custom-scroll"},g&&(f=g,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:E.isRtl?"rtl":void 0},E("AuthSessions.CurrentSession")),a.ZP.createElement(Re.Z,{narrow:!0,inactive:!0,className:"no-icon"},a.ZP.createElement("div",{className:"multiline-menu-item",dir:"auto"},a.ZP.createElement("span",{className:"title",dir:"auto"},f.appName),a.ZP.createElement("span",{className:"subtitle black tight"},Pa(f)),a.ZP.createElement("span",{className:"subtitle"},f.ip," - ",va(f)))),a.ZP.createElement(Re.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:h},E("TerminateAllSessions")))),p&&(C=p,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:E.isRtl?"rtl":void 0},E("OtherSessions")),C.map((function(e){return a.ZP.createElement(Re.Z,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{v(e.hash)}}],className:"no-icon"},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,q.VX)(E,1e3*e.dateActive)),a.ZP.createElement("span",{className:"title"},e.appName),a.ZP.createElement("span",{className:"subtitle black tight"},Pa(e)),a.ZP.createElement("span",{className:"subtitle"},e.ip," - ",va(e))))})))),p&&a.ZP.createElement(Xe.Z,{isOpen:d,onClose:Z,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:P,confirmIsDestructive:!0}));var C,f})));var pa=n(6272);const Ea=(0,a.X$)((0,s.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}}))((({usersById:e,blockedIds:t,contactIds:n,localContactIds:r,currentUserId:o,isOpen:i,onClose:l})=>{const{loadContactList:c,setUserSearchQuery:d,blockContact:m}=(0,s.uC)(),h=(0,u.Z)(),[Z,v]=(0,a.eJ)(""),g=(0,a.sO)(null);(0,a.d4)((()=>{d({query:Z})}),[Z,d]);const p=(0,a.Ye)((()=>{const a=(0,me.Tw)([...n||[],...r||[]].filter((e=>e!==o&&!t.includes(e))));return(0,P.kK)(a,e,Z).sort(((t,n)=>{const a=(0,P.Js)(e[t])||"",s=(0,P.Js)(e[n])||"";return a.localeCompare(s)}))}),[t,n,o,Z,r,e]),E=(0,a.I4)((t=>{const{id:n,accessHash:a}=e[t]||{};n&&a&&(m({contactId:n,accessHash:a}),l())}),[m,l,e]);return a.ZP.createElement(Fe,{isOpen:i,chatOrUserIds:p,filterRef:g,filterPlaceholder:h("BlockedUsers.BlockUser"),filter:Z,onFilterChange:v,loadMore:c,onSelectChatOrUser:E,onClose:l})}))),Ca=(0,a.X$)((0,s.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}}))((({isActive:e,onScreenSelect:t,onReset:n,chatsByIds:r,usersByIds:l,blockedIds:c,phoneCodeList:d})=>{const{unblockContact:h}=(0,s.uC)(),Z=(0,u.Z)(),[v,g,p]=(0,xe.Z)(),E=(0,a.I4)((e=>{h({contactId:e})}),[h]);return(0,m.ZP)(e,n,t,o.MT.PrivacyBlockedUsers),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content infinite-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("p",{className:"settings-item-description-larger mt-0 mb-2",dir:Z.isRtl?"rtl":void 0},Z("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},null!=c&&c.length?a.ZP.createElement("div",{className:"scroll-container"},c.map(((e,t)=>function(e,t,n){const s=(0,P.YC)(e),o=s?l[e]:void 0,c=s?void 0:r[e],m=(0,X.Z)("Chat chat-item-clickable blocked-list-item small-icon",s?"private":"group");return a.ZP.createElement(Re.Z,{key:e,className:m,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{E(e)}}],style:`top: ${(0+t)*i.rS}px;`},a.ZP.createElement(ge.Z,{size:"medium",user:o,chat:c}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},a.ZP.createElement("h3",{dir:"auto"},(0,Pe.Z)((s?(0,P.Js)(o):(0,P.U)(Z,c))||"")),(null==o?void 0:o.phoneNumber)&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,pa.WZ)(d,o.phoneNumber)),o&&!o.phoneNumber&&o.username&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",o.username)))}(e,t)))):c&&!c.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},Z("NoBlocked")):a.ZP.createElement(Se.Z,{key:"loading"}))),a.ZP.createElement(dn.Z,{isShown:!0,onClick:g,ariaLabel:Z("BlockContact")},a.ZP.createElement("i",{className:"icon-add"})),a.ZP.createElement(Ea,{isOpen:v,onClose:p}))})));var fa=n(7854);const ba=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,g.zB)(e,"🔐")})))((({isActive:e,onReset:t,animatedEmoji:n,onScreenSelect:s})=>{const r=(0,u.Z)();return(0,m.ZP)(e,t,s,o.MT.TwoFaEnabled),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:n,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,Pe.Z)(r("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Re.Z,{icon:"edit",onClick:()=>s(o.MT.TwoFaChangePasswordCurrent)},r("ChangePassword")),a.ZP.createElement(Re.Z,{icon:"password-off",onClick:()=>s(o.MT.TwoFaTurnOff)},r("TurnPasswordOff")),a.ZP.createElement(Re.Z,{icon:"email",onClick:()=>s(o.MT.TwoFaRecoveryEmailCurrentPassword)},r("SetRecoveryEmail"))))})));var Ia=n(3490),ya=n(9364);const Na=(0,a.X$)((({screen:e,isActive:t,onScreenSelect:n,onReset:s,error:r,isLoading:o,expectedPassword:i,placeholder:l="Current Password",hint:c,submitLabel:d,clearError:h,onSubmit:Z})=>{const[v,P]=(0,a.eJ)(""),[g,p]=(0,a.eJ)(!1),E=(0,a.I4)((e=>{i&&e!==i?P("Passwords Should Be Equal"):Z(e)}),[Z,i]),C=(0,a.I4)((()=>{h&&h(),P("")}),[h]),f=(0,u.Z)();return(0,m.ZP)(t,s,n,e),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(Ia.Z,{isBig:!0,isPasswordVisible:g})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(ya.Z,{error:v||r,hint:c,placeholder:l,submitLabel:d||f("Next"),clearError:C,isLoading:o,isPasswordVisible:g,onChangePasswordVisibility:p,onSubmit:E})))})),ka=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,g.zB)(e,"🔐")})))((({isActive:e,onScreenSelect:t,onReset:n,animatedEmoji:s,onStart:r})=>{const i=(0,u.Z)();return(0,m.ZP)(e,n,t,o.MT.TwoFaDisabled),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:s,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},i("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(R.Z,{onClick:r},i("EditAdminTransferSetPassword"))))}))),Sa=f.wB?550:400,wa=(0,a.X$)((0,s.c$)(((e,{icon:t})=>({animatedEmoji:(0,g.zB)(e,"email"===t?"💌":"💡")})))((({animatedEmoji:e,type:t="text",isLoading:n,error:s,placeholder:r,shouldConfirm:o,clearError:i,onSubmit:l,isActive:c,onScreenSelect:d,onReset:h,screen:Z})=>{const v=(0,a.sO)(null),[P,g]=(0,a.eJ)(""),[p,E,C]=(0,xe.Z)(!1);(0,a.d4)((()=>{f.$b||setTimeout((()=>{v.current.focus()}),Sa)}),[]);const b=(0,u.Z)();return(0,m.ZP)(c,h,d,Z),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:e,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),v.current&&l(P)}},a.ZP.createElement(Me.Z,{ref:v,value:P,inputMode:t,label:r,error:s,onChange:e=>{s&&i&&i(),g(e.target.value)}}),P?a.ZP.createElement(R.Z,{type:"submit",isLoading:n,ripple:!0},b("Continue")):a.ZP.createElement(R.Z,{isText:!0,isLoading:n,ripple:!0,onClick:o?E:()=>{l()}},b("YourEmailSkip"))),o&&a.ZP.createElement(we.Z,{className:"narrow",isOpen:p,title:b("YourEmailSkipWarning"),onClose:C},(0,Pe.Z)(b("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(R.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{C(),l()}},b("YourEmailSkip")),a.ZP.createElement(R.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:C},b("Cancel"))))))}))),Ma=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,g.zB)(e,"🥳")})))((({isActive:e,onReset:t,animatedEmoji:n,onScreenSelect:s})=>{const r=(0,u.Z)();return(0,m.ZP)(e,t,s,o.MT.TwoFaCongratulations),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:n,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},r("TwoStepVerificationPasswordSetInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(R.Z,{onClick:()=>{s(o.MT.Privacy)}},r("TwoStepVerificationPasswordReturnSettings"))))}))),Ta=f.wB?550:400,Ra=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,g.zB)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength})))((({animatedEmoji:e,codeLength:t,isLoading:n,error:s,clearError:r,onSubmit:o,isActive:i,onScreenSelect:l,onReset:c,screen:d})=>{const h=(0,a.sO)(null),[Z,v]=(0,a.eJ)("");(0,a.d4)((()=>{f.$b||setTimeout((()=>{h.current.focus()}),Ta)}),[]);const P=(0,u.Z)();return(0,m.ZP)(i,c,l,d),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:e,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Me.Z,{value:Z,ref:h,inputMode:"decimal",label:P("YourEmailCode"),error:s,onChange:e=>{s&&r&&r();const n=e.target.value.slice(0,t);n.length===t&&o(n),v(n),e.target.value=n}}),n&&a.ZP.createElement(Se.Z,null)))}))),La=(0,a.X$)((0,s.c$)((e=>({...e.twoFaSettings})))((({currentScreen:e,shownScreen:t,state:n,hint:r,isLoading:i,error:l,waitingEmailCodeLength:c,dispatch:d,isActive:m,onScreenSelect:h,onReset:Z})=>{const{updatePassword:v,checkPassword:P,clearTwoFaError:g,updateRecoveryEmail:p,provideTwoFaEmailCode:E,clearPassword:C}=(0,s.uC)();(0,a.d4)((()=>{c&&(e===o.MT.TwoFaNewPasswordEmail?h(o.MT.TwoFaNewPasswordEmailCode):e===o.MT.TwoFaRecoveryEmail&&h(o.MT.TwoFaRecoveryEmailCode))}),[e,h,c]);const f=(0,a.I4)((()=>{d({type:"reset"}),h(o.MT.TwoFaNewPassword)}),[d,h]),b=(0,a.I4)((e=>{d({type:"setPassword",payload:e}),h(o.MT.TwoFaNewPasswordConfirm)}),[d,h]),I=(0,a.I4)((()=>{h(o.MT.TwoFaNewPasswordHint)}),[h]),y=(0,a.I4)((e=>{d({type:"setHint",payload:e}),h(o.MT.TwoFaNewPasswordEmail)}),[d,h]),N=(0,a.I4)((e=>{d({type:"setEmail",payload:e}),v({...n,email:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[d,h,n,v]),k=(0,a.I4)((e=>{d({type:"setCurrentPassword",payload:e}),P({currentPassword:e,onSuccess:()=>{h(o.MT.TwoFaChangePasswordNew)}})}),[P,d,h]),S=(0,a.I4)((e=>{d({type:"setPassword",payload:e}),h(o.MT.TwoFaChangePasswordConfirm)}),[d,h]),w=(0,a.I4)((()=>{h(o.MT.TwoFaChangePasswordHint)}),[h]),M=(0,a.I4)((e=>{d({type:"setHint",payload:e}),v({...n,hint:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[d,h,n,v]),T=(0,a.I4)((e=>{C({currentPassword:e,onSuccess:()=>{h(o.MT.Privacy)}})}),[C,h]),R=(0,a.I4)((e=>{d({type:"setCurrentPassword",payload:e}),P({currentPassword:e,onSuccess:()=>{h(o.MT.TwoFaRecoveryEmail)}})}),[P,d,h]),L=(0,a.I4)((e=>{d({type:"setEmail",payload:e}),p({...n,email:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[d,h,n,p]),A=(0,a.I4)((e=>{E({code:e})}),[E]),F=(0,u.Z)();switch(e){case o.MT.TwoFaDisabled:return a.ZP.createElement(ka,{onStart:f,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPassword,o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPassword:return a.ZP.createElement(Na,{screen:e,placeholder:F("PleaseEnterPassword"),submitLabel:F("Continue"),onSubmit:b,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(Na,{screen:e,expectedPassword:n.password,placeholder:F("PleaseReEnterPassword"),submitLabel:F("Continue"),onSubmit:I,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPasswordHint:return a.ZP.createElement(wa,{icon:"hint",placeholder:F("PasswordHintPlaceholder"),onSubmit:y,screen:e,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(wa,{icon:"email",type:"email",isLoading:i,error:l,clearError:g,placeholder:F("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:N,screen:e,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(Ra,{isLoading:i,error:l,clearError:g,onSubmit:A,screen:e,onScreenSelect:h,isActive:m||t===o.MT.TwoFaCongratulations,onReset:Z});case o.MT.TwoFaCongratulations:return a.ZP.createElement(Ma,{onScreenSelect:h,isActive:m,onReset:Z});case o.MT.TwoFaEnabled:return a.ZP.createElement(ba,{onScreenSelect:h,isActive:m||[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(t),onReset:Z});case o.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(Na,{screen:e,isLoading:i,error:l,clearError:g,hint:r,onSubmit:k,onScreenSelect:h,isActive:m||[o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaChangePasswordNew:return a.ZP.createElement(Na,{screen:e,placeholder:F("PleaseEnterNewFirstPassword"),onSubmit:S,onScreenSelect:h,isActive:m||[o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(Na,{screen:e,expectedPassword:n.password,placeholder:F("PleaseReEnterPassword"),onSubmit:w,onScreenSelect:h,isActive:m||[o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement(wa,{isLoading:i,error:l,clearError:g,icon:"hint",placeholder:F("PasswordHintPlaceholder"),onSubmit:M,onScreenSelect:h,isActive:m||t===o.MT.TwoFaCongratulations,onReset:Z,screen:e});case o.MT.TwoFaTurnOff:return a.ZP.createElement(Na,{isLoading:i,error:l,clearError:g,hint:r,onSubmit:T,onScreenSelect:h,isActive:m,onReset:Z,screen:e});case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(Na,{screen:e,isLoading:i,error:l,clearError:g,hint:r,onSubmit:R,onScreenSelect:h,isActive:m||[o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement(wa,{screen:e,icon:"email",type:"email",placeholder:F("RecoveryEmailTitle"),onSubmit:L,onScreenSelect:h,isActive:m||[o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(Ra,{screen:e,isLoading:i,error:l,clearError:g,onSubmit:A,onScreenSelect:h,isActive:m||t===o.MT.TwoFaCongratulations,onReset:Z});default:return}})));var Aa=n(1820);function Fa(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.PrivacyForwardingAllowedContacts:case o.MT.PrivacyForwardingDeniedContacts:return n.forwards;case o.MT.PrivacyGroupChatsDeniedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const Ba=(0,a.X$)((0,s.c$)(((e,{screen:t})=>{const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:r}=e;return{currentUserId:r,chatsById:n,listIds:a.active,orderedPinnedIds:s.active,archivedPinnedIds:s.archived,archivedListIds:a.archived,settings:Fa(e,t)}}))((({currentUserId:e,isAllowList:t,screen:n,settings:r,chatsById:i,listIds:l,orderedPinnedIds:c,archivedListIds:d,archivedPinnedIds:h,isActive:Z,onScreenSelect:v,onReset:g})=>{const{setPrivacySettings:p}=(0,s.uC)(),E=(0,u.Z)(),C=(0,a.Ye)((()=>r?t?[...r.allowUserIds,...r.allowChatIds]:[...r.blockUserIds,...r.blockChatIds]:[]),[t,r]),[f,b]=(0,a.eJ)(""),[I,y]=(0,a.eJ)(!1),[N,k]=(0,a.eJ)(C),S=(0,a.Ye)((()=>{const e=l?(0,P.O)(i,l,c,"all"):void 0,t=d?(0,P.O)(i,d,h,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]}),[i,l,c,d,h]),w=(0,a.Ye)((()=>{if(S)return S.filter((t=>((0,P.YC)(t.id)&&t.id!==e||(0,P.Bf)(t))&&(!f||(0,Tn.Z)((0,P.U)(E,t),f)||C.includes(t.id)))).map((({id:e})=>e))}),[S,e,E,f,C]),M=(0,a.I4)((e=>{k(e),y(!0)}),[]),T=(0,a.I4)((()=>{p({privacyKey:ha(n),isAllowList:Boolean(t),contactsIds:N}),v(o.MT.Privacy)}),[t,N,v,n,p]);return(0,m.ZP)(Z,g,v,n),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Aa.Z,{itemIds:w||[],selectedIds:N,filterValue:f,filterPlaceholder:E(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:M,onFilterChange:b}),a.ZP.createElement(dn.Z,{isShown:I,onClick:T,ariaLabel:E(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),$a=(0,a.X$)((0,s.c$)((e=>{const{availableReactions:t,appConfig:n}=e;return{availableReactions:t,selectedReaction:null==n?void 0:n.defaultReaction}}))((({isActive:e,onReset:t,onScreenSelect:n,availableReactions:r,selectedReaction:i})=>{const{setDefaultReaction:l}=(0,s.uC)();(0,m.ZP)(e,t,n,o.MT.General);const c=(null==r?void 0:r.filter((e=>!e.isInactive)).map((e=>({label:a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(lt.Z,{reaction:e.reaction}),e.title),value:e.reaction}))))||[],d=(0,a.I4)((e=>{l({reaction:e})}),[l]);return a.ZP.createElement("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction"},a.ZP.createElement(at.Z,{name:"quick-reaction-settings",options:c,selected:i,onChange:d}))}))),xa=Object.keys(o.MT).length/2,Da=[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],Ua=[o.MT.Folders,o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersEditFolderFromChatList,o.MT.FoldersIncludedChats,o.MT.FoldersIncludedChatsFromChatList,o.MT.FoldersExcludedChats,o.MT.FoldersExcludedChatsFromChatList],Oa=[o.MT.PrivacyBlockedUsers,o.MT.PrivacyActiveSessions],Ga=[o.MT.PrivacyPhoneNumberAllowedContacts,o.MT.PrivacyPhoneNumberDeniedContacts],Ja=[o.MT.PrivacyLastSeenAllowedContacts,o.MT.PrivacyLastSeenDeniedContacts],Xa=[o.MT.PrivacyProfilePhotoAllowedContacts,o.MT.PrivacyProfilePhotoDeniedContacts],za=[o.MT.PrivacyForwardingAllowedContacts,o.MT.PrivacyForwardingDeniedContacts],_a=[o.MT.PrivacyGroupChatsAllowedContacts,o.MT.PrivacyGroupChatsDeniedContacts],Ya=(0,a.X$)((({isActive:e,currentScreen:t,foldersState:n,foldersDispatch:s,onScreenSelect:r,onReset:i,shouldSkipTransition:l})=>{const[c,d]=(0,tn.Z)(an,nn),m=(0,a.I4)((()=>{t!==o.MT.FoldersCreateFolder&&t!==o.MT.FoldersEditFolder&&t!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{s({type:"reset"})}),200),t!==o.MT.FoldersIncludedChats&&t!==o.MT.FoldersExcludedChats?i():"create"===n.mode?r(o.MT.FoldersCreateFolder):r(o.MT.FoldersEditFolder)}),[n.mode,s,t,i,r]),u=(0,a.I4)((()=>{s({type:"saveFilters"}),m()}),[s,m]);function h(i,l,h){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(sn,{currentScreen:t,onReset:m,onSaveFilter:u,onScreenSelect:r,editedFolderId:n.folderId}),function(i,l){const u={[o.MT.PrivacyPhoneNumber]:Ga.includes(l),[o.MT.PrivacyLastSeen]:Ja.includes(l),[o.MT.PrivacyProfilePhoto]:Xa.includes(l),[o.MT.PrivacyForwarding]:za.includes(l),[o.MT.PrivacyGroupChats]:_a.includes(l)},h=Da.includes(l),Z=Ua.includes(l),v=Oa.includes(l)||h||Object.keys(u).includes(l.toString())||Object.values(u).find((e=>!0===e));switch(t){case o.MT.Main:return a.ZP.createElement(ln,{onScreenSelect:r,isActive:e,onReset:m});case o.MT.EditProfile:return a.ZP.createElement(En,{onScreenSelect:r,isActive:e&&i,onReset:m});case o.MT.General:return a.ZP.createElement(zn,{onScreenSelect:r,isActive:i||l===o.MT.GeneralChatBackgroundColor||l===o.MT.GeneralChatBackground||l===o.MT.QuickReaction||v||Z,onReset:m});case o.MT.QuickReaction:return a.ZP.createElement($a,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.Notifications:return a.ZP.createElement(da,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.DataStorage:return a.ZP.createElement(bn,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.Privacy:return a.ZP.createElement(ma,{onScreenSelect:r,isActive:i||v||h,onReset:m});case o.MT.Language:return a.ZP.createElement(ua,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.GeneralChatBackground:return a.ZP.createElement(aa,{onScreenSelect:r,isActive:i||l===o.MT.GeneralChatBackgroundColor,onReset:m});case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement(la,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.PrivacyActiveSessions:return a.ZP.createElement(ga,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.PrivacyBlockedUsers:return a.ZP.createElement(Ca,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.PrivacyPhoneNumber:case o.MT.PrivacyLastSeen:case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyForwarding:case o.MT.PrivacyGroupChats:return a.ZP.createElement(Za,{screen:t,onScreenSelect:r,isActive:i||u[t],onReset:m});case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement(Ba,{isAllowList:!0,screen:t,onScreenSelect:r,isActive:i||u[t],onReset:m});case o.MT.PrivacyPhoneNumberDeniedContacts:case o.MT.PrivacyLastSeenDeniedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:case o.MT.PrivacyForwardingDeniedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement(Ba,{screen:t,onScreenSelect:r,isActive:i,onReset:m});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(An,{currentScreen:t,shownScreen:l,state:n,dispatch:s,isActive:i,onScreenSelect:r,onReset:m});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(La,{currentScreen:t,state:c,dispatch:d,shownScreen:l,isActive:i,onScreenSelect:r,onReset:m});default:return}}(i,h))}return a.ZP.createElement(A.Z,{id:"Settings",name:l?"none":f.s0,activeKey:t,renderCount:xa},h)})),Ha=(0,G.P2)((e=>e()),6e4,!0),Va=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n,statusesById:a}=e.users;return{usersById:n,userStatusesById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}}))((({isActive:e,filter:t,usersById:n,userStatusesById:r,contactIds:o,serverTimeOffset:i,onReset:l})=>{const{loadContactList:c,openChat:d}=(0,s.uC)();(0,a.d4)((()=>{Ha((()=>{c()}))})),(0,m.ZP)(e,l);const u=(0,a.I4)((e=>{d({id:e,shouldReplaceHistory:!0})}),[d]),h=(0,a.Ye)((()=>{if(!o)return;const e=(0,P.kK)(o,n,t);return(0,P.Z0)(e,n,r,void 0,i)}),[o,t,n,r,i]),[Z,v]=(0,ye.Z)(void 0,h,Boolean(t));return a.ZP.createElement(Te.Z,{items:Z,onLoadMore:v,className:"chat-list custom-scroll"},null!=Z&&Z.length?Z.map((e=>a.ZP.createElement(Re.Z,{key:e,className:"chat-item-clickable",onClick:()=>u(e),ripple:!f.wB},a.ZP.createElement(Ae.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):Z&&!Z.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},t.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(Se.Z,{key:"loading"}))}))),ja=(0,G.P2)((e=>e()),6e4,!0),qa=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.chats,{query:a,fetchingStatus:s,globalResults:r,localResults:o}=e.globalSearch,{userIds:i}=r||{},{userIds:l}=o||{};return{chatsById:n,localContactIds:t,searchQuery:a,isSearching:null==s?void 0:s.chats,globalUserIds:i,localUserIds:l}}))((({isChannel:e,isActive:t,selectedMemberIds:n,onSelectedMemberIdsChange:r,onNextStep:o,onReset:i,chatsById:l,localContactIds:c,searchQuery:d,isSearching:h,localUserIds:Z,globalUserIds:v})=>{const{loadContactList:g,setGlobalSearchQuery:p}=(0,s.uC)();(0,a.d4)((()=>{ja((()=>{g()}))}));const E=(0,u.Z)();(0,m.ZP)(t,i);const C=(0,a.I4)((e=>{p({query:e})}),[p]),f=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId,t=c?(0,P.kK)(c,e,d):[];return(0,P.ih)((0,me.Tw)([...t,...Z||[],...v||[]]).filter((t=>{const n=e[t];return!n||!n.isSelf&&(n.canBeInvitedToGroup||!(0,P.cS)(n))})),l,!1,n)}),[c,l,d,Z,v,n]),b=(0,a.I4)((()=>{(n.length||e)&&(p({query:""}),o())}),[n.length,e,p,o]);return a.ZP.createElement("div",{className:"NewChat step-1"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:i,ariaLabel:"Return to Chat List"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,E("GroupAddMembers"))),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Aa.Z,{itemIds:f,selectedIds:n,filterValue:d,filterPlaceholder:E("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:h,onSelectedIdsChange:r,onFilterChange:C}),a.ZP.createElement(dn.Z,{isShown:Boolean(n.length||e),onClick:b,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Ka=(0,a.X$)((0,s.c$)((e=>{const{progress:t,error:n}=e.chatCreation||{};return{creationProgress:t,creationError:n}}))((({isChannel:e,isActive:t,memberIds:n,onReset:r,creationProgress:i,creationError:l})=>{const{createGroupChat:c,createChannel:d}=(0,s.uC)(),h=(0,u.Z)();(0,m.ZP)(t,r);const[Z,v]=(0,a.eJ)(""),[P,g]=(0,a.eJ)(""),[p,E]=(0,a.eJ)(),[C,f]=(0,a.eJ)(),b="Chat title can't be empty",I="Channel title can't be empty",y="Sorry, creating supergroups is not yet supported",N=i===o.Nh.InProgress,k=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");v(n),n!==t&&(e.currentTarget.value=n)}),[]),S=(0,a.I4)((e=>{g(e.currentTarget.value)}),[]),w=(0,a.I4)((()=>{Z.length?n.length>199?f(y):c({title:Z,photo:p,memberIds:n}):f(b)}),[Z,n,c,p,b,y]),M=(0,a.I4)((()=>{Z.length?d({title:Z,about:P,photo:p,memberIds:n}):f(I)}),[Z,d,P,p,n,I]);(0,a.d4)((()=>{i===o.Nh.Complete&&r(!0)}),[i,r]);const T=l&&h(l)||(C!==b&&C!==I?C:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.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,h(e?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(cn.Z,{onChange:E,title:h("AddPhoto")}),a.ZP.createElement(Me.Z,{value:Z,onChange:k,label:h(e?"EnterChannelName":"GroupName"),error:C===b||C===I?C:void 0}),e&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Me.Z,{value:P,onChange:S,label:h("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},h("DescriptionInfo"))),T&&a.ZP.createElement("p",{className:"error"},T),n.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},h("GroupInfo.ParticipantCount",n.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},n.map((e=>a.ZP.createElement(Re.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ae.Z,{userId:e}))))))),a.ZP.createElement(dn.Z,{isShown:0!==Z.length,onClick:e?M:w,disabled:N,ariaLabel:e?h("ChannelIntro.CreateChannel"):"Create Group"},N?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Wa=Object.keys(o.du).length/2,Qa=(0,a.X$)((({isActive:e,isChannel:t=!1,content:n,onContentChange:s,onReset:r})=>{const[i,l]=(0,a.eJ)([]),c=(0,a.I4)((()=>{s(t?o.du.NewChannelStep2:o.du.NewGroupStep2)}),[t,s]);return a.ZP.createElement(A.Z,{id:"NewChat",name:f.s0,renderCount:Wa,activeKey:n},(s=>{switch(n){case o.du.NewChannelStep1:case o.du.NewGroupStep1:return a.ZP.createElement(qa,{isChannel:t,isActive:e,selectedMemberIds:i,onSelectedMemberIdsChange:l,onNextStep:c,onReset:r});case o.du.NewChannelStep2:case o.du.NewGroupStep2:return a.ZP.createElement(Ka,{isChannel:t,isActive:s&&e,memberIds:i,onReset:r});default:return}}))}));var es=n(1080);const ts=(0,a.X$)((({isActive:e,onReset:t,onContentChange:n})=>{const s=(0,u.Z)();return(0,m.ZP)(e,t,n,o.du.Archived),a.ZP.createElement("div",{className:"ArchivedChats"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:t,ariaLabel:"Return to chat list"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,s("ArchivedChats"))),a.ZP.createElement(es.Z,{folderType:"archived",isActive:e}))}));var ns=n(1218);const as=(0,a.X$)((0,s.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}))((({isOpen:e,chatId:t,foldersById:n,folderOrderedIds:r,onClose:o,onCloseAnimationEnd:i})=>{const{editChatFolders:l}=(0,s.uC)(),c=(0,u.Z)(),d=(0,a.Ye)((()=>n?Object.keys(n).reduce(((e,a)=>{const{includedChatIds:s,pinnedChatIds:r}=n[Number(a)];return(s.includes(t)||null!=r&&r.includes(t))&&e.push(a),e}),[]):[]),[t,n]),[m,h]=(0,a.eJ)(d),Z=(0,a.Ye)((()=>(null==r?void 0:r.map((e=>({label:n?n[e].title:"",value:String(e)}))))||[]),[r,n]),v=(0,a.I4)((()=>{const e=d.filter((e=>!m.includes(e))).map(Number),n=m.filter((e=>!d.includes(e))).map(Number);l({chatId:t,idsToRemove:e,idsToAdd:n}),o()}),[t,l,d,o,m]);if(n&&r)return a.ZP.createElement(we.Z,{isOpen:e,onClose:o,onCloseAnimationEnd:i,onEnter:v,className:"delete",title:c("FilterAddTo")},a.ZP.createElement(ns.Z,{options:Z,selected:m,onChange:h,round:!0}),a.ZP.createElement(R.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:v},c("FilterAddTo")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:o},c("Cancel")))})));var ss=n(4319),rs=n(647);function os(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let is,ls;const cs={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},ds=e=>"changedTouches"in e?e.changedTouches[0].clientY:0,ms=e=>{const t="deltaY"in e?e.deltaY:ds(e);if(!is||!is.contains(e.target)||is.scrollTop<=0&&t<=0||is.scrollTop>=is.scrollHeight-is.offsetHeight&&t>=0){if(ls&&e.target.closest(ls))return;e.preventDefault()}};function us(e){cs[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 hs(e,t){is=e,ls=t,document.addEventListener("wheel",ms,{passive:!1}),document.addEventListener("touchmove",ms,{passive:!1}),document.onkeydown=us}function Zs(){is=void 0,ls=void 0,document.removeEventListener("wheel",ms),document.removeEventListener("touchmove",ms),document.onkeydown=null}var vs=n(3394),Ps=n(2328);const gs=(0,X.y)("ReactionSelectorReaction"),ps=(0,a.X$)((({reaction:e,onSendReaction:t,isReady:n})=>{var s;const o=(0,a.sO)(null),i=(0,h.Z)(`document${null===(s=e.selectAnimation)||void 0===s?void 0:s.id}`,!n,r.IU.Lottie),[l,c,d]=(0,xe.Z)(),[m,u]=(0,xe.Z)(),Z=Boolean(n&&i),{transitionClassNames:v}=(0,_.Z)(Z),{shouldRender:P,transitionClassNames:g}=(0,_.Z)(!n||!m,void 0,!0);return a.ZP.createElement("div",{className:gs("&"),onClick:function(){if(!o.current)return;const{x:n,y:a}=o.current.getBoundingClientRect();t(e.reaction,n,a)},ref:o,onMouseEnter:n?c:void 0},P&&a.ZP.createElement("div",{className:gs("static",`reaction-${e.reaction}`,n?[g]:void 0)}),Z&&a.ZP.createElement(mt.Z,{id:`select_${e.reaction}`,className:gs("animated",[v]),animationData:i,play:l,noLoop:!0,size:32,onLoad:u,onEnded:d}))})),Es=(0,X.y)("ReactionSelector"),Cs=(0,a.X$)((({availableReactions:e,enabledReactions:t,onSendReaction:n,isPrivate:s,isReady:r})=>{const o=(0,a.sO)(null),[i,l]=(0,xe.Z)(!1);(0,Ct.Z)(o.current,!i),(0,a.bt)((()=>{l()}),[l]);const c=e=>{o&&("deltaY"in e?e.deltaY:ds(e))&&e.preventDefault()};if((s||null!=t&&t.length)&&e)return a.ZP.createElement("div",{className:Es("&"),onWheelCapture:c,onTouchMove:c},a.ZP.createElement("div",{className:Es("bubble-big")}),a.ZP.createElement("div",{className:Es("bubble-small")}),a.ZP.createElement("div",{className:Es("items-wrapper")},a.ZP.createElement("div",{className:Es("items",["no-scrollbar"]),ref:o},null==e?void 0:e.map((e=>{if(!e.isInactive&&(s||t&&t.includes(e.reaction)))return a.ZP.createElement(ps,{key:e.reaction,isReady:r,onSendReaction:n,reaction:e})})))))})),fs=(0,a.X$)((({availableReactions:e,isOpen:t,message:n,isPrivate:s,enabledReactions:o,anchor:i,canSendNow:l,canReschedule:c,canReply:d,canEdit:m,canPin:h,canUnpin:Z,canDelete:v,canReport:g,canForward:p,canFaveSticker:E,canUnfaveSticker:C,canCopy:b,canCopyLink:I,canSelect:y,canDownload:N,isDownloading:k,canShowSeenBy:S,canShowReactionsCount:w,canRemoveReaction:M,canShowReactionList:T,seenByRecentUsers:R,onReply:L,onEdit:A,onPin:F,onUnpin:$,onForward:x,onDelete:D,onReport:U,onFaveSticker:O,onUnfaveSticker:G,onSelect:J,onSend:z,onReschedule:_,onClose:Y,onCloseAnimationEnd:H,onCopyLink:V,onDownload:j,onShowSeenBy:q,onShowReactors:K,onSendReaction:W})=>{var Q,ee,te,ne;const ae=(0,a.sO)(null),se=(0,a.sO)(null),re=function(e,t,n){const a=[],s=(0,P.UD)(e),o=(0,P.O$)(e)||((0,P.Cg)(e)?void 0:(0,P.F$)(e)),i=(0,P.Ti)(e,"inline"),l=o&&(i||(0,P.BM)(e))&&ss.yl,c=window.getSelection();if(l&&a.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(i?rs.he(i,r.IU.BlobUrl):o.blobUrl).then(ss.VP),t&&t()}}),s){var d;const n=Boolean((null==c||null===(d=c.anchorNode)||void 0===d?void 0:d.parentNode)&&c.anchorNode.parentNode.closest(".Message .content-inner")&&""!==c.toString().replace(/(?:\r\n|\r|\n)/g,""));a.push({label:os(n),handler:()=>{const a=n&&c?c.toString():(0,P.EU)(e);(0,ss.TE)(a),t&&t()}})}return n&&a.push({label:"lng_context_copy_message_link",handler:()=>{n(),t&&t()}}),a}(n,Y,I?V:void 0),oe=!(s||null!=o&&o.length),ie=T&&!oe,[le,ce,de]=(0,xe.Z)(),me=(0,a.I4)((()=>document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id="${n.id}"]`)),[n.id]),ue=(0,a.I4)((()=>document.querySelector(".Transition__slide--active > .MessageList")),[]),he=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),Ze=(0,a.I4)((()=>{var e;const t=f.wB&&(null===(e=document.querySelector(".AudioPlayer-content"))||void 0===e?void 0:e.offsetHeight)||0,n=document.querySelector(".HeaderPinnedMessage-wrapper"),a=(f.wB&&!t||!f.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:ie?32:void 0,extraMarginTop:a+t}}),[ie]),ve=(0,a.I4)((()=>{W(void 0,0,0)}),[W]);(0,a.d4)((()=>{t?setTimeout((()=>{ce()}),200):de()}),[t,ce,de]);const{positionX:Pe,positionY:pe,transformOriginX:Ee,transformOriginY:Ce,style:fe,menuStyle:be,withScroll:Ie}=(0,vs.Z)(i,me,ue,he,Ze);(0,a.d4)((()=>(hs(Ie?se.current:void 0,".ReactionSelector"),Zs)),[Ie]);const ye=(0,u.Z)();return a.ZP.createElement(Ps.Z,{ref:ae,isOpen:t,transformOriginX:Ee,transformOriginY:Ce,positionX:Pe,positionY:pe,style:fe,bubbleStyle:be,className:(0,X.Z)("MessageContextMenu","fluid",ie&&"with-reactions"),onClose:Y,onCloseAnimationEnd:H},T&&a.ZP.createElement(Cs,{enabledReactions:o,onSendReaction:W,isPrivate:s,availableReactions:e,isReady:le}),a.ZP.createElement("div",{className:"scrollable-content custom-scroll",style:be,ref:se},M&&a.ZP.createElement(B.Z,{icon:"reactions",onClick:ve},"Remove Reaction"),l&&a.ZP.createElement(B.Z,{icon:"send-outline",onClick:z},ye("MessageScheduleSend")),c&&a.ZP.createElement(B.Z,{icon:"schedule",onClick:_},ye("MessageScheduleEditTime")),d&&a.ZP.createElement(B.Z,{icon:"reply",onClick:L},ye("Reply")),m&&a.ZP.createElement(B.Z,{icon:"edit",onClick:A},ye("Edit")),E&&a.ZP.createElement(B.Z,{icon:"favorite",onClick:O},ye("AddToFavorites")),C&&a.ZP.createElement(B.Z,{icon:"favorite",onClick:G},ye("Stickers.RemoveFromFavorites")),b&&re.map((e=>a.ZP.createElement(B.Z,{key:e.label,icon:"copy",onClick:e.handler},ye(e.label)))),h&&a.ZP.createElement(B.Z,{icon:"pin",onClick:F},ye("DialogPin")),Z&&a.ZP.createElement(B.Z,{icon:"unpin",onClick:$},ye("DialogUnpin")),N&&a.ZP.createElement(B.Z,{icon:"download",onClick:j},ye(k?"lng_context_cancel_download":"lng_media_download")),p&&a.ZP.createElement(B.Z,{icon:"forward",onClick:x},ye("Forward")),y&&a.ZP.createElement(B.Z,{icon:"select",onClick:J},ye("Common.Select")),g&&a.ZP.createElement(B.Z,{icon:"flag",onClick:U},ye("lng_context_report_msg")),(S||w)&&a.ZP.createElement(B.Z,{icon:w?"reactions":"group",onClick:w?K:q,disabled:!(w||null!==(Q=n.seenByUserIds)&&void 0!==Q&&Q.length)},w&&null!==(ee=n.reactors)&&void 0!==ee&&ee.count?S&&null!==(te=n.seenByUserIds)&&void 0!==te&&te.length?ye("Chat.OutgoingContextMixedReactionCount",[n.reactors.count,n.seenByUserIds.length]):ye("Chat.ContextReactionCount",n.reactors.count,"i"):null!==(ne=n.seenByUserIds)&&void 0!==ne&&ne.length?ye("Conversation.ContextMenuSeen",n.seenByUserIds.length,"i"):ye("Conversation.ContextMenuNoViews"),a.ZP.createElement("div",{className:"avatars"},null==R?void 0:R.map((e=>a.ZP.createElement(ge.Z,{size:"micro",user:e}))))),v&&a.ZP.createElement(B.Z,{destructive:!0,icon:"delete",onClick:D},ye("Delete"))))})),bs=2*I.Gw,Is=(0,a.X$)((0,s.c$)(((e,{message:t,messageListType:n})=>{var a,s,r;const{threadId:o}=(0,g.Bt)(e)||{},l=(0,g.xs)(e,t.chatId),c=(0,g.Z1)(e,t.chatId),{seenByExpiresAt:d,seenByMaxChatMembers:m}=e.appConfig||{},{noOptions:u,canReply:h,canPin:Z,canUnpin:v,canDelete:p,canReport:E,canEdit:C,canForward:f,canFaveSticker:b,canUnfaveSticker:I,canCopy:y,canCopyLink:N,canSelect:k,canDownload:S}=o&&(0,g._k)(e,t,o)||{},w="pinned"===n,M="scheduled"===n,T=c&&(0,P.eA)(c),R=Boolean(c&&m&&d&&(0,P.Bf)(c)&&(0,P.B4)(t)&&!M&&c.membersCount&&c.membersCount<m&&t.date>Date.now()/1e3-d),L=c&&(0,P.YC)(c.id),A=(0,P.Lo)(t),F=!T&&!M&&!A&&!L&&t.reactions&&!(0,P.JE)(t.reactions)&&t.reactions.canSeeList,B=L&&(null===(a=t.reactions)||void 0===a||null===(s=a.results)||void 0===s?void 0:s.some((e=>e.isChosen))),$=(0,g.EV)(e,t);return{availableReactions:e.availableReactions,noOptions:u,canSendNow:M,canReschedule:M,canReply:!w&&!M&&h,canPin:!M&&Z,canUnpin:!M&&v,canDelete:p,canReport:E,canEdit:!w&&C,canForward:!$&&!M&&f,canFaveSticker:!M&&b,canUnfaveSticker:!M&&I,canCopy:!$&&y,canCopyLink:!$&&!M&&N,canSelect:k,canDownload:!$&&S,activeDownloads:l,canShowSeenBy:R,enabledReactions:null==c||null===(r=c.fullInfo)||void 0===r?void 0:r.enabledReactions,isPrivate:L,hasFullInfo:Boolean(null==c?void 0:c.fullInfo),canShowReactionsCount:F,canShowReactionList:!A&&!M&&(null==c?void 0:c.id)!==i.aw,canRemoveReaction:B}}))((({availableReactions:e,isOpen:t,messageListType:n,chatUsername:r,message:o,album:i,anchor:l,onClose:c,onCloseAnimationEnd:d,noOptions:m,canSendNow:u,hasFullInfo:h,canReschedule:Z,canReply:v,canPin:P,canUnpin:g,canDelete:p,canReport:E,canShowReactionsCount:C,canShowReactionList:f,canRemoveReaction:b,canEdit:I,enabledReactions:y,isPrivate:N,canForward:k,canFaveSticker:S,canUnfaveSticker:w,canCopy:M,canCopyLink:T,canSelect:R,canDownload:L,activeDownloads:A,canShowSeenBy:F})=>{var B;const{setReplyingToId:$,setEditingId:x,pinMessage:D,openForwardMenu:U,faveSticker:O,unfaveSticker:G,toggleMessageSelection:J,sendScheduledMessages:z,rescheduleMessage:Y,downloadMessageMedia:H,cancelMessageMediaDownload:V,loadSeenBy:j,openSeenByModal:K,sendReaction:W,openReactorListModal:Q,loadFullChat:ee,loadReactors:te}=(0,s.uC)(),{transitionClassNames:ne}=(0,_.Z)(t,d,void 0,!1),[ae,se]=(0,a.eJ)(!0),[re,oe]=(0,a.eJ)(!1),[ie,le]=(0,a.eJ)(!1),[ce,de]=(0,a.eJ)(!1),[me,ue,he]=(0,xe.Z)();(0,a.d4)((()=>{F&&t&&j({chatId:o.chatId,messageId:o.id})}),[j,t,o.chatId,o.id,F]),(0,a.d4)((()=>{C&&t&&te({chatId:o.chatId,messageId:o.id})}),[C,t,te,o.chatId,o.id]),(0,a.d4)((()=>{h||N||!t||ee({chatId:o.chatId})}),[h,t,N,ee,o.chatId]);const Ze=(0,a.Ye)((()=>{var e,t,n;if(null!==(e=o.reactions)&&void 0!==e&&null!==(t=e.recentReactions)&&void 0!==t&&t.length){var a,r;const e=(0,s.Rd)().users.byId;return null===(a=o.reactions)||void 0===a||null===(r=a.recentReactions)||void 0===r?void 0:r.slice(0,3).map((({userId:t})=>e[t])).filter(Boolean)}if(!o.seenByUserIds)return;const i=(0,s.Rd)().users.byId;return null===(n=o.seenByUserIds)||void 0===n?void 0:n.slice(0,3).map((e=>i[e])).filter(Boolean)}),[null===(B=o.reactions)||void 0===B?void 0:B.recentReactions,o.seenByUserIds]),ve=i?i.messages.some((e=>A.includes(e.id))):A.includes(o.id),Pe=(0,a.I4)((()=>{se(!1),oe(!0)}),[]),ge=(0,a.I4)((()=>{se(!1),le(!0)}),[]),pe=(0,a.I4)((()=>{se(!1),c()}),[c]),Ee=(0,a.I4)((()=>{oe(!1),c()}),[c]),Ce=(0,a.I4)((()=>{le(!1),c()}),[c]),fe=(0,a.I4)((()=>{de(!1),c()}),[c]),be=(0,a.I4)((()=>{he(),c()}),[he,c]),Ie=(0,a.I4)((()=>{$({messageId:o.id}),pe()}),[$,o.id,pe]),ye=(0,a.I4)((()=>{x({messageId:o.id}),pe()}),[x,o.id,pe]),Ne=(0,a.I4)((()=>{se(!1),de(!0)}),[]),ke=(0,a.I4)((()=>{D({messageId:o.id,isUnpin:!0}),pe()}),[D,o.id,pe]),Se=(0,a.I4)((()=>{if(pe(),null!=i&&i.messages){const e=i.messages.map((({id:e})=>e));U({fromChatId:o.chatId,messageIds:e})}else U({fromChatId:o.chatId,messageIds:[o.id]})}),[U,o,pe,i]),we=(0,a.I4)((()=>{pe(),O({sticker:o.content.sticker})}),[pe,o.content.sticker,O]),Me=(0,a.I4)((()=>{pe(),G({sticker:o.content.sticker})}),[pe,o.content.sticker,G]),Te=(0,a.I4)((()=>{const e=null!=i&&i.messages?{messageId:o.id,childMessageIds:i.messages.map((({id:e})=>e)),withShift:!1}:{messageId:o.id,withShift:!1};J(e),pe()}),[pe,o.id,J,i]),Re=(0,a.I4)((()=>{z({chatId:o.chatId,id:o.id}),pe()}),[pe,o.chatId,o.id,z]),Le=(0,a.I4)((()=>{se(!1),ue()}),[ue]),Ae=(0,a.I4)((()=>{pe(),K({chatId:o.chatId,messageId:o.id})}),[pe,o.chatId,o.id,K]),Fe=(0,a.I4)((()=>{pe(),Q({chatId:o.chatId,messageId:o.id})}),[pe,Q,o.chatId,o.id]),Be=(0,a.I4)((e=>{Y({chatId:o.chatId,messageId:o.id,scheduledAt:Math.round(e.getTime()/1e3)})}),[o.chatId,o.id,Y]),$e=(0,a.I4)((()=>{(0,ss.TE)(`https://t.me/${r||`c/${o.chatId.replace("-","")}`}/${o.id}`),pe()}),[r,pe,o.chatId,o.id]),De=(0,a.I4)((()=>{((null==i?void 0:i.messages)||[o]).forEach((e=>{ve?V({message:e}):H({message:e})})),pe()}),[i,o,pe,ve,V,H]),Ue=(0,a.I4)(((e,t,n)=>{W({chatId:o.chatId,messageId:o.id,reaction:e,x:t,y:n,startSize:bs}),pe()}),[pe,o.chatId,o.id,W]),Oe=(0,a.Ye)((()=>(i?i.messages:[o]).map((({id:e})=>e))),[i,o]);if(m)return void pe();const Ge=new Date;return Ge.setFullYear(Ge.getFullYear()+1),a.ZP.createElement("div",{className:(0,X.Z)("ContextMenuContainer",ne)},a.ZP.createElement(fs,{availableReactions:e,message:o,isPrivate:N,isOpen:ae,enabledReactions:y,anchor:l,canShowReactionsCount:C,canShowReactionList:f,canRemoveReaction:b,canSendNow:u,canReschedule:Z,canReply:v,canDelete:p,canReport:E,canPin:P,canUnpin:g,canEdit:I,canForward:k,canFaveSticker:S,canUnfaveSticker:w,canCopy:M,canCopyLink:T,canSelect:R,canDownload:L,canShowSeenBy:F,isDownloading:ve,seenByRecentUsers:Ze,onReply:Ie,onEdit:ye,onPin:Ne,onUnpin:ke,onForward:Se,onDelete:Pe,onReport:ge,onFaveSticker:we,onUnfaveSticker:Me,onSelect:Te,onSend:Re,onReschedule:Le,onClose:pe,onCopyLink:$e,onDownload:De,onShowSeenBy:Ae,onSendReaction:Ue,onShowReactors:Fe}),a.ZP.createElement(We,{isOpen:re,isSchedule:"scheduled"===n,onClose:Ee,album:i,message:o}),a.ZP.createElement(st,{isOpen:ie,onClose:Ce,messageIds:Oe}),a.ZP.createElement(Qe,{isOpen:ce,messageId:o.id,chatId:o.chatId,onClose:fe}),Z&&a.ZP.createElement(qe,{isOpen:me,withTimePicker:!0,selectedAt:1e3*o.date,maxAt:(0,q._F)(Ge),isFutureMode:!0,onClose:be,onSubmit:Be}))}))),ys=(0,a.X$)((0,s.c$)(((e,{fromSticker:t,stickerSetShortName:n})=>{const a=(0,g.Bt)(e),{chatId:s,threadId:r}=a||{},o=s&&(0,g.Z1)(e,s),i=o?(0,P.H5)(o):void 0;return{canSendStickers:Boolean(o&&r&&(0,P.Qm)(o,r)&&(null==i?void 0:i.canSendStickers)),stickerSet:t?(0,g.Ny)(e,t.stickerSetId):n?(0,g.E_)(e,n):void 0}}))((({isOpen:e,fromSticker:t,stickerSetShortName:n,stickerSet:r,canSendStickers:o,onClose:l})=>{const{loadStickers:c,toggleStickerSet:d,sendMessage:m}=(0,s.uC)(),h=(0,a.sO)(null),Z=(0,u.Z)(),{observe:v}=(0,Bn.S1)({rootRef:h,throttleMs:200,isDisabled:!e});(0,a.d4)((()=>{if(e)if(t){const{stickerSetId:e,stickerSetAccessHash:n}=t;c({stickerSetId:e,stickerSetAccessHash:n})}else n&&c({stickerSetShortName:n})}),[e,t,c,n]);const P=(0,a.I4)((e=>{e={...e,isPreloadedGlobally:!0},m({sticker:e}),l()}),[l,m]),g=(0,a.I4)((()=>{r&&(d({stickerSetId:r.id}),l())}),[l,r,d]);return a.ZP.createElement(we.Z,{className:"StickerSetModal",isOpen:e,onClose:l,hasCloseButton:!0,title:r?(0,Pe.Z)(r.title,["emoji","links"]):Z("AccDescrStickerSet")},null!=r&&r.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:h,className:"stickers custom-scroll"},r.stickers.map((e=>a.ZP.createElement(Un.Z,{sticker:e,size:i.yK,observeIntersection:v,onClick:o?P:void 0,clickArg:e})))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(R.Z,{size:"smaller",fluid:!0,color:r.installedDate?"danger":"primary",onClick:g},Z(r.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",r.count,"i")))):a.ZP.createElement(Se.Z,null))})));var Ns=n(2898);const ks=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t);if(!a||a.isRestricted)return{};const s=(0,P.YC)(a.id),r=s?(0,g.dy)(e,t):void 0,o=r&&(0,P.kw)(r);return{chat:a,isMuted:(0,P.i4)(a,(0,g.dZ)(e),(0,g.NJ)(e)),isPrivate:s,canAddContact:o,canDeleteChat:(0,P.cc)(a),hasLinkedChat:Boolean(null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.linkedChatId)}}))((({chatId:e,isOpen:t,withExtraActions:n,anchor:r,isChannel:o,canStartBot:i,canRestartBot:l,canSubscribe:c,canSearch:d,canCall:m,canMute:h,canLeave:Z,canEnterVoiceChat:v,canCreateVoiceChat:P,chat:g,isPrivate:p,isMuted:E,canDeleteChat:C,hasLinkedChat:b,canAddContact:I,onSubscribeChannel:y,onSearchClick:N,onClose:k,onCloseAnimationEnd:S})=>{const{updateChatMutedState:w,enterMessageSelectMode:M,sendBotCommand:T,restartBot:R,joinGroupCall:L,createGroupCall:A,openLinkedChat:F,addContact:$,openCallFallbackConfirm:x}=(0,s.uC)(),[D,U]=(0,a.eJ)(!0),[O,G]=(0,a.eJ)(!1),{x:J,y:X}=r;(0,_.Z)(t,S,void 0,!1);const z=(0,a.I4)((()=>{U(!1),G(!0)}),[]),Y=(0,a.I4)((()=>{U(!1),k()}),[k]),H=(0,a.I4)((()=>{G(!1),k()}),[k]),V=(0,a.I4)((()=>{T({command:"/start"})}),[T]),j=(0,a.I4)((()=>{R({chatId:e})}),[e,R]),q=(0,a.I4)((()=>{w({chatId:e,isMuted:!E}),Y()}),[e,Y,E,w]),K=(0,a.I4)((()=>{P?A({chatId:e}):L({chatId:e}),Y()}),[Y,P,e,L,A]),W=(0,a.I4)((()=>{F({id:e}),Y()}),[e,Y,F]),Q=(0,a.I4)((()=>{$({userId:e}),Y()}),[$,e,Y]),ee=(0,a.I4)((()=>{y(),Y()}),[Y,y]),te=(0,a.I4)((()=>{x(),Y()}),[Y,x]),ne=(0,a.I4)((()=>{N(),Y()}),[Y,N]),ae=(0,a.I4)((()=>{M(),Y()}),[Y,M]);(0,a.d4)((()=>(hs(),Zs)),[]);const se=(0,u.Z)();return a.ZP.createElement(Ns.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(Ps.Z,{isOpen:D,positionX:"right",style:`left: ${J}px;top: ${X}px;`,onClose:Y},n&&i&&a.ZP.createElement(B.Z,{icon:"bots",onClick:V},se("BotStart")),n&&l&&a.ZP.createElement(B.Z,{icon:"bots",onClick:j},se("BotRestart")),n&&c&&a.ZP.createElement(B.Z,{icon:o?"channel":"group",onClick:ee},se(o?"ProfileJoinChannel":"ProfileJoinGroup")),I&&a.ZP.createElement(B.Z,{icon:"add-user",onClick:Q},se("AddContact")),f.wB&&m&&a.ZP.createElement(B.Z,{icon:"phone",onClick:te},se("Call")),f.wB&&d&&a.ZP.createElement(B.Z,{icon:"search",onClick:ne},se("Search")),h&&a.ZP.createElement(B.Z,{icon:E?"unmute":"mute",onClick:q},se(E?"ChatsUnmute":"ChatsMute")),(v||P)&&a.ZP.createElement(B.Z,{icon:"voice-chat",onClick:K},se(P?"StartVoipChat":"VoipGroupJoinCall")),b&&a.ZP.createElement(B.Z,{icon:o?"comments":"channel",onClick:W},se(o?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(B.Z,{icon:"select",onClick:ae},se("ReportSelectMessages")),Z&&a.ZP.createElement(B.Z,{destructive:!0,icon:"delete",onClick:z},se(p?"DeleteChatUser":C?"GroupInfo.DeleteAndExit":o?"LeaveChannel":"Group.LeaveGroup"))),g&&a.ZP.createElement(gt.Z,{isOpen:O,onClose:H,chat:g})))})));var Ss=n(9589);const ws=(0,G.Ds)((e=>e()),200,!1),Ms=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.jr)(e);if(!t)return{};const{query:n,results:a}=(0,g.n5)(e)||{},{totalCount:s,foundIds:r}=a||{};return{chat:t,query:n,totalCount:s,foundIds:r,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}}))((({isActive:e,chat:t,query:n,totalCount:r,foundIds:o,isHistoryCalendarOpen:i})=>{const{setLocalTextSearchQuery:l,searchTextMessagesLocal:c,focusMessage:d,closeLocalTextSearch:m,openHistoryCalendar:u}=(0,s.uC)(),h=(0,a.sO)(null),[Z,v]=(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===h.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)((()=>{t&&o&&o.length?(d({chatId:t.id,messageId:o[o.length-1]}),v(0)):v(-1)}),[t,d,o]),(0,a.d4)((()=>{Array.from(document.querySelectorAll("input")).forEach((t=>{t.disabled=Boolean(e&&t!==h.current)})),Array.from(document.querySelectorAll("div[contenteditable]")).forEach((t=>{t.contentEditable=e?"false":"true"}))}),[e]),(0,a.d4)((()=>{e||h.current.blur()}),[e]),(0,a.bt)((()=>{document.querySelector("#MobileSearch input").blur()}),[i]);const P=(0,a.I4)((e=>{l({query:e}),e.length&&ws(c)}),[c,l]),g=(0,a.I4)((()=>{if(t&&o){const e=Z+1;d({chatId:t.id,messageId:o[o.length-1-e]}),v(e)}}),[t,Z,d,o]),p=(0,a.I4)((()=>{if(t&&o){const e=Z-1;d({chatId:t.id,messageId:o[o.length-1-e]}),v(e)}}),[t,Z,d,o]);return a.ZP.createElement("div",{id:"MobileSearch",className:e?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement(R.Z,{size:"smaller",round:!0,color:"translucent",onClick:m},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement(Ss.Z,{ref:h,value:n,onChange:P})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},n?null!=o&&o.length?`${Z+1} of ${r}`:o&&!o.length?"No results":"":a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>u({selectedAt:(0,q._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon-calendar"}))),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:g,disabled:!o||!o.length||Z===o.length-1},a.ZP.createElement("i",{className:"icon-up"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:p,disabled:!o||!o.length||0===Z},a.ZP.createElement("i",{className:"icon-down"}))))})));var Ts=n(5376),Rs=n(9295),Ls=n(8353),As=n(971),Fs=n(7002),Bs=n(3616);function $s(e,t,n=0,a=!1,s=!1,r=!1){const o=e[r?"scrollLeft":"scrollTop"],i=o+e[r?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:c}=l,d=[];let m=!1;for(let e=0;e<c;e++){const t=l[e],c=t[r?"offsetLeft":"offsetTop"],u=c+t[r?"offsetWidth":"offsetHeight"];if(s?u>=o-n&&u<=i+n:c<=i+n&&u>=o-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:l,visibleIndexes:d}}const xs=function(e,t,n=!1){const a=e[n?"scrollLeft":"scrollTop"],s=a+e[n?"offsetWidth":"offsetHeight"],r=t[n?"offsetLeft":"offsetTop"],o=r+t[n?"offsetWidth":"offsetHeight"];return r>a&&o<s};var Ds=n(539);function Us(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:r}=$s(a,e,8,!0,!0);if(!r.length||!r[t])return;const o=s[0];if(!s.includes(t)||t===o&&!xs(a,r[o])){const e=t>s[s.length-1]?"start":"end";(0,Ds.Z)(a,r[t],e,10)}}var Os=n(3570);function Gs({isActive:e,isHorizontal:t,shouldSaveSelectionOnUpdateItems:n,shouldRemoveSelectionOnReset:s,noArrowNavigation:r,items:o,shouldSelectOnTab:i,onSelect:l,onClose:c}){const[d,m]=(0,a.eJ)(-1),u=(0,a.I4)((e=>o?(0,Os.Z)(o.length,e):-1),[o]),h=(0,a.I4)(((e,t)=>{t.preventDefault(),m((t=>u(t+e)))}),[m,u]),Z=(0,a.I4)((e=>{if(o&&o.length&&d>-1){const t=o[d];t&&(e.preventDefault(),l(t))}}),[o,l,d]),v=!o||d>o.length-1;return(0,a.d4)((()=>{n&&!v||m(s?-1:0)}),[v,s,n]),(0,a.d4)((()=>e?(0,tt.Z)({onEsc:c,onUp:r||t?void 0:e=>h(-1,e),onDown:r||t?void 0:e=>h(1,e),onLeft:r||!t?void 0:e=>h(-1,e),onRight:r||!t?void 0:e=>h(1,e),onTab:i?Z:void 0,onEnter:Z}):void 0),[r,h,Z,e,t,c,i]),d}const Js=(0,a.X$)((({isOpen:e,onClose:t,onInsertUserName:n,filteredUsers:r})=>{const o=(0,a.sO)(null),{shouldRender:i,transitionClassNames:l}=(0,_.Z)(e,void 0,void 0,!1),c=(0,a.I4)(((e,t=!1)=>{const a=(0,s.Rd)().users.byId[e];a&&n(a,t)}),[n]),d=(0,a.I4)((e=>{c(e.id,!0)}),[c]),m=Gs({isActive:e,items:r,onSelect:d,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,a.d4)((()=>{Us(".chat-item-clickable",m,o)}),[m]),(0,a.d4)((()=>{r&&!r.length&&t()}),[r,t]);const u=(0,v.Z)(null!=r&&r.length?r:void 0,i),h=r&&!r.length?u:r;if(!i||h&&!h.length)return;const Z=(0,X.Z)("MentionTooltip composer-tooltip custom-scroll",l);return a.ZP.createElement("div",{className:Z,ref:o},null==h?void 0:h.map((({id:e},t)=>a.ZP.createElement(Re.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>c(e),focus:m===t},a.ZP.createElement(Ae.Z,{userId:e,avatarSize:"small",withUsername:!0})))))}));var Xs=n(9830);const zs=(0,a.X$)((({chatId:e,threadId:t,attachments:n,caption:s,isReady:r,currentUserId:o,groupChatMembers:l,recentEmojis:c,baseEmojiKeywords:d,emojiKeywords:m,addRecentEmoji:h,onCaptionUpdate:Z,onSend:P,onFileAppend:g,onClear:p})=>{const C=(0,As.Y)(s),f=(0,a.sO)(),b=(0,v.Z)(n),I=n.length?n:b,y=Boolean(n.length),[N,k,S]=(0,xe.Z)(),w=Boolean(I&&I.every((e=>e.quick))),M=(0,u.Z)(),{isMentionTooltipOpen:T,closeMentionTooltip:L,insertMention:A,mentionFilteredUsers:F}=(0,Rs.Z)(y,C,Z,i.nY,l,void 0,o),{isEmojiTooltipOpen:B,closeEmojiTooltip:$,filteredEmojis:x,insertEmoji:D}=(0,Ls.Z)(y,C,c,i.nY,Z,d,m,!r);(0,a.d4)((()=>y?(0,E.Z)(p):void 0),[y,p]);const U=(0,a.I4)((()=>{y&&P()}),[y,P]),O=(0,a.I4)((e=>{e.preventDefault(),S();const{dataTransfer:{files:t}}=e;if(null!=t&&t.length){const e=w?Array.from(t).filter((e=>e.type&&i.dI.has(e.type))):Array.from(t);g(e,w)}}),[w,g,S]);if(!I)return;const G=I.every((e=>i.oG.has(e.mimeType))),J=I.every((e=>i.wG.has(e.mimeType))),X=I.every((e=>e.mimeType.startsWith("audio/")));let z="";return z=M(G?"PreviewSender.SendPhoto":J?"PreviewSender.SendVideo":X?"PreviewSender.SendAudio":"PreviewSender.SendFile",I.length,"i"),a.ZP.createElement(we.Z,{isOpen:y,onClose:p,header:function(){if(I)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:M.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:p},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},z),a.ZP.createElement(R.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:U},M("Send")))}(),className:"AttachmentModal "+(N?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:k,onDrop:O,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),f.current&&(window.clearTimeout(f.current),f.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(".drop-target")&&!t&&(f.current=window.setTimeout(S,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),S())},"data-attach-description":M("Preview.Dragging.AddItems",10)},w?a.ZP.createElement("div",{className:"media-wrapper custom-scroll"},I.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"},I.map((e=>a.ZP.createElement(Fs.Z,{name:e.filename,extension:(0,Ts.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(Js,{isOpen:T,onClose:L,onInsertUserName:A,filteredUsers:F}),a.ZP.createElement(Xs.Z,{isOpen:B,emojis:x,onClose:$,onEmojiSelect:D,addRecentEmoji:h}),a.ZP.createElement(Bs.Z,{id:"caption-input-text",chatId:e,threadId:t,isAttachmentModalInput:!0,html:s,editableInputId:i.nY,placeholder:M("Caption"),onUpdate:Z,onSend:P,canAutoFocus:Boolean(r&&n.length)}))))}));var _s=n(3099);const Ys=(0,a.X$)((({isOpen:e,onSend:t,onClear:n})=>{const s=(0,a.sO)(null),r=(0,a.sO)(null),o=(0,a.sO)(null),[i,l]=(0,a.eJ)(""),[c,d]=(0,a.eJ)([""]),[m,h]=(0,a.eJ)(!0),[Z,v]=(0,a.eJ)(!1),[P,g]=(0,a.eJ)(!1),[p,C]=(0,a.eJ)(),[f,b]=(0,a.eJ)(),[I,y]=(0,a.eJ)(!1),N=(0,u.Z)(),k=(0,a.I4)((t=>{e&&t.current&&t.current.focus()}),[e]);(0,a.d4)((()=>e?(0,E.Z)(n):void 0),[e,n]),(0,a.d4)((()=>{e||(l(""),d([""]),h(!0),v(!1),g(!1),C(""),b(""),y(!1))}),[e]),(0,a.d4)((()=>k(s)),[k,e]),(0,a.bt)((()=>{const e=o.current;e&&p!==e.innerHTML&&(e.innerHTML=p)}),[p]);const S=(0,a.I4)(((e=[])=>{d([...e,""]),requestAnimationFrame((()=>{const e=r.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),w=(0,a.I4)((()=>{if(y(!1),!e)return;const n=i.trim().substring(0,255),a=c.map((e=>e.trim().substring(0,100))).filter((e=>e.length));if(!n||a.length<2)return l(n),a.length?a.length<2?S(a):d(a):S(),void y(!0);if(P&&(!f||!a[Number(f)]))return void y(!0);const s={summary:{question:n,answers:a.map(((e,t)=>({text:e.trim(),option:String(t),...String(t)===f&&{correct:!0}}))),...!m&&{isPublic:!0},...Z&&{multipleChoice:!0},...P&&{quiz:!0}}};if(P){const{text:e,entities:t}=p&&(0,_s.Z)(p.substring(0,200))||{};s.quiz={correctAnswers:[f],...e&&{solution:e},...t&&{solutionEntities:t}}}t(s)}),[e,i,c,P,f,m,Z,t,S,p]),M=(0,a.I4)(((e,t)=>{const n=[...c];n[e]=t,n[n.length-1].trim().length&&n.length<10?S(n):d(n)}),[c,S]),T=(0,a.I4)((e=>{const t=[...c];t.splice(e,1),d(t),requestAnimationFrame((()=>{r.current&&r.current.classList.toggle("overflown",r.current.scrollHeight>320)}))}),[c]),L=(0,a.I4)((e=>{b(e)}),[b]),A=(0,a.I4)((e=>{h(e.target.checked)}),[]),F=(0,a.I4)((e=>{v(e.target.checked)}),[]),B=(0,a.I4)((e=>{g(e.target.checked)}),[]),$=(0,a.I4)((e=>{13===e.keyCode&&w()}),[w]),x=(0,a.I4)((()=>{if(I&&!i.trim().length)return N("lng_polls_choose_question")}),[I,N,i]),D=(0,a.I4)((e=>{const t=c.map((e=>e.trim())).filter((e=>e.length));if(I&&t.length<2&&!c[e].trim().length)return N("lng_polls_choose_answers")}),[I,N,c]);function U(){return c.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(Me.Z,{label:t!==c.length-1||10===c.length?N("OptionHint"):N("CreatePoll.AddOption"),error:D(t),value:e,onChange:e=>M(t,e.currentTarget.value),onKeyPress:$}),t!==c.length-1&&a.ZP.createElement(R.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:N("Delete"),onClick:()=>T(t)},a.ZP.createElement("i",{className:"icon-close"})))))}return a.ZP.createElement(we.Z,{isOpen:e,onClose:n,header:a.ZP.createElement("div",{className:"modal-header-condensed"},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:n},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},N("NewPoll")),a.ZP.createElement(R.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:w},N("Create"))),className:"PollModal"},a.ZP.createElement(Me.Z,{ref:s,label:N("AskAQuestion"),value:i,error:x(),onChange:e=>l(e.currentTarget.value),onKeyPress:$}),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"options-list custom-scroll",ref:r},a.ZP.createElement("h3",{className:"options-header"},N("PollOptions")),I&&function(){const e=c.map((e=>e.trim())).filter((e=>e.length));return P&&(!f||!e[Number(f)])&&a.ZP.createElement("p",{className:"error"},N("lng_polls_choose_correct"))}(),P?a.ZP.createElement(at.Z,{name:"correctOption",options:U().map(((e,t)=>({value:String(t),label:e,hidden:t===c.length-1}))),onChange:L}):U()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},a.ZP.createElement(Cn.Z,{label:N("PollAnonymous"),checked:m,onChange:A}),a.ZP.createElement(Cn.Z,{label:N("PollMultiple"),checked:Z,disabled:P,onChange:F}),a.ZP.createElement(Cn.Z,{label:N("PollQuiz"),checked:P,disabled:Z,onChange:B}),P&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},N("lng_polls_solution_title")),a.ZP.createElement("div",{ref:o,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>C(e.currentTarget.innerHTML)}),a.ZP.createElement("div",{className:"note"},N("CreatePoll.ExplanationInfo")))))}));var Hs=n(6503),Vs=n(4284),js=n(1367);const qs=(0,a.X$)((({emoji:e,focus:t,onClick:n})=>{const s=(0,a.I4)((t=>{t.preventDefault(),n(e.native,e.id)}),[e,n]);return a.ZP.createElement("div",{className:"EmojiButton "+(t?"focus":""),onMouseDown:s,title:`:${e.names[0]}:`},f.op?e.native:a.ZP.createElement("img",{src:`./img-apple-64/${e.image}.png`,alt:"",loading:"lazy"}))})),Ks=(0,a.X$)((({category:e,index:t,allEmojis:n,observeIntersection:s,shouldRender:r,onEmojiSelect:o})=>{const i=(0,a.sO)(null);(0,Bn._N)(i,s);const l=(0,$n.Z)(r),c=(0,u.Z)(),d=f.wB?Math.floor((b.Z.get().width-8)/44):9,m=44*Math.ceil(e.emojis.length/d);return a.ZP.createElement("div",{ref:i,key:e.id,id:`emoji-category-${t}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},c("recent"===e.id?"RecentStickers":`Emoji${t}`)),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",l),style:`height: ${m}px;`,dir:c.isRtl?"rtl":void 0},r&&e.emojis.map((e=>{const t=n[e];if(!t)return;const s="id"in t?t:t[1];return a.ZP.createElement(qs,{key:s.id,emoji:s,onClick:o})}))))})),Ws={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"},Qs=[];let er,tr,nr;const ar=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["recentEmojis"])))((({className:e,onEmojiSelect:t,recentEmojis:s})=>{const r=(0,a.sO)(null),o=(0,a.sO)(null),[l,c]=(0,a.eJ)(),[d,m]=(0,a.eJ)(),[h,Z]=(0,a.eJ)(0),{observe:v}=(0,Bn.S1)({rootRef:r,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-",""));Qs[n]=e.isIntersecting}));const t=Qs.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&Z(t[Math.floor(t.length/2)].index)}));(0,Ct.Z)(o.current,!f.wB),(0,a.d4)((()=>{if(!l)return;const e=o.current;if(!e)return;const t=42*h-e.offsetWidth/2+21;(0,js.Z)(e,t)}),[l,h]);const P=(0,u.Z)(),g=(0,a.Ye)((()=>{if(!l)return Zt.D;const e=[...l];return null!=s&&s.length&&e.unshift({id:"recent",name:P("RecentStickers"),emojis:s}),e}),[l,P,s]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{c(nr.categories),m(nr.emojis)};nr?e():async function(){return er||(er=n.e(501).then(n.t.bind(n,7501,19)),tr=(await er).default,nr=(0,Vs.NM)(tr)),er}().then(e)}),200)}),[]);const p=(0,a.I4)((e=>{Z(e);const t=document.getElementById(`emoji-category-${e}`);(0,Ds.Z)(r.current,t,"start",50,800)}),[]),E=(0,a.I4)(((e,n)=>{t(e,n)}),[t]),C=(0,Ft.Z)([],i.kU),b=(0,X.Z)("EmojiPicker",e);return d&&C?a.ZP.createElement("div",{className:b},a.ZP.createElement("div",{ref:o,className:"EmojiPicker-header",dir:P.isRtl?"rtl":""},g.map((function(e,t){const n=Ws[e.id];return n&&a.ZP.createElement(R.Z,{className:"symbol-set-button "+(t===h?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>p(t),ariaLabel:e.name},a.ZP.createElement("i",{className:n}))}))),a.ZP.createElement("div",{ref:r,className:(0,X.Z)("EmojiPicker-main no-selection",f.$b?"no-scrollbar":"custom-scroll")},g.map(((e,t)=>a.ZP.createElement(Ks,{category:e,index:t,allEmojis:d,observeIntersection:v,shouldRender:h>=t-1&&h<=t+1,onEmojiSelect:E}))))):a.ZP.createElement("div",{className:b},a.ZP.createElement(Se.Z,null))})));var sr=n(6389);const rr=f.wB?8:16,or=(0,a.X$)((({stickerSet:e,loadAndPlay:t,index:n,observeIntersection:s,shouldRender:r,onStickerSelect:o,onStickerUnfave:l})=>{const c=(0,a.sO)(null);(0,Bn._N)(c,s);const d=(0,$n.Z)(r),m=f.wB?Math.floor((b.Z.get().width-8)/(i.Q+rr)):5,u=Math.ceil(e.count/m)*(i.Q+rr);return a.ZP.createElement("div",{ref:c,key:e.id,id:`sticker-set-${n}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name"},e.title),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",d),style:`height: ${u}px;`},r&&e.stickers&&e.stickers.map((n=>a.ZP.createElement(Un.Z,{key:n.id,sticker:n,size:i.Q,observeIntersection:s,noAnimate:!t,onClick:o,clickArg:n,onUnfaveClick:"favorite"===e.id?l:void 0})))))})),ir=[],lr=(0,a.X$)((0,s.c$)((e=>{const{setsById:t,added:n,recent:a,favorite:s}=e.stickers;return{recentStickers:a.stickers,favoriteStickers:s.stickers,stickerSetsById:t,addedSetIds:n.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers}}))((({chatId:e,threadId:t,className:n,loadAndPlay:r,canSendStickers:o,recentStickers:l,favoriteStickers:c,addedSetIds:d,stickerSetsById:m,shouldPlay:h,onStickerSelect:Z})=>{const{loadRecentStickers:v,addRecentSticker:P,unfaveSticker:g}=(0,s.uC)(),p=(0,a.sO)(null),E=(0,a.sO)(null),[C,b]=(0,a.eJ)(0),I=(0,sr.Z)(e,t),{observe:y}=(0,Bn.S1)({rootRef:p,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-",""));ir[n]=e.isIntersecting}));const t=ir.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&b(t[Math.floor(t.length/2)].index)})),{observe:N}=(0,Bn.S1)({rootRef:E}),k=(0,u.Z)(),S=Boolean(d),w=(0,a.Ye)((()=>d?[{id:"recent",title:k("RecentStickers"),stickers:l,count:l.length},{id:"favorite",title:k("FavoriteStickers"),stickers:c,count:c.length},...d.map((e=>m[e])).filter(Boolean)]:Zt.D),[d,k,l,c,m]),M=(0,a.Ye)((()=>S&&0===w.filter((e=>{var t;return null===(t=e.stickers)||void 0===t?void 0:t.length})).length),[w,S]);(0,a.d4)((()=>{r&&(v(),I({type:"chooseSticker"}))}),[r,v,I]),(0,Ct.Z)(E.current),(0,a.d4)((()=>{if(!S)return;const e=E.current;if(!e)return;const t=52*C-(e.offsetWidth/2-26);(0,js.Z)(e,t)}),[S,C]);const T=(0,a.I4)((e=>{b(e);const t=document.getElementById(`sticker-set-${e}`);(0,Ds.Z)(p.current,t,"start",void 0,500)}),[]),L=(0,a.I4)((e=>{Z(e),P({sticker:e})}),[P,Z]),A=(0,a.I4)((e=>{g({sticker:e})}),[g]),F=(0,a.I4)((()=>{I({type:"chooseSticker"})}),[I]),B=(0,Ft.Z)([],i.Y),$=(0,X.Z)("StickerPicker",n);return S&&B&&!M&&o?a.ZP.createElement("div",{className:$},a.ZP.createElement("div",{ref:E,className:"StickerPicker-header no-selection no-scrollbar"},w.map((function(e,t){var n;const s=null===(n=e.stickers)||void 0===n?void 0:n[0],r=(0,X.Z)("symbol-set-button sticker-set-button",t===C&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!s?a.ZP.createElement(R.Z,{key:e.id,className:r,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>T(t)},"recent"===e.id?a.ZP.createElement("i",{className:"icon-recent"}):"favorite"===e.id?a.ZP.createElement("i",{className:"icon-favorite"}):e.isAnimated?a.ZP.createElement(xn,{stickerSet:e,observeIntersection:N}):a.ZP.createElement(Dn,{stickerSet:e,observeIntersection:N})):a.ZP.createElement(Un.Z,{key:e.id,sticker:s,size:i.DC,title:e.title,className:r,observeIntersection:N,onClick:T,clickArg:t})}))),a.ZP.createElement("div",{ref:p,onMouseMove:F,className:(0,X.Z)("StickerPicker-main no-selection",f.$b?"no-scrollbar":"custom-scroll")},w.map(((e,t)=>a.ZP.createElement(or,{key:e.id,stickerSet:e,loadAndPlay:Boolean(h&&r),index:t,observeIntersection:y,shouldRender:C>=t-1&&C<=t+1,onStickerSelect:L,onStickerUnfave:A}))))):a.ZP.createElement("div",{className:$},o?M?a.ZP.createElement("div",{className:"picker-disabled"},k("NoStickers")):a.ZP.createElement(Se.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},k("ErrorSendRestrictedStickersAll")))})));var cr=n(386);function dr(){return(dr=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}).apply(this,arguments)}const mr=(0,a.X$)((({gif:e,observeIntersection:t,isDisabled:n,className:s,onClick:o})=>{var i,l;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=Boolean(null===(i=e.thumbnail)||void 0===i?void 0:i.dataUri),u=`gif${e.id}`,Z=(0,Bn.Op)(c,t)&&!n,v=(0,h.Z)(`${u}?size=m`,!Z,r.IU.BlobUrl),P=(0,ea.Z)(null===(l=e.thumbnail)||void 0===l?void 0:l.dataUri,Boolean(v)),g=(0,h.Z)(u,!Z,r.IU.BlobUrl),p=Boolean(Z&&g),{isBuffered:E,bufferingHandlers:C}=(0,Y.Z)(!0),f=Z&&!E,b=Z&&E;(0,V.Z)(d,[p]);const I=(0,a.I4)((()=>o({...e,blobUrl:g})),[o,e,g]),y=(0,X.Z)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",u,s);return a.ZP.createElement("div",{ref:c,className:y,onMouseDown:cr.b,onClick:I},m&&a.ZP.createElement("canvas",{ref:P,className:"thumbnail",style:b?"display: none;":void 0}),v&&!b&&a.ZP.createElement("img",{src:v,alt:"",className:"preview"}),p&&a.ZP.createElement("video",dr({ref:d,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},C),a.ZP.createElement("source",{src:g})),f&&a.ZP.createElement(J.Z,{color:v||m?"white":"black"}))})),ur=(0,a.X$)((0,s.c$)((e=>({savedGifs:e.gifs.saved.gifs})))((({className:e,loadAndPlay:t,canSendGifs:n,savedGifs:r,onGifSelect:o})=>{const{loadSavedGifs:l}=(0,s.uC)(),c=(0,a.sO)(null),{observe:d}=(0,Bn.S1)({rootRef:c,debounceMs:300});(0,a.d4)((()=>{t&&l()}),[t,l]);const m=(0,Ft.Z)([],i.Y);return a.ZP.createElement("div",{ref:c,className:(0,X.Z)("GifPicker",e,f.$b?"no-scrollbar":"custom-scroll")},n?m&&r&&r.length?r.map((e=>a.ZP.createElement(mr,{key:e.id,gif:e,observeIntersection:d,isDisabled:!t,onClick:o}))):m&&r?a.ZP.createElement("div",{className:"picker-disabled"},"No saved GIFs."):a.ZP.createElement(Se.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))})));let hr;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(hr||(hr={}));const Zr=Object.values(hr).filter((e=>"string"==typeof e)),vr={[hr.Emoji]:"icon-smile",[hr.Stickers]:"icon-stickers",[hr.GIFs]:"icon-gifs"},Pr=(0,a.X$)((({activeTab:e,onSwitchTab:t,onRemoveSymbol:n,onSearchOpen:s})=>{const r=(0,u.Z)();function o(n){return a.ZP.createElement(R.Z,{className:"symbol-tab-button "+(e===n?"activated":""),onClick:()=>t(n),ariaLabel:Zr[n],round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:vr[n]}))}const i=(0,a.I4)((()=>{s(e===hr.Stickers?"stickers":"gifs")}),[e,s]);return a.ZP.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0},e!==hr.Emoji&&a.ZP.createElement(R.Z,{className:"symbol-search-button",ariaLabel:e===hr.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:i},a.ZP.createElement("i",{className:"icon-search"})),o(hr.Emoji),o(hr.Stickers),o(hr.GIFs),e===hr.Emoji&&a.ZP.createElement(R.Z,{className:"symbol-delete-button",onClick:n,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:"icon-delete-left"})))}));let gr=!1;const pr=(0,a.X$)((0,s.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown})))((({chatId:e,threadId:t,isOpen:n,canSendStickers:s,canSendGifs:r,isLeftColumnShown:o,onLoad:i,onClose:l,onEmojiSelect:c,onStickerSelect:d,onGifSelect:m,onRemoveSymbol:h,onSearchOpen:Z,addRecentEmoji:v})=>{const[P,g]=(0,a.eJ)(0),[p,E]=(0,a.eJ)([]),[C,b]=(0,Hs.Z)(n,l,void 0,f.wB),{shouldRender:I,transitionClassNames:y}=(0,_.Z)(n,l,!1,!1);!gr&&n&&(gr=!0),(0,a.d4)((()=>{i()}),[i]),(0,a.bt)((()=>{if(f.wB)return n&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{n&&(0,G.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[n]);const N=(0,a.sO)(p);N.current=p,(0,a.d4)((()=>{N.current.length&&(N.current.forEach((e=>{v({emoji:e})})),E([]))}),[n,P,v]);const k=(0,a.I4)(((e,t)=>{E((e=>[...e,t])),c(e)}),[c]),S=(0,a.I4)((e=>{l(),Z(e)}),[l,Z]),w=(0,a.I4)((e=>{d(e,!0)}),[d]),M=(0,u.Z)();function T(o,i){switch(P){case hr.Emoji:return a.ZP.createElement(ar,{className:"picker-tab",onEmojiSelect:k});case hr.Stickers:return a.ZP.createElement(lr,{className:"picker-tab",loadAndPlay:!!s&&n&&(o||i),canSendStickers:s,onStickerSelect:w,chatId:e,threadId:t});case hr.GIFs:return a.ZP.createElement(ur,{className:"picker-tab",loadAndPlay:!!r&&n&&(o||i),canSendGifs:r,onGifSelect:m})}}const L=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},gr&&a.ZP.createElement(A.Z,{name:"slide",activeKey:P,renderCount:Zr.length},T)),f.wB&&a.ZP.createElement(R.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:M("Close"),className:"symbol-close-button",size:"tiny",onClick:l},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Pr,{activeTab:P,onSwitchTab:g,onRemoveSymbol:h,onSearchOpen:S}));if(f.wB){if(!I)return;const e=(0,X.Z)("SymbolMenu mobile-menu",y,!o&&"middle-column-open");return a.ZP.createElement(Ns.Z,null,a.ZP.createElement("div",{className:e},L))}return a.ZP.createElement(Ps.Z,{isOpen:n,positionX:"left",positionY:"bottom",onClose:l,className:"SymbolMenu",onCloseAnimationEnd:l,onMouseEnter:f.$b?void 0:C,onMouseLeave:f.$b?void 0:b,noCloseOnBackdrop:!f.$b},L)}))),Er=(0,a.X$)((({isOpen:e,canAttachMedia:t,canAttachPolls:n,onFileSelect:s,onPollCreate:r,onClose:o})=>{const[l,c]=(0,Hs.Z)(e,o),d=(0,a.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&s(Array.from(n),t)}),[s]),m=(0,a.I4)((()=>{Yn(Array.from(i.dI).join(","),(e=>d(e,!0)))}),[d]),h=(0,a.I4)((()=>{Yn("*",(e=>d(e,!1)))}),[d]),Z=(0,u.Z)();return a.ZP.createElement(Ps.Z,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:o,className:"AttachMenu fluid",onCloseAnimationEnd:o,onMouseEnter:f.$b?void 0:l,onMouseLeave:f.$b?void 0:c,noCloseOnBackdrop:!f.$b},!t&&a.ZP.createElement(B.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),t&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(B.Z,{icon:"photo",onClick:m},Z("AttachmentMenu.PhotoOrVideo")),a.ZP.createElement(B.Z,{icon:"document",onClick:h},Z("AttachDocument"))),n&&a.ZP.createElement(B.Z,{icon:"poll",onClick:r},Z("Poll")))})),Cr=(0,a.X$)((({withAvatar:e,focus:t,botCommand:n,bot:s,onClick:r})=>a.ZP.createElement(Re.Z,{key:n.command,className:(0,X.Z)("BotCommand chat-item-clickable scroll-item",e&&"with-avatar"),multiline:!0,onClick:()=>r(n),focus:t},e&&a.ZP.createElement(ge.Z,{size:"small",user:s}),a.ZP.createElement("div",{className:"content-inner"},a.ZP.createElement("span",{className:"title"},"/",n.command),a.ZP.createElement("span",{className:"subtitle"},(0,Pe.Z)(n.description)))))),fr=(0,a.X$)((0,s.c$)((e=>({usersById:e.users.byId})))((({usersById:e,isOpen:t,withUsername:n,botCommands:r,onClick:o,onClose:i})=>{const{sendBotCommand:l}=(0,s.uC)(),c=(0,a.sO)(null),{shouldRender:d,transitionClassNames:m}=(0,_.Z)(t,void 0,void 0,!1),u=(0,a.I4)((({botId:t,command:a})=>{const s=e[t];l({command:`/${a}${n&&s?`@${s.username}`:""}`,botId:t}),o()}),[o,l,e,n]),h=Gs({isActive:t,items:r,onSelect:u,onClose:i});(0,a.d4)((()=>{r&&!r.length&&i()}),[r,i]),(0,a.d4)((()=>{Us(".chat-item-clickable",h,c)}),[h]);const Z=(0,v.Z)(r&&r.length?r:void 0,d),P=r&&!r.length?Z:r;if(!d||P&&!P.length)return;const g=(0,X.Z)("BotCommandTooltip composer-tooltip custom-scroll",m);return a.ZP.createElement("div",{className:g,ref:c},P&&P.map(((t,n)=>a.ZP.createElement(Cr,{key:`${t.botId}_${t.command}`,botCommand:t,bot:e[t.botId],withAvatar:!0,onClick:u,focus:h===n}))))}))),br=(0,a.X$)((({isOpen:e,botCommands:t,onClose:n})=>{const{sendBotCommand:r}=(0,s.uC)(),[o,i]=(0,Hs.Z)(e,n,void 0,f.wB),l=(0,a.I4)((e=>{r({command:`/${e.command}`,botId:e.botId}),n()}),[n,r]);return a.ZP.createElement(Ps.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:n,className:"BotCommandMenu",onCloseAnimationEnd:n,onMouseEnter:f.$b?void 0:o,onMouseLeave:f.$b?void 0:i,noCloseOnBackdrop:!f.$b},t.map((e=>a.ZP.createElement(Cr,{key:e.command,botCommand:e,onClick:l}))))})),Ir=(0,a.X$)((0,s.c$)((e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}}))((({chatId:e,threadId:t,isOpen:n,onStickerSelect:r,stickers:o})=>{const{clearStickersForEmoji:l}=(0,s.uC)(),c=(0,a.sO)(null),{shouldRender:d,transitionClassNames:m}=(0,_.Z)(n,void 0,void 0,!1),u=(0,v.Z)(o,!0),h=o||u,Z=(0,sr.Z)(e,t),{observe:P}=(0,Bn.S1)({rootRef:c,throttleMs:200});(0,a.d4)((()=>n?(0,E.Z)(l):void 0),[n,l]);const g=(0,X.Z)("StickerTooltip composer-tooltip custom-scroll",m,!(null!=h&&h.length)&&"hidden");return a.ZP.createElement("div",{ref:c,className:g,onMouseEnter:f.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:f.$b?void 0:()=>{document.body.classList.remove("no-select")},onMouseMove:()=>{Z({type:"chooseSticker"})}},d&&h?h.map((e=>a.ZP.createElement(Un.Z,{key:e.id,sticker:e,size:i.Q,observeIntersection:P,onClick:r,clickArg:e}))):d?a.ZP.createElement(Se.Z,null):void 0)}))),yr=(0,a.X$)((({isOpen:e,onSilentSend:t,onScheduleSend:n,onClose:s,onCloseAnimationEnd:r})=>{const[o,i]=(0,Hs.Z)(e,s),l=(0,u.Z)();return a.ZP.createElement(Ps.Z,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",className:"CustomSendMenu",onClose:s,onCloseAnimationEnd:r,onMouseEnter:f.$b?void 0:o,onMouseLeave:f.$b?void 0:i,noCloseOnBackdrop:!f.$b},t&&a.ZP.createElement(B.Z,{icon:"mute",onClick:t},l("SendWithoutSound")),n&&a.ZP.createElement(B.Z,{icon:"schedule",onClick:n},l("ScheduleMessage")))}));var Nr=n(2420),kr=n(3283),Sr=n(2678);const wr=(0,a.X$)((({isOpen:e,emojis:t,onClose:n,onEmojiSelect:s,addRecentEmoji:r})=>{const o=(0,a.sO)(null),{shouldRender:i,transitionClassNames:l}=(0,_.Z)(e,void 0,void 0,!1),c=(0,Sr.Z)(t.length?t:void 0,350)||[],d=(0,a.I4)((e=>{s(e.native),r({emoji:e.id})}),[r,s]),m=(0,a.I4)(((e,t)=>{s(e),r({emoji:t})}),[r,s]),u=Gs({isActive:e,isHorizontal:!0,items:t,onSelect:d,onClose:n});(0,a.d4)((()=>{!function(e,t){const n=t.current;if(!n)return;const{visibleIndexes:a,allElements:s}=$s(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const r=a[0];if(!a.includes(e)||e===r&&!xs(n,s[r],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,js.Z)(n,t)}}(u,o)}),[u]);const h=(0,X.Z)("EmojiTooltip composer-tooltip custom-scroll-x",l);return a.ZP.createElement("div",{ref:o,className:h,onMouseEnter:f.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:f.$b?void 0:()=>{document.body.classList.remove("no-select")}},i&&c?c.map(((e,t)=>a.ZP.createElement(qs,{key:e.id,emoji:e,focus:u===t,onClick:m}))):i?a.ZP.createElement(Se.Z,null):void 0)})),Mr=(0,a.X$)((({title:e,description:t,thumbnail:n,thumbUrl:s,focus:r,transitionClassNames:o="",onClick:i})=>{let l="";const c=(0,h.Z)(n?`webDocument:${n.url}`:void 0);return(s=s||c)?l=a.ZP.createElement("img",{src:s,className:o,alt:"",decoding:"async",draggable:"false"}):e&&(l=(0,it.Xv)(e,1)),a.ZP.createElement(Re.Z,{focus:r,className:"BaseResult chat-item-clickable",onMouseDown:cr.b,onClick:i},a.ZP.createElement("span",{className:"thumb"},"string"==typeof l?(0,Pe.Z)(l):l),a.ZP.createElement("div",{className:"content-inner"},e&&a.ZP.createElement("div",{className:"title"},e),t&&a.ZP.createElement("div",{className:"description"},t)))})),Tr=(0,a.X$)((({focus:e,isForGallery:t,inlineResult:n,onClick:s})=>{var r;let o,i,l;"photo"in n&&(o=n.photo),"thumbnail"in n&&(i=n.thumbnail),"webThumbnail"in n&&t&&(l=n.webThumbnail);const c=(0,h.Z)(l?`webDocument:${l.url}`:void 0),d=(0,h.Z)(o&&`photo${o.id}?size=m`),m=(0,$n.Z)(d),u=(0,a.I4)((()=>{s(n)}),[n,s]);var Z,v;if(t)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:u},a.ZP.createElement("img",{src:(null===(Z=o)||void 0===Z||null===(v=Z.thumbnail)||void 0===v?void 0:v.dataUri)||c,alt:""}),a.ZP.createElement("img",{src:d,className:(0,X.Z)("full-media",m),alt:""}));const{title:P,description:g}=n;return a.ZP.createElement(Mr,{focus:e,thumbUrl:d||(null===(r=i)||void 0===r?void 0:r.dataUri)||c,transitionClassNames:m,title:P,description:g,onClick:u})})),Rr=(0,a.X$)((({focus:e,inlineResult:t,onClick:n})=>{const{title:s,url:r,description:o,webThumbnail:i}=t,l=(0,a.I4)((()=>{n(t)}),[t,n]);return a.ZP.createElement(Mr,{focus:e,thumbnail:i,title:s||r,description:o,onClick:l})})),Lr=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{gif:s}=e,r=(0,a.I4)((()=>{n(e)}),[e,n]);if(s)return a.ZP.createElement(mr,{gif:s,observeIntersection:t,className:"chat-item-clickable",onClick:r})})),Ar=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{sticker:s}=e;if(s)return a.ZP.createElement(Un.Z,{sticker:s,size:i.zq,observeIntersection:t,title:s.emoji,className:"chat-item-clickable",onClick:n,clickArg:e})})),Fr=(0,G.P2)((e=>e()),500,!0),Br=(0,a.X$)((({isOpen:e,botId:t,isGallery:n,inlineBotResults:r,switchPm:i,loadMore:l,onClose:c,onSelectResult:d})=>{const{openChat:m,startBot:u}=(0,s.uC)(),h=(0,a.sO)(null),{shouldRender:Z,transitionClassNames:P}=(0,_.Z)(e,void 0,void 0,!1),{observe:g}=(0,Bn.S1)({rootRef:h,debounceMs:200,isDisabled:!e}),p=(0,a.I4)((({direction:e})=>{e===o.Uq.Backwards&&Fr(l)}),[l]),E=Gs({isActive:e,shouldRemoveSelectionOnReset:n,noArrowNavigation:n,items:r,onSelect:d,onClose:c});(0,a.d4)((()=>{Us(".chat-item-clickable",E,h)}),[E]);const C=(0,a.I4)((()=>{m({id:t}),u({botId:t,param:i.startParam})}),[t,m,u,i]),b=(0,v.Z)(null!=r&&r.length?r:void 0,Z),I=r&&!r.length?b:r;if(!Z||!(null!=I&&I.length||i))return;const y=(0,X.Z)("InlineBotTooltip composer-tooltip",f.$b?"no-scrollbar":"custom-scroll",n&&"gallery",P);return a.ZP.createElement(Te.Z,{ref:h,className:y,items:I,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:p,sensitiveArea:160},i&&a.ZP.createElement(Re.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:C},a.ZP.createElement("span",{className:"title"},i.text)),(null==I?void 0:I.length)&&I.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(Lr,{key:e.id,inlineResult:e,observeIntersection:g,onClick:d});case"photo":return a.ZP.createElement(Tr,{key:e.id,isForGallery:n,inlineResult:e,onClick:d});case"sticker":return a.ZP.createElement(Ar,{key:e.id,inlineResult:e,observeIntersection:g,onClick:d});case"video":case"file":case"game":return a.ZP.createElement(Tr,{key:e.id,focus:E===t,inlineResult:e,onClick:d});case"article":case"audio":return a.ZP.createElement(Rr,{key:e.id,focus:E===t,inlineResult:e,onClick:d});default:return}})))})),$r=(0,a.X$)((({isOpen:e,onClose:t,chatId:n,selectedSendAsId:r,sendAsIds:o})=>{const{saveDefaultSendAs:i}=(0,s.uC)(),l=(0,s.Rd)().users.byId,c=(0,s.Rd)().chats.byId,d=(0,u.Z)(),m=(0,a.sO)(null),[h,Z,v]=(0,Hs.Z)(e,t,void 0);(0,a.d4)((()=>{e&&v()}),[e,v]);const g=(0,a.I4)((e=>{t(),i({chatId:n,sendAsId:e})}),[n,t,i]),p=Gs({isActive:e,items:o,onSelect:g,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});return(0,a.d4)((()=>{Us(".chat-item-clickable",p,m)}),[p]),(0,a.d4)((()=>{o&&!o.length&&t()}),[o,t]),a.ZP.createElement(Ps.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:t,className:"SendAsMenu",onCloseAnimationEnd:t,onMouseEnter:f.$b?void 0:h,onMouseLeave:f.$b?void 0:Z,noCloseOnBackdrop:!f.$b},a.ZP.createElement("div",{className:"send-as-title",dir:"auto"},d("SendMessageAsTitle")),l&&c&&(null==o?void 0:o.map(((e,t)=>{const n=(0,P.YC)(e)?l[e]:void 0,s=n?void 0:c[e],o=n?(0,P.Js)(n):null==s?void 0:s.title;return a.ZP.createElement(Re.Z,{key:e,className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>g(e),focus:p===t},a.ZP.createElement(ge.Z,{size:"small",user:n,chat:s,className:(0,X.Z)(r===e&&"selected")}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},o&&(0,Pe.Z)(o))),a.ZP.createElement("span",{className:"subtitle"},n?d("VoipGroupPersonalAccount"):d("Subscribers",null==s?void 0:s.membersCount,"i"))))}))))}));var xr=n(6844);const Dr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t),a=n&&(0,g.Zw)(e,n.id);if(!n||!a)return{};const{query:s,results:r}=(0,g.n5)(e)||{},{totalCount:o,foundIds:i}=r||{};return{chat:n,messagesById:a,query:s,totalCount:o,foundIds:i}}))((({chatId:e,threadId:t,onClose:n,isActive:r,chat:o,messagesById:i,query:l,totalCount:c,foundIds:d})=>{const{searchTextMessagesLocal:h,focusMessage:Z}=(0,s.uC)(),v=(0,u.Z)(),p=(0,a.Ye)((()=>{if(!(l&&d&&d.length&&i))return Zt.D;const n=d.map((n=>{const a=i[n];if(!a)return;const r=a.senderId?(0,g.dy)((0,s.Rd)(),a.senderId):void 0;let l;if(o&&(0,P.eA)(o))l=o;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;l=e&&t?(0,g.Z1)((0,s.Rd)(),t):void 0}else l=a.senderId?(0,g.Z1)((0,s.Rd)(),a.senderId):void 0;return{message:a,senderUser:r,senderChat:l,onClick:()=>Z({chatId:e,threadId:t,messageId:n})}})).filter(Boolean);return(0,me.Xo)(n,(({message:e})=>e.date),"desc")}),[e,t,Z,d,o,i,l]);(0,m.ZP)(r,n);const E=(0,a.sO)(null),C=(0,Ne.Z)(E,!0,(e=>{const t=null==p?void 0:p[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0);return a.ZP.createElement(Te.Z,{className:"RightSearch custom-scroll",items:p,preloadBackwards:0,onLoadMore:h,noFastList:!0,onKeyDown:C,ref:E},a.ZP.createElement("p",{className:"helper-text",dir:"auto"},l?0!==c&&p.length?1===c?"1 message found":`${p.length&&(c||p.length)} messages found`:v("lng_search_no_results"):v("lng_dlg_search_for_messages")),p.map((({message:e,senderUser:t,senderChat:n,onClick:s})=>{const r=n?(0,P.U)(v,n):(0,P.Js)(t),o=(0,y.eK)(v,e,void 0,l);return a.ZP.createElement(Re.Z,{className:"chat-item-clickable search-result-message m-0",onClick:s},a.ZP.createElement(ge.Z,{chat:n,user:t}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},r&&(0,Pe.Z)(r)),a.ZP.createElement(xr.Z,{message:e})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},o)))})))})));var Ur=n(9290);const Or=(0,a.X$)((0,s.c$)(((e,{stickerSetId:t})=>({set:(0,g.Ny)(e,t),shouldPlay:(0,g.yB)(e)})))((({stickerSetId:e,observeIntersection:t,set:n,shouldPlay:r,isSomeModalOpen:o,onModalToggle:l})=>{const{loadStickers:c,toggleStickerSet:d}=(0,s.uC)(),m=(0,u.Z)(),h=n&&Boolean(n.installedDate),Z=Boolean(null==n?void 0:n.stickers),[v,P,g]=(0,xe.Z)();(0,Ur.Z)((()=>{l(v)}),[v,l]);const p=(0,a.Ye)((()=>{if(!n)return[];const e=(n.covers||[]).map((({id:e})=>e)),t=n.stickers?n.stickers.filter((({id:t})=>!e.includes(t))):[];return[...n.covers||[],...t].slice(0,5)}),[n]);(0,a.d4)((()=>{!Z&&p.length<5&&c({stickerSetId:e})}),[Z,p.length,c,e]);const E=(0,a.I4)((()=>{d({stickerSetId:e})}),[d,e]);if(!n)return;const C=p.length>0;return a.ZP.createElement("div",{key:n.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"},n.title),a.ZP.createElement("p",{className:"count",dir:"auto"},m("Stickers",n.count,"i"))),a.ZP.createElement(R.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(J.Z,null),C&&p.map((e=>a.ZP.createElement(Un.Z,{sticker:e,size:i.Y7,observeIntersection:t,noAnimate:!r||v||o,onClick:P})))),C&&a.ZP.createElement(Gn.Z,{isOpen:v,fromSticker:p[0],onClose:g}))}))),Gr=(0,G.P2)((e=>e()),6e4,!0),Jr=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.y5)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a}}))((({onClose:e,isActive:t,query:n,featuredIds:r,resultIds:o})=>{const{loadFeaturedStickers:i}=(0,s.uC)(),l=(0,a.sO)(null),c=(0,u.Z)(),[d,h]=(0,a.eJ)(!1),{observe:Z}=(0,Bn.S1)({rootRef:l,throttleMs:200});return(0,a.d4)((()=>{Gr((()=>{i()}))})),(0,m.ZP)(t,e),a.ZP.createElement("div",{ref:l,className:"StickerSearch custom-scroll",dir:c.isRtl?"rtl":void 0},function(){if(void 0!==n)return!n&&r?r.map((e=>a.ZP.createElement(Or,{key:e,stickerSetId:e,observeIntersection:Z,isSomeModalOpen:d,onModalToggle:h}))):o?o.length?o.map((e=>a.ZP.createElement(Or,{key:e,stickerSetId:e,observeIntersection:Z,isSomeModalOpen:d,onModalToggle:h}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(Se.Z,null)}())}))),Xr=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.yN)(e),{query:n,results:a}=t||{},{chatId:s}=(0,g.Bt)(e)||{},r=s?(0,g.Z1)(e,s):void 0;return{query:n,results:a,chat:r,isChatWithBot:r?(0,g.xo)(e,r):void 0}}))((({onClose:e,isActive:t,query:n,results:r,chat:o,isChatWithBot:i})=>{const{searchMoreGifs:l,sendMessage:c,setGifSearchQuery:d}=(0,s.uC)(),h=(0,a.sO)(null),{observe:Z}=(0,Bn.S1)({rootRef:h,debounceMs:300}),{canSendGifs:v}=(0,P.H5)(o,i),g=(0,a.I4)((e=>{v&&c({gif:e}),f.$b&&d({query:void 0})}),[v,c,d]),p=(0,u.Z)();(0,m.ZP)(t,e);const E=Boolean(void 0!==n&&r&&r.length);return a.ZP.createElement("div",{className:"GifSearch",dir:p.isRtl?"rtl":void 0},a.ZP.createElement(Te.Z,{ref:h,className:(0,X.Z)("gif-container custom-scroll",E&&"grid"),items:r,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:l},function(){if(void 0!==n)return r?r.length?r.map((e=>a.ZP.createElement(mr,{key:e.id,gif:e,observeIntersection:Z,onClick:g}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},p("NoGIFsFound")):a.ZP.createElement(Se.Z,null)}()))}))),zr=(0,a.X$)((0,s.c$)(((e,{answer:t})=>{const{voters:n,offsets:a}=e.pollResults;return{voters:null==n?void 0:n[t.option],offset:(null==a?void 0:a[t.option])||""}}))((({chat:e,message:t,answer:n,answerVote:r,totalVoters:o,voters:i,offset:l})=>{const{loadPollOptionResults:c,openChat:d,closePollResults:m}=(0,s.uC)(),h=(0,v.Z)(r.votersCount),[Z,P]=(0,a.eJ)(!0),g=Boolean(i),{option:p,text:E}=n,C=(0,u.Z)();(0,a.d4)((()=>{g&&h===r.votersCount||c({chat:e,messageId:t.id,option:p,offset:l,limit:4,shouldResetVoters:!0})}),[r.votersCount,g]);const f=(0,a.I4)((()=>{P(!0),c({chat:e,messageId:t.id,option:p,offset:l,limit:50})}),[e,c,t.id,l,p]);(0,a.d4)((()=>{P(!1)}),[i]);const b=(0,a.I4)((e=>{d({id:e}),m()}),[m,d]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},i?i.map((e=>a.ZP.createElement(Re.Z,{key:e,className:"chat-item-clickable",onClick:()=>b(e)},a.ZP.createElement(Ae.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(Se.Z,null),i&&function(){const e=r.votersCount-i.length;return r.votersCount>4&&e>0&&a.ZP.createElement(kn,{count:e,itemName:"voter",isLoading:Z,onClick:f})}()),a.ZP.createElement("div",{className:"answer-head",dir:C.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},E),a.ZP.createElement("span",{className:"answer-percent",dir:C.isRtl?"auto":void 0},(I=r.votersCount,(y=o)>0?(I/y*100).toFixed():0),"%")));var I,y}))),_r=(0,a.X$)((0,s.c$)((e=>{const{pollResults:{chatId:t,messageId:n},lastSyncTime:a}=e;return t&&n?{chat:(0,g.Z1)(e,t),message:(0,g.hj)(e,t,n),lastSyncTime:a}:{}}))((({onClose:e,isActive:t,chat:n,message:s,lastSyncTime:r})=>{const o=(0,u.Z)();if((0,m.ZP)(t,e),!s||!n)return a.ZP.createElement(Se.Z,null);const{summary:i,results:l}=(0,P.t9)(s);if(!l.results)return;const c=(0,me.ee)(l.results,"option");return a.ZP.createElement("div",{className:"PollResults",dir:o.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"poll-question",dir:"auto"},(0,Pe.Z)(i.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},r&&i.answers.map((e=>a.ZP.createElement(zr,{key:`${s.id}-${e.option}`,chat:n,message:s,answer:e,answerVote:c[e.option],totalVoters:l.totalVoters}))),!r&&a.ZP.createElement(Se.Z,null)))}))),Yr="Please provide first name",Hr=(0,a.X$)((0,s.c$)(((e,{userId:t})=>{const n=(0,g.dy)(e,t),a=(0,g.Z1)(e,t),{progress:s}=e.management;return{user:n,progress:s,isMuted:(0,P.i4)(a,(0,g.dZ)(e),(0,g.NJ)(e))}}))((({userId:e,user:t,progress:n,isMuted:r,onClose:i,isActive:l})=>{const{updateContact:c,deleteContact:d,closeManagement:h}=(0,s.uC)(),[Z,v,P]=(0,xe.Z)(),[g,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(),f=(0,u.Z)();(0,m.ZP)(l,i);const b=t&&t.firstName||"",I=t&&t.lastName||"",[y,N]=(0,a.eJ)(b),[k,S]=(0,a.eJ)(I),[w,M]=(0,a.eJ)(!r);(0,a.d4)((()=>{M(!r)}),[r]),(0,a.d4)((()=>{p(!1),P()}),[P,e]),(0,a.d4)((()=>{N(b),S(I)}),[b,I,t]),(0,a.d4)((()=>{n===o.wv.Complete&&(p(!1),C(void 0),P())}),[P,n]);const T=(0,a.I4)((e=>{N(e.target.value),p(!0)}),[]),R=(0,a.I4)((e=>{S(e.target.value),p(!0)}),[]),L=(0,a.I4)((e=>{M(e.target.checked),p(!0)}),[]),A=(0,a.I4)((()=>{const t=y.trim(),n=k.trim();t.length||C(Yr),c({userId:e,isMuted:!w,firstName:t,lastName:n})}),[y,k,c,e,w]),F=(0,a.I4)((()=>{d({userId:e}),P(),h()}),[P,h,d,e]);if(!t)return;const B=n===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(Ae.Z,{userId:t.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(Me.Z,{id:"user-first-name",label:f("UserInfo.FirstNamePlaceholder"),onChange:T,value:y,error:E===Yr?E:void 0}),a.ZP.createElement(Me.Z,{id:"user-last-name",label:f("UserInfo.LastNamePlaceholder"),onChange:R,value:k}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(Cn.Z,{checked:w,label:f("Notifications"),subLabel:f(w?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:L}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:v},f("DeleteContact")))),a.ZP.createElement(dn.Z,{isShown:g,onClick:A,disabled:B,ariaLabel:f("Save")},B?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:Z,onClose:P,text:f("AreYouSureDeleteContact"),confirmLabel:f("DeleteContact"),confirmHandler:F,confirmIsDestructive:!0}))}))),Vr="Group title can't be empty",jr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n,a;const s=(0,g.Z1)(e,t),{progress:r}=e.management,o=Boolean(null===(n=s.fullInfo)||void 0===n?void 0:n.linkedChatId),i=(0,P.G9)(s),{invites:l}=e.management.byChatId[t]||{};return{chat:s,progress:r,isBasicGroup:i,hasLinkedChannel:o,canChangeInfo:i?s.isCreator:(0,P.VE)(s,"changeInfo"),canBanUsers:i?s.isCreator:(0,P.VE)(s,"banUsers"),canInvite:i?s.isCreator:(0,P.VE)(s,"inviteUsers"),exportedInvites:l,lastSyncTime:e.lastSyncTime,availableReactionsCount:null===(a=e.availableReactions)||void 0===a?void 0:a.filter((e=>!e.isInactive)).length}}))((({chatId:e,chat:t,progress:n,isBasicGroup:i,hasLinkedChannel:l,canChangeInfo:c,canBanUsers:d,canInvite:Z,onScreenSelect:v,onClose:g,isActive:p,exportedInvites:E,lastSyncTime:C,availableReactionsCount:f})=>{var b,I,y,N,k,S;const{togglePreHistoryHidden:w,updateChat:M,deleteChat:T,leaveChannel:R,deleteChannel:L,closeManagement:A,openChat:F,loadExportedChatInvites:B,loadChatJoinRequests:$}=(0,s.uC)(),[x,D,U]=(0,xe.Z)(),O=t.title,G=t.fullInfo&&t.fullInfo.about||"",[X,z]=(0,a.eJ)(!1),[_,Y]=(0,a.eJ)(O),[H,V]=(0,a.eJ)(G),[j,q]=(0,a.eJ)(),[K,W]=(0,a.eJ)(),Q=(0,P.RT)(t),ee=(0,h.Z)(Q,!1,r.IU.BlobUrl),te=(0,u.Z)();(0,m.ZP)(p,g),(0,a.d4)((()=>{C&&Z&&(B({chatId:e}),B({chatId:e,isRevoked:!0}),$({chatId:e}))}),[e,B,C,Z,$]),(0,a.d4)((()=>{n===o.wv.Complete&&(z(!1),W(void 0))}),[n]);const ne=(0,a.I4)((()=>{v(o.u1.ChatPrivacyType)}),[v]),ae=(0,a.I4)((()=>{v(o.u1.Discussion)}),[v]),se=(0,a.I4)((()=>{v(o.u1.Reactions)}),[v]),re=(0,a.I4)((()=>{v(o.u1.GroupPermissions)}),[v]),oe=(0,a.I4)((()=>{v(o.u1.ChatAdministrators)}),[v]),ie=(0,a.I4)((e=>{q(e),z(!0)}),[]),le=(0,a.I4)((e=>{Y(e.target.value),z(!0)}),[]),ce=(0,a.I4)((e=>{V(e.target.value),z(!0)}),[]),de=(0,a.I4)((()=>{const t=_.trim(),n=H.trim();t.length?M({chatId:e,title:t,about:n,photo:j}):W(Vr)}),[H,e,j,_,M]),me=(0,a.I4)((()=>{v(o.u1.GroupMembers)}),[v]),ue=(0,a.I4)((()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;w({chatId:t.id,isEnabled:!e})}),[t,w]),he=(null===(b=t.fullInfo)||void 0===b||null===(I=b.enabledReactions)||void 0===I?void 0:I.length)||0,Ze=(0,a.Ye)((()=>{if(!t.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter((e=>!t.defaultBannedRights[e])).length;const{sendStickers:n,sendGifs:a}=t.defaultBannedRights;return n||a||(e+=1),e}),[t]),ve=(null===(y=t.fullInfo)||void 0===y||null===(N=y.adminMembers)||void 0===N?void 0:N.length)||0,ge=(0,a.I4)((()=>{i?T({chatId:t.id}):t.isCreator?L({chatId:t.id}):R({chatId:t.id}),U(),A(),F({id:void 0})}),[i,t.isCreator,t.id,U,A,R,L,T,F]);if(t.isRestricted)return;const pe=n===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(cn.Z,{currentAvatarBlobUrl:ee,onChange:ie,disabled:!c}),a.ZP.createElement(Me.Z,{id:"group-title",label:te("GroupName"),onChange:le,value:_,error:K===Vr?K:void 0,disabled:!c}),a.ZP.createElement(Me.Z,{id:"group-about",className:"mb-2",label:te("DescriptionPlaceholder"),onChange:ce,value:H,disabled:!c}),t.isCreator&&a.ZP.createElement(Re.Z,{icon:"lock",multiline:!0,onClick:ne},a.ZP.createElement("span",{className:"title"},te("GroupType")),a.ZP.createElement("span",{className:"subtitle"},t.username?te("TypePublic"):te("TypePrivate"))),l&&a.ZP.createElement(Re.Z,{icon:"message",multiline:!0,onClick:ae},a.ZP.createElement("span",{className:"title"},te("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},te("DiscussionUnlink"))),a.ZP.createElement(Re.Z,{icon:"permissions",multiline:!0,onClick:re,disabled:!d},a.ZP.createElement("span",{className:"title"},te("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},Ze,"/",8)),a.ZP.createElement(Re.Z,{icon:"reactions",multiline:!0,onClick:se,disabled:!c},a.ZP.createElement("span",{className:"title"},te("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},he,"/",f)),a.ZP.createElement(Re.Z,{icon:"admin",multiline:!0,onClick:oe},a.ZP.createElement("span",{className:"title"},te("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,it.kh)(ve))),Z&&a.ZP.createElement(Re.Z,{icon:"link",onClick:()=>{v(o.u1.Invites)},multiline:!0,disabled:!E},a.ZP.createElement("span",{className:"title"},te("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},E?(0,it.kh)(E.length):te("Loading"))),Boolean(null===(k=t.joinRequests)||void 0===k?void 0:k.length)&&a.ZP.createElement(Re.Z,{icon:"add-user-filled",onClick:()=>{v(o.u1.JoinRequests)},multiline:!0},a.ZP.createElement("span",{className:"title"},te("MemberRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,it.kh)(t.joinRequests.length)))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{icon:"group",multiline:!0,onClick:me},a.ZP.createElement("span",{className:"title"},te("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,it.kh)(null!==(S=t.membersCount)&&void 0!==S?S:0))),t.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection"},a.ZP.createElement(Cn.Z,{checked:!t.fullInfo.isPreHistoryHidden,label:te("ChatHistory"),onChange:ue,disabled:!d}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:D},te("DeleteMega")))),a.ZP.createElement(dn.Z,{isShown:X,onClick:de,disabled:pe,ariaLabel:te("Save")},pe?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:x,onClose:U,textParts:(0,Pe.Z)(i||!t.isCreator?te("AreYouSureDeleteAndExit"):te("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:i||!t.isCreator?te("DeleteMega"):te("DeleteGroupForAll"),confirmHandler:ge,confirmIsDestructive:!0}))}))),qr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>({chat:(0,g.Z1)(e,t),currentUserId:e.currentUserId})))((({onScreenSelect:e,onChatMemberSelect:t,chat:n,currentUserId:r,onClose:i,isActive:l})=>{const{updateChatDefaultBannedRights:c}=(0,s.uC)(),[d,h]=(0,a.eJ)({}),[Z,v]=(0,a.eJ)(!1),[P,g]=(0,a.eJ)(!1),p=(0,u.Z)();(0,m.ZP)(l,i);const E=(0,a.I4)((()=>{e(o.u1.GroupRemovedUsers)}),[e]),C=(0,a.I4)((()=>{e(o.u1.GroupUserPermissionsCreate)}),[e]),f=(0,a.I4)((n=>{t(n.userId,n.promotedByUserId===r),e(o.u1.GroupUserPermissions)}),[r,t,e]);(0,a.d4)((()=>{h((null==n?void 0:n.defaultBannedRights)||{}),v(!1),setTimeout((()=>{g(!1)}),250)}),[n]);const b=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}h((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),v(!0)}),[]),I=(0,a.I4)((()=>{n&&(g(!0),c({chatId:n.id,bannedRights:d}))}),[n,d,c]),y=(0,a.Ye)((()=>n&&n.fullInfo&&n.fullInfo.kickedMembers?n.fullInfo.kickedMembers.length:0),[n]),N=(0,a.Ye)((()=>n&&n.fullInfo&&n.fullInfo.members?n.fullInfo.members.filter((({bannedRights:e})=>!!e)):[]),[n]),k=(0,a.I4)((e=>{const{bannedRights:t}=e;if(!t||!n)return;const{defaultBannedRights:a}=n;return Object.keys(t).reduce(((e,n)=>{if(!t[n]||null!=a&&a[n]||"sendInline"===n||"viewMessages"===n||"sendGames"===n)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}}(n);if(!s)return e;const r=p(s);return`${e}${e.length?`, ${r}`:r}`}),"")}),[n,p]);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"},p("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendMessages",checked:!d.sendMessages,label:p("UserRestrictionsSend"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendMedia",checked:!d.sendMedia,label:p("UserRestrictionsSendMedia"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendStickers",checked:!d.sendStickers&&!d.sendGifs,label:p("UserRestrictionsSendStickers"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendPolls",checked:!d.sendPolls,label:p("UserRestrictionsSendPolls"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"embedLinks",checked:!d.embedLinks,label:p("UserRestrictionsEmbedLinks"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"inviteUsers",checked:!d.inviteUsers,label:p("UserRestrictionsInviteUsers"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"pinMessages",checked:!d.pinMessages,label:p("UserRestrictionsPinMessages"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!d.changeInfo,label:p("UserRestrictionsChangeInfo"),blocking:!0,onChange:b}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:E},a.ZP.createElement("span",{className:"title"},p("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},y))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},p("PrivacyExceptions")),a.ZP.createElement(Re.Z,{icon:"add-user",onClick:C},p("ChannelAddException")),N.map((e=>a.ZP.createElement(Re.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>f(e)},a.ZP.createElement(Ae.Z,{userId:e.userId,status:k(e)})))))),a.ZP.createElement(dn.Z,{isShown:Z,onClick:I,ariaLabel:p("Save"),disabled:P},P?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Kr=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e;return{currentUserId:t}}))((({chat:e,currentUserId:t,isOpen:n,onClose:r})=>{var o;const{loadMoreMembers:i,deleteChatMember:l}=(0,s.uC)(),c=(0,u.Z)(),[d,m]=(0,a.eJ)(""),h=(0,a.sO)(null),Z=(0,a.Ye)((()=>{var n;const a=((null===(n=e.fullInfo)||void 0===n?void 0:n.members)||[]).reduce(((e,n)=>(n.isAdmin||n.isOwner||n.userId===t||e.push(n.userId),e)),[]),r=(0,s.Rd)().users.byId;return(0,P.kK)(a,r,d)}),[null===(o=e.fullInfo)||void 0===o?void 0:o.members,t,d]),v=(0,a.I4)((t=>{l({chatId:e.id,userId:t}),r()}),[e.id,l,r]);return a.ZP.createElement(Fe,{isOpen:n,chatOrUserIds:Z,filterRef:h,filterPlaceholder:c("ChannelBlockUser"),filter:d,onFilterChange:m,loadMore:i,onSelectChatOrUser:v,onClose:r})}))),Wr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t),{byId:a}=e.users;return{chat:n,usersById:a,canDeleteMembers:n&&((0,P.VE)(n,"banUsers")||n.isCreator)}}))((({chat:e,usersById:t,canDeleteMembers:n,onClose:r,isActive:o})=>{const{updateChatMemberBannedRights:i}=(0,s.uC)(),l=(0,u.Z)(),[c,d,h]=(0,xe.Z)();(0,m.ZP)(o,r);const Z=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[]),[e]),v=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const n=t[e.kickedByUserId];return n?l("UserRemovedBy",(0,P.Js)(n)):void 0}),[l,t]),g=(0,a.I4)((t=>{if(e)return[{title:l("Unblock"),icon:"delete",destructive:!0,handler:()=>i({chatId:e.id,userId:t.userId,bannedRights:{}})}]}),[l,e,i]);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("p",{className:"text-muted"},l("NoBlockedGroup2")),Z.map((e=>a.ZP.createElement(Re.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:g(e)},a.ZP.createElement(Ae.Z,{userId:e.userId,status:v(e)})))),n&&a.ZP.createElement(dn.Z,{isShown:!0,onClick:d,ariaLabel:l("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon-add-user-filled"})),e&&n&&a.ZP.createElement(Kr,{chat:e,isOpen:c,onClose:h}))))}))),Qr="Channel title can't be empty",eo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t),{progress:s}=e.management,r=Boolean(null==a?void 0:a.isSignaturesShown),{invites:o}=e.management.byChatId[t]||{};return{chat:a,progress:s,isSignaturesShown:r,canChangeInfo:(0,P.VE)(a,"changeInfo"),canInvite:(0,P.VE)(a,"inviteUsers"),lastSyncTime:e.lastSyncTime,exportedInvites:o,availableReactionsCount:null===(n=e.availableReactions)||void 0===n?void 0:n.filter((e=>!e.isInactive)).length}}))((({chatId:e,chat:t,progress:n,isSignaturesShown:i,canChangeInfo:l,canInvite:c,exportedInvites:d,lastSyncTime:Z,availableReactionsCount:v,onScreenSelect:g,onClose:p,isActive:E})=>{var C,f,b,I,y,N,k;const{updateChat:S,toggleSignatures:w,closeManagement:M,leaveChannel:T,deleteChannel:R,openChat:L,loadExportedChatInvites:A,loadChatJoinRequests:F}=(0,s.uC)(),B=t&&t.title||"",$=null!=t&&t.fullInfo&&t.fullInfo.about||"",x=null==t||null===(C=t.fullInfo)||void 0===C?void 0:C.linkedChatId,[D,U,O]=(0,xe.Z)(),[G,X]=(0,a.eJ)(!1),[z,_]=(0,a.eJ)(B),[Y,H]=(0,a.eJ)($),[V,j]=(0,a.eJ)(),[q,K]=(0,a.eJ)(),W=t&&(0,P.RT)(t),Q=(0,h.Z)(W,!1,r.IU.BlobUrl),ee=(0,u.Z)();(0,m.ZP)(E,p),(0,a.d4)((()=>{Z&&(A({chatId:e}),A({chatId:e,isRevoked:!0}),F({chatId:e}))}),[e,A,Z,F]),(0,a.d4)((()=>{n===o.wv.Complete&&(X(!1),K(void 0))}),[n]);const te=(null==t||null===(f=t.fullInfo)||void 0===f||null===(b=f.adminMembers)||void 0===b?void 0:b.length)||0,ne=(0,a.I4)((()=>{g(o.u1.ChatPrivacyType)}),[g]),ae=(0,a.I4)((()=>{g(o.u1.Discussion)}),[g]),se=(0,a.I4)((()=>{g(o.u1.Reactions)}),[g]),re=(0,a.I4)((()=>{g(o.u1.ChatAdministrators)}),[g]),oe=(0,a.I4)((e=>{j(e),X(!0)}),[]),ie=(0,a.I4)((e=>{_(e.target.value),X(!0)}),[]),le=(0,a.I4)((e=>{H(e.target.value),X(!0)}),[]),ce=(0,a.I4)((()=>{const t=z.trim(),n=Y.trim();t.length?S({chatId:e,title:t,about:n,photo:V}):K(Qr)}),[Y,e,V,z,S]),de=(0,a.I4)((()=>{w({chatId:e,isEnabled:!i})}),[e,i,w]),me=(0,a.I4)((()=>{g(o.u1.ChannelSubscribers)}),[g]),ue=(0,a.I4)((()=>{t.isCreator?R({chatId:t.id}):T({chatId:t.id}),O(),M(),L({id:void 0})}),[t.isCreator,t.id,O,M,T,R,L]),he=(null===(I=t.fullInfo)||void 0===I||null===(y=I.enabledReactions)||void 0===y?void 0:y.length)||0;if(t.isRestricted)return;const Ze=n===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(cn.Z,{currentAvatarBlobUrl:Q,onChange:oe,disabled:!l}),a.ZP.createElement(Me.Z,{id:"channel-title",label:ee("EnterChannelName"),onChange:ie,value:z,error:q===Qr?q:void 0,disabled:!l}),a.ZP.createElement(Me.Z,{id:"channel-about",className:"mb-2",label:ee("DescriptionPlaceholder"),onChange:le,value:Y,disabled:!l}),t.isCreator&&a.ZP.createElement(Re.Z,{icon:"lock",multiline:!0,onClick:ne},a.ZP.createElement("span",{className:"title"},ee("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},t.username?ee("TypePublic"):ee("TypePrivate"))),a.ZP.createElement(Re.Z,{icon:"message",multiline:!0,onClick:ae,disabled:!l},a.ZP.createElement("span",{className:"title"},ee("Discussion")),a.ZP.createElement("span",{className:"subtitle"},ee(x?"DiscussionUnlink":"Add"))),a.ZP.createElement(Re.Z,{icon:"admin",multiline:!0,onClick:re},a.ZP.createElement("span",{className:"title"},ee("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},te)),c&&a.ZP.createElement(Re.Z,{icon:"link",onClick:()=>{g(o.u1.Invites)},multiline:!0,disabled:!d},a.ZP.createElement("span",{className:"title"},ee("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},d?(0,it.kh)(d.length):ee("Loading"))),Boolean(null===(N=t.joinRequests)||void 0===N?void 0:N.length)&&a.ZP.createElement(Re.Z,{icon:"add-user-filled",onClick:()=>{g(o.u1.JoinRequests)},multiline:!0},a.ZP.createElement("span",{className:"title"},ee("SubscribeRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,it.kh)(t.joinRequests.length))),a.ZP.createElement(Re.Z,{icon:"reactions",multiline:!0,onClick:se,disabled:!l},a.ZP.createElement("span",{className:"title"},ee("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},he,"/",v)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(Cn.Z,{checked:i,label:ee("ChannelSignMessages"),onChange:de}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{icon:"group",multiline:!0,onClick:me},a.ZP.createElement("span",{className:"title",dir:"auto"},ee("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ee("Subscribers",null!==(k=t.membersCount)&&void 0!==k?k:0,"i")))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:U},t.isCreator?ee("ChannelDelete"):ee("LeaveChannel")))),a.ZP.createElement(dn.Z,{isShown:G,onClick:ce,disabled:Ze,ariaLabel:ee("Save")},Ze?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:D,onClose:O,text:t.isCreator?ee("ChannelDeleteAlert"):ee("ChannelLeaveAlert"),confirmLabel:t.isCreator?ee("ChannelDelete"):ee("LeaveChannel"),confirmHandler:ue,confirmIsDestructive:!0}))})));var to=n(88);const no=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t),{isUsernameAvailable:a}=(0,g.aW)(e,t);return{chat:n,isChannel:(0,P.eA)(n),progress:e.management.progress,isUsernameAvailable:a,isProtected:null==n?void 0:n.isProtected}}))((({chat:e,onClose:t,isActive:n,isChannel:r,progress:i,isUsernameAvailable:l,isProtected:c})=>{var d;const{checkPublicLink:h,updatePublicLink:Z,updatePrivateLink:v,toggleIsProtected:P}=(0,s.uC)(),g=Boolean(e.username),p=null===(d=e.fullInfo)||void 0===d?void 0:d.inviteLink,[E,C]=(0,a.eJ)(g?"public":"private"),[f,b]=(0,a.eJ)(),[I,y,N]=(0,xe.Z)(),k=Boolean("public"===E&&f&&l||"private"===E&&g);(0,m.ZP)(n,t),(0,a.d4)((()=>{E&&!p&&v()}),[E,p,v]);const S=(0,a.I4)((e=>{C(e)}),[]),w=(0,a.I4)((t=>{P({chatId:e.id,isProtected:"protected"===t})}),[e.id,P]),M=(0,a.I4)((()=>{Z({username:"public"===E?f:""})}),[E,Z,f]),T=(0,a.I4)((()=>{N(),v()}),[N,v]),R=(0,u.Z)(),L=r?"Channel":"Mega",A=r?"Channel":"Group",F=[{value:"private",label:R(`${L}Private`),subLabel:R(`${L}PrivateInfo`)},{value:"public",label:R(`${L}Public`),subLabel:R(`${L}PublicInfo`)}],B=[{value:"allowed",label:R("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:R("ChannelVisibility.Forwarding.Disabled")}],$=i===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:R.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},R(`${A}Type`)),a.ZP.createElement(at.Z,{selected:E,name:"channel-type",options:F,onChange:S})),"private"===E?a.ZP.createElement("div",{className:"section",dir:R.isRtl?"rtl":void 0},p?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(to.Z,{url:p,className:"group-link",text:p}),a.ZP.createElement("p",{className:"section-info",dir:R.isRtl?"rtl":void 0},R(`${L}PrivateLinkHelp`)),a.ZP.createElement(Re.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:y},R("RevokeLink")),a.ZP.createElement(Xe.Z,{isOpen:I,onClose:N,text:R("RevokeAlert"),confirmLabel:R("RevokeButton"),confirmHandler:T,confirmIsDestructive:!0})):a.ZP.createElement(Se.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(vn,{asLink:!0,currentUsername:e.username,isLoading:$,isUsernameAvailable:l,checkUsername:h,onChange:b}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},R(`${A}.Username.CreatePublicLinkHelp`))),a.ZP.createElement("div",{className:"section",dir:R.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},R(r?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")),a.ZP.createElement(at.Z,{selected:c?"protected":"allowed",name:"channel-type",options:B,onChange:w}),a.ZP.createElement("p",{className:"section-info"},R(r?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")))),a.ZP.createElement(dn.Z,{isShown:k,disabled:$,ariaLabel:R("Save"),onClick:M},$?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),ao=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t),{forDiscussionIds:s,byId:r}=e.chats;return{chat:a,chatsByIds:r,forDiscussionIds:s,linkedChat:null!=a&&null!==(n=a.fullInfo)&&void 0!==n&&n.linkedChatId?(0,g.Z1)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&(0,P.eA)(a)}}))((({chat:e,onClose:t,isActive:n,chatId:r,chatsByIds:l,linkedChat:c,forDiscussionIds:d,isChannel:h,onScreenSelect:Z})=>{const{loadGroupsForDiscussion:v,linkDiscussionGroup:P,unlinkDiscussionGroup:g}=(0,s.uC)(),[p,E]=(0,a.eJ)(),[C,f]=(0,a.eJ)(),[b,I]=(0,a.eJ)(!1),y=(0,a.I4)((()=>I(!0)),[]),[N,k,S]=(0,xe.Z)(),[w,M,T]=(0,xe.Z)(),R=(0,u.Z)(),L=null==c?void 0:c.id;(0,m.ZP)(n,t),(0,a.d4)((()=>{v()}),[v]),(0,a.d4)((()=>{C||(0,dt.Z)("DiscussionGroups").then(f)}),[C]);const A=(0,a.I4)((()=>{S(),g({channelId:h?r:L}),h||Z(o.u1.Initial)}),[S,g,h,r,L,Z]),F=(0,a.I4)((()=>{T(),P({channelId:r,chatId:p})}),[T,P,r,p]);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:"section-icon"},C&&a.ZP.createElement(mt.Z,{id:"discussionGroupsDucks",size:i.bM,animationData:C,play:b,noLoop:!0,onLoad:y})),c&&a.ZP.createElement("div",null,a.ZP.createElement(Re.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(Le.Z,{chatId:c.id})),a.ZP.createElement(Re.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:k},R(h?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(Xe.Z,{isOpen:N,onClose:S,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(ge.Z,{size:"tiny",chat:c}),a.ZP.createElement("div",{className:"modal-title"},R(h?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,Pe.Z)(R(h?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",c.title),["br","simple_markdown"]),confirmLabel:R(h?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:A,confirmIsDestructive:!0})),!c&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},R("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Re.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},R("DiscussionCreateGroup")),d?d.map(((e,t)=>a.ZP.createElement(Re.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{E(e),M()}},a.ZP.createElement(Le.Z,{chatId:e})))):a.ZP.createElement(St.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},R("DiscussionChannelHelp2")),a.ZP.createElement(Xe.Z,{isOpen:w,onClose:T,header:function(){const e=l[p];if(e)return a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(ge.Z,{size:"tiny",chat:e}),a.ZP.createElement("div",{className:"modal-title"},R("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const t=l[p];if(t)return t.hasPrivateLink?(0,Pe.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):(0,Pe.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"])}(),confirmLabel:R("DiscussionLinkGroup"),confirmHandler:F,isButtonsInOneRow:!0})))))}))),so=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,g.Z1)(e,t);return{chat:a,isFormFullyDisabled:!(a.isCreator||n)}}))((({chat:e,selectedChatMemberId:t,onScreenSelect:n,isFormFullyDisabled:r,onClose:i,isActive:l})=>{const{updateChatMemberBannedRights:c}=(0,s.uC)(),[d,h]=(0,a.eJ)({}),[Z,v]=(0,a.eJ)(!1),[P,g]=(0,a.eJ)(!1),[p,E,C]=(0,xe.Z)(),f=(0,u.Z)();(0,m.ZP)(l,i);const b=(0,a.Ye)((()=>{if(e&&e.fullInfo&&e.fullInfo.members)return e.fullInfo.members.find((({userId:e})=>e===t))}),[e,t]);(0,a.d4)((()=>{null!=e&&e.fullInfo&&t&&!b&&n(o.u1.GroupPermissions)}),[e,n,b,t]),(0,a.d4)((()=>{h((null==b?void 0:b.bannedRights)||(null==e?void 0:e.defaultBannedRights)||{}),v(!1),g(!1)}),[e,b]);const I=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}h((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),v(!0)}),[]),y=(0,a.I4)((()=>{e&&t&&(g(!0),c({chatId:e.id,userId:t,bannedRights:d}))}),[e,t,d,c]),N=(0,a.I4)((()=>{e&&t&&c({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})}),[e,t,c]),k=(0,a.I4)((t=>!!r||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t]),[e,r]);if(b)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ae.Z,{userId:b.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},f("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendMessages",checked:!d.sendMessages,label:f("UserRestrictionsSend"),blocking:!0,disabled:k("sendMessages"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendMedia",checked:!d.sendMedia,label:f("UserRestrictionsSendMedia"),blocking:!0,disabled:k("sendMedia"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendStickers",checked:!d.sendStickers&&!d.sendGifs,label:f("UserRestrictionsSendStickers"),blocking:!0,disabled:k("sendStickers"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendPolls",checked:!d.sendPolls,label:f("UserRestrictionsSendPolls"),blocking:!0,disabled:k("sendPolls"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"embedLinks",checked:!d.embedLinks,label:f("UserRestrictionsEmbedLinks"),blocking:!0,disabled:k("embedLinks"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"inviteUsers",checked:!d.inviteUsers,label:f("UserRestrictionsInviteUsers"),blocking:!0,disabled:k("inviteUsers"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"pinMessages",checked:!d.pinMessages,label:f("UserRestrictionsPinMessages"),blocking:!0,disabled:k("pinMessages"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!d.changeInfo,label:f("UserRestrictionsChangeInfo"),blocking:!0,disabled:k("changeInfo"),onChange:I}))),!r&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:E},f("UserRestrictionsBlock")))),a.ZP.createElement(dn.Z,{isShown:Z,onClick:y,ariaLabel:f("Save"),disabled:P},P?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:p,onClose:C,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:N,confirmIsDestructive:!0}))}))),ro=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t);return{chat:n,currentUserId:e.currentUserId,isChannel:(0,P.eA)(n)}}))((({chat:e,isChannel:t,currentUserId:n,onScreenSelect:r,onChatMemberSelect:i,onClose:l,isActive:c})=>{const d=(0,u.Z)();(0,m.ZP)(c,l);const h=(0,a.Ye)((()=>e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[e]),Z=(0,a.I4)((e=>{i(e.userId,e.promotedByUserId===n),r(o.u1.ChatAdminRights)}),[n,i,r]),v=(0,a.I4)((()=>{r(o.u1.GroupAddAdmins)}),[r]),g=(0,a.I4)((e=>{if(e.isOwner)return d("ChannelCreator");const t=(0,s.Rd)().users.byId,n=e.promotedByUserId?t[e.promotedByUserId]:void 0;return n?d("EditAdminPromotedBy",(0,P.Js)(n)):d("ChannelAdmin")}),[d]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{icon:"recent",multiline:!0,onClick:function(){r(o.u1.GroupRecentActions)}},a.ZP.createElement("span",{className:"title"},d("EventLog")),a.ZP.createElement("span",{className:"subtitle"},d(t?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:d.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},t?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),h.map((e=>a.ZP.createElement(Re.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>Z(e)},a.ZP.createElement(Ae.Z,{userId:e.userId,status:g(e),forceShowSelf:!0})))),a.ZP.createElement(dn.Z,{isShown:!0,onClick:v,ariaLabel:d("Channel.Management.AddModerator")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))))}))),oo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>({chat:(0,g.Z1)(e,t)})))((({chat:e,onClose:t,isActive:n})=>{const s=(0,u.Z)();(0,m.ZP)(n,t);const r=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[e]),o=(0,a.I4)((e=>e.isOwner?s("ChannelCreator"):s("ChannelAdmin")),[s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section not-implemented",dir:s.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(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterLeavingMembers"),onChange:void 0}))),a.ZP.createElement("div",{className:"section not-implemented",dir:s.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},s("Channel.Management.Title")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllAdmins"),onChange:void 0})),r.map((e=>a.ZP.createElement(Re.Z,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},a.ZP.createElement(Cn.Z,{label:"",checked:!0}),a.ZP.createElement(Ae.Z,{userId:e.userId,status:o(e),forceShowSelf:!0})))))))}))),io=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,g.Z1)(e,t),{byId:s}=e.users,{currentUserId:r}=e;return{chat:a,usersById:s,currentUserId:r,isChannel:(0,P.eA)(a),isFormFullyDisabled:!(a.isCreator||n),defaultRights:a.adminRights}}))((({isNewAdmin:e,selectedUserId:t,defaultRights:n,onScreenSelect:r,chat:i,usersById:l,currentUserId:c,isChannel:d,isFormFullyDisabled:h,onClose:Z,isActive:v})=>{var g;const{updateChatAdmin:p}=(0,s.uC)(),[E,C]=(0,a.eJ)({}),[f,b]=(0,a.eJ)(e),[I,y]=(0,a.eJ)(!1),[N,k,S]=(0,xe.Z)(),[w,M]=(0,a.eJ)(""),T=(0,u.Z)();(0,m.ZP)(v,Z);const R=(0,a.Ye)((()=>{var a,r;const o=null===(a=i.fullInfo)||void 0===a||null===(r=a.adminMembers)||void 0===r?void 0:r.find((({userId:e})=>e===t));if(!e||!o&&t){if(e){const e=(0,s.Rd)().users.byId[t];return e?{userId:e.id,adminRights:n,customTitle:T("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return o}}),[null===(g=i.fullInfo)||void 0===g?void 0:g.adminMembers,n,e,T,t]);(0,a.d4)((()=>{null!=i&&i.fullInfo&&t&&!R&&r(o.u1.ChatAdministrators)}),[i,r,R,t]),(0,a.d4)((()=>{C((null==R?void 0:R.adminRights)||{}),M(((null==R?void 0:R.customTitle)||"").substr(0,16)),b(Boolean(e)),y(!1)}),[n,e,R]);const L=(0,a.I4)((e=>{const{name:t}=e.target;C((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),b(!0)}),[]),A=(0,a.I4)((()=>{t&&(y(!0),p({chatId:i.id,userId:t,adminRights:E,customTitle:w}))}),[t,p,i.id,E,w]),F=(0,a.I4)((()=>{t&&(p({chatId:i.id,userId:t,adminRights:{}}),S())}),[i.id,S,t,p]),B=(0,a.I4)((e=>!((0,P.G9)(i)||!h&&i.adminRights&&i.adminRights[e])),[i,h]),$=(0,a.Ye)((()=>{if(e||!R)return;if(R.isOwner)return T("ChannelCreator");const t=R.promotedByUserId?l[R.promotedByUserId]:void 0;return t?T("EditAdminPromotedBy",(0,P.Js)(t)):T("ChannelAdmin")}),[e,R,l,T]),x=(0,a.I4)((e=>{const{value:t}=e.target;M(t),b(!0)}),[]);if(R)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Re.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ae.Z,{userId:R.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(Cn.Z,{name:"changeInfo",checked:!!E.changeInfo,label:T(d?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:B("changeInfo"),onChange:L})),d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"postMessages",checked:!!E.postMessages,label:T("EditAdminPostMessages"),blocking:!0,disabled:B("postMessages"),onChange:L})),d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"editMessages",checked:!!E.editMessages,label:T("EditAdminEditMessages"),blocking:!0,disabled:B("editMessages"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"deleteMessages",checked:!!E.deleteMessages,label:T(d?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:B("deleteMessages"),onChange:L})),!d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"banUsers",checked:!!E.banUsers,label:T("EditAdminBanUsers"),blocking:!0,disabled:B("banUsers"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"inviteUsers",checked:!!E.inviteUsers,label:T("EditAdminAddUsers"),blocking:!0,disabled:B("inviteUsers"),onChange:L})),!d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"pinMessages",checked:!!E.pinMessages,label:T("EditAdminPinMessages"),blocking:!0,disabled:B("pinMessages"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"addAdmins",checked:!!E.addAdmins,label:T("EditAdminAddAdmins"),blocking:!0,disabled:B("addAdmins"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"manageCall",checked:!!E.manageCall,label:T("StartVoipChatPermission"),blocking:!0,disabled:B("manageCall"),onChange:L})),!d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"anonymous",checked:!!E.anonymous,label:T("EditAdminSendAnonymously"),blocking:!0,disabled:B("anonymous"),onChange:L})),h&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},T("Channel.EditAdmin.CannotEdit")),!d&&a.ZP.createElement(Me.Z,{id:"admin-title",label:T("EditAdminRank"),onChange:x,value:w,disabled:h,maxLength:16}),c!==t&&!h&&!e&&a.ZP.createElement(Re.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:k},T("EditAdminRemoveAdmin")))),a.ZP.createElement(dn.Z,{isShown:f,onClick:A,ariaLabel:T("Save"),disabled:I},I?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),!e&&a.ZP.createElement(Xe.Z,{isOpen:N,onClose:S,text:"Are you sure you want to dismiss this admin?",confirmLabel:T("Channel.Admin.Dismiss"),confirmHandler:F,confirmIsDestructive:!0}))}))),lo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n,a;const s=(0,g.Z1)(e,t),{statusesById:r}=e.users,o=null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.members,i=null==s||null===(a=s.fullInfo)||void 0===a?void 0:a.adminMembers,l=s&&(0,P.eA)(s),{userIds:c}=e.contactList||{},{query:d,fetchingStatus:m,globalUserIds:u,localUserIds:h}=e.userSearch;return{members:o,adminMembers:i,userStatusesById:r,isChannel:l,localContactIds:c,searchQuery:d,isSearching:m,globalUserIds:u,localUserIds:h,serverTimeOffset:e.serverTimeOffset}}))((({noAdmins:e,members:t,adminMembers:n,userStatusesById:r,isChannel:i,isActive:l,globalUserIds:c,localContactIds:d,localUserIds:h,isSearching:Z,searchQuery:v,serverTimeOffset:g,onClose:p,onScreenSelect:E,onChatMemberSelect:C})=>{const{openUserInfo:f,setUserSearchQuery:b,loadContactList:I}=(0,s.uC)(),y=(0,u.Z)(),N=(0,a.sO)(null),k=(0,a.sO)(null),S=(0,a.Ye)((()=>e&&(null==n?void 0:n.map((({userId:e})=>e)))||[]),[n,e]),w=(0,a.Ye)((()=>{const n=(0,s.Rd)().users.byId;if(!t||!n)return[];const a=(0,P.Z0)(t.map((({userId:e})=>e)),n,r,void 0,g);return e?a.filter((e=>!S.includes(e))):a}),[t,r,g,e,S]),M=(0,a.Ye)((()=>{const t=(0,s.Rd)().users.byId,n=(0,s.Rd)().chats.byId,a=!!v,r=a?d?(0,P.kK)(d,t,v):[]:w;return(0,P.ih)((0,me.Tw)([...r,...a&&h||[],...a&&c||[]]).filter((n=>{const a=t[n];return!a||!a.isSelf&&(i||a.canBeInvitedToGroup||!(0,P.cS)(a))&&(!e||!S.includes(n))})),n,!0)}),[w,d,v,h,c,i,e,S]),[T,R]=(0,ye.Z)(I,M,Boolean(v)),L=(0,a.I4)((t=>{e?(C(t,!1),E(o.u1.ChatNewAdminRights)):f({id:t})}),[e,C,E,f]),A=(0,a.I4)((e=>{b({query:e.target.value})}),[b]),F=(0,Ne.Z)(k,l,(e=>{T&&T.length>0&&L(T[-1===e?0:e])}),".ListItem-button",!0);return(0,m.ZP)(l,p),a.ZP.createElement("div",{className:"Management"},e&&a.ZP.createElement("div",{className:"Management__filter",dir:y.isRtl?"rtl":void 0},a.ZP.createElement(Me.Z,{ref:N,value:v,onChange:A,placeholder:y("Search")})),a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},null!=T&&T.length?a.ZP.createElement(Te.Z,{className:"picker-list custom-scroll",items:M,onLoadMore:R,noScrollRestore:Boolean(v),ref:k,onKeyDown:F},T.map((e=>a.ZP.createElement(Re.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>L(e)},a.ZP.createElement(Ae.Z,{userId:e,forceShowSelf:!0}))))):Z||!T||T.length?a.ZP.createElement(Se.Z,null):a.ZP.createElement(St.Z,{teactOrderKey:0,key:"nothing-found",text:i?"No subscribers found":"No members found"}))))}))),co=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t),{byId:s,statusesById:r}=e.users;return{members:null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,usersById:s,userStatusesById:r,isChannel:a&&(0,P.eA)(a),serverTimeOffset:e.serverTimeOffset}}))((({usersById:e,userStatusesById:t,members:n,isChannel:s,onScreenSelect:r,onChatMemberSelect:i,onClose:l,isActive:c,serverTimeOffset:d})=>{(0,m.ZP)(c,l);const u=(0,a.Ye)((()=>{if(n&&e)return(0,P.Z0)(n.filter((e=>!e.isOwner)).map((({userId:e})=>e)),e,t,void 0,d)}),[n,d,e,t]),h=(0,a.I4)((e=>{i(e),r(o.u1.GroupUserPermissions)}),[i,r]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},u?u.map(((e,t)=>a.ZP.createElement(Re.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>h(e)},a.ZP.createElement(Ae.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(St.Z,{teactOrderKey:0,key:"nothing-found",text:s?"No subscribers found":"No members found"}))))})));var mo=n(2357),uo=n(2267);function ho(e,t){const{isPermanent:n,usage:a=0,date:s}=e,{isPermanent:r,usage:o=0,date:i}=t;return n||r?Number(n)-Number(r):a||o?o-a:i-s}const Zo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{invites:n,revokedInvites:a}=e.management.byChatId[t];return{exportedInvites:n,revokedExportedInvites:a,chat:(0,g.Z1)(e,t),serverTimeOffset:e.serverTimeOffset}}))((({chatId:e,chat:t,exportedInvites:n,revokedExportedInvites:r,isActive:i,serverTimeOffset:l,onClose:d,onScreenSelect:h})=>{const{setEditingExportedInvite:Z,showNotification:v,editExportedChatInvite:P,deleteExportedChatInvite:g,deleteRevokedExportedChatInvites:p,setOpenedInviteInfo:E}=(0,s.uC)(),[C,b,I]=(0,xe.Z)(),[y,N,k]=(0,xe.Z)(),[S,w]=(0,a.eJ)(),[M,T,L]=(0,xe.Z)(),[A,$]=(0,a.eJ)();(0,m.ZP)(i,d);const x=(0,u.Z)(),D=(0,a.Ye)((()=>{if(n)return n.some((({expireDate:e})=>e&&e-(0,uo.b)(l)<q.xR/1e3))}),[n,l]),U=(0,c.Z)();(0,mo.Z)((()=>{U()}),D?1e3:void 0);const O=null==n?void 0:n.find((({isPermanent:e})=>e)),G=null!=t&&t.username?`t.me/${t.username}`:null==O?void 0:O.link,J=(0,a.Ye)((()=>{const e=null!=t&&t.username?n:null==n?void 0:n.filter((({isPermanent:e})=>!e));return null==e?void 0:e.sort(ho)}),[null==t?void 0:t.username,n]),X=(0,a.I4)((t=>{const{link:n,title:a,isRequestNeeded:s,expireDate:r,usageLimit:o}=t;P({chatId:e,link:n,title:a,isRequestNeeded:s,expireDate:r,usageLimit:o,isRevoked:!0})}),[e,P]),z=(0,a.I4)((e=>{w(e),N()}),[N]),_=(0,a.I4)((()=>{S&&(X(S),w(void 0),k())}),[k,X,S]),Y=(0,a.I4)((()=>{h(o.u1.EditInvite)}),[h]),H=(0,a.I4)((()=>{O&&z(O)}),[z,O]),V=(0,a.I4)((()=>{p({chatId:e}),I()}),[e,I,p]),j=(0,a.I4)((t=>{E({chatId:e,invite:t}),h(o.u1.InviteInfo)}),[e,h,E]),K=(0,a.I4)((t=>{g({chatId:e,link:t.link})}),[e,g]),W=(0,a.I4)((e=>{$(e),T()}),[T]),Q=(0,a.I4)((()=>{A&&(K(A),$(void 0),L())}),[L,K,A]),ee=(0,a.I4)((e=>{(0,ss.TE)(e),v({message:x("LinkCopied")})}),[x,v]),te=(0,a.I4)((()=>{ee(G)}),[ee,G]),ne=e=>{const{usage:t=0,usageLimit:n,expireDate:a,isPermanent:s,requested:r,isRevoked:o}=e;let i="";if(i=!o&&n&&t<n?x("CanJoin",n-t):t?x("PeopleJoined",t):x("NoOneJoined"),o)return i+=`${x("Revoked")}`,i;if(r&&(i+=`${x("JoinRequests",r)}`),void 0!==n&&t===n)i+=`${x("LinkLimitReached")}`;else if(a){const e=1e3*(a-(0,uo.b)(l));i+=" • ",i+=e>0?x("InviteLink.ExpiresIn",(0,q.D)(x,e)):x("InviteLink.Expired")}else s&&(i+=`${x("Permanent")}`);return i},ae=t=>{const n=[];return n.push({title:x("Copy"),icon:"copy",handler:()=>ee(t.link)}),t.isPermanent||t.isRevoked||n.push({title:x("Edit"),icon:"edit",handler:()=>(t=>{Z({chatId:e,invite:t}),h(o.u1.EditInvite)})(t)}),t.isRevoked?n.push({title:x("DeleteLink"),icon:"delete",handler:()=>W(t),destructive:!0}):n.push({title:x("RevokeButton"),icon:"delete",handler:()=>z(t),destructive:!0}),n},se=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(R.Z,{round:!0,ripple:!f.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"Actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]);return a.ZP.createElement("div",{className:"Management ManageInvites"},a.ZP.createElement("div",{className:"custom-scroll"},G&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",{className:"text-muted"},null!=t&&t.username?x("PublicLink"):x("lng_create_permanent_link_title")),a.ZP.createElement("div",{className:"primary-link"},a.ZP.createElement("input",{className:"form-control primary-link-input",value:G,readOnly:!0,onClick:te}),a.ZP.createElement(F.Z,{className:"primary-link-more-menu",trigger:se,positionX:"right"},a.ZP.createElement(B.Z,{icon:"copy",onClick:te},x("Copy")),!(null!=t&&t.username)&&a.ZP.createElement(B.Z,{icon:"delete",onClick:H,destructive:!0},x("RevokeButton")))),a.ZP.createElement(R.Z,{onClick:te},x("CopyLink"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement(R.Z,{isText:!0,key:"create",className:"create-link",onClick:Y},x("CreateNewLink")),(!J||!J.length)&&a.ZP.createElement(St.Z,{text:"No links found",key:"nothing"}),null==J?void 0:J.map((e=>a.ZP.createElement(Re.Z,{icon:"link",secondaryIcon:"more",multiline:!0,onClick:()=>j(e),contextActions:ae(e),key:e.link},a.ZP.createElement("span",{className:"title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ne(e))))),a.ZP.createElement("p",{className:"text-muted hint",key:"links-hint"},x("ManageLinksInfoHelp"))),r&&Boolean(r.length)&&a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{className:"text-muted",key:"title"},x("RevokedLinks")),a.ZP.createElement(Re.Z,{icon:"delete",destructive:!0,key:"delete",onClick:b},a.ZP.createElement("span",{className:"title"},x("DeleteAllRevokedLinks"))),null==r?void 0:r.map((e=>a.ZP.createElement(Re.Z,{icon:"link",secondaryIcon:"more",multiline:!0,onClick:()=>j(e),contextActions:ae(e),key:e.link},a.ZP.createElement("span",{className:"title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ne(e))))))),a.ZP.createElement(Xe.Z,{isOpen:C,onClose:I,title:x("DeleteAllRevokedLinks"),text:x("DeleteAllRevokedLinkHelp"),confirmHandler:V}),a.ZP.createElement(Xe.Z,{isOpen:y,onClose:k,title:x("RevokeLink"),text:x("RevokeAlert"),confirmHandler:_}),a.ZP.createElement(Xe.Z,{isOpen:M,onClose:L,title:x("DeleteLink"),text:x("DeleteLinkHelp"),confirmHandler:Q}))}))),vo=[1,10,100],Po={hour:36e5,day:864e5,week:6048e5},go=Po.hour,po=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{editingInvite:n}=e.management.byChatId[t];return{editingInvite:n,serverTimeOffset:e.serverTimeOffset}}))((({chatId:e,editingInvite:t,isActive:n,serverTimeOffset:r,onClose:i,onScreenSelect:l})=>{const{editExportedChatInvite:c,exportChatInvite:d}=(0,s.uC)(),h=(0,u.Z)(),[Z,v,P]=(0,xe.Z)(),[g,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(""),[f,b]=(0,a.eJ)(Date.now()+go),[I,y]=(0,a.eJ)("unlimited"),[N,k]=(0,a.eJ)(10),[S,w]=(0,a.eJ)("0");(0,m.ZP)(n,i),(0,Ur.Z)((([e])=>{if(e!==t)if(t){const{title:e,usageLimit:n,expireDate:a,isRequestNeeded:s}=t;e&&C(e),n&&(w(vo.includes(n)?n.toString():"custom"),k(n)),a&&(y("custom"),b(1e3*a)),s&&p(!0)}else C(""),y("unlimited"),w("0"),b(1e3*(0,uo.b)(r)+go),k(10),p(!1)}),[t,r]);const M=(0,a.I4)((e=>{p(e.target.checked)}),[]),T=(0,a.I4)((e=>{C(e.target.value)}),[]),L=(0,a.I4)((e=>{k(Number.parseInt(e.target.value,10))}),[]),A=(0,a.I4)((e=>{b(e.getTime()),P()}),[P]),F=(0,a.I4)((()=>{const n="custom"===S?N:S;let a;switch(I){case"custom":a=(0,uo.b)(r)+(f-Date.now())/1e3;break;case"hour":case"day":case"week":a=(0,uo.b)(r)+Po[I]/1e3;break;case"unlimited":default:a=void 0}t?c({link:t.link,chatId:e,title:E,isRequestNeeded:g,expireDate:a,usageLimit:n}):d({chatId:e,title:E,isRequestNeeded:g,expireDate:a,usageLimit:n}),l(o.u1.Invites)}),[e,f,N,c,t,d,g,I,S,E,l,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(Cn.Z,{label:h("ApproveNewMembers"),subLabel:h("ApproveNewMembersDescription"),checked:g,onChange:M})),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Me.Z,{className:"link-name",placeholder:h("LinkNameHint"),value:E,onChange:T}),a.ZP.createElement("p",{className:"text-muted hint"},h("LinkNameHelp"))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},h("LimitByPeriod")),a.ZP.createElement(at.Z,{name:"expireOptions",options:[{value:"hour",label:h("Hours",1)},{value:"day",label:h("Days",1)},{value:"week",label:h("Weeks",1)},{value:"unlimited",label:h("NoLimit")},{value:"custom",label:h("lng_group_invite_expire_custom")}],onChange:y,selected:I}),"custom"===I&&a.ZP.createElement(R.Z,{className:"expire-limit",isText:!0,onClick:v},(0,q.Tu)(h,f)," ",(0,q.mr)(h,f)),a.ZP.createElement("p",{className:"text-muted hint"},h("TimeLimitHelp"))),!g&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},h("LimitNumberOfUses")),a.ZP.createElement(at.Z,{name:"usageOptions",options:[...vo.map((e=>({value:e.toString(),label:e}))),{value:"0",label:h("NoLimit")},{value:"custom",label:h("lng_group_invite_usage_custom")}],onChange:w,selected:S}),"custom"===S&&a.ZP.createElement("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:N,onChange:L}),a.ZP.createElement("p",{className:"text-muted hint"},h("UsesLimitHelp"))),a.ZP.createElement(dn.Z,{isShown:!0,onClick:F,ariaLabel:h(t?"SaveLink":"CreateLink")},a.ZP.createElement("i",{className:"icon-check"}))),a.ZP.createElement(qe,{isOpen:Z,isFutureMode:!0,withTimePicker:!0,onClose:P,onSubmit:A,selectedAt:f,submitButtonLabel:h("Save")}))}))),Eo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t);return{enabledReactions:null===(n=a.fullInfo)||void 0===n?void 0:n.enabledReactions,availableReactions:e.availableReactions,chat:a}}))((({availableReactions:e,enabledReactions:t,chat:n,isActive:r,onClose:o})=>{const{setChatEnabledReactions:i}=(0,s.uC)(),l=(0,u.Z)(),[c,d]=(0,a.eJ)(!1),[h,Z]=(0,a.eJ)(!1),[v,P]=(0,a.eJ)(t);(0,m.ZP)(r,o);const g=(0,a.I4)((()=>{n&&(Z(!0),i({chatId:n.id,enabledReactions:v}))}),[n,v,i]);(0,a.d4)((()=>{Z(!1),d(!1),P(t||[])}),[t]);const p=(0,a.I4)((t=>{if(!n||!e)return;const{name:a,checked:s}=t.currentTarget,r="all"===a?s?e.map((e=>e.reaction)):[]:s?[...v,a]:v.filter((e=>e!==a));P(r),d(!0)}),[e,n,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(Cn.Z,{name:"all",checked:!v||v.length>0,label:l("EnableReactions"),onChange:p})),null==e?void 0:e.filter((e=>!e.isInactive)).map((({reaction:e,title:t})=>a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:e,checked:!v||(null==v?void 0:v.includes(e)),disabled:0===(null==v?void 0:v.length),label:a.ZP.createElement("div",{className:"Reaction"},a.ZP.createElement(lt.Z,{reaction:e}),t),onChange:p})))))),a.ZP.createElement(dn.Z,{isShown:c,onClick:g,ariaLabel:l("Save"),disabled:h},h?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Co=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{inviteInfo:n}=e.management.byChatId[t];return{invite:null==n?void 0:n.invite,importers:null==n?void 0:n.importers,serverTimeOffset:e.serverTimeOffset}}))((({chatId:e,invite:t,importers:n,isActive:r,serverTimeOffset:o,onClose:i})=>{const{showNotification:l,loadChatInviteImporters:c,openUserInfo:d}=(0,s.uC)(),h=(0,u.Z)(),{usage:Z=0,usageLimit:v,link:P,adminId:g}=t||{},p=(null==t?void 0:t.expireDate)&&1e3*(t.expireDate-(0,uo.b)(o))+Date.now(),E=((null==t?void 0:t.expireDate)||0)-(0,uo.b)(o)<0;(0,a.d4)((()=>{P&&c({chatId:e,link:P})}),[e,P,c]);const C=(0,a.I4)((()=>{(0,ss.TE)(t.link),l({message:h("LinkCopied")})}),[t,h,l]);return(0,m.ZP)(r,i),a.ZP.createElement("div",{className:"Management ManageInviteInfo"},a.ZP.createElement("div",{className:"custom-scroll"},!t&&a.ZP.createElement("p",{className:"text-muted"},h("Loading")),t&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",null,t.title||t.link),a.ZP.createElement("input",{className:"form-control",value:t.link,readOnly:!0,onClick:C}),a.ZP.createElement(R.Z,{className:"copy-link",onClick:C},h("CopyLink")),p&&a.ZP.createElement("p",{className:"text-muted"},E?h("ExpiredLink"):h("LinkExpiresIn",`${(0,q.Tu)(h,p)} ${(0,q.mr)(h,p)}`))),g&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,h("LinkCreatedeBy")),a.ZP.createElement(Re.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>d({id:g})},a.ZP.createElement(Ae.Z,{userId:g,status:(0,q.ZK)(h,1e3*t.date,!0),forceShowSelf:!0}))),(()=>{if(null==t||!t.isRevoked)return n?a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,n.length?h("PeopleJoined",Z):h("NoOneJoined")),a.ZP.createElement("p",{className:"text-muted"},!n.length&&(v?h("PeopleCanJoinViaLinkCount",v-Z):h("NoOneJoinedYet")),n.map((e=>a.ZP.createElement(Re.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>d({id:e.userId})},a.ZP.createElement(Ae.Z,{userId:e.userId,status:(0,q.ZK)(h,1e3*e.date,!0),forceShowSelf:!0})))))):a.ZP.createElement("p",{className:"text-muted"},h("Loading"))})())))}))),fo=(0,a.X$)((0,s.c$)(((e,{userId:t})=>({user:(0,g.dy)(e,t),serverTimeOffset:e.serverTimeOffset})))((({userId:e,about:t,date:n,isChannel:r,user:o,serverTimeOffset:i,chatId:l})=>{const{openUserInfo:c,hideChatJoinRequest:d}=(0,s.uC)(),m=(0,X.y)("JoinRequest"),h=(0,u.Z)(),Z=(0,P.Js)(o),v=1e3*(n-(0,uo.b)(i))+Date.now(),g=(0,q.zk)(new Date(v))?(0,q.mr)(h,v):(0,q.j1)(h,v,!0,!1,!0),p=(0,a.I4)((()=>{d({chatId:l,userId:e,isApproved:!0})}),[l,d,e]),E=(0,a.I4)((()=>{d({chatId:l,userId:e,isApproved:!1})}),[l,d,e]);return a.ZP.createElement("div",{className:m("&")},a.ZP.createElement("div",{className:m("top")},a.ZP.createElement("div",{className:m("user"),onClick:()=>{c({userId:e})}},a.ZP.createElement(ge.Z,{key:e,size:"medium",user:o}),a.ZP.createElement("div",{className:m("user-info")},a.ZP.createElement("div",{className:m("user-name")},Z),a.ZP.createElement("div",{className:m("user-subtitle")},t))),a.ZP.createElement("div",{className:m("date")},g)),a.ZP.createElement("div",{className:m("buttons")},a.ZP.createElement(R.Z,{className:m("button"),onClick:p},h(r?"ChannelAddToChannel":"ChannelAddToGroup")),a.ZP.createElement(R.Z,{className:m("button"),isText:!0,onClick:E},h("DismissRequest"))))}))),bo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t);return{chat:n,serverTimeOffset:e.serverTimeOffset,isChannel:n&&(0,P.eA)(n)}}))((({chat:e,chatId:t,isActive:n,isChannel:r,onClose:o})=>{var i,l,c,d,h;const{hideAllChatJoinRequests:Z,loadChatJoinRequests:v}=(0,s.uC)(),[P,g,p]=(0,xe.Z)(),[E,C,f]=(0,xe.Z)(),b=(0,u.Z)();(0,m.ZP)(n,o),(0,a.d4)((()=>{null!=e&&e.joinRequests||v({chatId:t})}),[e,t,v]);const I=(0,a.I4)((()=>{Z({chatId:t,isApproved:!0}),p()}),[Z,t,p]),y=(0,a.I4)((()=>{Z({chatId:t,isApproved:!1}),f()}),[Z,t,f]);return a.ZP.createElement("div",{className:"Management ManageJoinRequests"},Boolean(null==e||null===(i=e.joinRequests)||void 0===i?void 0:i.length)&&a.ZP.createElement("div",{className:"section bulk-actions"},a.ZP.createElement(R.Z,{className:"bulk-action-button",onClick:g},"Accept all"),a.ZP.createElement(R.Z,{className:"bulk-action-button",onClick:C,isText:!0},"Dismiss all")),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"custom-scroll",teactFastList:!0},a.ZP.createElement("p",{key:"title"},null!=e&&null!==(l=e.joinRequests)&&void 0!==l&&l.length?b("JoinRequests",null==e||null===(c=e.joinRequests)||void 0===c?void 0:c.length):b("NoMemberRequests")),0===(null==e||null===(d=e.joinRequests)||void 0===d?void 0:d.length)&&a.ZP.createElement("p",{className:"text-muted",key:"empty"},b(r?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")),null==e||null===(h=e.joinRequests)||void 0===h?void 0:h.map((({userId:e,about:n,date:s})=>a.ZP.createElement(fo,{userId:e,about:n,date:s,isChannel:r,chatId:t,key:e}))))),a.ZP.createElement(Xe.Z,{isOpen:P,onClose:p,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:I}),a.ZP.createElement(Xe.Z,{isOpen:E,onClose:f,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:y}))}))),Io=(0,a.X$)((0,s.c$)((e=>({managementType:(0,g.pP)(e)})))((({chatId:e,currentScreen:t,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,onChatMemberSelect:i,onClose:l,isActive:c,managementType:d})=>{switch(t){case o.u1.Initial:switch(d){case"user":return a.ZP.createElement(Hr,{key:e,userId:e,onClose:l,isActive:c});case"group":return a.ZP.createElement(jr,{key:e,chatId:e,onScreenSelect:r,onClose:l,isActive:c||[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(t)});case"channel":return a.ZP.createElement(eo,{key:e,chatId:e,onScreenSelect:r,onClose:l,isActive:c||[o.u1.ChannelSubscribers,o.u1.ChatAdministrators,o.u1.Discussion,o.u1.ChatPrivacyType,o.u1.ChatAdminRights,o.u1.ChatNewAdminRights,o.u1.GroupRecentActions].includes(t)})}break;case o.u1.ChatPrivacyType:return a.ZP.createElement(no,{chatId:e,isActive:c,onClose:l});case o.u1.Discussion:return a.ZP.createElement(ao,{chatId:e,onScreenSelect:r,isActive:c,onClose:l});case o.u1.GroupPermissions:return a.ZP.createElement(qr,{chatId:e,onScreenSelect:r,onChatMemberSelect:i,isActive:c||[o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions].includes(t),onClose:l});case o.u1.GroupRemovedUsers:return a.ZP.createElement(Wr,{chatId:e,isActive:c,onClose:l});case o.u1.GroupUserPermissionsCreate:return a.ZP.createElement(co,{chatId:e,onChatMemberSelect:i,onScreenSelect:r,isActive:c||[o.u1.GroupUserPermissions].includes(t),onClose:l});case o.u1.GroupUserPermissions:return a.ZP.createElement(so,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChatAdministrators:return a.ZP.createElement(ro,{chatId:e,onScreenSelect:r,onChatMemberSelect:i,isActive:c||[o.u1.ChatAdminRights,o.u1.ChatNewAdminRights,o.u1.GroupRecentActions].includes(t),onClose:l});case o.u1.GroupRecentActions:return a.ZP.createElement(oo,{chatId:e,isActive:c,onClose:l});case o.u1.ChatNewAdminRights:case o.u1.ChatAdminRights:return a.ZP.createElement(io,{chatId:e,isNewAdmin:t===o.u1.ChatNewAdminRights,selectedUserId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChannelSubscribers:case o.u1.GroupMembers:return a.ZP.createElement(lo,{chatId:e,isActive:c,onClose:l});case o.u1.Invites:return a.ZP.createElement(Zo,{chatId:e,isActive:c,onClose:l,onScreenSelect:r});case o.u1.EditInvite:return a.ZP.createElement(po,{chatId:e,isActive:c,onClose:l,onScreenSelect:r});case o.u1.GroupAddAdmins:return a.ZP.createElement(lo,{chatId:e,noAdmins:!0,isActive:c,onClose:l,onScreenSelect:r,onChatMemberSelect:i});case o.u1.Reactions:return a.ZP.createElement(Eo,{chatId:e,isActive:c,onClose:l});case o.u1.InviteInfo:return a.ZP.createElement(Co,{chatId:e,isActive:c,onClose:l});case o.u1.JoinRequests:return a.ZP.createElement(bo,{chatId:e,isActive:c,onClose:l})}})));var yo=n(9937);const No=/^4[0-9]{12}(?:[0-9]{1,3})?$/,ko=/^5[1-5][0-9]{11,14}$/,So=/^2[2-7][0-9]{11,14}$/;let wo;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(wo||(wo={}));const Mo={[wo.Default]:"",[wo.Visa]:"visa",[wo.Mastercard]:"mastercard"};function To(e){return e=e.replace(/\s/g,""),No.test(e)?wo.Visa:ko.test(e)||So.test(e)?wo.Mastercard:wo.Default}const Ro={},Lo=/(\d{1,3})(\d{1,3})?(\d{1,3})?(\d{1,3})?(\d{1,3})?/,Ao="AF🇦🇫93Afghanistan333\nAO🇦🇴244Angola333\nAL🇦🇱355Albania234\nAD🇦🇩376Andorra222\nAE🇦🇪971United Arab Emirates234\nAI🇦🇮1264Anguilla34\nAR🇦🇷54Argentina\nAM🇦🇲374Armenia233\nAG🇦🇬1268Antigua and Barbuda34\nAU🇦🇺61Australia333\nAS🇦🇸1684American Samoa34\nAT🇦🇹43Austria\nAW🇦🇼297Aruba34\nAZ🇦🇿994Azerbaijan2322\nBI🇧🇮257Burundi224\nBE🇧🇪32Belgium3222\nBJ🇧🇯229Benin233\nBF🇧🇫226Burkina Faso2222\nBD🇧🇩880Bangladesh\nBG🇧🇬359Bulgaria\nBH🇧🇭973Bahrain44\nBS🇧🇸1242Bahamas34\nBA🇧🇦387Bosnia and Herzegovina\nBY🇧🇾375Belarus2322\nBZ🇧🇿501Belize\nBO🇧🇴591Bolivia134\nBR🇧🇷55Brazil254\nBB🇧🇧1246Barbados34\nBM🇧🇲1441Bermuda34\nBN🇧🇳673Brunei34\nBQ🇧🇶599Bonaire, Sint Eustatius and Saba\nBT🇧🇹975Bhutan\nBW🇧🇼267Botswana233\nCF🇨🇫236Central African Republic2222\nCA🇨🇦1Canada334\nCH🇨🇭41Switzerland234\nCK🇨🇰682Cook Islands\nCL🇨🇱56Chile144\nCN🇨🇳86China344\nCI🇨🇮225Côte d`Ivoire233\nCM🇨🇲237Cameroon44\nCD🇨🇩243DR Congo234\nCG🇨🇬242Republic of the Congo234\nCO🇨🇴57Colombia334\nKM🇰🇲269Comoros34\nCV🇨🇻238Cape Verde34\nCR🇨🇷506Costa Rica\nCU🇨🇺53Cuba44\nCY🇨🇾357Cyprus44\nCW🇨🇼599Curaçao\nCZ🇨🇿420Czech Republic\nDE🇩🇪49Germany38\nDJ🇩🇯253Djibouti2222\nDM🇩🇲1767Dominica34\nDK🇩🇰45Denmark44\nDO🇩🇴1Dominican Republic334\nDZ🇩🇿213Algeria3222\nEC🇪🇨593Ecuador\nEG🇪🇬20Egypt234\nER🇪🇷291Eritrea133\nES🇪🇸34Spain333\nEE🇪🇪372Estonia\nET🇪🇹251Ethiopia234\nFI🇫🇮358Finland\nFJ🇫🇯679Fiji\nFK🇫🇰500Falkland Islands\nFM🇫🇲691Micronesia\nFO🇫🇴298Faroe Islands33\nFR🇫🇷33France12222\nGA🇬🇦241Gabon1222\nGB🇬🇧44United Kingdom46\nGE🇬🇪995Georgia\nGF🇬🇫594French Guiana\nGH🇬🇭233Ghana\nGI🇬🇮350Gibraltar44\nGL🇬🇱299Greenland33\nGN🇬🇳224Guinea333\nGM🇬🇲220Gambia34\nGP🇬🇵590Guadeloupe\nGU🇬🇺1671Guam34\nGW🇬🇼245Guinea-Bissau34\nGQ🇬🇶240Equatorial Guinea333\nGR🇬🇷30Greece244\nGD🇬🇩1473Grenada34\nGT🇬🇹502Guatemala134\nGY🇬🇾592Guyana\nHK🇭🇰852Hong Kong\nHN🇭🇳504Honduras44\nHR🇭🇷385Croatia\nHT🇭🇹509Haiti\nHU🇭🇺36Hungary234\nID🇮🇩62Indonesia\nIN🇮🇳91India55\nIO🇩🇬246Diego Garcia34\nIE🇮🇪353Ireland234\nIR🇮🇷98Iran334\nIQ🇮🇶964Iraq334\nIS🇮🇸354Iceland34\nIL🇮🇱972Israel234\nIT🇮🇹39Italy334\nJM🇯🇲1876Jamaica34\nJO🇯🇴962Jordan144\nJP🇯🇵81Japan244\nKZ🇰🇿7Kazakhstan3322\nKE🇰🇪254Kenya333\nKG🇰🇬996Kyrgyzstan\nKH🇰🇭855Cambodia\nKI🇰🇮686Kiribati\nKN🇰🇳1869Saint Kitts and Nevis34\nKR🇰🇷82South Korea\nKW🇰🇼965Kuwait44\nKY🇰🇾1345Cayman Islands34\nLA🇱🇦856Laos\nLB🇱🇧961Lebanon\nLR🇱🇷231Liberia\nLY🇱🇾218Libya234\nLC🇱🇨1758Saint Lucia34\nLI🇱🇮423Liechtenstein\nLK🇱🇰94Sri Lanka234\nLS🇱🇸266Lesotho233\nLT🇱🇹370Lithuania35\nLU🇱🇺352Luxembourg\nLV🇱🇻371Latvia35\nMA🇲🇦212Morocco234\nMC🇲🇨377Monaco44\nMD🇲🇩373Moldova233\nMG🇲🇬261Madagascar2232\nMP🇲🇵1670Northern Mariana Islands34\nMO🇲🇴853Macau\nMS🇲🇸1664Montserrat34\nMV🇲🇻960Maldives\nMX🇲🇽52Mexico\nMH🇲🇭692Marshall Islands\nMK🇲🇰389Macedonia\nML🇲🇱223Mali44\nMT🇲🇹356Malta2222\nMM🇲🇲95Myanmar\nME🇲🇪382Montenegro\nMN🇲🇳976Mongolia\nMZ🇲🇿258Mozambique234\nMQ🇲🇶596Martinique\nMR🇲🇷222Mauritania44\nMU🇲🇺230Mauritius\nMW🇲🇼265Malawi\nMY🇲🇾60Malaysia\nNA🇳🇦264Namibia234\nNC🇳🇨687New Caledonia6\nNE🇳🇪227Niger2222\nNF🇳🇫672Norfolk Island\nNG🇳🇬234Nigeria\nNI🇳🇮505Nicaragua44\nNL🇳🇱31Netherlands12222\nNO🇳🇴47Norway44\nNP🇳🇵977Nepal\nNU🇳🇺683Niue\nNR🇳🇷674Nauru\nNZ🇳🇿64New Zealand\nOM🇴🇲968Oman44\nPK🇵🇰92Pakistan334\nPA🇵🇦507Panama44\nPE🇵🇪51Peru333\nPF🇵🇫689French Polynesia\nPH🇵🇭63Philippines334\nPM🇵🇲508Saint Pierre and Miquelon\nPR🇵🇷1Puerto Rico334\nPS🇵🇸970Palestine324\nPW🇵🇼680Palau\nPG🇵🇬675Papua New Guinea\nPL🇵🇱48Poland333\nKP🇰🇵850North Korea\nPT🇵🇹351Portugal144\nPY🇵🇾595Paraguay333\nQA🇶🇦974Qatar\nRE🇷🇪262Réunion333\nRO🇷🇴40Romania333\nRU🇷🇺7Russia3322\nRW🇷🇼250Rwanda333\nSA🇸🇦966Saudi Arabia\nSD🇸🇩249Sudan234\nSN🇸🇳221Senegal234\nSG🇸🇬65Singapore44\nSH🇸🇭290Saint Helena23\nSH🇸🇭247Saint Helena4\nSB🇸🇧677Solomon Islands\nSL🇸🇱232Sierra Leone233\nSV🇸🇻503El Salvador44\nSM🇸🇲378San Marino334\nSO🇸🇴252Somalia233\nRS🇷🇸381Serbia234\nSS🇸🇸211South Sudan234\nST🇸🇹239São Tomé and Príncipe25\nSR🇸🇷597Suriname34\nSK🇸🇰421Slovakia\nSI🇸🇮386Slovenia\nSE🇸🇪46Sweden234\nSZ🇸🇿268Swaziland44\nSC🇸🇨248Seychelles1222\nSX🇸🇽1721Sint Maarten34\nSY🇸🇾963Syria\nTC🇹🇨1649Turks and Caicos Islands34\nTD🇹🇩235Chad2222\nTG🇹🇬228Togo233\nTH🇹🇭66Thailand144\nTJ🇹🇯992Tajikistan\nTK🇹🇰690Tokelau\nTM🇹🇲993Turkmenistan26\nTL🇹🇱670Timor-Leste\nTO🇹🇴676Tonga\nTT🇹🇹1868Trinidad and Tobago34\nTN🇹🇳216Tunisia233\nTR🇹🇷90Turkey334\nTV🇹🇻688Tuvalu\nTW🇹🇼886Taiwan\nTZ🇹🇿255Tanzania234\nUG🇺🇬256Uganda234\nUA🇺🇦380Ukraine2322\nUY🇺🇾598Uruguay44\nUS🇺🇸1United States334\nUZ🇺🇿998Uzbekistan27\nVA🇻🇦3Vatican City\nVC🇻🇨1784Saint Vincent and the Grenadines34\nVE🇻🇪58Venezuela334\nVG🇻🇬1284British Virgin Islands34\nVI🇻🇮1340US Virgin Islands34\nVN🇻🇳84Vietnam\nVU🇻🇺678Vanuatu\nWF🇼🇫681Wallis and Futuna\nWS🇼🇸685Samoa\nXK🇽🇰383Kosovo44\nYE🇾🇪967Yemen333\nZA🇿🇦27South Africa234\nZM🇿🇲260Zambia234\nZW🇿🇼263Zimbabwe234".split("\n").map((e=>({id:e.substr(0,2),flag:e.substr(2,4),code:`+${e.match(/\d+/)[0]}`,name:e.split(/\d+/)[1],phoneFormat:function(e){if(!e)return Lo;const t=e[0];let n;if(!Ro[t]){const e=t.split("").map(Number);n=e.reduce(((e,t,n)=>`${e}(\\d{1,${t}})${n>0?"?":""}`),""),Ro[t]=new RegExp(`${n}${"()?".repeat(5-e.length)}`)}return Ro[t]}(e.match(/\d+$/))}))),Fo={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},Bo=(e,t)=>{switch(t.type){case"changeAddress1":return{...e,streetLine1:t.payload,formErrors:{...e.formErrors,streetLine1:void 0}};case"changeAddress2":return{...e,streetLine2:t.payload,formErrors:{...e.formErrors,streetLine2:void 0}};case"changeCity":return{...e,city:t.payload,formErrors:{...e.formErrors,city:void 0}};case"changeState":return{...e,state:t.payload,formErrors:{...e.formErrors,state:void 0}};case"changeCountry":return{...e,countryIso2:t.payload,billingCountry:$o(t.payload),formErrors:{...e.formErrors,countryIso2:void 0}};case"changePostCode":return{...e,postCode:t.payload,formErrors:{...e.formErrors,postCode:void 0}};case"changeFullName":return{...e,fullName:t.payload,formErrors:{...e.formErrors,fullName:void 0}};case"changeEmail":return{...e,email:t.payload,formErrors:{...e.formErrors,email:void 0}};case"changePhone":return{...e,phone:t.payload,formErrors:{...e.formErrors,phone:void 0}};case"changeShipping":return{...e,shipping:t.payload};case"changeCardNumber":return{...e,cardNumber:t.payload,formErrors:{...e.formErrors,cardNumber:void 0}};case"changeCardholder":return{...e,cardholder:t.payload,formErrors:{...e.formErrors,cardholder:void 0}};case"changeExpiryDate":return{...e,expiry:t.payload,formErrors:{...e.formErrors,expiry:void 0}};case"changeCvvCode":return{...e,cvv:t.payload,formErrors:{...e.formErrors,cvv:void 0}};case"changeBillingCountry":return{...e,billingCountry:t.payload,formErrors:{...e.formErrors,billingCountry:void 0}};case"changeBillingZip":return{...e,billingZip:t.payload,formErrors:{...e.formErrors,billingZip:void 0}};case"changeSaveInfo":return{...e,saveInfo:t.payload};case"changeSaveCredentials":return{...e,saveCredentials:t.payload};case"updateUserInfo":return t.payload.countryIso2?{...e,...t.payload,billingCountry:$o(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function $o(e){const t=Ao.find((({id:t})=>t===e));return t?t.name:""}function xo(e,t=400){(0,a.d4)((()=>{f.$b||setTimeout((()=>{(0,G.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const Do=(0,a.X$)((e=>{const{id:t,value:n,label:s,hasArrow:r,error:o,ref:i,placeholder:l,onChange:c,children:d}=e,m=o||s,u=(0,X.Z)("input-group",n&&"touched",o&&"error",m&&"with-label",r&&"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:l||s,ref:i},d),m&&t&&a.ZP.createElement("label",{htmlFor:t},m))})),Uo=(0,a.X$)((({state:e,needEmail:t,needPhone:n,needName:s,needAddress:r,dispatch:o})=>{const i=(0,a.sO)(null),l=(0,a.sO)(null),c=(0,a.sO)(null);(0,a.d4)((()=>{c.current&&c.current.value!==e.countryIso2&&(c.current.value=e.countryIso2)}),[e.countryIso2]);const d=(0,u.Z)();xo(i);const m=(0,a.I4)((e=>{o({type:"changeAddress1",payload:e.target.value})}),[o]),h=(0,a.I4)((e=>{o({type:"changeAddress2",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeCity",payload:e.target.value})}),[o]),v=(0,a.I4)((e=>{o({type:"changeState",payload:e.target.value})}),[o]),P=(0,a.I4)((e=>{o({type:"changeCountry",payload:e.target.value})}),[o]),g=(0,a.I4)((e=>{o({type:"changePostCode",payload:e.target.value})}),[o]),p=(0,a.I4)((e=>{o({type:"changeFullName",payload:e.target.value})}),[o]),E=(0,a.I4)((e=>{o({type:"changeEmail",payload:e.target.value})}),[o]),C=(0,a.I4)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,l.current&&(l.current.value=t),o({type:"changePhone",payload:t})}),[o]),f=(0,a.I4)((e=>{o({type:"changeSaveInfo",payload:e.target.value})}),[o]),{formErrors:b}=e;return a.ZP.createElement("div",{className:"ShippingInfo"},a.ZP.createElement("form",null,r?a.ZP.createElement("div",null,a.ZP.createElement("h5",null,d("PaymentShippingAddress")),a.ZP.createElement(Me.Z,{ref:i,label:"Address1 (Street)",onChange:m,value:e.streetLine1,inputMode:"text",error:b.streetLine1}),a.ZP.createElement(Me.Z,{label:"Address2 (Street)",onChange:h,value:e.streetLine2,inputMode:"text",error:b.streetLine2}),a.ZP.createElement(Me.Z,{label:"City",onChange:Z,value:e.city,inputMode:"text",error:b.city}),a.ZP.createElement(Me.Z,{label:"State",onChange:v,value:e.state,inputMode:"text",error:b.state}),a.ZP.createElement(Do,{label:"Country",placeholder:"Country",onChange:P,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:b.countryIso2,ref:c},Ao.map((({name:e,id:t})=>a.ZP.createElement("option",{value:t,className:"county-item"},e)))),a.ZP.createElement(Me.Z,{label:"Post Code",onChange:g,value:e.postCode,inputMode:"text",error:b.postCode})):void 0,s||t||n?a.ZP.createElement("h5",null,d("PaymentShippingReceiver")):void 0,s&&a.ZP.createElement(Me.Z,{label:"Full name",onChange:p,value:e.fullName,inputMode:"text",error:b.fullName}),t&&a.ZP.createElement(Me.Z,{label:"Email",onChange:E,value:e.email,inputMode:"email",error:b.email}),n&&a.ZP.createElement(Me.Z,{label:"Phone number",onChange:C,value:e.phone,inputMode:"tel",error:b.phone,ref:l}),a.ZP.createElement(Cn.Z,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:f})))})),Oo=(0,a.X$)((({state:e,shippingOptions:t,currency:n,dispatch:s})=>{const r=(0,u.Z)();(0,a.d4)((()=>{t&&!e.shipping&&s({type:"changeShipping",payload:t[0].id})}),[t,e.shipping,s]);const o=(0,a.I4)((e=>{s({type:"changeShipping",payload:e})}),[s]),i=(0,a.Ye)((()=>t.map((({id:e,title:t,amount:a})=>({label:t,subLabel:(0,yo.x)(a,n,r.code),value:e})))),[t,n,r.code]);return a.ZP.createElement("div",{className:"Shipping"},a.ZP.createElement("form",null,a.ZP.createElement("p",null,"Select shipping method"),a.ZP.createElement(at.Z,{name:"shipping-options",options:i,onChange:o,selected:e.shipping})))}));function Go(e,t,n,s,r=!1){return a.ZP.createElement("div",{className:"price-info-item "+(r?"price-info-item-main":"")},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("div",{className:"value"},(0,yo.x)(n,s,e)))}function Jo(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 Xo=(0,a.X$)((({invoiceContent:e,prices:t,shippingPrices:n,checkoutInfo:s,currency:r,totalPrice:o})=>{const i=(0,u.Z)(),{photoUrl:l,title:c,text:d}=e||{},{paymentMethod:m,paymentProvider:h,shippingAddress:Z,name:v,phone:P,shippingMethod:g}=s||{};return a.ZP.createElement("div",{className:"Checkout"},a.ZP.createElement("div",{className:"description has-image"},l&&a.ZP.createElement("img",{src:l,alt:""}),a.ZP.createElement("div",{className:"text"},a.ZP.createElement("h5",null,c),a.ZP.createElement("p",null,d))),a.ZP.createElement("div",{className:"price-info"},t&&t.map((e=>Go(i.code,e.label,e.amount,r))),n&&n.map((e=>Go(i.code,e.label,e.amount,r))),void 0!==o&&Go(i.code,i("Checkout.TotalAmount"),o,r,!0)),a.ZP.createElement("div",{className:"invoice-info"},m&&Jo("icon-card",m,"Payment method"),h&&Jo("stripe-provider",h,"Payment provider"),Z&&Jo("icon-location",Z,"Shipping address"),v&&Jo("icon-user",v,"Name"),P&&Jo("icon-phone",P,"Phone number"),g&&Jo("icon-truck",g,"Shipping method")))})),zo=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null),r=(0,a.I4)((t=>{if("Backspace"===t.key&&"/"===e.charAt(e.length-1)){const t=e.slice(0,e.length-1);s.current&&(s.current.value=t)}}),[e]),o=(0,a.I4)((e=>{n(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))}),[n]);return a.ZP.createElement(Me.Z,{label:"Expiry date",ref:s,onChange:o,onKeyDown:r,value:e,error:t,inputMode:"numeric",maxLength:5})}));var _o=n(6352),Yo=n(5753);const Ho=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null);xo(s);const[r,o]=(0,a.eJ)(wo.Default);(0,a.d4)((()=>{const t=To(e);o(t)}),[]);const i=(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),a=To(e.target.value);o(a),n(t),s.current&&(s.current.value=t)}),[n,s]),l=function(e){switch(e){case wo.Mastercard:return a.ZP.createElement("img",{src:_o,alt:""});case wo.Visa:return a.ZP.createElement("img",{src:Yo,alt:""});default:return}}(r);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement("span",{className:"left-addon"},l),a.ZP.createElement(Me.Z,{ref:s,label:"Card number",onChange:i,value:e,inputMode:"numeric",className:r?"has-left-addon":"",error:t,maxLength:23}))})),Vo=(0,a.X$)((({state:e,canSaveCredentials:t,needCardholderName:n,needCountry:s,needZip:r,dispatch:o})=>{const i=(0,a.sO)(null);(0,a.d4)((()=>{i.current&&i.current.value!==e.billingCountry&&(i.current.value=e.billingCountry)}),[e.billingCountry]);const l=(0,a.I4)((e=>{o({type:"changeCardNumber",payload:e})}),[o]),c=(0,a.I4)((e=>{o({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[o]),d=(0,a.I4)((e=>{o({type:"changeExpiryDate",payload:e})}),[o]),m=(0,a.I4)((e=>{o({type:"changeCvvCode",payload:e.target.value})}),[o]),h=(0,a.I4)((e=>{o({type:"changeBillingCountry",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeBillingZip",payload:e.target.value})}),[o]),v=(0,a.I4)((e=>{o({type:"changeSaveCredentials",payload:e.target.value})}),[o]),P=(0,u.Z)(),{formErrors:g={}}=e;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,P("PaymentCardTitle")),a.ZP.createElement(Ho,{onChange:l,value:e.cardNumber,error:g.cardNumber}),n&&a.ZP.createElement(Me.Z,{label:"Name on card",onChange:c,value:e.cardholder,inputMode:"text",error:g.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(zo,{value:e.expiry,onChange:d,error:g.expiry}),a.ZP.createElement(Me.Z,{label:"CVV code",onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,error:g.cvv})),s||r?a.ZP.createElement("h5",null,P("PaymentBillingAddress")):void 0,s&&a.ZP.createElement(Do,{label:"Country",placeholder:"Country",onChange:h,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:g.billingCountry,ref:i},Ao.map((({name:e})=>a.ZP.createElement("option",{value:e,className:"county-item"},e)))),r&&a.ZP.createElement(Me.Z,{label:"Post Code",onChange:Z,value:e.billingZip,inputMode:"text",error:g.billingZip}),t&&a.ZP.createElement(Cn.Z,{label:P("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:v})))})),jo=(0,a.X$)((0,s.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:r,invoiceContent:o,nativeProvider:i,nativeParams:l,passwordMissing:c,error:d}=e.payment,m=Boolean(r&&(!i||"stripe"!==i)),{needCardholderName:u,needCountry:h,needZip:Z}=l||{},{nameRequested:v,phoneRequested:P,emailRequested:g,shippingAddressRequested:p,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I}=r||{};return{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:i,passwordMissing:c,nameRequested:v,shippingAddressRequested:p,phoneRequested:P,emailRequested:g,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I,isProviderError:m,invoiceContent:o,needCardholderName:u,needCountry:h,needZip:Z,error:d}}))((({isOpen:e,onClose:t,step:n,shippingOptions:r,savedInfo:i,canSaveCredentials:l,nameRequested:c,shippingAddressRequested:d,phoneRequested:m,emailRequested:h,phoneToProvider:Z,emailToProvider:v,currency:P,passwordMissing:g,isProviderError:p,invoiceContent:E,nativeProvider:C,prices:f,needCardholderName:b,needCountry:I,needZip:y,error:N})=>{const{validateRequestedInfo:k,sendPaymentForm:S,setPaymentStep:w,sendCredentialsInfo:M,clearPaymentError:T}=(0,s.uC)(),[L,F]=(0,tn.Z)(Bo,Fo),[B,$]=(0,a.eJ)(!1),x=(0,u.Z)();(0,a.d4)((()=>{(n||N)&&$(!1)}),[n,N]),(0,a.d4)((()=>{null!=N&&N.field&&F({type:"setFormErrors",payload:{[N.field]:N.message}})}),[N,F]),(0,a.d4)((()=>{if(i){const{name:e,phone:t,email:n,shippingAddress:a}=i;F({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...a||{}}})}}),[i,F]);const D=(0,a.I4)((()=>{T()}),[T]),U=(0,a.Ye)((()=>n!==o.KB.Checkout?0:function(e=[],t,n){const a=t?Ko(t,n):[];let s=0;return s=e.concat(a||[]).reduce(((e,t)=>e+t.amount),s),s}(f,r,L.shipping)),[n,L.shipping,f,r]),O=(0,a.Ye)((()=>{if(n===o.KB.Checkout)return function(e,t,n){const a=`${function(e){const t=To(e);return Mo[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,s=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:r,fullName:o}=e,i=t?qo(t,e.shipping):void 0;return{paymentMethod:a,paymentProvider:n,shippingAddress:s,name:o,phone:r,shippingMethod:null==i?void 0:i.title}}(L,r,C||"")}),[n,L,r,C]),G=(0,a.I4)((()=>{const{saveInfo:e}=L,t=function(e){const{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:o,fullName:i,phone:l,email:c}=e;return{name:i,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:o}}}(L);k({requestInfo:t,saveInfo:e})}),[k,L]),X=(0,a.I4)((()=>{const e=function(e){const{cardNumber:t,cardholder:n,expiry:a,cvv:s,billingCountry:r,billingZip:o}=e,[i,l]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:i,expiryYear:l,cvv:s,country:r,zip:o}}}(L);M({credentials:e})}),[M,L]),z=(0,a.I4)((()=>{S({shippingOptionId:L.shipping,saveCredentials:L.saveCredentials})}),[S,L]),_=(0,a.I4)((e=>{w({step:e})}),[w]),Y=(0,a.I4)((()=>{switch($(!0),n){case o.KB.ShippingInfo:return G();case o.KB.Shipping:return _(o.KB.PaymentInfo);case o.KB.PaymentInfo:return X();case o.KB.Checkout:return z();default:return()=>{}}}),[n,G,_,X,z]),H=(0,a.Ye)((()=>{switch(n){case o.KB.ShippingInfo:return x("PaymentShippingInfo");case o.KB.Shipping:return x("PaymentShippingMethod");case o.KB.PaymentInfo:return x("PaymentCardInfo");case o.KB.Checkout:return x("PaymentCheckout");default:return""}}),[n,x]),V=(0,a.Ye)((()=>{switch(n){case o.KB.Checkout:return x("Checkout.PayPrice",(0,yo.x)(U,P,x.code));default:return x("Next")}}),[n,x,P,U]);return p?a.ZP.createElement(we.Z,{className:"error",isOpen:e,onClose:t},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(R.Z,{isText:!0,onClick:t},x("OK"))):a.ZP.createElement(we.Z,{className:"PaymentModal",isOpen:e,onClose:t},a.ZP.createElement("div",{className:"header",dir:x.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null,H)),void 0!==n?a.ZP.createElement(A.Z,{name:"slide",activeKey:n},(()=>a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case o.KB.ShippingInfo:return a.ZP.createElement(Uo,{state:L,dispatch:F,needAddress:Boolean(d),needEmail:Boolean(h||v),needPhone:Boolean(m||Z),needName:Boolean(c)});case o.KB.Shipping:return a.ZP.createElement(Oo,{state:L,dispatch:F,shippingOptions:r||[],currency:P});case o.KB.PaymentInfo:return a.ZP.createElement(Vo,{state:L,dispatch:F,canSaveCredentials:Boolean(!g&&l),needCardholderName:b,needCountry:I,needZip:y});case o.KB.Checkout:return a.ZP.createElement(Xo,{prices:f,shippingPrices:L.shipping&&r?Ko(r,L.shipping):void 0,totalPrice:U,invoiceContent:E,checkoutInfo:O,currency:P});default:return}}(n)))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(J.Z,{color:"gray"})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(R.Z,{type:"submit",onClick:Y,disabled:B,isLoading:B},V)),N&&!N.field&&function(){if(N)return a.ZP.createElement(we.Z,{className:"error",isOpen:Boolean(N),onClose:D},a.ZP.createElement("h4",null,N.description||"Error"),a.ZP.createElement("p",null,N.description||"Error"),a.ZP.createElement(R.Z,{isText:!0,onClick:T},x("OK")))}())})));function qo(e,t){return e.find((({id:e})=>e===t))}function Ko(e,t){const n=qo(e,t);return null==n?void 0:n.prices}const Wo=(0,a.X$)((0,s.c$)((e=>{const{receipt:t}=e.payment,{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:o,shippingPrices:i,shippingMethod:l,photoUrl:c,text:d,title:m}=t||{};return{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:o,shippingPrices:i,shippingMethod:l,photoUrl:c,text:d,title:m}}))((({isOpen:e,onClose:t,prices:n,shippingPrices:s,totalAmount:r,currency:o,info:i,photoUrl:l,text:c,title:d,credentialsTitle:m,shippingMethod:h})=>{const Z=(0,u.Z)(),v=(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:r,name:o}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:s,name:o,phone:r,shippingMethod:n}}(m,i,h)),[i,h,m]);return a.ZP.createElement(we.Z,{className:"PaymentModal PaymentModal-receipt",isOpen:e,onClose:t},a.ZP.createElement("div",null,a.ZP.createElement("div",{className:"header",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null," ",Z("PaymentReceipt")," ")),a.ZP.createElement("div",{className:"receipt-content custom-scroll"},a.ZP.createElement(Xo,{prices:n,shippingPrices:s,totalPrice:r,invoiceContent:{photoUrl:l,text:c,title:d},checkoutInfo:v,currency:o}))))})))},9364:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(4050),s=n(3716),r=n(7361),o=n(6752),i=n(9107),l=n(231);const c=r.wB?550:400,d=(0,a.X$)((({isLoading:e=!1,isPasswordVisible:t,error:n,hint:d,placeholder:m="Password",submitLabel:u="Next",clearError:h,onChangePasswordVisibility:Z,onInputChange:v,onSubmit:P})=>{const g=(0,a.sO)(null),p=(0,i.Z)(),[E,C]=(0,a.eJ)(""),[f,b]=(0,a.eJ)(!1);return(0,a.d4)((()=>{r.$b||setTimeout((()=>{g.current.focus()}),c)}),[]),(0,a.d4)((()=>{n&&requestAnimationFrame((()=>{g.current.focus(),g.current.select()}))}),[n]),a.ZP.createElement("form",{action:"",onSubmit:function(t){t.preventDefault(),e||f&&P(E)},autoComplete:"off"},a.ZP.createElement("div",{className:(0,o.Z)("input-group password-input",E&&"touched",n&&"error"),dir:p.isRtl?"rtl":void 0},a.ZP.createElement("input",{ref:g,className:"form-control",type:t?"text":"password",id:"sign-in-password",value:E||"",autoComplete:"current-password",onChange:function(e){n&&h();const{target:t}=e;C(t.value),b(t.value.length>=s.lo),v&&v(t.value)},dir:"auto"}),a.ZP.createElement("label",null,n||d||m),a.ZP.createElement("div",{className:"toggle-password",onClick:function(){Z(!t)},role:"button",tabIndex:0,title:"Toggle password visibility"},a.ZP.createElement("i",{className:t?"icon-eye":"icon-eye-closed"}))),f&&a.ZP.createElement(l.Z,{type:"submit",ripple:!0,isLoading:e},u))}))},3490:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(4050),s=n(3716),r=n(7361),o=n(7324),i=n(7799);const l=[0,50],c=[0,20],d=[20,0],m=r.wB?s.qp:s.z7,u=(0,a.X$)((({isPasswordVisible:e,isBig:t})=>{const[n,r]=(0,a.eJ)(),[u,h]=(0,a.eJ)(),[Z,v]=(0,a.eJ)(!1),[P,g]=(0,a.eJ)(!1);(0,a.d4)((()=>{n?setTimeout((()=>g(!0)),2e3):(0,o.Z)("MonkeyClose").then(r)}),[n]),(0,a.d4)((()=>{u||(0,o.Z)("MonkeyPeek").then(h)}),[u]);const p=(0,a.I4)((()=>v(!0)),[]);return a.ZP.createElement("div",{id:"monkey",className:t?"big":""},!Z&&a.ZP.createElement("div",{className:"monkey-preview"}),n&&a.ZP.createElement(i.Z,{id:"closeMonkey",size:t?s.K2:m,className:P?"hidden":"shown",animationData:n,playSegment:l,noLoop:!0,onLoad:p}),u&&a.ZP.createElement(i.Z,{id:"peekMonkey",size:t?s.K2:m,className:P?"shown":"hidden",animationData:u,playSegment:e?c:d,noLoop:!0}))}))},710:(e,t,n)=>{n.d(t,{Z:()=>P});var a=n(4050),s=n(6752),r=n(3716),o=n(1394),i=n(9107),l=n(231),c=n(3103),d=n(4288);const m={type:"blob",quality:1,format:"jpeg",circle:!1,size:{width:1024,height:1024}};let u,h,Z;const v=(0,a.X$)((({file:e,onChange:t,onClose:s})=>{const[v,P]=(0,a.eJ)(!1);(0,a.d4)((()=>{e&&(v?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:n,offsetHeight:a}=t;Z=new u(t,{enableZoom:!0,boundary:{width:n,height:a},viewport:{width:n-16,height:a-16,type:"circle"}});const s=await(0,o.YJ)(e);await Z.bind({url:s})}catch(e){r.eM&&console.error(e)}}(e):async function(){return h||(h=Promise.all([n.e(99),n.e(472)]).then(n.bind(n,3472)),u=(await h).default),h}().then((()=>P(!0))))}),[e,v]);const g=(0,i.Z)();return a.ZP.createElement(c.Z,{isOpen:Boolean(e),onClose:s,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},v?a.ZP.createElement("div",{id:"avatar-crop"}):a.ZP.createElement(d.Z,null),a.ZP.createElement(l.Z,{className:"confirm-button",round:!0,color:"primary",onClick:async function(){if(!Z)return;const e=await Z.result(m),n="string"==typeof e?e:(0,o.hl)(e,"avatar.jpg");t(n)},ariaLabel:g("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),P=(0,a.X$)((({title:e="Change your profile picture",disabled:t,currentAvatarBlobUrl:n,onChange:r})=>{const[o,i]=(0,a.eJ)(),[l,c]=(0,a.eJ)(n);(0,a.d4)((()=>{c(n)}),[n]);const d=(0,s.Z)(l&&"filled",t&&"disabled");return a.ZP.createElement("div",{className:"AvatarEditable"},a.ZP.createElement("label",{className:d,role:"button",tabIndex:0,title:e},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"}),l&&a.ZP.createElement("img",{src:l,alt:"Avatar"})),a.ZP.createElement(v,{file:o,onClose:function(){i(void 0)},onChange:function(e){i(void 0),r(e),l&&URL.revokeObjectURL(l),c(URL.createObjectURL(e))}}))}))},6352:(e,t,n)=>{e.exports=n.p+"mastercard.4216118edafe23cc2dec..svg"},5753:(e,t,n)=>{e.exports=n.p+"visa.e5a7c336e1deb4b92a63..svg"}}]);
//# sourceMappingURL=126.8100af6cdae9295c7269.js.map