TelegramPWA/dist/3779.c5f3d4ea7ae8e70486d2.js
Alexander Zinchuk 5617ae4fc4 [Build]
2022-12-15 19:21:00 +01:00

2 lines
422 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([[3779],{36349:(e,t,n)=>{n.r(t),n.d(t,{AboutAdsModal:()=>_n,ArchivedChats:()=>nr,AttachBotInstallModal:()=>wt,AttachBotRecipientPicker:()=>tt,AttachmentModal:()=>no,BotCommandMenu:()=>Bo,BotCommandTooltip:()=>xo,BotTrustModal:()=>Nt,CalendarModal:()=>gt,ChatFolderModal:()=>sr,ContactList:()=>Yi,ContextMenuContainer:()=>Nr,CustomEmojiSetsModal:()=>Ar,CustomEmojiTooltip:()=>Uo,CustomSendMenu:()=>$o,DeleteFolderDialog:()=>Mt,DeleteMessageModal:()=>H,Dialogs:()=>st,DraftRecipientPicker:()=>et,DropArea:()=>_o.Z,EmojiInteractionAnimation:()=>Qn,EmojiTooltip:()=>Jo,ForwardRecipientPicker:()=>Qe,GifSearch:()=>rl,GiftPremiumModal:()=>Ln,HeaderMenuContainer:()=>Fr,HistoryCalendar:()=>Et,InlineBotTooltip:()=>Qo,LeftSearch:()=>$a,Management:()=>ac,MediaViewer:()=>Ue,MentionTooltip:()=>Wr,MessageSelectToolbar:()=>Xn,MessageStatistics:()=>Sl,MobileSearch:()=>Or,NewChat:()=>er,NewChatStep1:()=>Ki,NewChatStep2:()=>Wi,NewContactModal:()=>ft,Notifications:()=>rt,PaymentModal:()=>Lc,PinMessageModal:()=>Gn,PollModal:()=>so,PollResults:()=>Nl,PremiumLimitReachedModal:()=>Un,PremiumMainModal:()=>Tn,ReactorListModal:()=>Kn,ReceiptModal:()=>Bc,RightSearch:()=>nl,SafeLinkModal:()=>ct,SeenByModal:()=>Hn,SendAsMenu:()=>el,Settings:()=>qi,SponsoredMessageContextMenuContainer:()=>wr,Statistics:()=>El,StickerSearch:()=>il,StickerSetModal:()=>Mr,StickerTooltip:()=>Oo,SymbolMenu:()=>Lo,TextFormatter:()=>Go.Z,UnpinAllMessagesModal:()=>jn,UrlAuthModal:()=>ut,WebAppModal:()=>kt});var a=n(14050),s=n(91713),i=n(33555),r=n(56112),o=n(11192),l=n(10396),c=n(23989),d=n(77361),m=n(83716),u=n(74399),h=n(43858),P=n(98069),Z=n(3858),v=n(55254);function p(e,t){const n=document.createElement("div");n.classList.add("ghost");const a=new Image;if(a.draggable=!1,a.oncontextmenu=Z.Z,"string"==typeof e?a.src=e:e instanceof HTMLVideoElement?a.src=e.poster:a.src=e.src,n.appendChild(a),t===s.bZ.ProfileAvatar||t===s.bZ.SettingsAvatar){n.classList.add("ProfileInfo"),t===s.bZ.SettingsAvatar&&n.classList.add("self");const e=document.querySelector(t===s.bZ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&n.appendChild(e.cloneNode(!0))}return n}function g(e,t){const n=document.querySelector(".Transition__slide--active > .MessageList");let a=e.offsetTop+t.closest(".content-inner, .WebPage").offsetTop;return e.id.includes("album-media-")&&(a+=e.parentElement.offsetTop+e.closest(".Message").offsetTop),a>n.scrollTop&&a+t.offsetHeight<n.scrollTop+n.offsetHeight}function E(e,t){Object.assign(e.style,t)}function C(e,t){let n,a;switch(e){case s.bZ.Album:case s.bZ.ScheduledAlbum:n=`.Transition__slide--active > .MessageList #album-media-${(0,r.d0)(t.id)}`,a=".full-media";break;case s.bZ.SharedMedia:n=`#shared-media${(0,r.d0)(t.id)}`,a="img";break;case s.bZ.SearchResult:n=`#search-media${(0,r.d0)(t.id)}`,a="img";break;case s.bZ.MiddleHeaderAvatar:n=".MiddleHeader .Transition__slide--active .ChatInfo .Avatar",a=".avatar-media";break;case s.bZ.SettingsAvatar:n="#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto",a=".avatar-media";break;case s.bZ.ProfileAvatar:n="#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto",a=".avatar-media";break;case s.bZ.ScheduledInline:case s.bZ.Inline:default:n=`.Transition__slide--active > .MessageList #${(0,r.d0)(t.id)}`,a=`${m.be} .full-media, ${m.be} .thumbnail`}const i=document.querySelector(n),o=i&&i.querySelectorAll(a);return{container:i,mediaEl:o?.[0]}}function f(e,t){switch(t){case s.bZ.Album:case s.bZ.ScheduledAlbum:case s.bZ.Inline:case s.bZ.ScheduledInline:e.classList.add("rounded-corners");break;case s.bZ.SharedMedia:case s.bZ.SettingsAvatar:case s.bZ.ProfileAvatar:case s.bZ.SearchResult:e.firstChild.style.objectFit="cover";break;case s.bZ.MiddleHeaderAvatar:e.classList.add("circle")}}var b=n(996),I=n(60706),y=n(65326),S=n(18674),k=n(74753);function N(e){if(e.webkitSupportsPresentationMode&&"function"==typeof e.webkitSetPresentationMode)return e.webkitSetPresentationMode.bind(e)}function w(){if(document.pictureInPictureElement)try{document.exitPictureInPicture()}catch(e){m.eM&&console.log("[MV] PictureInPicture Error",e)}}var M=n(59107),T=n(87204),A=n(6137),R=n(6202),L=n(92566),F=n(96264),x=n(29290),B=n(71394);const O=new Map;const D=e=>{let{message:t,mediaId:n=0,avatarOwner:i,origin:o,delay:l}=e;const c=t?(0,r.O$)(t):void 0,d=t?(0,r.b7)(t):void 0,m=t?(0,r.F$)(t):void 0,h=t?(0,r.Cg)(t):void 0,P=!!t&&(0,r.rl)(t),Z=!!t&&(0,r.hC)(t),v=t?(0,r.c0)(t):void 0,p=i?.photos?.[n],g=Boolean(p?.isVideo),E=Boolean(d||h||Z),C=Boolean(!E&&(c||m||P)),{isGif:f}=d||h||{},b=o===s.bZ.SharedMedia,I=o===s.bZ.SearchResult,S=(0,a.Ye)((()=>e=>i?p?p.isVideo&&e?(0,r.Dk)(p):0===n?(0,r.RT)(i,e?"big":"normal"):`photo${p.id}?size=c`:(0,r.RT)(i,e?"big":"normal"):t&&(0,r.Ti)(t,e?"full":"preview")),[i,t,p,n]),k=(0,R.Z)(t&&(b||I||P||Z)&&(0,r.Ti)(t,"pictogram"),void 0,A.IU.BlobUrl,void 0,l),N=S(),w=(0,R.Z)(N,void 0,A.IU.BlobUrl,void 0,l),{mediaData:M,loadProgress:T}=(0,L.Z)(S(!0),void 0,t&&(0,r.kG)(t,"full"),void 0,l),D=c||d?(c||d).blobUrl:void 0;let U=!E&&(D||M)||w||k;const $=function(e){const t=(0,a.sO)();let n=!1;(0,x.Z)((()=>{if(n=!0,t.current=void 0,!e)return;const a=new Image;if(a.src=e,!a.width)return;const s=(0,B.ao)(a);(0,F.Z)(s.getContext("2d"),0,0,s.width,s.height,2,2),t.current=s.toDataURL()}),[e]);const s=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;const s=(0,a.sO)(e?O.get(e):void 0),i=(0,a.sO)(),r=(0,y.Z)();return i.current&&t&&(clearTimeout(i.current),i.current=void 0),(0,a.d4)((()=>{if(!e||s.current||t)return;const a=new Image;a.onload=()=>{const t=(0,B.ao)(a);(0,F.Z)(t.getContext("2d"),0,0,t.width,t.height,2,2);const n=t.toDataURL();s.current=n,r(),O.size>=1e3&&O.clear(),O.set(e,n)},n?i.current=window.setTimeout((()=>{a.src=e}),n):a.src=e}),[e,n,r,t]),s.current}(e||void 0,Boolean(t.current));return t.current||!n&&s||e||void 0}(!U&&t&&(0,r.DH)(t));U||o===s.bZ.SearchResult||(U=$),g&&w&&(U=w);const _=D||M||(E?void 0:w||k||U),G=t?(0,r.ep)(t):i?`avatar${i.id}.${i?.hasVideoAvatar?"mp4":"jpg"}`:void 0;let j;return t?P||Z?j=(0,r.aE)(t).mediaSize:c||m?j=(0,r.bV)(c||m):(d||h)&&(j=(0,r.jC)(d||h)):j=g?u.Fp:u.vY,{getMediaHash:S,photo:c,video:d,webPagePhoto:m,webPageVideo:h,isVideo:E,isPhoto:C,isGif:f,isDocumentPhoto:P,isDocumentVideo:Z,fileName:G,bestImageData:U,bestData:_,dimensions:j,isFromSharedMedia:b,avatarPhoto:p,isVideoAvatar:g,loadProgress:T,videoSize:v}};var U=n(66534),$=n(231),_=n(40126),G=n(2255),j=n(53106),V=n(58964),z=n(39196),J=n(32340),X=n(13103);const H=(0,a.X$)((0,i.c$)(((e,t)=>{let{message:n,isSchedule:a}=t;const{threadId:s}=(0,o.Bt)(e)||{},{canDeleteForAll:i}=s&&(0,o._k)(e,n,s)||{},l=(0,o.Z1)(e,n.chatId);return{canDeleteForAll:!a&&i,contactName:l&&(0,r.YC)(l.id)?(0,r.Vl)((0,o.dy)(e,(0,r.zX)(l))):void 0,willDeleteForCurrentUserOnly:l&&(0,r.G9)(l)&&!i,willDeleteForAll:l&&(0,r.ZV)(l)}}))((e=>{let{isOpen:t,isSchedule:n,message:s,album:r,canDeleteForAll:o,contactName:l,willDeleteForCurrentUserOnly:c,willDeleteForAll:d,onConfirm:m,onClose:u}=e;const{deleteMessages:h,deleteScheduledMessages:P}=(0,i.Sv)(),Z=(0,a.I4)((()=>{m?.();const e=r?.messages?r.messages.map((e=>{let{id:t}=e;return t})):[s.id];h({messageIds:e,shouldDeleteForAll:!0}),u()}),[m,r,s.id,h,u]),v=(0,a.I4)((()=>{m?.();const e=r?.messages?r.messages.map((e=>{let{id:t}=e;return t})):[s.id];n?P({messageIds:e}):h({messageIds:e,shouldDeleteForAll:!1}),u()}),[m,r,s.id,n,u,P,h]),p=(0,M.Z)();return a.ZP.createElement(X.Z,{isOpen:t,onClose:u,onEnter:t&&!o?v:void 0,className:"delete",title:p("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,p("AreYouSureDeleteSingleMessage")),c&&a.ZP.createElement("p",null,p("lng_delete_for_me_chat_hint",1,"i")),d&&a.ZP.createElement("p",null,p("lng_delete_for_everyone_hint",1,"i")),o&&a.ZP.createElement($.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},l&&(0,J.Z)(p("Conversation.DeleteMessagesFor",l)),!l&&p("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement($.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:v},p(o?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:u},p("Cancel")))}))),q=(0,a.X$)((e=>{let{isOpen:t,photo:n,profileId:s,onClose:o,onConfirm:l}=e;const{deleteProfilePhoto:c,deleteChatPhoto:d}=(0,i.Sv)(),m=(0,a.I4)((()=>{l?.(),(0,r.YC)(s)?c({photo:n}):d({photo:n,chatId:s}),o()}),[l,s,o,c,n,d]),u=(0,M.Z)();return a.ZP.createElement(X.Z,{isOpen:t,onClose:o,onEnter:m,className:"delete",title:"Are you sure?"},a.ZP.createElement($.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:m},u("Preview.DeletePhoto")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:o},u("Cancel")))})),Y=(0,a.X$)((0,i.c$)(((e,t)=>{let{message:n,canUpdateMedia:a,avatarPhoto:s,avatarOwner:i}=t;const r=(0,o.Bt)(e),{threadId:l}=(0,o.Bt)(e)||{},c=!!n&&(0,o.te)(e,n),d=(0,o.EV)(e,n),m=n&&(0,o.Am)(e,n?.chatId),{canDelete:u}=l&&n&&(0,o._k)(e,n,l)||{},h=s&&s.id===i?.avatarHash,P=u||a&&!!s,Z=a&&!!s&&!h,v=r?.type;return{isDownloading:c,isProtected:d,isChatProtected:m,canDelete:P,canUpdate:Z,messageListType:v,avatarOwnerId:i?.id}}))((e=>{let{mediaData:t,isVideo:n,message:s,avatarPhoto:o,avatarOwnerId:l,fileName:c,isChatProtected:m,isDownloading:u,isProtected:h,canReport:P,zoomLevelChange:Z,canDelete:v,canUpdate:p,messageListType:g,selectMedia:E,onReport:C,onCloseMediaViewer:f,onBeforeDelete:b,onForward:y,setZoomLevelChange:S}=e;const[k,N,w]=(0,I.Z)(!1),{downloadMessageMedia:T,cancelMessageMediaDownload:A,updateProfilePhoto:R,updateChatPhoto:F}=(0,i.Sv)(),{loadProgress:x}=(0,L.Z)(s&&(0,r.Ti)(s,"download"),!u,s&&(0,r.kG)(s,"download")),B=(0,a.I4)((()=>{u?A({message:s}):T({message:s})}),[A,T,u,s]),O=(0,a.I4)((()=>{S((Z<0?Z:0)-1)}),[S,Z]),D=(0,a.I4)((()=>{S((Z>0?Z:0)+1)}),[S,Z]),U=(0,a.I4)((()=>{o&&l&&((0,r.YC)(l)?R({photo:o}):F({chatId:l,photo:o}),E(0))}),[o,l,E,R,F]),_=(0,M.Z)(),G=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",className:n?"active":void 0,onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]);function J(){return s?a.ZP.createElement(H,{isOpen:k,isSchedule:"scheduled"===g,onClose:w,onConfirm:b,message:s}):l&&o?a.ZP.createElement(q,{isOpen:k,onClose:w,onConfirm:b,profileId:l,photo:o}):void 0}if(d.wB){const e=[];if(s?.isForwardingAllowed||m||e.push({icon:"forward",onClick:y,children:_("Forward")}),h||(n?e.push({icon:u?"cancel":"download",onClick:B,children:u?`${Math.round(100*x)}% Downloading...`:"Download"}):e.push({icon:"download",href:t,download:c,children:_("AccActionDownload")})),P&&e.push({icon:"report",onClick:C,children:_("ReportPeer.Report")}),p&&e.push({icon:"copy-media",onClick:U,children:_("ProfilePhoto.SetMainPhoto")}),v&&e.push({icon:"delete",onClick:N,children:_("Delete")}),0===e.length)return;return a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(j.Z,{trigger:G,positionX:"right"},e.map((e=>{let{icon:t,onClick:n,href:s,download:i,children:r}=e;return a.ZP.createElement(V.Z,{key:t,icon:t,href:s,download:i,onClick:n},r)}))),u&&a.ZP.createElement(z.Z,{progress:x,size:"s",noCross:!0}),v&&J())}return a.ZP.createElement("div",{className:"MediaViewerActions"},s?.isForwardingAllowed&&!m&&a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("Forward"),onClick:y},a.ZP.createElement("i",{className:"icon-forward"})),function(){if(!h)return n?a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("AccActionDownload"),onClick:B},u?a.ZP.createElement(z.Z,{progress:x,size:"s",onClick:B}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement($.Z,{href:t,download:c,round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"}))}(),a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("MediaZoomOut"),onClick:O},a.ZP.createElement("i",{className:"icon-zoom-out"})),a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("MediaZoomIn"),onClick:D},a.ZP.createElement("i",{className:"icon-zoom-in"})),P&&a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_(n?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:C},a.ZP.createElement("i",{className:"icon-flag"})),p&&a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("ProfilePhoto.SetMainPhoto"),onClick:U},a.ZP.createElement("i",{className:"icon-copy-media"})),v&&a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("Delete"),onClick:N},a.ZP.createElement("i",{className:"icon-delete"})),a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("Close"),onClick:f},a.ZP.createElement("i",{className:"icon-close"})),v&&J())})));var K=n(9933),W=n(46752),Q=n(64963),ee=n(28712),te=n(69118),ne=n(67360),ae=n(28183),se=n(12255),ie=n(46590);const re=oe();function oe(){return void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":""}var le=n(49204);const ce=e=>{let{text:t="",isHidden:n,isForVideo:s,onClick:i,isProtected:r}=e;const[o,l]=(0,a.eJ)(!1);(0,a.d4)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;l(t>2*u.Gw)};t();const n=(0,te.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const c=(0,W.Z)("MediaViewerFooter",s&&"is-for-video",n&&"is-hidden",r&&"is-protected");return a.ZP.createElement("div",{className:c,onClick:function(e){t&&e.stopPropagation()}},t&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:d.wB?void 0:i},a.ZP.createElement("p",{className:"media-text custom-scroll "+(o?"multiline":""),dir:"auto"},t)))};var de=n(12019),me=n(31212),ue=n(46898),he=n(790),Pe=n(2155),Ze=n(18051),ve=n(52328);const pe=e=>{e.stopPropagation()},ge=[.5,1,1.5,2],Ee=e=>{let{bufferedRanges:t,bufferedProgress:n,currentTime:s,duration:i,fileSize:r,isForceMobileVersion:o,isPlaying:l,isFullscreenSupported:c,isFullscreen:m,isVisible:u,isBuffered:h,volume:P,isMuted:Z,playbackRate:v,onChangeFullscreen:p,onVolumeClick:g,onVolumeChange:E,onPlaybackRateChange:C,isPictureInPictureSupported:f,onPictureInPictureChange:b,onPlayPause:y,setVisibility:S,onSeek:k}=e;const[N,w,T]=(0,I.Z)(),A=(0,a.sO)(null),R=(0,a.sO)(!1),L=R.current;(0,a.d4)((()=>{if(!d.$b)return;let e;if(u&&l&&!L&&!N)return e=window.setTimeout((()=>{S(!1)}),3e3),()=>{e&&window.clearTimeout(e)};e&&window.clearTimeout(e)}),[l,u,L,S,N]),(0,a.d4)((()=>(u?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[u]),(0,a.d4)((()=>{u||T()}),[T,u]);const F=(0,M.Z)(),x=(0,a.I4)((e=>{if(R.current&&A.current){const{width:t,left:n}=A.current.getBoundingClientRect(),a=e instanceof MouseEvent?e.clientX:e.targetTouches[0].clientX;k(Math.max(Math.min(i*((a-n)/t),i),0))}}),[i,k]),B=(0,a.I4)((e=>{R.current=!0,x(e)}),[x]),O=(0,a.I4)((()=>{R.current=!1}),[]);(0,a.d4)((()=>{if(A.current&&u)return(0,Q.sf)(A.current,{onCapture:B,onRelease:O,onClick:O,onDrag:x})}),[u,B,x,O]);const D=(0,a.Ye)((()=>0===P||Z?"icon-muted":P<.3?"icon-volume-1":P<.6?"icon-volume-2":"icon-volume-3"),[P,Z]);return a.ZP.createElement("div",{className:(0,W.Z)("VideoPlayerControls",o&&"mobile",u&&"active"),onClick:pe},function(e,t,n,s){const i=e/t*100;return a.ZP.createElement("div",{className:"player-seekline",ref:s},a.ZP.createElement("div",{className:"player-seekline-track"},n.map((e=>{let{start:t,end:n}=e;return a.ZP.createElement("div",{className:"player-seekline-buffered",style:`left: ${100*t}%; right: ${100-100*n}%`})})),a.ZP.createElement("div",{className:"player-seekline-played",style:`width: ${i||0}%`})))}(s,i,t,A),a.ZP.createElement("div",{className:"buttons"},a.ZP.createElement($.Z,{ariaLabel:F("AccActionPlay"),size:"tiny",ripple:!d.wB,color:"translucent-white",className:"play",round:!0,onClick:y},a.ZP.createElement("i",{className:l?"icon-pause":"icon-play"})),a.ZP.createElement($.Z,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:g},a.ZP.createElement("i",{className:D})),!d.cj&&a.ZP.createElement(Ze.Z,{bold:!0,className:"volume-slider",value:Z?0:100*P,onChange:E}),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,he.k9)(e)} / ${(0,he.k9)(t)}`)}(s,i),!h&&a.ZP.createElement("div",{className:"player-file-size"},`${(0,Pe.sS)(F,r*n)} / ${(0,Pe.sS)(F,r)}`),a.ZP.createElement("div",{className:"spacer"}),a.ZP.createElement($.Z,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:w},`${v}x`),f&&a.ZP.createElement($.Z,{ariaLabel:"Picture in picture",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:b},a.ZP.createElement("i",{className:"icon-pip"})),c&&a.ZP.createElement($.Z,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:p},a.ZP.createElement("i",{className:m?"icon-smallscreen":"icon-fullscreen"}))),a.ZP.createElement(ve.Z,{isOpen:N,className:(0,W.Z)("playback-rate-menu",!c&&"no-fullscreen",!f&&"no-pip"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:T},ge.map((e=>a.ZP.createElement(V.Z,{disabled:v===e,onClick:()=>C(e)},`${e}x`)))))};function Ce(){return Ce=Object.assign?Object.assign.bind():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},Ce.apply(this,arguments)}const fe=(0,a.X$)((e=>{let{url:t,isGif:n,posterData:s,posterSize:r,loadProgress:o,fileSize:l,isMediaViewerOpen:c,noPlay:u,volume:h,isMuted:P,playbackRate:v,onClose:p,toggleControls:g,areControlsVisible:E,shouldCloseOnClick:C,isProtected:f,isClickDisabled:b}=e;const{setMediaViewerVolume:I,setMediaViewerMuted:y,setMediaViewerPlaybackRate:S,setMediaViewerHidden:M}=(0,i.Sv)(),T=(0,a.sO)(null),[A,R]=(0,a.eJ)(!d.$b||!d.cj),[L,F]=(0,a.eJ)(0),[x,B,O]=function(e,t){const[n,s]=(0,a.eJ)(Boolean(re&&document[re]));return(0,a.bt)((()=>{const n=e.current,a=()=>{const e=Boolean(re&&document[re]);s(e),n.controls=e},i=()=>{s(!0)},r=()=>{s(!1),t(!1)};return document.addEventListener("fullscreenchange",a,!1),document.addEventListener("webkitfullscreenchange",a,!1),document.addEventListener("mozfullscreenchange",a,!1),n&&(n.addEventListener("webkitbeginfullscreen",i,!1),n.addEventListener("webkitendfullscreen",r,!1)),()=>{document.removeEventListener("fullscreenchange",a,!1),document.removeEventListener("webkitfullscreenchange",a,!1),document.removeEventListener("mozfullscreenchange",a,!1),n&&(n.removeEventListener("webkitbeginfullscreen",i,!1),n.removeEventListener("webkitendfullscreen",r,!1))}}),[]),re||d.cj?[n,()=>{var t;e.current&&(re||d.cj)&&((t=e.current).requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.webkitEnterFullscreen?t.webkitEnterFullscreen():t.mozRequestFullScreen&&t.mozRequestFullScreen(),s(!0))},()=>{e.current&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),s(!1))}]:[!1]}(T,R),D=(0,a.I4)((()=>{d.nJ||M(!0)}),[M]),U=(0,a.I4)((()=>{d.nJ||M(!1)}),[M]),[_,G]=function(e,t,n){const[s,i]=(0,a.eJ)(!1);(0,a.bt)((()=>{if(d.cj&&d.fl||!e.current)return;const a=e.current,s=N(a);return document.pictureInPictureEnabled&&!e.current?.disablePictureInPicture||void 0!==s?(a.autoPictureInPicture=!0,i(!0),a.addEventListener("enterpictureinpicture",t),a.addEventListener("leavepictureinpicture",n),()=>{a.removeEventListener("enterpictureinpicture",t),a.removeEventListener("leavepictureinpicture",n)}):void 0}),[e,t,n]);const r=(0,a.I4)((()=>{if(!e.current)return;const t=N(e.current);t?t("inline"):w()}),[e]),o=(0,a.I4)((()=>{if(!e.current)return;r();const t=e.current,n=(0,k.h)(t),a=N(t);a?a("picture-in-picture"):function(e){if(e.requestPictureInPicture)try{e.requestPictureInPicture()}catch(e){m.eM&&console.log("[MV] PictureInPicture Error",e)}}(t),n&&(0,k.Z)(t)}),[e,r]);return s?[s,o]:[!1]}(T,D,U),j=(0,a.I4)((()=>{g(!0)}),[g]),V=(0,a.I4)((e=>{const t=T.current?.getBoundingClientRect();t&&(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&g(!1)}),[g]),{isBuffered:J,bufferedRanges:X,bufferingHandlers:H,bufferedProgress:q}=(0,de.Z)(),{shouldRender:Y,transitionClassNames:K}=(0,me.Z)(!J,void 0,void 0,"slow"),{shouldRender:W,transitionClassNames:Q}=(0,me.Z)(d.cj&&!A&&!Y,void 0,void 0,"slow");(0,a.d4)((()=>{u||!c?T.current.pause():t&&!d.$b&&(0,k.Z)(T.current)}),[u,c,t,y]),(0,a.d4)((()=>{T.current.currentTime===T.current.duration?(F(0),R(!1)):F(T.current.currentTime)}),[L]),(0,a.d4)((()=>{T.current.volume=h}),[h]),(0,a.d4)((()=>{T.current.playbackRate=v}),[v]);const ee=(0,a.I4)((e=>{e.stopPropagation(),A?(T.current.pause(),R(!1)):((0,k.Z)(T.current),R(!0))}),[A]),te=(0,a.I4)((e=>{b||(C?p(e):ee(e))}),[p,C,ee,b]);(0,ue.Z)(T,[]);const ne=(0,a.I4)((e=>{F(e.currentTarget.currentTime)}),[]),ae=(0,a.I4)((()=>{F(0),R(!1),g(!0)}),[g]),se=(0,a.I4)((()=>{x&&O?O():!x&&B&&B()}),[O,x,B]),ie=(0,a.I4)((e=>{T.current.currentTime=e}),[]),oe=(0,a.I4)((e=>{I({volume:e/100})}),[I]),le=(0,a.I4)((()=>{T.current.muted=!T.current.muted,y({isMuted:!P})}),[P,y]),ce=(0,a.I4)((e=>{S({playbackRate:e})}),[S]);(0,a.d4)((()=>{if(!c)return;const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),ee(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[ee,c]);const he=r&&`width: ${r.width}px; height: ${r.height}px`,Pe=`background-image: url(${s})`,Ze=T.current?.duration||0;return a.ZP.createElement("div",{className:"VideoPlayer",onMouseMove:d.$b?void 0:j,onMouseOut:d.$b?void 0:V},a.ZP.createElement("div",{style:he},f&&a.ZP.createElement("div",{onContextMenu:Z.Z,onDoubleClick:d.$b?void 0:se,onClick:d.wB?void 0:ee,className:"protector"}),a.ZP.createElement("video",Ce({ref:T,autoPlay:d.$b,controlsList:"nodownload",playsInline:!0,loop:n||Ze<=30,muted:n||P,id:"media-viewer-video",style:Pe,onPlay:()=>R(!0),onEnded:ae,onClick:d.wB?void 0:te,onDoubleClick:d.$b?void 0:se},H,{onPause:e=>{R(!1),H.onPause(e)},onTimeUpdate:ne}),t&&a.ZP.createElement("source",{src:t}))),W&&a.ZP.createElement($.Z,{round:!0,className:`play-button ${Q}`,onClick:ee},a.ZP.createElement("i",{className:"icon-play"})),Y&&a.ZP.createElement("div",{className:["spinner-container",K].join(" ")},!J&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement(z.Z,{size:"xl",progress:J?1:o,square:!0,onClick:p})),!n&&!Y&&a.ZP.createElement(Ee,{isPlaying:A,bufferedRanges:X,bufferedProgress:q,isBuffered:J,currentTime:L,isFullscreenSupported:Boolean(B),isPictureInPictureSupported:_,isFullscreen:x,fileSize:l,duration:Ze,isVisible:E,setVisibility:g,isForceMobileVersion:r&&r.width<400,onSeek:ie,onChangeFullscreen:se,onPictureInPictureChange:G,onPlayPause:ee,volume:h,playbackRate:v,isMuted:P,onVolumeClick:le,onVolumeChange:oe,onPlaybackRateChange:ce}))})),be=(0,a.X$)((0,i.c$)(((e,t)=>{const{chatId:n,threadId:a,mediaId:i,avatarOwnerId:r,origin:l}=t,{volume:c,isMuted:d,playbackRate:m,isHidden:u}=e.mediaViewer;if(l===s.bZ.SearchResult){if(!n||!i)return{volume:c,isMuted:d,playbackRate:m};const t=(0,o.hj)(e,n,i);return t?{chatId:n,mediaId:i,senderId:t.senderId,origin:l,message:t,isProtected:(0,o.EV)(e,t),volume:c,isMuted:d,isHidden:u,playbackRate:m}:{volume:c,isMuted:d,playbackRate:m}}if(r)return{mediaId:i,senderId:r,avatarOwner:(0,o.dy)(e,r)||(0,o.Z1)(e,r),origin:l,volume:c,isMuted:d,isHidden:u,playbackRate:m};if(!(n&&a&&i))return{volume:c,isMuted:d,playbackRate:m};let h;return h=l&&[s.bZ.ScheduledAlbum,s.bZ.ScheduledInline].includes(l)?(0,o.Tm)(e,n,i):(0,o.hj)(e,n,i),h?{chatId:n,threadId:a,mediaId:i,senderId:h.senderId,origin:l,message:h,isProtected:(0,o.EV)(e,h),volume:c,isMuted:d,isHidden:u,playbackRate:m}:{volume:c,isMuted:d,playbackRate:m}}))((e=>{const{mediaId:t,isActive:n,avatarOwner:s,chatId:i,message:r,origin:o,animationLevel:l,areControlsVisible:c,isProtected:m,volume:h,playbackRate:P,isMuted:v,isHidden:p,onClose:g,onFooterClick:E,setControlsVisible:C,isMoving:f}=e,I=2===l,{isVideo:y,isPhoto:S,bestImageData:k,bestData:N,dimensions:w,isGif:M,isVideoAvatar:T,videoSize:A,loadProgress:R}=D({message:r,avatarOwner:s,mediaId:t,origin:o,delay:I&&350}),L=Boolean(s||t),F=(0,a.I4)((e=>{C?.(e)}),[C]);if(s)return T?a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},a.ZP.createElement(fe,{key:t,url:N,isGif:!0,posterData:k,posterSize:(0,u.PA)(w,!1,!0),loadProgress:R,fileSize:A,isMediaViewerOpen:L&&n,areControlsVisible:c,toggleControls:F,isProtected:m,noPlay:!n,onClose:g,isMuted:!0,shouldCloseOnClick:!0,volume:0,isClickDisabled:f,playbackRate:1})):a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},Ie(N,(0,u.PA)(w,!1),!d.wB&&!m,m));if(!r)return;const x=(0,b.X)(r),B=Boolean(x);return a.ZP.createElement("div",{className:(0,W.Z)("MediaViewerContent",B&&"has-footer")},S&&Ie(N,r&&(0,u.PA)(w,B),!d.wB&&!m,m),y&&(n?a.ZP.createElement(fe,{key:t,url:N,isGif:M,posterData:k,posterSize:r&&(0,u.PA)(w,B,!0),loadProgress:R,fileSize:A,areControlsVisible:c,isMediaViewerOpen:L&&n,toggleControls:F,noPlay:!n,onClose:g,isMuted:v,isHidden:p,isProtected:m,volume:h,isClickDisabled:f,playbackRate:P}):function(e,t,n,s){const i=t&&`width: ${t.width}px; height: ${t.height}px`,r=`background-image: url(${e})`;return e?a.ZP.createElement("div",{className:"VideoPlayer"},s&&a.ZP.createElement("div",{onContextMenu:Z.Z,className:"protector"}),a.ZP.createElement("div",{style:i},a.ZP.createElement("video",{style:r,className:(0,W.Z)(s&&"is-protected"),draggable:Boolean(n)}))):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(le.Z,{color:"white"}))}(k,r&&(0,u.PA)(w,B,!0),!d.wB&&!m,m)),x&&a.ZP.createElement(ce,{text:x,onClick:E,isProtected:m,isHidden:!!d.$b&&!c,isForVideo:y&&!M}))})));function Ie(e,t,n,s){return e?a.ZP.createElement("div",{style:"position: relative;"},s&&a.ZP.createElement("div",{onContextMenu:Z.Z,className:"protector"}),a.ZP.createElement("img",{src:e,alt:"",className:(0,W.Z)(s&&"is-protected"),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(le.Z,{color:"white"}))}function ye(){return ye=Object.assign?Object.assign.bind():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},ye.apply(this,arguments)}const{easeOutCubic:Se,easeOutQuart:ke}=K.M8,Ne=d.$b?40:0,we=350;let Me,Te;var Ae;!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(Ae||(Ae={}));const Re=(0,a.X$)((e=>{let{mediaId:t,getMediaId:n,selectMedia:s,isVideo:i,isGif:r,isPhoto:o,isOpen:l,hasFooter:c,zoomLevelChange:m,animationLevel:u,isHidden:h,...P}=e;const Z=(0,a.sO)(null),v=(0,a.sO)(null),p=(0,a.sO)({x:0,y:0,scale:1}),g=(0,a.sO)({x:0,y:0,scale:1}),E=(0,a.sO)(void 0),C=(0,a.sO)(!0),f=(0,a.sO)(!1),[b,I]=(0,a.eJ)(t),S=(0,T.Z)(m),k=void 0!==S&&S!==m,N=(0,y.Z)(),[w,A]=(0,a.eJ)(!1),R=(()=>{const[e,t]=(0,a.eJ)(!1);return(0,a.d4)((()=>{const e=()=>{t(function(){const e=oe();return Boolean(e&&document[e])}())};return document.addEventListener("fullscreenchange",e,!1),document.addEventListener("webkitfullscreenchange",e,!1),document.addEventListener("mozfullscreenchange",e,!1),()=>{document.removeEventListener("fullscreenchange",e,!1),document.removeEventListener("webkitfullscreenchange",e,!1),document.removeEventListener("mozfullscreenchange",e,!1)}}),[]),e})(),[L,F]=(0,a.eJ)(!1),{height:x,width:B,isResizing:O}=(0,se.Z)(),{onClose:D}=P,U=(0,M.Z)();(0,ie.Z)({isActive:l,onBack:D,shouldBeReplaced:!0});const $=(0,a.I4)((e=>{p.current=e,N()}),[N]),_=(0,ne.Z)(s,[],350,!0),G=(0,ne.Z)((()=>{E.current=void 0}),[],500,!0),j=(0,ne.Z)((e=>{C.current=e,N()}),[N],800,!0),V=r&&!d.cj,z=d.$b?40:B/10,J=(0,a.I4)((e=>{if(!d.$b)return;const t=x-e.pageY<80;!t&&e.pageX<z||!t&&e.pageX>B-z||A(!w)}),[z,w,x,B]);if((0,ae.Z)((()=>A(!0)),450),(0,a.d4)((()=>{I(t)}),[t]),(0,a.d4)((()=>{if(!Z.current||void 0===b||h||R)return;let e=g.current;const t={x:0,y:0},a={x:0,y:0},s={x:0,y:0};let i,r,o=Date.now();const l=(0,te.Ds)((()=>{o=Date.now()}),500,!1,!0),c=t=>{const a=n(b,t);if(void 0!==a){const n=(B+Ne)*t;return p.current.x+=n,C.current=!1,I(a),_(a),j(!0),e={x:0,y:0,scale:1},0===u?($(e),!0):(Me=(0,K.vr)({from:p.current.x,to:0,duration:we,timing:Se,onUpdate:e=>$({y:0,x:e,scale:1})}),!0)}return!1},m=e=>{if(1!==p.current.scale)return[!1,!1];if(e.target.closest("div.VideoPlayerControls"))return[!1,!1];let t=0;return x-e.pageY<80?[!1,!1]:(e.pageX<z?t=-1:e.pageX>B-z&&(t=1),[0!==t,c(t)])},P=e=>{if(1===p.current.scale)switch(e.key){case"Left":case"ArrowLeft":c(-1);break;case"Right":case"ArrowRight":c(1)}},y=function(e){let{x:t,y:n,scale:a}=e,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!i)return[{x:t,y:n,scale:a},!0,!0];let r=!0,o=!0;const l=(B-B*a)/2,c=(x-x*a)/2,d=Math.max(-i.left*a,l),m=B-i.right*a;r=(0,ee.Kh)(t,m,d),t=(0,ee.uZ)(t,m,d);const u=Math.max(-i.top*a+s,c),h=x-i.bottom*a;return o=(0,ee.Kh)(n,h,u),n=(0,ee.uZ)(n,h,u),[{x:t,y:n,scale:a},r,o]},S=i=>{if(f.current)return void(f.current=!1);"mouseup"===i.type&&F(!1);const r=Math.abs(p.current.x),l=Math.abs(p.current.y),{scale:c,x:d,y:m}=p.current;if(G(),j(!0),c<1)return e={x:0,y:0,scale:1},void(Me=(0,K.vr)({from:[d,m,c],to:[0,0,1],duration:we,timing:Se,onUpdate:e=>$({x:e[0],y:e[1],scale:e[2]})}));if(c>1){const n=Math.min(c,4),r=n/c;let l=d*r+(a.x-r*a.x),u=m*r+(a.y-r*a.y);const h=.15;if("wheel"!==i.type&&e.scale===c){const e=Math.abs(t.x)/(Date.now()-o),n=Math.abs(t.y)/(Date.now()-o);l-=Math.abs(t.x)*e*h*s.x,u-=Math.abs(t.y)*n*h*s.y}return[e]=y({x:l,y:u,scale:n},60),void(Me=(0,K.vr)({from:[d,m,c],to:[e.x,e.y,e.scale],duration:we,timing:Se,onUpdate:e=>$({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:d,y:m,scale:c},l>=50)return void D();if(l>0)return void(Me=(0,K.vr)({from:m,to:0,duration:we,timing:Se,onUpdate:e=>$({x:0,y:e,scale:c})}));const u=d<0?1:-1,h=n(b,d<0?1:-1),P=s.x<0?-1:1;if(void 0!==h&&r>=50&&u===P){const e=(B+Ne)*u;p.current.x+=e,I(h),_(h)}Me=(0,K.vr)({from:p.current.x,to:0,duration:we,timing:Se,onUpdate:e=>{var t;return $({y:0,x:e,scale:null!==(t=p.current?.scale)&&void 0!==t?t:1})}})},k=(0,Q.sf)(Z.current,{isNotPassive:!0,withNativeDrag:!0,excludedClosestSelector:".MediaViewerFooter, .ZoomControls",minZoom:1,maxZoom:4,doubleTapZoom:3,onCapture:e=>{if(xe(e))return;if("mousedown"===e.type&&(F(!0),1!==p.current.scale))return void e.preventDefault();o=Date.now();const{x:t,y:n,scale:a}=p.current;if(0===t&&0===n&&1===a){if(!v.current)return;if(r=v.current.querySelector("img, video"),!r)return;i=r.getBoundingClientRect()}},onDrag:(n,a,i,r)=>{let{dragOffsetX:o,dragOffsetY:c}=i;if(f.current||xe(n))return;if(d.cj&&"touchstart"===a.type){const{pageX:e}=a.touches[0];if(e<=Q.vJ||e>=B-Q.vJ)return}Me&&(Me(),Me=void 0),s.x=t.x-o,s.y=t.y-c,t.x=o,t.y=c;const m=Math.abs(o),u=Math.abs(c),{scale:h,x:P,y:Z}=p.current;if(l(),1===h){if("mousemove"!==n.type){if(E.current!==Ae.Vertical&&(E.current===Ae.Horizontal||Math.abs(P)>10||m/u>1.5)){E.current=Ae.Horizontal,C.current=!1;const e=B+Ne,t=(0,ee.uZ)(o,-e,e);return $({x:t,y:0,scale:h}),void("wheel"===n.type&&Math.abs(t)>100&&(S(n),f.current=!0))}if(E.current===Ae.Vertical||Math.abs(Z)>10||u/m>1.5){E.current=Ae.Vertical;const e=x,t=(0,ee.uZ)(c,-e,e);$({x:0,y:t,scale:h}),"wheel"===n.type&&Math.abs(t)>100&&(S(n),f.current=!0)}}}else{const t=e.x+o,a=e.y+c;if(["wheel","mousemove"].includes(n.type)){const[e,n,s]=y({x:t,y:a,scale:h},60);return r&&r(!n,!s),void $(e)}"touches"in n&&1===n.touches.length&&$({x:t,y:a,scale:h})}},onZoom:(t,n)=>{let{zoom:s,zoomFactor:i,initialCenterX:r,initialCenterY:o,dragOffsetX:l,dragOffsetY:c,currentCenterX:d,currentCenterY:m}=n;Me&&Me(),r=r||B/2,o=o||x/2,d=d||B/2,m=m||x/2;const u=null!=s?s:(0,ee.uZ)(e.scale*i,.5,12),h=u/e.scale,P=Math.abs(Math.min(e.x,0)),Z=Math.abs(Math.min(e.y,0));a.x=d,a.y=m;const v=P+r,p=Z+o,g=v-h*v,E=p-h*p,[C]=y({x:e.x+g+l,y:e.y+E+c,scale:u});$(C)},onClick(t){F(!1);const[n,a]=m(t);if(n){if(t.preventDefault(),t.stopPropagation(),d.$b)return;a||D()}else 1!==e.scale||d.$b||!V&&Fe(t.target,".VideoPlayer")||D()},onDoubleClick(t,n){let{centerX:a,centerY:s}=n;const[i]=m(t);if(i)return t.preventDefault(),void t.stopPropagation();if(!d.$b&&"wheel"!==t.type)return;const{x:r,y:o,scale:l}=p.current;if(1===l){if(0!==r||0!==o)return;e=y({x:a-3*a,y:s-3*s,scale:3})[0]}else e={x:0,y:0,scale:1};Me=(0,K.vr)({from:[r,o,l],to:[e.x,e.y,e.scale],duration:we,timing:Se,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};$(t)}})},onRelease:S});return document.addEventListener("keydown",P,!1),()=>{k(),document.removeEventListener("keydown",P,!1)}}),[D,$,n,b,B,x,z,V,_,j,G,u,F,h,R]),(0,a.d4)((()=>{if(!Z.current||!k||h||R)return;const{scale:e}=p.current,t=m>0?-1:1;let n=100,a=0;e<=.6&&t>0||e>=12&&t<0||(1===e&&t>0&&(n=20),Te&&Te(),Te=(0,K.vr)({from:t,to:t*n,duration:we,timing:ke,onUpdate:e=>{if(!Z.current)return;const t=(0,ee.NM)(e-a,2);a=e;const n=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});Z.current.dispatchEvent(n)}}))}),[m,k,h,R]),void 0===b)return;const X=n(b,1),H=n(b,-1),q=void 0!==H,Y=void 0!==X,re=p.current.x,le=p.current.y,{scale:ce}=p.current,de=L&&ce>1;return a.ZP.createElement("div",{className:"MediaViewerSlides",ref:Z},q&&1===ce&&!O&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:Le(-B+re-Ne)},a.ZP.createElement(be,ye({},P,{animationLevel:u,isMoving:de,areControlsVisible:w,mediaId:H}))),a.ZP.createElement("div",{className:(0,W.Z)("MediaViewerSlide","MediaViewerSlide--active",de&&"MediaViewerSlide--moving"),onClick:J,ref:v,style:Le(re,le,ce)},a.ZP.createElement(be,ye({},P,{mediaId:b,animationLevel:u,isActive:C.current,setControlsVisible:A,isMoving:de,areControlsVisible:w&&1===ce}))),Y&&1===ce&&!O&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:Le(B+re+Ne)},a.ZP.createElement(be,ye({},P,{animationLevel:u,isMoving:de,areControlsVisible:w,mediaId:X}))),q&&1===ce&&!d.$b&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${i&&!r&&"inline"}`,"aria-label":U("AccDescrPrevious"),dir:U.isRtl?"rtl":void 0}),Y&&1===ce&&!d.$b&&a.ZP.createElement("button",{type:"button",className:`navigation next ${i&&!r&&"inline"}`,"aria-label":U("Next"),dir:U.isRtl?"rtl":void 0}))}));function Le(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return`transform: translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${n.toFixed(3)});`}function Fe(e,t){return!!e&&(!!e.matches(t)||Boolean(e.closest(t)))}function xe(e){const t=e.target;return!!Fe(t,".VideoPlayerControls")&&(Fe(t,".play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu")||e.preventDefault(),!0)}var Be=n(70172);const Oe=(0,i.c$)(((e,t)=>{let{chatId:n,messageId:a,isAvatar:s}=t;const{animationLevel:i}=e.settings.byKey;if(s&&n)return{sender:(0,r.YC)(n)?(0,o.dy)(e,n):(0,o.Z1)(e,n),animationLevel:i};if(!a||!n)return{animationLevel:i};const l=(0,o.hj)(e,n,a);return{message:l,sender:l&&(0,o.Ur)(e,l),animationLevel:i}}))((e=>{let{chatId:t,messageId:n,sender:s,isAvatar:o,message:l,animationLevel:c}=e;const{closeMediaViewer:m,focusMessage:u,toggleChatInfo:h}=(0,i.Sv)(),P=(0,a.I4)((()=>{m(),d.wB?setTimeout((()=>{h(!1,{forceSyncOnIOs:!0}),u({chatId:t,messageId:n})}),350):u({chatId:t,messageId:n})}),[t,u,h,n,m]),Z=(0,M.Z)();if(!s||!l&&!o)return;const v=(0,r.OU)(Z,s);return a.ZP.createElement("div",{className:"SenderInfo",onClick:P},(0,r.YC)(s.id)?a.ZP.createElement(Be.Z,{key:s.id,size:"medium",user:s,animationLevel:c,withVideo:!0}):a.ZP.createElement(Be.Z,{key:s.id,size:"medium",chat:s,animationLevel:c,withVideo:!0}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},v&&(0,J.Z)(v)),a.ZP.createElement("div",{className:"date",dir:"auto"},o?Z("lng_mediaview_profile_photo"):(0,he.ZK)(Z,1e3*l.date,!0))))})),De=350,Ue=(0,a.X$)((0,i.c$)((e=>{const{chatId:t,threadId:n,mediaId:a,avatarOwnerId:i,origin:l,isHidden:c}=e.mediaViewer,{animationLevel:d}=e.settings.byKey,{shouldSkipHistoryAnimations:m,currentUserId:u}=e;let h,P,Z,v=!!t&&(0,o.FM)(e,t);if(l===s.bZ.SearchResult){if(!t||!a)return{animationLevel:d,shouldSkipHistoryAnimations:m};const n=(0,o.hj)(e,t,a);return n?{chatId:t,mediaId:a,senderId:n.senderId,isChatWithSelf:v,origin:l,message:n,animationLevel:d,isHidden:c,shouldSkipHistoryAnimations:m}:{animationLevel:d,shouldSkipHistoryAnimations:m}}if(i){const t=(0,o.dy)(e,i),n=(0,o.Z1)(e,i);let s=!1;return t?s=i===u:n&&(s=(0,r.Nl)(n)),v=(0,o.FM)(e,i),{mediaId:a,senderId:i,avatarOwner:t||n,isChatWithSelf:v,canUpdateMedia:s,animationLevel:d,origin:l,shouldSkipHistoryAnimations:m,isHidden:c}}if(!(t&&n&&a))return{animationLevel:d,shouldSkipHistoryAnimations:m};if(h=l&&[s.bZ.ScheduledAlbum,s.bZ.ScheduledInline].includes(l)?(0,o.Tm)(e,t,a):(0,o.hj)(e,t,a),!h)return{animationLevel:d,shouldSkipHistoryAnimations:m};if(P=l&&[s.bZ.ScheduledAlbum,s.bZ.ScheduledInline].includes(l)?(0,o.Fn)(e,t):(0,o.Zw)(e,t),l===s.bZ.Inline||l===s.bZ.Album)Z=(0,o.qC)(e,t,n)||(0,o.gb)(e,t,n);else if(l===s.bZ.SharedMedia){const t=(0,o.we)(e),{foundIds:n}=t&&t.resultsByType&&t.resultsByType.media||{};Z=n}return{chatId:t,threadId:n,mediaId:a,senderId:h.senderId,isChatWithSelf:v,origin:l,message:h,chatMessages:P,collectionIds:Z,animationLevel:d,isHidden:c,shouldSkipHistoryAnimations:m}}))((e=>{let{chatId:t,threadId:n,mediaId:o,senderId:Z,isChatWithSelf:k,canUpdateMedia:N,origin:A,avatarOwner:R,message:L,chatMessages:F,collectionIds:x,animationLevel:B,isHidden:O,shouldSkipHistoryAnimations:j}=e;const{openMediaViewer:V,closeMediaViewer:z,openForwardMenu:J,focusMessage:X,toggleChatInfo:H}=(0,i.Sv)(),q=Boolean(R||o),K=(0,a.sO)(),W=(0,T.Z)(Z),Q=2===B?"slide-fade":"none",ee=2===B&&!j,[te,ne,ae]=(0,I.Z)(),[se,ie]=(0,a.eJ)(1),{webPagePhoto:re,webPageVideo:oe,isVideo:le,isPhoto:ce,bestImageData:de,bestData:me,dimensions:ue,isGif:he,isFromSharedMedia:Pe,avatarPhoto:Ze,fileName:ve}=D({message:L,avatarOwner:R,mediaId:o,origin:A,delay:ee&&De}),pe=!!Ze&&!k,ge=!O&&q,Ee=re||oe?o:void 0,Ce=(0,a.Ye)((()=>Ee?[Ee]:R?R.photos?.map(((e,t)=>t))||[]:(0,r.N0)(F||{},x||[],Pe)),[Ee,R,F,x,Pe]),fe=o?Ce.indexOf(o):-1;!q||W&&W===Z&&K.current||(K.current=fe),(0,a.d4)((()=>{if(q)return(0,P.l_)(),P.In}),[q]),(0,a.d4)((()=>{ge&&w()}),[ge]),(0,a.d4)((()=>{d.wB&&document.body.classList.toggle("is-media-viewer-open",q),d.$b&&document.body.classList.toggle("no-selection",q)}),[q]);const be=(0,y.Z)();(0,a.d4)((()=>{const e=window.matchMedia(u.L6);return"function"==typeof e.addEventListener?e.addEventListener("change",be):"function"==typeof e.addListener&&e.addListener(be),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",be):"function"==typeof e.removeListener&&e.removeListener(be)}}),[be]);const Ie=(0,T.Z)(L),ye=(0,T.Z)(O),Se=(0,T.Z)(A),ke=(0,T.Z)(o),Ne=(0,T.Z)(R),we=(0,T.Z)(de),Me=L?(0,b.X)(L):void 0,Te=Boolean(Me),Ae=ye&&ke!==o;(0,a.d4)((()=>{!ee||!q||Ie&&!Ae||Ne||((0,S.YW)(De+m.fK),function(e,t,n,a,i,r){const{mediaEl:o}=C(t,r);if(!o)return;const{width:l}=h.Z.get(),{width:c,height:P}=(0,u.fM)(e,i),{width:Z,height:v}=(0,u.jg)(c,P,a.width,a.height),g=(l-Z)/2,b=function(e){const t=window.matchMedia(u.L6);let n=4.125;return e&&!d.$b&&(n+=t.matches?.875:2.125),n*u.Gw}(e)+(P-v)/2;let{top:I,left:y,width:S,height:k}=o.getBoundingClientRect();if([s.bZ.SharedMedia,s.bZ.Album,s.bZ.ScheduledAlbum,s.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,i){if(e===t){const r=Math.max(s,i)*(e/t);a-=(r-s)/2,n-=(r-i)/2,s=r,i=r}else if(e>t){const n=s;a-=((s=i*(e/t))-n)/2}else if(t>e){const a=i;n-=((i=s*(t/e))-a)/2}return{top:n,left:a,width:s,height:i}}(Z,v,I,y,S,k);I=e.top,y=e.left,S=e.width,k=e.height}const N=y+S/2-(g+Z/2),w=I+k/2-(b+v/2),M=S/Z,T=k/v,A=p(n||o);E(A,{top:`${b}px`,left:`${g}px`,width:`${Z}px`,height:`${v}px`,transform:`translate3d(${N}px, ${w}px, 0) scale(${M}, ${T})`}),f(A,t),document.body.classList.add("ghost-animating"),requestAnimationFrame((()=>{document.body.appendChild(A),requestAnimationFrame((()=>{A.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(A),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(A)&&document.body.removeChild(A),document.body.classList.remove("ghost-animating")}))}),200+m.fK)}))}))}(Te,A,de,ue,le,L)),ee&&!q&&(Ie||Ne)&&((0,S.YW)(De+m.fK),function(e,t,n){const{container:a,mediaEl:i}=C(e,n);if(!i)return;const r=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!r||!i)return;const{top:o,left:l,width:c,height:d}=r.getBoundingClientRect(),{top:u,left:P,width:Z,height:b}=i.getBoundingClientRect();let I=u;if(!(0,v.P)(a)){const{height:e}=h.Z.get();I=u<o?-b:e}const y=l+c/2-(P+Z/2),S=o+d/2-(I+b/2);let k=c/Z,N=d/b;const w=[s.bZ.Inline,s.bZ.ScheduledInline].includes(e)&&!g(a,i)||[s.bZ.Album,s.bZ.ScheduledAlbum].includes(e)&&!g(a,i);[s.bZ.SharedMedia,s.bZ.Album,s.bZ.ScheduledAlbum,s.bZ.SearchResult].includes(e)&&(k>N?k=N:N>k&&(N=k));const M=document.getElementsByClassName("ghost")[0],T=M||p(t||i,e);M||E(T,{top:`${I}px`,left:`${P}px`,width:`${Z}px`,height:`${b}px`,transform:`translate3d(${y}px, ${S}px, 0) scale(${k}, ${N})`}),requestAnimationFrame((()=>{if(M){const{top:e,left:t,width:n,height:a}=M.getBoundingClientRect();E(T,{transition:"none",top:`${I}px`,left:`${P}px`,transformOrigin:"top left",transform:`translate3d(${t-P}px, ${e-I}px, 0) scale(${n/Z}, ${a/b})`,width:`${Z}px`,height:`${b}px`})}document.body.classList.add("ghost-animating"),M||document.body.appendChild(T),requestAnimationFrame((()=>{M&&(M.style.transition=""),T.style.transform="",w&&(T.style.opacity="0"),f(T,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(T)&&document.body.removeChild(T),document.body.classList.remove("ghost-animating")}))}),200+m.fK)}))}))}(Se,we,Ie||void 0))}),[ee,q,Ae,A,Se,L,Ie,Ne,de,we,ue,le,Te]);const Le=(0,a.I4)((()=>z()),[z]),Fe=(0,a.I4)((()=>{Le(),d.wB?setTimeout((()=>{H(!1,{forceSyncOnIOs:!0}),X({chatId:t,threadId:n,mediaId:o})}),De):X({chatId:t,threadId:n,mediaId:o})}),[Le,t,n,X,H,o]),xe=(0,a.I4)((()=>{J({fromChatId:t,messageIds:[o]})}),[J,t,o]),Be=(0,a.I4)((e=>{V({chatId:t,threadId:n,mediaId:e,avatarOwnerId:R?.id,origin:A},{forceOnHeavyAnimation:!0})}),[R?.id,t,V,A,n]);(0,a.d4)((()=>q?(0,c.Z)((()=>{Le()})):void 0),[Le,q]),(0,a.d4)((()=>{le&&!he&&(0,l.Es)()}),[he,le]),(0,a.d4)((()=>{if(q)return h.Z.disableRefresh(),()=>{h.Z.enableRefresh()}}),[q]);const Ue=(0,a.I4)(((e,t)=>{if(void 0===e)return;const n=Ce.indexOf(e);return-1===t&&n>0||1===t&&n<Ce.length-1?Ce[n+t]:void 0}),[Ce]),$e=(0,a.I4)((()=>{if(Ce.length<=1)return void Le();let e=o?Ce.indexOf(o):-1;e=e>0?e-1:0,Be(Ce[e])}),[Le,o,Ce,Be]),_e=(0,M.Z)();return a.ZP.createElement(_.Z,{id:"MediaViewer",isOpen:q,isHidden:O,noCloseTransition:j},a.ZP.createElement("div",{className:"media-viewer-head",dir:_e.isRtl?"rtl":void 0},d.wB&&a.ZP.createElement($.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:_e("Close"),onClick:Le},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(G.Z,{activeKey:K.current,name:Q},R?a.ZP.createElement(Oe,{key:o,chatId:R.id,isAvatar:!0}):a.ZP.createElement(Oe,{key:o,chatId:t,messageId:o})),a.ZP.createElement(Y,{mediaData:me,isVideo:le,message:L,canUpdateMedia:N,avatarPhoto:Ze,avatarOwner:R,fileName:ve,canReport:pe,selectMedia:Be,onBeforeDelete:$e,onReport:ne,onCloseMediaViewer:Le,onForward:xe,zoomLevelChange:se,setZoomLevelChange:ie}),a.ZP.createElement(U.Z,{isOpen:te,onClose:ae,subject:"media",photo:Ze,chatId:R?.id})),a.ZP.createElement(Re,{mediaId:o,getMediaId:Ue,chatId:t,isPhoto:ce,isGif:he,threadId:n,avatarOwnerId:R?.id,origin:A,isOpen:q,hasFooter:Te,zoomLevelChange:se,isVideo:le,animationLevel:B,onClose:Le,selectMedia:Be,isHidden:O,onFooterClick:Fe}))})));var $e=n(60782),_e=n(27407),Ge=n(72313),je=n(12515),Ve=n(34288),ze=n(97687),Je=n(21273),Xe=n(31876),He=n(98799),qe=n(6058);const Ye=(0,a.X$)((e=>{let{isOpen:t,currentUserId:n,chatOrUserIds:s,search:i,searchPlaceholder:o,loadMore:l,onSearchChange:c,onSelectChatOrUser:d,onClose:u,onCloseAnimationEnd:h}=e;const P=(0,M.Z)(),[Z,v]=(0,_e.Z)(l,s,Boolean(i)),p=(0,a.sO)(null),g=(0,a.I4)((()=>{c("")}),[c]);(0,je.Z)(p,t,g);const E=(0,a.sO)(null),C=(0,a.I4)((e=>{c(e.currentTarget.value)}),[c]),f=(0,Ge.Z)(E,t,(e=>{Z&&Z.length>0&&d(Z[-1===e?0:e])}),".ListItem-button",!0),b=a.ZP.createElement("div",{className:"modal-header",dir:P.isRtl?"rtl":void 0},a.ZP.createElement($.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:P("Close"),onClick:u},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(ze.Z,{ref:p,value:i,onChange:C,onKeyDown:f,placeholder:o})),I=s.indexOf(Z[0]);return a.ZP.createElement(X.Z,{isOpen:t,className:"ChatOrUserPicker",header:b,onClose:u,onCloseAnimationEnd:h},Z?.length?a.ZP.createElement(Je.Z,{ref:E,className:"picker-list custom-scroll",items:Z,onLoadMore:v,withAbsolutePositioning:!0,maxHeight:s.length*m.rS,onKeyDown:f},Z.map(((e,t)=>a.ZP.createElement(Xe.Z,{key:e,className:"chat-item-clickable force-rounded-corners small-icon",style:`top: ${(I+t)*m.rS}px;`,onClick:()=>d(e)},(0,r.YC)(e)?a.ZP.createElement(qe.Z,{status:e===n?P("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(He.Z,{chatId:e}))))):Z&&!Z.length?a.ZP.createElement("p",{className:"no-results"},P("lng_blocked_list_not_found")):a.ZP.createElement(Ve.Z,null))}));var Ke=n(18360);const We=(0,a.X$)((0,i.c$)((e=>{const{chats:{byId:t,listIds:n,orderedPinnedIds:a},currentUserId:s}=e;return{chatsById:t,activeListIds:n.active,archivedListIds:n.archived,pinnedIds:a.active,contactIds:e.contactList?.userIds,currentUserId:s}}))((e=>{let{isOpen:t,currentUserId:n,chatsById:s,activeListIds:l,archivedListIds:c,pinnedIds:d,contactIds:u,filter:h=m.F9,searchPlaceholder:P,loadMore:Z,onSelectRecipient:v,onClose:p,onCloseAnimationEnd:g}=e;const E=(0,M.Z)(),[C,f]=(0,a.eJ)(""),b=(0,a.Ye)((()=>{if(!t)return;let e=d||[];n&&(e=(0,$e.Tw)([n,...e]));const a=(0,i.Rd)(),m=a.users.byId,P=[...l||[],...C&&c||[]].filter((e=>{const t=s[e],n=m[e];return(!n||!(0,r.NB)(n))&&t&&(0,r.Qm)(t,A._f)})),Z=(0,r.ih)((0,$e.Tw)([...(0,r.$l)(E,P,s,C,n),...u&&h.includes("users")?(0,r.kK)(u,m,C):[]]),s,void 0,e);return(0,o.JR)(a,Z,h)}),[d,n,l,C,c,E,s,u,h,t]),I=(0,Ke.Z)(b,!0);return a.ZP.createElement(Ye,{isOpen:t,chatOrUserIds:I,searchPlaceholder:P,search:C,onSearchChange:f,loadMore:Z,onSelectChatOrUser:v,onClose:p,onCloseAnimationEnd:g})}))),Qe=(0,a.X$)((0,i.c$)((e=>({currentUserId:e.currentUserId,isManyMessages:(e.forwardMessages.messageIds?.length||0)>1})))((e=>{let{isOpen:t,currentUserId:n,isManyMessages:s}=e;const{setForwardChatId:r,exitForwardMode:o,forwardToSavedMessages:l,showNotification:c}=(0,i.Sv)(),d=(0,M.Z)(),[m,u,h]=(0,I.Z)();(0,a.d4)((()=>{t&&u()}),[t,u]);const P=(0,a.I4)((e=>{e===n?(l(),c({message:d(s?"Conversation.ForwardTooltip.SavedMessages.Many":"Conversation.ForwardTooltip.SavedMessages.One")})):r({id:e})}),[n,l,s,d,r,c]),Z=(0,a.I4)((()=>{o()}),[o]);if(t||m)return a.ZP.createElement(We,{isOpen:t,searchPlaceholder:d("ForwardTo"),onSelectRecipient:P,onClose:Z,onCloseAnimationEnd:h})}))),et=(0,a.X$)((e=>{let{requestedDraft:t}=e;const n=Boolean(t&&!t.chatId),{openChatWithDraft:s,resetOpenChatWithDraft:r}=(0,i.Sv)(),o=(0,M.Z)(),[l,c,d]=(0,I.Z)();(0,a.d4)((()=>{n&&c()}),[n,c]);const m=(0,a.I4)((e=>{s({chatId:e,text:t.text,files:t.files})}),[s,t]),u=(0,a.I4)((()=>{r()}),[r]);if(n||l)return a.ZP.createElement(We,{isOpen:n,searchPlaceholder:o("ForwardTo"),onSelectRecipient:m,onClose:u,onCloseAnimationEnd:d})})),tt=(0,a.X$)((e=>{let{requestedAttachBotInChat:t}=e;const{cancelAttachBotInChat:n,callAttachBot:s}=(0,i.Sv)(),r=(0,M.Z)(),o=Boolean(t),[l,c,d]=(0,I.Z)();(0,a.d4)((()=>{o&&c()}),[o,c]);const{botId:m,filter:u,startParam:h}=t||{},P=(0,a.I4)((e=>{s({botId:m,chatId:e,startParam:h}),n()}),[m,s,n,h]);if(o||l)return a.ZP.createElement(We,{isOpen:o,searchPlaceholder:r("Search"),filter:u,onSelectRecipient:P,onClose:n,onCloseAnimationEnd:d})}));var nt=n(91947);function at(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const st=(0,a.X$)((0,i.c$)((e=>({dialogs:e.dialogs,animationLevel:e.settings.byKey.animationLevel})))((e=>{let{dialogs:t,animationLevel:n}=e;const{dismissDialog:s,acceptInviteConfirmation:r,sendMessage:o,showNotification:l}=(0,i.Sv)(),[c,d,m]=(0,I.Z)(),u=(0,M.Z)();var h,P,Z;if((0,a.d4)((()=>{t.length>0&&d()}),[t,d]),t.length)return a.ZP.createElement("div",{id:"Dialogs"},Boolean(t.length)&&("hash"in(h=t[t.length-1])?(e=>{const{hash:t,title:n,about:i,participantsCount:o,isChannel:d,photo:h,isRequestNeeded:P}=e,Z=u(d?"Subscribers":"Members",o,"i"),p=u(d?"ChannelJoin":"JoinGroup"),g=u(d?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup");return a.ZP.createElement(X.Z,{isOpen:c,onClose:m,className:"error",header:v(n,h),onCloseAnimationEnd:s},void 0!==o&&a.ZP.createElement("p",{className:"modal-help"},Z),i&&a.ZP.createElement("p",{className:"modal-about"},(0,J.Z)(i,["br"])),P&&a.ZP.createElement("p",{className:"modal-help"},u(d?"MemberRequests.RequestToJoinDescriptionChannel":"MemberRequests.RequestToJoinDescriptionGroup")),a.ZP.createElement($.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{r({hash:t}),P&&l({message:u(d?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),m()}},P?g:p),a.ZP.createElement($.Z,{isText:!0,className:"confirm-dialog-button",onClick:m},u("Cancel")))})(h):"phoneNumber"in h?(P=h,a.ZP.createElement(X.Z,{isOpen:c,onClose:m,className:"confirm",title:u("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:s},u("AreYouSureShareMyContactInfoBot"),a.ZP.createElement("div",null,a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:()=>{o({contact:(0,$e.ei)(P,["firstName","lastName","phoneNumber"])}),m()}},u("OK")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},u("Cancel"))))):(Z=h,a.ZP.createElement(X.Z,{isOpen:c,onClose:m,onCloseAnimationEnd:s,className:"error",title:at(Z)},Z.hasErrorKey?(0,nt.ZP)(Z):(0,J.Z)(Z.message,["simple_markdown","emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement($.Z,{isText:!0,onClick:m},u("OK")))))));function v(e,t){return a.ZP.createElement("div",{className:"modal-header"},t&&a.ZP.createElement(Be.Z,{size:"small",photo:t,animationLevel:n,withVideo:!0}),a.ZP.createElement("div",{className:"modal-title"},(0,J.Z)(e)),a.ZP.createElement($.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:u("Close"),onClick:m},a.ZP.createElement("i",{className:"icon-close"})))}})));var it=n(96937);const rt=(0,a.X$)((0,i.c$)((e=>(0,$e.ei)(e,["notifications"])))((e=>{let{notifications:t}=e;const{dismissNotification:n}=(0,i.Sv)();if(t.length)return a.ZP.createElement("div",{id:"Notifications"},t.map((e=>{let{message:t,className:s,localId:i,action:r,actionText:o,title:l}=e;return a.ZP.createElement(it.Z,{title:l?(0,J.Z)(l,["simple_markdown","emoji","br","links"]):void 0,action:r,actionText:o,className:s,message:(0,J.Z)(t,["simple_markdown","emoji","br","links"]),onDismiss:()=>n({localId:i})})})))})));var ot=n(81396),lt=n(17551);const ct=(0,a.X$)((e=>{let{url:t}=e;const{toggleSafeLinkModal:n}=(0,i.Sv)(),s=(0,M.Z)(),r=(0,a.I4)((()=>{window.open((0,ot.X)(t),"_blank","noopener"),n({url:void 0})}),[n,t]),o=(0,a.I4)((()=>{n({url:void 0})}),[n]),l=(0,Ke.Z)(t);return a.ZP.createElement(lt.Z,{isOpen:Boolean(t),onClose:o,title:s("OpenUrlTitle"),textParts:(0,J.Z)(s("OpenUrlAlert2",l),["links"]),confirmLabel:s("OpenUrlTitle"),confirmHandler:r})}));var dt=n(14605);const mt="XxZ7KIBUQzsSYf8KZiIc",ut=(0,a.X$)((e=>{let{urlAuth:t,currentUser:n}=e;const{closeUrlAuthModal:s,acceptBotUrlAuth:o,acceptLinkUrlAuth:l}=(0,i.Sv)(),[c,d]=(0,a.eJ)(!0),[m,u]=(0,a.eJ)(!0),h=(0,Ke.Z)(t,!1),{domain:P,botId:Z,shouldRequestWriteAccess:v}=h?.request||{},p=Z?(0,i.Rd)().users.byId[Z]:void 0,g=(0,M.Z)(),E=(0,a.I4)((()=>{t?.url&&c?(t.button?o:l)({isWriteAllowed:m}):window.open((0,ot.X)(h?.url),"_blank","noopener"),s()}),[t,c,s,o,l,m,h]),C=(0,a.I4)((()=>{s()}),[s]),f=(0,a.I4)((e=>{d(e),u(e)}),[d]);return(0,a.d4)((()=>{P&&(d(!0),u(Boolean(v)))}),[v,P]),a.ZP.createElement(lt.Z,{isOpen:Boolean(t?.url),onClose:C,title:g("OpenUrlTitle"),confirmLabel:g("OpenUrlTitle"),confirmHandler:E},(0,J.Z)(g("OpenUrlAlert2",h?.url),["links"]),P&&a.ZP.createElement(dt.Z,{checked:c,label:a.ZP.createElement(a.ZP.Fragment,null,(0,J.Z)(g("Conversation.OpenBotLinkLogin",[P,(0,r.Js)(n)]),["simple_markdown"])),onCheck:f,className:mt}),v&&a.ZP.createElement(dt.Z,{checked:m,label:a.ZP.createElement(a.ZP.Fragment,null,(0,J.Z)(g("Conversation.OpenBotLinkAllowMessages",(0,r.Js)(p)),["simple_markdown"])),onCheck:u,disabled:!c,className:mt}))})),ht=2147483647e3,Pt=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function Zt(e,t,n,a,s){const i=new Date(e,t,n),r=a&&(0,he.$Y)(a),o=s&&(0,he.$Y)(s);return!!(o&&i>o)||!!(r&&i<r)}function vt(e){return String(e).padStart(2,"0")}function pt(e,t,n){return`${e}-${t+1}-${n}`}const gt=(0,a.X$)((e=>{let{selectedAt:t,minAt:n,maxAt:s,isFutureMode:i,isPastMode:r,isOpen:o,withTimePicker:l,submitButtonLabel:c,secondButtonLabel:d,onClose:m,onSubmit:u,onSecondButtonClick:h}=e;const P=(0,M.Z)(),Z=new Date,v=(0,a.Ye)((()=>i&&!n?new Date:new Date(Math.max(n||0,0))),[i,n]),p=(0,a.Ye)((()=>r&&!s?new Date:new Date(Math.min(s||ht,ht))),[r,s]),g=(0,a.Ye)((()=>t?new Date(t):new Date),[t]),E=(0,T.Z)(o),[C,f,b]=(0,I.Z)(!1),[y,S]=(0,a.eJ)(g),[k,N]=(0,a.eJ)(new Date(y.getFullYear(),y.getMonth(),1)),[w,A]=(0,a.eJ)(vt(g.getHours())),[R,L]=(0,a.eJ)(vt(g.getMinutes())),F=pt(y.getFullYear(),y.getMonth(),y.getDate()),x=k.getFullYear(),B=k.getMonth();(0,a.d4)((()=>{!E&&o&&(S(g),N(new Date(g.getFullYear(),g.getMonth(),1)),l&&(A(vt(g.getHours())),L(vt(g.getMinutes()))))}),[g,o,E,l]),(0,a.d4)((()=>{i&&!C&&y.getTime()<v.getTime()&&(S(v),A(vt(v.getHours())),L(vt(v.getMinutes())))}),[i,C,v,y]),(0,a.d4)((()=>{r&&!C&&y.getTime()>p.getTime()&&(S(p),A(vt(p.getHours())),L(vt(p.getMinutes())))}),[i,r,C,p,v,y]),(0,a.d4)((()=>{if(t){const e=new Date(t);S(e),A(vt(e.getHours())),L(vt(e.getMinutes()))}}),[t]);const O=r&&x>=Z.getFullYear()&&B>=Z.getMonth()||p&&x>=p.getFullYear()&&B>=p.getMonth(),D=i&&x<=Z.getFullYear()&&B<=Z.getMonth(),{prevMonthGrid:U,currentMonthGrid:_,nextMonthGrid:G}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],i=new Date;i.setDate(1),i.setMonth(t),i.setFullYear(e);const r=i.getDay()||7,o=new Date(e,t,0).getDate();for(let e=1;e<r;e++)n.push(o-r+e+1);for(;i.getMonth()===t;){const e=i.getDate();a.push(e),i.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}}(x,B)),[B,x]),j=(0,a.Ye)((()=>c||function(e,t){const n=(0,he.xH)(t,e.code);return n===(0,he.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,he.mr)(e,t)):e("Conversation.ScheduleMessage.SendOn",[n,(0,he.mr)(e,t)])}(P,y)),[P,y,c]),V=(0,a.I4)((()=>{u(y)}),[u,y]),z=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return A(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(y.getTime());a.setHours(n),S(a);const s=vt(n);A(s),e.target.value=s}),[y]),J=(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),S(a);const s=vt(n);L(s),e.target.value=s}),[y]);return a.ZP.createElement(X.Z,{isOpen:o,onClose:m,className:"CalendarModal"},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",onClick:m},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h4",null,P(`lng_month${B+1}`)," ",x),a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",disabled:D,onClick:D?void 0:function(){N((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",disabled:O,onClick:O?void 0:function(){N((e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t}))}},a.ZP.createElement("i",{className:"icon-next"})))),a.ZP.createElement("div",{className:"calendar-wrapper"},a.ZP.createElement("div",{className:"calendar-grid"},Pt.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,P(e))))),U.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))),_.map((e=>a.ZP.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void S((e=>{const n=new Date(e);return n.setDate(t),n.setMonth(B),n.setFullYear(x),n}));var t},className:(0,W.Z)("day-button",Zt(x,B,e,v,p)?"disabled":e?"clickable":"",F===pt(x,B,e)&&"selected")},Boolean(e)&&a.ZP.createElement("span",null,e)))),G.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),l&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:w,onChange:z,onFocus:f,onBlur:b}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:R,onChange:J,onFocus:f,onBlur:b})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement($.Z,{onClick:V},j),d&&a.ZP.createElement($.Z,{onClick:h,isText:!0},d)))})),Et=(0,a.X$)((0,i.c$)((e=>({selectedAt:e.historyCalendarSelectedAt})))((e=>{let{isOpen:t,selectedAt:n}=e;const{searchMessagesByDate:s,closeHistoryCalendar:r}=(0,i.Sv)(),o=(0,a.I4)((e=>{s({timestamp:e.valueOf()/1e3}),r()}),[r,s]),l=(0,M.Z)();return a.ZP.createElement(gt,{isOpen:t,selectedAt:n,isPastMode:!0,submitButtonLabel:l("JumpToDate"),onClose:r,onSubmit:o})})));var Ct=n(6272);const ft=(0,a.X$)((0,i.c$)(((e,t)=>{let{userId:n}=t;return{user:n?(0,o.dy)(e,n):void 0,userStatus:n?(0,o.ss)(e,n):void 0,serverTimeOffset:e.serverTimeOffset,phoneCodeList:e.countryList.phoneCodes}}))((e=>{var t,n,s;let{isOpen:o,userId:l,isByPhoneNumber:c,user:m,userStatus:u,phoneCodeList:h,serverTimeOffset:P}=e;const{updateContact:Z,importContact:v,closeNewContactDialog:p}=(0,i.Sv)(),g=(0,M.Z)(),E=(0,Ke.Z)(m),C=(0,Ke.Z)(c),f=(0,a.sO)(null),[b,y,S]=(0,I.Z)(),[k,N]=(0,a.eJ)(null!==(t=E?.firstName)&&void 0!==t?t:""),[w,T]=(0,a.eJ)(null!==(n=E?.lastName)&&void 0!==n?n:""),[A,R]=(0,a.eJ)(null!==(s=E?.phoneNumber)&&void 0!==s?s:""),[L,F]=(0,a.eJ)(!0),x=Boolean(k&&(!c||A));(0,a.d4)((()=>{var e,t,n;o&&(y(),N(null!==(e=E?.firstName)&&void 0!==e?e:""),T(null!==(t=E?.lastName)&&void 0!==t?t:""),R(null!==(n=E?.phoneNumber)&&void 0!==n?n:""),F(!0))}),[o,y,E?.firstName,E?.lastName,E?.phoneNumber]),(0,a.d4)((()=>{!d.$b&&b&&setTimeout((()=>{f.current?.focus()}),200)}),[b]);const B=(0,a.I4)((e=>{N(e.target.value)}),[]),O=(0,a.I4)((e=>{R((0,Ct.WZ)(h,e.target.value))}),[h]),D=(0,a.I4)((e=>{T(e.target.value)}),[]),U=(0,a.I4)((()=>{p(),N(""),T(""),R("")}),[p]),_=(0,a.I4)((()=>{c||!l?v({firstName:k,lastName:w,phoneNumber:A}):Z({userId:l,firstName:k,lastName:w,shouldSharePhoneNumber:L})}),[k,v,c,w,A,L,Z,l]);if(o||b)return a.ZP.createElement(X.Z,{className:"NewContactModal",title:g("NewContact"),isOpen:o,onClose:U,onCloseAnimationEnd:S},E&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"NewContactModal__profile",dir:g.isRtl?"rtl":void 0},a.ZP.createElement(Be.Z,{size:"jumbo",user:E,text:`${k} ${w}`}),a.ZP.createElement("div",{className:"NewContactModal__profile-info"},a.ZP.createElement("p",{className:"NewContactModal__phone-number"},E?.phoneNumber?(0,Ct.WZ)(h,E.phoneNumber):g("MobileHidden")),a.ZP.createElement("span",{className:"NewContactModal__user-status",dir:"auto"},(0,r.Tq)(g,E,u,P)))),a.ZP.createElement(ze.Z,{ref:f,value:k,label:g("FirstName"),tabIndex:0,onChange:B}),a.ZP.createElement(ze.Z,{value:w,label:g("LastName"),tabIndex:0,onChange:D}),a.ZP.createElement("p",{className:"NewContactModal__help-text"},(0,J.Z)(g("NewContact.Phone.Hidden.Text",E?.firstName||""),["emoji","simple_markdown"])),a.ZP.createElement(dt.Z,{checked:L,tabIndex:0,onCheck:F,label:g("lng_new_contact_share")}),a.ZP.createElement("p",{className:"NewContactModal__help-text"},(0,J.Z)(g("AddContact.SharedContactExceptionInfo",E?.firstName)))),C&&a.ZP.createElement("div",{className:"NewContactModal__new-contact",dir:g.isRtl?"rtl":void 0},a.ZP.createElement(Be.Z,{size:"jumbo",text:`${k} ${w}`}),a.ZP.createElement("div",{className:"NewContactModal__new-contact-fieldset"},a.ZP.createElement(ze.Z,{ref:f,value:A,inputMode:"tel",label:g("lng_contact_phone"),tabIndex:0,onChange:O}),a.ZP.createElement(ze.Z,{value:k,label:g("FirstName"),tabIndex:0,onChange:B}),a.ZP.createElement(ze.Z,{value:w,label:g("LastName"),tabIndex:0,onChange:D}))),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement($.Z,{isText:!0,className:"confirm-dialog-button",onClick:U},g("Cancel")),a.ZP.createElement($.Z,{isText:!0,className:"confirm-dialog-button",disabled:!x,onClick:_},g("Done"))))})));var bt=n(18629),It=n(62357);const yt=["allow-scripts","allow-same-origin","allow-popups","allow-forms","allow-modals","allow-storage-access-by-user-activation"].join(" "),St={ok:"OK",cancel:"Cancel",close:"Close"},kt=(0,a.X$)((0,i.c$)(((e,t)=>{let{webApp:n}=t;const{botId:a}=n||{},s=a?e.attachMenu.bots[a]:void 0,i=a?(0,o.dy)(e,a):void 0,r=(0,o.jr)(e),l=(0,o.Pu)(e),{isPaymentModalOpen:c,status:d}=e.payment;return{attachBot:s,bot:i,chat:r,theme:l,isPaymentModalOpen:c,paymentStatus:d}}))((e=>{let{webApp:t,chat:n,bot:s,attachBot:r,theme:o,isPaymentModalOpen:l,paymentStatus:c}=e;const{closeWebApp:u,sendWebViewData:P,prolongWebView:Z,toggleAttachBot:v,openTelegramLink:p,openChat:g,openInvoice:E,setWebAppPaymentSlug:C}=(0,i.Sv)(),[f,b]=(0,a.eJ)(),[y,S]=(0,a.eJ)(!1),[k,N]=(0,a.eJ)((0,bt.BS)().bg_color),[w,A]=(0,a.eJ)((0,bt.BS)().bg_color),[R,L]=(0,a.eJ)(!1),[F,B,O]=(0,I.Z)(!1),[D,U]=(0,a.eJ)(),_=(0,T.Z)(D),G=D||_,z=(0,a.sO)(null),J=(0,M.Z)(),{url:H,buttonText:q,queryId:Y}=t||{},K=Boolean(H),Q=!Y,ee=(0,a.I4)((e=>{const{eventType:t,eventData:n}=e;if("web_app_close"===t&&u(),"web_app_open_invoice"===t&&(C({slug:n.slug}),E({slug:n.slug})),"web_app_open_tg_link"===t&&!l){const e=m.zH+n.path_full;p({url:e}),u()}if("web_app_open_link"===t){const e=n.url;window.open(e,"_blank","noreferrer")}if("web_app_setup_back_button"===t&&S(n.is_visible),"web_app_set_background_color"===t){const e=(0,bt.BS)(),t=(0,bt.Uq)(n.color)?n.color:e.bg_color;N(t)}if("web_app_set_header_color"===t){const e=(0,bt.BS)(),t=e[n.color_key],a=(0,bt.Uq)(t)?t:e.bg_color;A(a)}if("web_app_data_send"===t&&(u(),P({bot:s,buttonText:q,data:n.data})),"web_app_setup_main_button"===t){const e=(0,bt.BS)(),t=(0,bt.Uq)(n.color)?n.color:e.button_color,a=(0,bt.Uq)(n.text_color)?n.text_color:e.text_color;b({isVisible:n.is_visible&&Boolean(n.text?.trim().length),isActive:n.is_active,text:n.text||"",color:t,textColor:a,isProgressVisible:n.is_progress_visible})}if("web_app_setup_closing_behavior"===t&&L(n.need_confirmation),"web_app_open_popup"===t){if(!n.message.trim().length||!n.buttons?.length||n.buttons.length>3)return;U(n)}}),[s,q,u,E,p,P,C,l]),{reloadFrame:te,sendEvent:ne,sendViewport:ae,sendTheme:ie}=((e,t,n,s)=>{const i=(0,a.sO)(!1),r=(0,a.sO)(),o=(0,se.Z)(),l=(0,a.I4)((t=>{if(!e.current)return;const n=e.current;n.src="about:blank",n.addEventListener("load",(()=>{n.src=t}),{once:!0})}),[e]),c=(0,a.I4)((t=>{e.current?.contentWindow&&e.current.contentWindow.postMessage(JSON.stringify(t),"*")}),[e]),d=(0,a.I4)((t=>{if(!e.current)return;const{width:n,height:a}=e.current.getBoundingClientRect();c({eventType:"viewport_changed",eventData:{width:n,height:a,is_expanded:!0,is_state_stable:!t}})}),[c,e]),m=(0,a.I4)((()=>{c({eventType:"theme_changed",eventData:{theme_params:(0,bt.BS)()}})}),[c]),u=(0,a.I4)((e=>{c({eventType:"set_custom_style",eventData:e})}),[c]),h=(0,a.I4)((e=>{if(!i.current)try{const t=JSON.parse(e.data);if("web_app_request_viewport"===t.eventType&&d(o.isResizing),"web_app_request_theme"===t.eventType&&m(),"iframe_ready"===t.eventType){const e=getComputedStyle(document.body).getPropertyValue("--color-scrollbar");u("* {\n scrollbar-width: thin;\n scrollbar-color: %SCROLLBAR_COLOR% transparent;\n}\n\n*::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border-radius: 6px;\n background-color: %SCROLLBAR_COLOR%;\n}\n\n*::-webkit-scrollbar-corner {\n background-color: transparent;\n}".replace(/%SCROLLBAR_COLOR%/g,e))}if("web_app_data_send"===t.eventType){if(!n)return;i.current=!0}s(t)}catch(e){}}),[n,s,u,m,d,o]);return(0,a.d4)((()=>{const{width:e,height:t,isResizing:n}=o;r.current&&r.current.width===e&&r.current.height===t&&!r.current.isResizing||(r.current={width:e,height:t,isResizing:n},d(n))}),[d,o]),(0,a.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),(0,a.d4)((()=>{t&&e.current?.contentWindow?(d(),i.current=!1):r.current=void 0}),[t,d,e]),{sendEvent:c,reloadFrame:l,sendViewport:d,sendTheme:m}})(z,K,Q,ee),re=f?.isVisible&&f.text.trim().length>0;(0,It.Z)((()=>{Z({botId:s.id,queryId:Y,peerId:n.id})}),Y?45e3:void 0,!0);const oe=(0,a.I4)((()=>{ne({eventType:"main_button_pressed"})}),[ne]),ce=(0,a.I4)((()=>{ne({eventType:"settings_button_pressed"})}),[ne]),de=(0,a.I4)((()=>{te(t.url)}),[te,t]),me=(0,a.I4)((()=>{R?B():u()}),[R,B,u]),ue=(0,a.I4)((e=>{U(void 0),ne({eventType:"popup_closed",eventData:{button_id:e}})}),[ne]),he=(0,a.I4)((()=>{ue()}),[ue]);(0,x.Z)((()=>{setTimeout((()=>{ae()}),400)}),[f?.isVisible,ae]),(0,x.Z)((()=>{setTimeout((()=>{ie()}),400)}),[o,ie]),(0,a.d4)((()=>{if(K)return h.Z.disableRefresh(),()=>{h.Z.enableRefresh()}}),[K]),(0,x.Z)((e=>{let[n]=e;l!==n&&t?.slug&&!l&&c&&(ne({eventType:"invoice_closed",eventData:{slug:t.slug,status:c}}),C({slug:void 0}))}),[l,c,ne,C,t]);const Pe=(0,a.I4)((()=>{v({botId:s.id,isEnabled:!r})}),[s,r,v]),Ze=(0,a.I4)((()=>{y?ne({eventType:"back_button_pressed"}):me()}),[me,y,ne]),ve=(0,a.I4)((()=>{g({id:s.id}),u()}),[s,u,g]);(0,a.d4)((()=>{K||(L(!1),O(),U(void 0))}),[O,K]);const pe=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement($.Z,{round:!0,ripple:!d.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]),ge=(0,W.Z)("animated-close-icon",y&&"state-back"),Ee=(0,a.Ye)((()=>a.ZP.createElement("div",{className:"modal-header",style:`background-color: ${w}`},a.ZP.createElement($.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:J(y?"Back":"Close"),onClick:Ze},a.ZP.createElement("div",{className:ge})),a.ZP.createElement("div",{className:"modal-title"},s?.firstName),a.ZP.createElement(j.Z,{className:"web-app-more-menu",trigger:pe,positionX:"right"},n&&s&&n.id!==s.id&&a.ZP.createElement(V.Z,{icon:"bots",onClick:ve},J("BotWebViewOpenBot")),a.ZP.createElement(V.Z,{icon:"reload",onClick:de},J("WebApp.ReloadPage")),s?.isAttachBot&&a.ZP.createElement(V.Z,{icon:r?"stop":"install",onClick:Pe,destructive:Boolean(r)},J(r?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd")),r?.hasSettings&&a.ZP.createElement(V.Z,{icon:"settings",onClick:ce},J("Settings"))))),[J,Ze,s,pe,n,ve,de,r,Pe,ce,y,w,ge]),Ce=(0,T.Z)(f?.color,!0),fe=(0,T.Z)(f?.textColor,!0),be=(0,T.Z)(f&&Boolean(f.isActive),!0),Ie=(0,T.Z)(f?.text,!0),ye=f?.color||Ce,Se=f?.textColor||fe,ke=void 0!==f?.isActive?f.isActive:be,Ne=f?.text||Ie;(0,a.d4)((()=>{if(!K){const e=(0,bt.BS)();b(void 0),S(!1),N(e.bg_color),A(e.bg_color)}}),[K]);const[we,Me]=(0,a.eJ)(!1),[Te,Ae]=(0,a.eJ)(!0),Re=(0,a.sO)();return(0,a.d4)((()=>{Re.current&&clearTimeout(Re.current),re?(Ae(!1),Re.current=setTimeout((()=>{Me(!0)}),250)):(Me(!1),Re.current=setTimeout((()=>{Ae(!0)}),250))}),[Me,re]),a.ZP.createElement(X.Z,{className:"WebAppModal",isOpen:K,onClose:me,header:Ee,hasCloseButton:!0,style:`background-color: ${k}`},K&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("iframe",{className:(0,W.Z)("web-app-frame",we&&"with-button"),src:H,title:`${s?.firstName} Web App`,sandbox:yt,allow:"camera; microphone; geolocation;",allowFullScreen:!0,ref:z}),a.ZP.createElement($.Z,{className:(0,W.Z)("web-app-button",re&&"visible",Te&&"hidden"),style:`background-color: ${ye}; color: ${Se}`,disabled:!ke,onClick:oe},Ne,f?.isProgressVisible&&a.ZP.createElement(le.Z,{color:"white"}))),R&&a.ZP.createElement(lt.Z,{isOpen:F,onClose:O,title:J("lng_bot_close_warning_title"),text:J("lng_bot_close_warning"),confirmHandler:u,confirmIsDestructive:!0,confirmLabel:J("lng_bot_close_warning_sure")}),G&&a.ZP.createElement(X.Z,{isOpen:Boolean(D),title:G.title||" ",onClose:he,hasCloseButton:!0,className:(0,W.Z)("web-app-popup",!G.title?.trim().length&&"without-title")},G.message,a.ZP.createElement("div",{className:"dialog-buttons mt-2"},G.buttons.map((e=>a.ZP.createElement($.Z,{key:e.id||e.text||e.type,color:"destructive"===e.type?"danger":"primary",isText:!0,fluid:!0,size:"smaller",onClick:()=>ue(e.id)},e.text||J(St[e.type])))))))}))),Nt=(0,a.X$)((e=>{let{bot:t,type:n}=e;const{cancelBotTrustRequest:s,markBotTrusted:o}=(0,i.Sv)(),l=(0,M.Z)(),c=(0,T.Z)(t,!1),d=(0,T.Z)(n,!1),m=t||c,u=n||d,h=(0,a.I4)((()=>{o({botId:t.id})}),[o,t]),P=l("game"===u?"AppName":"BotOpenPageTitle"),Z=l("game"===u?"BotPermissionGameAlert":"BotOpenPageMessage",(0,r.Js)(m));return a.ZP.createElement(lt.Z,{isOpen:Boolean(t),onClose:s,confirmHandler:h,title:P,textParts:(0,J.Z)(Z,["br","simple_markdown","emoji"])})})),wt=(0,a.X$)((e=>{let{bot:t}=e;const{cancelAttachBotInstall:n,confirmAttachBotInstall:s}=(0,i.Sv)(),r=(0,M.Z)(),o=(0,Ke.Z)(t?.firstName,!0);return a.ZP.createElement(lt.Z,{isOpen:Boolean(t),onClose:n,confirmHandler:s,title:o,text:r("WebApp.AddToAttachmentText",o)})})),Mt=(0,a.X$)((e=>{let{deleteFolderDialogId:t}=e;const{closeDeleteChatFolderModal:n,deleteChatFolder:s}=(0,i.Sv)(),r=(0,M.Z)(),o=(0,a.I4)((()=>{n(),s({id:t})}),[n,s,t]);return a.ZP.createElement(lt.Z,{isOpen:void 0!==t,onClose:n,text:r("FilterDeleteAlert"),confirmLabel:r("Delete"),confirmHandler:o,confirmIsDestructive:!0})}));var Tt=n(81367),At=n(9937);const Rt="slESyAvUqizX4_EIX_yg",Lt=(0,a.X$)((e=>{let{leftValue:t,rightValue:n,className:s,floatingBadgeIcon:i,rightStyle:r}=e;const o=(0,M.Z)();return a.ZP.createElement("div",{className:(0,W.Z)("qiAkShre9E6R3S_XXL9S",s)},i&&a.ZP.createElement("div",{className:"gIcOQgrfw3soP3cK9s5Q"},a.ZP.createElement("i",{className:(0,W.Z)("y7T3FpaFXDsnPGk6dPmg",i)}),a.ZP.createElement("div",{className:"rQ6ZdKdWi4HVydX6qhWS",dir:o.isRtl?"rtl":void 0},t),a.ZP.createElement("div",{className:"Ip5PkcvyMOnN0RLpXLXO",dangerouslySetInnerHTML:{__html:'<svg width="26" height="9" viewBox="0 0 26 9" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 0H26H24.4853C22.894 0 21.3679 0.632141 20.2426 1.75736L14.4142 7.58579C13.6332 8.36684 12.3668 8.36683 11.5858 7.58579L5.75736 1.75736C4.63214 0.632139 3.10602 0 1.51472 0H0Z" fill="#7E85FF"/></svg>'}})),a.ZP.createElement("div",{className:(0,W.Z)(Rt,"lQi3xqxjvl2Owb4ES2SM")},a.ZP.createElement("div",{className:"kuq7sjJF6mvCc4Y5CXpv X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR",dir:o.isRtl?"rtl":void 0},o("LimitFree")),!i&&a.ZP.createElement("div",{className:"FaVxkFCcMpBfLY74WJZv X0zFAEpRoPWj1yE904xR"},t)),a.ZP.createElement("div",{className:(0,W.Z)(Rt,"Dcv5uphsn2Sxpg3ROS_u"),style:r},a.ZP.createElement("div",{className:"QWqqObtxZyakBzakEoyh X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR",dir:o.isRtl?"rtl":void 0},o("LimitPremium")),a.ZP.createElement("div",{className:"TCdcdr_TxlgpCSBV0ePq X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR"},n)))})),Ft=[91,160,255],xt=[197,100,243],Bt=(0,a.X$)((e=>{let{title:t,description:n,leftValue:s,rightValue:i,colorStepProgress:r}=e;const o=(0,a.Ye)((()=>Ft.map(((e,t)=>(0,ee.t7)(e,xt[t],r)))),[r]);return a.ZP.createElement("div",{className:"jeeOV_UYyl50GFLOzjGC"},a.ZP.createElement("div",{className:"SVqE3gr2ekQUWfFT_Mvg"},t),a.ZP.createElement("div",{className:"mCBNPstzrSlOQsz6rOtE"},n),a.ZP.createElement(Lt,{leftValue:s,rightValue:i,rightStyle:`background: rgb(${o.join(",")})`}))}));var Ot=n(15866),Dt=n(70692);const Ut=n.p+"DeviceFrame.79271ee0fa60a7b6a1aa.svg";var $t=n(35148);const _t={root:"WHiQiGCtWfjSlEysEelB",wrapper:"WUpKHfqLbeZmhfYqqiko",down:"MiGmL4xqBPkxmLim4Ai0",frame:"xuhT9JHpFkVsTcUWeh4L",video:"sLLJqCkdSug4bzEQrACs"},Gt=(0,a.X$)((e=>{let{videoId:t,isReverseAnimation:n,isDown:s,videoThumbnail:i,index:r,isActive:o}=e;const l=(0,R.Z)(`document${t}`),c=(0,Ot.Z)(i.dataUri),d=(0,Dt.Z)(l);return a.ZP.createElement("div",{className:_t.root},a.ZP.createElement("div",{className:(0,W.Z)(_t.wrapper,n&&_t.reverse,s&&_t.down),id:`premium_feature_preview_video_${r}`},a.ZP.createElement("img",{src:Ut,alt:"",className:_t.frame}),a.ZP.createElement("canvas",{ref:c,className:_t.video}),a.ZP.createElement($t.Z,{canPlay:o,className:(0,W.Z)(_t.video,d),src:l,disablePictureInPicture:!0,playsInline:!0,muted:!0,loop:!0})))}));var jt=n(3570),Vt=n(97799);const zt=e=>{let{size:t,realIndex:n,isActivated:s,canPlay:i,reaction:r,index:o,maxLength:l,handleClick:c}=e;const d=(0,R.Z)(`document${r.activateAnimation?.id}`),m=(0,R.Z)(`document${r.aroundAnimation?.id}`),[u,h,P]=(0,I.Z)(s),[Z,v,p]=(0,I.Z)(!1),g=(t-.2*t)/2,E=o/l*(2*Math.PI),C=E-Math.PI/6*Math.cos(E),f=.2+.7*(Math.sin(C)+1)/2,b=f>.85?1:f,y=Math.cos(C)*g,S=Math.sin(C)*g*.6,k=(0,a.I4)((()=>{c(n)}),[c,n]);return(0,a.d4)((()=>{s&&(h(),p())}),[s,h,p]),a.ZP.createElement(a.ZP.Fragment,null,s&&!Z&&a.ZP.createElement(Vt.Z,{className:"bIR5UZpxiCoHBe0ZmtIn sbJjdz4IEwYhlti5MyPA",tgsUrl:m,play:i,isLowPriority:!0,noLoop:!0,size:.6*t,style:`--x: ${y}px; --y: ${S}px; --scale: ${b};`,onEnded:v}),a.ZP.createElement(Vt.Z,{className:"sbJjdz4IEwYhlti5MyPA",tgsUrl:d,onClick:k,play:u&&i,noLoop:!0,size:.2*t,style:`--x: ${y}px; --y: ${S}px; --scale: ${b};`,onEnded:P}))},Jt=(0,a.X$)((0,i.c$)((e=>({availableReactions:e.availableReactions})))((e=>{let{availableReactions:t,isActive:n}=e;const s=(0,a.sO)(null),[i,r,o]=(0,I.Z)(),l=(0,a.sO)(),[c,d]=(0,a.eJ)(0),[m,u]=(0,a.eJ)(0),h=t?.filter((e=>e.isPremium))?.slice(0,15)||[];(0,It.Z)((()=>{d((e=>(0,jt.Z)(h.length,e+1)))}),i||!n?void 0:3e3);const P=(0,a.I4)((e=>{d(e),r(),l.current&&clearTimeout(l.current),l.current=setTimeout((()=>{o()}),4e3)}),[r,o]);return(0,a.d4)((()=>{const e=s.current;e&&u(e.closest(".modal-dialog").clientWidth)}),[]),a.ZP.createElement("div",{className:"lSI7Gb2It7nFGpBE4IFs",ref:s},h.map(((e,t)=>a.ZP.createElement(zt,{size:m,reaction:e,realIndex:t,index:(t-c+h.length/4)%h.length,maxLength:h.length,handleClick:P,isActivated:c===t,canPlay:n}))))}))),Xt="_rzXza87NHdAMH2TDKul",Ht="qd3rvhZma3JJmhdt07Ig",qt=(0,a.X$)((e=>{let{length:t,active:n,onSelectSlide:s}=e;const i=Math.max(0,Math.min(t-8,n-4)),r=i===t-8-1,o=i===t-8,l=0===i,c=1===i,m=Math.min(t,8),u=(0,a.I4)((()=>{s(n+1)}),[n,s]),h=(0,a.I4)((()=>{s(n-1)}),[n,s]),P=Math.min(8,t);return a.ZP.createElement("div",null,!d.$b&&a.ZP.createElement($.Z,{className:(0,W.Z)(Xt,0===n&&Ht),color:"translucent",disabled:0===n,round:!0,onClick:h},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement("div",{className:"NtJc4bt94t9fklIWC6wF",style:`--start-from: ${i}; --length: ${t}; --count: ${P};`},Array(t).fill(void 0).map(((e,t)=>{const d=t,u=t===i+m-1&&!o&&!r,h=t===i+m-2&&!r&&!o||t===i+m-1&&r,P=t===i&&!l&&!c,Z=t===i+1&&!l&&!c||t===i&&c,v=t<i||t>=i+m;return a.ZP.createElement("div",{onClick:()=>s(t),className:(0,W.Z)("eCgEFkp07vgaUGwymYAQ",d===n&&"nlCmVncFkKVtsawWqcfw",(h||Z)&&"AIpVWjJc47egZ8ATaC3n",(u||P)&&"MnRKztu0OZTyIywGLMc6",v&&"boSFbatyzatdw70J7mpu")})}))),!d.$b&&a.ZP.createElement($.Z,{className:(0,W.Z)(Xt,n===t-1&&Ht,"J4UYbae0Frt01jIavpB0"),color:"translucent",round:!0,disabled:n===t-1,onClick:u},a.ZP.createElement("i",{className:"icon-next"})))})),Yt=e=>{let{size:t,realIndex:n,canPlay:s,sticker:i,index:r,maxLength:o,onClick:l,onEnded:c}=e;const d=(0,R.Z)(`sticker${i.id}`),m=(0,R.Z)(`sticker${i.id}?size=f`),u=0===r,[h,P,Z]=(0,I.Z)(u),v=t-.6*t,p=3*v,g=3.2*v,E=r/o*(2*Math.PI),C=u?1:.66,f=Math.cos(E)*p-2.8*v,b=Math.sin(E)*g,y=(0,a.I4)((()=>{l(n)}),[l,n]),S=(0,a.I4)((()=>{Z(),c()}),[Z,c]);return(0,a.d4)((()=>{u&&P()}),[u,P]),a.ZP.createElement(a.ZP.Fragment,null,u&&a.ZP.createElement(Vt.Z,{className:"JLzWnq8to4W24wBGmbyt PIYKt4xxOUBpRjRu0b4q",tgsUrl:m,play:s,isLowPriority:!0,noLoop:!0,size:.8*t,style:`--x: calc(${f}px - 10%); --y: ${b}px;`}),a.ZP.createElement(Vt.Z,{className:"PIYKt4xxOUBpRjRu0b4q",tgsUrl:d,play:s&&h,noLoop:!0,size:.6*t,style:`--x: ${f}px; --y: ${b}px; --opacity: ${C}`,onClick:y,onEnded:S}))},Kt=(0,a.X$)((0,i.c$)((e=>({stickers:e.stickers.premium.stickers})))((e=>{let{stickers:t,isActive:n}=e;const s=(0,a.sO)(null),[i,r]=(0,a.eJ)(0),[o,l]=(0,a.eJ)(0),c=t?.slice(0,15),d=(0,a.I4)((e=>{r(-e)}),[]),m=(0,a.I4)((()=>{setTimeout((()=>{r((e=>(0,jt.Z)(c.length,e+1)))}),150)}),[c.length]);return(0,a.d4)((()=>{const e=s.current;e&&l(e.closest(".modal-dialog").clientWidth)}),[]),a.ZP.createElement("div",{className:"dVn5gk50tXn1EiI4kJFJ",ref:s},c?.map(((e,t)=>a.ZP.createElement(Yt,{size:o,sticker:e,realIndex:t,index:(t+i+c.length)%c.length,maxLength:c.length,onClick:d,onEnded:m,canPlay:n}))))}))),Wt="fEQZ2fyO9g6L1v8QJUCJ",Qt="xkC9BFxv7RkSwbPe4RMb",en="eEYA2lXPy_DUKe8JKHiP",tn="TVO7LjkV_yHUGIu5PXCA",nn={double_limits:"PremiumPreviewLimits",unique_reactions:"PremiumPreviewReactions",premium_stickers:"PremiumPreviewStickers",animated_emoji:"PremiumPreviewEmoji",no_ads:"PremiumPreviewNoAds",voice_to_text:"PremiumPreviewVoiceToText",profile_badge:"PremiumPreviewProfileBadge",faster_download:"PremiumPreviewDownloadSpeed",more_upload:"PremiumPreviewUploads",advanced_chat_management:"PremiumPreviewAdvancedChatManagement",animated_userpics:"PremiumPreviewAnimatedProfiles"},an={double_limits:"PremiumPreviewLimitsDescription",unique_reactions:"PremiumPreviewReactionsDescription",premium_stickers:"PremiumPreviewStickersDescription",no_ads:"PremiumPreviewNoAdsDescription",animated_emoji:"PremiumPreviewEmojiDescription",voice_to_text:"PremiumPreviewVoiceToTextDescription",profile_badge:"PremiumPreviewProfileBadgeDescription",faster_download:"PremiumPreviewDownloadSpeedDescription",more_upload:"PremiumPreviewUploadsDescription",advanced_chat_management:"PremiumPreviewAdvancedChatManagementDescription",animated_userpics:"PremiumPreviewAnimatedProfilesDescription"},sn=["double_limits","more_upload","faster_download","voice_to_text","no_ads","unique_reactions","premium_stickers","animated_emoji","advanced_chat_management","profile_badge","animated_userpics"],rn=["faster_download","voice_to_text","advanced_chat_management","profile_badge","animated_userpics"],on=["channels","dialogFolderPinned","channelsPublic","savedGifs","stickersFaved","aboutLength","captionLength","dialogFilters","dialogFiltersChats"],ln={channels:"GroupsAndChannelsLimitTitle",dialogFolderPinned:"PinChatsLimitTitle",channelsPublic:"PublicLinksLimitTitle",savedGifs:"SavedGifsLimitTitle",stickersFaved:"FavoriteStickersLimitTitle",aboutLength:"BioLimitTitle",captionLength:"CaptionsLimitTitle",dialogFilters:"FoldersLimitTitle",dialogFiltersChats:"ChatPerFolderLimitTitle"},cn={channels:"GroupsAndChannelsLimitSubtitle",dialogFolderPinned:"PinChatsLimitSubtitle",channelsPublic:"PublicLinksLimitSubtitle",savedGifs:"SavedGifsLimitSubtitle",stickersFaved:"FavoriteStickersLimitSubtitle",aboutLength:"BioLimitSubtitle",captionLength:"CaptionsLimitSubtitle",dialogFilters:"FoldersLimitSubtitle",dialogFiltersChats:"ChatPerFolderLimitSubtitle"},dn=(0,a.X$)((e=>{let{promo:t,initialSection:n,onBack:s,onClickSubscribe:i,isPremium:r,limits:o}=e;const l=(0,M.Z)(),c=(0,a.sO)(null),[d,m]=(0,a.eJ)(sn.indexOf(n)),[u,h]=(0,a.eJ)(0),[P,Z,v]=(0,I.Z)(),[p,g]=(0,a.eJ)(!0),[E,C]=(0,a.eJ)(!1),f=(0,T.Z)(n);function b(e){const{scrollTop:t,clientHeight:n,scrollHeight:a}=e.currentTarget;g(t<=20),C(t>=a-n-20)}(0,a.d4)((()=>{const e=c.current;if(!e||f===n)return;const t=sn.indexOf(n);m(t),Z(),(0,Tt.Z)(e,e.clientWidth*t,0).then(v)}),[d,n,f,Z,v]);const y=(0,a.I4)((async e=>{const t=c.current;t&&(m(e),Z(),await(0,Tt.Z)(t,t.clientWidth*e,800),v())}),[Z,v]),S=t.options.find((e=>1===e.months));return a.ZP.createElement("div",{className:"QfngIllOc1THaTQiJf7h"},a.ZP.createElement($.Z,{round:!0,size:"smaller",className:(0,W.Z)("ZTIpWD6Zrj1U7rnGvrlD",0!==d&&"E42Dy7DFLAxvj8HE4GAD"),color:0===d?"translucent":"translucent-white",onClick:s,ariaLabel:l("Back")},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("div",{className:"EXGFQjwHmQxjvMLbYtS9"}),a.ZP.createElement("div",{className:(0,W.Z)("JMdhJYW94Mas4JDye486","no-scrollbar"),onScroll:function(e){const{clientWidth:t,scrollLeft:n}=e.currentTarget,a=Math.round(n),s=a%t/t;e.currentTarget.style.setProperty("--scroll-progress",s.toString()),e.currentTarget.style.setProperty("--abs-scroll-progress",Math.abs(s).toString());const i=Math.ceil((a+1)/t);h(i);const r=e.currentTarget.querySelector("#premium_feature_preview_video_"+(i-1)),o=e.currentTarget.querySelector(`#premium_feature_preview_video_${i}`);if(r?.classList.toggle("reverse",!1),o?.classList.toggle("reverse",!0),P)return;const l=Math.round(a/t);m(l)},ref:c},sn.map(((e,n)=>{if("double_limits"===e)return a.ZP.createElement("div",{className:(0,W.Z)(Qt,"zngeFAwxdlVJZY876fHc")},a.ZP.createElement("h2",{className:(0,W.Z)("Mw81cOCIGy8KGn9VokFA",p&&"tRvcw256KSHRqgSj5uGX")},l(nn.double_limits)),a.ZP.createElement("div",{className:(0,W.Z)("le7Qv9QkHlO3qdK0Hs_g","custom-scroll"),onScroll:b},on.map(((e,t)=>{const n=o?.[e][0].toString(),s=o?.[e][1].toString();return a.ZP.createElement(Bt,{title:l(ln[e]),description:l(cn[e],s),leftValue:n,rightValue:s,colorStepProgress:t/(on.length-1)})}))));if("unique_reactions"===e)return a.ZP.createElement("div",{className:Qt},a.ZP.createElement("div",{className:Wt},a.ZP.createElement(Jt,{isActive:d===n})),a.ZP.createElement("h1",{className:en},l(nn.unique_reactions)),a.ZP.createElement("div",{className:tn},(0,J.Z)(l(an.unique_reactions),["br"])));if("premium_stickers"===e)return a.ZP.createElement("div",{className:Qt},a.ZP.createElement("div",{className:Wt},a.ZP.createElement(Kt,{isActive:d===n})),a.ZP.createElement("h1",{className:en},l(nn.premium_stickers)),a.ZP.createElement("div",{className:tn},(0,J.Z)(l(an.premium_stickers),["br"])));const s=t.videoSections.indexOf(e);return-1!==s?a.ZP.createElement("div",{className:Qt},a.ZP.createElement("div",{className:Wt},a.ZP.createElement(Gt,{isActive:d===n,videoId:t.videos[s].id,videoThumbnail:t.videos[s].thumbnail,isDown:rn.includes(e),index:n,isReverseAnimation:n===u})),a.ZP.createElement("h1",{className:en},l(nn[t.videoSections[s]])),a.ZP.createElement("div",{className:tn},(0,J.Z)(l(an[t.videoSections[s]]),["br"]))):void 0}))),a.ZP.createElement("div",{className:(0,W.Z)("EKr_FVmiDSwhUxouhaqB",(E||0!==d)&&"H8z5Q6gsuqeCy82HFlyX")},a.ZP.createElement(qt,{length:sn.length,active:d,onSelectSlide:y}),a.ZP.createElement($.Z,{className:(0,W.Z)("n8tTb600de2uZKGkyw67"),isShiny:!r,withPremiumGradient:!r,onClick:r?s:function(){i(n)}},r?l("OK"):l("SubscribeToPremium",(0,At.x)(Number(S.amount),S.currency,l.code)))))}));var mn=n(20230),un=n(9211);const hn={root:"PEnE7xWTMwTPGmhubmj6",text:"U4UYSH7uHW3k4FlqBefm",header:"Jdlm3dtJ8gOIY0x0u2d4",description:"cE44My72bdvMJna9mgoc",icon:"mxF3NdPgAi_H0ZFgNEtw"},Pn=["#F2862D","#EB7B4D","#E46D72","#DD6091","#CC5FBA","#B464E7","#9873FF","#768DFF","#55A5FC","#52B0C9","#4FBC93","#4CC663"],Zn=(0,a.X$)((e=>{let{icon:t,title:n,text:s,index:i,onClick:r}=e;return a.ZP.createElement(Xe.Z,{buttonClassName:hn.root,onClick:r},a.ZP.createElement("img",{src:t,className:hn.icon,alt:"",style:`--item-color: ${Pn[i]}`}),a.ZP.createElement("div",{className:hn.text},a.ZP.createElement("div",{className:hn.title},(0,J.Z)(n,["br"])),a.ZP.createElement("div",{className:hn.description},s)))})),vn=n.p+"PremiumLogo.a5c0e88cd478f4d76d82.svg",pn=n.p+"PremiumLimits.08701cb6df3cf756c5f7.svg",gn=n.p+"PremiumFile.884dd3865acfe594fc61.svg",En=n.p+"PremiumSpeed.d0a43b6780c411c2f84a.svg",Cn=n.p+"PremiumVoice.b3a2893dbe481108ab94.svg",fn=n.p+"PremiumAds.a758f19ece91fe91318e.svg",bn=n.p+"PremiumReactions.7fee56ab6b58c82fd15e.svg",In=n.p+"PremiumStickers.7b5a8531a41b43d0da12.svg",yn=n.p+"PremiumChats.89d9d315638e283ca895.svg",Sn=n.p+"PremiumBadge.1c630afcfd1112ad16d0.svg",kn=n.p+"PremiumVideo.288cb61931e33d913f0a.svg",Nn=n.p+"PremiumEmoji.26515017c8f6dc4f3f67.svg",wn="yVkdTScCEhH3EQMQiA42",Mn={double_limits:pn,unique_reactions:bn,premium_stickers:In,animated_emoji:Nn,no_ads:fn,voice_to_text:Cn,profile_badge:Sn,faster_download:En,more_upload:gn,advanced_chat_management:yn,animated_userpics:kn},Tn=(0,a.X$)((0,i.c$)((e=>({currentUserId:e.currentUserId,promo:e.premiumModal?.promo,isClosing:e.premiumModal?.isClosing,isSuccess:e.premiumModal?.isSuccess,isGift:e.premiumModal?.isGift,monthsAmount:e.premiumModal?.monthsAmount,fromUser:e.premiumModal?.fromUserId?(0,o.dy)(e,e.premiumModal.fromUserId):void 0,toUser:e.premiumModal?.toUserId?(0,o.dy)(e,e.premiumModal.toUserId):void 0,initialSection:e.premiumModal?.initialSection,isPremium:(0,o.wV)(e),limitChannels:(0,un.P)(e,"channels"),limitFolders:(0,un.P)(e,"dialogFilters"),limitPins:(0,un.P)(e,"dialogFolderPinned"),limitLinks:(0,un.P)(e,"channelsPublic"),limits:e.appConfig?.limits,premiumSlug:e.appConfig?.premiumInvoiceSlug,premiumBotUsername:e.appConfig?.premiumBotUsername,premiumPromoOrder:e.appConfig?.premiumPromoOrder})))((e=>{let{isOpen:t,currentUserId:n,fromUser:s,promo:o,initialSection:l,isPremium:c,limitChannels:d,limitLinks:u,limitFolders:h,limitPins:P,limits:Z,premiumSlug:v,premiumBotUsername:p,isClosing:g,isSuccess:E,isGift:C,toUser:f,monthsAmount:b,premiumPromoOrder:I}=e;const y=(0,a.sO)(null),{closePremiumModal:S,openInvoice:k,requestConfetti:N,openTelegramLink:w}=(0,i.Sv)(),T=(0,M.Z)(),[A,R]=(0,a.eJ)(!0),[L,F]=(0,a.eJ)(l),B=(0,a.I4)((e=>()=>{F(e)}),[]);function O(e){y.current&&(v?k({slug:v}):p&&(w({url:`${m.zH}${p}?start=${e||"promo"}`}),S()))}const D=(0,a.I4)((()=>{const e=y.current;if(e&&t){const{top:t,left:n,width:a,height:s}=e.querySelector(".modal-content").getBoundingClientRect();N({top:t,left:n,width:a,height:s})}}),[t,N]);if((0,a.d4)((()=>{E&&D()}),[E,D]),(0,x.Z)((e=>{let[t]=e;t!==c&&D()}),[c]),!o)return;const U=o.options.find((e=>1===e.months));return a.ZP.createElement(X.Z,{className:"JJNHc_FZuydBNBIHK9xC",onCloseAnimationEnd:()=>S({isClosed:!0}),onClose:S,isOpen:t&&!g,dialogRef:y},a.ZP.createElement(G.Z,{name:"slide",activeKey:L?1:0,className:"Q05gUm0HCMtSoeX2HVGw"},L?a.ZP.createElement(dn,{initialSection:L,onBack:B(void 0),promo:o,onClickSubscribe:O,isPremium:c,limits:Z}):a.ZP.createElement("div",{className:(0,W.Z)("E9_LJ9RqAHTj8h84EROt","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;R(t<=150)}},a.ZP.createElement($.Z,{round:!0,size:"smaller",className:"TyuYAZecpI2K_1i3B5XO",color:"translucent",onClick:()=>S(),ariaLabel:T("Close")},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("img",{className:"Vaf41aTAoSwl_e_cZhah",src:vn,alt:""}),a.ZP.createElement("h2",{className:"J2z1gqvfQu5kqV_UP8US"},(0,J.Z)(C?s?.id===n?T("TelegramPremiumUserGiftedPremiumOutboundDialogTitle",[(0,r.Js)(f),b]):T("TelegramPremiumUserGiftedPremiumDialogTitle",[(0,r.Js)(s),b]):s?T("TelegramPremiumUserDialogTitle",(0,r.Js)(s)):T(c?"TelegramPremiumSubscribedTitle":"TelegramPremium"),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:"PXg8sU2cfdeysJXctlpB"},(0,J.Z)(C?s?.id===n?T("TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle",(0,r.Js)(f)):T("TelegramPremiumUserGiftedPremiumDialogSubtitle"):T(s?"TelegramPremiumUserDialogSubtitle":c?"TelegramPremiumSubscribedSubtitle":"TelegramPremiumSubtitle"),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:(0,W.Z)("Rwuf1efaEfZ13AD5XbCB",A&&"NV7fN3j69oFZEJu7ejG8")},a.ZP.createElement("h2",{className:"jA_DV7G5VJo8xGOe0otF"},T("TelegramPremium"))),a.ZP.createElement("div",{className:(0,W.Z)("LlPAfJpL066su4P2NFmh",c&&"wpPtJKCqTdOGkKoh7KTo")},(I||sn).map(((e,t)=>{if(sn.includes(e))return a.ZP.createElement(Zn,{key:e,title:T(nn[e]),text:"double_limits"===e?T(an[e],[d,h,P,u,4]):T(an[e]),icon:Mn[e],index:t,onClick:B(e)})})),a.ZP.createElement("div",{className:(0,W.Z)(wn,"MQbFSG2o_R8rjKDsqs8R"),dir:T.isRtl?"rtl":void 0},a.ZP.createElement("p",null,(0,J.Z)(T("AboutPremiumDescription"),["simple_markdown"])),a.ZP.createElement("p",null,(0,J.Z)(T("AboutPremiumDescription2"),["simple_markdown"]))),function(){if(o&&(!C||s?.id!==n))return a.ZP.createElement("div",{className:wn,dir:T.isRtl?"rtl":void 0},(0,mn.H)(o.statusText,o.statusEntities))}()),!c&&a.ZP.createElement("div",{className:"FApXoTPpasib6Np5Uxpt"},a.ZP.createElement($.Z,{className:"Fb3VVHNrypZ3lhYfSVI_",isShiny:!0,withPremiumGradient:!0,onClick:function(){O()}},T("SubscribeToPremium",(0,At.x)(Number(U.amount),U.currency,T.code)))))))})));var An=n(8337);const Rn=(0,a.X$)((e=>{let{option:t,checked:n,fullMonthlyAmount:s,onChange:i}=e;const r=(0,M.Z)(),{months:o,amount:l,currency:c}=t,d=Math.floor(l/o),m=(0,a.Ye)((()=>s&&s>d?Math.ceil(100-d/(s/100)):void 0),[s,d]),u=(0,a.I4)((e=>{e.target.checked&&i(o)}),[o,i]);return a.ZP.createElement("label",{className:(0,W.Z)("c43s0Q6_xgGlM8sZxQ7Q",n&&"PjYaF42Oe55WgPpTP6Od"),dir:r.isRtl?"rtl":void 0},a.ZP.createElement("input",{className:"r03M3Tzd52_D2GCAdabK",type:"radio",name:"gift_option",value:o,checked:n,onChange:u}),a.ZP.createElement("div",{className:"oL_26LDnHDwJRxqKF1Kn"},a.ZP.createElement("div",{className:"JmEuBQ4mFzu1MiFV5qSB"},r("Months",o)),a.ZP.createElement("div",{className:"hssGd7AUhDhhG2_aXqe9"},r("PricePerMonth",(0,At.x)(d,c,r.code)),m&&a.ZP.createElement("span",{className:"WCXGWHYNQh8lg2rIWehC",title:r("GiftDiscount")}," ",m,"% ")),a.ZP.createElement("div",{className:"mhc9AgOUiNT2QMcErpQe"},(0,At.x)(l,c,r.code))))})),Ln=(0,a.X$)((0,i.c$)((e=>{const{forUserId:t,monthlyCurrency:n,monthlyAmount:a}=e.giftPremiumModal||{},s=t?(0,o.dy)(e,t):void 0;return{user:s,gifts:s?s.fullInfo?.premiumGifts:void 0,monthlyCurrency:n,monthlyAmount:a?Number(a):void 0,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{isOpen:t,user:n,gifts:s,monthlyCurrency:o,monthlyAmount:l,animationLevel:c}=e;const{openPremiumModal:d,closeGiftPremiumModal:m,openUrl:u}=(0,i.Sv)(),h=(0,M.Z)(),P=(0,Ke.Z)(n,!0),Z=(0,Ke.Z)(s,!0),[v,p]=(0,a.eJ)(),g=Z?.[0],E=(0,a.Ye)((()=>{if(!Z||0===Z.length||!g)return;const e=Z.reduce(((e,t)=>t.amount<g?.amount?t:g),g);return e.currency===o&&l?l:Math.floor(e.amount/e.months)}),[g,Z,l,o]);(0,a.d4)((()=>{t&&p(g?.months)}),[g?.months,t]);const C=(0,a.Ye)((()=>Z?.find((e=>e.months===v))),[Z,v]),f=(0,a.I4)((()=>{C&&(m(),u({url:C.botUrl}))}),[m,u,C]),b=(0,a.I4)((()=>{d()}),[d]);return a.ZP.createElement(X.Z,{onClose:m,isOpen:t,className:"K80So3B9potKGNvwdtYE"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement($.Z,{round:!0,size:"smaller",className:"dxx424IZDNuP1OLbUIve",color:"translucent",onClick:()=>m(),ariaLabel:h("Close")},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Be.Z,{user:P,size:"jumbo",className:"qJgJ7R5NJVmAxBjT5LxT",animationLevel:c,withVideo:!0}),a.ZP.createElement("h2",{className:"eqCNa8zBoMroKcepfXyE"},h("GiftTelegramPremiumTitle")),a.ZP.createElement("p",{className:"MtYhgDChavNfKIUAJPzt"},(0,J.Z)(h("GiftTelegramPremiumDescription",(0,r.Vl)(P)),["emoji","simple_markdown"])),a.ZP.createElement("div",{className:"HyfHjS1vAds31eFcSpDg"},Z?.map((e=>a.ZP.createElement(Rn,{key:e.amount,option:e,fullMonthlyAmount:E,checked:e.months===v,onChange:p})))),function(){const e=h("GiftPremiumListFeaturesAndTerms").match(/([^*]*)\*([^*]+)\*(.*)/);if(e&&!(e.length<4))return a.ZP.createElement("p",{className:"J0hST5xsC45ZolfGpbDc"},e[1],a.ZP.createElement(An.Z,{isPrimary:!0,onClick:b},e[2]),e[3])}()),a.ZP.createElement($.Z,{className:"sSXm9RjIQSsVFi0D1nEd",isShiny:!0,disabled:!v,onClick:f},h("GiftSubscriptionFor",C&&(0,At.x)(Number(C.amount),C.currency,h.code))))}))),Fn={dialogFiltersChats:"LimitReachedChatInFolders",uploadMaxFileparts:"LimitReachedFileSize",dialogFilters:"LimitReachedFolders",dialogFolderPinned:"LimitReachedPinDialogs",channelsPublic:"LimitReachedPublicLinks",channels:"LimitReachedCommunities"},xn={dialogFiltersChats:"LimitReachedChatInFoldersLocked",uploadMaxFileparts:"LimitReachedFileSizeLocked",dialogFilters:"LimitReachedFoldersLocked",dialogFolderPinned:"LimitReachedPinDialogsLocked",channelsPublic:"LimitReachedPublicLinksLocked",channels:"LimitReachedCommunitiesLocked"},Bn={dialogFiltersChats:"LimitReachedChatInFoldersPremium",uploadMaxFileparts:"LimitReachedFileSizePremium",dialogFilters:"LimitReachedFoldersPremium",dialogFolderPinned:"LimitReachedPinDialogsPremium",channelsPublic:"LimitReachedPublicLinksPremium",channels:"LimitReachedCommunitiesPremium"},On={dialogFiltersChats:"icon-chat-badge",uploadMaxFileparts:"icon-file-badge",dialogFilters:"icon-folder-badge",dialogFolderPinned:"icon-pin-badge",channelsPublic:"icon-link-badge",channels:"icon-chats-badge"},Dn={uploadMaxFileparts:(e,t)=>8e3===t?e("FileSize.GB","4"):4e3===t?e("FileSize.GB","2"):(0,Pe.sS)(e,t*m.pJ)},Un=(0,a.X$)((0,i.c$)(((e,t)=>{let{limit:n}=t;const{limits:a}=e.appConfig||{},s=(0,o.wV)(e);return{defaultValue:n?a?.[n][0]:void 0,premiumValue:n?a?.[n][1]:void 0,canBuyPremium:!(0,o.oe)(e),isPremium:s}}))((e=>{let{defaultValue:t,premiumValue:n,limit:s,isPremium:r,canBuyPremium:o}=e;const{closeLimitReachedModal:l,openPremiumModal:c}=(0,i.Sv)(),d=(0,M.Z)(),[m,u,h]=(0,I.Z)(),P=(0,a.I4)((()=>{c(),u()}),[c,u]);(0,a.d4)((()=>{!s&&m&&h()}),[m,s,h]);const Z=d("LimitReached"),v=s&&Dn[s],p=function(e){let{lang:t,limitType:n,isPremium:a,canBuyPremium:s,defaultValue:i,premiumValue:r,valueFormatter:o}=e;if(!n)return;const l=o?o(t,i):i,c=o?o(t,r):r;return a?t(Bn[n],c):s?t(Fn[n],"channelsPublic"===n?c:[l,c]):t(xn[n],l)}({lang:d,limitType:s,isPremium:r,canBuyPremium:o,defaultValue:t,premiumValue:n,valueFormatter:v}),g=s&&On[s],E=o&&!r;return a.ZP.createElement(X.Z,{onClose:u,onCloseAnimationEnd:l,isOpen:Boolean(s)&&!m,title:Z,className:"iz5RJvcQyNNDQzKfXQbN"},!E&&a.ZP.createElement("div",{className:"womlEQglVV1w8ltVa6PQ"},a.ZP.createElement("i",{className:(0,W.Z)("q8SgjqQqlOVMSofzhdwh",g)}),a.ZP.createElement("div",{className:"QC8Xe4ShGc_q82s4Tjmg"},v?.(d,r?n:t)||(r?n:t))),E&&a.ZP.createElement(Lt,{className:"az3lXhmlMfZfIQ_81jog",leftValue:v?.(d,t)||t?.toString(),rightValue:v?.(d,n)||n?.toString(),floatingBadgeIcon:g}),a.ZP.createElement("div",null,(0,J.Z)(p||"",["simple_markdown","br"])),a.ZP.createElement("div",{className:"DgRFl7StCs4fhROb7CKH"},a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"primary"},d(E?"Cancel":"OK")),E&&a.ZP.createElement($.Z,{className:(0,W.Z)("confirm-dialog-button","Twnx_5clE9fKNOMo7lXf"),isShiny:!0,onClick:P,color:"primary"},d("IncreaseLimit"),a.ZP.createElement("i",{className:(0,W.Z)("BW05mF5k9uq5qBi_BYzg","icon-double-badge")}))))})));var $n=n(10088);const _n=(0,a.X$)((e=>{let{isOpen:t,onClose:n}=e;const s=(0,M.Z)();return a.ZP.createElement(X.Z,{isOpen:t,onClose:n,hasCloseButton:!0,title:s("SponsoredMessageInfo")},a.ZP.createElement("p",null,(0,J.Z)(s("SponsoredMessageInfoDescription1"),["br"])),a.ZP.createElement("p",null,(0,J.Z)(s("SponsoredMessageInfoDescription2"),["br"])),a.ZP.createElement("p",null,(0,J.Z)(s("SponsoredMessageInfoDescription3"),["br"])),a.ZP.createElement("p",null,a.ZP.createElement($n.Z,{url:s("SponsoredMessageAlertLearnMoreUrl"),text:s("SponsoredMessageAlertLearnMoreUrl")})),a.ZP.createElement("p",null,(0,J.Z)(s("SponsoredMessageInfoDescription4"),["br"])),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},s("Close")))})),Gn=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,r.YC)(n),s=(0,o.FM)(e,n),i=(0,o.Z1)(e,n),l=Boolean(i)&&(0,r.eA)(i),c=Boolean(i)&&(0,r.G9)(i),d=Boolean(i)&&(0,r.ZV)(i);return{isPrivateChat:a,isChatWithSelf:s,isChannel:l,isGroup:c,isSuperGroup:d,canPinForAll:a&&!s||d||c,contactName:i&&(0,r.YC)(i.id)?(0,r.Vl)((0,o.dy)(e,(0,r.zX)(i))):void 0}}))((e=>{let{isOpen:t,messageId:n,chatId:s,isChannel:r,isGroup:o,isSuperGroup:l,canPinForAll:c,contactName:d,onClose:m}=e;const{pinMessage:u}=(0,i.Sv)(),h=(0,a.I4)((()=>{u({chatId:s,messageId:n,isUnpin:!1}),m()}),[u,s,n,m]),P=(0,a.I4)((()=>{u({chatId:s,messageId:n,isUnpin:!1,isOneSide:!0,isSilent:!0}),m()}),[s,n,m,u]),Z=(0,M.Z)();return a.ZP.createElement(X.Z,{isOpen:t,onClose:m,className:"pin",title:Z("PinMessageAlertTitle")},a.ZP.createElement("p",null,Z(r?"PinMessageAlertChannel":o||l?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:P},Z("DialogPin")),c&&a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:h},d?(0,J.Z)(Z("Conversation.PinMessagesFor",d)):Z("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},Z("Cancel")))}))),jn=(0,a.X$)((e=>{let{isOpen:t,pinnedMessagesCount:n=0,onClose:s,onUnpin:i}=e;const r=(0,M.Z)();return a.ZP.createElement(X.Z,{isOpen:t,onClose:s,className:"unpin-all",title:r("Chat.PanelUnpinAllMessages")},a.ZP.createElement("p",null,r("Chat.UnpinAllMessagesConfirmation",n,"i")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:i},r("DialogUnpin")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},r("Cancel")))}));var Vn=n(517),zn=n(73541);const Jn=(0,a.X$)((0,i.c$)(((e,t)=>{let{isSchedule:n}=t;const{messageIds:a}=e.selectedMessages||{},{canDeleteForAll:s}=(0,o.xl)(e),i=(0,o.jr)(e);return{selectedMessageIds:a,canDeleteForAll:!n&&s,contactName:i&&(0,r.YC)(i.id)?(0,r.Vl)((0,o.dy)(e,(0,r.zX)(i))):void 0,willDeleteForCurrentUserOnly:i&&(0,r.G9)(i)&&!s,willDeleteForAll:i&&(0,r.ZV)(i)}}))((e=>{let{isOpen:t,isSchedule:n,selectedMessageIds:s,canDeleteForAll:r,contactName:o,willDeleteForCurrentUserOnly:l,willDeleteForAll:c,onClose:d}=e;const{deleteMessages:m,deleteScheduledMessages:u,exitMessageSelectMode:h}=(0,i.Sv)(),P=(0,T.Z)(t),Z=(0,a.I4)((()=>{d(),m({messageIds:s,shouldDeleteForAll:!0})}),[m,s,d]),v=(0,a.I4)((()=>{n?u({messageIds:s}):m({messageIds:s,shouldDeleteForAll:!1}),d()}),[n,d,u,s,m]),p=(0,M.Z)();if((0,a.d4)((()=>{!t&&P&&h()}),[h,t,P]),s)return a.ZP.createElement(X.Z,{isOpen:t,onClose:d,onEnter:r?void 0:v,className:"delete",title:p("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,p("AreYouSureDeleteFewMessages")),l&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),c&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),r&&a.ZP.createElement($.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},o?(0,J.Z)(p("ChatList.DeleteForEveryone",o)):p("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement($.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:v},p(r?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},p("Cancel")))}))),Xn=(0,a.X$)((0,i.c$)((e=>{const{type:t,chatId:n}=(0,o.Bt)(e)||{},a="scheduled"===t,{canDelete:s}=(0,o.xl)(e),i=Boolean(!a&&(0,o.nB)(e)),r=(0,o.Nu)(e),{messageIds:l}=e.selectedMessages||{},c=!!n&&(0,o.ku)(e,n,l),d=!!n&&(0,o.w9)(e,n,l),m=e.forwardMessages.isModalShown,u=Boolean(m||e.requestedDraft||e.requestedAttachBotInChat||e.requestedAttachBotInstall);return{isSchedule:a,selectedMessagesCount:(0,o.D7)(e),canDeleteMessages:s,canReportMessages:i,canDownloadMessages:r,canForwardMessages:d,selectedMessageIds:l,hasProtectedMessage:c,isAnyModalOpen:u}}))((e=>{let{canPost:t,isActive:n,messageListType:s,isSchedule:r,selectedMessagesCount:o,canDeleteMessages:l,canReportMessages:c,canDownloadMessages:d,canForwardMessages:m,hasProtectedMessage:u,isAnyModalOpen:h,selectedMessageIds:P}=e;const{exitMessageSelectMode:Z,openForwardMenuForSelectedMessages:v,downloadSelectedMessages:p,copySelectedMessages:g,showNotification:E}=(0,i.Sv)(),C=(0,M.Z)(),[f,b,y]=(0,I.Z)(),[S,k,N]=(0,I.Z)();((e,t)=>{(0,zn.y)({"Mod+C":function(n){e&&(n.preventDefault(),t())}})})(Boolean(n),g),(0,a.d4)((()=>!n||f||S||h?void 0:(0,Vn.Z)({onBackspace:l?b:void 0,onDelete:l?b:void 0,onEsc:Z})),[n,f,S,b,Z,h,l]);const w=(0,a.I4)((()=>{g(),E({message:C("Share.Link.Copied")}),Z()}),[g,Z,C,E]),A=(0,a.I4)((()=>{p(),Z()}),[p,Z]),R=(0,T.Z)(o||void 0,!0),L=C("VoiceOver.Chat.MessagesSelected",n?o:R,"i"),F=(0,W.Z)("MessageSelectToolbar",t&&"with-composer",n&&"shown"),x=(e,t,n,s)=>a.ZP.createElement("div",{role:"button",tabIndex:0,className:(0,W.Z)("item",s&&"destructive"),onClick:n,title:t},a.ZP.createElement("i",{className:`icon-${e}`}));return a.ZP.createElement("div",{className:F},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement($.Z,{color:"translucent",round:!0,onClick:Z,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:L},L),Boolean(o)&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==s&&m&&x("forward",C("Chat.ForwardActionHeader"),v),c&&x("flag",C("Conversation.ReportMessages"),k),d&&!u&&x("download",C("lng_media_download"),A),!u&&x("copy",C("lng_context_copy_selected_items"),w),l&&x("delete",C("EditAdminGroupDeleteMessages"),b,!0))),a.ZP.createElement(Jn,{isOpen:f,isSchedule:r,onClose:y}),a.ZP.createElement(U.Z,{isOpen:S,onClose:N,messageIds:P}))}))),Hn=(0,a.X$)((0,i.c$)((e=>{const{chatId:t,messageId:n}=e.seenByModal||{};return t&&n?{memberIds:(0,o.hj)(e,t,n)?.seenByUserIds}:{}}))((e=>{let{isOpen:t,memberIds:n}=e;const{openChat:s,closeSeenByModal:r}=(0,i.Sv)(),o=(0,M.Z)(),l=(0,a.I4)((e=>{r(),setTimeout((()=>{s({id:e})}),100)}),[r,s]),c=(0,Ke.Z)(n,!0);return a.ZP.createElement(X.Z,{isOpen:t,onClose:r,className:"narrow",title:`Seen by ${n?.length} users`},a.ZP.createElement("div",{dir:o.isRtl?"rtl":void 0},c&&c.map((e=>a.ZP.createElement(Xe.Z,{key:e,className:"chat-item-clickable scroll-item small-icon",onClick:()=>l(e)},a.ZP.createElement(qe.Z,{userId:e,noStatusOrTyping:!0}))))),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},o("Close")))})));var qn=n(48198),Yn=n(2153);const Kn=(0,a.X$)((0,i.c$)((e=>{const{chatId:t,messageId:n}=e.reactorModal||{},a=t&&n?(0,o.hj)(e,t,n):void 0;return{chatId:t,messageId:n,reactions:a?.reactions,reactors:a?.reactors,seenByUserIds:a?.seenByUserIds,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{isOpen:t,reactors:n,reactions:r,chatId:o,messageId:l,seenByUserIds:c,animationLevel:d}=e;const{loadReactors:m,closeReactorListModal:u,openChat:h}=(0,i.Sv)(),P=(0,i.Rd)().users.byId,Z=(0,M.Z)(),[v,p,g]=(0,I.Z)(!1),[E,C]=(0,a.eJ)(void 0),f=n&&r&&n.count>=10&&r.results.length>1,b=(0,a.sO)();(0,a.d4)((()=>{t&&!v&&(b.current=void 0),v&&!t&&(g(),C(void 0))}),[v,t,g]);const y=(0,a.I4)((()=>{b.current&&h({id:b.current}),u()}),[u,h]),S=(0,a.I4)((()=>{p()}),[p]),k=(0,a.I4)((e=>{b.current=e,S()}),[S]),N=(0,a.I4)((()=>{m({chatId:o,messageId:l})}),[o,m,l]),w=(0,a.Ye)((()=>n?.reactions?(0,$e.Tw)(n.reactions.map((e=>e.reaction))):[]),[n]),T=(0,a.Ye)((()=>E?n?.reactions.filter((e=>e.reaction===E)).map((e=>e.userId)):(0,$e.Tw)(n?.reactions.map((e=>e.userId)).concat(c||[])||[])),[E,n,c]),[A,R]=(0,_e.Z)(N,T,n&&void 0===n.nextOffset);return(0,a.d4)((()=>{R?.({direction:s.Uq.Backwards})}),[R]),a.ZP.createElement(X.Z,{isOpen:t&&!v,onClose:S,className:"ReactorListModal narrow",title:Z("Reactions"),onCloseAnimationEnd:y},f&&a.ZP.createElement("div",{className:"Reactions"},a.ZP.createElement($.Z,{className:(0,W.Z)(!E&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(void 0)},a.ZP.createElement("i",{className:"icon-heart"}),n?.count&&(0,Pe.bi)(n.count)),w.map((e=>{const t=r?.results.find((t=>t.reaction===e))?.count;return a.ZP.createElement($.Z,{key:e,className:(0,W.Z)(E===e&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(e)},a.ZP.createElement(qn.Z,{reaction:e,className:"reaction-filter-emoji"}),t&&(0,Pe.bi)(t))}))),a.ZP.createElement("div",{dir:Z.isRtl?"rtl":void 0},A?.length?a.ZP.createElement(Je.Z,{className:"reactor-list custom-scroll",items:A,onLoadMore:R},A?.flatMap((e=>{const t=P[e],s=n?.reactions.filter((t=>t.userId===e)),i=[];return s?.forEach((n=>{i.push(a.ZP.createElement(Xe.Z,{key:`${e}-${n.reaction}`,className:"chat-item-clickable reactors-list-item",onClick:()=>k(e)},a.ZP.createElement(Be.Z,{user:t,size:"small",animationLevel:d,withVideo:!0}),a.ZP.createElement(Yn.Z,{peer:t,withEmojiStatus:!0}),n.reaction&&a.ZP.createElement(qn.Z,{className:"reactors-list-emoji",reaction:n.reaction})))})),i}))):a.ZP.createElement(Ve.Z,null)),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:S},Z("Close")))})));var Wn=n(13365);const Qn=(0,a.X$)((0,i.c$)(((e,t)=>{let{activeEmojiInteraction:n}=t;const a=void 0!==n.animatedEffect&&(0,o.tH)(e,n.animatedEffect);return{effectAnimationId:a?a.id:void 0,localEffectAnimation:!a&&n.animatedEffect&&Object.keys(Wn.l).includes(n.animatedEffect)?n.animatedEffect:void 0}}))((e=>{let{effectAnimationId:t,localEffectAnimation:n,activeEmojiInteraction:s}=e;const{stopActiveEmojiInteraction:r}=(0,i.Sv)(),[o,l]=(0,I.Z)(!1),[c,m]=(0,I.Z)(!1),u=(0,a.sO)(),h=(0,a.I4)((()=>{l(),u.current&&clearTimeout(u.current),setTimeout((()=>{r({id:s.id})}),250)}),[s.id,l,r]),P=(0,a.I4)((e=>{e.target?.closest(".AnimatedEmoji")||h()}),[h]);(0,a.d4)((()=>(document.addEventListener("touchstart",P),document.addEventListener("touchmove",P),document.addEventListener("mousedown",P),document.addEventListener("wheel",P),()=>{document.removeEventListener("touchstart",P),document.removeEventListener("touchmove",P),document.removeEventListener("mousedown",P),document.removeEventListener("wheel",P)})),[P]),(0,a.bt)((()=>{const e=(0,S.YW)();u.current=setTimeout((()=>{h(),e()}),3e3)}),[h]);const Z=t&&`sticker${t}`,v=(0,R.Z)(Z,!t);if(!s.startSize)return;const p=(s.startSize||0)/309,g=n&&n in Wn.l?Wn.l[n]:v;return a.ZP.createElement("div",{className:(0,W.Z)("EmojiInteractionAnimation",o&&"hiding",c&&"playing",s.isReversed&&"reversed"),style:`--scale: ${p}; --start-x: ${s.x}px; --start-y: ${s.y}px;`},a.ZP.createElement(Vt.Z,{key:`effect_${t}`,size:309,tgsUrl:g,play:c,quality:d.wZ?.5:void 0,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:m}))})));var ea=n(93133),ta=n(70735),na=n(78781),aa=n(41470);const sa=e=>{const t=(0,a.sO)(null),n=(0,a.I4)((n=>{"Enter"===n.key&&t.current===document.activeElement&&e()}),[e]);return(0,a.d4)((()=>(window.addEventListener("keydown",n,!1),()=>window.removeEventListener("keydown",n,!1))),[n]),t};var ia=n(40329),ra=n(50742);const oa=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),s=a&&(0,r.zX)(a);return{chat:a,user:s?(0,o.dy)(e,s):void 0,isPinned:(0,o.ep)(e,n),isMuted:a?(0,r.i4)(a,(0,o.dZ)(e),(0,o.NJ)(e)):void 0,canChangeFolder:Boolean(e.chatFolders.orderedIds?.length)}}))((e=>{let{chatId:t,withUsername:n,onClick:s,chat:i,user:o,isPinned:l,isMuted:c,canChangeFolder:d}=e;const[m,u,h]=(0,I.Z)(),[P,Z,v]=(0,I.Z)(),p=(0,aa.Z)({chat:i,user:o,isPinned:l,isMuted:c,canChangeFolder:d,handleDelete:u,handleChatFolderChange:Z},!0),g=(0,a.I4)((()=>{s(t)}),[t,s]),E=sa(g);if(i)return a.ZP.createElement(Xe.Z,{className:"chat-item-clickable search-result",onClick:g,contextActions:p,buttonRef:E},(0,r.YC)(t)?a.ZP.createElement(qe.Z,{userId:t,withUsername:n,avatarSize:"large",withVideoAvatar:!0}):a.ZP.createElement(He.Z,{chatId:t,withUsername:n,avatarSize:"large",withVideoAvatar:!0}),a.ZP.createElement(ia.Z,{isOpen:m,onClose:h,chat:i}),a.ZP.createElement(ra.Z,{isOpen:P,onClose:v,chatId:t}))}))),la=(0,te.P2)((e=>e()),6e4,!0),ca=(0,a.X$)((0,i.c$)((e=>{const{userIds:t}=e.topPeers,n=e.users.byId,{recentlyFoundChatIds:a}=e.globalSearch,{animationLevel:s}=e.settings.byKey;return{topUserIds:t,usersById:n,recentlyFoundChatIds:a,animationLevel:s}}))((e=>{let{topUserIds:t,usersById:n,recentlyFoundChatIds:s,animationLevel:o,onReset:l}=e;const{loadTopUsers:c,openChat:d,addRecentlyFoundChatId:m,clearRecentlyFoundChats:u}=(0,i.Sv)(),h=(0,a.sO)(null);(0,a.d4)((()=>{la((()=>{c()}))}),[c]),(0,na.Z)(h.current,!t);const P=(0,a.I4)((e=>{d({id:e,shouldReplaceHistory:!0}),l(),setTimeout((()=>{m({id:e})}),250)}),[d,m,l]),Z=(0,M.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},t&&a.ZP.createElement("div",{className:"top-peers-section",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:h,className:"top-peers no-selection"},t.map((e=>a.ZP.createElement("div",{className:"top-peer-item",onClick:()=>P(e),dir:Z.isRtl?"rtl":void 0},a.ZP.createElement(Be.Z,{user:n[e],animationLevel:o,withVideo:!0}),a.ZP.createElement("div",{className:"top-peer-name"},(0,J.Z)((0,r.Vl)(n[e])||" "))))))),s&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:Z.isRtl?"rtl":void 0},Z("Recent"),a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:u,isRtl:Z.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),s.map((e=>a.ZP.createElement(oa,{chatId:e,onClick:P})))))}))),da=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n);if(!a)return{};const s=(0,r.zX)(a);return{chat:a,lastSyncTime:e.lastSyncTime,animationLevel:e.settings.byKey.animationLevel,...s&&{privateChatUser:(0,o.dy)(e,s)}}}))((e=>{let{message:t,searchQuery:n,chatId:s,chat:o,privateChatUser:l,animationLevel:c,lastSyncTime:m}=e;const{focusMessage:u}=(0,i.Sv)(),h=(0,r.bf)(t)?void 0:(0,r.DH)(t),P=(0,R.Z)((0,r.Ti)(t,"micro")),Z=Boolean((0,r.Y5)(t)),v=(0,a.I4)((()=>{u({chatId:s,messageId:t.id,shouldReplaceHistory:!0})}),[s,u,t.id]),p=(0,M.Z)(),g=sa(v);if(o)return a.ZP.createElement(Xe.Z,{className:"ChatMessage chat-item-clickable",ripple:!d.wB,onClick:v,buttonRef:g},a.ZP.createElement(Be.Z,{chat:o,user:l,isSavedMessages:l?.isSelf,lastSyncTime:m,withVideo:!0,animationLevel:c}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"info-row"},a.ZP.createElement(Yn.Z,{peer:l||o,withEmojiStatus:!0,isSavedMessages:s===l?.id&&l?.isSelf}),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(An.Z,{className:"date"},(0,he.VX)(p,1e3*t.date)))),a.ZP.createElement("div",{className:"subtitle"},a.ZP.createElement("div",{className:"message",dir:"auto"},function(e,t,n,s,i){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:(0,W.Z)("media-preview--image",i&&"round")}),(0,r.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,b.e)(e,t,!0,s)):(0,b.e)(e,t,void 0,s)}(p,t,P||h,n,Z)))))}))),ma=(0,a.X$)((e=>{let{searchDate:t,onSelect:n}=e;const s=(0,a.Ye)((()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,he.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,he.xH)(a)})}return t}(t)),[t]);return a.ZP.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},s.map((e=>{let{date:t,text:s}=e;return a.ZP.createElement("div",{onClick:()=>n(t),className:"date-item",key:s},a.ZP.createElement("i",{className:"icon-calendar"}),a.ZP.createElement("span",null,s))})))}));var ua=n(47262),ha=n(49187);const Pa=(0,te.P2)((e=>e()),500,!0),Za=(0,a.X$)((0,i.c$)((e=>{const{byId:t}=e.chats,{userIds:n}=e.contactList||{};if(!n)return{chatsById:t};const{currentUserId:a,messages:s,lastSyncTime:i}=e,{fetchingStatus:r,globalResults:o,localResults:l,resultsByType:c}=e.globalSearch,{chatIds:d,userIds:m}=o||{},{chatIds:u,userIds:h}=l||{},{byChatId:P}=s,Z=c?.text?.foundIds;return{currentUserId:a,localContactIds:n,localChatIds:u,localUserIds:h,globalChatIds:d,globalUserIds:m,foundIds:Z,globalMessagesByChatId:P,chatsById:t,fetchingStatus:r,lastSyncTime:i}}))((e=>{let{searchQuery:t,searchDate:n,dateSearchQuery:o,currentUserId:l,localContactIds:c,localChatIds:m,localUserIds:u,globalChatIds:h,globalUserIds:P,foundIds:Z,globalMessagesByChatId:v,chatsById:p,fetchingStatus:g,lastSyncTime:E,onReset:C,onSearchDateSelect:f}=e;const{openChat:I,addRecentlyFoundChatId:y,searchMessagesGlobal:S,setGlobalSearchChatId:k}=(0,i.Sv)(),N=(0,a.sO)(null);(0,na.Z)(N.current,void 0,!0);const w=(0,M.Z)(),[T,A]=(0,a.eJ)(!1),[R,L]=(0,a.eJ)(!1),F=(0,a.I4)((e=>{let{direction:n}=e;E&&n===s.Uq.Backwards&&Pa((()=>{S({type:"text",query:t})}))}),[E,S,t]),x=(0,a.I4)((e=>{I({id:e,shouldReplaceHistory:!0}),e!==l&&y({id:e}),d.wB||C()}),[l,I,y,C]),B=(0,a.I4)((e=>{k({id:e})}),[k]),O=(0,a.Ye)((()=>{if(!t||t.startsWith("@")&&t.length<2)return ta.D;const e=[...l?[l]:[],...c||[]],n=(0,i.Rd)().users.byId,a=(0,r.kK)(e,n,t,l,w("SavedMessages"));return[...(0,r.ih)((0,$e.Tw)([...a||[],...m||[],...u||[]]),p,void 0,l?[l]:void 0)]}),[t,l,c,w,m,u,p]),D=(0,a.Ye)((()=>!t||t.length<4||!h||!P?ta.D:(0,r.ih)((0,$e.Tw)([...h,...P]),p,!0)),[p,h,P,t]),U=(0,a.Ye)((()=>(t||n)&&Z&&0!==Z.length?Z.map((e=>{const[t,n]=e.split("_");return v?.[t]?.byId[Number(n)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):ta.D),[Z,v,t,n]),$=(0,a.I4)((()=>{A(!T)}),[T]),_=(0,a.I4)((()=>{L(!R)}),[R]),G=g&&!g.chats&&!g.messages&&!O.length&&!D.length&&!U.length;return t||n?a.ZP.createElement(Je.Z,{className:"LeftSearch custom-scroll",items:U,onLoadMore:F,noScrollRestoreOnTop:!0,noFastList:!0},o&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(ma,{searchDate:o,onSelect:f})),G&&a.ZP.createElement(ua.Z,{text:w("ChatList.Search.NoResults"),description:w("ChatList.Search.NoResultsDescription")}),Boolean(O.length)&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:w.isRtl?"rtl":void 0,ref:N},O.map((e=>a.ZP.createElement(ha.Z,{chatOrUserId:e,onClick:B,clickArg:e})))),Boolean(O.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},O.length>5&&a.ZP.createElement(An.Z,{className:"Link",onClick:$},w(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionDialogs")),O.map(((e,t)=>{if(T||!(t>=5))return a.ZP.createElement(oa,{chatId:e,onClick:x})}))),Boolean(D.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},D.length>5&&a.ZP.createElement(An.Z,{className:"Link",onClick:_},w(R?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionGlobal")),D.map(((e,t)=>{if(R||!(t>=5))return a.ZP.createElement(oa,{chatId:e,withUsername:!0,onClick:x})}))),Boolean(U.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},w("SearchMessages")),U.map((function(e){const n=(0,b.e)(w,e),s=p[e.chatId];if(n&&s)return a.ZP.createElement(da,{chatId:e.chatId,message:e,searchQuery:t})})))):a.ZP.createElement(ca,{onReset:C})}))),va=(0,te.P2)((e=>e()),500,!0),pa=(0,a.X$)((0,i.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a},lastSyncTime:s}=e,{fetchingStatus:i,resultsByType:r}=e.globalSearch,{foundIds:o}=r?.text||{};return{currentUserId:n,foundIds:o,globalMessagesByChatId:a,chatsById:t,fetchingStatus:i,lastSyncTime:s}}))((e=>{let{searchQuery:t,currentUserId:n,dateSearchQuery:r,foundIds:o,globalMessagesByChatId:l,chatsById:c,fetchingStatus:d,lastSyncTime:m,onSearchDateSelect:u}=e;const{searchMessagesGlobal:h}=(0,i.Sv)(),P=(0,M.Z)(),Z=(0,a.I4)((e=>{let{direction:a}=e;m&&a===s.Uq.Backwards&&va((()=>{h({type:"text",query:t,chatId:n})}))}),[n,m,h,t]),v=(0,a.Ye)((()=>o&&0!==o.length?o.map((e=>{const[t,n]=e.split("_");return l?.[t]?.byId[Number(n)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):ta.D),[o,l]),p=d&&!d.chats&&!d.messages&&!v.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Je.Z,{className:"search-content custom-scroll chat-list",items:v,onLoadMore:Z,noFastList:!0},r&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(ma,{searchDate:r,onSelect:u})),p&&a.ZP.createElement(ua.Z,{text:P("ChatList.Search.NoResults"),description:P("ChatList.Search.NoResultsDescription")}),v.map((function(e){const n=(0,b.e)(P,e),s=c[e.chatId];if(n&&s)return a.ZP.createElement(da,{chatId:e.chatId,message:e,searchQuery:t})}))))})));function ga(e){return(t,n)=>{const{byId:a}=t.chats,{byId:s}=t.users,{fetchingStatus:i,resultsByType:r,chatId:l}=t.globalSearch,c="audio"!==e?e:n?.isVoice?"voice":"audio",{byChatId:d}=t.messages,m=r?.[c]?.foundIds,u=t.activeDownloads.byChatId;return{theme:(0,o.Pu)(t),isLoading:void 0===m||!!i&&Boolean(i.chats||i.messages),chatsById:a,usersById:s,globalMessagesByChatId:d,foundIds:m,searchChatId:l,activeDownloads:u,isChatProtected:l?(0,o.Z1)(t,l)?.isProtected:void 0,lastSyncTime:t.lastSyncTime}}}var Ea=n(17891),Ca=n(3657),fa=n(13709);const ba="media",Ia=(0,te.P2)((e=>e()),500,!0),ya=(0,a.X$)((0,i.c$)(ga(ba))((e=>{let{searchQuery:t,searchChatId:n,isLoading:r,globalMessagesByChatId:o,foundIds:l,lastSyncTime:c,isChatProtected:d}=e;const{searchMessagesGlobal:u,openMediaViewer:h}=(0,i.Sv)(),P=(0,a.sO)(null),Z=(0,M.Z)(),{observe:v}=(0,Ca.S1)({rootRef:P,throttleMs:500}),p=(0,a.I4)((e=>{let{direction:a}=e;c&&a===s.Uq.Backwards&&Ia((()=>{u({type:ba,query:t,chatId:n})}))}),[c,u,t,n]),g=(0,a.Ye)((()=>l&&o?l.map((e=>{const[t,n]=e.split("_");return o[t]?.byId[Number(n)]})).filter(Boolean):ta.D),[o,l]),E=(0,a.I4)(((e,t)=>{h({chatId:t,mediaId:e,origin:s.bZ.SearchResult})}),[h]),C=(0,Ea.Z)([t],m.Y)&&!r,f=C&&l&&l.length>0&&!t,b=C&&l&&l.length>0&&t,I=(0,W.Z)("search-content custom-scroll",b&&"chat-list");return a.ZP.createElement("div",{ref:P,className:"LeftSearch"},a.ZP.createElement(Je.Z,{className:I,items:g,itemSelector:t?".ListItem":".Media",onLoadMore:p,noFastList:!0},!C&&a.ZP.createElement(Ve.Z,null),C&&(!l||0===l.length)&&a.ZP.createElement(ua.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),f&&a.ZP.createElement("div",{className:"media-list",dir:Z.isRtl?"rtl":void 0},g.map((e=>a.ZP.createElement(fa.Z,{key:`${e.chatId}-${e.id}`,idPrefix:"search-media",message:e,isProtected:d||e.isProtected,observeIntersection:v,onClick:E})))),b&&g.map((e=>a.ZP.createElement(da,{key:e.id,chatId:e.chatId,message:e})))))})));var Sa=n(91),ka=n(45418);const Na="links",wa=(0,te.P2)((e=>e()),500,!0),Ma=(0,a.X$)((0,i.c$)(ga(Na))((e=>{let{searchQuery:t,searchChatId:n,isLoading:r,chatsById:o,usersById:l,globalMessagesByChatId:c,foundIds:d,lastSyncTime:u,isChatProtected:h}=e;const{searchMessagesGlobal:P,focusMessage:Z}=(0,i.Sv)(),v=(0,a.sO)(null),p=(0,M.Z)(),{observe:g}=(0,Ca.S1)({rootRef:v,throttleMs:500}),E=(0,a.I4)((e=>{let{direction:a}=e;u&&a===s.Uq.Backwards&&wa((()=>{P({type:Na,query:t,chatId:n})}))}),[u,P,t,n]),C=(0,a.Ye)((()=>d&&c?d.map((e=>{const[t,n]=e.split("_");return c[t]?.byId[Number(n)]})).filter(Boolean):ta.D),[c,d]),f=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),b=(0,Ea.Z)([t],m.Y)&&!r;return a.ZP.createElement("div",{ref:v,className:"LeftSearch"},a.ZP.createElement(Je.Z,{className:"search-content documents-list custom-scroll",items:C,onLoadMore:E,noFastList:!0},!b&&a.ZP.createElement(Ve.Z,null),b&&(!d||0===d.length)&&a.ZP.createElement(ua.Z,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),b&&d&&d.length>0&&C.map(((e,t)=>{const n=0===t||(0,he.kj)(e.date)!==(0,he.kj)(C[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,he.np)(p,new Date(1e3*e.date))),a.ZP.createElement(ka.Z,{key:e.id,message:e,senderTitle:(0,Sa.F)(p,e,o,l),isProtected:h||e.isProtected,observeIntersection:g,onMessageClick:f}))}))))})));var Ta=n(82535);const Aa="documents",Ra=(0,te.P2)((e=>e()),500,!0),La=(0,a.X$)((0,i.c$)(ga(Aa))((e=>{let{searchQuery:t,searchChatId:n,isLoading:o,chatsById:l,usersById:c,globalMessagesByChatId:d,foundIds:u,activeDownloads:h,lastSyncTime:P}=e;const{searchMessagesGlobal:Z,focusMessage:v}=(0,i.Sv)(),p=(0,a.sO)(null),g=(0,M.Z)(),{observe:E}=(0,Ca.S1)({rootRef:p,throttleMs:500}),C=(0,a.I4)((e=>{let{direction:a}=e;P&&a===s.Uq.Backwards&&Ra((()=>{Z({type:Aa,query:t,chatId:n})}))}),[P,Z,t,n]),f=(0,a.Ye)((()=>u&&d?u.map((e=>{const[t,n]=e.split("_"),a=d[t]?.byId[Number(n)];return a&&(0,r.aE)(a)?a:void 0})).filter(Boolean):ta.D),[d,u]),b=(0,a.I4)(((e,t)=>{v({chatId:t,messageId:e})}),[v]),I=(0,Ea.Z)([t],m.Y)&&!o;return a.ZP.createElement("div",{ref:p,className:"LeftSearch"},a.ZP.createElement(Je.Z,{className:"search-content documents-list custom-scroll",items:f,onLoadMore:C,noFastList:!0},!I&&a.ZP.createElement(Ve.Z,null),I&&(!u||0===u.length)&&a.ZP.createElement(ua.Z,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),I&&u&&u.length>0&&f.map(((e,t)=>{const n=0===t||(0,he.kj)(e.date)!==(0,he.kj)(f[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},n&&a.ZP.createElement("p",{className:"section-heading"},(0,he.np)(g,new Date(1e3*e.date))),a.ZP.createElement(Ta.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,Sa.F)(g,e,l,c),className:"scroll-item",isDownloading:h[e.chatId]?.includes(e.id),observeIntersection:E,onDateClick:b}))}))))})));var Fa=n(54752);const xa=(0,te.P2)((e=>e()),500,!0),Ba=(0,a.X$)((0,i.c$)(ga("audio"))((e=>{let{theme:t,isVoice:n,searchQuery:r,searchChatId:o,isLoading:l,chatsById:c,usersById:d,globalMessagesByChatId:u,foundIds:h,lastSyncTime:P,activeDownloads:Z}=e;const{searchMessagesGlobal:v,focusMessage:p,openAudioPlayer:g}=(0,i.Sv)(),E=(0,M.Z)(),C=n?"voice":"audio",f=(0,a.I4)((e=>{let{direction:t}=e;P&&t===s.Uq.Backwards&&xa((()=>{v({type:C,query:r,chatId:o})}))}),[C,P,v,r,o]),b=(0,a.Ye)((()=>h&&u?h.map((e=>{const[t,n]=e.split("_");return u[t]?.byId[Number(n)]})).filter(Boolean):ta.D),[u,h]),I=(0,a.I4)(((e,t)=>{p({chatId:t,messageId:e})}),[p]),y=(0,a.I4)(((e,t)=>{g({chatId:t,messageId:e})}),[g]),S=(0,Ea.Z)([r],m.Y)&&!l;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Je.Z,{className:"search-content documents-list custom-scroll",items:b,onLoadMore:f,noFastList:!0},!S&&a.ZP.createElement(Ve.Z,null),S&&(!h||0===h.length)&&a.ZP.createElement(ua.Z,{text:E("ChatList.Search.NoResults"),description:E("ChatList.Search.NoResultsDescription")}),S&&h&&h.length>0&&b.map(((e,n)=>{const i=0===n||(0,he.kj)(e.date)!==(0,he.kj)(b[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},i&&a.ZP.createElement("p",{className:"section-heading",dir:E.isRtl?"rtl":void 0},(0,he.np)(E,new Date(1e3*e.date))),a.ZP.createElement(Fa.ZP,{key:e.id,theme:t,message:e,origin:s.Cr.Search,senderTitle:(0,Sa.F)(E,e,c,d),date:e.date,lastSyncTime:P,className:"scroll-item",onPlay:y,onDateClick:I,canDownload:!c[e.chatId]?.isProtected&&!e.isProtected,isDownloading:Z[e.chatId]?.includes(e.id)}))}))))}))),Oa=[{type:s.nJ.ChatList,title:"SearchAllChatsShort"},{type:s.nJ.Media,title:"SharedMediaTab2"},{type:s.nJ.Links,title:"SharedLinksTab2"},{type:s.nJ.Files,title:"SharedFilesTab2"},{type:s.nJ.Music,title:"SharedMusicTab2"},{type:s.nJ.Voice,title:"SharedVoiceTab2"}],Da=[{type:s.nJ.ChatList,title:"All Messages"},...Oa.slice(1)],Ua=Object.keys(s.nJ).length/2,$a=(0,a.X$)((0,i.c$)((e=>{const{currentContent:t,chatId:n}=e.globalSearch;return{currentContent:t,chatId:n}}))((e=>{let{searchQuery:t,searchDate:n,isActive:r,currentContent:o=s.nJ.ChatList,chatId:l,onReset:c}=e;const{setGlobalSearchContent:d,setGlobalSearchDate:m}=(0,i.Sv)(),u=(0,M.Z)(),[h,P]=(0,a.eJ)(o),Z=(0,a.Ye)((()=>(0,he.xk)(t)),[t]),v=(0,a.I4)((e=>{const t=Oa[e];d({content:t.type}),P(e)}),[d]),p=(0,a.I4)((e=>{m({date:e.getTime()/1e3})}),[m]);(0,ie.Z)({isActive:r,onBack:c});const g=(0,a.sO)(null),E=(0,Ge.Z)(g,r,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:g,onKeyDown:E},a.ZP.createElement(ea.Z,{activeTab:h,tabs:l?Da:Oa,onSwitchTab:v}),a.ZP.createElement(G.Z,{name:u.isRtl?"slide-optimized-rtl":"slide-optimized",renderCount:Ua,activeKey:o},(()=>{switch(o){case s.nJ.ChatList:return l?a.ZP.createElement(pa,{searchQuery:t,dateSearchQuery:Z,onReset:c,onSearchDateSelect:p}):a.ZP.createElement(Za,{searchQuery:t,searchDate:n,dateSearchQuery:Z,onReset:c,onSearchDateSelect:p});case s.nJ.Media:return a.ZP.createElement(ya,{searchQuery:t});case s.nJ.Links:return a.ZP.createElement(Ma,{searchQuery:t});case s.nJ.Files:return a.ZP.createElement(La,{searchQuery:t});case s.nJ.Music:return a.ZP.createElement(Ba,{key:"audio",searchQuery:t});case s.nJ.Voice:return a.ZP.createElement(Ba,{key:"voice",isVoice:!0,searchQuery:t});default:return}})()))})));var _a=n(91090);const Ga={currentPassword:"",password:"",hint:"",email:""},ja=(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 Ga;default:return e}},Va=(0,a.X$)((e=>{let{currentScreen:t,editedFolderId:n,onReset:r,onSaveFilter:o,onScreenSelect:l}=e;const{signOut:c,openDeleteChatFolderModal:m}=(0,i.Sv)(),[u,h]=(0,a.eJ)(!1),P=function(e,t){const n=(0,a.sO)(0),s=(0,a.sO)();return(0,a.I4)((()=>{if(n.current++,5===n.current)return n.current=0,void t();s.current&&clearTimeout(s.current),s.current=setTimeout((()=>{n.current=0}),300)}),[5,t])}(0,(()=>{l(s.MT.Experimental)})),Z=(0,a.I4)((()=>{h(!0)}),[]),v=(0,a.I4)((()=>{h(!1)}),[]),p=(0,a.I4)((()=>{n&&m({folderId:n})}),[n,m]),g=(0,a.I4)((()=>{v(),c()}),[v,c]),E=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement($.Z,{round:!0,ripple:!d.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]),C=(0,M.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",onClick:r,ariaLabel:C("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(t){case s.MT.EditProfile:return a.ZP.createElement("h3",null,C("lng_settings_information"));case s.MT.General:return a.ZP.createElement("h3",null,C("General"));case s.MT.QuickReaction:return a.ZP.createElement("h3",null,C("DoubleTapSetting"));case s.MT.CustomEmoji:return a.ZP.createElement("h3",null,C("Emoji"));case s.MT.Notifications:return a.ZP.createElement("h3",null,C("Notifications"));case s.MT.DataStorage:return a.ZP.createElement("h3",null,C("DataSettings"));case s.MT.Privacy:return a.ZP.createElement("h3",null,C("PrivacySettings"));case s.MT.Language:return a.ZP.createElement("h3",null,C("Language"));case s.MT.Stickers:return a.ZP.createElement("h3",null,C("StickersName"));case s.MT.Experimental:return a.ZP.createElement("h3",null,C("lng_settings_experimental"));case s.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,C("ChatBackground"));case s.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,C("SetColor"));case s.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,C("PrivacyPhone"));case s.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,C("PrivacyLastSeen"));case s.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,C("Privacy.ProfilePhoto"));case s.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,C("PrivacyForwards"));case s.MT.PrivacyVoiceMessages:return a.ZP.createElement("h3",null,C("PrivacyVoiceMessages"));case s.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,C("AutodownloadGroupChats"));case s.MT.PrivacyPhoneNumberAllowedContacts:case s.MT.PrivacyLastSeenAllowedContacts:case s.MT.PrivacyProfilePhotoAllowedContacts:case s.MT.PrivacyForwardingAllowedContacts:case s.MT.PrivacyVoiceMessagesAllowedContacts:case s.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement("h3",null,C("AlwaysShareWith"));case s.MT.PrivacyPhoneNumberDeniedContacts:case s.MT.PrivacyLastSeenDeniedContacts:case s.MT.PrivacyProfilePhotoDeniedContacts:case s.MT.PrivacyForwardingDeniedContacts:case s.MT.PrivacyVoiceMessagesDeniedContacts:case s.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement("h3",null,C("NeverShareWith"));case s.MT.ActiveSessions:return a.ZP.createElement("h3",null,C("SessionsTitle"));case s.MT.ActiveWebsites:return a.ZP.createElement("h3",null,C("OtherWebSessions"));case s.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,C("BlockedUsers"));case s.MT.TwoFaDisabled:case s.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,C("TwoStepVerification"));case s.MT.TwoFaNewPassword:case s.MT.TwoFaChangePasswordNew:case s.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,C("PleaseEnterCurrentPassword"));case s.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,C("PleaseReEnterPassword"));case s.MT.TwoFaNewPasswordHint:case s.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,C("PasswordHint"));case s.MT.TwoFaNewPasswordEmail:case s.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,C("RecoveryEmailTitle"));case s.MT.TwoFaNewPasswordEmailCode:case s.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement("h3",null,"Recovery Email Code");case s.MT.TwoFaCongratulations:return a.ZP.createElement("h3",null,C("TwoStepVerificationPasswordSet"));case s.MT.TwoFaChangePasswordCurrent:case s.MT.TwoFaTurnOff:case s.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,C("PleaseEnterCurrentPassword"));case s.MT.PasscodeDisabled:case s.MT.PasscodeEnabled:case s.MT.PasscodeNewPasscode:case s.MT.PasscodeNewPasscodeConfirm:case s.MT.PasscodeCongratulations:return a.ZP.createElement("h3",null,C("Passcode"));case s.MT.PasscodeTurnOff:return a.ZP.createElement("h3",null,C("PasscodeController.Disable.Title"));case s.MT.PasscodeChangePasscodeCurrent:case s.MT.PasscodeChangePasscodeNew:return a.ZP.createElement("h3",null,C("PasscodeController.Change.Title"));case s.MT.PasscodeChangePasscodeConfirm:return a.ZP.createElement("h3",null,C("PasscodeController.ReEnterPasscode.Placeholder"));case s.MT.Folders:return a.ZP.createElement("h3",null,C("Filters"));case s.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,C("FilterNew"));case s.MT.FoldersEditFolder:case s.MT.FoldersEditFolderFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,C("FilterEdit")),n&&a.ZP.createElement(j.Z,{className:"settings-more-menu",trigger:E,positionX:"right"},a.ZP.createElement(V.Z,{icon:"delete",destructive:!0,onClick:p},C("Delete"))));case s.MT.FoldersIncludedChats:case s.MT.FoldersIncludedChatsFromChatList:case s.MT.FoldersExcludedChats:case s.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},t===s.MT.FoldersIncludedChats||t===s.MT.FoldersIncludedChatsFromChatList?a.ZP.createElement("h3",null,C("FilterInclude")):a.ZP.createElement("h3",null,C("FilterExclude")),a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:o,ariaLabel:C("AutoDeleteConfirm")},a.ZP.createElement("i",{className:"icon-check"})));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",{onClick:P},C("SETTINGS")),a.ZP.createElement($.Z,{round:!0,ripple:!d.wB,size:"smaller",color:"translucent",onClick:()=>l(s.MT.EditProfile),ariaLabel:C("lng_settings_information")},a.ZP.createElement("i",{className:"icon-edit"})),a.ZP.createElement(j.Z,{className:"settings-more-menu",trigger:E,positionX:"right"},a.ZP.createElement(V.Z,{icon:"logout",onClick:Z},C("LogOutTitle"))))}}(),a.ZP.createElement(lt.Z,{isOpen:u,onClose:v,text:C("lng_sure_logout"),confirmLabel:C("AccountSettings.Logout"),confirmHandler:g,confirmIsDestructive:!0}))}));var za=n(20787),Ja=n(70180),Xa=n(4863);const Ha=(0,a.X$)((0,i.c$)((e=>{const{currentUserId:t,lastSyncTime:n}=e;return{sessionCount:e.activeSessions.orderedHashes.length,currentUser:t?(0,o.dy)(e,t):void 0,lastSyncTime:n,canBuyPremium:!(0,o.oe)(e)}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,currentUser:o,sessionCount:l,lastSyncTime:c,canBuyPremium:d}=e;const{loadProfilePhotos:m,loadAuthorizations:u,openPremiumModal:h}=(0,i.Sv)(),P=(0,M.Z)(),Z=o?.id;return(0,a.d4)((()=>{Z&&c&&m({profileId:Z})}),[c,Z,m]),(0,ie.Z)({isActive:t,onBack:r}),(0,a.d4)((()=>{c&&u()}),[c,u]),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-main-menu"},o&&a.ZP.createElement(za.Z,{userId:o.id,canPlayVideo:Boolean(t),forceShowSelf:!0}),o&&a.ZP.createElement(Ja.Z,{chatOrUserId:o.id,forceShowSelf:!0}),a.ZP.createElement(Xe.Z,{icon:"settings",onClick:()=>n(s.MT.General)},P("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Xe.Z,{icon:"unmute",onClick:()=>n(s.MT.Notifications)},P("Notifications")),a.ZP.createElement(Xe.Z,{icon:"data",onClick:()=>n(s.MT.DataStorage)},P("DataSettings")),a.ZP.createElement(Xe.Z,{icon:"lock",onClick:()=>n(s.MT.Privacy)},P("PrivacySettings")),a.ZP.createElement(Xe.Z,{icon:"folder",onClick:()=>n(s.MT.Folders)},P("Filters")),a.ZP.createElement(Xe.Z,{icon:"active-sessions",onClick:()=>n(s.MT.ActiveSessions)},P("SessionsTitle"),l>0&&a.ZP.createElement("span",{className:"settings-item__current-value"},l)),a.ZP.createElement(Xe.Z,{icon:"language",onClick:()=>n(s.MT.Language)},P("Language"),a.ZP.createElement("span",{className:"settings-item__current-value"},P.langName)),a.ZP.createElement(Xe.Z,{icon:"stickers",onClick:()=>n(s.MT.Stickers)},P("StickersName")),d&&a.ZP.createElement(Xe.Z,{leftElement:a.ZP.createElement(Xa.Z,{withGradient:!0,big:!0}),className:"settings-main-menu-premium",onClick:()=>h()},P("TelegramPremium"))))})));var qa=n(90710),Ya=n(41151);const Ka=/https:\/\/t\.me\/?/i,Wa=/^\D([a-zA-Z0-9_]+)$/,Qa=(0,te.Ds)((e=>e()),250,!1),es=(0,a.X$)((e=>{let{currentUsername:t,asLink:n,isLoading:s,isUsernameAvailable:r,checkedUsername:o,onChange:l}=e;const{checkUsername:c,checkPublicLink:d}=(0,i.Sv)(),[u,h]=(0,a.eJ)(t||""),P=(0,M.Z)(),Z=n?"SetUrl":"Username",v=P(n?"SetUrlPlaceholder":"Username"),p=(0,T.Z)(r),g=t!==u?null!=r?r:p:void 0,E=u&&t!==u&&o!==u,[C,f]=(0,a.Ye)((()=>u.length?u.length<5?[void 0,P(`${Z}InvalidShort`)]:u.length>32?[void 0,P(`${Z}InvalidLong`)]:Wa.test(u)?void 0===g||E?[]:[g?P(`${Z}Available`,v):void 0,!1===g?P(`${Z}InUse`):void 0]:[void 0,P(`${Z}Invalid`)]:[]),[u,g,E,P,Z,v]);(0,a.d4)((()=>{h(t||"")}),[n,t]);const b=(0,a.I4)((e=>{const a=e.target.value.trim().replace(Ka,"");h(a);const s=function(e){return e.length>=5&&e.length<=32&&Wa.test(e)}(a);s&&(l?.(a),Qa((()=>{a!==t&&(n?d:c)({username:a})})))}),[n,d,c,t,l]);return a.ZP.createElement(ze.Z,{value:`${n?m.zH:""}${u}`,onChange:b,label:E?P("Checking"):v,error:f,success:C,readOnly:s,teactExperimentControlled:!0})})),ts=(0,a.X$)((e=>{let{ref:t,id:n,className:s,value:i,label:r,error:o,success:l,disabled:c,readOnly:d,placeholder:m,autoComplete:u,inputMode:h,maxLength:P,maxLengthIndicator:Z,tabIndex:v,onChange:p,onInput:g,onKeyPress:E,onKeyDown:C,onBlur:f,onPaste:b}=e,I=(0,a.sO)(null);t&&(I=t);const y=(0,M.Z)(),S=o||l||r,k=(0,W.Z)("input-group",i&&"touched",o?"error":l&&"success",c&&"disabled",d&&"disabled",S&&"with-label",s);(0,a.d4)((()=>{const e=I.current;e&&(e.style.height="0",e.style.height=`${e.scrollHeight}px`)}),[]);const N=(0,a.I4)((e=>{e.currentTarget.value=e.currentTarget.value.replace(/\n/,""),e.currentTarget.style.height="0",e.currentTarget.style.height=`${e.currentTarget.scrollHeight}px`,p?.(e)}),[p]);return a.ZP.createElement("div",{className:k,dir:y.isRtl?"rtl":void 0},a.ZP.createElement("textarea",{ref:I,className:"form-control",id:n,dir:"auto",value:i||"",tabIndex:v,placeholder:m,maxLength:P,autoComplete:u,inputMode:h,disabled:c,readOnly:d,onChange:N,onInput:g,onKeyPress:E,onKeyDown:C,onBlur:f,onPaste:b,"aria-label":S}),S&&a.ZP.createElement("label",{htmlFor:n},S),Z&&a.ZP.createElement("div",{className:"max-length-indicator"},Z))}));var ns=n(64319);var as=n(80036);const ss={x:0,y:0},is=(0,a.X$)((e=>{let{children:t,id:n,onDrag:s,onDragEnd:i,style:r,knobStyle:o,isDisabled:l}=e;const c=(0,M.Z)(),d=(0,a.sO)(null),[m,u]=(0,a.eJ)({isDragging:!1,origin:ss,translation:ss}),h=e=>{e.stopPropagation(),e.preventDefault();const{x:t,y:n}=rs(e);u({...m,isDragging:!0,origin:{x:t,y:n},width:d.current?.offsetWidth,height:d.current?.offsetHeight})},P=(0,a.I4)((e=>{const{x:t,y:a}=rs(e),i={x:t-m.origin.x,y:a-m.origin.y};u((e=>({...e,translation:i}))),s(i,n)}),[n,s,m.origin.x,m.origin.y]),Z=(0,a.I4)((()=>{requestAnimationFrame((()=>{u((e=>({...e,isDragging:!1,width:void 0,height:void 0}))),i()}))}),[i]);(0,a.d4)((()=>{m.isDragging&&l&&u((e=>({...e,isDragging:!1,width:void 0,height:void 0})))}),[l,m.isDragging]),(0,a.d4)((()=>(m.isDragging?(window.addEventListener("touchmove",P),window.addEventListener("mousemove",P),window.addEventListener("touchend",Z),window.addEventListener("touchcancel",Z),window.addEventListener("mouseup",Z)):(window.removeEventListener("touchmove",P),window.removeEventListener("mousemove",P),window.removeEventListener("touchend",Z),window.removeEventListener("touchcancel",Z),window.removeEventListener("mouseup",Z),u((e=>({...e,translation:ss})))),()=>{m.isDragging&&(window.removeEventListener("touchmove",P),window.removeEventListener("mousemove",P),window.removeEventListener("touchend",Z),window.removeEventListener("touchcancel",Z),window.removeEventListener("mouseup",Z))})),[P,Z,m.isDragging]);const v=(0,W.Z)("C9QYXaRLeCEFngOBl4S3",m.isDragging&&"vhGsRt79lQzzuXny9KG8"),p=(0,a.Ye)((()=>(0,as.Z)(m.isDragging&&`transform: translate(${m.translation.x}px, ${m.translation.y}px)`,m.width?`width: ${m.width}px`:void 0,m.height?`height: ${m.height}px`:void 0,r)),[r,m.height,m.isDragging,m.translation.x,m.translation.y,m.width]);return a.ZP.createElement("div",{style:p,className:v,ref:d},t,!l&&a.ZP.createElement("div",{"aria-label":c("i18n_dragToSort"),tabIndex:0,role:"button",className:(0,W.Z)("oGgH1RraeCPayQnxA8C_","draggable-knob"),onMouseDown:h,onTouchStart:h,style:o},a.ZP.createElement("i",{className:"icon-sort","aria-hidden":!0})))}));function rs(e){let t,n;return"touches"in e?(t=e.touches[0].clientX,n=e.touches[0].clientY):(t=e.clientX,n=e.clientY),{x:t,y:n}}const os=(0,a.X$)((e=>{let{chatId:t,usernames:n,onEditUsername:s}=e;const{showNotification:r,toggleUsername:o,toggleChatUsername:l,sortUsernames:c,sortChatUsernames:d}=(0,i.Sv)(),m=(0,M.Z)(),[u,h]=(0,a.eJ)(),P=(0,a.Ye)((()=>n.map((e=>{let{username:t}=e;return t}))),[n]),Z=(0,T.Z)(P),[v,p]=(0,a.eJ)({orderedUsernames:P,dragOrderUsernames:P,draggedIndex:void 0});(0,a.d4)((()=>{Z!==P&&p({orderedUsernames:P,dragOrderUsernames:P,draggedIndex:void 0})}),[Z,P]);const g=(0,a.I4)((e=>{(0,ns.TE)(`@${e}`),r({message:m("UsernameCopied")})}),[m,r]),E=(0,a.I4)((e=>{e.isEditable?s(e.username):h(e)}),[s]),C=(0,a.I4)((()=>{h(void 0)}),[]),f=(0,a.I4)((()=>{t?l({chatId:t,username:u.username,isActive:!u.isActive}):o({username:u.username,isActive:!u.isActive}),C()}),[t,C,l,o,u]),b=(0,a.I4)(((e,t)=>{const n=Math.round(e.y/60),a=v.orderedUsernames?.indexOf(t)||0,s=v.orderedUsernames?.filter((e=>e!==t));s&&(0,ee.Kh)(a+n,0,P.length)&&(s.splice(a+n,0,t),p((e=>({...e,draggedIndex:a,dragOrderUsernames:s}))))}),[v.orderedUsernames,P.length]),I=(0,a.I4)((()=>{p((e=>(t?d({chatId:t,usernames:e.dragOrderUsernames}):c({usernames:e.dragOrderUsernames}),{...e,orderedUsernames:e.dragOrderUsernames,draggedIndex:void 0})))}),[t,d,c]);return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"u8GGVdXgbKUMvoqqs0VJ"},a.ZP.createElement("h4",{className:"sPTmRsKHnc3FL9AubUaY",dir:m.isRtl?"rtl":void 0},m("lng_usernames_subtitle")),a.ZP.createElement("div",{className:"pWxbEJm12NZb25lGmdwA",style:`height: ${60*n.length}px`},n.map(((e,t)=>{var n,s;const i=v.draggedIndex===t,r=60*(null!==(n=v.orderedUsernames?.indexOf(e.username))&&void 0!==n?n:0),o=60*(null!==(s=v.dragOrderUsernames?.indexOf(e.username))&&void 0!==s?s:0),l=e.isEditable?"lng_usernames_edit":e.isActive?"lng_usernames_active":"lng_usernames_non_active";return a.ZP.createElement(is,{key:e.username,id:e.username,onDrag:b,onDragEnd:I,style:`top: ${i?r:o}px;`,knobStyle:(m.isRtl?"left":"right")+": 3rem;",isDisabled:!e.isActive},a.ZP.createElement(Xe.Z,{key:e.username,className:(0,W.Z)("mb-2 no-icon","AWgYeVXfLin4VAmQzhKQ"),narrow:!0,secondaryIcon:"more",icon:e.isActive?"link":"link-broken",multiline:!0,contextActions:[{handler:()=>{g(e.username)},title:m("Copy"),icon:"copy"}],onClick:()=>{E(e)}},a.ZP.createElement("span",{className:"title"},"@",e.username),a.ZP.createElement("span",{className:"subtitle"},m(l))))}))),a.ZP.createElement("p",{className:"YqnFSIc98kYMRge1RrlJ",dir:m.isRtl?"rtl":void 0},m("lng_usernames_description"))),a.ZP.createElement(lt.Z,{isOpen:Boolean(u),onClose:C,title:m(u?.isActive?"Username.DeactivateAlertTitle":"Username.ActivateAlertTitle"),text:m(u?.isActive?"Username.DeactivateAlertText":"Username.ActivateAlertText"),confirmLabel:m(u?.isActive?"Username.DeactivateAlertHide":"Username.ActivateAlertShow"),confirmHandler:f,confirmIsDestructive:!u?.isActive}))})),ls=(0,te.P2)((e=>e()),6e4,!0),cs="Please provide your first name",ds=(0,a.X$)((0,i.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a,checkedUsername:s,error:i}=e.profileEdit||{},l=t?(0,o.dy)(e,t):void 0,c=(0,un.M)(e,"aboutLength");if(!l)return{progress:n,checkedUsername:s,isUsernameAvailable:a,editUsernameError:i,maxBioLength:c};const{firstName:d,lastName:m,usernames:u,fullInfo:h}=l,{bio:P}=h||{};return{currentAvatarHash:(0,r.RT)(l),currentFirstName:d,currentLastName:m,currentBio:P,progress:n,isUsernameAvailable:a,checkedUsername:s,editUsernameError:i,maxBioLength:c,usernames:u}}))((e=>{let{isActive:t,currentAvatarHash:n,currentFirstName:r,currentLastName:o,currentBio:l,progress:c,checkedUsername:d,editUsernameError:u,isUsernameAvailable:h,maxBioLength:P,usernames:Z,onReset:v}=e;const{loadCurrentUser:p,updateProfile:g}=(0,i.Sv)(),E=(0,M.Z)(),C=(0,a.Ye)((()=>Z?.find((e=>{let{isEditable:t}=e;return t}))),[Z])?.username||"",[f,b]=(0,a.eJ)(!1),[I,y]=(0,a.eJ)(!1),[S,k]=(0,a.eJ)(),[N,w]=(0,a.eJ)(),[L,F]=(0,a.eJ)(r||""),[x,B]=(0,a.eJ)(o||""),[O,D]=(0,a.eJ)(l||""),[U,$]=(0,a.eJ)(C),_=(0,R.Z)(n,!1,A.IU.BlobUrl),G=c===s.rN.InProgress,j=!1===U,V=(0,T.Z)(h),z=null!=h?h:V,X=Z&&Z.length>1,H=(0,a.Ye)((()=>!j&&(Boolean(N)||I||f&&!0===z)),[j,N,I,f,z]);(0,ie.Z)({isActive:t,onBack:v}),(0,a.d4)((()=>{ls((()=>{p()}))}),[p]),(0,a.d4)((()=>{w(void 0)}),[_]),(0,a.d4)((()=>{F(r||""),B(o||""),D(l||"")}),[r,o,l]),(0,a.d4)((()=>{$(C||"")}),[C]),(0,a.d4)((()=>{c===s.rN.Complete&&(y(!1),b(!1),k(void 0))}),[c]);const q=(0,a.I4)((e=>{w(e)}),[]),Y=(0,a.I4)((e=>{F(e.target.value),y(!0)}),[]),K=(0,a.I4)((e=>{B(e.target.value),y(!0)}),[]),W=(0,a.I4)((e=>{D(e.target.value),y(!0)}),[]),Q=(0,a.I4)((e=>{$(e),b(C!==e)}),[C]),ee=(0,a.I4)((()=>{const e=L.trim(),t=x.trim(),n=O.trim();e.length?g({photo:N,...I&&{firstName:e,lastName:t,bio:n},...f&&{username:U}}):k(cs)}),[N,L,x,O,I,U,f,g]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-edit-profile settings-item"},a.ZP.createElement(qa.Z,{currentAvatarBlobUrl:_,onChange:q,title:"Edit your profile photo",disabled:G}),a.ZP.createElement(ze.Z,{value:L,onChange:Y,label:E("FirstName"),disabled:G,error:S===cs?S:void 0}),a.ZP.createElement(ze.Z,{value:x,onChange:K,label:E("LastName"),disabled:G}),a.ZP.createElement(ts,{value:O,onChange:W,label:E("UserBio"),disabled:G,maxLength:P,maxLengthIndicator:P?(P-O.length).toString():void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:E.isRtl?"rtl":void 0},(0,J.Z)(E("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0},E("Username")),a.ZP.createElement(es,{currentUsername:C,isLoading:G,isUsernameAvailable:h,checkedUsername:d,onChange:Q}),u===m.Wf&&function(){const e=`${m.zH}${m.Ll}`;return a.ZP.createElement("p",{className:"settings-item-description",dir:E.isRtl?"rtl":void 0},E("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map((t=>"PURCHASE_LINK"===t?a.ZP.createElement($n.Z,{url:e,text:`@${m.Ll}`}):t)))}(),a.ZP.createElement("p",{className:"settings-item-description",dir:E.isRtl?"rtl":void 0},(0,J.Z)(E("UsernameHelp"),["br","simple_markdown"])),U&&a.ZP.createElement("p",{className:"settings-item-description",dir:E.isRtl?"rtl":void 0},E("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},m.zH,U))),X&&a.ZP.createElement(os,{usernames:Z,onEditUsername:$})),a.ZP.createElement(Ya.Z,{isShown:H,onClick:ee,disabled:G,ariaLabel:E("Save")},G?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),ms=(0,a.X$)((0,i.c$)((e=>(0,$e.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb"])))((e=>{let{isActive:t,onReset:n,canAutoLoadPhotoFromContacts:s,canAutoLoadPhotoInPrivateChats:r,canAutoLoadPhotoInGroups:o,canAutoLoadPhotoInChannels:l,canAutoLoadVideoFromContacts:c,canAutoLoadVideoInPrivateChats:d,canAutoLoadVideoInGroups:u,canAutoLoadVideoInChannels:h,canAutoLoadFileFromContacts:P,canAutoLoadFileInPrivateChats:Z,canAutoLoadFileInGroups:v,canAutoLoadFileInChannels:p,canAutoPlayGifs:g,canAutoPlayVideos:E,autoLoadFileMaxSizeMb:C}=e;const{setSettingOption:f}=(0,i.Sv)(),b=(0,M.Z)();(0,ie.Z)({isActive:t,onBack:n});const I=(0,a.I4)((e=>b("AutodownloadSizeLimitUpTo",b("FileSize.MB",String(m.by[e]),"i"))),[b]),y=(0,a.I4)((e=>{f({autoLoadFileMaxSizeMb:m.by[e]})}),[f]),S=(0,a.I4)((e=>{f({canAutoPlayGifs:e})}),[f]),k=(0,a.I4)((e=>{f({canAutoPlayVideos:e})}),[f]);function N(e,t,n,s,i,r){return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},e),a.ZP.createElement(dt.Z,{label:b("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>f({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(dt.Z,{label:b("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>f({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(dt.Z,{label:b("AutoDownloadSettings.GroupChats"),checked:i,onCheck:e=>f({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(dt.Z,{label:b("AutoDownloadSettings.Channels"),checked:r,onCheck:e=>f({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=m.by.indexOf(C);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(Ze.Z,{label:b("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:I,onChange:y}))}())}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},N(b("AutoDownloadPhotosTitle"),"Photo",s,r,o,l),N(b("AutoDownloadVideosTitle"),"Video",c,d,u,h),N("Auto-download files","File",P,Z,v,p),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},b("AutoplayMedia")),a.ZP.createElement(dt.Z,{label:b("GifsTab2"),checked:g,onCheck:S}),a.ZP.createElement(dt.Z,{label:b("DataAndStorage.Autoplay.Videos"),checked:E,onCheck:k})))})));var us=n(95616),hs=n(58912);const Ps=(0,te.P2)((e=>e()),6e4,!0),Zs=(0,a.X$)((0,i.c$)((e=>{const{orderedIds:t,byId:n,recommended:a}=e.chatFolders;return{folderIds:t,foldersById:n,isPremium:(0,o.wV)(e),recommendedChatFolders:a,maxFolders:(0,un.M)(e,"dialogFilters")}}))((e=>{let{isActive:t,onCreateFolder:n,onEditFolder:s,onReset:o,folderIds:l,foldersById:c,isPremium:d,recommendedChatFolders:u,maxFolders:h}=e;const{loadRecommendedChatFolders:P,addChatFolder:Z,openLimitReachedModal:v,openDeleteChatFolderModal:p,sortChatFolders:g}=(0,i.Sv)(),[E,C]=(0,a.eJ)({orderedFolderIds:l,dragOrderIds:l,draggedIndex:void 0}),f=(0,T.Z)(l);(0,a.d4)((()=>{f!==l&&C({orderedFolderIds:l,dragOrderIds:l,draggedIndex:void 0})}),[f,l,E.orderedFolderIds?.length]),(0,a.d4)((()=>{Ps((()=>{P()}))}),[P]);const b=(0,a.I4)((()=>{Object.keys(c).length>=h-1?v({limit:"dialogFilters"}):n()}),[c,h,n,v]),I=(0,M.Z)();(0,ie.Z)({isActive:t,onBack:o});const y=(0,us.mE)(),S=(0,a.Ye)((()=>{if(l)return l.length<=1?ta.D:l.map((e=>{const t=c[e];return e===m.Nf?{id:e,title:I("FilterAllChats")}:{id:t.id,title:t.title,subtitle:(0,r.SB)(I,t,y[t.id])}}))}),[l,c,I,y]),k=(0,a.I4)((e=>{Object.keys(c).length>=h-1?v({limit:"dialogFilters"}):Z({folder:e})}),[c,h,Z,v]),N=(0,a.I4)(((e,t)=>{const n=Math.round(e.y/68),a=E.orderedFolderIds?.indexOf(t)||0,s=E.orderedFolderIds?.filter((e=>e!==t));s&&(0,ee.Kh)(a+n,0,l?.length||0)&&(s.splice(a+n+(d?0:1),0,t),C((e=>({...e,draggedIndex:a,dragOrderIds:s}))))}),[l?.length,d,E.orderedFolderIds]),w=(0,a.I4)((()=>{C((e=>(g({folderIds:e.dragOrderIds}),{...e,orderedFolderIds:e.dragOrderIds,draggedIndex:void 0})))}),[g]),A=(0,a.Ye)((()=>!d||Object.keys(c).length<h-1),[c,d,h]);return a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(hs.Z,{size:m.ku,tgsUrl:Wn.l.FoldersAll,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},I("CreateNewFilterInfo")),A&&a.ZP.createElement($.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:b,isRtl:I.isRtl},a.ZP.createElement("i",{className:"icon-add"}),I("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:I.isRtl?"rtl":void 0},I("Filters")),a.ZP.createElement("div",{className:"settings-sortable-container",style:`height: ${68*(l?.length||0)}px`},S?.length?S.map(((e,n)=>{var i,r;const o=n>h-1,l=E.draggedIndex===n,u=68*(null!==(i=E.orderedFolderIds?.indexOf(e.id))&&void 0!==i?i:0),P=68*(null!==(r=E.dragOrderIds?.indexOf(e.id))&&void 0!==r?r:0);return e.id===m.Nf?a.ZP.createElement(is,{key:e.id,id:e.id,onDrag:N,onDragEnd:w,style:`top: ${l?u:P}px;`,knobStyle:(I.isRtl?"left":"right")+": 0.375rem;",isDisabled:!d||!t},a.ZP.createElement(Xe.Z,{key:e.id,className:"mb-2 no-icon settings-sortable-item",narrow:!0,inactive:!0,multiline:!0,isStatic:!0},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},I("FoldersAllChatsDesc")))):a.ZP.createElement(is,{key:e.id,id:e.id,onDrag:N,onDragEnd:w,style:`top: ${l?u:P}px;`,knobStyle:(I.isRtl?"left":"right")+": 3rem;",isDisabled:o||!t},a.ZP.createElement(Xe.Z,{className:"mb-2 no-icon settings-sortable-item",narrow:!0,secondaryIcon:"more",multiline:!0,contextActions:[{handler:()=>{p({folderId:e.id})},destructive:!0,title:I("Delete"),icon:"delete"}],onClick:()=>{o?v({limit:"dialogFilters"}):s(c[e.id])}},a.ZP.createElement("span",{className:"title"},(0,J.Z)(e.title,["emoji"]),o&&a.ZP.createElement("i",{className:"icon-lock-badge settings-folders-blocked-icon"})),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))})):S&&!S.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(Ve.Z,null))),u&&Boolean(u.length)&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:I.isRtl?"rtl":void 0},I("FilterRecommended")),u.map((e=>a.ZP.createElement(Xe.Z,{className:"mb-2",narrow:!0,onClick:()=>k(e)},a.ZP.createElement("div",{className:"settings-folders-recommended-item"},a.ZP.createElement("div",{className:"multiline-item"},a.ZP.createElement("span",{className:"title"},(0,J.Z)(e.title,["emoji"])),a.ZP.createElement("span",{className:"subtitle"},e.description)),a.ZP.createElement($.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:I.isRtl},I("Add"))))))))})));var vs=n(53455);const ps=e=>{let{count:t,itemName:n,itemPluralName:s,isLoading:i,onClick:r}=e;const o=(0,M.Z)();return a.ZP.createElement($.Z,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:i,isRtl:o.isRtl,onClick:r},a.ZP.createElement("i",{className:"icon-down"}),"Show ",t," more ",t>1?s||`${n}s`:n)},gs="Please provide a title for this folder.",Es="ChatList.Filter.Error.Empty",Cs=(0,a.X$)((0,i.c$)(((e,t)=>{let{state:n}=t;const{listIds:a}=e.chats,{byId:s}=e.chatFolders;return{loadedActiveChatIds:a.active,loadedArchivedChatIds:a.archived,isRemoved:void 0!==n.folderId&&!s[n.folderId]}}))((e=>{let{state:t,dispatch:n,onAddIncludedChats:s,onAddExcludedChats:o,isActive:l,onReset:c,isRemoved:d,onBack:u,loadedActiveChatIds:h,loadedArchivedChatIds:P}=e;const{editChatFolder:Z,addChatFolder:v}=(0,i.Sv)(),[p,g]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(!1);(0,a.d4)((()=>{d&&c()}),[d,c]);const{selectedChatIds:f,selectedChatTypes:b}=(0,vs.vb)(t,"included"),{selectedChatIds:I,selectedChatTypes:y}=(0,vs.vb)(t,"excluded");(0,a.d4)((()=>{g(!1),C(!1)}),[t.folderId]);const[S,k]=(0,a.Ye)((()=>{const e=new Set([...h||[],...P||[]]),t=(0,$e.eL)(f,e),n=(0,$e.eL)(I,e);return[p?t:t.slice(0,5-b.length),E?n:n.slice(0,5-y.length)]}),[I,f,b,y,E,p,h,P]),N=(0,M.Z)();(0,ie.Z)({isActive:l,onBack:u});const w=(0,a.I4)((e=>{const{currentTarget:t}=e;n({type:"setTitle",payload:t.value.trim()})}),[n]),T=(0,a.I4)((()=>{const{title:e}=t.folder;e?f.length||Object.keys(b).length?(n({type:"setIsLoading",payload:!0}),"edit"===t.mode?Z({id:t.folderId,folderUpdate:t.folder}):v({folder:t.folder}),setTimeout((()=>{c()}),500)):n({type:"setError",payload:Es}):n({type:"setError",payload:gs})}),[v,n,Z,f.length,b,c,t]);function A(e){const t="included"===e?b:y,n="included"===e?S:k,s="included"===e?p:E,i=("included"===e?f:I).length-t.length-n.length,o="included"===e?()=>g(!0):()=>C(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?vs.fi.find((t=>{let{key:n}=t;return n===e})):vs.Yy.find((t=>{let{key:n}=t;return n===e}));if(n)return a.ZP.createElement(Xe.Z,{key:n.key,className:"settings-folders-list-item mb-1",icon:n.icon,narrow:!0,inactive:!0},N(n.title))}(t,e))),n.map((e=>a.ZP.createElement(Xe.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,r.YC)(e)?a.ZP.createElement(qe.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(He.Z,{avatarSize:"small",chatId:e})))),!s&&i>0&&a.ZP.createElement(ps,{count:i,itemName:"chat",onClick:o}))}return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(hs.Z,{size:m.ku,tgsUrl:Wn.l.FoldersNew,play:String(t.folderId),className:"settings-content-icon"}),"create"===t.mode&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:N.isRtl?"rtl":void 0},N("FilterIncludeInfo")),a.ZP.createElement(ze.Z,{className:"mb-0",label:N("FilterNameHint"),value:t.folder.title,onChange:w,error:t.error&&t.error===gs?gs:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},t.error&&t.error===Es&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:N.isRtl?"rtl":void 0},N(t.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("FilterInclude")),a.ZP.createElement(Xe.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:s},N("FilterAddChats")),A("included")),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("FilterExclude")),a.ZP.createElement(Xe.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:o},N("FilterAddChats")),A("excluded"))),a.ZP.createElement(Ya.Z,{isShown:Boolean(t.isTouched),disabled:t.isLoading,onClick:T,ariaLabel:"edit"===t.mode?"Save changes":"Create folder"},t.isLoading?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),fs=(0,a.X$)((0,i.c$)((e=>({maxChats:(0,un.M)(e,"dialogFiltersChats")})))((e=>{let{mode:t,chatIds:n,selectedIds:s,selectedChatTypes:o,filterValue:l,onSelectedIdsChange:c,onSelectedChatTypesChange:d,onFilterChange:m,maxChats:u}=e;const{openLimitReachedModal:h}=(0,i.Sv)(),P=(0,a.sO)(null),Z="included"===t?vs.fi:vs.Yy,v=s.length+o.length>10;(0,a.d4)((()=>{setTimeout((()=>{requestAnimationFrame((()=>{P.current.focus()}))}),500)}),[]);const p=(0,a.I4)((e=>{const n=[...s];if(n.includes(e))n.splice(n.indexOf(e),1);else{if(s.length>=u&&"included"===t)return void h({limit:"dialogFiltersChats"});n.push(e)}c(n)}),[s,c,u,t,h]),g=(0,a.I4)((e=>{const t=[...o];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),d(t)}),[o,d]),E=(0,a.I4)((e=>{const{value:t}=e.currentTarget;m(t)}),[m]),C=(0,M.Z)(),[f,b]=(0,_e.Z)(void 0,n,Boolean(l));return a.ZP.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"picker-header custom-scroll"},o.map((function(e){const t=Z.find((t=>{let{key:n}=t;return e===n}));if(t)return a.ZP.createElement(ha.Z,{icon:t.icon,title:C(t.title),isMinimized:v,canClose:!0,onClick:g,clickArg:t.key})})),s.map(((e,t)=>a.ZP.createElement(ha.Z,{chatOrUserId:e,isMinimized:v&&t<s.length-5,canClose:!0,onClick:p,clickArg:e}))),a.ZP.createElement(ze.Z,{ref:P,value:l,onChange:E,placeholder:C("Search")})),a.ZP.createElement(Je.Z,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:f,onLoadMore:b},(!f||!f.length||f.includes(n[0]))&&a.ZP.createElement("div",{key:"header"},a.ZP.createElement("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("FilterChatTypes")),Z.map((function(e){return a.ZP.createElement(Xe.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"},C(e.title)),a.ZP.createElement(dt.Z,{label:"",checked:o.includes(e.key),round:!0}))})),a.ZP.createElement("div",{className:"picker-list-divider"}),a.ZP.createElement("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("FilterChats"))),f?.length?f.map((function(e){const t=s.includes(e);return a.ZP.createElement(Xe.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>p(e),ripple:!0},(0,r.YC)(e)?a.ZP.createElement(qe.Z,{userId:e}):a.ZP.createElement(He.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(dt.Z,{label:"",checked:t,round:!0}))})):f&&!f.length?a.ZP.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):a.ZP.createElement(Ve.Z,{key:"loading"})))}))),bs=(0,a.X$)((e=>{let{mode:t,state:n,dispatch:s,isActive:o,onReset:l}=e;const{chatFilter:c}=n,{selectedChatIds:d,selectedChatTypes:u}=(0,vs.vb)(n,t,!0),h=(0,M.Z)(),P=(0,us.d7)(m.Nf),Z=(0,us.d7)(m.WS),v=(0,a.Ye)((()=>{const e=(0,i.Rd)().chats.byId,t=[...P||[],...Z||[]];return(0,$e.Tw)([...d,...(0,r.$l)(h,t,e,c)])}),[P,Z,d,h,c]),p=(0,a.I4)((e=>{s({type:"setChatFilter",payload:e})}),[s]),g=(0,a.I4)((e=>{s("included"===t?{type:"setIncludeFilters",payload:{...n.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...n.excludeFilters,excludedChatIds:e}})}),[t,n,s]),E=(0,a.I4)((e=>{const n={};e.forEach((e=>{n[e]=!0})),s("included"===t?{type:"setIncludeFilters",payload:{includedChatIds:d,...n}}:{type:"setExcludeFilters",payload:{excludedChatIds:d,...n}})}),[t,d,s]);return(0,ie.Z)({isActive:o,onBack:l}),v?a.ZP.createElement(fs,{mode:t,chatIds:v,selectedIds:d,selectedChatTypes:u,filterValue:c,onSelectedIdsChange:g,onSelectedChatTypesChange:E,onFilterChange:p}):a.ZP.createElement(Ve.Z,null)})),Is=(0,a.X$)((e=>{let{currentScreen:t,shownScreen:n,state:i,dispatch:r,isActive:o,onScreenSelect:l,onReset:c}=e;const d=(0,a.I4)((()=>{t!==s.MT.FoldersCreateFolder&&t!==s.MT.FoldersEditFolder&&t!==s.MT.FoldersEditFolderFromChatList||setTimeout((()=>{r({type:"reset"})}),200),t!==s.MT.FoldersIncludedChats&&t!==s.MT.FoldersExcludedChats?c():"create"===i.mode?l(s.MT.FoldersCreateFolder):l(s.MT.FoldersEditFolder)}),[i.mode,r,t,c,l]),m=(0,a.I4)((()=>{r({type:"reset"}),l(s.MT.FoldersCreateFolder)}),[l,r]),u=(0,a.I4)((e=>{r({type:"editFolder",payload:e}),l(s.MT.FoldersEditFolder)}),[r,l]),h=(0,a.I4)((()=>{r({type:"editIncludeFilters"}),l(t===s.MT.FoldersEditFolderFromChatList?s.MT.FoldersIncludedChatsFromChatList:s.MT.FoldersIncludedChats)}),[t,r,l]),P=(0,a.I4)((()=>{r({type:"editExcludeFilters"}),l(t===s.MT.FoldersEditFolderFromChatList?s.MT.FoldersExcludedChatsFromChatList:s.MT.FoldersExcludedChats)}),[t,r,l]);switch(t){case s.MT.Folders:return a.ZP.createElement(Zs,{onCreateFolder:m,onEditFolder:u,isActive:o||[s.MT.FoldersCreateFolder,s.MT.FoldersEditFolder,s.MT.FoldersIncludedChats,s.MT.FoldersExcludedChats].includes(n),onReset:c});case s.MT.FoldersCreateFolder:case s.MT.FoldersEditFolder:case s.MT.FoldersEditFolderFromChatList:return a.ZP.createElement(Cs,{state:i,dispatch:r,onAddIncludedChats:h,onAddExcludedChats:P,onReset:d,isActive:o||[s.MT.FoldersIncludedChats,s.MT.FoldersExcludedChats].includes(n),onBack:c});case s.MT.FoldersIncludedChats:case s.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(bs,{mode:"included",state:i,dispatch:r,onReset:d,isActive:o});case s.MT.FoldersExcludedChats:case s.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(bs,{mode:"excluded",state:i,dispatch:r,onReset:d,isActive:o});default:return}}));var ys=n(50711),Ss=n(14434),ks=n(27370);const Ns=["Solid and Steady","Nice and Fast","Lots of Stuff"],ws=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],Ms=(0,a.X$)((0,i.c$)((e=>{const{theme:t,shouldUseSystemTheme:n}=e.settings.byKey;return{...(0,$e.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","isSensitiveEnabled","canChangeSensitive","timeFormat"]),theme:t,shouldUseSystemTheme:n}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,messageTextSize:o,animationLevel:l,messageSendKeyCombo:c,timeFormat:u,theme:h,shouldUseSystemTheme:P}=e;const{setSettingOption:Z}=(0,i.Sv)(),v=(0,M.Z)(),p=[{label:v("EmptyChat.Appearance.Light"),value:"light"},{label:v("EmptyChat.Appearance.Dark"),value:"dark"},{label:v("EmptyChat.Appearance.System"),value:"auto"}],g=d.$b?void 0:[{value:"enter",label:v("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:v(d.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}],E=(0,a.I4)((e=>{Ns.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),Z({animationLevel:e})}),[Z]),C=(0,a.I4)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,d.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()),Z({messageTextSize:e})}),[Z]),f=(0,a.I4)((e=>{const t="auto"===e?(0,d.vn)():e;Z({theme:t}),Z({shouldUseSystemTheme:"auto"===e}),t!==h&&(0,ks.Z)(t,l===m.zy)}),[l,Z,h]),b=(0,a.I4)((e=>{Z({timeFormat:e}),Z({wasTimeFormatSetManually:!0}),(0,ys.qf)(e)}),[Z]),I=(0,a.I4)((e=>{Z({messageSendKeyCombo:e})}),[Z]);return(0,ie.Z)({isActive:t,onBack:r}),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:v.isRtl?"rtl":void 0},v("SETTINGS")),a.ZP.createElement(Ze.Z,{label:v("TextSize"),min:12,max:20,value:o,onChange:C}),a.ZP.createElement(Xe.Z,{icon:"photo",onClick:()=>n(s.MT.GeneralChatBackground)},v("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("Theme")),a.ZP.createElement(Ss.Z,{name:"theme",options:p,selected:P?"auto":h,onChange:f})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(Ss.Z,{name:"timeformat",options:ws,selected:u,onChange:b})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:v.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(Ze.Z,{options:Ns,value:l,onChange:E})),g&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("VoiceOver.Keyboard")),a.ZP.createElement(Ss.Z,{name:"keyboard-send-settings",options:g,onChange:I,selected:c})))})));var Ts=n(85655),As=n(75851),Rs=n(49524);const Ls=(0,a.X$)((e=>{let{wallpaper:t,theme:n,isSelected:i,onClick:r}=e;const{slug:o,document:l}=t,c=`wallpaper${l.id}`,d=l.previewBlobUrl,u=(0,R.Z)(`${c}?size=m`),h=(0,Ot.Z)(l.thumbnail?.dataUri,Boolean(u),!0),{transitionClassNames:P}=(0,me.Z)(Boolean(u||d),void 0,void 0,"slow"),[Z,v]=(0,a.eJ)(!1),{mediaData:p,loadProgress:g}=(0,L.Z)(c,!Z),E=!1===(0,T.Z)(Z),{shouldRender:C,transitionClassNames:f}=(0,me.Z)(Z&&!p||o===s.mp,void 0,E,"slow"),b=(0,a.sO)();b.current=n;const I=(0,a.I4)((()=>{(async()=>{const e=await(0,B.gm)(p);await Rs.save(m.fo,b.current,e),r(o)})()}),[p,r,o]);(0,a.d4)((()=>{p&&I()}),[p,I]);const y=(0,a.I4)((()=>{p?I():v((e=>!e))}),[p,I]),S=(0,W.Z)("WallpaperTile",i&&"selected");return a.ZP.createElement("div",{className:S,onClick:y},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:h,className:"thumbnail"}),a.ZP.createElement("img",{src:u||d,className:(0,W.Z)("full-media",P),alt:""}),C&&a.ZP.createElement("div",{className:(0,W.Z)("spinner-container",f)},a.ZP.createElement(z.Z,{progress:g,onClick:y}))))})),Fs=(0,te.P2)((e=>e()),6e4,!0),xs=(0,a.X$)((0,i.c$)((e=>{const t=(0,o.Pu)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:r,background:o,isBlurred:l,loadedWallpapers:c,theme:d}=e;const{loadWallpapers:u,uploadWallpaper:h,setThemeSettings:P}=(0,i.Sv)(),Z=(0,a.sO)();Z.current=d,(0,a.d4)((()=>{Fs((()=>{u()}))}),[u]);const v=(0,a.I4)((e=>{const{files:t}=e.target;t&&t.length>0&&h(t[0])}),[h]),p=(0,a.I4)((()=>{(0,Ts.g)("image/jpeg",v,!0)}),[v]),g=(0,a.I4)((()=>{n(s.MT.GeneralChatBackgroundColor)}),[n]),E=(0,a.I4)((()=>{P({theme:d,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===d?m.Vv:m.g})}),[P,d]),C=(0,a.I4)((e=>{P({theme:Z.current,background:e});const t=c&&c.find((t=>t.slug===e));t?.document.thumbnail&&(0,As.ix)(t.document.thumbnail.dataUri).then((e=>{const t=(0,As.uR)(e),n=`#${(0,As.CO)(e)}`;P({theme:Z.current,backgroundColor:n,patternColor:t})}))}),[c,P]),f=(0,a.I4)((e=>{P({theme:Z.current,isBlurred:e.target.checked})}),[P]),b=(0,M.Z)();(0,ie.Z)({isActive:t,onBack:r});const I=c?.[0]&&c[0].slug===s.mp;return a.ZP.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Xe.Z,{icon:"camera-add",className:"mb-0",disabled:I,onClick:p},b("UploadImage")),a.ZP.createElement(Xe.Z,{icon:"colorize",className:"mb-0",onClick:g},b("SetColor")),a.ZP.createElement(Xe.Z,{icon:"favorite",onClick:E},b("ThemeResetToDefaults")),a.ZP.createElement(dt.Z,{label:b("BackgroundBlurred"),checked:Boolean(l),onChange:f})),c?a.ZP.createElement("div",{className:"settings-wallpapers"},c.map((e=>a.ZP.createElement(Ls,{wallpaper:e,theme:d,isSelected:o===e.slug,onClick:C})))):a.ZP.createElement(Ve.Z,null))}))),Bs=(0,As.xP)((0,As.wK)("e6ebee")),Os=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Ds(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 Us(e,t){let{colorPosition:n,huePosition:a}=e;return[a/(t.hueRect.width-1),n[0]/(t.colorRect.width-1),1-n[1]/(t.colorRect.height-1)]}const $s=(0,a.X$)((0,i.c$)((e=>{const t=(0,o.Pu)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}))((e=>{let{isActive:t,onReset:n,theme:s,backgroundColor:r}=e;const{setThemeSettings:o}=(0,i.Sv)(),l=(0,a.sO)();l.current=s;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=(0,a.sO)(null),u=(0,a.sO)(!0),[h,P]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?(0,As.xP)((0,As.wK)(e.replace("#",""))):Bs}(r)),Z=(0,a.sO)(h);(0,a.d4)((()=>{Z.current=h}),[h]);const[v,p,g]=(0,I.Z)(),[E,C]=(0,a.eJ)(""),[f,b]=(0,a.eJ)(""),y=(0,a.sO)(),S=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:d.current.offsetLeft,...(0,$e.ei)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:m.current.offsetLeft,...(0,$e.ei)(m.current.getBoundingClientRect(),["width"])};function n(t){const n=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+c.current.scrollTop),e.height-1)],{huePosition:a}=Ds(Z.current,y.current);return P(Us({colorPosition:n,huePosition:a},y.current)),p(),!0}function a(e){const{colorPosition:n}=Ds(Z.current,y.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return P(Us({colorPosition:n,huePosition:a},y.current)),p(),!0}y.current={colorRect:e,hueRect:t},(0,Q.sf)(d.current,{onCapture:n,onDrag:n,onRelease:g,onClick:g,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,Q.sf)(m.current,{onCapture:a,onDrag:a,onRelease:g,onClick:g,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[p,g]);const{colorPosition:k=[0,0],huePosition:N=0}=y.current?Ds(h,y.current):{},w=(0,As.CO)((0,As.eb)(h)),M=h[0],T=(0,As.CO)((0,As.eb)([M,1,1]));(0,a.d4)((()=>{const e=(0,As.eb)(h),t=`#${(0,As.CO)(e)}`;if(C(e.join(", ")),b(t),!u.current){const n=(0,As.uR)(e);o({theme:l.current,background:void 0,backgroundColor:t,patternColor:n})}u.current=!1}),[h,o]),(0,a.d4)((()=>{!function(e,t,n,a){let s,i,r;n.current&&a.current?(s=a.current.colorRect.width,i=a.current.colorRect.height,r=n.current):(s=e.offsetWidth,i=e.offsetHeight,r=e.getContext("2d"),e.width=s,e.height=i,n.current=r);const o=r.createImageData(s,i),l=o.data,c=(0,As.eb)([t,1,1]);let d=0;for(let e=0;e<i;e++){const t=1-e/(i-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}}r.putImageData(o,0,0)}(d.current.firstChild,M,S,y)}),[M]),(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 i=0;for(let e=0;e<t;e++){const n=e/(t-1),a=(0,As.eb)([n,1,1]);s[i++]=a[0],s[i++]=a[1],s[i++]=a[2],s[i++]=255}n.putImageData(a,0,0)}(m.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((0,As.xP)(e))}e.currentTarget.value=t}),[]),R=(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((0,As.xP)((0,As.wK)(t.replace("#","")))),e.currentTarget.value=t}),[]),L=(0,a.I4)((e=>{P((0,As.xP)((0,As.wK)(e.currentTarget.dataset.color.replace("#",""))))}),[]),F=(0,W.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",v&&"is-dragging");return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{ref:c,className:F},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:d,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${k[0]}px, ${k[1]}px); background-color: #${w};`})),a.ZP.createElement("div",{ref:m,className:"hue-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translateX(${N}px); background-color: #${T};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(ze.Z,{value:f,label:"HEX",onChange:R}),a.ZP.createElement(ze.Z,{value:E,label:"RGB",onChange:A}))),a.ZP.createElement("div",{className:"predefined-colors"},Os.map((e=>a.ZP.createElement("div",{className:e===`#${w}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:L})))))})));var _s=n(88957),Gs=n(28406);const js=(0,a.X$)((0,i.c$)((e=>({hasPrivateChatsNotifications:Boolean(e.settings.byKey.hasPrivateChatsNotifications),hasPrivateChatsMessagePreview:Boolean(e.settings.byKey.hasPrivateChatsMessagePreview),hasGroupNotifications:Boolean(e.settings.byKey.hasGroupNotifications),hasGroupMessagePreview:Boolean(e.settings.byKey.hasGroupMessagePreview),hasBroadcastNotifications:Boolean(e.settings.byKey.hasBroadcastNotifications),hasBroadcastMessagePreview:Boolean(e.settings.byKey.hasBroadcastMessagePreview),hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume})))((e=>{let{isActive:t,onReset:n,hasPrivateChatsNotifications:s,hasPrivateChatsMessagePreview:r,hasGroupNotifications:o,hasGroupMessagePreview:l,hasBroadcastNotifications:c,hasBroadcastMessagePreview:d,hasContactJoinedNotifications:m,hasPushNotifications:u,hasWebNotifications:h,notificationSoundVolume:P}=e;const{loadNotificationSettings:Z,updateContactSignUpNotification:v,updateNotificationSettings:p,updateWebNotificationSettings:g}=(0,i.Sv)();(0,a.d4)((()=>{Z()}),[Z]);const E=(0,_s.Z)(500,!0),C=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!s:!("group"===t?o:c),i="contact"===t?r:"group"===t?l:d;p({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:i},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[d,c,l,o,r,s,p]),f=(0,a.I4)((e=>{g({hasWebNotifications:e.target.checked})}),[g]),b=(0,a.I4)((e=>{g({hasPushNotifications:e.target.checked})}),[g]),I=(0,a.I4)((e=>{C(e,"contact","silent")}),[C]),y=(0,a.I4)((e=>{C(e,"contact","showPreviews")}),[C]),S=(0,a.I4)((e=>{C(e,"group","silent")}),[C]),k=(0,a.I4)((e=>{C(e,"group","showPreviews")}),[C]),N=(0,a.I4)((e=>{C(e,"broadcast","silent")}),[C]),w=(0,a.I4)((e=>{C(e,"broadcast","showPreviews")}),[C]),T=(0,a.I4)((e=>{v({isSilent:!e.target.checked})}),[v]),A=(0,a.I4)((e=>{g({notificationSoundVolume:e}),E((()=>(0,Gs.q3)(void 0,e)))}),[E,g]),R=(0,M.Z)();return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:R.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(dt.Z,{label:"Web notifications",subLabel:R(h?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:h,onChange:f}),a.ZP.createElement(dt.Z,{label:"Offline notifications",disabled:!h,subLabel:R(u?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:u,onChange:b}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(Ze.Z,{label:"Sound",min:0,max:10,value:P,onChange:A}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:R.isRtl?"rtl":void 0},R("AutodownloadPrivateChats")),a.ZP.createElement(dt.Z,{label:R("NotificationsForPrivateChats"),subLabel:R(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:I}),a.ZP.createElement(dt.Z,{label:R("MessagePreview"),disabled:!s,subLabel:R(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:y})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:R.isRtl?"rtl":void 0},R("FilterGroups")),a.ZP.createElement(dt.Z,{label:R("NotificationsForGroups"),subLabel:R(o?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:o,onChange:S}),a.ZP.createElement(dt.Z,{label:R("MessagePreview"),disabled:!o,subLabel:R(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:k})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:R.isRtl?"rtl":void 0},R("FilterChannels")),a.ZP.createElement(dt.Z,{label:R("NotificationsForChannels"),subLabel:R(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:N}),a.ZP.createElement(dt.Z,{label:R("MessagePreview"),disabled:!c,subLabel:R(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:w})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:R.isRtl?"rtl":void 0},R("PhoneOther")),a.ZP.createElement(dt.Z,{label:R("ContactJoined"),checked:m,onChange:T})))}))),Vs=(0,a.X$)((0,i.c$)((e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:n,canChangeSensitive:a,shouldArchiveAndMuteNewNonContact:s},privacy:i},blocked:r,passcode:{hasPasscode:l}}=e;return{isCurrentUserPremium:(0,o.wV)(e),hasPassword:t,hasPasscode:Boolean(l),blockedCount:r.totalCount,webAuthCount:e.activeWebSessions.orderedHashes.length,isSensitiveEnabled:n,shouldArchiveAndMuteNewNonContact:s,canChangeSensitive:a,privacyPhoneNumber:i.phoneNumber,privacyLastSeen:i.lastSeen,privacyProfilePhoto:i.profilePhoto,privacyForwarding:i.forwards,privacyVoiceMessages:i.voiceMessages,privacyGroupChats:i.chatInvite,privacyPhoneCall:i.phoneCall,privacyPhoneP2P:i.phoneP2P}}))((e=>{let{isActive:t,isCurrentUserPremium:n,hasPassword:r,hasPasscode:o,blockedCount:l,webAuthCount:c,isSensitiveEnabled:d,canChangeSensitive:m,shouldArchiveAndMuteNewNonContact:u,privacyPhoneNumber:h,privacyLastSeen:P,privacyProfilePhoto:Z,privacyForwarding:v,privacyVoiceMessages:p,privacyGroupChats:g,privacyPhoneCall:E,privacyPhoneP2P:C,onScreenSelect:f,onReset:b}=e;const{loadPrivacySettings:I,loadBlockedContacts:y,loadAuthorizations:S,loadContentSettings:k,updateContentSettings:N,loadGlobalPrivacySettings:w,updateGlobalPrivacySettings:T,loadWebAuthorizations:A,showNotification:R}=(0,i.Sv)();(0,a.d4)((()=>{y(),S(),I(),k(),A()}),[y,S,I,k,A]),(0,a.d4)((()=>{t&&w()}),[t,w]);const L=(0,M.Z)();(0,ie.Z)({isActive:t,onBack:b});const F=(0,a.I4)((e=>{T({shouldArchiveAndMuteNewNonContact:e})}),[T]),x=(0,a.I4)((()=>{n?f(s.MT.PrivacyVoiceMessages):R({message:L("PrivacyVoiceMessagesPremiumOnly")})}),[n,L,f,R]);function B(e){const{visibility:t}=e||{},n=e?e.blockChatIds.length+e.blockUserIds.length:0,a=e?e.allowChatIds.length+e.allowUserIds.length:0,s=[];n&&s.push(`-${n}`),a&&s.push(`+${a}`);const i=s.length?`(${s.join(",")})`:"";switch(t){case"everybody":return`${L("P2PEverybody")} ${i}`;case"contacts":return`${L("P2PContacts")} ${i}`;case"nobody":return`${L("P2PNobody")} ${i}`}}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Xe.Z,{icon:"delete-user",onClick:()=>f(s.MT.PrivacyBlockedUsers)},L("BlockedUsers"),a.ZP.createElement("span",{className:"settings-item__current-value"},l||"")),a.ZP.createElement(Xe.Z,{icon:"web",onClick:()=>f(s.MT.ActiveWebsites)},L("PrivacySettings.WebSessions"),a.ZP.createElement("span",{className:"settings-item__current-value"},c||"")),a.ZP.createElement(Xe.Z,{icon:"key",narrow:!0,onClick:()=>f(o?s.MT.PasscodeEnabled:s.MT.PasscodeDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("Passcode")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},L(o?"PasswordOn":"PasswordOff")))),a.ZP.createElement(Xe.Z,{icon:"lock",narrow:!0,onClick:()=>f(r?s.MT.TwoFaEnabled:s.MT.TwoFaDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},L(r?"PasswordOn":"PasswordOff"))))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:L.isRtl?"rtl":void 0},L("PrivacyTitle")),a.ZP.createElement(Xe.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.MT.PrivacyPhoneNumber)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},B(h)))),a.ZP.createElement(Xe.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.MT.PrivacyLastSeen)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},B(P)))),a.ZP.createElement(Xe.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.MT.PrivacyProfilePhoto)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},B(Z)))),a.ZP.createElement(Xe.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.MT.PrivacyPhoneCall)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("WhoCanCallMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},B(E)))),a.ZP.createElement(Xe.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.MT.PrivacyPhoneP2P)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("PrivacyP2P")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},B(C)))),a.ZP.createElement(Xe.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.MT.PrivacyForwarding)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},B(v)))),a.ZP.createElement(Xe.Z,{narrow:!0,disabled:!n,allowDisabledClick:!0,rightElement:!n&&a.ZP.createElement("i",{className:"icon-lock-badge settings-icon-locked"}),className:"no-icon",onClick:x},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("PrivacyVoiceMessages")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},B(p)))),a.ZP.createElement(Xe.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.MT.PrivacyGroupChats)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},L("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},B(g))))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("NewChatsFromNonContacts")),a.ZP.createElement(dt.Z,{label:L("ArchiveAndMute"),subLabel:L("ArchiveAndMuteInfo"),checked:Boolean(u),onCheck:F})),m&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("lng_settings_sensitive_title")),a.ZP.createElement(dt.Z,{label:L("lng_settings_sensitive_disable_filtering"),subLabel:L("lng_settings_sensitive_about"),checked:Boolean(d),disabled:!m,onCheck:N})))}))),zs=(0,a.X$)((0,i.c$)((e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language})))((e=>{let{isActive:t,onReset:n,languages:s,language:r}=e;const{loadLanguages:o,setSettingOption:l}=(0,i.Sv)(),[c,d]=(0,a.eJ)(r),[m,u,h]=(0,I.Z)();(0,a.d4)((()=>{o()}),[o]);const P=(0,a.I4)((e=>{d(e),u(),(0,ys.m0)(e,(()=>{h(),l({language:e})}))}),[u,h,l]),Z=(0,a.Ye)((()=>s?function(e){const t=(window.navigator.language||"en").toLowerCase(),n=t.substr(0,2);return e.map((e=>{let{langCode:t,nativeName:n,name:a}=e;return{value:t,label:n,subLabel:a}})).sort((e=>!t||e.value!==t&&e.value!==n?0:-1))}(s):void 0),[s]);return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content settings-item settings-language custom-scroll settings-item--first"},Z?a.ZP.createElement(Ss.Z,{name:"keyboard-send-settings",options:Z,selected:c,loadingOption:m?c:void 0,onChange:P}):a.ZP.createElement(Ve.Z,null))})));function Js(e){switch(e){case s.MT.PrivacyPhoneNumber:case s.MT.PrivacyPhoneNumberAllowedContacts:case s.MT.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case s.MT.PrivacyLastSeen:case s.MT.PrivacyLastSeenAllowedContacts:case s.MT.PrivacyLastSeenDeniedContacts:return"lastSeen";case s.MT.PrivacyProfilePhoto:case s.MT.PrivacyProfilePhotoAllowedContacts:case s.MT.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case s.MT.PrivacyForwarding:case s.MT.PrivacyForwardingAllowedContacts:case s.MT.PrivacyForwardingDeniedContacts:return"forwards";case s.MT.PrivacyVoiceMessages:case s.MT.PrivacyVoiceMessagesAllowedContacts:case s.MT.PrivacyVoiceMessagesDeniedContacts:return"voiceMessages";case s.MT.PrivacyGroupChats:case s.MT.PrivacyGroupChatsAllowedContacts:case s.MT.PrivacyGroupChatsDeniedContacts:return"chatInvite";case s.MT.PrivacyPhoneCall:case s.MT.PrivacyPhoneCallAllowedContacts:case s.MT.PrivacyPhoneCallDeniedContacts:return"phoneCall";case s.MT.PrivacyPhoneP2P:case s.MT.PrivacyPhoneP2PAllowedContacts:case s.MT.PrivacyPhoneP2PDeniedContacts:return"phoneP2P"}}const Xs=(0,a.X$)((0,i.c$)(((e,t)=>{let n,{screen:a}=t;const{chats:{byId:i},settings:{privacy:r}}=e;switch(a){case s.MT.PrivacyPhoneNumber:n=r.phoneNumber;break;case s.MT.PrivacyLastSeen:n=r.lastSeen;break;case s.MT.PrivacyProfilePhoto:n=r.profilePhoto;break;case s.MT.PrivacyPhoneCall:n=r.phoneCall;break;case s.MT.PrivacyPhoneP2P:n=r.phoneP2P;break;case s.MT.PrivacyForwarding:n=r.forwards;break;case s.MT.PrivacyVoiceMessages:n=r.voiceMessages;break;case s.MT.PrivacyGroupChats:n=r.chatInvite}return n?{...n,chatsById:i}:{}}))((e=>{let{screen:t,isActive:n,onScreenSelect:r,onReset:o,visibility:l,allowUserIds:c,allowChatIds:d,blockUserIds:m,blockChatIds:u,chatsById:h}=e;const{setPrivacyVisibility:P}=(0,i.Sv)(),Z=(0,M.Z)(),v=(0,a.Ye)((()=>{switch(t){case s.MT.PrivacyProfilePhoto:case s.MT.PrivacyGroupChats:return[{value:"everybody",label:Z("P2PEverybody")},{value:"contacts",label:Z("P2PContacts")}];default:return[{value:"everybody",label:Z("P2PEverybody")},{value:"contacts",label:Z("P2PContacts")},{value:"nobody",label:Z("P2PNobody")}]}}),[Z,t]),p={shouldShowDenied:"nobody"!==l,shouldShowAllowed:"everybody"!==l},g=Js(t),E=(0,a.Ye)((()=>{switch(t){case s.MT.PrivacyPhoneNumber:return Z("PrivacyPhoneTitle");case s.MT.PrivacyLastSeen:return Z("LastSeenTitle");case s.MT.PrivacyProfilePhoto:return Z("PrivacyProfilePhotoTitle");case s.MT.PrivacyForwarding:return Z("PrivacyForwardsTitle");case s.MT.PrivacyVoiceMessages:return Z("PrivacyVoiceMessagesTitle");case s.MT.PrivacyGroupChats:return Z("WhoCanAddMe");case s.MT.PrivacyPhoneCall:return Z("WhoCanCallMe");case s.MT.PrivacyPhoneP2P:return Z("PrivacyP2P");default:return}}),[Z,t]);(0,ie.Z)({isActive:n,onBack:o});const C=(0,a.Ye)((()=>{if(t===s.MT.PrivacyLastSeen)return Z("CustomHelp")}),[Z,t]),f=(()=>{switch(t){case s.MT.PrivacyPhoneNumber:return s.MT.PrivacyPhoneNumberAllowedContacts;case s.MT.PrivacyLastSeen:return s.MT.PrivacyLastSeenAllowedContacts;case s.MT.PrivacyProfilePhoto:return s.MT.PrivacyProfilePhotoAllowedContacts;case s.MT.PrivacyForwarding:return s.MT.PrivacyForwardingAllowedContacts;case s.MT.PrivacyPhoneCall:return s.MT.PrivacyPhoneCallAllowedContacts;case s.MT.PrivacyPhoneP2P:return s.MT.PrivacyPhoneP2PAllowedContacts;case s.MT.PrivacyVoiceMessages:return s.MT.PrivacyVoiceMessagesAllowedContacts;default:return s.MT.PrivacyGroupChatsAllowedContacts}})(),b=(()=>{switch(t){case s.MT.PrivacyPhoneNumber:return s.MT.PrivacyPhoneNumberDeniedContacts;case s.MT.PrivacyLastSeen:return s.MT.PrivacyLastSeenDeniedContacts;case s.MT.PrivacyProfilePhoto:return s.MT.PrivacyProfilePhotoDeniedContacts;case s.MT.PrivacyForwarding:return s.MT.PrivacyForwardingDeniedContacts;case s.MT.PrivacyPhoneCall:return s.MT.PrivacyPhoneCallDeniedContacts;case s.MT.PrivacyPhoneP2P:return s.MT.PrivacyPhoneP2PDeniedContacts;case s.MT.PrivacyVoiceMessages:return s.MT.PrivacyVoiceMessagesDeniedContacts;default:return s.MT.PrivacyGroupChatsDeniedContacts}})(),I=(0,a.Ye)((()=>c&&d&&h?d.reduce(((e,t)=>e+(h[t]?h[t].membersCount:0)),c.length):0),[d,c,h]),y=(0,a.Ye)((()=>m&&u&&h?u.reduce(((e,t)=>e+(h[t]?h[t].membersCount:0)),m.length):0),[u,m,h]),S=(0,a.I4)((e=>{P({privacyKey:g,visibility:e})}),[g,P]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:Z.isRtl?"rtl":void 0},E),a.ZP.createElement(Ss.Z,{name:`visibility-${g}`,options:v,onChange:S,selected:l}),C&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:Z.isRtl?"rtl":void 0},C)),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:Z.isRtl?"rtl":void 0},Z("PrivacyExceptions")),p.shouldShowAllowed&&a.ZP.createElement(Xe.Z,{narrow:!0,icon:"add-user",onClick:()=>{r(f)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},I>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"+",I),a.ZP.createElement("span",{className:"title"},Z("AlwaysAllow")),a.ZP.createElement("span",{className:"subtitle"},Z("EditAdminAddUsers")))),p.shouldShowDenied&&a.ZP.createElement(Xe.Z,{narrow:!0,icon:"delete-user",onClick:()=>{r(b)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},y>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"",y),a.ZP.createElement("span",{className:"title"},Z("NeverAllow")),a.ZP.createElement("span",{className:"subtitle"},Z("EditAdminAddUsers"))))))})));function Hs(e){const t=e.platform.toLowerCase(),n=e.deviceModel.toLowerCase(),a=e.systemVersion.toLowerCase();return n.includes("xbox")?"xbox":n.includes("chrome")&&!n.includes("chromebook")?"chrome":n.includes("brave")?"brave":n.includes("vivaldi")?"vivaldi":n.includes("safari")?"safari":n.includes("firefox")?"firefox":n.includes("opera")?"opera":n.includes("samsungbrowser")?"samsung":t.includes("android")?"android":n.includes("iphone")||n.includes("ipad")||t.includes("ios")||t.includes("macos")||a.includes("macos")?"apple":t.includes("ubuntu")||a.includes("ubuntu")?"ubuntu":t.includes("linux")||a.includes("linux")?"linux":t.includes("windows")||a.includes("windows")?"windows":"unknown"}var qs=n(83321);const Ys={SettingsActiveSession:"P9I8aybVU7NyFiMWiyU2",settingsActiveSession:"P9I8aybVU7NyFiMWiyU2",iconDevice:"a633Zas_0v2MAAY277vj",iconDevice__android:"GUI0ogXbRdxQ2RGy8fGv",iconDeviceAndroid:"GUI0ogXbRdxQ2RGy8fGv",iconDevice__apple:"emCcCPeQ7_9DHBonyO02",iconDeviceApple:"emCcCPeQ7_9DHBonyO02",iconDevice__brave:"OMEQQMEIcjln7GIyfO3Q",iconDeviceBrave:"OMEQQMEIcjln7GIyfO3Q",iconDevice__chrome:"XEQtza6nFt8ptPkvbi2w",iconDeviceChrome:"XEQtza6nFt8ptPkvbi2w",iconDevice__edge:"iHueuVDDSF_BaK2Wa06i",iconDeviceEdge:"iHueuVDDSF_BaK2Wa06i",iconDevice__firefox:"KM9rrbhNSrNOW8roXGo_",iconDeviceFirefox:"KM9rrbhNSrNOW8roXGo_",iconDevice__linux:"JzdHedSfMsVcaa8u4X6O",iconDeviceLinux:"JzdHedSfMsVcaa8u4X6O",iconDevice__opera:"McukeiFuIkeZbxMNzQKK",iconDeviceOpera:"McukeiFuIkeZbxMNzQKK",iconDevice__safari:"XGWuju_22haQw0Qraor7",iconDeviceSafari:"XGWuju_22haQw0Qraor7",iconDevice__samsung:"ZZGcTr3P3RJrOwOwFX6r",iconDeviceSamsung:"ZZGcTr3P3RJrOwOwFX6r",iconDevice__ubuntu:"OPtbMfpfiWN3dxilMOPX",iconDeviceUbuntu:"OPtbMfpfiWN3dxilMOPX",iconDevice__unknown:"xoc1kuf1XAKh_dhO758U",iconDeviceUnknown:"xoc1kuf1XAKh_dhO758U",iconDevice__vivaldi:"Y25gBvz9xzZicoJgQf8Y",iconDeviceVivaldi:"Y25gBvz9xzZicoJgQf8Y",iconDevice__windows:"dKbtoO2xjdhL8W2mqyxr",iconDeviceWindows:"dKbtoO2xjdhL8W2mqyxr",iconDevice__xbox:"FhLv8AIUHzsoTX8b0zdA",iconDeviceXbox:"FhLv8AIUHzsoTX8b0zdA",title:"b9iUjEhCpOrQ4dPhn2KU",note:"hTTCWbngkwJoEwtGFD9o",date:"pUv5oVVNDZ5lBRzNzx3X",box:"e32uLjclYAYuxxW1CAex",actionHeader:"xwSMwr4aHsrRVIVInLEo",actionName:"tSrCe7E_Iom1nGuh2Gs3",headerButton:"N0buK669iHOZ1hN_H7Ik"},Ks=(0,a.X$)((0,i.c$)(((e,t)=>{let{hash:n}=t;return{session:n?e.activeSessions.byHash[n]:void 0}}))((e=>{let{isOpen:t,session:n,onClose:s}=e;const{changeSessionSettings:r,terminateAuthorization:o}=(0,i.Sv)(),l=(0,M.Z)(),c=(0,Ke.Z)(n,!0),d=(0,a.I4)((()=>{r({hash:n.hash,areSecretChatsEnabled:!n.areSecretChatsEnabled})}),[r,n]),m=(0,a.I4)((()=>{r({hash:n.hash,areCallsEnabled:!n.areCallsEnabled})}),[r,n]),u=(0,a.I4)((()=>{o({hash:n.hash}),s()}),[s,n,o]);if(c)return a.ZP.createElement(X.Z,{header:a.ZP.createElement("div",{className:"modal-header-condensed",dir:l.isRtl?"rtl":void 0},a.ZP.createElement($.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:l("Close"),onClick:s},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},l("SessionPreview.Title")),a.ZP.createElement($.Z,{color:"danger",onClick:u,className:(0,W.Z)("modal-action-button",Ys.headerButton)},l("SessionPreview.TerminateSession"))),isOpen:t,hasCloseButton:!0,onClose:s,className:Ys.SettingsActiveSession},a.ZP.createElement("div",{className:(0,W.Z)(Ys.iconDevice,c&&Ys[`iconDevice__${Hs(c)}`])}),a.ZP.createElement("h3",{className:Ys.title,dir:"auto"},c?.deviceModel),a.ZP.createElement("div",{className:Ys.date,"aria-label":l("PrivacySettings.LastSeen")},(0,he.SA)(1e3*c.dateActive,l.code)),a.ZP.createElement("dl",{className:Ys.box},a.ZP.createElement("dt",null,l("SessionPreview.App")),a.ZP.createElement("dd",null,c?.appName," ",c?.appVersion,","," ",c?.platform," ",c?.systemVersion),a.ZP.createElement("dt",null,l("SessionPreview.Ip")),a.ZP.createElement("dd",null,c?.ip),a.ZP.createElement("dt",null,l("SessionPreview.Location")),a.ZP.createElement("dd",null,c&&function(e){return[e.region,e.country].filter(Boolean).join(", ")}(c))),a.ZP.createElement("p",{className:Ys.note},l("SessionPreview.IpDesc")),a.ZP.createElement("h4",{className:Ys.actionHeader},l("AuthSessions.View.AcceptTitle")),a.ZP.createElement(Xe.Z,{onClick:d},a.ZP.createElement("span",{className:Ys.actionName},l("SessionPreview.Accept.Secret")),a.ZP.createElement(qs.Z,{id:"accept_secrets",label:"On",checked:c.areSecretChatsEnabled})),a.ZP.createElement(Xe.Z,{onClick:m},a.ZP.createElement("span",{className:Ys.actionName},l("SessionPreview.Accept.Calls")),a.ZP.createElement(qs.Z,{id:"accept_calls",label:"On",checked:c.areCallsEnabled})))})));function Ws(e){return[e.region,e.country].filter(Boolean).join(", ")}const Qs=(0,a.X$)((0,i.c$)((e=>e.activeSessions))((e=>{let{isActive:t,onReset:n,byHash:s,orderedHashes:r,ttlDays:o}=e;const{terminateAuthorization:l,terminateAllAuthorizations:c,changeSessionTtl:d}=(0,i.Sv)(),m=(0,M.Z)(),[u,h,P]=(0,I.Z)(),[Z,v]=(0,a.eJ)(),[p,g,E]=(0,I.Z)(),C=(0,a.Ye)((()=>{if(void 0!==o)return o<=7?"7":o<=30?"30":o<=93?"90":o<=183?"183":o>183?"365":void 0}),[o]),f=(0,a.Ye)((()=>{const e=[{label:m("Weeks",1,"i"),value:"7"},{label:m("Months",1,"i"),value:"30"},{label:m("Months",3,"i"),value:"90"},{label:m("Months",6,"i"),value:"183"}];return o&&o>=365&&e.push({label:m("Years",1,"i"),value:"365"}),e}),[m,o]),b=(0,a.I4)((e=>{l({hash:e})}),[l]),y=(0,a.I4)((()=>{P(),c()}),[P,c]),S=(0,a.I4)((e=>{v(e),g()}),[g]),k=(0,a.I4)((()=>{v(void 0),E()}),[E]),N=(0,a.I4)((e=>{d({days:Number(e)})}),[d]),w=(0,a.Ye)((()=>{const e=r.find((e=>s[e].isCurrent));return e?s[e]:void 0}),[s,r]),T=(0,a.Ye)((()=>r.filter((e=>!s[e].isCurrent))),[s,r]),A=Boolean(T.length);return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content custom-scroll SettingsActiveSessions"},w&&(L=w,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("AuthSessions.CurrentSession")),a.ZP.createElement(Xe.Z,{narrow:!0,inactive:!0,icon:`device-${Hs(L)} icon-device`},a.ZP.createElement("div",{className:"multiline-menu-item",dir:"auto"},a.ZP.createElement("span",{className:"title",dir:"auto"},L.deviceModel),a.ZP.createElement("span",{className:"subtitle black tight"},L.appName," ",L.appVersion,", ",L.platform," ",L.systemVersion),a.ZP.createElement("span",{className:"subtitle"},L.ip," - ",Ws(L)))),A&&a.ZP.createElement(Xe.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:h},m("TerminateAllSessions")))),A&&(R=T,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("OtherSessions")),R.map((function(e){const t=s[e];return a.ZP.createElement(Xe.Z,{key:t.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{b(t.hash)}}],icon:`device-${Hs(t)} icon-device`,onClick:()=>{S(t.hash)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,he.VX)(m,1e3*t.dateActive)),a.ZP.createElement("span",{className:"title"},t.deviceModel),a.ZP.createElement("span",{className:"subtitle black tight"},t.appName," ",t.appVersion,", ",t.platform," ",t.systemVersion),a.ZP.createElement("span",{className:"subtitle"},t.ip," ",Ws(t))))})))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("TerminateOldSessionHeader")),a.ZP.createElement("p",null,m("IfInactiveFor")),a.ZP.createElement(Ss.Z,{name:"session_ttl",options:f,selected:C,onChange:N})),A&&a.ZP.createElement(lt.Z,{isOpen:u,onClose:P,text:m("AreYouSureSessions"),confirmLabel:m("TerminateAllSessions"),confirmHandler:y,confirmIsDestructive:!0}),a.ZP.createElement(Ks,{isOpen:p,hash:Z,onClose:k}));var R,L}))),ei="TgiK64wG1hkOWSiXybQf",ti=(0,a.X$)((0,i.c$)(((e,t)=>{let{hash:n}=t;const a=n?e.activeWebSessions.byHash[n]:void 0;return{session:a,bot:a?e.users.byId[a.botId]:void 0,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{isOpen:t,session:n,bot:s,animationLevel:r,onClose:o}=e;const{terminateWebAuthorization:l}=(0,i.Sv)(),c=(0,M.Z)(),d=(0,Ke.Z)(n,!0),m=(0,Ke.Z)(s,!0),u=(0,a.I4)((()=>{l({hash:n.hash}),o()}),[o,n,l]);if(d)return a.ZP.createElement(X.Z,{header:a.ZP.createElement("div",{className:"modal-header-condensed",dir:c.isRtl?"rtl":void 0},a.ZP.createElement($.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:c("Close"),onClick:o},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},c("WebSessionsTitle")),a.ZP.createElement($.Z,{color:"danger",onClick:u,className:(0,W.Z)("modal-action-button","hlKLEbMQAsx572pUREy0")},c("AuthSessions.LogOut"))),isOpen:t,hasCloseButton:!0,onClose:o,className:"OeRWKjYQC6t7Uxv8I3j0"},a.ZP.createElement(Be.Z,{className:"oy_023CG29VsnL9L5ulf",user:m,size:"large",animationLevel:r,withVideo:!0}),m&&a.ZP.createElement(Yn.Z,{className:"bg8UD_Pu2JWogmjuvVXg",peer:m}),a.ZP.createElement("div",{className:ei},d?.domain),a.ZP.createElement("dl",{className:"HSyJbRkyhkeT0s2QA4Ku"},a.ZP.createElement("dt",null,c("AuthSessions.View.Browser")),a.ZP.createElement("dd",null,d?.browser),a.ZP.createElement("dt",null,c("SessionPreview.Ip")),a.ZP.createElement("dd",null,d?.ip),a.ZP.createElement("dt",null,c("SessionPreview.Location")),a.ZP.createElement("dd",null,d?.region)),a.ZP.createElement("p",{className:ei},c("AuthSessions.View.LocationInfo")))}))),ni={avatar:"n3bBygyO4j5MQyJ70Twt","clear-help":"vUICy6ZQCYFSrvvxXe7f",clearHelp:"vUICy6ZQCYFSrvvxXe7f"},ai=(0,a.X$)((0,i.c$)((e=>{const{byHash:t,orderedHashes:n}=e.activeWebSessions;return{byHash:t,orderedHashes:n,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{isActive:t,byHash:n,orderedHashes:s,animationLevel:r,onReset:o}=e;const{terminateWebAuthorization:l,terminateAllWebAuthorizations:c}=(0,i.Sv)(),d=(0,M.Z)(),[m,u,h]=(0,I.Z)(),[P,Z]=(0,a.eJ)(),[v,p,g]=(0,I.Z)(),E=(0,a.I4)((e=>{l({hash:e})}),[l]),C=(0,a.I4)((()=>{h(),c()}),[h,c]),f=(0,a.I4)((e=>{Z(e),p()}),[p]),b=(0,a.I4)((()=>{Z(void 0),g()}),[g]);var y;if((0,a.d4)((()=>{s.length||o()}),[o,s]),(0,ie.Z)({isActive:t,onBack:o}),s.length)return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(Xe.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:u},d("AuthSessions.LogOutApplications")),a.ZP.createElement("p",{className:(0,W.Z)("settings-item-description",ni.clearHelp)},d("ClearOtherWebSessionsHelp"))),(y=s,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:d.isRtl?"rtl":void 0},d("WebSessionsTitle")),y.map((function(e){const t=n[e],s=(0,i.Rd)().users.byId[t.botId];return a.ZP.createElement(Xe.Z,{key:t.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{E(t.hash)}}],onClick:()=>f(t.hash)},a.ZP.createElement(Be.Z,{className:ni.avatar,user:s,size:"tiny",animationLevel:r,withVideo:!0}),a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,he.VX)(d,1e3*t.dateActive)),s&&a.ZP.createElement(Yn.Z,{className:ni.title,peer:s}),a.ZP.createElement("span",{className:(0,W.Z)("subtitle","black","tight",ni.platform)},t.domain,", ",t.browser,", ",t.platform),a.ZP.createElement("span",{className:"subtitle"},t.ip," ",t.region)))})))),a.ZP.createElement(lt.Z,{isOpen:m,onClose:h,title:d("AuthSessions.LogOutApplications"),text:d("AreYouSureWebSessions"),confirmHandler:C,confirmIsDestructive:!0}),a.ZP.createElement(ti,{isOpen:v,hash:P,onClose:b}))}))),si=(0,a.X$)((0,i.c$)((e=>{const{users:{byId:t},blocked:{ids:n},contactList:a,currentUserId:s}=e;return{usersById:t,blockedIds:n,contactIds:a?.userIds,localContactIds:e.userSearch.localUserIds,currentUserId:s}}))((e=>{let{usersById:t,blockedIds:n,contactIds:s,localContactIds:o,currentUserId:l,isOpen:c,onClose:d}=e;const{setUserSearchQuery:m,blockContact:u}=(0,i.Sv)(),h=(0,M.Z)(),[P,Z]=(0,a.eJ)("");(0,a.d4)((()=>{m({query:P})}),[P,m]);const v=(0,a.Ye)((()=>{const e=(0,$e.Tw)([...s||[],...o||[]].filter((e=>e!==l&&!n.includes(e))));return(0,r.kK)(e,t,P).sort(((e,n)=>{const a=(0,r.Js)(t[e])||"",s=(0,r.Js)(t[n])||"";return a.localeCompare(s)}))}),[n,s,l,P,o,t]),p=(0,a.I4)((e=>{const{id:n,accessHash:a}=t[e]||{};n&&a&&(u({contactId:n,accessHash:a}),d())}),[u,d,t]);return a.ZP.createElement(Ye,{isOpen:c,chatOrUserIds:v,searchPlaceholder:h("BlockedUsers.BlockUser"),search:P,onSearchChange:Z,onSelectChatOrUser:p,onClose:d})}))),ii=(0,a.X$)((0,i.c$)((e=>{const{chats:{byId:t},users:{byId:n},blocked:{ids:a},countryList:{phoneCodes:s}}=e;return{chatsByIds:t,usersByIds:n,blockedIds:a,phoneCodeList:s}}))((e=>{let{isActive:t,onReset:n,chatsByIds:s,usersByIds:o,blockedIds:l,phoneCodeList:c}=e;const{unblockContact:d}=(0,i.Sv)(),u=(0,M.Z)(),[h,P,Z]=(0,I.Z)(),v=(0,a.I4)((e=>{d({contactId:e})}),[d]);(0,ie.Z)({isActive:t,onBack:n});const p=(0,a.Ye)((()=>l.reduce(((e,t)=>{const n=(0,r.YC)(t)?o[t]:void 0,a=n&&!n.phoneNumber&&(0,r.WS)(n);return a&&(e[t]=a),e}),{})),[l,o]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content infinite-scroll"},a.ZP.createElement("div",{className:"settings-item no-border"},a.ZP.createElement("p",{className:"settings-item-description-larger mt-0 mb-2",dir:u.isRtl?"rtl":void 0},u("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},l?.length?a.ZP.createElement("div",{className:"scroll-container"},l.map(((e,t)=>function(e,t,n){const i=(0,r.YC)(e),l=i?o[e]:void 0,d=i?void 0:s[e],u=l||d,h=(0,W.Z)("Chat chat-item-clickable blocked-list-item small-icon",i?"private":"group"),P=p[e];return a.ZP.createElement(Xe.Z,{key:e,className:h,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{v(e)}}],style:`top: ${(0+t)*m.rS}px;`},a.ZP.createElement(Be.Z,{size:"medium",user:l,chat:d}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},u&&a.ZP.createElement(Yn.Z,{peer:u}),l?.phoneNumber&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,Ct.WZ)(c,l.phoneNumber)),P&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",P)))}(e,t)))):l&&!l.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},u("NoBlocked")):a.ZP.createElement(Ve.Z,{key:"loading"}))),a.ZP.createElement(Ya.Z,{isShown:!0,onClick:P,ariaLabel:u("BlockContact")},a.ZP.createElement("i",{className:"icon-add"})),a.ZP.createElement(si,{isOpen:h,onClose:Z}))})));var ri=n(21179),oi=n(2092);const li=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:i}=e;const r=(0,M.Z)();return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ri.Z,{tgsUrl:Wn.l.Lock,previewUrl:oi,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,J.Z)(r("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Xe.Z,{icon:"edit",onClick:()=>i(s.MT.TwoFaChangePasswordCurrent)},r("ChangePassword")),a.ZP.createElement(Xe.Z,{icon:"password-off",onClick:()=>i(s.MT.TwoFaTurnOff)},r("TurnPasswordOff")),a.ZP.createElement(Xe.Z,{icon:"email",onClick:()=>i(s.MT.TwoFaRecoveryEmailCurrentPassword)},r("SetRecoveryEmail"))))}));var ci=n(93490),di=n(99364);const mi=(0,a.X$)((e=>{let{isActive:t,onReset:n,error:s,isLoading:i,shouldDisablePasswordManager:r,expectedPassword:o,placeholder:l="Current Password",hint:c,submitLabel:d,clearError:m,onSubmit:u}=e;const[h,P]=(0,a.eJ)(""),[Z,v]=(0,a.eJ)(!1),p=(0,a.I4)((e=>{o&&e!==o?P("Passwords Should Be Equal"):u(e)}),[u,o]),g=(0,a.I4)((()=>{m&&m(),P("")}),[m]),E=(0,M.Z)();return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content password-form custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ci.Z,{isBig:!0,isPasswordVisible:Z})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(di.Z,{error:h||s,hint:c,placeholder:l,shouldDisablePasswordManager:r,submitLabel:d||E("Next"),clearError:g,isLoading:i,isPasswordVisible:Z,shouldResetValue:t,onChangePasswordVisibility:v,onSubmit:p})))})),ui=(0,a.X$)((e=>{let{isActive:t,onReset:n,onStart:s}=e;const i=(0,M.Z)();return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ri.Z,{tgsUrl:Wn.l.Lock,previewUrl:oi,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},i("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement($.Z,{onClick:s},i("EditAdminTransferSetPassword"))))}));var hi=n(45601);const Pi=d.wB?550:400,Zi=(0,a.X$)((0,i.c$)(((e,t)=>{let{icon:n}=t;return{animatedEmoji:(0,o.zB)(e,"email"===n?"💌":"💡")}}))((e=>{let{animatedEmoji:t,type:n="text",isLoading:s,error:i,placeholder:r,shouldConfirm:o,clearError:l,onSubmit:c,isActive:m,onReset:u}=e;const h=(0,a.sO)(null),[P,Z]=(0,a.eJ)(""),[v,p,g]=(0,I.Z)(!1);(0,a.d4)((()=>{d.$b||setTimeout((()=>{h.current.focus()}),Pi)}),[]);const E=(0,a.I4)((e=>{i&&l&&l(),Z(e.target.value)}),[l,i]),C=(0,a.I4)((()=>{c()}),[c]),f=(0,a.I4)((()=>{g(),c()}),[c,g]),b=(0,M.Z)();return(0,ie.Z)({isActive:m,onBack:u}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(hi.Z,{sticker:t,size:160,className:"settings-content-icon"})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),h.current&&c(P)}},a.ZP.createElement(ze.Z,{ref:h,value:P,inputMode:n,label:r,error:i,onChange:E}),P?a.ZP.createElement($.Z,{type:"submit",isLoading:s,ripple:!0},b("Continue")):a.ZP.createElement($.Z,{isText:!0,isLoading:s,ripple:!0,onClick:o?p:C},b("YourEmailSkip"))),o&&a.ZP.createElement(X.Z,{className:"narrow",isOpen:v,title:b("YourEmailSkipWarning"),onClose:g},(0,J.Z)(b("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement($.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:f},b("YourEmailSkip")),a.ZP.createElement($.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:g},b("Cancel"))))))}))),vi=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:i}=e;const r=(0,M.Z)(),o=(0,a.I4)((()=>{i(s.MT.Privacy)}),[i]);return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(hs.Z,{size:m.K2,tgsUrl:Wn.l.Congratulations,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},r("TwoStepVerificationPasswordSetInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement($.Z,{onClick:o},r("TwoStepVerificationPasswordReturnSettings"))))})),pi=d.wB?550:400,gi=(0,a.X$)((0,i.c$)((e=>({animatedEmoji:(0,o.zB)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength})))((e=>{let{animatedEmoji:t,codeLength:n,isLoading:s,error:i,clearError:r,onSubmit:o,isActive:l,onReset:c}=e;const m=(0,a.sO)(null),[u,h]=(0,a.eJ)("");(0,a.d4)((()=>{d.$b||setTimeout((()=>{m.current.focus()}),pi)}),[]);const P=(0,M.Z)();(0,ie.Z)({isActive:l,onBack:c});const Z=(0,a.I4)((e=>{i&&r&&r();const t=e.target.value.slice(0,n);t.length===n&&o(t),h(t),e.target.value=t}),[r,n,i,o]);return a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(hi.Z,{sticker:t,size:160,className:"settings-content-icon"})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(ze.Z,{value:u,ref:m,inputMode:"decimal",label:P("YourEmailCode"),error:i,onChange:Z}),s&&a.ZP.createElement(Ve.Z,null)))}))),Ei=(0,a.X$)((0,i.c$)((e=>({...e.twoFaSettings})))((e=>{let{currentScreen:t,shownScreen:n,state:r,hint:o,isLoading:l,error:c,waitingEmailCodeLength:d,dispatch:m,isActive:u,onScreenSelect:h,onReset:P}=e;const{updatePassword:Z,checkPassword:v,clearTwoFaError:p,updateRecoveryEmail:g,provideTwoFaEmailCode:E,clearPassword:C}=(0,i.Sv)();(0,a.d4)((()=>{d&&(t===s.MT.TwoFaNewPasswordEmail?h(s.MT.TwoFaNewPasswordEmailCode):t===s.MT.TwoFaRecoveryEmail&&h(s.MT.TwoFaRecoveryEmailCode))}),[t,h,d]);const f=(0,a.I4)((()=>{m({type:"reset"}),h(s.MT.TwoFaNewPassword)}),[m,h]),b=(0,a.I4)((e=>{m({type:"setPassword",payload:e}),h(s.MT.TwoFaNewPasswordConfirm)}),[m,h]),I=(0,a.I4)((()=>{h(s.MT.TwoFaNewPasswordHint)}),[h]),y=(0,a.I4)((e=>{m({type:"setHint",payload:e}),h(s.MT.TwoFaNewPasswordEmail)}),[m,h]),S=(0,a.I4)((e=>{m({type:"setEmail",payload:e}),Z({...r,email:e,onSuccess:()=>{h(s.MT.TwoFaCongratulations)}})}),[m,h,r,Z]),k=(0,a.I4)((e=>{m({type:"setCurrentPassword",payload:e}),v({currentPassword:e,onSuccess:()=>{h(s.MT.TwoFaChangePasswordNew)}})}),[v,m,h]),N=(0,a.I4)((e=>{m({type:"setPassword",payload:e}),h(s.MT.TwoFaChangePasswordConfirm)}),[m,h]),w=(0,a.I4)((()=>{h(s.MT.TwoFaChangePasswordHint)}),[h]),T=(0,a.I4)((e=>{m({type:"setHint",payload:e}),Z({...r,hint:e,onSuccess:()=>{h(s.MT.TwoFaCongratulations)}})}),[m,h,r,Z]),A=(0,a.I4)((e=>{C({currentPassword:e,onSuccess:()=>{h(s.MT.Privacy)}})}),[C,h]),R=(0,a.I4)((e=>{m({type:"setCurrentPassword",payload:e}),v({currentPassword:e,onSuccess:()=>{h(s.MT.TwoFaRecoveryEmail)}})}),[v,m,h]),L=(0,a.I4)((e=>{m({type:"setEmail",payload:e}),g({...r,email:e,onSuccess:()=>{h(s.MT.TwoFaCongratulations)}})}),[m,h,r,g]),F=(0,a.I4)((e=>{E({code:e})}),[E]),x=(0,M.Z)();switch(t){case s.MT.TwoFaDisabled:return a.ZP.createElement(ui,{onStart:f,isActive:u||[s.MT.TwoFaNewPassword,s.MT.TwoFaNewPasswordConfirm,s.MT.TwoFaNewPasswordHint,s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaNewPassword:return a.ZP.createElement(mi,{placeholder:x("PleaseEnterPassword"),submitLabel:x("Continue"),onSubmit:b,isActive:u||[s.MT.TwoFaNewPasswordConfirm,s.MT.TwoFaNewPasswordHint,s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(mi,{expectedPassword:r.password,placeholder:x("PleaseReEnterPassword"),submitLabel:x("Continue"),onSubmit:I,isActive:u||[s.MT.TwoFaNewPasswordHint,s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaNewPasswordHint:return a.ZP.createElement(Zi,{icon:"hint",placeholder:x("PasswordHintPlaceholder"),onSubmit:y,isActive:u||[s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(Zi,{icon:"email",type:"email",isLoading:l,error:c,clearError:p,placeholder:x("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:S,isActive:u||[s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(gi,{isLoading:l,error:c,clearError:p,onSubmit:F,isActive:u||n===s.MT.TwoFaCongratulations,onReset:P});case s.MT.TwoFaCongratulations:return a.ZP.createElement(vi,{onScreenSelect:h,isActive:u,onReset:P});case s.MT.TwoFaEnabled:return a.ZP.createElement(li,{onScreenSelect:h,isActive:u||[s.MT.TwoFaChangePasswordCurrent,s.MT.TwoFaChangePasswordNew,s.MT.TwoFaChangePasswordConfirm,s.MT.TwoFaChangePasswordHint,s.MT.TwoFaTurnOff,s.MT.TwoFaRecoveryEmailCurrentPassword,s.MT.TwoFaRecoveryEmail,s.MT.TwoFaRecoveryEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(mi,{isLoading:l,error:c,clearError:p,hint:o,onSubmit:k,isActive:u||[s.MT.TwoFaChangePasswordNew,s.MT.TwoFaChangePasswordConfirm,s.MT.TwoFaChangePasswordHint,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaChangePasswordNew:return a.ZP.createElement(mi,{placeholder:x("PleaseEnterNewFirstPassword"),onSubmit:N,isActive:u||[s.MT.TwoFaChangePasswordConfirm,s.MT.TwoFaChangePasswordHint,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(mi,{expectedPassword:r.password,placeholder:x("PleaseReEnterPassword"),onSubmit:w,isActive:u||[s.MT.TwoFaChangePasswordHint,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaChangePasswordHint:return a.ZP.createElement(Zi,{isLoading:l,error:c,clearError:p,icon:"hint",placeholder:x("PasswordHintPlaceholder"),onSubmit:T,isActive:u||n===s.MT.TwoFaCongratulations,onReset:P});case s.MT.TwoFaTurnOff:return a.ZP.createElement(mi,{isLoading:l,error:c,clearError:p,hint:o,onSubmit:A,isActive:u,onReset:P});case s.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(mi,{isLoading:l,error:c,clearError:p,hint:o,onSubmit:R,isActive:u||[s.MT.TwoFaRecoveryEmail,s.MT.TwoFaRecoveryEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaRecoveryEmail:return a.ZP.createElement(Zi,{icon:"email",type:"email",placeholder:x("RecoveryEmailTitle"),onSubmit:L,isActive:u||[s.MT.TwoFaRecoveryEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:P});case s.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(gi,{isLoading:l,error:c,clearError:p,onSubmit:F,isActive:u||n===s.MT.TwoFaCongratulations,onReset:P});default:return}})));var Ci=n(11820);function fi(e,t){const{privacy:n}=e.settings;switch(t){case s.MT.PrivacyPhoneNumberAllowedContacts:case s.MT.PrivacyPhoneNumberDeniedContacts:return n.phoneNumber;case s.MT.PrivacyLastSeenAllowedContacts:case s.MT.PrivacyLastSeenDeniedContacts:return n.lastSeen;case s.MT.PrivacyProfilePhotoAllowedContacts:case s.MT.PrivacyProfilePhotoDeniedContacts:return n.profilePhoto;case s.MT.PrivacyPhoneCallAllowedContacts:case s.MT.PrivacyPhoneCallDeniedContacts:return n.phoneCall;case s.MT.PrivacyPhoneP2PAllowedContacts:case s.MT.PrivacyPhoneP2PDeniedContacts:return n.phoneP2P;case s.MT.PrivacyForwardingAllowedContacts:case s.MT.PrivacyForwardingDeniedContacts:return n.forwards;case s.MT.PrivacyVoiceMessagesAllowedContacts:case s.MT.PrivacyVoiceMessagesDeniedContacts:return n.voiceMessages;case s.MT.PrivacyGroupChatsDeniedContacts:case s.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const bi=(0,a.X$)((0,i.c$)(((e,t)=>{let{screen:n}=t;return{currentUserId:e.currentUserId,settings:fi(e,n)}}))((e=>{let{isAllowList:t,screen:n,isActive:o,onScreenSelect:l,onReset:c,currentUserId:d,settings:u}=e;const{setPrivacySettings:h}=(0,i.Sv)(),P=(0,M.Z)(),Z=(0,a.Ye)((()=>u?t?[...u.allowUserIds,...u.allowChatIds]:[...u.blockUserIds,...u.blockChatIds]:[]),[t,u]),[v,p]=(0,a.eJ)(""),[g,E]=(0,a.eJ)(!1),[C,f]=(0,a.eJ)(Z),b=(0,us.d7)(m.Nf),I=(0,us.d7)(m.WS),y=(0,a.Ye)((()=>{const e=(0,i.Rd)().chats.byId,t=(0,$e.Tw)([...b||[],...I||[]]).filter((t=>{const n=e[t];return n&&(0,r.YC)(n.id)&&n.id!==d}));return(0,$e.Tw)([...Z,...(0,r.$l)(P,t,e,v)])}),[b,I,Z,P,v,d]),S=(0,a.I4)((e=>{f(e),E(!0)}),[]),k=(0,a.I4)((()=>{h({privacyKey:Js(n),isAllowList:Boolean(t),contactsIds:C}),l(s.MT.Privacy)}),[t,C,l,n,h]);return(0,ie.Z)({isActive:o,onBack:c}),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Ci.Z,{itemIds:y||[],selectedIds:C,filterValue:v,filterPlaceholder:P(t?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:S,onFilterChange:p}),a.ZP.createElement(Ya.Z,{isShown:g,onClick:k,ariaLabel:P(t?"AlwaysAllow":"NeverAllow")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Ii=(0,a.X$)((0,i.c$)((e=>{const{availableReactions:t,config:n}=e,a=(0,o.wV)(e);return{availableReactions:t,selectedReaction:n?.defaultReaction,isPremium:a}}))((e=>{let{isActive:t,availableReactions:n,isPremium:s,selectedReaction:r,onReset:o}=e;const{setDefaultReaction:l}=(0,i.Sv)();(0,ie.Z)({isActive:t,onBack:o});const c=n?.filter((e=>!(e.isInactive||!s&&e.isPremium))).map((e=>({label:a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(qn.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(Ss.Z,{name:"quick-reaction-settings",options:c,selected:r,onChange:d}))})));var yi=n(95281);const Si=(0,a.X$)((e=>{let{isActive:t,onReset:n,onStart:s}=e;const i=(0,M.Z)();return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ri.Z,{tgsUrl:Wn.l.Lock,previewUrl:oi,size:m.Iz,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description",dir:"auto"},"When you set up an additional passcode, a lock icon will appear on the chats page. Tap it to lock and unlock your Telegram WebZ."),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Note: if you forget your local passcode, you'll need to log out of Telegram WebZ and log in again.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement($.Z,{onClick:s},i("EnablePasscode"))))})),ki=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:i}=e;const r=(0,M.Z)();return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ri.Z,{tgsUrl:Wn.l.Lock,previewUrl:oi,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Local passcode is enabled.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Xe.Z,{icon:"edit",onClick:()=>i(s.MT.PasscodeChangePasscodeCurrent)},r("Passcode.Change")),a.ZP.createElement(Xe.Z,{icon:"password-off",onClick:()=>i(s.MT.PasscodeTurnOff)},r("Passcode.TurnOff"))))})),Ni=(0,a.X$)((e=>{let{isActive:t,onReset:n}=e;const s=(0,M.Z)(),i=(0,a.I4)((()=>{n(!0)}),[n]);return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(hs.Z,{size:m.Iz,tgsUrl:Wn.l.Congratulations,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Congratulations!"),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Now you can lock the app with a passcode so that others can't open it.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement($.Z,{onClick:i},s("Back"))))})),wi=(0,a.X$)((0,i.c$)((e=>({...e.passcode})))((e=>{let{passcode:t,currentScreen:n,shownScreen:r,error:o,isActive:l,isLoading:c,onScreenSelect:d,onSetPasscode:m,onReset:u}=e;const{setPasscode:h,clearPasscode:P,setPasscodeError:Z,clearPasscodeError:v}=(0,i.Sv)(),p=(0,M.Z)(),g=(0,a.I4)((()=>{m(""),d(s.MT.PasscodeNewPasscode)}),[d,m]),E=(0,a.I4)((e=>{m(e),d(s.MT.PasscodeNewPasscodeConfirm)}),[d,m]),C=(0,a.I4)((()=>{h({passcode:t}),m(""),d(s.MT.PasscodeCongratulations)}),[d,m,t,h]),f=(0,a.I4)((e=>{m(""),(0,yi.so)(e).then((()=>{d(s.MT.PasscodeChangePasscodeNew)}),(()=>{Z({error:p("PasscodeController.Error.Current")})}))}),[p,d,m,Z]),b=(0,a.I4)((e=>{m(e),d(s.MT.PasscodeChangePasscodeConfirm)}),[d,m]),I=(0,a.I4)((e=>{(0,yi.so)(e).then((()=>{P(),d(s.MT.Privacy)}),(()=>{Z({error:p("PasscodeController.Error.Current")})}))}),[P,p,d,Z]);switch(n){case s.MT.PasscodeDisabled:return a.ZP.createElement(Si,{onStart:g,isActive:l||[s.MT.PasscodeNewPasscode,s.MT.PasscodeNewPasscodeConfirm,s.MT.PasscodeCongratulations].includes(r),onReset:u});case s.MT.PasscodeNewPasscode:return a.ZP.createElement(mi,{shouldDisablePasswordManager:!0,placeholder:p("EnterNewPasscode"),submitLabel:p("Continue"),onSubmit:E,isActive:l||[s.MT.PasscodeNewPasscodeConfirm,s.MT.PasscodeCongratulations].includes(r),onReset:u});case s.MT.PasscodeNewPasscodeConfirm:return a.ZP.createElement(mi,{shouldDisablePasswordManager:!0,expectedPassword:t,placeholder:p("ReEnterYourPasscode"),submitLabel:p("Continue"),isLoading:c,onSubmit:C,isActive:l||[s.MT.PasscodeCongratulations].includes(r),onReset:u});case s.MT.PasscodeCongratulations:return a.ZP.createElement(Ni,{isActive:l,onReset:u});case s.MT.PasscodeEnabled:return a.ZP.createElement(ki,{onScreenSelect:d,isActive:l||[s.MT.PasscodeChangePasscodeCurrent,s.MT.PasscodeChangePasscodeNew,s.MT.PasscodeChangePasscodeConfirm,s.MT.PasscodeCongratulations,s.MT.PasscodeTurnOff].includes(r),onReset:u});case s.MT.PasscodeChangePasscodeCurrent:return a.ZP.createElement(mi,{shouldDisablePasswordManager:!0,error:o,clearError:v,placeholder:p("PasscodeController.Current.Placeholder"),onSubmit:f,isActive:l||[s.MT.PasscodeChangePasscodeNew,s.MT.PasscodeChangePasscodeConfirm,s.MT.PasscodeCongratulations].includes(r),onReset:u});case s.MT.PasscodeChangePasscodeNew:return a.ZP.createElement(mi,{shouldDisablePasswordManager:!0,placeholder:p("PleaseEnterNewFirstPassword"),onSubmit:b,isActive:l||[s.MT.PasscodeChangePasscodeConfirm,s.MT.PasscodeCongratulations].includes(r),onReset:u});case s.MT.PasscodeChangePasscodeConfirm:return a.ZP.createElement(mi,{shouldDisablePasswordManager:!0,expectedPassword:t,placeholder:p("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:c,onSubmit:C,isActive:l||[s.MT.PasscodeCongratulations].includes(r),onReset:u});case s.MT.PasscodeTurnOff:return a.ZP.createElement(mi,{shouldDisablePasswordManager:!0,error:o?p(o):void 0,clearError:v,placeholder:p("PasscodeController.Current.Placeholder"),onSubmit:I,isActive:l,onReset:u});default:return}})));var Mi=n(799);const Ti=(0,a.X$)((e=>{let{stickerSet:t,size:n=m.DC,noAnimate:s,observeIntersection:l,sharedCanvasRef:c}=e;const u=(0,a.sO)(null),{hasThumbnail:h,isLottie:P,isVideos:Z}=t,v=(0,Ca.Op)(u,l),p=t.stickers&&Z&&!d.Hh,g=p&&(0,r.RK)(t.stickers[0].id),E=(0,R.Z)(g,!v),C=(h&&!p||P)&&`stickerSet${t.id}`,f=(0,R.Z)(C,!v),b=f||E,I=(0,Dt.Z)(b),y=(0,Mi.Z)(u,c);return a.ZP.createElement("div",{ref:u,className:"sticker-set-cover"},b?P?a.ZP.createElement(Vt.Z,{className:I,tgsUrl:f,size:n||y.size,play:v&&!s,isLowPriority:!(0,o.Si)((0,i.Rd)(),t),sharedCanvas:c?.current||void 0,sharedCanvasCoords:y.coords}):Z&&!p?a.ZP.createElement($t.Z,{className:(0,W.Z)("h6jE3TEaqlzbs0ro0J2_",I),src:f,canPlay:v&&!s,loop:!0,disablePictureInPicture:!0}):a.ZP.createElement("img",{src:f||E,className:I,alt:""}):(0,Pe.Xv)(t.title,2))}));var Ai=n(73547);const Ri=(0,a.X$)((e=>{let{stickerSet:t,noAnimate:n,className:s,observeIntersection:i,onClick:r}=e;const o=(0,M.Z)(),l=t?.stickers?.[0],c=(0,a.I4)((()=>{l&&r(l)}),[l,r]);if(t&&t.stickers)return a.ZP.createElement(Xe.Z,{narrow:!0,className:(0,W.Z)("StickerSetCard",s),inactive:!l,onClick:c},function(){if(t)return t.hasThumbnail||!l?a.ZP.createElement($.Z,{ariaLabel:t.title,color:"translucent",isRtl:o.isRtl},a.ZP.createElement(Ti,{stickerSet:t,size:m.Mw,noAnimate:n,observeIntersection:i})):a.ZP.createElement(Ai.Z,{sticker:l,size:m.Mw,title:t.title,noAnimate:n,observeIntersection:i,noContextMenu:!0,isCurrentUserPremium:!0,clickArg:void 0})}(),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},t.title),a.ZP.createElement("div",{className:"subtitle"},o("StickerPack.StickerCount",t.count,"i"))))})),Li=(0,a.X$)((0,i.c$)((e=>({...(0,$e.ei)(e.settings.byKey,["shouldSuggestStickers","shouldLoopStickers"]),addedSetIds:e.stickers.added.setIds,customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:e.config?.defaultReaction})))((e=>{let{isActive:t,addedSetIds:n,customEmojiSetIds:r,stickerSetsById:o,defaultReaction:l,shouldSuggestStickers:c,shouldLoopStickers:d,onReset:m,onScreenSelect:u}=e;const{setSettingOption:h,openStickerSet:P}=(0,i.Sv)(),Z=(0,M.Z)(),v=(0,a.sO)(null),{observe:p}=(0,Ca.S1)({rootRef:v}),g=(0,a.I4)((e=>{P({stickerSetInfo:e.stickerSetInfo})}),[P]),E=(0,a.I4)((e=>{h({shouldSuggestStickers:e})}),[h]),C=(0,a.I4)((e=>{h({shouldLoopStickers:e})}),[h]),f=(0,a.Ye)((()=>n&&Object.values((0,$e.ei)(o,n))),[n,o]);return(0,ie.Z)({isActive:t,onBack:m}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(dt.Z,{label:Z("SuggestStickers"),checked:c,onCheck:E}),a.ZP.createElement(dt.Z,{label:Z("LoopAnimatedStickers"),checked:d,onCheck:C}),a.ZP.createElement(Xe.Z,{className:"mt-4",onClick:()=>u(s.MT.CustomEmoji),icon:"smile"},Z("StickersList.EmojiItem"),r&&a.ZP.createElement("span",{className:"settings-item__current-value"},r.length)),l&&a.ZP.createElement(Xe.Z,{className:"SettingsDefaultReaction",onClick:()=>u(s.MT.QuickReaction)},a.ZP.createElement(qn.Z,{reaction:l}),a.ZP.createElement("div",{className:"title"},Z("DoubleTapSetting")))),f&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:Z.isRtl?"rtl":void 0},Z("ChooseStickerMyStickerSets")),a.ZP.createElement("div",{ref:v},f.map((e=>a.ZP.createElement(Ri,{key:e.id,stickerSet:e,observeIntersection:p,onClick:g})))),a.ZP.createElement("p",{className:"settings-item-description mt-3",dir:"auto"},(0,J.Z)(Z("StickersBotInfo"),["links"]))))}))),Fi=(0,a.X$)((0,i.c$)((e=>({...(0,$e.ei)(e.settings.byKey,["shouldSuggestCustomEmoji"]),customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById})))((e=>{let{isActive:t,customEmojiSetIds:n,stickerSetsById:s,shouldSuggestCustomEmoji:r,onReset:o}=e;const{openStickerSet:l,setSettingOption:c}=(0,i.Sv)(),d=(0,M.Z)(),m=(0,a.sO)(null),{observe:u}=(0,Ca.S1)({rootRef:m});(0,ie.Z)({isActive:t,onBack:o});const h=(0,a.I4)((e=>{l({stickerSetInfo:e.stickerSetInfo})}),[l]),P=(0,a.I4)((e=>{c({shouldSuggestCustomEmoji:e})}),[c]),Z=(0,a.Ye)((()=>n&&Object.values((0,$e.ei)(s,n))),[n,s]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},Z&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(dt.Z,{label:d("SuggestAnimatedEmoji"),checked:r,onCheck:P}),a.ZP.createElement("div",{className:"mt-4",ref:m},Z.map((e=>a.ZP.createElement(Ri,{key:e.id,stickerSet:e,observeIntersection:u,onClick:h})))),a.ZP.createElement("p",{className:"settings-item-description mt-3",dir:"auto"},(0,J.Z)(d("EmojiBotInfo"),["links"]))))}))),xi=(0,a.X$)((e=>{let{isActive:t,onReset:n}=e;const{requestConfetti:s}=(0,i.Sv)(),r=(0,M.Z)();return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(hs.Z,{tgsUrl:Wn.l.Experimental,size:200,className:"experimental-duck",nonInteractive:!0,noLoop:!1}),a.ZP.createElement("p",{className:"settings-item-description",dir:"auto"},r("lng_settings_experimental_about"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(Xe.Z,{onClick:()=>s(),icon:"animations"},a.ZP.createElement("div",{className:"title"},"Launch some confetti!"))))})),Bi=Object.keys(s.MT).length/2,Oi=[s.MT.TwoFaDisabled,s.MT.TwoFaNewPassword,s.MT.TwoFaNewPasswordConfirm,s.MT.TwoFaNewPasswordHint,s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations,s.MT.TwoFaEnabled,s.MT.TwoFaChangePasswordCurrent,s.MT.TwoFaChangePasswordNew,s.MT.TwoFaChangePasswordConfirm,s.MT.TwoFaChangePasswordHint,s.MT.TwoFaTurnOff,s.MT.TwoFaRecoveryEmailCurrentPassword,s.MT.TwoFaRecoveryEmail,s.MT.TwoFaRecoveryEmailCode],Di=[s.MT.PasscodeDisabled,s.MT.PasscodeEnabled],Ui=[s.MT.Folders,s.MT.FoldersCreateFolder,s.MT.FoldersEditFolder,s.MT.FoldersEditFolderFromChatList,s.MT.FoldersIncludedChats,s.MT.FoldersIncludedChatsFromChatList,s.MT.FoldersExcludedChats,s.MT.FoldersExcludedChatsFromChatList],$i=[s.MT.PrivacyBlockedUsers,s.MT.ActiveWebsites],_i=[s.MT.PrivacyPhoneNumberAllowedContacts,s.MT.PrivacyPhoneNumberDeniedContacts],Gi=[s.MT.PrivacyLastSeenAllowedContacts,s.MT.PrivacyLastSeenDeniedContacts],ji=[s.MT.PrivacyProfilePhotoAllowedContacts,s.MT.PrivacyProfilePhotoDeniedContacts],Vi=[s.MT.PrivacyPhoneCallAllowedContacts,s.MT.PrivacyPhoneCallDeniedContacts],zi=[s.MT.PrivacyPhoneP2PAllowedContacts,s.MT.PrivacyPhoneP2PDeniedContacts],Ji=[s.MT.PrivacyForwardingAllowedContacts,s.MT.PrivacyForwardingDeniedContacts],Xi=[s.MT.PrivacyVoiceMessagesAllowedContacts,s.MT.PrivacyVoiceMessagesDeniedContacts],Hi=[s.MT.PrivacyGroupChatsAllowedContacts,s.MT.PrivacyGroupChatsDeniedContacts],qi=(0,a.X$)((e=>{let{isActive:t,currentScreen:n,foldersState:i,foldersDispatch:r,onScreenSelect:o,onReset:l,shouldSkipTransition:c}=e;const[m,u]=(0,_a.Z)(ja,Ga),[h,P]=(0,a.eJ)(""),Z=(0,a.I4)((e=>{!0!==e?(n!==s.MT.FoldersCreateFolder&&n!==s.MT.FoldersEditFolder&&n!==s.MT.FoldersEditFolderFromChatList||setTimeout((()=>{r({type:"reset"})}),200),n!==s.MT.FoldersIncludedChats&&n!==s.MT.FoldersExcludedChats?l():"create"===i.mode?o(s.MT.FoldersCreateFolder):o(s.MT.FoldersEditFolder)):l(!0)}),[i.mode,r,n,l,o]),v=(0,a.I4)((()=>{r({type:"saveFilters"}),Z()}),[r,Z]);function p(e,l,c){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Va,{currentScreen:n,onReset:Z,onSaveFilter:v,onScreenSelect:o,editedFolderId:i.folderId}),function(e,l){const c={[s.MT.PrivacyPhoneNumber]:_i.includes(l),[s.MT.PrivacyLastSeen]:Gi.includes(l),[s.MT.PrivacyProfilePhoto]:ji.includes(l),[s.MT.PrivacyPhoneCall]:Vi.includes(l),[s.MT.PrivacyPhoneP2P]:zi.includes(l),[s.MT.PrivacyForwarding]:Ji.includes(l),[s.MT.PrivacyVoiceMessages]:Xi.includes(l),[s.MT.PrivacyGroupChats]:Hi.includes(l)},d=Oi.includes(l),v=Di.includes(l),p=Ui.includes(l),g=$i.includes(l)||d||v||Object.keys(c).includes(l.toString())||Object.values(c).find((e=>!0===e));switch(n){case s.MT.Main:return a.ZP.createElement(Ha,{onScreenSelect:o,isActive:t,onReset:Z});case s.MT.EditProfile:return a.ZP.createElement(ds,{isActive:t&&e,onReset:Z});case s.MT.General:return a.ZP.createElement(Ms,{onScreenSelect:o,isActive:e||l===s.MT.GeneralChatBackgroundColor||l===s.MT.GeneralChatBackground||l===s.MT.QuickReaction||l===s.MT.CustomEmoji||g||p,onReset:Z});case s.MT.QuickReaction:return a.ZP.createElement(Ii,{isActive:e,onReset:Z});case s.MT.CustomEmoji:return a.ZP.createElement(Fi,{isActive:e,onReset:Z});case s.MT.Notifications:return a.ZP.createElement(js,{isActive:e,onReset:Z});case s.MT.DataStorage:return a.ZP.createElement(ms,{isActive:e,onReset:Z});case s.MT.Privacy:return a.ZP.createElement(Vs,{onScreenSelect:o,isActive:e||g,onReset:Z});case s.MT.Language:return a.ZP.createElement(zs,{isActive:e,onReset:Z});case s.MT.Stickers:return a.ZP.createElement(Li,{isActive:e,onReset:Z,onScreenSelect:o});case s.MT.Experimental:return a.ZP.createElement(xi,{isActive:e,onReset:Z});case s.MT.GeneralChatBackground:return a.ZP.createElement(xs,{onScreenSelect:o,isActive:e||l===s.MT.GeneralChatBackgroundColor,onReset:Z});case s.MT.GeneralChatBackgroundColor:return a.ZP.createElement($s,{isActive:e,onReset:Z});case s.MT.ActiveSessions:return a.ZP.createElement(Qs,{isActive:e,onReset:Z});case s.MT.ActiveWebsites:return a.ZP.createElement(ai,{isActive:e,onReset:Z});case s.MT.PrivacyBlockedUsers:return a.ZP.createElement(ii,{isActive:e,onReset:Z});case s.MT.PrivacyPhoneNumber:case s.MT.PrivacyLastSeen:case s.MT.PrivacyProfilePhoto:case s.MT.PrivacyPhoneCall:case s.MT.PrivacyPhoneP2P:case s.MT.PrivacyForwarding:case s.MT.PrivacyVoiceMessages:case s.MT.PrivacyGroupChats:return a.ZP.createElement(Xs,{screen:n,onScreenSelect:o,isActive:e||c[n],onReset:Z});case s.MT.PrivacyPhoneNumberAllowedContacts:case s.MT.PrivacyLastSeenAllowedContacts:case s.MT.PrivacyProfilePhotoAllowedContacts:case s.MT.PrivacyPhoneCallAllowedContacts:case s.MT.PrivacyPhoneP2PAllowedContacts:case s.MT.PrivacyForwardingAllowedContacts:case s.MT.PrivacyVoiceMessagesAllowedContacts:case s.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement(bi,{isAllowList:!0,screen:n,onScreenSelect:o,isActive:e||c[n],onReset:Z});case s.MT.PrivacyPhoneNumberDeniedContacts:case s.MT.PrivacyLastSeenDeniedContacts:case s.MT.PrivacyProfilePhotoDeniedContacts:case s.MT.PrivacyPhoneCallDeniedContacts:case s.MT.PrivacyPhoneP2PDeniedContacts:case s.MT.PrivacyForwardingDeniedContacts:case s.MT.PrivacyVoiceMessagesDeniedContacts:case s.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement(bi,{screen:n,onScreenSelect:o,isActive:e,onReset:Z});case s.MT.Folders:case s.MT.FoldersCreateFolder:case s.MT.FoldersEditFolder:case s.MT.FoldersEditFolderFromChatList:case s.MT.FoldersIncludedChats:case s.MT.FoldersIncludedChatsFromChatList:case s.MT.FoldersExcludedChats:case s.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Is,{currentScreen:n,shownScreen:l,state:i,dispatch:r,isActive:e,onScreenSelect:o,onReset:Z});case s.MT.TwoFaDisabled:case s.MT.TwoFaNewPassword:case s.MT.TwoFaNewPasswordConfirm:case s.MT.TwoFaNewPasswordHint:case s.MT.TwoFaNewPasswordEmail:case s.MT.TwoFaNewPasswordEmailCode:case s.MT.TwoFaCongratulations:case s.MT.TwoFaEnabled:case s.MT.TwoFaChangePasswordCurrent:case s.MT.TwoFaChangePasswordNew:case s.MT.TwoFaChangePasswordConfirm:case s.MT.TwoFaChangePasswordHint:case s.MT.TwoFaTurnOff:case s.MT.TwoFaRecoveryEmailCurrentPassword:case s.MT.TwoFaRecoveryEmail:case s.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(Ei,{currentScreen:n,state:m,dispatch:u,shownScreen:l,isActive:e,onScreenSelect:o,onReset:Z});case s.MT.PasscodeDisabled:case s.MT.PasscodeNewPasscode:case s.MT.PasscodeNewPasscodeConfirm:case s.MT.PasscodeChangePasscodeCurrent:case s.MT.PasscodeChangePasscodeNew:case s.MT.PasscodeChangePasscodeConfirm:case s.MT.PasscodeCongratulations:case s.MT.PasscodeEnabled:case s.MT.PasscodeTurnOff:return a.ZP.createElement(wi,{currentScreen:n,passcode:h,onSetPasscode:P,shownScreen:l,isActive:e,onScreenSelect:o,onReset:Z});default:return}}(e,c))}return a.ZP.createElement(G.Z,{id:"Settings",name:c?"none":d.s0,activeKey:n,renderCount:Bi},p)})),Yi=(0,a.X$)((0,i.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n,statusesById:a}=e.users;return{usersById:n,userStatusesById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{isActive:t,filter:n,usersById:s,userStatusesById:o,contactIds:l,serverTimeOffset:c,onReset:m}=e;const{openChat:u,openNewContactDialog:h}=(0,i.Sv)(),P=(0,M.Z)();(0,ie.Z)({isActive:t,onBack:m});const Z=(0,a.I4)((e=>{u({id:e,shouldReplaceHistory:!0})}),[u]),v=(0,a.Ye)((()=>{if(!l)return;const e=(0,r.kK)(l,s,n);return(0,r.Z0)(e,s,o,void 0,c)}),[l,n,s,o,c]),[p,g]=(0,_e.Z)(void 0,v,Boolean(n));return a.ZP.createElement(Je.Z,{items:p,onLoadMore:g,className:"chat-list custom-scroll"},p?.length?p.map((e=>a.ZP.createElement(Xe.Z,{key:e,className:"chat-item-clickable",onClick:()=>Z(e),ripple:!d.wB},a.ZP.createElement(qe.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):p&&!p.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},n.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(Ve.Z,{key:"loading"}),a.ZP.createElement(Ya.Z,{key:"create-new-contact",isShown:!0,onClick:h,ariaLabel:P("CreateNewContact")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))}))),Ki=(0,a.X$)((0,i.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.chats,{query:a,fetchingStatus:s,globalResults:i,localResults:r}=e.globalSearch,{userIds:o}=i||{},{userIds:l}=r||{};return{chatsById:n,localContactIds:t,searchQuery:a,isSearching:s?.chats,globalUserIds:o,localUserIds:l}}))((e=>{let{isChannel:t,isActive:n,selectedMemberIds:s,onSelectedMemberIdsChange:o,onNextStep:l,onReset:c,chatsById:d,localContactIds:m,searchQuery:u,isSearching:h,localUserIds:P,globalUserIds:Z}=e;const{setGlobalSearchQuery:v}=(0,i.Sv)(),p=(0,M.Z)();(0,ie.Z)({isActive:n,onBack:c});const g=(0,a.I4)((e=>{v({query:e})}),[v]),E=(0,a.Ye)((()=>{const e=(0,i.Rd)().users.byId,t=m?(0,r.kK)(m,e,u):[];return(0,r.ih)((0,$e.Tw)([...t,...P||[],...Z||[]]).filter((t=>{const n=e[t];return!n||!n.isSelf&&(n.canBeInvitedToGroup||!(0,r.cS)(n))})),d,!1,s)}),[m,d,u,P,Z,s]),C=(0,a.I4)((()=>{(s.length||t)&&(v({query:""}),l())}),[s.length,t,v,l]);return a.ZP.createElement("div",{className:"NewChat step-1"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",onClick:c,ariaLabel:"Return to Chat List"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,p("GroupAddMembers"))),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Ci.Z,{itemIds:E,selectedIds:s,filterValue:u,filterPlaceholder:p("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:h,onSelectedIdsChange:o,onFilterChange:g}),a.ZP.createElement(Ya.Z,{isShown:Boolean(s.length||t),onClick:C,ariaLabel:t?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Wi=(0,a.X$)((0,i.c$)((e=>{const{progress:t,error:n}=e.chatCreation||{};return{creationProgress:t,creationError:n,maxGroupSize:e.config?.maxGroupSize}}))((e=>{let{isChannel:t,isActive:n,memberIds:r,maxGroupSize:o,creationProgress:l,creationError:c,onReset:d}=e;const{createGroupChat:m,createChannel:u}=(0,i.Sv)(),h=(0,M.Z)();(0,ie.Z)({isActive:n,onBack:d});const[P,Z]=(0,a.eJ)(""),[v,p]=(0,a.eJ)(""),[g,E]=(0,a.eJ)(),[C,f]=(0,a.eJ)(),b="Chat title can't be empty",I="Channel title can't be empty",y=l===s.Nh.InProgress,S=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");Z(n),n!==t&&(e.currentTarget.value=n)}),[]),k=(0,a.I4)((e=>{p(e.currentTarget.value)}),[]),N=(0,a.I4)((()=>{P.length?o&&r.length>=o?f("Sorry, creating supergroups is not yet supported"):m({title:P,photo:g,memberIds:r}):f(b)}),[P,r,o,m,g]),w=(0,a.I4)((()=>{P.length?u({title:P,about:v,photo:g,memberIds:r}):f(I)}),[P,u,v,g,r,I]);(0,a.d4)((()=>{l===s.Nh.Complete&&d(!0)}),[l,d]);const T=c&&h(c)||(C!==b&&C!==I?C:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>d(),ariaLabel:"Return to member selection"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,h(t?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(qa.Z,{onChange:E,title:h("AddPhoto")}),a.ZP.createElement(ze.Z,{value:P,onChange:S,label:h(t?"EnterChannelName":"GroupName"),error:C===b||C===I?C:void 0}),t&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(ze.Z,{value:v,onChange:k,label:h("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},h("DescriptionInfo"))),T&&a.ZP.createElement("p",{className:"error"},T),r.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},h("GroupInfo.ParticipantCount",r.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},r.map((e=>a.ZP.createElement(Xe.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(qe.Z,{userId:e}))))))),a.ZP.createElement(Ya.Z,{isShown:0!==P.length,onClick:t?w:N,disabled:y,ariaLabel:t?h("ChannelIntro.CreateChannel"):"Create Group"},y?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Qi=Object.keys(s.du).length/2,er=(0,a.X$)((e=>{let{isActive:t,isChannel:n=!1,content:i,onContentChange:r,onReset:o}=e;const[l,c]=(0,a.eJ)([]),m=(0,a.I4)((()=>{r(n?s.du.NewChannelStep2:s.du.NewGroupStep2)}),[n,r]);return a.ZP.createElement(G.Z,{id:"NewChat",name:d.s0,renderCount:Qi,activeKey:i},(e=>{switch(i){case s.du.NewChannelStep1:case s.du.NewGroupStep1:return a.ZP.createElement(Ki,{isChannel:n,isActive:t,selectedMemberIds:l,onSelectedMemberIdsChange:c,onNextStep:m,onReset:o});case s.du.NewChannelStep2:case s.du.NewGroupStep2:return a.ZP.createElement(Wi,{isChannel:n,isActive:e&&t,memberIds:l,onReset:o});default:return}}))}));var tr=n(1080);const nr=(0,a.X$)((e=>{let{isActive:t,onReset:n}=e;const s=(0,M.Z)();return(0,ie.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"ArchivedChats"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:"Return to chat list"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,s("ArchivedChats"))),a.ZP.createElement(tr.Z,{folderType:"archived",isActive:t}))}));var ar=n(51218);const sr=(0,a.X$)((0,i.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}))((e=>{let{isOpen:t,chatId:n,foldersById:s,folderOrderedIds:r,onClose:o,onCloseAnimationEnd:l}=e;const{editChatFolders:c}=(0,i.Sv)(),d=(0,M.Z)(),u=(0,a.Ye)((()=>s?Object.keys(s).reduce(((e,t)=>{const{includedChatIds:a,pinnedChatIds:i}=s[Number(t)];return(a.includes(n)||i?.includes(n))&&e.push(t),e}),[]):[]),[n,s]),[h,P]=(0,a.eJ)(u),Z=(0,a.Ye)((()=>r?.filter((e=>e!==m.Nf)).map((e=>({label:s?s[e].title:"",value:String(e)})))||[]),[r,s]),v=(0,a.I4)((()=>{const e=u.filter((e=>!h.includes(e))).map(Number),t=h.filter((e=>!u.includes(e))).map(Number);c({chatId:n,idsToRemove:e,idsToAdd:t}),o()}),[n,c,u,o,h]);if(s&&r)return a.ZP.createElement(X.Z,{isOpen:t,onClose:o,onCloseAnimationEnd:l,onEnter:v,className:"delete",title:d("FilterAddTo")},a.ZP.createElement(ar.Z,{options:Z,selected:h,onChange:P,round:!0}),a.ZP.createElement($.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:v},d("FilterAddTo")),a.ZP.createElement($.Z,{className:"confirm-dialog-button",isText:!0,onClick:o},d("Cancel")))})));var ir=n(33057),rr=n(40647),or=n(60998);function lr(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let cr,dr;const mr={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},ur=e=>"changedTouches"in e?e.changedTouches[0].clientY:0,hr=e=>{const t="deltaY"in e?e.deltaY:ur(e);if(!cr||!cr.contains(e.target)||cr.scrollTop<=0&&t<=0||cr.scrollTop>=cr.scrollHeight-cr.offsetHeight&&t>=0){if(dr&&e.target.closest(dr))return;e.preventDefault()}};function Pr(e){mr[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 Zr(e,t){cr=e,dr=t,document.addEventListener("wheel",hr,{passive:!1}),document.addEventListener("touchmove",hr,{passive:!1}),document.onkeydown=Pr}function vr(){cr=void 0,dr=void 0,document.removeEventListener("wheel",hr),document.removeEventListener("touchmove",hr),document.onkeydown=null}var pr=n(63394),gr=n(66902),Er=n(17921);const Cr=d.FW?24:32,fr=(0,W.y)("ReactionSelectorReaction"),br=(0,a.X$)((e=>{let{reaction:t,previewIndex:n,onSendReaction:s,isReady:i}=e;const r=(0,a.sO)(null),o=(0,R.Z)(`document${t.selectAnimation?.id}`,!i),[l,c,m]=(0,I.Z)(),[u,h]=(0,I.Z)(),P=!i||!u,Z=Boolean(i&&o);return a.ZP.createElement("div",{className:fr("&",d.FW&&"compact"),onClick:function(){if(!r.current)return;const{x:e,y:n}=r.current.getBoundingClientRect();s(t.reaction,e,n)},ref:r,onMouseEnter:i?c:void 0},P&&a.ZP.createElement("div",{className:fr("static"),style:`background-position-x: ${n*-Cr}px;`}),Z&&a.ZP.createElement(Vt.Z,{tgsUrl:o,play:l,noLoop:!0,size:Cr,onLoad:h,onEnded:m}))})),Ir=(0,W.y)("ReactionSelector"),yr=(0,a.X$)((e=>{let{availableReactions:t,enabledReactions:n,currentReactions:s,maxUniqueReactions:i,isPrivate:r,isReady:o,onSendReaction:l}=e;const c=(0,a.sO)(null),[m,u]=(0,I.Z)(!1);(0,na.Z)(c.current,!m),(0,a.bt)((()=>{u()}),[u]);const h=e=>{c&&("deltaY"in e?e.deltaY:ur(e))&&e.preventDefault()},P=(0,a.Ye)((()=>t?.map((e=>{if(!e.isInactive&&(r||n&&n.includes(e.reaction))&&(!(i&&s&&s.length>=i)||s.includes(e.reaction)))return e}))||[]),[t,s,n,r,i]);if(P.length)return a.ZP.createElement("div",{className:Ir("&",d.FW&&"compact"),onWheelCapture:h,onTouchMove:h},a.ZP.createElement("div",{className:Ir("bubble-big")}),a.ZP.createElement("div",{className:Ir("bubble-small")}),a.ZP.createElement("div",{className:Ir("items-wrapper")},a.ZP.createElement("div",{className:Ir("items",["no-scrollbar"]),ref:c},P.map(((e,t)=>{if(e)return a.ZP.createElement(br,{key:e.reaction,previewIndex:t,isReady:o,onSendReaction:l,reaction:e})})))))})),Sr=(0,a.X$)((e=>{let{availableReactions:t,isOpen:n,message:s,isPrivate:o,isCurrentUserPremium:l,enabledReactions:c,maxUniqueReactions:m,anchor:u,canSendNow:h,canReschedule:P,canBuyPremium:Z,canReply:v,canEdit:p,canPin:g,canUnpin:E,canDelete:C,canReport:f,canForward:y,canFaveSticker:S,canUnfaveSticker:k,canCopy:N,canCopyLink:w,canSelect:T,canDownload:R,canSaveGif:L,canRevote:F,canClosePoll:x,isDownloading:B,canShowSeenBy:O,canShowReactionsCount:D,canRemoveReaction:U,canShowReactionList:$,seenByRecentUsers:_,hasCustomEmoji:G,customEmojiSets:j,onReply:z,onEdit:X,onPin:H,onUnpin:q,onForward:Y,onDelete:K,onReport:Q,onFaveSticker:ee,onUnfaveSticker:te,onSelect:ne,onSend:ae,onReschedule:se,onClose:ie,onCloseAnimationEnd:re,onCopyLink:oe,onCopyNumber:le,onDownload:ce,onSaveGif:de,onCancelVote:me,onClosePoll:ue,onShowSeenBy:he,onShowReactors:Pe,onSendReaction:Ze,onCopyMessages:pe,onAboutAds:ge,onSponsoredHide:Ee}=e;const{showNotification:Ce,openStickerSet:fe,openCustomEmojiSets:be}=(0,i.Sv)(),Ie=(0,a.sO)(null),ye=(0,a.sO)(null),Se=(0,M.Z)(),ke=$&&!(!o&&!c?.length),Ne=!("id"in s),we=Ne?"":s.id,[Me,Te,Ae]=(0,I.Z)(),Re=(0,a.Ye)((()=>{if(!Ne)return s.reactions?.results.map((e=>e.reaction))}),[Ne,s]),Le=(0,a.I4)((()=>{Ce({message:Se("Share.Link.Copied")}),ie()}),[Se,ie,Ce]),Fe=(0,a.I4)((()=>{j&&(1===j.length?fe({stickerSetInfo:{shortName:j[0].shortName}}):be({setIds:j.map((e=>e.id))}),ie())}),[j,ie,be,fe]),xe=Ne?[]:function(e,t,n,a,s){const i=[],o=(0,r.UD)(e),l=(0,r.O$)(e)||((0,r.Cg)(e)?void 0:(0,r.F$)(e)),c=(0,r.nl)(e),d=(0,r.Ti)(e,"inline"),m=l&&(d||(0,r.BM)(e))&&ns.yl,u=window.getSelection();if(m&&i.push({label:"lng_context_copy_image",icon:"copy-media",handler:()=>{Promise.resolve(d?rr.he(d,A.IU.BlobUrl):l.blobUrl).then(ns.VP),t?.()}}),o){const n=Boolean(u?.anchorNode?.parentNode&&u.anchorNode.parentNode.closest(".Message .content-inner")&&""!==u.toString().replace(/(?:\r\n|\r|\n)/g,""));i.push({label:lr(n),icon:"copy",handler:()=>{const s=(0,or.Z)();if(s?.length&&a)a(s);else if(n)document.execCommand("copy");else{const t=(0,b.X)(e,void 0,void 0,void 0,void 0,void 0,!0);t&&(0,ns.qN)(t.join(""),(0,r.EU)(e))}t?.()}})}return n&&i.push({label:"lng_context_copy_message_link",icon:"link",handler:()=>{n(),t?.()}}),c&&s&&i.push({label:"lng_profile_copy_phone",icon:"copy",handler:()=>{s(),t?.()}}),i}(s,Le,w?oe:void 0,pe,le),Oe=(0,a.I4)((()=>Ne?document.querySelector(".Transition__slide--active > .MessageList .SponsoredMessage"):document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id="${we}"]`)),[Ne,we]),De=(0,a.I4)((()=>document.querySelector(".Transition__slide--active > .MessageList")),[]),Ue=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),$e=(0,a.I4)((()=>{const e=d.wB&&document.querySelector(".AudioPlayer-content")?.offsetHeight||0,t=document.querySelector(".HeaderPinnedMessage-wrapper"),n=(d.wB&&!e||!d.wB&&t?.classList.contains("full-width"))&&t?.offsetHeight||0;return{extraPaddingX:10,extraTopPadding:document.querySelector(".MiddleHeader").offsetHeight,marginSides:ke?32:void 0,extraMarginTop:n+e}}),[ke]),_e=(0,a.I4)((()=>{Ze(void 0,0,0)}),[Ze]);(0,a.d4)((()=>{n?setTimeout((()=>{Te()}),200):Ae()}),[n,Te,Ae]);const{positionX:Ge,positionY:je,transformOriginX:Ve,transformOriginY:ze,style:Je,menuStyle:Xe,withScroll:He}=(0,pr.Z)(u,Oe,De,Ue,$e);return(0,a.d4)((()=>(Zr(He?ye.current:void 0,".ReactionSelector"),vr)),[He]),a.ZP.createElement(ve.Z,{ref:Ie,isOpen:n,transformOriginX:Ve,transformOriginY:ze,positionX:Ge,positionY:je,style:Je,bubbleStyle:Xe,className:(0,W.Z)("MessageContextMenu","fluid",ke&&"with-reactions"),onClose:ie,onCloseAnimationEnd:re},$&&a.ZP.createElement(yr,{enabledReactions:c,currentReactions:Re,maxUniqueReactions:m,onSendReaction:Ze,isPrivate:o,availableReactions:t,isReady:Me,canBuyPremium:Z,isCurrentUserPremium:l}),a.ZP.createElement("div",{className:"scrollable-content custom-scroll",style:Xe,ref:ye},U&&a.ZP.createElement(V.Z,{icon:"heart-outline",onClick:_e},"Remove Reaction"),h&&a.ZP.createElement(V.Z,{icon:"send-outline",onClick:ae},Se("MessageScheduleSend")),P&&a.ZP.createElement(V.Z,{icon:"schedule",onClick:se},Se("MessageScheduleEditTime")),v&&a.ZP.createElement(V.Z,{icon:"reply",onClick:z},Se("Reply")),p&&a.ZP.createElement(V.Z,{icon:"edit",onClick:X},Se("Edit")),S&&a.ZP.createElement(V.Z,{icon:"favorite",onClick:ee},Se("AddToFavorites")),k&&a.ZP.createElement(V.Z,{icon:"favorite",onClick:te},Se("Stickers.RemoveFromFavorites")),N&&xe.map((e=>a.ZP.createElement(V.Z,{key:e.label,icon:e.icon,onClick:e.handler},Se(e.label)))),g&&a.ZP.createElement(V.Z,{icon:"pin",onClick:H},Se("DialogPin")),E&&a.ZP.createElement(V.Z,{icon:"unpin",onClick:q},Se("DialogUnpin")),L&&a.ZP.createElement(V.Z,{icon:"gifs",onClick:de},Se("lng_context_save_gif")),F&&a.ZP.createElement(V.Z,{icon:"revote",onClick:me},Se("lng_polls_retract")),x&&a.ZP.createElement(V.Z,{icon:"stop",onClick:ue},Se("lng_polls_stop")),R&&a.ZP.createElement(V.Z,{icon:"download",onClick:ce},Se(B?"lng_context_cancel_download":"lng_media_download")),y&&a.ZP.createElement(V.Z,{icon:"forward",onClick:Y},Se("Forward")),T&&a.ZP.createElement(V.Z,{icon:"select",onClick:ne},Se("Common.Select")),f&&a.ZP.createElement(V.Z,{icon:"flag",onClick:Q},Se("lng_context_report_msg")),(O||D)&&!Ne&&a.ZP.createElement(V.Z,{className:"MessageContextMenu--seen-by",icon:D?"heart-outline":"group",onClick:D?Pe:he,disabled:!D&&!s.seenByUserIds?.length},a.ZP.createElement("span",{className:"MessageContextMenu--seen-by-label"},D&&s.reactors?.count?O&&s.seenByUserIds?.length?Se("Chat.OutgoingContextMixedReactionCount",[s.reactors.count,s.seenByUserIds.length]):Se("Chat.ContextReactionCount",s.reactors.count,"i"):1===s.seenByUserIds?.length&&_?(0,J.Z)((0,r.Js)(_[0])):s.seenByUserIds?.length?Se("Conversation.ContextMenuSeen",s.seenByUserIds.length,"i"):Se("Conversation.ContextMenuNoViews")),a.ZP.createElement("div",{className:"avatars"},_?.map((e=>a.ZP.createElement(Be.Z,{size:"micro",user:e}))))),C&&a.ZP.createElement(V.Z,{destructive:!0,icon:"delete",onClick:K},Se("Delete")),G&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(gr.Z,null),!j&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Er.Z,{inline:!0,className:"menu-loading-row"}),a.ZP.createElement(Er.Z,{inline:!0,className:"menu-loading-row"})),j&&1===j.length&&a.ZP.createElement(V.Z,{withWrap:!0,onClick:Fe,className:"menu-custom-emoji-sets"},(0,J.Z)(Se("MessageContainsEmojiPack",j[0].title),["simple_markdown","emoji"])),j&&j.length>1&&a.ZP.createElement(V.Z,{withWrap:!0,onClick:Fe,className:"menu-custom-emoji-sets"},(0,J.Z)(Se("MessageContainsEmojiPacks",j.length),["simple_markdown"]))),Ne&&a.ZP.createElement(V.Z,{icon:"help",onClick:ge},Se("SponsoredMessageInfo")),Ne&&Ee&&a.ZP.createElement(V.Z,{icon:"stop",onClick:Ee},Se("HideAd"))))})),kr=2*u.Gw,Nr=(0,a.X$)((0,i.c$)(((e,t)=>{let{message:n,messageListType:a}=t;const{threadId:s}=(0,o.Bt)(e)||{},i=(0,o.xs)(e,n.chatId),l=(0,o.Z1)(e,n.chatId),{seenByExpiresAt:c,seenByMaxChatMembers:d,maxUniqueReactions:u}=e.appConfig||{},{noOptions:h,canReply:P,canPin:Z,canUnpin:v,canDelete:p,canReport:g,canEdit:E,canForward:C,canFaveSticker:f,canUnfaveSticker:b,canCopy:I,canCopyLink:y,canSelect:S,canDownload:k,canSaveGif:N,canRevote:w,canClosePoll:M}=s&&(0,o._k)(e,n,s)||{},T="pinned"===a,A="scheduled"===a,R=l&&(0,r.eA)(l),L=(0,r.CI)(n),F=Boolean(l&&d&&c&&(0,r.Bf)(l)&&(0,r.B4)(n)&&!A&&l.membersCount&&l.membersCount<=d&&n.date>Date.now()/1e3-c),x=l&&(0,r.YC)(l.id),B=(0,r.FT)(n),O=!L&&!R&&!A&&!B&&!x&&n.reactions&&!(0,r.JE)(n.reactions)&&n.reactions.canSeeList,D=x&&n.reactions?.results?.some((e=>e.isChosen)),U=(0,o.EV)(e,n),$=Boolean(n.content.contact),_=(0,o.wV)(e),G=(0,o.q_)(e,n),j=G?.map((t=>(0,o.Ny)(e,t))),V=j?.every(Boolean)?j:void 0;return{availableReactions:e.availableReactions,noOptions:h,canSendNow:A,canReschedule:A,canReply:!T&&!A&&P,canPin:!A&&Z,canUnpin:!A&&v,canDelete:p,canReport:g,canEdit:!T&&E,canForward:!A&&C,canFaveSticker:!A&&f,canUnfaveSticker:!A&&b,canCopy:$||!U&&I,canCopyLink:!A&&y,canSelect:S,canDownload:!U&&k,canSaveGif:!U&&N,canRevote:w,canClosePoll:!A&&M,activeDownloads:i,canShowSeenBy:F,enabledReactions:l?.isForbidden?void 0:l?.fullInfo?.enabledReactions,maxUniqueReactions:u,isPrivate:x,isCurrentUserPremium:_,hasFullInfo:Boolean(l?.fullInfo),canShowReactionsCount:O,canShowReactionList:!L&&!B&&!A&&l?.id!==m.aw,canRemoveReaction:D,canBuyPremium:!_&&!(0,o.oe)(e),customEmojiSetsInfo:G,customEmojiSets:V,canScheduleUntilOnline:(0,o.Eh)(e,n.chatId)}}))((e=>{let{availableReactions:t,isOpen:n,messageListType:s,chatUsername:o,message:l,customEmojiSetsInfo:c,customEmojiSets:d,album:u,anchor:h,onClose:P,onCloseAnimationEnd:Z,noOptions:v,canSendNow:p,hasFullInfo:g,canReschedule:E,canReply:C,canPin:f,canUnpin:b,canDelete:y,canReport:S,canShowReactionsCount:k,canShowReactionList:N,canRemoveReaction:w,canEdit:T,enabledReactions:A,maxUniqueReactions:R,isPrivate:L,isCurrentUserPremium:F,canForward:x,canBuyPremium:B,canFaveSticker:O,canUnfaveSticker:D,canCopy:$,canCopyLink:_,canSelect:G,canDownload:j,canSaveGif:V,canRevote:z,canClosePoll:J,activeDownloads:X,canShowSeenBy:q,canScheduleUntilOnline:Y}=e;const{setReplyingToId:K,setEditingId:Q,pinMessage:ee,openForwardMenu:te,faveSticker:ne,unfaveSticker:ae,toggleMessageSelection:se,sendScheduledMessages:ie,rescheduleMessage:re,downloadMessageMedia:oe,cancelMessageMediaDownload:le,loadSeenBy:ce,openSeenByModal:de,sendReaction:ue,openReactorListModal:he,loadFullChat:Pe,loadReactors:Ze,copyMessagesByIds:ve,saveGif:pe,loadStickers:ge,cancelPollVote:Ee,closePoll:Ce}=(0,i.Sv)(),fe=(0,M.Z)(),{transitionClassNames:be}=(0,me.Z)(n,Z,void 0,!1),[Ie,ye]=(0,a.eJ)(!0),[Se,ke]=(0,a.eJ)(!1),[Ne,we]=(0,a.eJ)(!1),[Me,Te]=(0,a.eJ)(!1),[Ae,Re,Le]=(0,I.Z)(),[Fe,xe]=(0,ir.Z)(Y,P,l.date),Be=void 0===c||Boolean(c.length);(0,a.d4)((()=>{q&&n&&ce({chatId:l.chatId,messageId:l.id})}),[ce,n,l.chatId,l.id,q]),(0,a.d4)((()=>{k&&n&&Ze({chatId:l.chatId,messageId:l.id})}),[k,n,Ze,l.chatId,l.id]),(0,a.d4)((()=>{c?.length&&d?.length!==c.length&&c.forEach((e=>{ge({stickerSetInfo:e})}))}),[c,d,ge]),(0,a.d4)((()=>{g||L||!n||Pe({chatId:l.chatId})}),[g,n,L,Pe,l.chatId]);const Oe=(0,a.Ye)((()=>{if(l.reactions?.recentReactions?.length){const e=(0,i.Rd)().users.byId,t=new Set(l.reactions?.recentReactions?.map((t=>{let{userId:n}=t;return e[n]})));return Array.from(t).filter(Boolean).slice(0,3)}if(!l.seenByUserIds)return;const e=(0,i.Rd)().users.byId;return l.seenByUserIds?.slice(0,3).map((t=>e[t])).filter(Boolean)}),[l.reactions?.recentReactions,l.seenByUserIds]),De=u?u.messages.some((e=>X.includes(e.id))):X.includes(l.id),Ue=(0,a.I4)((()=>{ye(!1),ke(!0)}),[]),$e=(0,a.I4)((()=>{ye(!1),we(!0)}),[]),_e=(0,a.I4)((()=>{ye(!1),P()}),[P]),Ge=(0,a.I4)((()=>{ke(!1),P()}),[P]),je=(0,a.I4)((()=>{we(!1),P()}),[P]),Ve=(0,a.I4)((()=>{Te(!1),P()}),[P]),ze=(0,a.I4)((()=>{K({messageId:l.id}),_e()}),[K,l.id,_e]),Je=(0,a.I4)((()=>{Q({messageId:l.id}),_e()}),[Q,l.id,_e]),Xe=(0,a.I4)((()=>{ye(!1),Te(!0)}),[]),He=(0,a.I4)((()=>{ee({messageId:l.id,isUnpin:!0}),_e()}),[ee,l.id,_e]),qe=(0,a.I4)((()=>{if(_e(),u?.messages){const e=u.messages.map((e=>{let{id:t}=e;return t}));te({fromChatId:l.chatId,messageIds:e})}else te({fromChatId:l.chatId,messageIds:[l.id]})}),[te,l,_e,u]),Ye=(0,a.I4)((()=>{_e(),ne({sticker:l.content.sticker})}),[_e,l.content.sticker,ne]),Ke=(0,a.I4)((()=>{_e(),ae({sticker:l.content.sticker})}),[_e,l.content.sticker,ae]),We=(0,a.I4)((()=>{_e(),Ee({chatId:l.chatId,messageId:l.id})}),[_e,l,Ee]),Qe=(0,a.I4)((()=>{_e(),Ce({chatId:l.chatId,messageId:l.id})}),[_e,l,Ce]),et=(0,a.I4)((()=>{const e=u?.messages?{messageId:l.id,childMessageIds:u.messages.map((e=>{let{id:t}=e;return t})),withShift:!1}:{messageId:l.id,withShift:!1};se(e),_e()}),[_e,l.id,se,u]),tt=(0,a.I4)((()=>{ie({chatId:l.chatId,id:l.id}),_e()}),[_e,l.chatId,l.id,ie]),nt=(0,a.I4)((e=>{re({chatId:l.chatId,messageId:l.id,scheduledAt:e}),P()}),[l.chatId,l.id,P,re]),at=(0,a.I4)((()=>{ye(!1),Fe(nt)}),[nt,Fe]),st=(0,a.I4)((()=>{_e(),de({chatId:l.chatId,messageId:l.id})}),[_e,l.chatId,l.id,de]),it=(0,a.I4)((()=>{_e(),he({chatId:l.chatId,messageId:l.id})}),[_e,he,l.chatId,l.id]),rt=(0,a.I4)((e=>{ve({messageIds:e}),_e()}),[_e,ve]),ot=(0,a.I4)((()=>{(0,ns.TE)(`${m.zH}${o||`c/${l.chatId.replace("-","")}`}/${l.id}`),_e()}),[o,_e,l]),ct=(0,a.I4)((()=>{(0,ns.TE)(l.content.contact.phoneNumber),_e()}),[_e,l]),dt=(0,a.I4)((()=>{(u?.messages||[l]).forEach((e=>{De?le({message:e}):oe({message:e})})),_e()}),[u,l,_e,De,le,oe]),mt=(0,a.I4)((()=>{const e=(0,r.b7)(l);pe({gif:e}),_e()}),[_e,l,pe]),ut=(0,a.I4)(((e,t,n)=>{ue({chatId:l.chatId,messageId:l.id,reaction:e,x:t,y:n,startSize:kr}),_e()}),[_e,l.chatId,l.id,ue]),ht=(0,a.Ye)((()=>(u?u.messages:[l]).map((e=>{let{id:t}=e;return t}))),[u,l]);if(v)return void _e();const Pt=new Date;return Pt.setFullYear(Pt.getFullYear()+1),a.ZP.createElement("div",{className:(0,W.Z)("ContextMenuContainer",be)},a.ZP.createElement(Sr,{availableReactions:t,message:l,isPrivate:L,isCurrentUserPremium:F,canBuyPremium:B,isOpen:Ie,enabledReactions:A,maxUniqueReactions:R,anchor:h,canShowReactionsCount:k,canShowReactionList:N,canRemoveReaction:w,canSendNow:p,canReschedule:E,canReply:C,canDelete:y,canReport:S,canPin:f,canUnpin:b,canEdit:T,canForward:x,canFaveSticker:O,canUnfaveSticker:D,canCopy:$,canCopyLink:_,canSelect:G,canDownload:j,canSaveGif:V,canRevote:z,canClosePoll:J,canShowSeenBy:q,hasCustomEmoji:Be,customEmojiSets:d,isDownloading:De,seenByRecentUsers:Oe,onReply:ze,onEdit:Je,onPin:Xe,onUnpin:He,onForward:qe,onDelete:Ue,onReport:$e,onFaveSticker:Ye,onUnfaveSticker:Ke,onSelect:et,onSend:tt,onReschedule:at,onClose:_e,onCopyLink:ot,onCopyMessages:rt,onCopyNumber:ct,onDownload:dt,onSaveGif:mt,onCancelVote:We,onClosePoll:Re,onShowSeenBy:st,onSendReaction:ut,onShowReactors:it}),a.ZP.createElement(H,{isOpen:Se,isSchedule:"scheduled"===s,onClose:Ge,album:u,message:l}),a.ZP.createElement(U.Z,{isOpen:Ne,onClose:je,messageIds:ht}),a.ZP.createElement(Gn,{isOpen:Me,messageId:l.id,chatId:l.chatId,onClose:Ve}),a.ZP.createElement(lt.Z,{isOpen:Ae,onClose:Le,text:fe("lng_polls_stop_warning"),confirmLabel:fe("lng_polls_stop_sure"),confirmHandler:Qe}),E&&xe)}))),wr=(0,a.X$)((0,i.c$)((e=>({canBuyPremium:!(0,o.wV)(e)&&!(0,o.oe)(e)})))((e=>{let{message:t,anchor:n,onAboutAds:s,onClose:r,onCloseAnimationEnd:o,canBuyPremium:l}=e;const{openPremiumModal:c}=(0,i.Sv)(),[d,,m]=(0,I.Z)(!0),{transitionClassNames:u}=(0,me.Z)(d,o,void 0,!1),h=(0,a.I4)((()=>{s(),m()}),[m,s]),P=(0,a.I4)((()=>{m(),c(),r()}),[m,r,c]);if(n)return a.ZP.createElement("div",{className:(0,W.Z)("ContextMenuContainer",u)},a.ZP.createElement(Sr,{isOpen:d,anchor:n,message:t,onClose:m,onCloseAnimationEnd:m,onAboutAds:h,onSponsoredHide:l?P:void 0}))}))),Mr=(0,a.X$)((0,i.c$)(((e,t)=>{let{fromSticker:n,stickerSetShortName:a}=t;const s=(0,o.Bt)(e),{chatId:i,threadId:l}=s||{},c=i&&(0,o.Z1)(e,i),d=c?(0,r.H5)(c):void 0,m=Boolean(c&&l&&(0,r.Qm)(c,l)&&d?.canSendStickers),u=Boolean(i)&&(0,o.FM)(e,i),h=n?n.stickerSetInfo:a?{shortName:a}:void 0,P=h?(0,o.Ny)(e,h):void 0,Z=P&&(0,o.FW)(P);return{canScheduleUntilOnline:Boolean(i)&&(0,o.Eh)(e,i),canSendStickers:m,isSavedMessages:u,shouldSchedule:(0,o.Aq)(e),stickerSet:P,isCurrentUserPremium:(0,o.wV)(e),isSetPremium:Z}}))((e=>{let{isOpen:t,fromSticker:n,stickerSetShortName:s,stickerSet:r,canSendStickers:o,canScheduleUntilOnline:l,shouldSchedule:c,isSavedMessages:d,isSetPremium:u,isCurrentUserPremium:h,onClose:P}=e;const{loadStickers:Z,toggleStickerSet:v,sendMessage:p,openPremiumModal:g}=(0,i.Sv)(),E=(0,a.sO)(null),C=(0,a.sO)(null),f=(0,M.Z)(),b=(0,T.Z)(r),I=r||b,y=I?.isEmoji,S=!I?.installedDate&&u&&!h,[k,N]=(0,ir.Z)(l),{observe:w}=(0,Ca.S1)({rootRef:E,throttleMs:200,isDisabled:!t});(0,a.d4)((()=>{t&&!I?.stickers&&Z({stickerSetInfo:n?n.stickerSetInfo:{shortName:s}})}),[t,n,Z,s,I]);const A=(0,a.I4)(((e,t,n)=>{e={...e,isPreloadedGlobally:!0},c||n?k((n=>{p({sticker:e,isSilent:t,scheduledAt:n}),P()})):(p({sticker:e,isSilent:t}),P())}),[P,k,p,c]),R=(0,a.I4)((()=>{if(I){if(S)return void g({initialSection:"animated_emoji"});v({stickerSetId:I.id}),P()}}),[S,P,g,I,v]);return a.ZP.createElement(X.Z,{className:"StickerSetModal",isOpen:t,onClose:P,hasCloseButton:!0,title:I?(0,J.Z)(I.title,["emoji","links"]):f("AccDescrStickerSet")},I?.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:E,className:"stickers custom-scroll"},a.ZP.createElement("div",{className:"shared-canvas-container"},a.ZP.createElement("canvas",{ref:C,className:"shared-canvas"}),I.stickers.map((e=>a.ZP.createElement(Ai.Z,{sticker:e,size:y?m.lH:m.yK,observeIntersection:w,onClick:o&&!y?A:void 0,clickArg:e,isSavedMessages:d,isCurrentUserPremium:h,sharedCanvasRef:C}))))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement($.Z,{size:"smaller",fluid:!0,color:I.installedDate?"danger":"primary",isShiny:S,withPremiumGradient:S,onClick:R},(()=>{if(!I)return f("Loading");if(S)return f("EmojiInput.UnlockPack",I.title);const e=y?"Emoji":"Sticker";return f(I.installedDate?`StickerPack.Remove${e}Count`:`StickerPack.Add${e}Count`,I.count,"i")})()))):a.ZP.createElement(Ve.Z,null),N)}))),Tr={root:"Qzt_zq5gWHne6P2rw7Wj",sets:"Ay41sqhq2QmXdgDHnt2E"},Ar=(0,a.X$)((0,i.c$)(((e,t)=>{let{customEmojiSetIds:n}=t;const a=n?.map((t=>e.stickers.setsById[t]));return{customEmojiSets:a}}))((e=>{let{customEmojiSets:t,onClose:n}=e;const{openStickerSet:s}=(0,i.Sv)(),r=(0,a.sO)(null),{observe:o}=(0,Ca.S1)({rootRef:r}),l=(0,T.Z)(t),c=t||l,d=(0,a.I4)((e=>{s({stickerSetInfo:e.stickerSetInfo})}),[s]);return a.ZP.createElement(X.Z,{isOpen:Boolean(t),className:Tr.root,onClose:n,hasCloseButton:!0,title:"Sets of used emoji"},a.ZP.createElement("div",{className:(0,W.Z)(Tr.sets,"custom-scroll"),ref:r},c?.map((e=>a.ZP.createElement(Ri,{key:e.id,className:Tr.setCard,stickerSet:e,onClick:d,observeIntersection:o})))))})));var Rr=n(62898);const Lr={settings:{icon:"bots",label:"BotSettings"},privacy:{icon:"info",label:"Privacy"},help:{icon:"help",label:"BotHelp"}},Fr=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n);if(!a||a.isRestricted)return{};const s=(0,r.YC)(a.id),i=s?(0,o.dy)(e,n):void 0,l=i&&(0,r.kw)(i),c=(0,r.eA)(a)||(0,r.Bf)(a)||i&&!i.isSelf,d=n!==m.FV?(0,o.IK)(e,n):void 0,u=Boolean(e.lastSyncTime&&i?.fullInfo?.premiumGifts?.length&&!(0,o.oe)(e));return{chat:a,isMuted:(0,r.i4)(a,(0,o.dZ)(e),(0,o.NJ)(e)),isPrivate:s,canAddContact:l,canReportChat:c,canDeleteChat:(0,r.cc)(a),canGiftPremium:u,hasLinkedChat:Boolean(a?.fullInfo?.linkedChatId),botCommands:d?.fullInfo?.botInfo?.commands}}))((e=>{let{chatId:t,isOpen:n,withExtraActions:s,anchor:r,isChannel:o,botCommands:l,canStartBot:c,canRestartBot:m,canSubscribe:u,canSearch:h,canCall:P,canMute:Z,canViewStatistics:v,canLeave:p,canEnterVoiceChat:g,canCreateVoiceChat:E,chat:C,isPrivate:f,isMuted:b,canReportChat:I,canDeleteChat:y,canGiftPremium:S,hasLinkedChat:k,canAddContact:N,onSubscribeChannel:w,onSearchClick:T,onClose:A,onCloseAnimationEnd:R}=e;const{updateChatMutedState:L,enterMessageSelectMode:F,sendBotCommand:x,restartBot:B,joinGroupCall:O,createGroupCall:D,openLinkedChat:$,openAddContactDialog:_,requestCall:G,toggleStatistics:j,openGiftPremiumModal:z}=(0,i.Sv)(),[J,X]=(0,a.eJ)(!0),[H,q]=(0,a.eJ)(!1),[Y,K]=(0,a.eJ)(!1),{x:W,y:Q}=r;(0,me.Z)(n,R,void 0,!1);const ee=(0,a.I4)((()=>{X(!1),K(!0)}),[]),te=(0,a.I4)((()=>{K(!1),A()}),[A]),ne=(0,a.I4)((()=>{X(!1),q(!0)}),[]),ae=(0,a.I4)((()=>{X(!1),A()}),[A]),se=(0,a.I4)((()=>{q(!1),A()}),[A]),ie=(0,a.I4)((()=>{x({command:"/start"})}),[x]),re=(0,a.I4)((()=>{B({chatId:t})}),[t,B]),oe=(0,a.I4)((()=>{L({chatId:t,isMuted:!b}),ae()}),[t,ae,b,L]),le=(0,a.I4)((()=>{E?D({chatId:t}):O({chatId:t}),ae()}),[ae,E,t,O,D]),ce=(0,a.I4)((()=>{$({id:t}),ae()}),[t,ae,$]),de=(0,a.I4)((()=>{z({forUserId:t}),ae()}),[z,t,ae]),ue=(0,a.I4)((()=>{_({userId:t}),ae()}),[_,t,ae]),he=(0,a.I4)((()=>{w(),ae()}),[ae,w]),Pe=(0,a.I4)((()=>{G({userId:t,isVideo:!0}),ae()}),[t,ae,G]),Ze=(0,a.I4)((()=>{G({userId:t}),ae()}),[t,ae,G]),pe=(0,a.I4)((()=>{T(),ae()}),[ae,T]),ge=(0,a.I4)((()=>{j(),ae()}),[ae,j]),Ee=(0,a.I4)((()=>{F(),ae()}),[ae,F]);(0,a.d4)((()=>(Zr(),vr)),[]);const Ce=(0,M.Z)(),fe=(0,a.Ye)((()=>l?.map((e=>{let{command:t}=e;const n=Lr[t];if(n)return a.ZP.createElement(V.Z,{key:t,icon:n.icon,onClick:()=>{x({command:`/${t}`}),ae()}},Ce(n.label))}))),[l,ae,Ce,x]);return a.ZP.createElement(Rr.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(ve.Z,{isOpen:J,positionX:"right",style:`left: ${W}px;top: ${Q}px;`,onClose:ae},s&&c&&a.ZP.createElement(V.Z,{icon:"bots",onClick:ie},Ce("BotStart")),s&&m&&a.ZP.createElement(V.Z,{icon:"bots",onClick:re},Ce("BotRestart")),s&&u&&a.ZP.createElement(V.Z,{icon:o?"channel":"group",onClick:he},Ce(o?"ProfileJoinChannel":"ProfileJoinGroup")),N&&a.ZP.createElement(V.Z,{icon:"add-user",onClick:ue},Ce("AddContact")),d.wB&&P&&a.ZP.createElement(V.Z,{icon:"phone",onClick:Ze},Ce("Call")),P&&a.ZP.createElement(V.Z,{icon:"video-outlined",onClick:Pe},Ce("VideoCall")),d.wB&&h&&a.ZP.createElement(V.Z,{icon:"search",onClick:pe},Ce("Search")),Z&&a.ZP.createElement(V.Z,{icon:b?"unmute":"mute",onClick:oe},Ce(b?"ChatsUnmute":"ChatsMute")),(g||E)&&a.ZP.createElement(V.Z,{icon:"voice-chat",onClick:le},Ce(E?"StartVoipChat":"VoipGroupJoinCall")),k&&a.ZP.createElement(V.Z,{icon:o?"comments":"channel",onClick:ce},Ce(o?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(V.Z,{icon:"select",onClick:Ee},Ce("ReportSelectMessages")),v&&a.ZP.createElement(V.Z,{icon:"stats",onClick:ge},Ce("Statistics")),I&&a.ZP.createElement(V.Z,{icon:"flag",onClick:ee},Ce("ReportPeer.Report")),fe,S&&a.ZP.createElement(V.Z,{icon:"gift",onClick:de},Ce("GiftPremium")),p&&a.ZP.createElement(V.Z,{destructive:!0,icon:"delete",onClick:ne},Ce(f?"DeleteChatUser":y?"GroupInfo.DeleteAndExit":o?"LeaveChannel":"Group.LeaveGroup"))),C&&a.ZP.createElement(ia.Z,{isOpen:H,onClose:se,chat:C}),I&&C?.id&&a.ZP.createElement(U.Z,{isOpen:Y,onClose:te,subject:"peer",chatId:C.id})))})));var xr=n(69589);const Br=(0,te.Ds)((e=>e()),200,!1),Or=(0,a.X$)((0,i.c$)((e=>{const t=(0,o.jr)(e);if(!t)return{};const{query:n,results:a}=(0,o.n5)(e)||{},{totalCount:s,foundIds:i}=a||{};return{chat:t,query:n,totalCount:s,foundIds:i,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}}))((e=>{let{isActive:t,chat:n,query:s,totalCount:r,foundIds:o,isHistoryCalendarOpen:l}=e;const{setLocalTextSearchQuery:c,searchTextMessagesLocal:d,focusMessage:m,closeLocalTextSearch:u,openHistoryCalendar:h}=(0,i.Sv)(),P=(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===P.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)((()=>{n?.id&&o?.length?(m({chatId:n.id,messageId:o[0]}),v(0)):v(-1)}),[n?.id,m,o]),(0,a.d4)((()=>{Array.from(document.querySelectorAll("input")).forEach((e=>{e.disabled=Boolean(t&&e!==P.current)})),Array.from(document.querySelectorAll("div[contenteditable]")).forEach((e=>{e.contentEditable=t?"false":"true"}))}),[t]),(0,a.d4)((()=>{t||P.current.blur()}),[t]),(0,a.bt)((()=>{document.querySelector("#MobileSearch input").blur()}),[l]);const p=(0,a.I4)((e=>{c({query:e}),e.length&&Br(d)}),[d,c]),g=(0,a.I4)((()=>{if(n&&o){const e=Z+1;m({chatId:n.id,messageId:o[e]}),v(e)}}),[n,Z,m,o]),E=(0,a.I4)((()=>{if(n&&o){const e=Z-1;m({chatId:n.id,messageId:o[e]}),v(e)}}),[n,Z,m,o]);return a.ZP.createElement("div",{id:"MobileSearch",className:t?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement($.Z,{size:"smaller",round:!0,color:"translucent",onClick:u},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement(xr.Z,{ref:P,value:s,onChange:p})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},s?o?.length?`${Z+1} of ${r}`:o&&!o.length?"No results":"":a.ZP.createElement($.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>h({selectedAt:(0,he._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon-calendar"}))),a.ZP.createElement($.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($.Z,{round:!0,size:"smaller",color:"translucent",onClick:E,disabled:!o||!o.length||0===Z},a.ZP.createElement("i",{className:"icon-down"}))))})));var Dr=n(15376),Ur=n(21262),$r=n(29295),_r=n(72162),Gr=n(17240),jr=n(70971),Vr=n(60130),zr=n(47002),Jr=n(49841);function Xr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const r=e[i?"scrollLeft":"scrollTop"],o=r+e[i?"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[i?"offsetLeft":"offsetTop"],u=c+t[i?"offsetWidth":"offsetHeight"];if(s?u>=r-n&&u<=o+n:c<=o+n&&u>=r-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:l,visibleIndexes:d}}const Hr=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=e[n?"scrollLeft":"scrollTop"],s=a+e[n?"offsetWidth":"offsetHeight"],i=t[n?"offsetLeft":"offsetTop"],r=i+t[n?"offsetWidth":"offsetHeight"];return i>a&&r<s};var qr=n(60539);function Yr(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:i}=Xr(a,e,8,!0,!0);if(!i.length||!i[t])return;const r=s[0];if(!s.includes(t)||t===r&&!Hr(a,i[r])){const e=t>s[s.length-1]?"start":"end";(0,qr.Z)(a,i[t],e,10)}}function Kr(e){let{isActive:t,isHorizontal:n,shouldSaveSelectionOnUpdateItems:s,shouldRemoveSelectionOnReset:i,noArrowNavigation:r,items:o,shouldSelectOnTab:l,onSelect:c,onClose:d}=e;const[m,u]=(0,a.eJ)(-1),h=(0,a.I4)((e=>o?(0,jt.Z)(o.length,e):-1),[o]),P=(0,a.I4)(((e,t)=>{t.preventDefault(),u((t=>h(t+e)))}),[u,h]),Z=(0,a.I4)((e=>{if(o&&o.length&&m>-1){const t=o[m];t&&(e.preventDefault(),c(t))}}),[o,c,m]),v=!o||m>o.length-1;return(0,a.d4)((()=>{s&&!v||u(i?-1:0)}),[v,i,s]),(0,a.d4)((()=>t?(0,Vn.Z)({onEsc:d,onUp:r||n?void 0:e=>P(-1,e),onDown:r||n?void 0:e=>P(1,e),onLeft:r||!n?void 0:e=>P(-1,e),onRight:r||!n?void 0:e=>P(1,e),onTab:l?Z:void 0,onEnter:Z}):void 0),[r,P,Z,t,n,d,l]),m}const Wr=(0,a.X$)((e=>{let{isOpen:t,onClose:n,onInsertUserName:s,filteredUsers:r}=e;const o=(0,a.sO)(null),{shouldRender:l,transitionClassNames:c}=(0,me.Z)(t,void 0,void 0,!1),d=(0,a.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(0,i.Rd)().users.byId,a=n[e];a&&s(a,t)}),[s]),m=(0,a.I4)((e=>{d(e.id,!0)}),[d]),u=Kr({isActive:t,items:r,onSelect:m,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:n});(0,a.d4)((()=>{Yr(".chat-item-clickable",u,o)}),[u]),(0,a.d4)((()=>{r&&!r.length&&n()}),[r,n]);const h=(0,T.Z)(r?.length?r:void 0,l),P=r&&!r.length?h:r;if(!l||P&&!P.length)return;const Z=(0,W.Z)("MentionTooltip composer-tooltip custom-scroll",c);return a.ZP.createElement("div",{className:Z,ref:o},P?.map(((e,t)=>{let{id:n}=e;return a.ZP.createElement(Xe.Z,{key:n,className:"chat-item-clickable scroll-item",onClick:()=>d(n),focus:u===t},a.ZP.createElement(qe.Z,{userId:n,avatarSize:"small",withUsername:!0}))})))}));var Qr=n(19830),eo=n(67146),to=n(93219);const no=(0,a.X$)((e=>{let{chatId:t,threadId:n,attachments:s,caption:r,canShowCustomSendMenu:o,captionLimit:l,isReady:d,isChatWithSelf:u,currentUserId:h,groupChatMembers:P,recentEmojis:Z,baseEmojiKeywords:v,emojiKeywords:p,shouldSchedule:g,shouldSuggestCustomEmoji:E,customEmojiForEmoji:C,onCaptionUpdate:f,onSend:b,onFileAppend:y,onClear:S,onSendSilent:k,onSendScheduled:N}=e;const{addRecentCustomEmoji:w,addRecentEmoji:A}=(0,i.Sv)(),R=(0,jr.Y)(r),L=(0,jr.Y)(null),F=(0,a.sO)(),x=(0,T.Z)(s),O=s.length?s:x,D=Boolean(s.length),[U,_,G]=(0,I.Z)(),j=Boolean(O&&O.every((e=>e.quick))),V=(0,M.Z)(),{isMentionTooltipOpen:z,closeMentionTooltip:J,insertMention:H,mentionFilteredUsers:q}=(0,$r.Z)(D,`#${m.nY}`,f,P,void 0,h),{isCustomEmojiTooltipOpen:Y,insertCustomEmoji:K}=(0,Vr.Z)(Boolean(E)&&D,`#${m.nY}`,r,f,C,!d),{isEmojiTooltipOpen:W,filteredEmojis:Q,filteredCustomEmojis:ee,insertEmoji:te,insertCustomEmoji:ne,closeEmojiTooltip:ae}=(0,_r.Z)(D,R,Z,m.nY,f,v,p,!d);(0,a.d4)((()=>D?(0,c.Z)(S):void 0),[D,S]);const{isContextMenuOpen:se,handleContextMenu:ie,handleContextMenuClose:re,handleContextMenuHide:oe}=(0,Gr.Z)(L,!o||!D),le=(0,a.I4)((()=>{D&&(g?N():b())}),[D,N,b,g]),ce=(0,a.I4)((async e=>{e.preventDefault(),G();const{dataTransfer:t}=e,n=await(0,Ur.Z)(t.items);if(n?.length){const e=Array.from(n).filter((e=>!j||(0,B.MD)(e)));y(e,j)}}),[j,y,G]);if(!O)return;const de=O.every((e=>m.oG.has(e.mimeType))),me=O.every((e=>m.wG.has(e.mimeType))),ue=O.every((e=>m.e7.has(e.mimeType)));let he="";he=V(de?"PreviewSender.SendPhoto":me?"PreviewSender.SendVideo":ue?"PreviewSender.SendAudio":"PreviewSender.SendFile",O.length,"i");const Pe=l-r.length<=100?l-r.length:void 0;return a.ZP.createElement(X.Z,{isOpen:D,onClose:S,header:function(){if(O)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:V.isRtl?"rtl":void 0},a.ZP.createElement($.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:S},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},he),a.ZP.createElement("div",{className:"AttachmentModal--send-wrapper"},a.ZP.createElement($.Z,{ref:L,color:"primary",size:"smaller",className:"modal-action-button",onClick:le,onContextMenu:o?ie:void 0},V("Send")),o&&a.ZP.createElement(eo.Z,{isOpen:se,isOpenToBottom:!0,onSendSilent:u?void 0:k,onSendSchedule:N,onClose:re,onCloseAnimationEnd:oe,isSavedMessages:u})))}(),className:"AttachmentModal "+(U?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:_,onDrop:ce,onDragOver:function(e){e.preventDefault(),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(G,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),G())},"data-attach-description":V("Preview.Dragging.AddItems",10),"data-dropzone":!0},j?a.ZP.createElement("div",{className:"media-wrapper custom-scroll"},O.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,disablePictureInPicture:!0})))):a.ZP.createElement("div",{className:"document-wrapper custom-scroll"},O.map((e=>a.ZP.createElement(zr.Z,{name:e.filename,extension:(0,Dr.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(Wr,{isOpen:z,onClose:J,onInsertUserName:H,filteredUsers:q}),a.ZP.createElement(Qr.Z,{isOpen:W,emojis:Q,customEmojis:ee,onClose:ae,onEmojiSelect:te,onCustomEmojiSelect:ne,addRecentEmoji:A,addRecentCustomEmoji:w}),a.ZP.createElement(to.Z,{chatId:t,isOpen:Y,onCustomEmojiSelect:K,addRecentCustomEmoji:w}),a.ZP.createElement(Jr.Z,{id:"caption-input-text",chatId:t,threadId:n,isAttachmentModalInput:!0,html:r,editableInputId:m.nY,placeholder:V("Caption"),onUpdate:f,onSend:le,canAutoFocus:Boolean(d&&s.length),captionLimit:Pe}))))}));var ao=n(83099);const so=(0,a.X$)((e=>{let{isOpen:t,isQuiz:n,shouldBeAnonymous:s,onSend:i,onClear:r}=e;const o=(0,a.sO)(null),l=(0,a.sO)(null),d=(0,a.sO)(null),[m,u]=(0,a.eJ)(""),[h,P]=(0,a.eJ)([""]),[Z,v]=(0,a.eJ)(!0),[p,g]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(n||!1),[f,b]=(0,a.eJ)(""),[I,y]=(0,a.eJ)(),[S,k]=(0,a.eJ)(!1),N=(0,M.Z)(),w=(0,a.I4)((e=>{t&&e.current&&e.current.focus()}),[t]);(0,a.d4)((()=>t?(0,c.Z)(r):void 0),[t,r]),(0,a.d4)((()=>{t||(u(""),P([""]),v(!0),g(!1),C(n||!1),b(""),y(void 0),k(!1))}),[n,t]),(0,a.d4)((()=>w(o)),[w,t]),(0,a.bt)((()=>{const e=d.current;e&&f!==e.innerHTML&&(e.innerHTML=f)}),[f]);const T=(0,a.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];P([...e,""]),requestAnimationFrame((()=>{const e=l.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),A=(0,a.I4)((()=>{if(k(!1),!t)return;const e=m.trim().substring(0,255),n=h.map((e=>e.trim().substring(0,100))).filter((e=>e.length));if(!e||n.length<2)return u(e),n.length?n.length<2?T(n):P(n):T(),void k(!0);if(E&&(void 0===I||!n[I]))return void k(!0);const a={summary:{question:e,answers:n.map(((e,t)=>({text:e.trim(),option:String(t),...t===I&&{correct:!0}}))),...!Z&&{isPublic:!0},...p&&{multipleChoice:!0},...E&&{quiz:!0}}};if(E){const{text:e,entities:t}=f&&(0,ao.Z)(f.substring(0,200))||{};a.quiz={correctAnswers:[String(I)],...e&&{solution:e},...t&&{solutionEntities:t}}}i(a)}),[t,m,h,E,I,Z,p,i,T,f]),R=(0,a.I4)(((e,t)=>{const n=[...h];n[e]=t,n[n.length-1].trim().length&&n.length<10?T(n):P(n)}),[h,T]),L=(0,a.I4)((e=>{const t=[...h];t.splice(e,1),P(t),void 0!==I&&(I===e?y(void 0):e<I&&y(I-1)),requestAnimationFrame((()=>{l.current&&l.current.classList.toggle("overflown",l.current.scrollHeight>320)}))}),[I,h]),F=(0,a.I4)((e=>{y(Number(e))}),[y]),x=(0,a.I4)((e=>{v(e.target.checked)}),[]),B=(0,a.I4)((e=>{g(e.target.checked)}),[]),O=(0,a.I4)((e=>{C(e.target.checked)}),[]),D=(0,a.I4)((e=>{13===e.keyCode&&A()}),[A]),U=(0,a.I4)((e=>{u(e.target.value)}),[]),_=(0,a.I4)((()=>{if(S&&!m.trim().length)return N("lng_polls_choose_question")}),[S,N,m]),G=(0,a.I4)((e=>{const t=h.map((e=>e.trim())).filter((e=>e.length));if(S&&t.length<2&&!h[e].trim().length)return N("lng_polls_choose_answers")}),[S,N,h]);function j(){return h.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(ze.Z,{label:t!==h.length-1||10===h.length?N("OptionHint"):N("CreatePoll.AddOption"),error:G(t),value:e,onChange:e=>R(t,e.currentTarget.value),onKeyPress:D}),t!==h.length-1&&a.ZP.createElement($.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:N("Delete"),onClick:()=>L(t)},a.ZP.createElement("i",{className:"icon-close"})))))}return a.ZP.createElement(X.Z,{isOpen:t,onClose:r,header:a.ZP.createElement("div",{className:"modal-header-condensed"},a.ZP.createElement($.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:r},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},N("NewPoll")),a.ZP.createElement($.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:A},N("Create"))),className:"PollModal"},a.ZP.createElement(ze.Z,{ref:o,label:N("AskAQuestion"),value:m,error:_(),onChange:U,onKeyPress:D}),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"options-list custom-scroll",ref:l},a.ZP.createElement("h3",{className:"options-header"},N("PollOptions")),S&&function(){const e=h.map((e=>e.trim())).filter((e=>e.length));return E&&(void 0===I||!e[I])&&a.ZP.createElement("p",{className:"poll-error"},N("lng_polls_choose_correct"))}(),E?a.ZP.createElement(Ss.Z,{name:"correctOption",options:j().map(((e,t)=>({value:String(t),label:e,hidden:t===h.length-1}))),selected:String(I),onChange:F}):j()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},!s&&a.ZP.createElement(dt.Z,{label:N("PollAnonymous"),checked:Z,onChange:x}),a.ZP.createElement(dt.Z,{label:N("PollMultiple"),checked:p,disabled:E,onChange:B}),a.ZP.createElement(dt.Z,{label:N("PollQuiz"),checked:E,disabled:p||void 0!==n,onChange:O}),E&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},N("lng_polls_solution_title")),a.ZP.createElement("div",{ref:d,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>b(e.currentTarget.innerHTML)}),a.ZP.createElement("div",{className:"note"},N("CreatePoll.ExplanationInfo")))))}));var io=n(56503),ro=n(34284);const oo=(0,a.X$)((e=>{let{emoji:t,focus:n,onClick:s}=e;const i=(0,a.I4)((e=>{e.preventDefault(),s(t.native,t.id)}),[t,s]),r=(0,W.Z)("EmojiButton",n&&"focus"),o=`./img-apple-64/${t.image}.png`,l=ro.Uz.has(o);return a.ZP.createElement("div",{className:r,onMouseDown:i,title:`:${t.names[0]}:`},d.op?t.native:a.ZP.createElement("img",{src:o,className:l?void 0:"opacity-transition shown",alt:t.native,loading:"lazy","data-path":o,onLoad:l?void 0:ro.mE}))})),lo=(0,a.X$)((e=>{let{category:t,index:n,allEmojis:s,observeIntersection:i,shouldRender:r,onEmojiSelect:o}=e;const l=(0,a.sO)(null);(0,Ca._N)(l,i);const c=(0,Dt.Z)(r),u=(0,M.Z)(),P=d.wB?Math.floor((h.Z.get().width-8)/50):8,Z=50*Math.ceil(t.emojis.length/P);return a.ZP.createElement("div",{ref:l,key:t.id,id:`emoji-category-${n}`,className:"symbol-set"},a.ZP.createElement("div",{className:"symbol-set-header"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},u(t.id===m.s3?"RecentStickers":`Emoji${n}`))),a.ZP.createElement("div",{className:(0,W.Z)("symbol-set-container",c),style:`height: ${Z}px;`,dir:u.isRtl?"rtl":void 0},r&&t.emojis.map((e=>{const t=s[e];if(!t)return;const n="id"in t?t:t[1];return a.ZP.createElement(oo,{key:n.id,emoji:n,onClick:o})}))))})),co={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"},mo=[];let uo,ho,Po;const Zo=(0,a.X$)((0,i.c$)((e=>(0,$e.ei)(e,["recentEmojis"])))((e=>{let{className:t,recentEmojis:s,onEmojiSelect:i}=e;const r=(0,a.sO)(null),o=(0,a.sO)(null),[l,c]=(0,a.eJ)(),[u,h]=(0,a.eJ)(),[P,Z]=(0,a.eJ)(0),{observe:v}=(0,Ca.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-",""));mo[n]=e.isIntersecting}));const t=mo.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&Z(t[Math.floor(t.length/2)].index)}));(0,na.Z)(o.current,!d.wB),(0,a.d4)((()=>{if(!l)return;const e=o.current;if(!e)return;const t=42*P-e.offsetWidth/2+21;(0,Tt.Z)(e,t)}),[l,P]);const p=(0,M.Z)(),g=(0,a.Ye)((()=>{if(!l)return ta.D;const e=[...l];return s?.length&&e.unshift({id:m.s3,name:p("RecentStickers"),emojis:s}),e}),[l,p,s]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{c(Po.categories),h(Po.emojis)};Po?e():async function(){return uo||(uo=n.e(7501).then(n.t.bind(n,47501,19)),ho=(await uo).default,Po=(0,ro.NM)(ho)),uo}().then(e)}),200)}),[]);const E=(0,a.I4)((e=>{Z(e);const t=document.getElementById(`emoji-category-${e}`);(0,qr.Z)(r.current,t,"start",50,800)}),[]),C=(0,a.I4)(((e,t)=>{i(e,t)}),[i]),f=(0,Ea.Z)([],m.kU),b=(0,W.Z)("EmojiPicker",t);return u&&f?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=co[e.id];return n&&a.ZP.createElement($.Z,{className:"symbol-set-button "+(t===P?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>E(t),ariaLabel:e.name},a.ZP.createElement("i",{className:n}))}))),a.ZP.createElement("div",{ref:r,className:(0,W.Z)("EmojiPicker-main no-selection",d.$b?"no-scrollbar":"custom-scroll")},g.map(((e,t)=>a.ZP.createElement(lo,{category:e,index:t,allEmojis:u,observeIntersection:v,shouldRender:P>=t-1&&P<=t+1,onEmojiSelect:C}))))):a.ZP.createElement("div",{className:b},a.ZP.createElement(Ve.Z,null))}))),vo=d.wB?8:16,po=d.wB?8:10,go=(0,a.X$)((e=>{let{stickerSet:t,loadAndPlay:n,index:s,shouldRender:r,favoriteStickers:l,isSavedMessages:c,isCurrentUserPremium:u,isCustomEmojiPicker:P,observeIntersection:Z,onStickerSelect:v,onStickerUnfave:p,onStickerFave:g,onStickerRemoveRecent:E}=e;const{clearRecentStickers:C,clearRecentCustomEmoji:f,openPremiumModal:b,toggleStickerSet:y}=(0,i.Sv)(),S=(0,a.sO)(null),k=(0,a.sO)(null),N=(0,a.sO)(null),[w,T,A]=(0,I.Z)(),R=(0,M.Z)();(0,Ca._N)(S,Z);const L=(0,Dt.Z)(r),F=t.id===m.s3,x=t.id===m.k,B=t.isEmoji,O=!F&&(0,o.FW)(t),D=(0,a.I4)((()=>{B?f():C(),A()}),[f,C,A,B]),U=(0,a.I4)((()=>{O&&!u?b({initialSection:"animated_emoji"}):y({stickerSetId:t.id})}),[u,O,b,t,y]),_=!c&&!F&&B&&!u&&t.stickers?.some((e=>!e.isFree)),G=B?m.eX:m.Q,j=B?8:5,V=B?po:vo,z=d.wB?Math.floor((h.Z.get().width-8)/(G+V)):j,J=!t.installedDate&&t.id!==m.s3,[X,,H]=(0,I.Z)(J),q=3*z-1,Y=Math.ceil(Math.min(q,t.count)/z)*(G+V),K=X?Y:Math.ceil(t.count/z)*(G+V),Q=(0,a.Ye)((()=>l?new Set(l.map((e=>{let{id:t}=e;return t}))):void 0),[l]);return a.ZP.createElement("div",{ref:S,key:t.id,id:`${P?"custom-emoji-set":"sticker-set"}-${s}`,className:(0,W.Z)("symbol-set",_&&"symbol-set-locked")},a.ZP.createElement("div",{className:"symbol-set-header"},a.ZP.createElement("p",{className:"symbol-set-name"},_&&a.ZP.createElement("i",{className:"symbol-set-locked-icon icon-lock-badge"}),t.title),F&&a.ZP.createElement("i",{className:"symbol-set-remove icon-close",onClick:T}),!F&&B&&!t.installedDate&&a.ZP.createElement($.Z,{className:"symbol-set-add-button",withPremiumGradient:O&&!u,onClick:U,pill:!0,size:"tiny",fluid:!0},R(O&&_?"Unlock":"Add"))),a.ZP.createElement("div",{className:(0,W.Z)("symbol-set-container shared-canvas-container",L),style:`height: ${K}px;`},a.ZP.createElement("canvas",{ref:k,className:"shared-canvas",style:J?`height: ${Y}px;`:void 0}),(F||x||J)&&a.ZP.createElement("canvas",{ref:N,className:"shared-canvas"}),r&&t.stickers&&t.stickers.slice(0,X?q:t.stickers.length).map(((e,t)=>{const s=(F||x)&&(0,o.Si)((0,i.Rd)(),e.stickerSetInfo),r=J&&t>=q||s?N:k;return a.ZP.createElement(Ai.Z,{key:e.id,sticker:e,size:G,observeIntersection:Z,noAnimate:!n,isSavedMessages:c,canViewSet:!0,isCurrentUserPremium:u,sharedCanvasRef:r,onClick:v,clickArg:e,onUnfaveClick:x&&Q?.has(e.id)?p:void 0,onFaveClick:Q?.has(e.id)?void 0:g,onRemoveRecentClick:F?E:void 0})})),X&&t.count>q&&a.ZP.createElement($.Z,{className:"StickerButton custom-emoji set-expand",round:!0,color:"translucent",onClick:H},"+",t.count-q)),F&&a.ZP.createElement(lt.Z,{text:R("ClearRecentStickersAlertMessage"),isOpen:w,onClose:A,confirmHandler:D,confirmIsDestructive:!0}))})),Eo=[],Co=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{setsById:a}=e.stickers,s=(0,o.FM)(e,n),i=Object.values((0,$e.q0)(e.customEmojis.byId,e.recentCustomEmojis));return{stickerSetsById:a,addedCustomEmojiIds:e.customEmojis.added.setIds,canAnimate:e.settings.byKey.shouldLoopStickers,isSavedMessages:s,isCurrentUserPremium:(0,o.wV)(e),recentCustomEmoji:i,featuredCustomEmojiIds:e.customEmojis.featuredIds}}))((e=>{let{className:t,loadAndPlay:n,addedCustomEmojiIds:s,recentCustomEmoji:r,stickerSetsById:l,featuredCustomEmojiIds:c,canAnimate:u,isSavedMessages:h,isCurrentUserPremium:P,onCustomEmojiSelect:Z}=e;const v=(0,a.sO)(null),p=(0,a.sO)(null),g=(0,a.sO)(null),E=(0,a.sO)(null),[C,f]=(0,a.eJ)(0),{observe:b}=(0,Ca.S1)({rootRef:v,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("custom-emoji-set-"))return;const n=Number(t.replace("custom-emoji-set-",""));Eo[n]=e.isIntersecting}));const t=Eo.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&f(t[Math.floor(t.length/2)].index)})),{observe:I}=(0,Ca.S1)({rootRef:p}),y=(0,M.Z)(),S=Boolean(s),k=(0,a.Ye)((()=>{if(!s)return ta.D;const e=[];r.length&&e.push({id:m.s3,title:y("RecentStickers"),stickers:r,count:r.length,isEmoji:!0});const t=Object.values((0,$e.q0)(l,s)),n=c?.filter((e=>!s.includes(e)))||[],a=Object.values((0,$e.q0)(l,n));return[...e,...t,...a]}),[s,c,y,r,l]),N=(0,a.Ye)((()=>S&&0===k.filter((e=>e.stickers?.length)).length),[k,S]);(0,na.Z)(p.current),(0,a.d4)((()=>{if(!S)return;const e=p.current;if(!e)return;const t=52*C-(e.offsetWidth/2-26);(0,Tt.Z)(e,t)}),[S,C]);const w=(0,a.I4)((e=>{f(e);const t=document.getElementById(`custom-emoji-set-${e}`);(0,qr.Z)(v.current,t,"start",void 0,500)}),[]),T=(0,a.I4)((e=>{Z(e)}),[Z]),A=(0,Ea.Z)([],m.Y),R=(0,W.Z)("StickerPicker","CustomEmojiPicker",t);return S&&A&&!N?a.ZP.createElement("div",{className:R},a.ZP.createElement("div",{ref:p,className:"StickerPicker-header no-selection no-scrollbar"},a.ZP.createElement("div",{className:"shared-canvas-container"},a.ZP.createElement("canvas",{ref:g,className:"shared-canvas"}),a.ZP.createElement("canvas",{ref:E,className:"shared-canvas"}),k.map((function(e,t){const s=e.stickers?.[0],r=(0,W.Z)("symbol-set-button sticker-set-button",t===C&&"activated"),l=t<m.u,c=(0,o.Si)((0,i.Rd)(),e);return e.id===m.s3||e.id===m.k||e.id===m.dW||e.id===m.BR||e.hasThumbnail||!s?a.ZP.createElement($.Z,{key:e.id,className:r,ariaLabel:e.title,round:!0,faded:e.id===m.s3||e.id===m.k,color:"translucent",onClick:()=>w(t)},e.id===m.s3?a.ZP.createElement("i",{className:"icon-recent"}):a.ZP.createElement(Ti,{stickerSet:e,noAnimate:!u||!n,observeIntersection:I,sharedCanvasRef:l?c?E:g:void 0})):a.ZP.createElement(Ai.Z,{key:e.id,sticker:s,size:m.DC,title:e.title,className:r,noAnimate:!u||!n,observeIntersection:I,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:l?c?E:g:void 0,onClick:w,clickArg:t})})))),a.ZP.createElement("div",{ref:v,className:(0,W.Z)("StickerPicker-main no-selection",d.$b?"no-scrollbar":"custom-scroll")},k.map(((e,t)=>a.ZP.createElement(go,{key:e.id,stickerSet:e,loadAndPlay:Boolean(u&&n),index:t,observeIntersection:b,shouldRender:C>=t-1&&C<=t+1,isSavedMessages:h,isCustomEmojiPicker:!0,isCurrentUserPremium:P,onStickerSelect:T}))))):a.ZP.createElement("div",{className:R},N?a.ZP.createElement("div",{className:"picker-disabled"},y("NoStickers")):a.ZP.createElement(Ve.Z,null))})));var fo=n(56389);const bo=[],Io=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{setsById:a,added:s,recent:i,favorite:r,premiumSet:l}=e.stickers,c=(0,o.FM)(e,n);return{chat:(0,o.Z1)(e,n),recentStickers:i.stickers,favoriteStickers:r.stickers,premiumStickers:l.stickers,stickerSetsById:a,addedSetIds:s.setIds,canAnimate:e.settings.byKey.shouldLoopStickers,isSavedMessages:c,isCurrentUserPremium:(0,o.wV)(e)}}))((e=>{let{chat:t,threadId:n,className:s,loadAndPlay:r,canSendStickers:o,recentStickers:l,favoriteStickers:c,premiumStickers:u,addedSetIds:h,stickerSetsById:P,canAnimate:Z,isSavedMessages:v,isCurrentUserPremium:p,onStickerSelect:g}=e;const{loadRecentStickers:E,addRecentSticker:C,unfaveSticker:f,faveSticker:b,removeRecentSticker:I}=(0,i.Sv)(),y=(0,a.sO)(null),S=(0,a.sO)(null),k=(0,a.sO)(null),[N,w]=(0,a.eJ)(0),T=(0,fo.Z)(t.id,n),{observe:A}=(0,Ca.S1)({rootRef:y,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-",""));bo[n]=e.isIntersecting}));const t=bo.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&w(t[Math.floor(t.length/2)].index)})),{observe:R}=(0,Ca.S1)({rootRef:S}),L=(0,M.Z)(),F=Boolean(h),x=(0,a.Ye)((()=>{if(!h)return ta.D;const e=[],n=Object.values((0,$e.q0)(P,h));if(c.length&&e.push({id:m.k,title:L("FavoriteStickers"),stickers:c,count:c.length}),l.length&&e.push({id:m.s3,title:L("RecentStickers"),stickers:l,count:l.length}),p){const t=n.map((e=>e.stickers?.filter((e=>e.hasEffect)))).flat().filter(Boolean),a=(0,$e.od)([...t,...u],"id");a.length&&e.push({id:m.BR,title:L("PremiumStickers"),stickers:a,count:a.length})}if(t?.fullInfo?.stickerSet){const n=P[t.fullInfo.stickerSet.id];n&&e.push({id:m.dW,title:L("GroupStickers"),stickers:n.stickers,count:n.stickers.length})}return[...e,...n]}),[h,P,c,l,p,t,L,u]),B=(0,a.Ye)((()=>F&&0===x.filter((e=>e.stickers?.length)).length),[x,F]);(0,a.d4)((()=>{r&&(E(),o&&T({type:"chooseSticker"}))}),[o,r,E,T]),(0,na.Z)(S.current),(0,a.d4)((()=>{if(!F)return;const e=S.current;if(!e)return;const t=52*N-(e.offsetWidth/2-26);(0,Tt.Z)(e,t)}),[F,N]);const O=(0,a.I4)((e=>{w(e);const t=document.getElementById(`sticker-set-${e}`);(0,qr.Z)(y.current,t,"start",void 0,500)}),[]),D=(0,a.I4)(((e,t,n)=>{g(e,t,n),C({sticker:e})}),[C,g]),U=(0,a.I4)((e=>{f({sticker:e})}),[f]),_=(0,a.I4)((e=>{b({sticker:e})}),[b]),G=(0,a.I4)((()=>{o&&T({type:"chooseSticker"})}),[o,T]),j=(0,a.I4)((e=>{I({sticker:e})}),[I]),V=(0,Ea.Z)([],m.Y),z=(0,W.Z)("StickerPicker",s);return F&&V&&!B&&o?a.ZP.createElement("div",{className:z},a.ZP.createElement("div",{ref:S,className:"StickerPicker-header no-selection no-scrollbar"},a.ZP.createElement("div",{className:"shared-canvas-container"},a.ZP.createElement("canvas",{ref:k,className:"shared-canvas"}),x.map((function(e,n){const s=e.stickers?.[0],i=(0,W.Z)("symbol-set-button sticker-set-button",n===N&&"activated"),o=n<m.u;return e.id===m.s3||e.id===m.k||e.id===m.dW||e.id===m.BR||e.hasThumbnail||!s?a.ZP.createElement($.Z,{key:e.id,className:i,ariaLabel:e.title,round:!0,faded:e.id===m.s3||e.id===m.k,color:"translucent",onClick:()=>O(n)},e.id===m.BR?a.ZP.createElement(Xa.Z,{withGradient:!0,big:!0}):e.id===m.s3?a.ZP.createElement("i",{className:"icon-recent"}):e.id===m.k?a.ZP.createElement("i",{className:"icon-favorite"}):e.id===m.dW?a.ZP.createElement(Be.Z,{chat:t,size:"small"}):a.ZP.createElement(Ti,{stickerSet:e,noAnimate:!Z||!r,observeIntersection:R,sharedCanvasRef:o?k:void 0})):a.ZP.createElement(Ai.Z,{key:e.id,sticker:s,size:m.DC,title:e.title,className:i,noAnimate:!Z||!r,observeIntersection:R,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:o?k:void 0,onClick:O,clickArg:n})})))),a.ZP.createElement("div",{ref:y,onMouseMove:G,className:(0,W.Z)("StickerPicker-main no-selection",d.$b?"no-scrollbar":"custom-scroll")},x.map(((e,t)=>a.ZP.createElement(go,{key:e.id,stickerSet:e,loadAndPlay:Boolean(Z&&r),index:t,observeIntersection:A,shouldRender:N>=t-1&&N<=t+1,favoriteStickers:c,isSavedMessages:v,isCurrentUserPremium:p,onStickerSelect:D,onStickerUnfave:U,onStickerFave:_,onStickerRemoveRecent:j}))))):a.ZP.createElement("div",{className:z},o?B?a.ZP.createElement("div",{className:"picker-disabled"},L("NoStickers")):a.ZP.createElement(Ve.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},L("ErrorSendRestrictedStickersAll")))})));var yo=n(30386);function So(){return So=Object.assign?Object.assign.bind():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},So.apply(this,arguments)}const ko=(0,a.X$)((e=>{let{gif:t,isDisabled:n,className:s,observeIntersection:i,onClick:r,onUnsaveClick:o,isSavedMessages:l}=e;const c=(0,a.sO)(null),m=(0,M.Z)(),u=`gif${t.id}`,h=(0,Ca.Op)(c,i)&&!n,P=(0,R.Z)(`${u}?size=m`,!h,A.IU.BlobUrl),[Z]=(0,a.eJ)(t.thumbnail?.dataUri&&!P),v=(0,Ot.Z)(t.thumbnail?.dataUri,!Z),p=(0,R.Z)(u,!h,A.IU.BlobUrl),g=Boolean(h&&p),{isBuffered:E,bufferingHandlers:C}=(0,de.Z)(!0),f=h&&!E,b=h&&E,{isContextMenuOpen:I,contextMenuPosition:y,handleBeforeContextMenu:S,handleContextMenu:k,handleContextMenuClose:N,handleContextMenuHide:w}=(0,Gr.Z)(c),T=(0,a.I4)((()=>c.current),[]),L=(0,a.I4)((()=>c.current.closest(".custom-scroll, .no-scrollbar")),[]),F=(0,a.I4)((()=>c.current.querySelector(".gif-context-menu .bubble")),[]),{positionX:x,positionY:B,transformOriginX:O,transformOriginY:D,style:U}=(0,pr.Z)(y,T,L,F),_=(0,a.I4)((()=>{!I&&r&&r({...t,blobUrl:p})}),[I,r,t,p]),G=(0,a.I4)((e=>{e.stopPropagation(),e.preventDefault(),o(t)}),[o,t]),j=(0,a.I4)((()=>{o?.(t)}),[t,o]),z=(0,a.I4)((()=>{r({...t,blobUrl:p},!0)}),[t,r,p]),J=(0,a.I4)((()=>{r({...t,blobUrl:p},void 0,!0)}),[t,r,p]),X=(0,a.I4)((e=>{(0,yo.b)(e),S(e)}),[S]);(0,a.d4)((()=>{n&&N()}),[N,n]);const H=(0,W.Z)("GifButton",t.width&&t.height&&t.width<t.height?"vertical":"horizontal",r&&"interactive",u,s);return a.ZP.createElement("div",{ref:c,className:H,onMouseDown:X,onClick:_,onContextMenu:k},!d.$b&&o&&a.ZP.createElement($.Z,{className:"gif-unsave-button",color:"dark",pill:!0,onClick:G},a.ZP.createElement("i",{className:"icon-close gif-unsave-button-icon"})),Z&&a.ZP.createElement("canvas",{ref:v,className:"thumbnail",style:b?"display: none;":void 0}),P&&!b&&a.ZP.createElement("img",{src:P,alt:"",className:"preview"}),g&&a.ZP.createElement($t.Z,So({canPlay:!0,src:p,autoPlay:!0,loop:!0,muted:!0,disablePictureInPicture:!0,playsInline:!0,preload:"none"},C)),f&&a.ZP.createElement(le.Z,{color:P||Z?"white":"black"}),r&&void 0!==y&&a.ZP.createElement(ve.Z,{isOpen:I,transformOriginX:O,transformOriginY:D,positionX:x,positionY:B,style:U,className:"gif-context-menu",autoClose:!0,onClose:N,onCloseAnimationEnd:w},!l&&a.ZP.createElement(V.Z,{onClick:z,icon:"mute"},m("SendWithoutSound")),a.ZP.createElement(V.Z,{onClick:J,icon:"calendar"},m(l?"SetReminder":"ScheduleMessage")),o&&a.ZP.createElement(V.Z,{destructive:!0,icon:"delete",onClick:j},m("Delete"))))})),No=(0,a.X$)((0,i.c$)((e=>{const{chatId:t}=(0,o.Bt)(e)||{},n=Boolean(t)&&(0,o.FM)(e,t);return{savedGifs:e.gifs.saved.gifs,isSavedMessages:n}}))((e=>{let{className:t,loadAndPlay:n,canSendGifs:s,savedGifs:r,isSavedMessages:o,onGifSelect:l}=e;const{loadSavedGifs:c,saveGif:u}=(0,i.Sv)(),h=(0,a.sO)(null),{observe:P}=(0,Ca.S1)({rootRef:h,debounceMs:300});(0,a.d4)((()=>{n&&c()}),[n,c]);const Z=(0,a.I4)((e=>{u({gif:e,shouldUnsave:!0})}),[u]),v=(0,Ea.Z)([],m.Y);return a.ZP.createElement("div",{ref:h,className:(0,W.Z)("GifPicker",t,d.$b?"no-scrollbar":"custom-scroll")},s?v&&r&&r.length?r.map((e=>a.ZP.createElement(ko,{key:e.id,gif:e,observeIntersection:P,isDisabled:!n,onClick:s?l:void 0,onUnsaveClick:Z,isSavedMessages:o}))):v&&r?a.ZP.createElement("div",{className:"picker-disabled"},"No saved GIFs."):a.ZP.createElement(Ve.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))})));let wo;!function(e){e[e.Emoji=0]="Emoji",e[e.CustomEmoji=1]="CustomEmoji",e[e.Stickers=2]="Stickers",e[e.GIFs=3]="GIFs"}(wo||(wo={}));const Mo={[wo.Emoji]:"Emoji",[wo.CustomEmoji]:"StickersList.EmojiItem",[wo.Stickers]:"AccDescrStickers",[wo.GIFs]:"GifsTab"},To={[wo.Emoji]:"icon-smile",[wo.CustomEmoji]:"icon-favorite",[wo.Stickers]:"icon-stickers",[wo.GIFs]:"icon-gifs"},Ao=(0,a.X$)((e=>{let{activeTab:t,onSwitchTab:n,onRemoveSymbol:s,onSearchOpen:i}=e;const r=(0,M.Z)();function o(e){return a.ZP.createElement($.Z,{className:"symbol-tab-button "+(t===e?"activated":""),onClick:()=>n(e),ariaLabel:r(Mo[e]),round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:To[e]}))}const l=(0,a.I4)((()=>{i(t===wo.Stickers?"stickers":"gifs")}),[t,i]);return a.ZP.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0},t!==wo.Emoji&&t!==wo.CustomEmoji&&a.ZP.createElement($.Z,{className:"symbol-search-button",ariaLabel:t===wo.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:l},a.ZP.createElement("i",{className:"icon-search"})),o(wo.Emoji),o(wo.CustomEmoji),o(wo.Stickers),o(wo.GIFs),(t===wo.Emoji||t===wo.CustomEmoji)&&a.ZP.createElement($.Z,{className:"symbol-delete-button",onClick:s,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:"icon-delete-left"})))}));let Ro=!1;const Lo=(0,a.X$)((0,i.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown,isCurrentUserPremium:(0,o.wV)(e),lastSyncTime:e.lastSyncTime})))((e=>{let{chatId:t,threadId:n,isOpen:s,canSendStickers:r,canSendGifs:o,isLeftColumnShown:l,isCurrentUserPremium:c,lastSyncTime:m,onLoad:u,onClose:h,onEmojiSelect:P,onCustomEmojiSelect:Z,onStickerSelect:v,onGifSelect:p,onRemoveSymbol:g,onSearchOpen:E,addRecentEmoji:C,addRecentCustomEmoji:f}=e;const{loadPremiumSetStickers:b,loadFeaturedEmojiStickers:I}=(0,i.Sv)(),[y,S]=(0,a.eJ)(0),[k,N]=(0,a.eJ)([]),[w,T]=(0,a.eJ)([]),[A,R]=(0,io.Z)(s,h,void 0,d.wB),{shouldRender:L,transitionClassNames:F}=(0,me.Z)(s,h,!1,!1);!Ro&&s&&(Ro=!0),(0,a.d4)((()=>{u()}),[u]),(0,a.d4)((()=>{m&&(c&&b(),I())}),[c,m,I,b]),(0,a.bt)((()=>{if(d.wB)return s&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{s&&(0,te.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[s]);const x=(0,a.sO)(k);x.current=k,(0,a.d4)((()=>{x.current.length&&!s&&(x.current.forEach((e=>{C({emoji:e})})),N([]))}),[s,C]);const B=(0,a.I4)(((e,t)=>{N((e=>[...e,t])),P(e)}),[P]),O=(0,a.sO)(w);O.current=w,(0,a.d4)((()=>{O.current.length&&!s&&(O.current.forEach((e=>{f({documentId:e})})),N([]))}),[s,f]);const D=(0,a.I4)((e=>{T((t=>[...t,e.id])),Z(e)}),[Z]),U=(0,a.I4)((e=>{h(),E(e)}),[h,E]),_=(0,a.I4)(((e,t,n)=>{v(e,t,n,!0)}),[v]),j=(0,M.Z)();function V(e,i){switch(y){case wo.Emoji:return a.ZP.createElement(Zo,{className:"picker-tab",onEmojiSelect:B});case wo.CustomEmoji:return a.ZP.createElement(Co,{className:"picker-tab",loadAndPlay:s&&(e||i),onCustomEmojiSelect:D,chatId:t});case wo.Stickers:return a.ZP.createElement(Io,{className:"picker-tab",loadAndPlay:!!r&&s&&(e||i),canSendStickers:r,onStickerSelect:_,chatId:t,threadId:n});case wo.GIFs:return a.ZP.createElement(No,{className:"picker-tab",loadAndPlay:!!o&&s&&(e||i),canSendGifs:o,onGifSelect:p})}}const z=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},Ro&&a.ZP.createElement(G.Z,{name:"slide",activeKey:y,renderCount:Object.values(Mo).length},V)),d.wB&&a.ZP.createElement($.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:j("Close"),className:"symbol-close-button",size:"tiny",onClick:h},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Ao,{activeTab:y,onSwitchTab:S,onRemoveSymbol:g,onSearchOpen:U}));if(d.wB){if(!L)return;const e=(0,W.Z)("SymbolMenu mobile-menu",F,l&&"left-column-open");return a.ZP.createElement(Rr.Z,null,a.ZP.createElement("div",{className:e},z))}return a.ZP.createElement(ve.Z,{isOpen:s,positionX:"left",positionY:"bottom",onClose:h,className:"SymbolMenu",onCloseAnimationEnd:h,onMouseEnter:d.$b?void 0:A,onMouseLeave:d.$b?void 0:R,noCloseOnBackdrop:!d.$b,noCompact:!0},z)}))),Fo=(0,a.X$)((e=>{let{withAvatar:t,focus:n,botCommand:s,bot:i,onClick:r}=e;return a.ZP.createElement(Xe.Z,{key:s.command,className:(0,W.Z)("BotCommand chat-item-clickable scroll-item",t&&"with-avatar"),multiline:!0,onClick:()=>r(s),focus:n},t&&a.ZP.createElement(Be.Z,{size:"small",user:i}),a.ZP.createElement("div",{className:"content-inner"},a.ZP.createElement("span",{className:"title"},"/",s.command),a.ZP.createElement("span",{className:"subtitle"},(0,J.Z)(s.description))))})),xo=(0,a.X$)((0,i.c$)((e=>({usersById:e.users.byId})))((e=>{let{usersById:t,isOpen:n,withUsername:s,botCommands:r,onClick:o,onClose:l}=e;const{sendBotCommand:c}=(0,i.Sv)(),d=(0,a.sO)(null),{shouldRender:m,transitionClassNames:u}=(0,me.Z)(n,void 0,void 0,!1),h=(0,a.I4)((e=>{let{botId:n,command:a}=e;const i=t[n];c({command:`/${a}${s&&i?`@${i.usernames[0].username}`:""}`,botId:n}),o()}),[o,c,t,s]),P=Kr({isActive:n,items:r,onSelect:h,onClose:l});(0,a.d4)((()=>{r&&!r.length&&l()}),[r,l]),(0,a.d4)((()=>{Yr(".chat-item-clickable",P,d)}),[P]);const Z=(0,T.Z)(r&&r.length?r:void 0,m),v=r&&!r.length?Z:r;if(!m||v&&!v.length)return;const p=(0,W.Z)("BotCommandTooltip composer-tooltip custom-scroll",u);return a.ZP.createElement("div",{className:p,ref:d},v&&v.map(((e,n)=>a.ZP.createElement(Fo,{key:`${e.botId}_${e.command}`,botCommand:e,bot:t[e.botId],withAvatar:!0,onClick:h,focus:P===n}))))}))),Bo=(0,a.X$)((e=>{let{isOpen:t,botCommands:n,onClose:s}=e;const{sendBotCommand:r}=(0,i.Sv)(),[o,l]=(0,io.Z)(t,s,void 0,d.wB),c=(0,a.I4)((e=>{r({command:`/${e.command}`,botId:e.botId}),s()}),[s,r]);return a.ZP.createElement(ve.Z,{isOpen:t,positionX:"left",positionY:"bottom",onClose:s,className:"BotCommandMenu",onCloseAnimationEnd:s,onMouseEnter:d.$b?void 0:o,onMouseLeave:d.$b?void 0:l,noCloseOnBackdrop:!d.$b,noCompact:!0},n.map((e=>a.ZP.createElement(Fo,{key:e.command,botCommand:e,onClick:c}))))})),Oo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{stickers:a}=e.stickers.forEmoji;return{stickers:a,isSavedMessages:(0,o.FM)(e,n),isCurrentUserPremium:(0,o.wV)(e)}}))((e=>{let{chatId:t,threadId:n,isOpen:s,stickers:r,isSavedMessages:o,onStickerSelect:l,isCurrentUserPremium:d}=e;const{clearStickersForEmoji:u}=(0,i.Sv)(),h=(0,a.sO)(null),{shouldRender:P,transitionClassNames:Z}=(0,me.Z)(s,void 0,void 0,!1),v=(0,T.Z)(r,!0),p=r||v,g=(0,fo.Z)(t,n),{observe:E}=(0,Ca.S1)({rootRef:h,throttleMs:200});(0,a.d4)((()=>s?(0,c.Z)(u):void 0),[s,u]);const C=(0,W.Z)("StickerTooltip composer-tooltip custom-scroll",Z,!p?.length&&"hidden");return a.ZP.createElement("div",{ref:h,className:C,onMouseMove:()=>{g({type:"chooseSticker"})}},P&&p?p.map((e=>a.ZP.createElement(Ai.Z,{key:e.id,sticker:e,size:m.Q,observeIntersection:E,onClick:s?l:void 0,clickArg:e,isSavedMessages:o,canViewSet:!0,isCurrentUserPremium:d}))):P?a.ZP.createElement(Ve.Z,null):void 0)}))),Do={root:"o7fHB9vMHP_k5l9rZC2R",emojiButton:"LzdBMbvLbmND0s2zfaff"},Uo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{stickers:a}=e.customEmojis.forEmoji;return{customEmoji:a,isSavedMessages:(0,o.FM)(e,n),isCurrentUserPremium:(0,o.wV)(e)}}))((e=>{let{isOpen:t,customEmoji:n,isSavedMessages:s,isCurrentUserPremium:r,onCustomEmojiSelect:o,addRecentCustomEmoji:l}=e;const{clearCustomEmojiForEmoji:d}=(0,i.Sv)(),u=(0,a.sO)(null),{shouldRender:h,transitionClassNames:P}=(0,me.Z)(t,void 0,void 0,!1),Z=(0,T.Z)(n,!0),v=n||Z;(0,na.Z)(u.current);const{observe:p}=(0,Ca.S1)({rootRef:u,throttleMs:200});(0,a.d4)((()=>t?(0,c.Z)(d):void 0),[t,d]);const g=(0,a.I4)((e=>{t&&(o(e),l({documentId:e.id}),d())}),[l,d,t,o]),E=(0,W.Z)(Do.root,"composer-tooltip custom-scroll-x",P,!v?.length&&Do.hidden);return a.ZP.createElement("div",{ref:u,className:E},h&&v?v.map((e=>a.ZP.createElement(Ai.Z,{key:e.id,sticker:e,className:Do.emojiButton,size:m.Nj,observeIntersection:p,onClick:g,clickArg:e,isSavedMessages:s,canViewSet:!0,isCurrentUserPremium:r}))):h?a.ZP.createElement(Ve.Z,null):void 0)}))),$o=(0,a.X$)((e=>{let{isOpen:t,isOpenToBottom:n=!1,isSavedMessages:s,onSendSilent:i,onSendSchedule:r,onClose:o,onCloseAnimationEnd:l}=e;const[c,m]=(0,io.Z)(t,o),u=(0,M.Z)();return a.ZP.createElement(ve.Z,{isOpen:t,autoClose:!0,positionX:"right",positionY:n?"top":"bottom",className:"CustomSendMenu",onClose:o,onCloseAnimationEnd:l,onMouseEnter:d.$b?void 0:c,onMouseLeave:d.$b?void 0:m,noCloseOnBackdrop:!d.$b},i&&a.ZP.createElement(V.Z,{icon:"mute",onClick:i},u("SendWithoutSound")),r&&a.ZP.createElement(V.Z,{icon:"schedule",onClick:r},u(s?"SetReminder":"ScheduleMessage")))}));var _o=n(12420),Go=n(72087),jo=n(52678),Vo=n(34358);const zo=(0,a.X$)((e=>{let{emoji:t,focus:n,onClick:s}=e;const i=(0,a.I4)((e=>{e.preventDefault(),s?.(t)}),[t,s]),r=(0,W.Z)("EmojiButton",n&&"focus");return a.ZP.createElement("div",{className:r,onMouseDown:i,title:t.emoji},a.ZP.createElement(Vo.Z,{documentId:t.id,size:32,withSharedAnimation:!0,shouldPreloadPreview:!0}))})),Jo=(0,a.X$)((e=>{let{isOpen:t,emojis:n,customEmojis:s,onClose:i,onEmojiSelect:r,onCustomEmojiSelect:o,addRecentEmoji:l,addRecentCustomEmoji:c}=e;const d=(0,a.sO)(null),{shouldRender:m,transitionClassNames:u}=(0,me.Z)(t,void 0,void 0,!1),h=(0,jo.Z)(n.length?[...s,...n]:void 0,350)||[];(0,na.Z)(d.current);const P=(0,a.I4)((e=>{r(e.native),l({emoji:e.id})}),[l,r]),Z=(0,a.I4)((e=>{o(e),c({documentId:e.id})}),[c,o]),v=(0,a.I4)((e=>{"native"in e?P(e):Z(e)}),[Z,P]),p=(0,a.I4)(((e,t)=>{r(e),l({emoji:t})}),[l,r]),g=(0,a.I4)((e=>{o(e),c({documentId:e.id})}),[c,o]),E=Kr({isActive:t,isHorizontal:!0,items:h,onSelect:v,onClose:i});(0,a.d4)((()=>{!function(e,t){const n=t.current;if(!n)return;const{visibleIndexes:a,allElements:s}=Xr(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const i=a[0];if(!a.includes(e)||e===i&&!Hr(n,s[i],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,Tt.Z)(n,t)}}(E,d)}),[E]);const C=(0,W.Z)("EmojiTooltip composer-tooltip custom-scroll-x",u);return a.ZP.createElement("div",{ref:d,className:C},m&&h?h.map(((e,t)=>"native"in e?a.ZP.createElement(oo,{key:e.id,emoji:e,focus:E===t,onClick:p}):a.ZP.createElement(zo,{key:e.id,emoji:e,focus:E===t,onClick:g}))):m?a.ZP.createElement(Ve.Z,null):void 0)})),Xo=(0,a.X$)((e=>{let t,{title:n,description:s,thumbnail:i,thumbUrl:r,focus:o,transitionClassNames:l="",onClick:c}=e;const d=(0,R.Z)(i?`webDocument:${i.url}`:void 0);return r=r||d,r?t=a.ZP.createElement("img",{src:r,className:l,alt:"",decoding:"async",draggable:!1}):n&&(t=(0,Pe.Xv)(n,1)),a.ZP.createElement(Xe.Z,{focus:o,className:"BaseResult chat-item-clickable",onMouseDown:yo.b,onClick:c},a.ZP.createElement("span",{className:"thumb"},"string"==typeof t?(0,J.Z)(t):t),a.ZP.createElement("div",{className:"content-inner"},n&&a.ZP.createElement("div",{className:"title"},n),s&&a.ZP.createElement("div",{className:"description"},s)))})),Ho=(0,a.X$)((e=>{let t,n,s,{focus:i,isForGallery:r,inlineResult:o,onClick:l}=e;"photo"in o&&(t=o.photo),"thumbnail"in o&&(n=o.thumbnail),"webThumbnail"in o&&r&&(s=o.webThumbnail);const c=(0,R.Z)(s?`webDocument:${s.url}`:void 0),d=(0,R.Z)(t&&`photo${t.id}?size=m`),m=(0,Dt.Z)(d),u=(0,a.I4)((()=>{l(o)}),[o,l]);if(r)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:u},a.ZP.createElement("img",{src:t?.thumbnail?.dataUri||c,alt:""}),a.ZP.createElement("img",{src:d,className:(0,W.Z)("full-media",m),alt:""}));const{title:h,description:P}=o;return a.ZP.createElement(Xo,{focus:i,thumbUrl:d||n?.dataUri||c,transitionClassNames:m,title:h,description:P,onClick:u})})),qo=(0,a.X$)((e=>{let{focus:t,inlineResult:n,onClick:s}=e;const{title:i,url:r,description:o,webThumbnail:l}=n,c=(0,a.I4)((()=>{s(n)}),[n,s]);return a.ZP.createElement(Xo,{focus:t,thumbnail:l,title:i||r,description:o,onClick:c})})),Yo=(0,a.X$)((e=>{let{inlineResult:t,isSavedMessages:n,canSendGifs:s,observeIntersection:i,onClick:r}=e;const{gif:o}=t,l=(0,a.I4)(((e,n,a)=>{r(t,n,a)}),[t,r]);if(o)return a.ZP.createElement(ko,{gif:o,observeIntersection:i,className:"chat-item-clickable",onClick:s?l:void 0,isSavedMessages:n})})),Ko=(0,a.X$)((e=>{let{inlineResult:t,isSavedMessages:n,observeIntersection:s,onClick:i,isCurrentUserPremium:r}=e;const{sticker:o}=t;if(o)return a.ZP.createElement(Ai.Z,{sticker:o,size:m.zq,observeIntersection:s,title:o.emoji,className:"chat-item-clickable",onClick:i,clickArg:t,isSavedMessages:n,canViewSet:!0,isCurrentUserPremium:r})})),Wo=(0,te.P2)((e=>e()),500,!0),Qo=(0,a.X$)((e=>{let{isOpen:t,botId:n,isGallery:r,inlineBotResults:o,switchPm:l,isSavedMessages:c,canSendGifs:m,loadMore:u,onClose:h,onSelectResult:P,isCurrentUserPremium:Z}=e;const{openChat:v,startBot:p}=(0,i.Sv)(),g=(0,a.sO)(null),{shouldRender:E,transitionClassNames:C}=(0,me.Z)(t,void 0,void 0,!1),f=(0,Ke.Z)(r,E),{observe:b}=(0,Ca.S1)({rootRef:g,debounceMs:200,isDisabled:!t}),I=(0,a.I4)((e=>{let{direction:t}=e;t===s.Uq.Backwards&&Wo(u)}),[u]),y=Kr({isActive:t,shouldRemoveSelectionOnReset:f,noArrowNavigation:f,items:o,onSelect:P,onClose:h});(0,a.d4)((()=>{Yr(".chat-item-clickable",y,g)}),[y]);const S=(0,a.I4)((()=>{v({id:n}),p({botId:n,param:l.startParam})}),[n,v,p,l]),k=(0,T.Z)(o?.length?o:void 0,E),N=o?.length?o:k;if(!E||!N?.length&&!l)return;const w=(0,W.Z)("InlineBotTooltip composer-tooltip",d.$b?"no-scrollbar":"custom-scroll",f&&"gallery",C);return a.ZP.createElement(Je.Z,{ref:g,className:w,items:N,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:I,sensitiveArea:160},l&&a.ZP.createElement(Xe.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:S},a.ZP.createElement("span",{className:"title"},l.text)),N?.length&&N.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(Yo,{key:e.id,inlineResult:e,observeIntersection:b,onClick:P,isSavedMessages:c,canSendGifs:m});case"photo":return a.ZP.createElement(Ho,{key:e.id,isForGallery:f,inlineResult:e,onClick:P});case"sticker":return a.ZP.createElement(Ko,{key:e.id,inlineResult:e,observeIntersection:b,onClick:P,isSavedMessages:c,isCurrentUserPremium:Z});case"video":case"file":case"game":return a.ZP.createElement(Ho,{key:e.id,focus:y===t,inlineResult:e,onClick:P});case"article":case"audio":return a.ZP.createElement(qo,{key:e.id,focus:y===t,inlineResult:e,onClick:P});default:return}})))})),el=(0,a.X$)((e=>{let{isOpen:t,chatId:n,selectedSendAsId:s,sendAsPeerIds:o,isCurrentUserPremium:l,onClose:c}=e;const{saveDefaultSendAs:m,showNotification:u,openPremiumModal:h}=(0,i.Sv)(),P=(0,i.Rd)().users.byId,Z=(0,i.Rd)().chats.byId,v=(0,M.Z)(),p=(0,a.sO)(null),[g,E,C]=(0,io.Z)(t,c,void 0);(0,a.d4)((()=>{t&&C()}),[t,C]);const f=(0,a.I4)((e=>{c(),m({chatId:n,sendAsId:e})}),[n,c,m]),b=Kr({isActive:t,items:o,onSelect:f,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:c});return(0,a.d4)((()=>{Yr(".chat-item-clickable",b,p)}),[b]),(0,a.d4)((()=>{o&&!o.length&&c()}),[o,c]),a.ZP.createElement(ve.Z,{isOpen:t,positionX:"left",positionY:"bottom",onClose:c,className:"SendAsMenu",onCloseAnimationEnd:c,onMouseEnter:d.$b?void 0:g,onMouseLeave:d.$b?void 0:E,noCloseOnBackdrop:!d.$b,noCompact:!0},a.ZP.createElement("div",{className:"send-as-title",dir:"auto"},v("SendMessageAsTitle")),P&&Z&&o?.map(((e,t)=>{let{id:n,isPremium:i}=e;const o=(0,r.YC)(n)?P[n]:void 0,c=o?void 0:Z[n],d=o||c;return a.ZP.createElement(Xe.Z,{key:n,className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>{!i||l?f(n):u({message:v("SelectSendAsPeerPremiumHint"),actionText:v("Open"),action:()=>h()})},focus:b===t,rightElement:!l&&i&&a.ZP.createElement("i",{className:"icon-lock-badge send-as-icon-locked"})},a.ZP.createElement(Be.Z,{size:"small",user:o,chat:c,className:(0,W.Z)(s===n&&"selected")}),a.ZP.createElement("div",{className:"info"},d&&a.ZP.createElement(Yn.Z,{peer:d,noFake:!0}),a.ZP.createElement("span",{className:"subtitle"},o?v("VoipGroupPersonalAccount"):v("Subscribers",c?.membersCount,"i"))))})))}));var tl=n(76844);const nl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),s=a&&(0,o.Zw)(e,a.id);if(!a||!s)return{};const{query:i,results:r}=(0,o.n5)(e)||{},{totalCount:l,foundIds:c}=r||{};return{chat:a,messagesById:s,query:i,totalCount:l,foundIds:c,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{chatId:t,threadId:n,isActive:s,chat:l,messagesById:c,query:d,totalCount:m,foundIds:u,animationLevel:h,onClose:Z}=e;const{searchTextMessagesLocal:v,focusMessage:p}=(0,i.Sv)(),g=(0,a.sO)(null),E=(0,M.Z)();(0,ie.Z)({isActive:s,onBack:Z}),(0,a.d4)((()=>{if(s)return(0,P.l_)(),P.In}),[s]);const[C,f]=(0,_e.Z)(v,u),I=(0,a.Ye)((()=>d&&C?.length&&c?C.map((e=>{const a=c[e];if(!a)return;const s=a.senderId?(0,o.dy)((0,i.Rd)(),a.senderId):void 0;let d;if(l&&(0,r.eA)(l))d=l;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;d=e&&t?(0,o.Z1)((0,i.Rd)(),t):void 0}else d=a.senderId?(0,o.Z1)((0,i.Rd)(),a.senderId):void 0;return{message:a,senderUser:s,senderChat:d,onClick:()=>p({chatId:t,threadId:n,messageId:e})}})).filter(Boolean):ta.D),[d,C,c,l,p,t,n]),y=(0,Ge.Z)(g,!0,(e=>{const t=I?.[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0),S=C?.[0]===u?.[0];return a.ZP.createElement(Je.Z,{ref:g,className:"RightSearch custom-scroll",items:I,preloadBackwards:0,onLoadMore:f,onKeyDown:y},S&&a.ZP.createElement("p",{key:"helper-text",className:"helper-text",dir:"auto"},d?0!==m&&I.length?1===m?"1 message found":`${I.length&&(m||I.length)} messages found`:E("lng_search_no_results"):E("lng_dlg_search_for_messages")),I.map((e=>{let{message:t,senderUser:n,senderChat:s,onClick:i}=e;const r=(0,b.e)(E,t,void 0,d);return a.ZP.createElement(Xe.Z,{key:t.id,teactOrderKey:-t.date,className:"chat-item-clickable search-result-message m-0",onClick:i},a.ZP.createElement(Be.Z,{chat:s,user:n,animationLevel:h,withVideo:!0}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"search-result-message-top"},a.ZP.createElement(Yn.Z,{peer:n||s}),a.ZP.createElement(tl.Z,{message:t})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},r)))})))}))),al=(0,a.X$)((0,i.c$)(((e,t)=>{let{stickerSetId:n}=t;return{set:(0,o.Ny)(e,n),shouldPlay:(0,o.yB)(e),isCurrentUserPremium:(0,o.wV)(e)}}))((e=>{let{stickerSetId:t,observeIntersection:n,set:s,shouldPlay:r,isModalOpen:o,isCurrentUserPremium:l}=e;const{loadStickers:c,toggleStickerSet:d,openStickerSet:u}=(0,i.Sv)(),h=(0,a.sO)(null),P=(0,M.Z)(),Z=s&&Boolean(s.installedDate),v=Boolean(s?.stickers),p=(0,a.Ye)((()=>{var e;if(!s)return[];const t=(null!==(e=s.stickers?.filter((e=>{let{hasEffect:t}=e;return t})))&&void 0!==e?e:[]).slice(0,3),n=(s.covers||[]).map((e=>{let{id:t}=e;return t})),a=s.stickers?s.stickers.filter((e=>{let{id:t}=e;return!n.includes(t)})):[];return[...t,...s.covers||[],...a].slice(0,5)}),[s]);(0,a.d4)((()=>{!v&&p.length<5&&s&&c({stickerSetInfo:{shortName:s.shortName}})}),[v,p.length,c,s,t]);const g=(0,a.I4)((()=>{d({stickerSetId:t})}),[d,t]),E=(0,a.I4)((e=>{u({stickerSetInfo:e.stickerSetInfo})}),[u]);if(!s)return;const C=p.length>0;return a.ZP.createElement("div",{key:s.id,className:"sticker-set",dir:P.isRtl?"rtl":void 0},a.ZP.createElement("div",{className:"sticker-set-header"},a.ZP.createElement("div",{className:"title-wrapper"},a.ZP.createElement("h3",{className:"title",dir:"auto"},s.title),a.ZP.createElement("p",{className:"count",dir:"auto"},P("Stickers",s.count,"i"))),a.ZP.createElement($.Z,{className:Z?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:g},P(Z?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main shared-canvas-container"},a.ZP.createElement("canvas",{ref:h,className:"shared-canvas"}),!C&&a.ZP.createElement(le.Z,null),C&&p.map((e=>a.ZP.createElement(Ai.Z,{sticker:e,size:m.Y7,observeIntersection:n,noAnimate:!r||o,clickArg:e,onClick:E,noContextMenu:!0,isCurrentUserPremium:l,sharedCanvasRef:h})))))}))),sl=(0,te.P2)((e=>e()),6e4,!0),il=(0,a.X$)((0,i.c$)((e=>{const t=(0,o.y5)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a,isModalOpen:Boolean(e.openedStickerSetShortName)}}))((e=>{let{isActive:t,query:n,featuredIds:s,resultIds:r,isModalOpen:o,onClose:l}=e;const{loadFeaturedStickers:c}=(0,i.Sv)(),d=(0,a.sO)(null),m=(0,M.Z)(),{observe:u}=(0,Ca.S1)({rootRef:d,throttleMs:200});return(0,a.d4)((()=>{sl((()=>{c()}))})),(0,ie.Z)({isActive:t,onBack:l}),a.ZP.createElement("div",{ref:d,className:"StickerSearch custom-scroll",dir:m.isRtl?"rtl":void 0},function(){if(void 0!==n)return!n&&s?s.map((e=>a.ZP.createElement(al,{key:e,stickerSetId:e,observeIntersection:u,isModalOpen:o}))):r?r.length?r.map((e=>a.ZP.createElement(al,{key:e,stickerSetId:e,observeIntersection:u,isModalOpen:o}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(Ve.Z,null)}())}))),rl=(0,a.X$)((0,i.c$)((e=>{const t=(0,o.yN)(e),{query:n,results:a}=t||{},{chatId:s,threadId:i}=(0,o.Bt)(e)||{},l=s?(0,o.Z1)(e,s):void 0;return{query:n,results:a,chat:l,isChatWithBot:l?(0,o.xo)(e,l):void 0,isSavedMessages:Boolean(s)&&(0,o.FM)(e,s),canPostInChat:Boolean(l)&&Boolean(i)&&(0,r.Qm)(l,i),canScheduleUntilOnline:Boolean(s)&&(0,o.Eh)(e,s)}}))((e=>{let{isActive:t,query:n,results:s,chat:o,isChatWithBot:l,canScheduleUntilOnline:c,isSavedMessages:m,canPostInChat:u,onClose:h}=e;const{searchMoreGifs:P,sendMessage:Z,setGifSearchQuery:v}=(0,i.Sv)(),p=(0,a.sO)(null),[g,E]=(0,ir.Z)(c),{observe:C}=(0,Ca.S1)({rootRef:p,debounceMs:300}),f=u&&(0,r.H5)(o,l).canSendGifs,b=(0,a.I4)(((e,t,n)=>{f&&(n?g((n=>{Z({gif:e,scheduledAt:n,isSilent:t})})):Z({gif:e,isSilent:t})),d.$b&&v({query:void 0})}),[f,g,Z,v]),I=(0,M.Z)();(0,ie.Z)({isActive:t,onBack:h});const y=Boolean(void 0!==n&&s&&s.length);return a.ZP.createElement("div",{className:"GifSearch",dir:I.isRtl?"rtl":void 0},a.ZP.createElement(Je.Z,{ref:p,className:(0,W.Z)("gif-container custom-scroll",y&&"grid"),items:s,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:P},function(){if(void 0!==n)return s?s.length?s.map((e=>a.ZP.createElement(ko,{key:e.id,gif:e,observeIntersection:C,onClick:f?b:void 0,isSavedMessages:m}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},I("NoGIFsFound")):a.ZP.createElement(Ve.Z,null)}()),E)})));var ol=n(71226);const ll=[[{name:"followers",title:"ChannelStats.Overview.Followers"},{name:"enabledNotifications",title:"ChannelStats.Overview.EnabledNotifications",isPercentage:!0}],[{name:"viewsPerPost",title:"ChannelStats.Overview.ViewsPerPost"},{name:"sharesPerPost",title:"ChannelStats.Overview.SharesPerPost"}]],cl=[[{name:"members",title:"Stats.GroupMembers"},{name:"messages",title:"Stats.GroupMessages"}],[{name:"viewers",title:"Stats.GroupViewers"},{name:"posters",title:"Stats.GroupPosters"}]],dl=[[{name:"views",title:"Stats.Message.Views",isPlain:!0},{name:"forwards",title:"Stats.Message.PrivateShares",isPlain:!0,isApproximate:!0}],[{name:"publicForwards",title:"Stats.Message.PublicShares",isPlain:!0}]],ml=(0,a.X$)((e=>{let{isGroup:t,isMessage:n,statistics:s}=e;const i=(0,M.Z)(),{period:r}=s;return a.ZP.createElement("div",{className:"StatisticsOverview"},a.ZP.createElement("div",{className:"StatisticsOverview__header"},a.ZP.createElement("div",{className:"StatisticsOverview__title"},i("StatisticOverview")),r&&a.ZP.createElement("div",{className:"StatisticsOverview__caption"},(0,he.Tu)(i,1e3*r.minDate)," — ",(0,he.Tu)(i,1e3*r.maxDate))),a.ZP.createElement("table",{className:"StatisticsOverview__table"},(n?dl:t?cl:ll).map((e=>a.ZP.createElement("tr",null,e.map((e=>{const t=s[e.name];return e.isPlain?a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},e.isApproximate?`${(0,Pe.kh)(t)}`:(0,Pe.kh)(t)),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},i(e.title))):e.isPercentage?a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},t.percentage,"%"),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},i(e.title))):a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},(0,Pe.bi)(t.current))," ",(e=>{let{change:t,percentage:n}=e;if(!t)return;const s=Number(t)<0;return a.ZP.createElement("span",{className:(0,W.Z)("StatisticsOverview__value",s&&"negative")},s?`-${(0,Pe.bi)(Math.abs(t))}`:`+${(0,Pe.bi)(t)}`,n&&a.ZP.createElement(a.ZP.Fragment,null," ","(",n,"%)"))})(t),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},i(e.title)))})))))))})),ul=(0,a.X$)((e=>{let{message:t}=e;const n=(0,M.Z)(),{toggleMessageStatistics:s}=(0,i.Sv)(),o=(0,r.DH)(t),l=(0,R.Z)((0,r.Ti)(t,"micro")),c=Boolean((0,r.Y5)(t)),d=(0,a.I4)((()=>{s({messageId:t.id})}),[s,t.id]);return a.ZP.createElement("div",{className:(0,W.Z)("StatisticsRecentMessage",Boolean(l||o)&&"StatisticsRecentMessage--with-image"),onClick:d},a.ZP.createElement("div",{className:"StatisticsRecentMessage__title"},a.ZP.createElement("div",{className:"StatisticsRecentMessage__summary"},function(e,t,n,s){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:(0,W.Z)("media-preview__image",s&&"round")}),(0,r.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,b.e)(e,t,!0)):(0,b.e)(e,t)}(n,t,l||o,c)),a.ZP.createElement("div",{className:"StatisticsRecentMessage__meta"},n("ChannelStats.ViewsCount",t.views,"i"))),a.ZP.createElement("div",{className:"StatisticsRecentMessage__info"},a.ZP.createElement("div",{className:"StatisticsRecentMessage__date"},(0,he.SA)(1e3*t.date,n.code)),a.ZP.createElement("div",{className:"StatisticsRecentMessage__meta"},t.forwards?n("ChannelStats.SharesCount",t.forwards):"No shares")))}));let hl,Pl;const Zl={growthGraph:"ChannelStats.Graph.Growth",followersGraph:"ChannelStats.Graph.Followers",muteGraph:"ChannelStats.Graph.Notifications",topHoursGraph:"ChannelStats.Graph.ViewsByHours",viewsBySourceGraph:"ChannelStats.Graph.ViewsBySource",newFollowersBySourceGraph:"ChannelStats.Graph.NewFollowersBySource",languagesGraph:"ChannelStats.Graph.Language",interactionsGraph:"ChannelStats.Graph.Interactions"},vl=Object.keys(Zl),pl={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},gl=Object.keys(pl),El=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.aT)(e,n),s=(0,o.Z1)(e,n),i=s?.fullInfo?.statisticsDcId;return{statistics:a,dcId:i,isGroup:"chatTypeSuperGroup"===s?.type}}))((e=>{let{chatId:t,statistics:s,dcId:r,isGroup:o}=e;const l=(0,M.Z)(),c=(0,a.sO)(null),[d,m]=(0,a.eJ)(!1),u=(0,a.sO)([]),{loadStatistics:h,loadStatisticsAsyncGraph:P}=(0,i.Sv)(),Z=(0,y.Z)();(0,a.d4)((()=>{h({chatId:t,isGroup:o})}),[t,h,o]);const v=(0,a.Ye)((()=>o?gl:vl),[o]),p=(0,a.Ye)((()=>o?pl:Zl),[o]);return(0,a.d4)((()=>{s&&v.forEach((e=>{const n=s[e];"string"==typeof n&&P({name:e,chatId:t,token:n,isPercentage:"languagesGraph"===e})}))}),[v,t,s,P]),(0,a.d4)((()=>{(async()=>{await async function(){return hl||(hl=n.e(8878).then(n.bind(n,18878)),Pl=await hl),hl}(),d?s&&c.current&&(v.forEach(((e,t)=>{const n=s[e];if("string"==typeof n||u.current.includes(e))return;if(!n)return void u.current.push(e);const{zoomToken:a}=n;Pl.create(c.current.children[t],{title:l(p[e]),...a?{onZoom:e=>(0,ol.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:l("Graph.ZoomOut")}:{},...n}),u.current.push(e),c.current.children[t].classList.remove("hidden")})),Z()):m(!0)})()}),[v,p,d,s,l,t,P,r,Z]),d&&s?a.ZP.createElement("div",{className:(0,W.Z)("Statistics custom-scroll",d&&"ready")},a.ZP.createElement(ml,{statistics:s,isGroup:o}),!u.current.length&&a.ZP.createElement(Ve.Z,null),a.ZP.createElement("div",{ref:c},v.map((e=>a.ZP.createElement("div",{key:e,className:"Statistics__graph hidden"})))),Boolean(s.recentTopMessages?.length)&&a.ZP.createElement("div",{className:"Statistics__messages"},a.ZP.createElement("h2",{className:"Statistics__messages-title"},l("ChannelStats.Recent.Header")),s.recentTopMessages.map((e=>a.ZP.createElement(ul,{message:e}))))):a.ZP.createElement(Ve.Z,null)}))),Cl=(0,a.X$)((e=>{let{data:t}=e;const n=(0,M.Z)(),{openChatByUsername:s}=(0,i.Sv)(),o=(0,a.Ye)((()=>(0,r.WS)(t.chat)),[t.chat]),l=(0,a.I4)((()=>{s({username:o,messageId:t.messageId})}),[t.messageId,s,o]);return a.ZP.createElement("div",{className:"StatisticsPublicForward",onClick:l},a.ZP.createElement(Be.Z,{size:"medium",chat:t.chat}),a.ZP.createElement("div",{className:"StatisticsPublicForward__info"},a.ZP.createElement("div",{className:"StatisticsPublicForward__title"},t.title),a.ZP.createElement("div",{className:"StatisticsPublicForward__views"},n("ChannelStats.ViewsCount",t.views,"i"))))}));let fl,bl;const Il={viewsGraph:"Stats.MessageInteractionsTitle"},yl=Object.keys(Il),Sl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n)?.fullInfo?.statisticsDcId;return{statistics:e.statistics.currentMessage,dcId:a,messageId:e.statistics.currentMessageId}}))((e=>{let{chatId:t,isActive:s,statistics:r,dcId:o,messageId:l}=e;const c=(0,M.Z)(),d=(0,a.sO)(null),[m,u]=(0,a.eJ)(!1),h=(0,a.sO)([]),{loadMessageStatistics:P,loadStatisticsAsyncGraph:Z}=(0,i.Sv)(),v=(0,y.Z)();return(0,a.d4)((()=>{l&&P({chatId:t,messageId:l})}),[t,P,l]),(0,a.d4)((()=>{s&&!l||(h.current=[],u(!1))}),[s,l]),(0,a.d4)((()=>{r&&yl.forEach((e=>{const n=r[e];"string"==typeof n&&Z({name:e,chatId:t,token:n})}))}),[t,r,Z]),(0,a.d4)((()=>{(async()=>{await async function(){return fl||(fl=n.e(8878).then(n.bind(n,18878)),bl=await fl),fl}(),m?r&&d.current&&(yl.forEach(((e,t)=>{const n=r[e];if("string"==typeof n||h.current.includes(e))return;if(!n)return void h.current.push(e);const{zoomToken:a}=n;bl.create(d.current.children[t],{title:c(Il[e]),...a?{onZoom:e=>(0,ol.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:o}),zoomOutLabel:c("Graph.ZoomOut")}:{},...n}),h.current.push(e)})),v()):u(!0)})()}),[m,r,c,t,l,Z,o,v]),m&&r&&l?a.ZP.createElement("div",{className:(0,W.Z)("Statistics custom-scroll",m&&"ready")},a.ZP.createElement(ml,{statistics:r,isMessage:!0}),!h.current.length&&a.ZP.createElement(Ve.Z,null),a.ZP.createElement("div",{ref:d},yl.map((e=>a.ZP.createElement("div",{className:(0,W.Z)("Statistics__graph",!h.current.includes(e)&&"hidden")})))),Boolean(r.publicForwards)&&a.ZP.createElement("div",{className:"Statistics__public-forwards"},a.ZP.createElement("h2",{className:"Statistics__public-forwards-title"},c("Stats.Message.PublicShares")),r.publicForwardsData.map((e=>a.ZP.createElement(Cl,{data:e}))))):a.ZP.createElement(Ve.Z,null)}))),kl=(0,a.X$)((0,i.c$)(((e,t)=>{let{answer:n}=t;const{voters:a,offsets:s}=e.pollResults;return{voters:a?.[n.option],offset:s?.[n.option]||""}}))((e=>{let{chat:t,message:n,answer:s,answerVote:r,totalVoters:o,voters:l,offset:c}=e;const{loadPollOptionResults:d,openChat:m,closePollResults:u}=(0,i.Sv)(),h=(0,T.Z)(r.votersCount),[P,Z]=(0,a.eJ)(!0),v=Boolean(l),{option:p,text:g}=s,E=(0,M.Z)();(0,a.d4)((()=>{v&&h===r.votersCount||d({chat:t,messageId:n.id,option:p,offset:c,limit:4,shouldResetVoters:!0})}),[r.votersCount,v]);const C=(0,a.I4)((()=>{Z(!0),d({chat:t,messageId:n.id,option:p,offset:c,limit:50})}),[t,d,n.id,c,p]);(0,a.d4)((()=>{Z(!1)}),[l]);const f=(0,a.I4)((e=>{m({id:e}),u()}),[u,m]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},l?l.map((e=>a.ZP.createElement(Xe.Z,{key:e,className:"chat-item-clickable",onClick:()=>f(e)},a.ZP.createElement(qe.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(Ve.Z,null),l&&function(){const e=r.votersCount-l.length;return r.votersCount>4&&e>0&&a.ZP.createElement(ps,{count:e,itemName:"voter",isLoading:P,onClick:C})}()),a.ZP.createElement("div",{className:"answer-head",dir:E.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},g),a.ZP.createElement("span",{className:"answer-percent",dir:E.isRtl?"auto":void 0},(b=r.votersCount,(I=o)>0?(b/I*100).toFixed():0),"%")));var b,I}))),Nl=(0,a.X$)((0,i.c$)((e=>{const{pollResults:{chatId:t,messageId:n},lastSyncTime:a}=e;return t&&n?{chat:(0,o.Z1)(e,t),message:(0,o.hj)(e,t,n),lastSyncTime:a}:{}}))((e=>{let{onClose:t,isActive:n,chat:s,message:i,lastSyncTime:o}=e;const l=(0,M.Z)();if((0,ie.Z)({isActive:n,onBack:t}),!i||!s)return a.ZP.createElement(Ve.Z,null);const{summary:c,results:d}=(0,r.t9)(i);if(!d.results)return;const m=(0,$e.ee)(d.results,"option");return a.ZP.createElement("div",{className:"PollResults",dir:l.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"poll-question",dir:"auto"},(0,J.Z)(c.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},o&&c.answers.map((e=>a.ZP.createElement(kl,{key:`${i.id}-${e.option}`,chat:s,message:i,answer:e,answerVote:m[e.option],totalVoters:d.totalVoters}))),!o&&a.ZP.createElement(Ve.Z,null)))}))),wl="Please provide first name",Ml=(0,a.X$)((0,i.c$)(((e,t)=>{let{userId:n}=t;const a=(0,o.dy)(e,n),s=(0,o.Z1)(e,n),{progress:i}=e.management;return{user:a,progress:i,isMuted:(0,r.i4)(s,(0,o.dZ)(e),(0,o.NJ)(e))}}))((e=>{let{userId:t,user:n,progress:r,isMuted:o,onClose:l,isActive:c}=e;const{updateContact:d,deleteContact:m,closeManagement:u}=(0,i.Sv)(),[h,P,Z]=(0,I.Z)(),[v,p]=(0,a.eJ)(!1),[g,E]=(0,a.eJ)(),C=(0,M.Z)();(0,ie.Z)({isActive:c,onBack:l});const f=n&&n.firstName||"",b=n&&n.lastName||"",[y,S]=(0,a.eJ)(f),[k,N]=(0,a.eJ)(b),[w,T]=(0,a.eJ)(!o);(0,a.d4)((()=>{T(!o)}),[o]),(0,a.d4)((()=>{p(!1),Z()}),[Z,t]),(0,a.d4)((()=>{S(f),N(b)}),[f,b,n]),(0,a.d4)((()=>{r===s.wv.Complete&&(p(!1),E(void 0),Z())}),[Z,r]);const A=(0,a.I4)((e=>{S(e.target.value),p(!0)}),[]),R=(0,a.I4)((e=>{N(e.target.value),p(!0)}),[]),L=(0,a.I4)((e=>{T(e.target.checked),p(!0)}),[]),F=(0,a.I4)((()=>{const e=y.trim(),n=k.trim();e.length||E(wl),d({userId:t,isMuted:!w,firstName:e,lastName:n})}),[y,k,d,t,w]),x=(0,a.I4)((()=>{m({userId:t}),Z(),u()}),[Z,u,m,t]);if(!n)return;const B=r===s.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(qe.Z,{userId:n.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(ze.Z,{id:"user-first-name",label:C("UserInfo.FirstNamePlaceholder"),onChange:A,value:y,error:g===wl?g:void 0}),a.ZP.createElement(ze.Z,{id:"user-last-name",label:C("UserInfo.LastNamePlaceholder"),onChange:R,value:k}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(dt.Z,{checked:w,label:C("Notifications"),subLabel:C(w?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:L}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:P},C("DeleteContact")))),a.ZP.createElement(Ya.Z,{isShown:v,onClick:F,disabled:B,ariaLabel:C("Save")},B?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(lt.Z,{isOpen:h,onClose:Z,text:C("AreYouSureDeleteContact"),confirmLabel:C("DeleteContact"),confirmHandler:x,confirmIsDestructive:!0}))}))),Tl="Group title can't be empty",Al=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),{progress:s}=e.management,i=Boolean(a.fullInfo?.linkedChatId),l=(0,r.G9)(a),{invites:c}=e.management.byChatId[n]||{};return{chat:a,progress:s,isBasicGroup:l,hasLinkedChannel:i,canChangeInfo:l?a.isCreator:(0,r.VE)(a,"changeInfo"),canBanUsers:l?a.isCreator:(0,r.VE)(a,"banUsers"),canInvite:l?a.isCreator:(0,r.VE)(a,"inviteUsers"),exportedInvites:c,lastSyncTime:e.lastSyncTime,availableReactionsCount:e.availableReactions?.filter((e=>!e.isInactive)).length,isChannelsPremiumLimitReached:"channels"===e.limitReachedModal?.limit}}))((e=>{var t;let{chatId:n,chat:o,progress:l,isBasicGroup:c,hasLinkedChannel:d,canChangeInfo:m,canBanUsers:u,canInvite:h,onScreenSelect:P,onClose:Z,isActive:v,exportedInvites:p,lastSyncTime:g,availableReactionsCount:E,isChannelsPremiumLimitReached:C}=e;const{togglePreHistoryHidden:f,updateChat:b,deleteChat:y,leaveChannel:S,deleteChannel:k,closeManagement:N,openChat:w,loadExportedChatInvites:T,loadChatJoinRequests:L}=(0,i.Sv)(),[F,x,B]=(0,I.Z)(),O=o.title,D=o.fullInfo&&o.fullInfo.about||"",[U,$]=(0,a.eJ)(!1),[_,G]=(0,a.eJ)(O||""),[j,V]=(0,a.eJ)(D),[z,X]=(0,a.eJ)(),[H,q]=(0,a.eJ)(),Y=(0,r.RT)(o),K=(0,R.Z)(Y,!1,A.IU.BlobUrl),W=(0,a.Ye)((()=>d||(0,r.Sb)(o)),[o,d]),Q=(0,M.Z)(),ee=(0,a.sO)(null);(0,ie.Z)({isActive:v,onBack:Z}),(0,a.d4)((()=>{g&&h&&(T({chatId:n}),T({chatId:n,isRevoked:!0}),L({chatId:n}))}),[n,T,g,h,L]),(0,a.d4)((()=>{l===s.wv.Complete&&($(!1),q(void 0))}),[l]);const te=(0,a.I4)((()=>{P(s.u1.ChatPrivacyType)}),[P]),ne=(0,a.I4)((()=>{P(s.u1.Discussion)}),[P]),ae=(0,a.I4)((()=>{P(s.u1.Reactions)}),[P]),se=(0,a.I4)((()=>{P(s.u1.GroupPermissions)}),[P]),re=(0,a.I4)((()=>{P(s.u1.ChatAdministrators)}),[P]),oe=(0,a.I4)((()=>{P(s.u1.Invites)}),[P]),ce=(0,a.I4)((()=>{P(s.u1.JoinRequests)}),[P]),de=(0,a.I4)((e=>{X(e),$(!0)}),[]),me=(0,a.I4)((e=>{G(e.target.value),$(!0)}),[]),ue=(0,a.I4)((e=>{V(e.target.value),$(!0)}),[]),he=(0,a.I4)((()=>{const e=_.trim(),t=j.trim();e.length?b({chatId:n,title:e,about:t,photo:z}):q(Tl)}),[j,n,z,_,b]),Ze=(0,a.I4)((()=>{P(s.u1.GroupMembers)}),[P]),ve=(0,a.I4)((()=>{if(!o.fullInfo)return;const{isPreHistoryHidden:e}=o.fullInfo;f({chatId:o.id,isEnabled:!e})}),[o,f]);(0,a.d4)((()=>{if(!C)return;const e=ee.current?.querySelector("input");e.checked=!o.fullInfo?.isPreHistoryHidden}),[C,o.fullInfo?.isPreHistoryHidden]);const pe=o.fullInfo?.enabledReactions?.length||0,ge=(0,a.Ye)((()=>{if(!o.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter((e=>!o.defaultBannedRights[e])).length;const{sendStickers:t,sendGifs:n}=o.defaultBannedRights;return t||n||(e+=1),e}),[o]),Ee=(0,a.Ye)((()=>Object.keys(o.fullInfo?.adminMembersById||{}).length),[o.fullInfo?.adminMembersById]),Ce=(0,a.I4)((()=>{c?y({chatId:o.id}):o.isCreator?k({chatId:o.id}):S({chatId:o.id}),B(),N(),w({id:void 0})}),[c,o.isCreator,o.id,B,N,S,k,y,w]);if(o.isRestricted||o.isForbidden)return;const fe=l===s.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(qa.Z,{currentAvatarBlobUrl:K,onChange:de,disabled:!m}),a.ZP.createElement(ze.Z,{id:"group-title",label:Q("GroupName"),onChange:me,value:_,error:H===Tl?H:void 0,disabled:!m}),a.ZP.createElement(ts,{id:"group-about",className:"mb-2",label:Q("DescriptionPlaceholder"),maxLength:255,maxLengthIndicator:(255-j.length).toString(),onChange:ue,value:j,disabled:!m}),o.isCreator&&a.ZP.createElement(Xe.Z,{icon:"lock",multiline:!0,onClick:te},a.ZP.createElement("span",{className:"title"},Q("GroupType")),a.ZP.createElement("span",{className:"subtitle"},Q(W?"TypePublic":"TypePrivate"))),d&&a.ZP.createElement(Xe.Z,{icon:"message",multiline:!0,onClick:ne},a.ZP.createElement("span",{className:"title"},Q("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},Q("DiscussionUnlink"))),a.ZP.createElement(Xe.Z,{icon:"permissions",multiline:!0,onClick:se,disabled:!u},a.ZP.createElement("span",{className:"title"},Q("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ge,"/",8)),a.ZP.createElement(Xe.Z,{icon:"heart-outline",multiline:!0,onClick:ae,disabled:!m},a.ZP.createElement("span",{className:"title"},Q("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},pe,"/",E)),a.ZP.createElement(Xe.Z,{icon:"admin",multiline:!0,onClick:re},a.ZP.createElement("span",{className:"title"},Q("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,Pe.kh)(Ee))),h&&a.ZP.createElement(Xe.Z,{icon:"link",onClick:oe,multiline:!0,disabled:!p},a.ZP.createElement("span",{className:"title"},Q("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},p?(0,Pe.kh)(p.length):Q("Loading"))),Boolean(o.joinRequests?.length)&&a.ZP.createElement(Xe.Z,{icon:"add-user-filled",onClick:ce,multiline:!0},a.ZP.createElement("span",{className:"title"},Q("MemberRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,Pe.kh)(o.joinRequests.length)))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{icon:"group",multiline:!0,onClick:Ze},a.ZP.createElement("span",{className:"title"},Q("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,Pe.kh)(null!==(t=o.membersCount)&&void 0!==t?t:0))),!W&&o.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection",ref:ee},a.ZP.createElement(dt.Z,{checked:!o.fullInfo.isPreHistoryHidden,label:Q("ChatHistory"),onChange:ve,disabled:!u}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:x},Q("DeleteMega")))),a.ZP.createElement(Ya.Z,{isShown:U,onClick:he,disabled:fe,ariaLabel:Q("Save")},fe?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(lt.Z,{isOpen:F,onClose:B,textParts:(0,J.Z)(c||!o.isCreator?Q("AreYouSureDeleteAndExit"):Q("AreYouSureDeleteThisChatWithGroup",o.title),["br","simple_markdown"]),confirmLabel:c||!o.isCreator?Q("DeleteMega"):Q("DeleteGroupForAll"),confirmHandler:Ce,confirmIsDestructive:!0}))}))),Rl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;return{chat:(0,o.Z1)(e,n),currentUserId:e.currentUserId}}))((e=>{let{onScreenSelect:t,onChatMemberSelect:n,chat:r,currentUserId:o,onClose:l,isActive:c}=e;const{updateChatDefaultBannedRights:d}=(0,i.Sv)(),[m,u]=(0,a.eJ)({}),[h,P]=(0,a.eJ)(!1),[Z,v]=(0,a.eJ)(!1),p=(0,M.Z)();(0,ie.Z)({isActive:c,onBack:l});const g=(0,a.I4)((()=>{t(s.u1.GroupRemovedUsers)}),[t]),E=(0,a.I4)((()=>{t(s.u1.GroupUserPermissionsCreate)}),[t]),C=(0,a.I4)((e=>{n(e.userId,e.promotedByUserId===o),t(s.u1.GroupUserPermissions)}),[o,n,t]);(0,a.d4)((()=>{u(r?.defaultBannedRights||{}),P(!1),setTimeout((()=>{v(!1)}),250)}),[r]);const f=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}u((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),P(!0)}),[]),b=(0,a.I4)((()=>{r&&(v(!0),d({chatId:r.id,bannedRights:m}))}),[r,m,d]),I=(0,a.Ye)((()=>r&&r.fullInfo&&r.fullInfo.kickedMembers?r.fullInfo.kickedMembers.length:0),[r]),y=(0,a.Ye)((()=>r&&r.fullInfo&&r.fullInfo.members?r.fullInfo.members.filter((e=>{let{bannedRights:t}=e;return Boolean(t)})):[]),[r]),S=(0,a.I4)((e=>{const{bannedRights:t}=e;if(!t||!r)return;const{defaultBannedRights:n}=r;return Object.keys(t).reduce(((e,a)=>{if(!t[a]||n?.[a]||"sendInline"===a||"viewMessages"===a||"sendGames"===a)return e;const s=function(e){switch(e){case"sendMessages":return"UserRestrictionsNoSend";case"sendMedia":return"UserRestrictionsNoSendMedia";case"sendStickers":return"UserRestrictionsNoSendStickers";case"embedLinks":return"UserRestrictionsNoEmbedLinks";case"sendPolls":return"UserRestrictionsNoSendPolls";case"changeInfo":return"UserRestrictionsNoChangeInfo";case"inviteUsers":return"UserRestrictionsInviteUsers";case"pinMessages":return"UserRestrictionsPinMessages";default:return}}(a);if(!s)return e;const i=p(s);return`${e}${e.length?`, ${i}`:i}`}),"")}),[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("h3",{className:"section-heading",dir:"auto"},p("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"sendMessages",checked:!m.sendMessages,label:p("UserRestrictionsSend"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"sendMedia",checked:!m.sendMedia,label:p("UserRestrictionsSendMedia"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"sendStickers",checked:!m.sendStickers&&!m.sendGifs,label:p("UserRestrictionsSendStickers"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"sendPolls",checked:!m.sendPolls,label:p("UserRestrictionsSendPolls"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"embedLinks",checked:!m.embedLinks,label:p("UserRestrictionsEmbedLinks"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"inviteUsers",checked:!m.inviteUsers,label:p("UserRestrictionsInviteUsers"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"pinMessages",checked:!m.pinMessages,label:p("UserRestrictionsPinMessages"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!m.changeInfo,label:p("UserRestrictionsChangeInfo"),blocking:!0,onChange:f}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:g},a.ZP.createElement("span",{className:"title"},p("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},I))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},p("PrivacyExceptions")),a.ZP.createElement(Xe.Z,{icon:"add-user",onClick:E},p("ChannelAddException")),y.map((e=>a.ZP.createElement(Xe.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>C(e)},a.ZP.createElement(qe.Z,{userId:e.userId,status:S(e)})))))),a.ZP.createElement(Ya.Z,{isShown:h,onClick:b,ariaLabel:p("Save"),disabled:Z},Z?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Ll=(0,a.X$)((0,i.c$)((e=>{const{currentUserId:t}=e;return{currentUserId:t}}))((e=>{let{chat:t,currentUserId:n,isOpen:s,onClose:o}=e;const{loadMoreMembers:l,deleteChatMember:c}=(0,i.Sv)(),d=(0,M.Z)(),[m,u]=(0,a.eJ)(""),h=(0,a.Ye)((()=>{const e=(t.fullInfo?.members||[]).reduce(((e,t)=>(t.isAdmin||t.isOwner||t.userId===n||e.push(t.userId),e)),[]),a=(0,i.Rd)().users.byId;return(0,r.kK)(e,a,m)}),[t.fullInfo?.members,n,m]),P=(0,a.I4)((e=>{c({chatId:t.id,userId:e}),o()}),[t.id,c,o]);return a.ZP.createElement(Ye,{isOpen:s,chatOrUserIds:h,searchPlaceholder:d("ChannelBlockUser"),search:m,onSearchChange:u,loadMore:l,onSelectChatOrUser:P,onClose:o})}))),Fl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),{byId:s}=e.users;return{chat:a,usersById:s,canDeleteMembers:a&&((0,r.VE)(a,"banUsers")||a.isCreator),isChannel:a&&(0,r.eA)(a)}}))((e=>{let{chat:t,usersById:n,canDeleteMembers:s,isChannel:o,onClose:l,isActive:c}=e;const{updateChatMemberBannedRights:d}=(0,i.Sv)(),m=(0,M.Z)(),[u,h,P]=(0,I.Z)();(0,ie.Z)({isActive:c,onBack:l});const Z=(0,a.Ye)((()=>t&&t.fullInfo&&t.fullInfo.kickedMembers?t.fullInfo.kickedMembers:[]),[t]),v=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const t=n[e.kickedByUserId];return t?m("UserRemovedBy",(0,r.Js)(t)):void 0}),[m,n]),p=(0,a.I4)((e=>{if(t)return[{title:m("Unblock"),icon:"delete",destructive:!0,handler:()=>d({chatId:t.id,userId:e.userId,bannedRights:{}})}]}),[m,t,d]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:m.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted"},m(o?"NoBlockedChannel2":"NoBlockedGroup2")),Z.map((e=>a.ZP.createElement(Xe.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:p(e)},a.ZP.createElement(qe.Z,{userId:e.userId,status:v(e)})))),s&&a.ZP.createElement(Ya.Z,{isShown:!0,onClick:h,ariaLabel:m("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon-add-user-filled"})),t&&s&&a.ZP.createElement(Ll,{chat:t,isOpen:u,onClose:P}))))}))),xl="Channel title can't be empty",Bl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),{progress:s}=e.management,i=Boolean(a?.isSignaturesShown),{invites:l}=e.management.byChatId[n]||{};return{chat:a,progress:s,isSignaturesShown:i,canChangeInfo:(0,r.VE)(a,"changeInfo"),canInvite:(0,r.VE)(a,"inviteUsers"),lastSyncTime:e.lastSyncTime,exportedInvites:l,availableReactionsCount:e.availableReactions?.filter((e=>!e.isInactive)).length}}))((e=>{var t;let{chatId:n,chat:o,progress:l,isSignaturesShown:c,canChangeInfo:d,canInvite:m,exportedInvites:u,lastSyncTime:h,availableReactionsCount:P,onScreenSelect:Z,onClose:v,isActive:p}=e;const{updateChat:g,toggleSignatures:E,closeManagement:C,leaveChannel:f,deleteChannel:b,openChat:y,loadExportedChatInvites:S,loadChatJoinRequests:k}=(0,i.Sv)(),N=o&&o.title||"",w=o?.fullInfo&&o.fullInfo.about||"",T=o?.fullInfo?.linkedChatId,[L,F,x]=(0,I.Z)(),[B,O]=(0,a.eJ)(!1),[D,U]=(0,a.eJ)(N),[$,_]=(0,a.eJ)(w),[G,j]=(0,a.eJ)(),[V,z]=(0,a.eJ)(),J=o&&(0,r.RT)(o),X=(0,R.Z)(J,!1,A.IU.BlobUrl),H=(0,M.Z)();(0,ie.Z)({isActive:p,onBack:v}),(0,a.d4)((()=>{h&&(S({chatId:n}),S({chatId:n,isRevoked:!0}),k({chatId:n}))}),[n,S,h,k]),(0,a.d4)((()=>{l===s.wv.Complete&&(O(!1),z(void 0))}),[l]);const q=Object.keys(o.fullInfo?.adminMembersById||{}).length,Y=o?.fullInfo?.kickedMembers?.length||0,K=(0,a.I4)((()=>{Z(s.u1.ChatPrivacyType)}),[Z]),W=(0,a.I4)((()=>{Z(s.u1.Discussion)}),[Z]),Q=(0,a.I4)((()=>{Z(s.u1.Reactions)}),[Z]),ee=(0,a.I4)((()=>{Z(s.u1.ChatAdministrators)}),[Z]),te=(0,a.I4)((()=>{Z(s.u1.Invites)}),[Z]),ne=(0,a.I4)((()=>{Z(s.u1.JoinRequests)}),[Z]),ae=(0,a.I4)((e=>{j(e),O(!0)}),[]),se=(0,a.I4)((e=>{U(e.target.value),O(!0)}),[]),re=(0,a.I4)((e=>{_(e.target.value),O(!0)}),[]),oe=(0,a.I4)((()=>{const e=D.trim(),t=$.trim();e.length?g({chatId:n,title:e,about:t,photo:G}):z(xl)}),[$,n,G,D,g]),ce=(0,a.I4)((()=>{E({chatId:n,isEnabled:!c})}),[n,c,E]),de=(0,a.I4)((()=>{Z(s.u1.ChannelSubscribers)}),[Z]),me=(0,a.I4)((()=>{Z(s.u1.ChannelRemovedUsers)}),[Z]),ue=(0,a.I4)((()=>{o.isCreator?b({chatId:o.id}):f({chatId:o.id}),x(),C(),y({id:void 0})}),[o.isCreator,o.id,x,C,f,b,y]),he=o.fullInfo?.enabledReactions?.length||0,Ze=(0,a.Ye)((()=>(0,r.Sb)(o)),[o]);if(o.isRestricted||o.isForbidden)return;const ve=l===s.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(qa.Z,{currentAvatarBlobUrl:X,onChange:ae,disabled:!d}),a.ZP.createElement(ze.Z,{id:"channel-title",label:H("EnterChannelName"),onChange:se,value:D,error:V===xl?V:void 0,disabled:!d}),a.ZP.createElement(ts,{id:"channel-about",className:"mb-2",label:H("DescriptionPlaceholder"),onChange:re,value:$,maxLength:255,maxLengthIndicator:(255-$.length).toString(),disabled:!d}),o.isCreator&&a.ZP.createElement(Xe.Z,{icon:"lock",multiline:!0,onClick:K},a.ZP.createElement("span",{className:"title"},H("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},H(Ze?"TypePublic":"TypePrivate"))),a.ZP.createElement(Xe.Z,{icon:"message",multiline:!0,onClick:W,disabled:!d},a.ZP.createElement("span",{className:"title"},H("Discussion")),a.ZP.createElement("span",{className:"subtitle"},H(T?"DiscussionUnlink":"Add"))),m&&a.ZP.createElement(Xe.Z,{icon:"link",onClick:te,multiline:!0,disabled:!u},a.ZP.createElement("span",{className:"title"},H("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},u?(0,Pe.kh)(u.length):H("Loading"))),Boolean(o.joinRequests?.length)&&a.ZP.createElement(Xe.Z,{icon:"add-user-filled",onClick:ne,multiline:!0},a.ZP.createElement("span",{className:"title"},H("SubscribeRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,Pe.kh)(o.joinRequests.length))),a.ZP.createElement(Xe.Z,{icon:"heart-outline",multiline:!0,onClick:Q,disabled:!d},a.ZP.createElement("span",{className:"title"},H("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},he,"/",P)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(dt.Z,{checked:c,label:H("ChannelSignMessages"),onChange:ce}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{icon:"admin",multiline:!0,onClick:ee},a.ZP.createElement("span",{className:"title"},H("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},q)),a.ZP.createElement(Xe.Z,{icon:"group",multiline:!0,onClick:de},a.ZP.createElement("span",{className:"title",dir:"auto"},H("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},H("Subscribers",null!==(t=o.membersCount)&&void 0!==t?t:0,"i"))),a.ZP.createElement(Xe.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:me},a.ZP.createElement("span",{className:"title"},H("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},Y))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:F},o.isCreator?H("ChannelDelete"):H("LeaveChannel")))),a.ZP.createElement(Ya.Z,{isShown:B,onClick:oe,disabled:ve,ariaLabel:H("Save")},ve?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(lt.Z,{isOpen:L,onClose:x,text:o.isCreator?H("ChannelDeleteAlert"):H("ChannelLeaveAlert"),confirmLabel:o.isCreator?H("ChannelDelete"):H("LeaveChannel"),confirmHandler:ue,confirmIsDestructive:!0}))}))),Ol=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),{isUsernameAvailable:s,checkedUsername:i,error:l}=(0,o.aW)(e,n);return{chat:a,isChannel:(0,r.eA)(a),progress:e.management.progress,error:l,isUsernameAvailable:s,checkedUsername:i,isProtected:a?.isProtected,maxPublicLinks:(0,un.M)(e,"channelsPublic")}}))((e=>{let{chat:t,isActive:n,isChannel:o,progress:l,isUsernameAvailable:c,checkedUsername:d,error:u,isProtected:h,maxPublicLinks:P,onClose:Z}=e;const{updatePublicLink:v,updatePrivateLink:p,toggleIsProtected:g,openLimitReachedModal:E}=(0,i.Sv)(),C=(0,a.Ye)((()=>t.usernames?.find((e=>{let{isEditable:t}=e;return t}))),[t.usernames])?.username||"",f=(0,a.Ye)((()=>(0,r.Sb)(t)),[t]),b=t.fullInfo?.inviteLink,[y,S]=(0,a.eJ)(f?"public":"private"),[k,N]=(0,a.eJ)(),[w,A,R]=(0,I.Z)(),[L,F,x]=(0,I.Z)(),B=(0,T.Z)(c),O=Boolean("public"===y&&k&&(null!=c?c:B)||"private"===y&&f);(0,ie.Z)({isActive:n,onBack:Z}),(0,a.d4)((()=>{y&&!b&&p()}),[y,b,p]);const D=(0,a.I4)(((e,t)=>{if(Object.values((0,i.Rd)().chats.byId).filter((e=>e.isCreator&&e.usernames?.some((e=>e.isActive)))).length>=P&&"public"===e){E({limit:"channelsPublic"});const e=t.currentTarget.closest(".radio-group");return e.querySelector("[value=public]").checked=!1,void(e.querySelector("[value=private]").checked=!0)}S(e)}),[P,E]),U=(0,a.I4)((e=>{g({chatId:t.id,isProtected:"protected"===e})}),[t.id,g]),$=(0,a.I4)((()=>{f&&"private"===y?F():v({username:"public"===y?k:""})}),[f,F,y,v,k]),_=(0,a.I4)((()=>{v({username:""}),x()}),[x,v]),G=(0,a.I4)((()=>{R(),p()}),[R,p]),j=(0,M.Z)(),V=o?"Channel":"Mega",z=o?"Channel":"Group",J=[{value:"private",label:j(`${V}Private`),subLabel:j(`${V}PrivateInfo`)},{value:"public",label:j(`${V}Public`),subLabel:j(`${V}PublicInfo`)}],X=[{value:"allowed",label:j("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:j("ChannelVisibility.Forwarding.Disabled")}],H=l===s.wv.InProgress,q="public"===y&&t.usernames&&t.usernames.length>1;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:j.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},j(`${z}Type`)),a.ZP.createElement(Ss.Z,{selected:y,name:"channel-type",options:J,onChange:D})),"private"===y?a.ZP.createElement("div",{className:"section",dir:j.isRtl?"rtl":void 0},b?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement($n.Z,{url:b,className:"group-link",text:b}),a.ZP.createElement("p",{className:"section-info",dir:j.isRtl?"rtl":void 0},j(`${V}PrivateLinkHelp`)),a.ZP.createElement(Xe.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:A},j("RevokeLink")),a.ZP.createElement(lt.Z,{isOpen:w,onClose:R,text:j("RevokeAlert"),confirmLabel:j("RevokeButton"),confirmHandler:G,confirmIsDestructive:!0})):a.ZP.createElement(Ve.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(es,{asLink:!0,currentUsername:C,isLoading:H,isUsernameAvailable:c,checkedUsername:d,onChange:N}),u===m.Wf&&function(){const e=`${m.zH}${m.Ll}`;return a.ZP.createElement("p",{className:"section-info",dir:"auto"},j("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map((t=>"PURCHASE_LINK"===t?a.ZP.createElement($n.Z,{url:e,text:`@${m.Ll}`}):t)))}(),a.ZP.createElement("p",{className:"section-info",dir:"auto"},j(`${z}.Username.CreatePublicLinkHelp`))),q&&a.ZP.createElement(os,{chatId:t.id,usernames:t.usernames,onEditUsername:N}),a.ZP.createElement("div",{className:"section",dir:j.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},j(o?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")),a.ZP.createElement(Ss.Z,{selected:h?"protected":"allowed",name:"forwarding-type",options:X,onChange:U}),a.ZP.createElement("p",{className:"section-info"},j(o?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")))),a.ZP.createElement(Ya.Z,{isShown:O,disabled:H,ariaLabel:j("Save"),onClick:$},H?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(lt.Z,{isOpen:L,onClose:x,text:j("ChannelVisibility.Confirm.MakePrivate.Channel",C),confirmHandler:_,confirmIsDestructive:!0}))}))),Dl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),{forDiscussionIds:s,byId:i}=e.chats;return{chat:a,chatsByIds:i,forDiscussionIds:s,linkedChat:a?.fullInfo?.linkedChatId?(0,o.Z1)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&(0,r.eA)(a)}}))((e=>{let{chat:t,onClose:n,isActive:r,chatId:o,chatsByIds:l,linkedChat:c,forDiscussionIds:d,isChannel:u,onScreenSelect:h}=e;const{loadGroupsForDiscussion:P,linkDiscussionGroup:Z,unlinkDiscussionGroup:v,toggleJoinRequest:p,toggleJoinToSend:g}=(0,i.Sv)(),[E,C]=(0,a.eJ)(),[f,b,y]=(0,I.Z)(),[S,k,N]=(0,I.Z)(),[w,T]=(0,a.eJ)(c?.isJoinToSend),[A,R]=(0,a.eJ)(c?.isJoinRequest),L=(0,M.Z)(),F=c?.id;(0,ie.Z)({isActive:r,onBack:n}),(0,a.d4)((()=>{P()}),[P]),(0,a.d4)((()=>{r&&(T(c?.isJoinToSend||!1),R(c?.isJoinRequest||!1))}),[c,r]);const x=(0,a.I4)((()=>{y(),v({channelId:u?o:F}),u||h(s.u1.Initial)}),[y,v,u,o,F,h]),B=(0,a.I4)((()=>{N(),Z({channelId:o,chatId:E})}),[N,Z,o,E]),O=(0,a.I4)((e=>{T(e),g({chatId:F,isEnabled:e}),e||R(!1)}),[F,g]),D=(0,a.I4)((e=>{R(e),p({chatId:F,isEnabled:e})}),[F,p]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(hs.Z,{tgsUrl:Wn.l.DiscussionGroups,size:m.bM,className:"section-icon"}),c&&a.ZP.createElement("div",null,a.ZP.createElement(Xe.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(He.Z,{chatId:c.id})),a.ZP.createElement(Xe.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:b},L(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(lt.Z,{isOpen:f,onClose:y,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(Be.Z,{size:"tiny",chat:c}),a.ZP.createElement("div",{className:"modal-title"},L(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,J.Z)(L(u?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",c.title),["br","simple_markdown"]),confirmLabel:L(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:x,confirmIsDestructive:!0})),!c&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},L("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Xe.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},L("DiscussionCreateGroup")),d?d.map(((e,t)=>a.ZP.createElement(Xe.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{C(e),k()}},a.ZP.createElement(He.Z,{chatId:e})))):a.ZP.createElement(ua.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},L("DiscussionChannelHelp2")),a.ZP.createElement(lt.Z,{isOpen:S,onClose:N,header:function(){const e=l[E];if(e)return a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(Be.Z,{size:"tiny",chat:e}),a.ZP.createElement("div",{className:"modal-title"},L("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const e=l[E];if(e)return e.hasPrivateLink?(0,J.Z)(`Do you want to make **${e.title}** the discussion board for **${t.title}**?`,["br","simple_markdown"]):(0,J.Z)(`Do you want to make **${e.title}** the discussion board for **${t.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"])}(),confirmLabel:L("DiscussionLinkGroup"),confirmHandler:B,isButtonsInOneRow:!0}))),c&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading"},L("ChannelSettingsJoinTitle")),a.ZP.createElement(dt.Z,{checked:w,onCheck:O,label:L("ChannelSettingsJoinToSend")}),w&&a.ZP.createElement(dt.Z,{checked:A,onCheck:D,label:L("ChannelSettingsJoinRequest")}),a.ZP.createElement("p",{className:"text-muted"},L(w?"ChannelSettingsJoinRequestInfo":"ChannelSettingsJoinToSendInfo")))))}))),Ul=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n,isPromotedByCurrentUser:a}=t;const s=(0,o.Z1)(e,n);return{chat:s,isFormFullyDisabled:!(s.isCreator||a)}}))((e=>{let{chat:t,selectedChatMemberId:n,onScreenSelect:r,isFormFullyDisabled:o,onClose:l,isActive:c}=e;const{updateChatMemberBannedRights:d}=(0,i.Sv)(),[m,u]=(0,a.eJ)({}),[h,P]=(0,a.eJ)(!1),[Z,v]=(0,a.eJ)(!1),[p,g,E]=(0,I.Z)(),C=(0,M.Z)();(0,ie.Z)({isActive:c,onBack:l});const f=(0,a.Ye)((()=>{if(t&&t.fullInfo&&t.fullInfo.members)return t.fullInfo.members.find((e=>{let{userId:t}=e;return t===n}))}),[t,n]);(0,a.d4)((()=>{t?.fullInfo&&n&&!f&&r(s.u1.GroupPermissions)}),[t,r,f,n]),(0,a.d4)((()=>{u(f?.bannedRights||t?.defaultBannedRights||{}),P(!1),v(!1)}),[t,f]);const b=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}u((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),P(!0)}),[]),y=(0,a.I4)((()=>{t&&n&&(v(!0),d({chatId:t.id,userId:n,bannedRights:m}))}),[t,n,m,d]),S=(0,a.I4)((()=>{t&&n&&d({chatId:t.id,userId:n,bannedRights:{viewMessages:!0}})}),[t,n,d]),k=(0,a.I4)((e=>!!o||!(!t||!t.defaultBannedRights)&&t.defaultBannedRights[e]),[t,o]);if(f)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(qe.Z,{userId:f.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},C("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"sendMessages",checked:!m.sendMessages,label:C("UserRestrictionsSend"),blocking:!0,disabled:k("sendMessages"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"sendMedia",checked:!m.sendMedia,label:C("UserRestrictionsSendMedia"),blocking:!0,disabled:k("sendMedia"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"sendStickers",checked:!m.sendStickers&&!m.sendGifs,label:C("UserRestrictionsSendStickers"),blocking:!0,disabled:k("sendStickers"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"sendPolls",checked:!m.sendPolls,label:C("UserRestrictionsSendPolls"),blocking:!0,disabled:k("sendPolls"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"embedLinks",checked:!m.embedLinks,label:C("UserRestrictionsEmbedLinks"),blocking:!0,disabled:k("embedLinks"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"inviteUsers",checked:!m.inviteUsers,label:C("UserRestrictionsInviteUsers"),blocking:!0,disabled:k("inviteUsers"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"pinMessages",checked:!m.pinMessages,label:C("UserRestrictionsPinMessages"),blocking:!0,disabled:k("pinMessages"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!m.changeInfo,label:C("UserRestrictionsChangeInfo"),blocking:!0,disabled:k("changeInfo"),onChange:b}))),!o&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:g},C("UserRestrictionsBlock")))),a.ZP.createElement(Ya.Z,{isShown:h,onClick:y,ariaLabel:C("Save"),disabled:Z},Z?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(lt.Z,{isOpen:p,onClose:E,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:S,confirmIsDestructive:!0}))}))),$l=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n);return{chat:a,currentUserId:e.currentUserId,isChannel:(0,r.eA)(a)}}))((e=>{let{chat:t,isChannel:n,currentUserId:o,onScreenSelect:l,onChatMemberSelect:c,onClose:d,isActive:m}=e;const u=(0,M.Z)();(0,ie.Z)({isActive:m,onBack:d});const h=(0,a.I4)((()=>{l(s.u1.GroupRecentActions)}),[l]),P=(0,a.Ye)((()=>t.fullInfo?.adminMembersById?Object.values(t.fullInfo.adminMembersById).sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[t]),Z=(0,a.I4)((e=>{c(e.userId,e.promotedByUserId===o),l(s.u1.ChatAdminRights)}),[o,c,l]),v=(0,a.I4)((()=>{l(s.u1.GroupAddAdmins)}),[l]),p=(0,a.I4)((e=>{if(e.isOwner)return u("ChannelCreator");const t=(0,i.Rd)().users.byId,n=e.promotedByUserId?t[e.promotedByUserId]:void 0;return n?u("EditAdminPromotedBy",(0,r.Js)(n)):u("ChannelAdmin")}),[u]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{icon:"recent",multiline:!0,onClick:h},a.ZP.createElement("span",{className:"title"},u("EventLog")),a.ZP.createElement("span",{className:"subtitle"},u(n?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:u.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},n?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),P.map((e=>a.ZP.createElement(Xe.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>Z(e)},a.ZP.createElement(qe.Z,{userId:e.userId,status:p(e),forceShowSelf:!0})))),a.ZP.createElement(Ya.Z,{isShown:!0,onClick:v,ariaLabel:u("Channel.Management.AddModerator")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))))}))),_l=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;return{chat:(0,o.Z1)(e,n)}}))((e=>{let{chat:t,onClose:n,isActive:s}=e;const i=(0,M.Z)();(0,ie.Z)({isActive:s,onBack:n});const r=(0,a.Ye)((()=>t?.fullInfo?.adminMembersById?Object.values(t.fullInfo.adminMembersById).sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[t]),o=(0,a.I4)((e=>e.isOwner?i("ChannelCreator"):i("ChannelAdmin")),[i]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section not-implemented",dir:i.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(dt.Z,{name:"changeInfo",checked:!0,label:i("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterLeavingMembers"),onChange:void 0}))),a.ZP.createElement("div",{className:"section not-implemented",dir:i.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},i("Channel.Management.Title")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"changeInfo",checked:!0,label:i("EventLogAllAdmins"),onChange:void 0})),r.map((e=>a.ZP.createElement(Xe.Z,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},a.ZP.createElement(dt.Z,{label:"",checked:!0}),a.ZP.createElement(qe.Z,{userId:e.userId,status:o(e),forceShowSelf:!0})))))))}))),Gl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n,isPromotedByCurrentUser:a}=t;const s=(0,o.Z1)(e,n),{byId:i}=e.users,{currentUserId:l}=e;return{chat:s,usersById:i,currentUserId:l,isChannel:(0,r.eA)(s),isFormFullyDisabled:!(s.isCreator||a),defaultRights:s.adminRights}}))((e=>{let{isNewAdmin:t,selectedUserId:n,defaultRights:o,onScreenSelect:l,chat:c,usersById:d,currentUserId:m,isChannel:u,isFormFullyDisabled:h,onClose:P,isActive:Z}=e;const{updateChatAdmin:v}=(0,i.Sv)(),[p,g]=(0,a.eJ)({}),[E,C]=(0,a.eJ)(Boolean(t)),[f,b]=(0,a.eJ)(!1),[y,S,k]=(0,I.Z)(),[N,w]=(0,a.eJ)(""),T=(0,M.Z)();(0,ie.Z)({isActive:Z,onBack:P});const A=(0,a.Ye)((()=>{const e=n?c.fullInfo?.adminMembersById?.[n]:void 0;if(!t||!e&&n){if(t){const e=(0,i.Rd)().users.byId[n];return e?{userId:e.id,adminRights:o,customTitle:T("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return e}}),[c.fullInfo?.adminMembersById,o,t,T,n]);(0,a.d4)((()=>{c?.fullInfo&&n&&!A&&l(s.u1.ChatAdministrators)}),[c,l,A,n]),(0,a.d4)((()=>{g(A?.adminRights||{}),w((A?.customTitle||"").substr(0,16)),C(Boolean(t)),b(!1)}),[o,t,A]);const R=(0,a.I4)((e=>{const{name:t}=e.target;g((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),C(!0)}),[]),L=(0,a.I4)((()=>{n&&(b(!0),v({chatId:c.id,userId:n,adminRights:p,customTitle:N}))}),[n,v,c.id,p,N]),F=(0,a.I4)((()=>{n&&(v({chatId:c.id,userId:n,adminRights:{}}),k())}),[c.id,k,n,v]),x=(0,a.I4)((e=>!((0,r.G9)(c)||!h&&c.adminRights&&c.adminRights[e])),[c,h]),B=(0,a.Ye)((()=>{if(t||!A)return;if(A.isOwner)return T("ChannelCreator");const e=A.promotedByUserId?d[A.promotedByUserId]:void 0;return e?T("EditAdminPromotedBy",(0,r.Js)(e)):T("ChannelAdmin")}),[t,A,d,T]),O=(0,a.I4)((e=>{const{value:t}=e.target;w(t),C(!0)}),[]);if(A)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Xe.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(qe.Z,{userId:A.userId,status:B,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(dt.Z,{name:"changeInfo",checked:Boolean(p.changeInfo),label:T(u?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:x("changeInfo"),onChange:R})),u&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"postMessages",checked:Boolean(p.postMessages),label:T("EditAdminPostMessages"),blocking:!0,disabled:x("postMessages"),onChange:R})),u&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"editMessages",checked:Boolean(p.editMessages),label:T("EditAdminEditMessages"),blocking:!0,disabled:x("editMessages"),onChange:R})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"deleteMessages",checked:Boolean(p.deleteMessages),label:T(u?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:x("deleteMessages"),onChange:R})),!u&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"banUsers",checked:Boolean(p.banUsers),label:T("EditAdminBanUsers"),blocking:!0,disabled:x("banUsers"),onChange:R})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"inviteUsers",checked:Boolean(p.inviteUsers),label:T("EditAdminAddUsers"),blocking:!0,disabled:x("inviteUsers"),onChange:R})),!u&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"pinMessages",checked:Boolean(p.pinMessages),label:T("EditAdminPinMessages"),blocking:!0,disabled:x("pinMessages"),onChange:R})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"addAdmins",checked:Boolean(p.addAdmins),label:T("EditAdminAddAdmins"),blocking:!0,disabled:x("addAdmins"),onChange:R})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"manageCall",checked:Boolean(p.manageCall),label:T("StartVoipChatPermission"),blocking:!0,disabled:x("manageCall"),onChange:R})),!u&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"anonymous",checked:Boolean(p.anonymous),label:T("EditAdminSendAnonymously"),blocking:!0,disabled:x("anonymous"),onChange:R})),h&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},T("Channel.EditAdmin.CannotEdit")),!u&&a.ZP.createElement(ze.Z,{id:"admin-title",label:T("EditAdminRank"),onChange:O,value:N,disabled:h,maxLength:16}),m!==n&&!h&&!t&&a.ZP.createElement(Xe.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:S},T("EditAdminRemoveAdmin")))),a.ZP.createElement(Ya.Z,{isShown:E,onClick:L,ariaLabel:T("Save"),disabled:f},f?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),!t&&a.ZP.createElement(lt.Z,{isOpen:y,onClose:k,text:"Are you sure you want to dismiss this admin?",confirmLabel:T("Channel.Admin.Dismiss"),confirmHandler:F,confirmIsDestructive:!0}))})));var jl=n(22275);const Vl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),{statusesById:s}=e.users,i=a?.fullInfo?.members,l=a?.fullInfo?.adminMembersById,c=a&&(0,r.eA)(a),{userIds:d}=e.contactList||{},{query:m,fetchingStatus:u,globalUserIds:h,localUserIds:P}=e.userSearch;return{members:i,adminMembersById:l,userStatusesById:s,isChannel:c,localContactIds:d,searchQuery:m,isSearching:u,globalUserIds:h,localUserIds:P,canDeleteMembers:a&&(a.isCreator||(0,r.VE)(a,"banUsers")),serverTimeOffset:e.serverTimeOffset,currentUserId:e.currentUserId}}))((e=>{let{noAdmins:t,members:n,adminMembersById:o,userStatusesById:l,isChannel:c,isActive:d,globalUserIds:m,localContactIds:u,localUserIds:h,isSearching:P,searchQuery:Z,serverTimeOffset:v,currentUserId:p,canDeleteMembers:g,onClose:E,onScreenSelect:C,onChatMemberSelect:f}=e;const{openChat:b,setUserSearchQuery:I,closeManagement:y}=(0,i.Sv)(),S=(0,M.Z)(),k=(0,a.sO)(null),N=(0,a.sO)(null),[w,T]=(0,a.eJ)(),A=(0,a.Ye)((()=>t&&o?Object.keys(o):[]),[o,t]),R=(0,a.Ye)((()=>{const e=(0,i.Rd)().users.byId;if(!n||!e)return[];const a=(0,r.Z0)(n.map((e=>{let{userId:t}=e;return t})),e,l,void 0,v);return t?a.filter((e=>!A.includes(e))):a}),[n,l,v,t,A]),L=(0,a.Ye)((()=>{const e=(0,i.Rd)().users.byId,n=(0,i.Rd)().chats.byId,a=Boolean(Z),s=a?u?(0,r.kK)(u,e,Z):[]:R;return(0,r.ih)((0,$e.Tw)([...s,...a&&h||[],...a&&m||[]]).filter((n=>{const a=e[n];return!a||(c||a.canBeInvitedToGroup||!(0,r.cS)(a))&&(!t||!A.includes(n))})),n,!0)}),[R,u,Z,h,m,c,t,A]),[F,x]=(0,_e.Z)(void 0,L,Boolean(Z)),B=(0,a.I4)((e=>{t?(f(e,!1),C(s.u1.ChatNewAdminRights)):(y(),b({id:e}))}),[y,t,f,C,b]),O=(0,a.I4)((e=>{I({query:e.target.value})}),[I]),D=(0,Ge.Z)(N,d,(e=>{F&&F.length>0&&B(F[-1===e?0:e])}),".ListItem-button",!0),U=(0,a.I4)((()=>{T(void 0)}),[]);return(0,ie.Z)({isActive:d,onBack:E}),a.ZP.createElement("div",{className:"Management"},t&&a.ZP.createElement("div",{className:"Management__filter",dir:S.isRtl?"rtl":void 0},a.ZP.createElement(ze.Z,{ref:k,value:Z,onChange:O,placeholder:S("Search")})),a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},F?.length?a.ZP.createElement(Je.Z,{className:"picker-list custom-scroll",items:L,onLoadMore:x,noScrollRestore:Boolean(Z),ref:N,onKeyDown:D},F.map((e=>{return a.ZP.createElement(Xe.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>B(e),contextActions:(t=e,t!==p&&g?[{title:S("lng_context_remove_from_group"),icon:"stop",handler:()=>{T(t)}}]:void 0)},a.ZP.createElement(qe.Z,{userId:e,forceShowSelf:!0}));var t}))):P||!F||F.length?a.ZP.createElement(Ve.Z,null):a.ZP.createElement(ua.Z,{teactOrderKey:0,key:"nothing-found",text:c?"No subscribers found":"No members found"}))),g&&a.ZP.createElement(jl.Z,{isOpen:Boolean(w),userId:w,onClose:U}))}))),zl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n),{byId:s,statusesById:i}=e.users,l=a?.fullInfo?.members;return{members:l,usersById:s,userStatusesById:i,isChannel:a&&(0,r.eA)(a),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{usersById:t,userStatusesById:n,members:i,isChannel:o,onScreenSelect:l,onChatMemberSelect:c,onClose:d,isActive:m,serverTimeOffset:u}=e;(0,ie.Z)({isActive:m,onBack:d});const h=(0,a.Ye)((()=>{if(i&&t)return(0,r.Z0)(i.filter((e=>!e.isOwner)).map((e=>{let{userId:t}=e;return t})),t,n,void 0,u)}),[i,u,t,n]),P=(0,a.I4)((e=>{c(e),l(s.u1.GroupUserPermissions)}),[c,l]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},h?h.map(((e,t)=>a.ZP.createElement(Xe.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>P(e)},a.ZP.createElement(qe.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(ua.Z,{teactOrderKey:0,key:"nothing-found",text:o?"No subscribers found":"No members found"}))))})));var Jl=n(82267);function Xl(e,t){const{isPermanent:n,usage:a=0,date:s}=e,{isPermanent:i,usage:r=0,date:o}=t;return n||i?Number(n)-Number(i):a||r?r-a:o-s}const Hl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{invites:a,revokedInvites:s}=e.management.byChatId[n],i=(0,o.Z1)(e,n),l=i&&(0,r.eA)(i);return{exportedInvites:a,revokedExportedInvites:s,chat:i,serverTimeOffset:e.serverTimeOffset,isChannel:l}}))((e=>{let{chatId:t,chat:n,exportedInvites:o,revokedExportedInvites:l,isActive:c,isChannel:u,serverTimeOffset:h,onClose:P,onScreenSelect:Z}=e;const{setEditingExportedInvite:v,showNotification:p,editExportedChatInvite:g,deleteExportedChatInvite:E,deleteRevokedExportedChatInvites:C,setOpenedInviteInfo:f}=(0,i.Sv)(),b=(0,M.Z)(),[S,k,N]=(0,I.Z)(),[w,T,A]=(0,I.Z)(),[R,L]=(0,a.eJ)(),[F,x,B]=(0,I.Z)(),[O,D]=(0,a.eJ)();(0,ie.Z)({isActive:c,onBack:P});const U=(0,a.Ye)((()=>{if(o)return o.some((e=>{let{expireDate:t}=e;return t&&t-(0,Jl.b)(h)<he.xR/1e3}))}),[o,h]),_=(0,y.Z)();(0,It.Z)((()=>{_()}),U?1e3:void 0);const G=(0,a.Ye)((()=>n&&(0,r.WS)(n)),[n]),z=o?.find((e=>{let{isPermanent:t}=e;return t})),J=G?`${m.zH}${G}`:z?.link,X=(0,a.Ye)((()=>(n?.usernames?o:o?.filter((e=>{let{isPermanent:t}=e;return!t})))?.sort(Xl)),[n?.usernames,o]),H=(0,a.I4)((e=>{const{link:n,title:a,isRequestNeeded:s,expireDate:i,usageLimit:r}=e;g({chatId:t,link:n,title:a,isRequestNeeded:s,expireDate:i,usageLimit:r,isRevoked:!0})}),[t,g]),q=(0,a.I4)((e=>{L(e),T()}),[T]),Y=(0,a.I4)((()=>{R&&(H(R),L(void 0),A())}),[A,H,R]),K=(0,a.I4)((()=>{Z(s.u1.EditInvite)}),[Z]),W=(0,a.I4)((()=>{z&&q(z)}),[q,z]),Q=(0,a.I4)((()=>{C({chatId:t}),N()}),[t,N,C]),ee=(0,a.I4)((e=>{f({chatId:t,invite:e}),Z(s.u1.InviteInfo)}),[t,Z,f]),te=(0,a.I4)((e=>{E({chatId:t,link:e.link})}),[t,E]),ne=(0,a.I4)((e=>{D(e),x()}),[x]),ae=(0,a.I4)((()=>{O&&(te(O),D(void 0),B())}),[B,te,O]),se=(0,a.I4)((e=>{(0,ns.TE)(e),p({message:b("LinkCopied")})}),[b,p]),re=(0,a.I4)((()=>{se(J)}),[se,J]),oe=e=>{const{usage:t=0,usageLimit:n,expireDate:a,isPermanent:s,requested:i,isRevoked:r}=e;let o="";if(o=!r&&n&&t<n?b("CanJoin",n-t):t?b("PeopleJoined",t):b("NoOneJoined"),r)return o+=`${b("Revoked")}`,o;if(i&&(o+=`${b("JoinRequests",i)}`),void 0!==n&&t===n)o+=`${b("LinkLimitReached")}`;else if(a){const e=1e3*(a-(0,Jl.b)(h));o+=" • ",o+=e>0?b("InviteLink.ExpiresIn",(0,he.D)(b,e)):b("InviteLink.Expired")}else s&&(o+=`${b("Permanent")}`);return o},le=e=>{const{usage:t=0,usageLimit:n,isRevoked:a,expireDate:s}=e;return a?"link-status-icon-gray":n&&t<n?"link-status-icon-green":s&&1e3*(s-(0,Jl.b)(h))<=0?"link-status-icon-red":"link-status-icon-blue"},ce=e=>{const n=[];return n.push({title:b("Copy"),icon:"copy",handler:()=>se(e.link)}),e.isPermanent||e.isRevoked||n.push({title:b("Edit"),icon:"edit",handler:()=>(e=>{v({chatId:t,invite:e}),Z(s.u1.EditInvite)})(e)}),e.isRevoked?n.push({title:b("DeleteLink"),icon:"delete",handler:()=>ne(e),destructive:!0}):n.push({title:b("RevokeButton"),icon:"delete",handler:()=>q(e),destructive:!0}),n},de=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement($.Z,{round:!0,ripple:!d.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"Actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]);return a.ZP.createElement("div",{className:"Management ManageInvites"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(hs.Z,{tgsUrl:Wn.l.Invite,size:m.jV,className:"section-icon"}),a.ZP.createElement("p",{className:"text-muted"},b(u?"PrimaryLinkHelpChannel":"PrimaryLinkHelp"))),J&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",{className:"text-muted"},b(n?.usernames?"PublicLink":"lng_create_permanent_link_title")),a.ZP.createElement("div",{className:"primary-link"},a.ZP.createElement("input",{className:"form-control primary-link-input",value:J,readOnly:!0,onClick:re}),a.ZP.createElement(j.Z,{className:"primary-link-more-menu",trigger:de,positionX:"right"},a.ZP.createElement(V.Z,{icon:"copy",onClick:re},b("Copy")),!n?.usernames&&a.ZP.createElement(V.Z,{icon:"delete",onClick:W,destructive:!0},b("RevokeButton")))),a.ZP.createElement($.Z,{onClick:re},b("CopyLink"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement($.Z,{isText:!0,key:"create",className:"create-link",onClick:K},b("CreateNewLink")),(!X||!X.length)&&a.ZP.createElement(ua.Z,{text:"No links found",key:"nothing"}),X?.map((e=>a.ZP.createElement(Xe.Z,{leftElement:a.ZP.createElement("i",{className:`icon-link link-status-icon ${le(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>ee(e),contextActions:ce(e),key:e.link},a.ZP.createElement("span",{className:"title invite-title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},oe(e))))),a.ZP.createElement("p",{className:"text-muted hint",key:"links-hint"},b("ManageLinksInfoHelp"))),l&&Boolean(l.length)&&a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{className:"text-muted",key:"title"},b("RevokedLinks")),a.ZP.createElement(Xe.Z,{icon:"delete",destructive:!0,key:"delete",onClick:k},a.ZP.createElement("span",{className:"title"},b("DeleteAllRevokedLinks"))),l?.map((e=>a.ZP.createElement(Xe.Z,{leftElement:a.ZP.createElement("i",{className:`icon-link link-status-icon ${le(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>ee(e),contextActions:ce(e),key:e.link},a.ZP.createElement("span",{className:"title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},oe(e))))))),a.ZP.createElement(lt.Z,{isOpen:S,onClose:N,title:b("DeleteAllRevokedLinks"),text:b("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:b("DeleteAll"),confirmHandler:Q}),a.ZP.createElement(lt.Z,{isOpen:w,onClose:A,title:b("RevokeLink"),text:b("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:b("RevokeButton"),confirmHandler:Y}),a.ZP.createElement(lt.Z,{isOpen:F,onClose:B,title:b("DeleteLink"),text:b("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:b("Delete"),confirmHandler:ae}))}))),ql=[1,10,100],Yl={hour:36e5,day:864e5,week:6048e5},Kl=Yl.hour,Wl=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{editingInvite:a}=e.management.byChatId[n];return{editingInvite:a,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{chatId:t,editingInvite:n,isActive:r,serverTimeOffset:o,onClose:l,onScreenSelect:c}=e;const{editExportedChatInvite:d,exportChatInvite:m}=(0,i.Sv)(),u=(0,M.Z)(),[h,P,Z]=(0,I.Z)(),[v,p]=(0,a.eJ)(!1),[g,E]=(0,a.eJ)(""),[C,f]=(0,a.eJ)(Date.now()+Kl),[b,y]=(0,a.eJ)("unlimited"),[S,k]=(0,a.eJ)(10),[N,w]=(0,a.eJ)("0"),[T,A]=(0,a.eJ)(!1);(0,ie.Z)({isActive:r,onBack:l}),(0,x.Z)((e=>{let[t]=e;if(t!==n)if(n){const{title:e,usageLimit:t,expireDate:a,isRequestNeeded:s}=n;if(e&&E(e),t&&(w(ql.includes(t)?t.toString():"custom"),k(t)),a){const e=(0,Jl.b)(o)+Kl;y("custom"),f(1e3*Math.max(a,e))}s&&p(!0)}else E(""),y("unlimited"),w("0"),f(1e3*(0,Jl.b)(o)+Kl),k(10),p(!1)}),[n,o]);const R=(0,a.I4)((e=>{p(e.target.checked)}),[]),L=(0,a.I4)((e=>{E(e.target.value)}),[]),F=(0,a.I4)((e=>{k(Number.parseInt(e.target.value,10))}),[]),B=(0,a.I4)((e=>{f(e.getTime()),Z()}),[Z]),O=(0,a.I4)((()=>{A(!0);const e="custom"===N?S:N;let a;switch(b){case"custom":a=(0,Jl.b)(o)+(C-Date.now())/1e3;break;case"hour":case"day":case"week":a=(0,Jl.b)(o)+Yl[b]/1e3;break;case"unlimited":a=0;break;default:a=void 0}n?d({link:n.link,chatId:t,title:g,isRequestNeeded:v,expireDate:a,usageLimit:e}):m({chatId:t,title:g,isRequestNeeded:v,expireDate:a,usageLimit:e}),c(s.u1.Invites)}),[t,C,S,d,n,m,v,b,N,g,c,o]);return a.ZP.createElement("div",{className:"Management ManageInvite"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(dt.Z,{label:u("ApproveNewMembers"),subLabel:u("ApproveNewMembersDescription"),checked:v,onChange:R})),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(ze.Z,{className:"link-name",placeholder:u("LinkNameHint"),value:g,onChange:L}),a.ZP.createElement("p",{className:"text-muted hint"},u("LinkNameHelp"))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},u("LimitByPeriod")),a.ZP.createElement(Ss.Z,{name:"expireOptions",options:[{value:"hour",label:u("Hours",1)},{value:"day",label:u("Days",1)},{value:"week",label:u("Weeks",1)},{value:"unlimited",label:u("NoLimit")},{value:"custom",label:u("lng_group_invite_expire_custom")}],onChange:y,selected:b}),"custom"===b&&a.ZP.createElement($.Z,{className:"expire-limit",isText:!0,onClick:P},(0,he.Tu)(u,C)," ",(0,he.mr)(u,C)),a.ZP.createElement("p",{className:"text-muted hint"},u("TimeLimitHelp"))),!v&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},u("LimitNumberOfUses")),a.ZP.createElement(Ss.Z,{name:"usageOptions",options:[...ql.map((e=>({value:e.toString(),label:e}))),{value:"0",label:u("NoLimit")},{value:"custom",label:u("lng_group_invite_usage_custom")}],onChange:w,selected:N}),"custom"===N&&a.ZP.createElement("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:S,onChange:F}),a.ZP.createElement("p",{className:"text-muted hint"},u("UsesLimitHelp"))),a.ZP.createElement(Ya.Z,{isShown:!0,onClick:O,disabled:T,ariaLabel:u(n?"SaveLink":"CreateLink")},a.ZP.createElement("i",{className:"icon-check"}))),a.ZP.createElement(gt,{isOpen:h,isFutureMode:!0,withTimePicker:!0,onClose:Z,onSubmit:B,selectedAt:C,submitButtonLabel:u("Save")}))}))),Ql=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n);return{enabledReactions:a.fullInfo?.enabledReactions,availableReactions:e.availableReactions,chat:a}}))((e=>{let{availableReactions:t,enabledReactions:n,chat:s,isActive:r,onClose:o}=e;const{setChatEnabledReactions:l}=(0,i.Sv)(),c=(0,M.Z)(),[d,m]=(0,a.eJ)(!1),[u,h]=(0,a.eJ)(!1),[P,Z]=(0,a.eJ)(n||[]);(0,ie.Z)({isActive:r,onBack:o});const v=(0,a.I4)((()=>{s&&(h(!0),l({chatId:s.id,enabledReactions:P}))}),[s,P,l]);(0,a.d4)((()=>{h(!1),m(!1),Z(n||[])}),[n]);const p=(0,a.Ye)((()=>t?.filter((e=>!e.isInactive))),[t]),g=(0,a.I4)((e=>{if(!s||!p)return;const{name:t,checked:n}=e.currentTarget,a="all"===t?n?p.map((e=>e.reaction)):[]:n?[...P,t]:P.filter((e=>e!==t));Z(a),m(!0)}),[p,s,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:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:"all",checked:!P||P.length>0,label:c("EnableReactions"),onChange:g})),p?.map((e=>{let{reaction:t,title:n}=e;return a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(dt.Z,{name:t,checked:!P||P?.includes(t),disabled:0===P?.length,label:a.ZP.createElement("div",{className:"Reaction"},a.ZP.createElement(qn.Z,{reaction:t}),n),onChange:g}))})))),a.ZP.createElement(Ya.Z,{isShown:d,onClick:v,ariaLabel:c("Save"),disabled:u},u?a.ZP.createElement(le.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),ec=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{inviteInfo:a}=e.management.byChatId[n],{invite:s,importers:i,requesters:l}=a||{},c=(0,o.Z1)(e,n);return{invite:s,importers:i,requesters:l,isChannel:c&&(0,r.eA)(c),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{chatId:t,invite:n,importers:s,requesters:r,isChannel:o,isActive:l,serverTimeOffset:c,onClose:d}=e;const{showNotification:m,loadChatInviteImporters:u,loadChatInviteRequesters:h,openChat:P}=(0,i.Sv)(),Z=(0,M.Z)(),{usage:v=0,usageLimit:p,link:g,adminId:E}=n||{},C=n?.expireDate&&1e3*(n.expireDate-(0,Jl.b)(c))+Date.now(),f=(n?.expireDate||0)-(0,Jl.b)(c)<0;(0,a.d4)((()=>{g&&(u({chatId:t,link:g}),h({chatId:t,link:g}))}),[t,g,u,h]);const b=(0,a.I4)((()=>{(0,ns.TE)(n.link),m({message:Z("LinkCopied")})}),[n,Z,m]);return(0,ie.Z)({isActive:l,onBack:d}),a.ZP.createElement("div",{className:"Management ManageInviteInfo"},a.ZP.createElement("div",{className:"custom-scroll"},!n&&a.ZP.createElement("p",{className:"text-muted"},Z("Loading")),n&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"link-title"},n.title||n.link),a.ZP.createElement("input",{className:"form-control",value:n.link,readOnly:!0,onClick:b}),a.ZP.createElement($.Z,{className:"copy-link",onClick:b},Z("CopyLink")),C&&a.ZP.createElement("p",{className:"text-muted"},f?Z("ExpiredLink"):Z("LinkExpiresIn",`${(0,he.Tu)(Z,C)} ${(0,he.mr)(Z,C)}`))),E&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,Z("LinkCreatedeBy")),a.ZP.createElement(Xe.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>P({id:E})},a.ZP.createElement(qe.Z,{userId:E,status:(0,he.ZK)(Z,1e3*n.date,!0),forceShowSelf:!0}))),(()=>{if(s?.length||!r?.length)return s?a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,s.length?Z("PeopleJoined",v):Z("NoOneJoined")),a.ZP.createElement("p",{className:"text-muted"},!s.length&&(p?Z("PeopleCanJoinViaLinkCount",p-v):Z("NoOneJoinedYet")),s.map((e=>a.ZP.createElement(Xe.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>P({id:e.userId})},a.ZP.createElement(qe.Z,{userId:e.userId,status:(0,he.ZK)(Z,1e3*e.date,!0),forceShowSelf:!0})))))):a.ZP.createElement(le.Z,null)})(),(()=>{if(!n?.isRevoked){if(!r&&s)return a.ZP.createElement(le.Z,null);if(r?.length)return a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,Z(o?"SubscribeRequests":"MemberRequests")),a.ZP.createElement("p",{className:"text-muted"},r.map((e=>a.ZP.createElement(Xe.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>P({id:e.userId})},a.ZP.createElement(qe.Z,{userId:e.userId,status:(0,he.ZK)(Z,1e3*e.date,!0),forceShowSelf:!0}))))))}})())))}))),tc=(0,a.X$)((0,i.c$)(((e,t)=>{let{userId:n}=t;return{user:(0,o.dy)(e,n),animationLevel:e.settings.byKey.animationLevel,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{userId:t,chatId:n,about:s,date:o,isChannel:l,user:c,animationLevel:d,serverTimeOffset:m}=e;const{openChat:u,hideChatJoinRequest:h}=(0,i.Sv)(),P=(0,W.y)("JoinRequest"),Z=(0,M.Z)(),v=(0,r.Js)(c),p=1e3*(o-(0,Jl.b)(m))+Date.now(),g=(0,he.zk)(new Date(p))?(0,he.mr)(Z,p):(0,he.j1)(Z,p,!0,!1,!0),E=(0,a.I4)((()=>{h({chatId:n,userId:t,isApproved:!0})}),[n,h,t]),C=(0,a.I4)((()=>{h({chatId:n,userId:t,isApproved:!1})}),[n,h,t]);return a.ZP.createElement("div",{className:P("&")},a.ZP.createElement("div",{className:P("top")},a.ZP.createElement("div",{className:P("user"),onClick:()=>{u({id:t})}},a.ZP.createElement(Be.Z,{key:t,size:"medium",user:c,animationLevel:d,withVideo:!0}),a.ZP.createElement("div",{className:P("user-info")},a.ZP.createElement("div",{className:P("user-name")},v),a.ZP.createElement("div",{className:P("user-subtitle")},s))),a.ZP.createElement("div",{className:P("date")},g)),a.ZP.createElement("div",{className:P("buttons")},a.ZP.createElement($.Z,{className:P("button"),onClick:E},Z(l?"ChannelAddToChannel":"ChannelAddToGroup")),a.ZP.createElement($.Z,{className:P("button"),isText:!0,onClick:C},Z("DismissRequest"))))}))),nc=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,o.Z1)(e,n);return{chat:a,serverTimeOffset:e.serverTimeOffset,isChannel:a&&(0,r.eA)(a)}}))((e=>{let{chat:t,chatId:n,isActive:s,isChannel:o,onClose:l}=e;const{hideAllChatJoinRequests:c,loadChatJoinRequests:d}=(0,i.Sv)(),[u,h,P]=(0,I.Z)(),[Z,v,p]=(0,I.Z)(),g=(0,M.Z)();(0,ie.Z)({isActive:s,onBack:l}),(0,a.d4)((()=>{t?.joinRequests||(0,r.YC)(n)||d({chatId:n})}),[t,n,d]);const E=(0,a.I4)((()=>{c({chatId:n,isApproved:!0}),P()}),[c,n,P]),C=(0,a.I4)((()=>{c({chatId:n,isApproved:!1}),p()}),[c,n,p]);return a.ZP.createElement("div",{className:"Management ManageJoinRequests"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(hs.Z,{tgsUrl:Wn.l.JoinRequest,size:m.PM,className:"section-icon"}),Boolean(t?.joinRequests?.length)&&a.ZP.createElement("div",{className:"bulk-actions"},a.ZP.createElement($.Z,{className:"bulk-action-button",onClick:h},"Accept all"),a.ZP.createElement($.Z,{className:"bulk-action-button",onClick:v,isText:!0},"Dismiss all"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{key:"title"},t?.joinRequests?t.joinRequests.length?g("JoinRequests",t.joinRequests.length):g("NoMemberRequests"):g("Loading")),!t?.joinRequests&&a.ZP.createElement(le.Z,{key:"loading"}),0===t?.joinRequests?.length&&a.ZP.createElement("p",{className:"text-muted",key:"empty"},g(o?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")),t?.joinRequests?.map((e=>{let{userId:t,about:s,date:i}=e;return a.ZP.createElement(tc,{userId:t,about:s,date:i,isChannel:o,chatId:n,key:t})})))),a.ZP.createElement(lt.Z,{isOpen:u,onClose:P,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:E}),a.ZP.createElement(lt.Z,{isOpen:Z,onClose:p,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:C}))}))),ac=(0,a.X$)((0,i.c$)((e=>({managementType:(0,o.pP)(e)})))((e=>{let{chatId:t,currentScreen:n,selectedChatMemberId:i,isPromotedByCurrentUser:r,onScreenSelect:o,onChatMemberSelect:l,onClose:c,isActive:d,managementType:m}=e;switch(n){case s.u1.Initial:switch(m){case"user":return a.ZP.createElement(Ml,{key:t,userId:t,onClose:c,isActive:d});case"group":return a.ZP.createElement(Al,{key:t,chatId:t,onScreenSelect:o,onClose:c,isActive:d||[s.u1.ChatPrivacyType,s.u1.Discussion,s.u1.GroupPermissions,s.u1.ChatAdministrators,s.u1.GroupRemovedUsers,s.u1.GroupUserPermissionsCreate,s.u1.GroupUserPermissions,s.u1.ChatAdminRights,s.u1.ChatNewAdminRights,s.u1.GroupRecentActions].includes(n)});case"channel":return a.ZP.createElement(Bl,{key:t,chatId:t,onScreenSelect:o,onClose:c,isActive:d||[s.u1.ChannelSubscribers,s.u1.ChatAdministrators,s.u1.ChannelRemovedUsers,s.u1.Discussion,s.u1.ChatPrivacyType,s.u1.ChatAdminRights,s.u1.ChatNewAdminRights,s.u1.GroupRecentActions].includes(n)})}break;case s.u1.ChatPrivacyType:return a.ZP.createElement(Ol,{chatId:t,isActive:d,onClose:c});case s.u1.Discussion:return a.ZP.createElement(Dl,{chatId:t,onScreenSelect:o,isActive:d,onClose:c});case s.u1.GroupPermissions:return a.ZP.createElement(Rl,{chatId:t,onScreenSelect:o,onChatMemberSelect:l,isActive:d||[s.u1.GroupRemovedUsers,s.u1.GroupUserPermissionsCreate,s.u1.GroupUserPermissions].includes(n),onClose:c});case s.u1.ChannelRemovedUsers:case s.u1.GroupRemovedUsers:return a.ZP.createElement(Fl,{chatId:t,isActive:d,onClose:c});case s.u1.GroupUserPermissionsCreate:return a.ZP.createElement(zl,{chatId:t,onChatMemberSelect:l,onScreenSelect:o,isActive:d||[s.u1.GroupUserPermissions].includes(n),onClose:c});case s.u1.GroupUserPermissions:return a.ZP.createElement(Ul,{chatId:t,selectedChatMemberId:i,isPromotedByCurrentUser:r,onScreenSelect:o,isActive:d,onClose:c});case s.u1.ChatAdministrators:return a.ZP.createElement($l,{chatId:t,onScreenSelect:o,onChatMemberSelect:l,isActive:d||[s.u1.ChatAdminRights,s.u1.ChatNewAdminRights,s.u1.GroupRecentActions].includes(n),onClose:c});case s.u1.GroupRecentActions:return a.ZP.createElement(_l,{chatId:t,isActive:d,onClose:c});case s.u1.ChatNewAdminRights:case s.u1.ChatAdminRights:return a.ZP.createElement(Gl,{chatId:t,isNewAdmin:n===s.u1.ChatNewAdminRights,selectedUserId:i,isPromotedByCurrentUser:r,onScreenSelect:o,isActive:d,onClose:c});case s.u1.ChannelSubscribers:case s.u1.GroupMembers:return a.ZP.createElement(Vl,{chatId:t,isActive:d,onClose:c});case s.u1.Invites:return a.ZP.createElement(Hl,{chatId:t,isActive:d,onClose:c,onScreenSelect:o});case s.u1.EditInvite:return a.ZP.createElement(Wl,{chatId:t,isActive:d,onClose:c,onScreenSelect:o});case s.u1.GroupAddAdmins:return a.ZP.createElement(Vl,{chatId:t,noAdmins:!0,isActive:d,onClose:c,onScreenSelect:o,onChatMemberSelect:l});case s.u1.Reactions:return a.ZP.createElement(Ql,{chatId:t,isActive:d,onClose:c});case s.u1.InviteInfo:return a.ZP.createElement(ec,{chatId:t,isActive:d,onClose:c});case s.u1.JoinRequests:return a.ZP.createElement(nc,{chatId:t,isActive:d,onClose:c})}}))),sc=/^4\d/,ic=/^5[1-5]/,rc=/^2[2-7]\d{2}/,oc=/^220[0-4]/;let lc;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard",e[e.Mir=3]="Mir"}(lc||(lc={}));const cc={[lc.Default]:"",[lc.Visa]:"visa",[lc.Mastercard]:"mastercard",[lc.Mir]:"mir"};function dc(e){return e=e.replace(/\s/g,""),sc.test(e)?lc.Visa:oc.test(e)?lc.Mir:ic.test(e)||rc.test(e)?lc.Mastercard:lc.Default}const mc={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{},tipAmount:0,savedCredentialId:""},uc=(e,t)=>{switch(t.type){case"changeAddress1":return{...e,streetLine1:t.payload,formErrors:{...e.formErrors,streetLine1:void 0}};case"changeAddress2":return{...e,streetLine2:t.payload,formErrors:{...e.formErrors,streetLine2:void 0}};case"changeCity":return{...e,city:t.payload,formErrors:{...e.formErrors,city:void 0}};case"changeState":return{...e,state:t.payload,formErrors:{...e.formErrors,state:void 0}};case"changeCountry":return{...e,countryIso2:t.payload.iso2,billingCountry:t.payload.defaultName,formErrors:{...e.formErrors,countryIso2:void 0}};case"changePostCode":return{...e,postCode:t.payload,formErrors:{...e.formErrors,postCode:void 0}};case"changeFullName":return{...e,fullName:t.payload,formErrors:{...e.formErrors,fullName:void 0}};case"changeEmail":return{...e,email:t.payload,formErrors:{...e.formErrors,email:void 0}};case"changePhone":return{...e,phone:t.payload,formErrors:{...e.formErrors,phone:void 0}};case"changeShipping":return{...e,shipping:t.payload};case"changeCardNumber":return{...e,cardNumber:t.payload,formErrors:{...e.formErrors,cardNumber:void 0}};case"changeCardholder":return{...e,cardholder:t.payload,formErrors:{...e.formErrors,cardholder:void 0}};case"changeExpiryDate":return{...e,expiry:t.payload,formErrors:{...e.formErrors,expiry:void 0}};case"changeCvvCode":return{...e,cvv:t.payload,formErrors:{...e.formErrors,cvv:void 0}};case"changeBillingCountry":return{...e,billingCountry:t.payload,formErrors:{...e.formErrors,billingCountry:void 0}};case"changeBillingZip":return{...e,billingZip:t.payload,formErrors:{...e.formErrors,billingZip:void 0}};case"changeSaveInfo":return{...e,saveInfo:t.payload};case"changeSaveCredentials":return{...e,saveCredentials:t.payload};case"updateUserInfo":return t.payload.country?{...e,...t.payload,billingCountry:t.payload.country}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};case"setTipAmount":return{...e,tipAmount:t.payload};case"changeSavedCredentialId":return{...e,savedCredentialId:t.payload};case"resetState":return{...mc};default:return e}};function hc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400;(0,a.d4)((()=>{d.$b||setTimeout((()=>{(0,te.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const Pc=(0,a.X$)((e=>{const{id:t,value:n,label:s,hasArrow:i,error:r,ref:o,placeholder:l,tabIndex:c,onChange:d,children:m}=e,u=r||s,h=(0,W.Z)("input-group",n&&"touched",r&&"error",u&&"with-label",i&&"with-arrow","input-group");return a.ZP.createElement("div",{className:h},a.ZP.createElement("select",{className:"form-control",id:t,value:n||"",onChange:d,placeholder:l||s,tabIndex:c,ref:o},m),u&&t&&a.ZP.createElement("label",{htmlFor:t},u))})),Zc=(0,a.X$)((e=>{let{state:t,needEmail:n,needPhone:s,needName:i,needAddress:r,countryList:o,dispatch:l}=e;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=(0,a.sO)(null);(0,a.d4)((()=>{m.current&&m.current.value!==t.countryIso2&&(m.current.value=t.countryIso2)}),[t.countryIso2]);const u=(0,M.Z)();hc(c);const h=(0,a.I4)((e=>{l({type:"changeAddress1",payload:e.target.value})}),[l]),P=(0,a.I4)((e=>{l({type:"changeAddress2",payload:e.target.value})}),[l]),Z=(0,a.I4)((e=>{l({type:"changeCity",payload:e.target.value})}),[l]),v=(0,a.I4)((e=>{l({type:"changeState",payload:e.target.value})}),[l]),p=(0,a.I4)((e=>{l({type:"changeCountry",payload:o.find((t=>t.iso2===e.target.value))})}),[o,l]),g=(0,a.I4)((e=>{l({type:"changePostCode",payload:e.target.value})}),[l]),E=(0,a.I4)((e=>{l({type:"changeFullName",payload:e.target.value})}),[l]),C=(0,a.I4)((e=>{l({type:"changeEmail",payload:e.target.value})}),[l]),f=(0,a.I4)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,d.current&&(d.current.value=t),l({type:"changePhone",payload:t})}),[l]),b=(0,a.I4)((e=>{l({type:"changeSaveInfo",payload:e.target.value})}),[l]),{formErrors:I}=t;return a.ZP.createElement("div",{className:"ShippingInfo"},a.ZP.createElement("form",null,r?a.ZP.createElement("div",null,a.ZP.createElement("h5",null,u("PaymentShippingAddress")),a.ZP.createElement(ze.Z,{ref:c,label:u("PaymentShippingAddress1Placeholder"),onChange:h,value:t.streetLine1,inputMode:"text",tabIndex:0,error:I.streetLine1}),a.ZP.createElement(ze.Z,{label:u("PaymentShippingAddress2Placeholder"),onChange:P,value:t.streetLine2,inputMode:"text",tabIndex:0,error:I.streetLine2}),a.ZP.createElement(ze.Z,{label:u("PaymentShippingCityPlaceholder"),onChange:Z,value:t.city,inputMode:"text",tabIndex:0,error:I.city}),a.ZP.createElement(ze.Z,{label:u("PaymentShippingStatePlaceholder"),onChange:v,value:t.state,inputMode:"text",error:I.state}),a.ZP.createElement(Pc,{label:u("PaymentShippingCountry"),placeholder:u("PaymentShippingCountry"),onChange:p,value:t.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:I.countryIso2,ref:m,tabIndex:0},o.map((e=>{let{defaultName:n,name:s,iso2:i}=e;return a.ZP.createElement("option",{value:i,className:"county-item",selected:i===t.countryIso2},n||s)}))),a.ZP.createElement(ze.Z,{label:u("PaymentShippingZipPlaceholder"),onChange:g,value:t.postCode,inputMode:"text",tabIndex:0,error:I.postCode})):void 0,i||n||s?a.ZP.createElement("h5",null,u("PaymentShippingReceiver")):void 0,i&&a.ZP.createElement(ze.Z,{label:u("PaymentShippingName"),onChange:E,value:t.fullName,inputMode:"text",tabIndex:0,error:I.fullName}),n&&a.ZP.createElement(ze.Z,{label:u("PaymentShippingEmailPlaceholder"),onChange:C,value:t.email,inputMode:"email",tabIndex:0,error:I.email}),s&&a.ZP.createElement(ze.Z,{label:u("PaymentShippingPhoneNumber"),onChange:f,value:t.phone,inputMode:"tel",tabIndex:0,error:I.phone,ref:d}),a.ZP.createElement(dt.Z,{label:u("PaymentShippingSave"),subLabel:u("PaymentShippingSaveInfo"),checked:Boolean(t.saveInfo),tabIndex:0,onChange:b})))})),vc=(0,a.X$)((e=>{let{state:t,shippingOptions:n,currency:s,dispatch:i}=e;const r=(0,M.Z)();(0,a.d4)((()=>{n&&n.length&&!t.shipping&&i({type:"changeShipping",payload:n[0].id})}),[n,t.shipping,i]);const o=(0,a.I4)((e=>{i({type:"changeShipping",payload:e})}),[i]),l=(0,a.Ye)((()=>n.map((e=>{let{id:t,title:n,amount:a}=e;return{label:n,subLabel:(0,At.x)(a,s,r.code),value:t}}))),[n,s,r.code]);return a.ZP.createElement("div",{className:"Shipping"},a.ZP.createElement("form",null,a.ZP.createElement("p",null,r("PaymentShippingMethod")),a.ZP.createElement(Ss.Z,{name:"shipping-options",options:l,onChange:o,selected:t.shipping})))})),pc={root:"SM3T4awhZJvKn_c8aRuY",description:"RWoBZem6PCNMF5hu6Shs","checkout-picture":"prUKJGh6W9LIyjSnRbZc",checkoutPicture:"prUKJGh6W9LIyjSnRbZc",text:"xUG3uFeTiPPFkWHQELCc","checkout-title":"MO45Rkd2ksVxfzAONvQ6",checkoutTitle:"MO45Rkd2ksVxfzAONvQ6","checkout-description":"LqaZe1TRdNI17BEa1gcl",checkoutDescription:"LqaZe1TRdNI17BEa1gcl","price-info":"mz2vhtmYPNRaJbeUrXKA",priceInfo:"mz2vhtmYPNRaJbeUrXKA","price-info-item":"Ct9Ine31cu5h7FCjtRWa",priceInfoItem:"Ct9Ine31cu5h7FCjtRWa","price-info-item-main":"JduVB3d3NxN9TybmxIgS",priceInfoItemMain:"JduVB3d3NxN9TybmxIgS","price-info-item-title":"O7d8G4OQ_yTJSHiHbgBR",priceInfoItemTitle:"O7d8G4OQ_yTJSHiHbgBR",tipsList:"zsSyrAOxg0qs0nPJWSEe",tipsItem:"lcjeIUsdqs95BdK_oysT",tipsItem_active:"XRnGKO5ClzA_4S8i81wC",tipsItemActive:"XRnGKO5ClzA_4S8i81wC","invoice-info":"MyMLGHhiEKOVIoG3aQTS",invoiceInfo:"MyMLGHhiEKOVIoG3aQTS",provider:"hLVHJSaVspSZdzxNlBJk",stripe:"nrKVVKzRmr7s0TE15uG1",smartglocal:"oONvjFUTa5AbWvrbzbWn","checkout-info-item-info-title":"bkIqUpVUAY04wdT8fySX",checkoutInfoItemInfoTitle:"bkIqUpVUAY04wdT8fySX","checkout-info-item-info-data":"VAzhVfK6c1pUriepo4Ga",checkoutInfoItemInfoData:"VAzhVfK6c1pUriepo4Ga","tos-checkbox":"WjrdCzbl3hROmSBGGnjy",tosCheckbox:"WjrdCzbl3hROmSBGGnjy"},gc=(0,a.X$)((e=>{let{chat:t,invoice:n,prices:o,shippingPrices:l,checkoutInfo:c,currency:d,totalPrice:m,isTosAccepted:u,dispatch:h,onAcceptTos:P,tipAmount:Z,needAddress:v,hasShippingOptions:p,savedCredentials:g}=e;const{setPaymentStep:E}=(0,i.Sv)(),C=(0,M.Z)(),f=Boolean(h),{photo:b,title:I,text:y,isRecurring:S,recurringTermsUrl:k,suggestedTipAmounts:N,maxTipAmount:w}=n||{},{paymentMethod:T,paymentProvider:A,shippingAddress:L,name:F,phone:x,shippingMethod:B}=c||{},O=(0,R.Z)((0,r.O9)(b)),D=(0,a.I4)((e=>{h({type:"setTipAmount",payload:w?Math.min(e,w):e})}),[h,w]),U=(0,a.I4)((()=>{E({step:g?.length?s.KB.SavedPayments:s.KB.PaymentInfo})}),[g?.length,E]),$=(0,a.I4)((()=>{E({step:s.KB.ShippingInfo})}),[E]),_=(0,a.I4)((()=>{E({step:s.KB.Shipping})}),[E]);return a.ZP.createElement("div",{className:pc.root},a.ZP.createElement("div",{className:pc.description},O&&a.ZP.createElement("img",{className:pc.checkoutPicture,src:O,alt:""}),!O&&b&&a.ZP.createElement(Er.Z,{width:b.dimensions?.width,height:b.dimensions?.height,className:pc.checkoutPicture,forceAspectRatio:!0}),a.ZP.createElement("div",{className:pc.text},a.ZP.createElement("h5",{className:pc.checkoutTitle},I),y&&a.ZP.createElement("div",{className:pc.checkoutDescription},(0,J.Z)(y,["br","links","emoji"])))),a.ZP.createElement("div",{className:pc.priceInfo},o&&o.map((e=>Ec(C.code,e.label,e.amount,d))),l&&l.map((e=>Ec(C.code,e.label,e.amount,d))),N&&N.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:pc.priceInfoItem},a.ZP.createElement("div",{className:pc.priceInfoItemTitle},I),a.ZP.createElement("div",null,(0,At.x)(Z,d,C.code))),a.ZP.createElement("div",{className:pc.tipsList},N.map((e=>a.ZP.createElement("div",{key:e,className:(0,W.Z)(pc.tipsItem,e===Z&&pc.tipsItem_active),onClick:h?()=>D(e===Z?0:e):void 0},(0,At.x)(e,d,C.code,!0)))))),void 0!==m&&Ec(C.code,C("Checkout.TotalAmount"),m,d,!0)),a.ZP.createElement("div",{className:pc.invoiceInfo},Cc({title:T||g?.[0].title,label:C("PaymentCheckoutMethod"),icon:"card",onClick:f?U:void 0}),A&&Cc({title:A,label:C("PaymentCheckoutProvider"),customIcon:(0,W.Z)(pc.provider,pc[A.toLowerCase()])}),(v||!f)&&Cc({title:L,label:C("PaymentShippingAddress"),icon:"location",onClick:f?$:void 0}),F&&Cc({title:F,label:C("PaymentCheckoutName"),icon:"user"}),x&&Cc({title:x,label:C("PaymentCheckoutPhoneNumber"),icon:"phone"}),(p||!f)&&Cc({title:B,label:C("PaymentCheckoutShippingMethod"),icon:"truck",onClick:f?_:void 0}),S&&(G=k,a.ZP.createElement(dt.Z,{label:function(e,n){const s=C("PaymentCheckoutAcceptRecurrent",t?.title).split("*");return a.ZP.createElement(a.ZP.Fragment,null,s[0],a.ZP.createElement($n.Z,{url:e,text:"",isRtl:n},s[1]),s.slice(2))}(G,C.isRtl),name:"checkout_tos",checked:Boolean(u),className:pc.tosCheckbox,tabIndex:0,onCheck:P}))));var G}));function Ec(e,t,n,s){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return a.ZP.createElement("div",{className:(0,W.Z)(pc.priceInfoItem,i&&pc.priceInfoItemMain)},a.ZP.createElement("div",{className:pc.priceInfoItemTitle},t),a.ZP.createElement("div",null,(0,At.x)(n,s,e)))}function Cc(e){let{title:t,label:n,icon:s,customIcon:i,onClick:r}=e;return a.ZP.createElement(Xe.Z,{multiline:Boolean(t&&n!==t),icon:s,inactive:!r,onClick:r},i&&a.ZP.createElement("i",{className:i}),a.ZP.createElement("div",{className:pc.checkoutInfoItemInfoTitle},t||n),t&&n!==t&&a.ZP.createElement("p",{className:pc.checkoutInfoItemInfoData},n))}const fc=(0,a.X$)((e=>{let{value:t,error:n,onChange:s}=e;const i=(0,M.Z)(),r=(0,a.I4)((e=>{const n=e.target.value;t.endsWith("/")&&t.length>n.length?s(n):s(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return t?.[0]&&Number(t[0])>12&&(t[0]="12"),t?.[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))}),[s,t]);return a.ZP.createElement(ze.Z,{label:i("PaymentCardExpireDate"),onChange:r,value:t,error:n,inputMode:"numeric",tabIndex:0,maxLength:5,teactExperimentControlled:!0})})),bc=n.p+"mastercard.790db81f7978635f77d8.svg",Ic=n.p+"visa.538e537ba818f53b0a8f.svg",yc=n.p+"mir.e3a390b90e2e3e292621.svg",Sc=(0,a.X$)((e=>{let{value:t,error:n,onChange:s}=e;const i=(0,M.Z)(),r=(0,a.sO)(null);hc(r);const[o,l]=(0,a.eJ)(lc.Default);(0,a.d4)((()=>{const e=dc(t);l(e)}),[]);const c=(0,a.I4)((e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),n=dc(e.target.value);l(n),s(t)}),[s]),d=function(e){switch(e){case lc.Mastercard:return a.ZP.createElement("img",{src:bc,alt:""});case lc.Visa:return a.ZP.createElement("img",{src:Ic,alt:""});case lc.Mir:return a.ZP.createElement("img",{src:yc,alt:""});default:return}}(o);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement(ze.Z,{ref:r,label:i("PaymentCardNumber"),onChange:c,value:t,inputMode:"numeric",className:o?"has-right-addon":"",error:n,tabIndex:0,maxLength:23,teactExperimentControlled:!0}),a.ZP.createElement("span",{className:"right-addon"},d))})),kc=(0,a.X$)((e=>{let{state:t,canSaveCredentials:n,needCardholderName:s,needCountry:i,needZip:r,countryList:o,dispatch:l}=e;const c=(0,a.sO)(null);(0,a.d4)((()=>{c.current&&c.current.value!==t.billingCountry&&(c.current.value=t.billingCountry)}),[t.billingCountry]);const d=(0,a.I4)((e=>{l({type:"changeCardNumber",payload:e})}),[l]),m=(0,a.I4)((e=>{l({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[l]),u=(0,a.I4)((e=>{l({type:"changeExpiryDate",payload:e})}),[l]),h=(0,a.I4)((e=>{const t=e.target.value.replace(/[^0-9]/g,"");l({type:"changeCvvCode",payload:t})}),[l]),P=(0,a.I4)((e=>{l({type:"changeBillingCountry",payload:e.target.value})}),[l]),Z=(0,a.I4)((e=>{l({type:"changeBillingZip",payload:e.target.value})}),[l]),v=(0,a.I4)((e=>{l({type:"changeSaveCredentials",payload:e.target.value})}),[l]),p=(0,M.Z)(),{formErrors:g={}}=t;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,p("PaymentCardTitle")),a.ZP.createElement(Sc,{onChange:d,value:t.cardNumber,error:g.cardNumber}),s&&a.ZP.createElement(ze.Z,{label:p("Checkout.NewCard.CardholderNamePlaceholder"),onChange:m,value:t.cardholder,inputMode:"text",tabIndex:0,error:g.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(fc,{value:t.expiry,onChange:u,error:g.expiry}),a.ZP.createElement(ze.Z,{label:p("lng_payments_card_cvc"),onChange:h,value:t.cvv,inputMode:"numeric",maxLength:3,tabIndex:0,error:g.cvv,teactExperimentControlled:!0})),i||r?a.ZP.createElement("h5",null,p("PaymentBillingAddress")):void 0,i&&a.ZP.createElement(Pc,{label:p("PaymentShippingCountry"),placeholder:p("PaymentShippingCountry"),onChange:P,value:t.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:g.billingCountry,tabIndex:0,ref:c},o.map((e=>{let{defaultName:n,name:s}=e;return a.ZP.createElement("option",{value:n,className:"county-item",selected:n===t.billingCountry},n||s)}))),r&&a.ZP.createElement(ze.Z,{label:p("PaymentShippingZipPlaceholder"),onChange:Z,value:t.billingZip,inputMode:"text",tabIndex:0,maxLength:12,error:g.billingZip}),a.ZP.createElement(dt.Z,{label:p("PaymentCardSavePaymentInformation"),checked:!!n&&t.saveCredentials,tabIndex:0,onChange:v,disabled:!n}),a.ZP.createElement("p",{className:"description"},p(n?"Checkout.NewCard.SaveInfoHelp":"Checkout.2FA.Text"))))})),Nc=(0,a.X$)((e=>{let{url:t,noRedirect:n,onClose:s}=e;const{openTelegramLink:r}=(0,i.Sv)(),o=(0,M.Z)(),l=(0,a.I4)((e=>{try{const t=JSON.parse(e.data),{eventType:a,eventData:i}=t;if("web_app_open_tg_link"!==a)return;if(!n){const e=m.zH+i.path_full;r({url:e})}s()}catch(e){}}),[s,n,r]);return(0,a.d4)((()=>(window.addEventListener("message",l),()=>window.removeEventListener("message",l))),[l]),a.ZP.createElement("div",{className:"ConfirmPayment"},a.ZP.createElement("iframe",{src:t,title:o("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-modals allow-forms allow-scripts allow-same-origin allow-top-navigation",className:"ConfirmPayment__content"}))})),wc=(0,a.X$)((e=>{let{state:t,savedCredentials:n,dispatch:s,onNewCardClick:i}=e;const r=(0,M.Z)(),o=(0,a.Ye)((()=>n?.length?n.map((e=>{let{id:t,title:n}=e;return{label:n,value:t}})):ta.D),[n]),l=(0,a.I4)((e=>{s({type:"changeSavedCredentialId",payload:e})}),[s]);return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,r("PaymentCardTitle")),a.ZP.createElement(Ss.Z,{name:"saved-credentials",options:o,selected:t.savedCredentialId,onChange:l}),a.ZP.createElement($.Z,{isText:!0,onClick:i},r("PaymentCheckoutMethodNewCard"))))})),Mc=(0,a.X$)((0,i.c$)((e=>({error:e.payment.error?.message,passwordHint:e.twoFaSettings.hint,savedCredentials:e.payment.savedCredentials})))((e=>{let{isActive:t,error:n,state:s,savedCredentials:r,passwordHint:o,onPasswordChange:l}=e;const{clearPaymentError:c}=(0,i.Sv)(),d=(0,M.Z)(),[m,u]=(0,a.eJ)(!1),h=(0,a.Ye)((()=>r?.length&&s.savedCredentialId?r.find((e=>{let{id:t}=e;return t===s.savedCredentialId}))?.title:void 0),[r,s.savedCredentialId]);return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement(ci.Z,{isBig:!0,isPasswordVisible:m}),a.ZP.createElement(di.Z,{error:n?d(n):void 0,hint:o,description:d("PaymentConfirmationMessage",h),placeholder:d("Password"),clearError:c,shouldShowSubmit:!1,shouldResetValue:t,isPasswordVisible:m,onChangePasswordVisibility:u,onInputChange:l}))}))),Tc="stripe",Ac="smartglocal",Rc=new Set([Tc,Ac]),Lc=(0,a.X$)((0,i.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:i,invoiceContainer:r,nativeProvider:l,nativeParams:c,passwordMissing:d,error:m,confirmPaymentUrl:u,inputInvoice:h,requestId:P,stripeCredentials:Z,smartGlocalCredentials:v,savedCredentials:p,temporaryPassword:g,isExtendedMedia:E}=e.payment,C=h&&"chatId"in h?(0,o.Z1)(e,h.chatId):void 0,f=Boolean(i&&(!l||!Rc.has(l))),{needCardholderName:b,needCountry:I,needZip:y}=c||{},{isNameRequested:S,isShippingAddressRequested:k,isPhoneRequested:N,isEmailRequested:w,shouldSendPhoneToProvider:M,shouldSendEmailToProvider:T,currency:A,prices:R}=r||{};return{step:t,chat:C,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:l,passwordMissing:d,isNameRequested:S,isShippingAddressRequested:k,isPhoneRequested:N,isEmailRequested:w,shouldSendPhoneToProvider:M,shouldSendEmailToProvider:T,currency:A,prices:R,isProviderError:f,invoice:i,needCardholderName:b,needCountry:I,needZip:y,error:m,confirmPaymentUrl:u,countryList:e.countryList.general,requestId:P,hasShippingOptions:Boolean(n?.length),smartGlocalToken:v?.token,stripeId:Z?.id,savedCredentials:p,passwordValidUntil:g?.validUntil,isExtendedMedia:E}}))((e=>{let{isOpen:t,onClose:n,step:r,chat:o,shippingOptions:l,savedInfo:c,canSaveCredentials:d,isNameRequested:m,isShippingAddressRequested:u,isPhoneRequested:h,isEmailRequested:P,shouldSendPhoneToProvider:Z,shouldSendEmailToProvider:v,currency:p,passwordMissing:g,isProviderError:E,invoice:C,nativeProvider:f,prices:b,needCardholderName:y,needCountry:S,needZip:k,confirmPaymentUrl:N,error:w,countryList:T,hasShippingOptions:A,requestId:R,smartGlocalToken:L,stripeId:F,savedCredentials:x,passwordValidUntil:B,isExtendedMedia:O}=e;const{loadPasswordInfo:D,validateRequestedInfo:U,sendPaymentForm:_,setPaymentStep:j,sendCredentialsInfo:V,clearPaymentError:z,validatePaymentPassword:J}=(0,i.Sv)(),H=(0,M.Z)(),[q,Y,K]=(0,I.Z)(),[Q,ee]=(0,_a.Z)(uc,mc),[te,ne]=(0,a.eJ)(!1),[ae,se]=(0,a.eJ)(!1),[ie,re]=(0,a.eJ)(""),oe=r!==s.KB.ConfirmPayment,ce=(0,a.I4)((e=>{j({step:e})}),[j]);(0,a.d4)((()=>{t&&(re(""),D(),Y())}),[t,D,Y]),(0,a.d4)((()=>{!t&&q&&K()}),[K,q,t]),(0,a.d4)((()=>{(void 0!==r||w)&&ne(!1)}),[r,w]),(0,a.d4)((()=>{w?.field&&ee({type:"setFormErrors",payload:{[w.field]:w.message}})}),[w,ee]),(0,a.d4)((()=>{if(c){const{name:e,phone:t,email:n,shippingAddress:a}=c,{countryIso2:s,...i}=a||{},r=s&&T.find((e=>{let{iso2:t}=e;return t===s})).defaultName;ee({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...r&&{country:r,countryIso2:s,...i}}})}}),[c,ee,T]),(0,a.d4)((()=>{x?.length&&ee({type:"changeSavedCredentialId",payload:x[0].id})}),[ee,x]);const de=(0,a.I4)((()=>{z()}),[z]),me=(0,a.Ye)((()=>r!==s.KB.Checkout?0:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;const s=t?xc(t,n):[];let i=a;const r=e.concat(s||[]);return i=r.reduce(((e,t)=>e+t.amount),i),i}(b,l,Q.shipping,Q.tipAmount)),[r,b,l,Q.shipping,Q.tipAmount]),ue=(0,a.Ye)((()=>{if(r===s.KB.Checkout)return function(e,t,n){const a=function(e){const t=dc(e);return cc[t]||""}(e.cardNumber),s=a&&e.cardNumber?`${a} *${e.cardNumber.slice(-4)}`:void 0,i=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:r,fullName:o}=e,l=(t?Fc(t,e.shipping):void 0)?.title;return{paymentMethod:s,paymentProvider:n,shippingAddress:i,name:o,phone:r,shippingMethod:l}}(Q,l,f||"")}),[r,Q,l,f]),he=(0,a.I4)((()=>{ce(s.KB.PaymentInfo)}),[ce]),Pe=(0,a.I4)((()=>{const{saveInfo:e}=Q,t=function(e){const{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:i,postCode:r,fullName:o,phone:l,email:c}=e;return{name:o,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:i,postCode:r}}}(Q);U({requestInfo:t,saveInfo:e})}),[U,Q]),Ze=(0,a.I4)((()=>{const e=function(e){const{cardNumber:t,cardholder:n,expiry:a,cvv:s,billingCountry:i,billingZip:r}=e,[o,l]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:o,expiryYear:l,cvv:s,country:i,zip:r}}}(Q);V({credentials:e})}),[V,Q]),ve=(0,a.I4)((()=>{_({shippingOptionId:Q.shipping,saveCredentials:Q.saveCredentials,savedCredentialId:Q.savedCredentialId,tipAmount:Q.tipAmount})}),[_,Q]),pe=(0,a.I4)((()=>{switch(r){case s.KB.ShippingInfo:ne(!0),Pe();break;case s.KB.Shipping:ce(s.KB.Checkout);break;case s.KB.SavedPayments:ce(s.KB.ConfirmPassword);break;case s.KB.ConfirmPassword:if(""===ie)return;ne(!0),J({password:ie});break;case s.KB.PaymentInfo:ne(!0),Ze(),ee({type:"changeSavedCredentialId",payload:""});break;case s.KB.Checkout:{if(c&&!R&&!Q.shipping)return ne(!0),void Pe();if(Q.savedCredentialId&&(!B||B<=Date.now()/1e3-3))return void ce(s.KB.ConfirmPassword);if(!Q.savedCredentialId&&(f===Tc&&!F||f===Ac&&!L))return void ce(s.KB.PaymentInfo);const{phone:e,email:t,fullName:n}=Q,a=P&&!t||h&&!e||m&&!n;if(u&&!R||a)return void ce(s.KB.ShippingInfo);if(u&&!Q.shipping)return void ce(s.KB.Shipping);ne(!0),ve();break}}}),[P,m,h,u,f,B,ee,Q,R,c,Ze,ve,ce,L,r,F,ie,J,Pe]);(0,a.d4)((()=>r===s.KB.ConfirmPassword?(0,Vn.Z)({onEnter:pe}):void 0),[pe,r]);const ge=(0,a.I4)((()=>{ee({type:"resetState"}),se(!1),n()}),[n,ee]),Ee=(0,a.I4)((()=>{ce(r===s.KB.ConfirmPassword?s.KB.SavedPayments:s.KB.Checkout)}),[ce,r]),Ce=(0,a.Ye)((()=>{switch(r){case s.KB.Checkout:return H("PaymentCheckout");case s.KB.ShippingInfo:return H("PaymentShippingInfo");case s.KB.Shipping:return H("PaymentShippingMethod");case s.KB.SavedPayments:return H("PaymentCheckoutMethod");case s.KB.ConfirmPassword:return H("Checkout.PasswordEntry.Title");case s.KB.PaymentInfo:return H("PaymentCardInfo");case s.KB.ConfirmPayment:return H("Checkout.WebConfirmation.Title");default:return""}}),[r,H]),fe=r===s.KB.Checkout?H("Checkout.PayPrice",(0,At.x)(me,p,H.code)):H("Next");if(E)return a.ZP.createElement(X.Z,{className:"error",isOpen:q,onClose:K,onCloseAnimationEnd:ge},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($.Z,{isText:!0,onClick:K},H("OK")));const be=function(){if(te)return!0;switch(r){case s.KB.Checkout:return Boolean(C?.isRecurring&&!ae);case s.KB.PaymentInfo:return Boolean(""===Q.cardNumber||y&&""===Q.cardholder||""===Q.cvv||""===Q.expiry);default:return!1}}();return a.ZP.createElement(X.Z,{className:(0,W.Z)("PaymentModal",C?.isRecurring&&"recurring"),isOpen:q,onClose:K,onCloseAnimationEnd:ge},a.ZP.createElement("div",{className:"header",dir:H.isRtl?"rtl":void 0},a.ZP.createElement($.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:r===s.KB.Checkout?K:Ee,ariaLabel:"Close"},a.ZP.createElement("i",{className:r===s.KB.Checkout?"icon-close":"icon-arrow-left"})),a.ZP.createElement("h3",null,Ce)),void 0!==r?a.ZP.createElement(G.Z,{name:"slide",activeKey:r},a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case s.KB.Checkout:return a.ZP.createElement(gc,{chat:o,prices:b,dispatch:ee,shippingPrices:Q.shipping&&l?xc(l,Q.shipping):void 0,totalPrice:me,invoice:C,checkoutInfo:ue,currency:p,hasShippingOptions:A,tipAmount:Q.tipAmount,needAddress:Boolean(u),savedCredentials:x,isTosAccepted:ae,onAcceptTos:se});case s.KB.SavedPayments:return a.ZP.createElement(wc,{state:Q,savedCredentials:x,dispatch:ee,onNewCardClick:he});case s.KB.ConfirmPassword:return a.ZP.createElement(Mc,{state:Q,savedCredentials:x,onPasswordChange:re,isActive:e===r});case s.KB.PaymentInfo:return a.ZP.createElement(kc,{state:Q,dispatch:ee,canSaveCredentials:Boolean(!g&&d),needCardholderName:y,needCountry:S,needZip:k,countryList:T});case s.KB.ShippingInfo:return a.ZP.createElement(Zc,{state:Q,dispatch:ee,needAddress:Boolean(u),needEmail:Boolean(P||v),needPhone:Boolean(h||Z),needName:Boolean(m),countryList:T});case s.KB.Shipping:return a.ZP.createElement(vc,{state:Q,dispatch:ee,shippingOptions:l||[],currency:p});case s.KB.ConfirmPayment:return a.ZP.createElement(Nc,{url:N,noRedirect:O,onClose:K});default:return}}(r))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(le.Z,{color:"gray"})),oe&&a.ZP.createElement("div",{className:"footer"},a.ZP.createElement($.Z,{type:"submit",onClick:pe,disabled:be,isLoading:te},fe)),w&&!w.field&&function(){if(w)return a.ZP.createElement(X.Z,{className:"error",isOpen:Boolean(w),onClose:de},a.ZP.createElement("h4",null,w.description||"Error"),a.ZP.createElement("p",null,w.description||"Error"),a.ZP.createElement($.Z,{isText:!0,onClick:z},H("OK")))}())})));function Fc(e,t){return e.find((e=>{let{id:n}=e;return n===t}))}function xc(e,t){return Fc(e,t)?.prices}const Bc=(0,a.X$)((0,i.c$)((e=>{const{receipt:t}=e.payment,{currency:n,prices:a,info:s,totalAmount:i,credentialsTitle:r,shippingPrices:o,shippingMethod:l,photo:c,text:d,title:m,tipAmount:u}=t||{};return{currency:n,prices:a,info:s,tipAmount:u,totalAmount:i,credentialsTitle:r,shippingPrices:o,shippingMethod:l,photo:c,text:d,title:m}}))((e=>{let{isOpen:t,onClose:n,prices:s,shippingPrices:i,tipAmount:r,totalAmount:o,currency:l,info:c,photo:d,text:m,title:u,credentialsTitle:h,shippingMethod:P}=e;const Z=(0,M.Z)(),[v,p,g]=(0,I.Z)();(0,a.d4)((()=>{t&&p()}),[t,p]);const E=(0,a.Ye)((()=>function(e,t,n){if(!t)return{paymentMethod:e};const{shippingAddress:a}=t,s=a?.streetLine1?`${a.streetLine1}, ${a.city}, ${a.countryIso2}`:void 0,{phone:i,name:r}=t;return{paymentMethod:e,shippingAddress:s,name:r,phone:i,shippingMethod:n}}(h,c,P)),[c,P,h]),C=(0,a.Ye)((()=>({photo:d,text:m,title:u,amount:o,currency:l})),[l,d,m,u,o]);return a.ZP.createElement(X.Z,{className:"PaymentModal PaymentModal-receipt",isOpen:v,onClose:g,onCloseAnimationEnd:n},a.ZP.createElement("div",null,a.ZP.createElement("div",{className:"header",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement($.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:g,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(gc,{prices:s,shippingPrices:i,totalPrice:o,tipAmount:r,invoice:C,checkoutInfo:E,currency:l}))))})))},93490:(e,t,n)=>{n.d(t,{Z:()=>P});var a=n(14050),s=n(83716),i=n(77361),r=n(13365),o=n(97799),l=n(28183),c=n(60706);const d=[0,50],m=[0,20],u=[20,0],h=i.wB?s.qp:s.z7,P=(0,a.X$)((e=>{let{isPasswordVisible:t,isBig:n}=e;const[i,P]=(0,c.Z)(!1),[Z,v]=(0,c.Z)(!1);(0,l.Z)(v,2e3);const p=(0,a.I4)(P,[P]);return a.ZP.createElement("div",{id:"monkey",className:n?"big":""},!i&&a.ZP.createElement("div",{className:"monkey-preview"}),a.ZP.createElement(o.Z,{size:n?s.K2:h,className:Z?"hidden":"shown",tgsUrl:r.l.MonkeyClose,playSegment:d,noLoop:!0,onLoad:p}),a.ZP.createElement(o.Z,{size:n?s.K2:h,className:Z?"shown":"hidden",tgsUrl:r.l.MonkeyPeek,playSegment:t?m:u,noLoop:!0}))}))},90710:(e,t,n)=>{n.d(t,{Z:()=>v});var a=n(14050),s=n(46752),i=n(83716),r=n(71394),o=n(59107),l=n(231),c=n(13103),d=n(34288);const m={type:"blob",quality:1,format:"jpeg",circle:!1,size:{width:1024,height:1024}};let u,h,P;const Z=(0,a.X$)((e=>{let{file:t,onChange:s,onClose:Z}=e;const[v,p]=(0,a.eJ)(!1);(0,a.d4)((()=>{t&&(v?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:n,offsetHeight:a}=t;P=new u(t,{enableZoom:!0,boundary:{width:n,height:a},viewport:{width:n-16,height:a-16,type:"circle"}});const s=await(0,r.YJ)(e);await P.bind({url:s})}catch(e){i.eM&&console.error(e)}}(t):async function(){return h||(h=Promise.all([n.e(5099),n.e(3472)]).then(n.bind(n,23472)),u=(await h).default),h}().then((()=>p(!0))))}),[t,v]);const g=(0,o.Z)(),E=(0,a.I4)((async()=>{if(!P)return;const e=await P.result(m),t="string"==typeof e?e:(0,r.hl)(e,"avatar.jpg");s(t)}),[s]);return a.ZP.createElement(c.Z,{isOpen:Boolean(t),onClose:Z,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},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:E,ariaLabel:g("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),v=(0,a.X$)((e=>{let{title:t="Change your profile picture",disabled:n,currentAvatarBlobUrl:i,onChange:r}=e;const[o,l]=(0,a.eJ)(),[c,d]=(0,a.eJ)(i);(0,a.d4)((()=>{d(i)}),[i]);const m=(0,a.I4)((e=>{l(void 0),r(e),c&&c!==i&&URL.revokeObjectURL(c),d(URL.createObjectURL(e))}),[c,i,r]),u=(0,a.I4)((()=>{l(void 0)}),[]),h=(0,s.Z)(c&&"filled",n&&"disabled");return a.ZP.createElement("div",{className:"AvatarEditable"},a.ZP.createElement("label",{className:h,role:"button",tabIndex:0,title:t},a.ZP.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(l(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),a.ZP.createElement("i",{className:"icon-camera-add"}),c&&a.ZP.createElement("img",{src:c,alt:"Avatar"})),a.ZP.createElement(Z,{file:o,onClose:u,onChange:m}))}))}}]);
//# sourceMappingURL=3779.c5f3d4ea7ae8e70486d2.js.map